* { box-sizing: border-box; }
body { margin: 0; font-family: -apple-system, "PingFang SC", "Microsoft YaHei", sans-serif; color: #222; background: #f5f6f8; line-height: 1.5; }
.topbar { display: flex; justify-content: space-between; align-items: center; padding: 12px 16px; background: #1f2937; color: #fff; }
.topbar h1 { margin: 0; font-size: 20px; }
.user-box { display: flex; gap: 10px; align-items: center; font-size: 14px; }
main { max-width: 1200px; margin: 0 auto; padding: 16px; }
.card { background: #fff; border: 1px solid #e5e7eb; border-radius: 8px; padding: 16px; }
.hidden { display: none !important; }
.msg { color: #374151; min-height: 1.2em; }
.msg.warn { color: #b91c1c; }
.hint { color: #6b7280; font-size: 13px; }
.empty { background: #fff; border: 1px dashed #d1d5db; border-radius: 8px; padding: 20px; text-align: center; color: #6b7280; }
button { cursor: pointer; padding: 8px 14px; border: 1px solid #d1d5db; border-radius: 6px; background: #fff; }
button:hover { background: #f3f4f6; }
input, select { padding: 8px; border: 1px solid #d1d5db; border-radius: 6px; width: 100%; }
label { display: block; margin: 10px 0; font-size: 14px; }
form button[type="submit"] { background: #2563eb; color: #fff; border-color: #2563eb; }
.tabs { display: flex; gap: 8px; margin-bottom: 12px; }
.tab, .mini-tab { padding: 9px 18px; border-radius: 8px 8px 0 0; }
.tab.active, .mini-tab.active { background: #2563eb; color: #fff; border-color: #2563eb; }
.tabs-mini { display: flex; gap: 8px; }
.view { background: #fff; border: 1px solid #e5e7eb; border-radius: 8px; padding: 16px; }
.toolbar { display: flex; flex-wrap: wrap; gap: 12px; align-items: center; margin-bottom: 12px; }
.toolbar label { margin: 0; display: flex; gap: 6px; align-items: center; }
.toolbar label input[type="checkbox"] { width: auto; }
.switch input { width: auto; }

/* 甘特图（条形时间轴）：每机一行，横向时间轴，可横向滚动 */
.chart-wrap { margin-bottom: 16px; }
.chart-legend { display: flex; flex-wrap: wrap; gap: 16px; align-items: center; margin: 8px 0; font-size: 13px; }
.legend-item { display: inline-flex; align-items: center; }
.legend-swatch { display: inline-block; width: 14px; height: 14px; border-radius: 3px; margin-right: 6px; }
.type-passenger { background: #2563eb; color: #fff; }
.type-ferry { background: #f59e0b; color: #111827; }
.type-other { background: #6b7280; color: #fff; }
.chart-scroll { overflow-x: auto; border: 1px solid #e5e7eb; border-radius: 8px; background: #fff; }
.chart-inner { position: relative; padding: 8px 0 12px; }
.chart-axis-row { display: flex; border-bottom: 1px solid #e5e7eb; }
.chart-axis-label { flex: 0 0 110px; }
.chart-axis { position: relative; flex: 1; height: 22px; font-size: 12px; color: #6b7280; }
.chart-day { position: absolute; top: 0; white-space: nowrap; }
.chart-row { display: flex; border-bottom: 1px solid #f1f1f1; }
.chart-row-label { flex: 0 0 110px; padding: 14px 8px; font-weight: bold; border-right: 1px solid #eee; background: #fff; position: sticky; left: 0; z-index: 2; }
.chart-row-main { flex: 1; min-width: 0; }
.chart-track { position: relative; height: 52px; background-image: linear-gradient(to right, #f1f1f1 1px, transparent 1px); background-size: 96px 100%; }
.chart-bar { position: absolute; top: 12px; height: 28px; border: none; padding: 0 6px; border-radius: 4px; text-align: left; overflow: visible; white-space: nowrap; font-size: 12px; line-height: 28px; }
.chart-bar-label { background: inherit; border-radius: 3px; padding: 0 4px; white-space: nowrap; }
.chart-pendings { display: flex; flex-wrap: wrap; gap: 8px; padding: 0 8px 10px; }
.chart-pending { background: #fef3c7; border: 1px dashed #d97706; color: #92400e; font-size: 12px; padding: 4px 10px; }
.gantt-today { position: absolute; top: 0; bottom: 0; width: 0; border-left: 2px dashed #dc2626; z-index: 1; }
/* 航段详情模态卡片 */
.modal { position: fixed; inset: 0; background: rgba(0, 0, 0, 0.45); display: flex; align-items: center; justify-content: center; z-index: 50; }
.modal-card { background: #fff; border-radius: 8px; padding: 20px; max-width: 520px; width: calc(100% - 40px); position: relative; }
.modal-card h3 { margin-top: 0; }
.modal-card p { margin: 6px 0; font-size: 14px; }
.modal-close { position: absolute; top: 8px; right: 8px; }

/* 明细表：日期 + 每机 计划/性质/机组 共 7 列，横向可滚动 */
.gantt-wrap { overflow-x: auto; }
.gantt { min-width: 900px; border: 1px solid #e5e7eb; border-radius: 8px; overflow: hidden; }
.g-row { display: grid; grid-template-columns: 110px 2.2fr 0.7fr 1.4fr 2.2fr 0.7fr 1.4fr; border-bottom: 1px solid #eee; }
.g-row > div { padding: 8px; border-right: 1px solid #f1f1f1; overflow-wrap: anywhere; }
.g-head { background: #f3f4f6; font-weight: bold; }
.g-date { font-weight: bold; white-space: nowrap; }
.plan-title { font-weight: bold; margin-bottom: 4px; }
.plan-leg { margin: 2px 0; }
.crew { margin: 2px 0; }
.local-note { font-size: 12px; color: #6b7280; margin-top: 4px; }
.list-item { border-bottom: 1px solid #eee; padding: 10px 0; }

/* 实时监控 */
#map { height: 480px; border: 1px solid #e5e7eb; border-radius: 8px; z-index: 0; }
.plane-icon { font-size: 24px; text-align: center; line-height: 28px; text-shadow: 0 0 3px #fff; }
.end-icon div { background: #2563eb; color: #fff; border-radius: 50%; width: 22px; height: 22px; line-height: 22px; text-align: center; font-size: 12px; font-weight: bold; }
.cards { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; margin: 12px 0; }
.cards .card p { margin: 4px 0; font-size: 14px; }
.cards .card h3 { margin: 0 0 8px; }
.seg { font-size: 13px; border-top: 1px dashed #e5e7eb; padding-top: 6px; margin-top: 6px; }
#chart { width: 100%; max-width: 900px; height: auto; border: 1px solid #e5e7eb; border-radius: 8px; background: #fff; }
.pending-row { display: flex; justify-content: space-between; align-items: center; gap: 12px; padding: 10px 0; border-bottom: 1px solid #eee; }

@media (max-width: 700px) {
  main { padding: 10px; }
  .topbar { flex-direction: column; align-items: flex-start; gap: 8px; }
  #map { height: 340px; }
  .cards { grid-template-columns: 1fr; }
  .tabs { overflow-x: auto; }
  .toolbar label { width: 100%; }
  .toolbar label input, .toolbar label select { flex: 1; }
}
