/* Turnaround monitor: dark operations theme, legible from a distance.
   Status colour is never the only signal: every state also has text. */
:root {
  --bg: #0a0f15;
  --bg-glow: #12273f;
  --surface: #111923;
  --surface-2: #17212d;
  --surface-3: #1f2b39;
  --line: #233142;
  --line-strong: #34465b;
  --text: #edf2f7;
  --text-2: #b4c2d0;
  --text-3: #8b9cae;
  --accent: #4fb3ff;
  --accent-ink: #03192b;
  --live: #3ddc97;
  --late: #ff7d73;
  --early: #4fd1c5;
  --remaining: #7cc4ff;
  --warn: #ffc65c;
  --danger: #ff8a8a;
  --radius-s: 6px;
  --radius: 10px;
  --radius-l: 14px;
  --shadow: 0 10px 30px #0009;
  color-scheme: dark;
  font-family: 'Noto Sans JP', 'Hiragino Sans', 'Hiragino Kaku Gothic ProN', 'Yu Gothic UI', 'Yu Gothic', Meiryo, system-ui, sans-serif;
  font-synthesis: none;
}

* { box-sizing: border-box; }
body {
  margin: 0;
  min-height: 100dvh;
  background: radial-gradient(1100px 420px at 15% -8%, var(--bg-glow) 0%, transparent 65%) no-repeat, var(--bg);
  color: var(--text);
  font-size: 18px;
  line-height: 1.5;
  /* Break Japanese at phrase boundaries where supported (lang="ja"). */
  word-break: auto-phrase;
}
button, input, select { font: inherit; }
button, a, input, select, canvas, summary, [tabindex] { outline-offset: 3px; }
button:focus-visible, a:focus-visible, input:focus-visible, select:focus-visible,
canvas:focus-visible, summary:focus-visible, [tabindex]:focus-visible { outline: 2px solid var(--accent); }
button, summary { cursor: pointer; }
button:disabled { cursor: default; opacity: .45; }
a { color: inherit; text-decoration: none; }
h1, h2, h3, p { margin: 0; }
h1, h2, h3 { font-feature-settings: 'palt'; letter-spacing: .02em; }
h1, h2 { font-size: 24px; font-weight: 700; }
h3 { font-size: 19px; font-weight: 650; }
small, .small { font-size: 15px; }
input, select {
  width: 100%;
  padding: 10px 12px;
  border: 1px solid var(--line-strong);
  border-radius: 8px;
  background: #0c131b;
  color: var(--text);
}
input:focus, select:focus { border-color: var(--accent); }
input[readonly] { color: var(--text-3); background: transparent; }
input::placeholder { color: var(--text-3); }
[hidden] { display: none !important; }
.muted { color: var(--text-2); }
.warning-text { color: var(--warn) !important; }
.danger-text { color: var(--danger) !important; }
.mono, time, .wall-clock, .expected-time, .schedule-delta { font-variant-numeric: tabular-nums; }
.icon { width: 1.1em; height: 1.1em; flex: none; }
.actions { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; }

/* Buttons */
.button {
  border: 1px solid transparent;
  border-radius: 8px;
  padding: 9px 16px;
  font-weight: 650;
  font-size: 16px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 7px;
  white-space: nowrap;
  transition: background-color .15s, border-color .15s, color .15s;
}
.button.primary { background: var(--accent); color: var(--accent-ink); }
.button.primary:hover:not(:disabled) { background: #7cc8ff; }
.button.secondary { background: var(--surface-2); border-color: var(--line-strong); color: var(--text); }
.button.secondary:hover:not(:disabled) { background: var(--surface-3); border-color: #4a6078; }
.button.quiet { background: transparent; color: var(--text-2); }
.button.quiet:hover:not(:disabled) { background: var(--surface-2); color: var(--text); }
.button.danger { background: #3d1f25; border-color: #7d3b44; color: #ffd2d2; }
.button.danger:hover:not(:disabled) { background: #552a32; }

/* Status pills: a dot plus text, so meaning never depends on colour alone. */
.pill {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  font-size: 15px;
  font-weight: 650;
  line-height: 1.3;
  padding: 4px 11px 4px 9px;
  border: 1px solid var(--line-strong);
  border-radius: 999px;
  background: var(--surface-2);
  color: var(--text-2);
  white-space: nowrap;
}
.pill-dot { width: 8px; height: 8px; border-radius: 50%; background: currentColor; flex: none; }
.pill.live { color: var(--live); background: #3ddc9714; border-color: #3ddc9750; }
.pill.live .pill-dot { animation: pulse-live 2s ease-out infinite; }
.pill.complete { color: #cfe3f7; background: #4fb3ff14; border-color: #4fb3ff45; }
.pill.complete .pill-dot { background: var(--accent); }
.pill.provisional { color: var(--warn); background: #ffc65c12; border-color: #ffc65c55; }
.pill.provisional .pill-dot { background: transparent; box-shadow: inset 0 0 0 2px currentColor; }
.pill.pending { color: var(--text-3); background: transparent; border-color: var(--line); }
.pill.pending .pill-dot { background: transparent; box-shadow: inset 0 0 0 1.5px currentColor; }
.pill.idle { color: var(--text-2); }
.pill.warning, .pill.warn { color: var(--warn); background: #ffc65c12; border-color: #ffc65c55; }
.pill.danger { color: var(--danger); background: #ff8a8a14; border-color: #ff8a8a55; }
.pill.accent { color: var(--accent); background: #4fb3ff14; border-color: #4fb3ff45; }

@keyframes pulse-live {
  0% { box-shadow: 0 0 0 0 #3ddc9799; }
  70% { box-shadow: 0 0 0 7px #3ddc9700; }
  100% { box-shadow: 0 0 0 0 #3ddc9700; }
}
@keyframes pulse-rec {
  0% { box-shadow: 0 0 0 0 #ff5a5acc; }
  70% { box-shadow: 0 0 0 6px #ff5a5a00; }
  100% { box-shadow: 0 0 0 0 #ff5a5a00; }
}

/* Top bar */
.topbar {
  position: relative;
  border-bottom: 1px solid var(--line);
  background: #0d141cdd;
  backdrop-filter: blur(8px);
}
.topbar::after {
  content: '';
  position: absolute;
  left: 0;
  right: 0;
  bottom: -1px;
  height: 2px;
  background: linear-gradient(90deg, var(--accent), var(--live) 35%, transparent 75%);
  opacity: .7;
}
.topbar-inner {
  max-width: 2100px;
  margin: auto;
  min-height: 64px;
  padding: 10px 28px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px 20px;
}
.brand { display: flex; align-items: center; gap: 12px; min-width: 0; flex: none; }
.brand-mark {
  width: 36px;
  height: 36px;
  border-radius: 10px;
  display: inline-grid;
  place-items: center;
  flex: none;
  color: var(--accent-ink);
  background: linear-gradient(135deg, #7cc8ff, var(--accent) 45%, #36d6a6);
  box-shadow: 0 4px 14px #4fb3ff40;
}
.brand-mark .icon { width: 22px; height: 22px; transform: rotate(45deg); }
.brand-text { display: flex; flex-direction: column; line-height: 1.2; min-width: 0; }
.brand-name { white-space: nowrap; font-weight: 700; font-size: 20px; font-feature-settings: 'palt'; letter-spacing: .03em; }
.brand-sub { font-size: 12px; color: var(--text-3); letter-spacing: .08em; white-space: nowrap; }
.brand-sub.brand-airport { font-size: 13px; font-weight: 650; color: var(--text-2); letter-spacing: .04em; }
.topbar-right { display: flex; gap: 18px; align-items: center; font-size: 15px; margin-left: auto; flex: none; white-space: nowrap; }
.wall-clock { font-size: 17px; font-weight: 600; color: var(--text); }
.connection {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  color: var(--live);
  white-space: nowrap;
  padding: 4px 11px;
  border-radius: 999px;
  background: #3ddc9712;
  border: 1px solid #3ddc9740;
}
.connection-dot { width: 8px; height: 8px; border-radius: 50%; background: currentColor; animation: pulse-live 2.4s ease-out infinite; }
.connection.stale { color: var(--warn); background: #ffc65c14; border-color: #ffc65c55; }
.connection.stale .connection-dot { animation: none; }
.identity { color: var(--text-3); }

/* Page layout */
.main { max-width: 2100px; margin: auto; padding: 22px 28px 40px; }
.page-heading { display: flex; align-items: center; justify-content: space-between; margin-bottom: 14px; gap: 16px; }
.page-heading .muted { font-size: 16px; }
.title-line { display: flex; align-items: center; gap: 14px; min-width: 0; }
.connection-banner {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 12px 16px;
  margin-bottom: 16px;
  border: 1px solid #ffc65c80;
  border-radius: var(--radius);
  background: #3a2e1a;
  color: #ffe2a8;
  font-size: 17px;
}

/* Empty states */
.empty-state {
  width: 100%;
  border: 1px dashed var(--line-strong);
  border-radius: var(--radius-l);
  background: #ffffff04;
  padding: 26px 28px;
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 20px;
}
.empty-title { font-size: 19px; font-weight: 650; margin-bottom: 4px; }

/* Workspace */
.workspace-head { display: flex; justify-content: space-between; gap: 20px; align-items: center; margin-bottom: 14px; }
.workspace-title { min-width: 0; display: flex; flex-direction: column; gap: 4px; }
.workspace-head h2 { font-size: 28px; overflow-wrap: anywhere; }
.gate-meta { display: flex; align-items: center; gap: 7px; font-size: 14px; color: var(--text-3); }
.gate-meta:empty { display: none; }
.panel { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius-l); padding: 18px 20px; }
.panel h3 { font-size: 17px; color: var(--text-2); }
.section-heading { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin-bottom: 12px; }

/* Monitor: video overlay and the steps in progress. */
.video-overlay {
  position: absolute;
  top: 10px;
  left: 12px;
  right: 12px;
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 8px;
  pointer-events: none;
}
.video-chip {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  font-size: 14px;
  font-weight: 600;
  padding: 3px 10px;
  border-radius: 999px;
  color: #e8eef5;
  background: #000000b3;
  border: 1px solid #ffffff1f;
  backdrop-filter: blur(4px);
}
.video-chip.live::before {
  content: '';
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: #ff5a5a;
  animation: pulse-rec 2s ease-out infinite;
}
.video-chip.recorded::before { content: ''; width: 8px; height: 8px; border-radius: 2px; background: var(--remaining); }
.video-chip.warning { color: var(--warn); border-color: #ffc65c66; }
.summary-heading { display: flex; justify-content: space-between; align-items: center; gap: 12px; }
.summary-heading h3 { font-size: 18px; color: var(--text-2); }
.analysis-freshness { display: flex; flex-wrap: wrap; gap: 6px 12px; align-items: center; font-size: 16px; }
.freshness-chip { color: var(--text-2); background: var(--surface-3); border-radius: 999px; padding: 3px 12px; }
.freshness-chip strong { color: var(--text); font-weight: 650; }
.analysis-lag { font-size: 21px; font-weight: 700; font-variant-numeric: tabular-nums; }
.current-steps {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
  gap: 10px;
  overflow-y: auto;
  min-height: 0;
  max-height: 17dvh;
}
.current-step {
  --proc: var(--accent);
  position: relative;
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 12px;
  padding: 9px 14px 9px 18px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  overflow: hidden;
  background: var(--surface-2);
  background: linear-gradient(90deg, color-mix(in srgb, var(--proc) 18%, transparent), transparent 75%), var(--surface-2);
}
.current-step::before { content: ''; position: absolute; left: 0; top: 0; bottom: 0; width: 5px; background: var(--proc); }
.current-step-main { min-width: 0; }
.current-step-name { display: block; font-size: 22px; line-height: 1.3; font-feature-settings: 'palt'; }
.current-step small { display: block; font-size: 14px; }
.current-step .schedule-delta { align-items: flex-end; white-space: nowrap; }

/* Schedule deltas: sign + text label, colour reinforces. */
.schedule-delta { display: flex; flex-direction: column; line-height: 1.15; }
.schedule-delta strong { font-size: 30px; font-weight: 750; letter-spacing: -.01em; }
.schedule-delta small { font-size: 14px; margin-top: 3px; font-weight: 600; }
.schedule-delta.none { color: var(--text-3); }
.schedule-delta.none strong { font-weight: 400; }
.schedule-delta.late { color: var(--late); }
.schedule-delta.early { color: var(--early); }
.schedule-delta.remaining { color: var(--remaining); }
.schedule-delta.on-time { color: var(--text); }

/* Results */
.results-panel { margin-top: 18px; }
.results-label { margin-top: -4px; }
.tabs { display: flex; gap: 3px; background: var(--bg); border: 1px solid var(--line); padding: 3px; border-radius: 999px; }
.button.tab { padding: 6px 14px; border-radius: 999px; color: var(--text-2); background: transparent; font-size: 15px; }
.button.tab:hover { color: var(--text); }
.button.tab.active { color: var(--text); background: var(--surface-3); box-shadow: 0 1px 3px #0008; }
.proc-dot {
  display: inline-block;
  width: 10px;
  height: 10px;
  margin-right: 10px;
  border-radius: 3px;
  vertical-align: .08em;
  background: var(--proc);
  box-shadow: 0 0 0 3px color-mix(in srgb, var(--proc) 22%, transparent);
}
.no-value { color: var(--text-3); }
.expected-time { font-size: 18px; color: #c5d1dd; }
.empty-results { padding: 40px 10px; text-align: center; color: var(--text-2); font-size: 18px; }

/* Timeline: planned windows (dashed) and observed intervals (solid) on one axis. */
.results-controls { display: flex; flex-wrap: wrap; gap: 8px 10px; justify-content: flex-end; }
.gantt { margin-top: 14px; overflow-x: auto; }
.gantt-inner { min-width: 760px; }
.gantt-scale, .gantt-row { display: grid; grid-template-columns: 220px minmax(0, 1fr); align-items: center; }
.gantt-ticks { position: relative; height: 26px; }
.gantt-tick {
  position: absolute;
  bottom: 4px;
  transform: translateX(-50%);
  font-size: 13px;
  color: var(--text-3);
  font-variant-numeric: tabular-nums;
  white-space: nowrap;
}
.gantt-row { --proc: var(--text-3); border-top: 1px solid var(--line); }
.gantt-row:hover { background: #ffffff05; }
.gantt-label { font-size: 17px; font-weight: 650; padding: 7px 12px 7px 4px; overflow-wrap: anywhere; font-feature-settings: 'palt'; }
.gantt-row.pending .gantt-label { color: var(--text-2); font-weight: 500; }
.gantt-row.pending .proc-dot { opacity: .45; box-shadow: none; }
.gantt-track { position: relative; height: 40px; }
.gantt-grid { position: absolute; top: 0; bottom: 0; width: 1px; background: var(--line); }
.gantt-plan {
  position: absolute;
  top: 8px;
  bottom: 8px;
  min-width: 2px;
  border: 1.5px dashed color-mix(in srgb, var(--proc) 80%, transparent);
  border-radius: 6px;
  background: color-mix(in srgb, var(--proc) 10%, transparent);
}
.gantt-actual {
  position: absolute;
  top: 13px;
  bottom: 13px;
  min-width: 4px;
  border-radius: 4px;
  background: var(--proc);
  box-shadow: 0 0 12px color-mix(in srgb, var(--proc) 45%, transparent);
}
.gantt-actual.ongoing {
  border-radius: 4px 0 0 4px;
  background: linear-gradient(90deg, var(--proc) 65%, color-mix(in srgb, var(--proc) 20%, transparent));
}
.gantt-actual.estimated::after {
  content: '';
  position: absolute;
  right: -2px;
  top: -5px;
  bottom: -5px;
  border-right: 2px dashed var(--text);
}
.gantt-plan-mark, .gantt-mark, .gantt-sighting {
  position: absolute;
  top: 50%;
  width: 13px;
  height: 13px;
  transform: translate(-50%, -50%) rotate(45deg);
}
.gantt-plan-mark { border: 1.5px dashed var(--proc); }
.gantt-mark { background: var(--proc); box-shadow: 0 0 0 2px var(--surface); }
.gantt-sighting { border: 2.5px solid var(--proc); border-radius: 50%; transform: translate(-50%, -50%); background: var(--surface); }
.gantt-now { position: absolute; top: 0; bottom: 0; width: 2px; margin-left: -1px; background: var(--live); opacity: .9; }
.gantt-legend { display: flex; flex-wrap: wrap; gap: 6px 18px; padding: 12px 4px 2px; border-top: 1px solid var(--line); font-size: 14px; color: var(--text-2); }
.gantt-key { display: inline-flex; align-items: center; gap: 7px; }
.gantt-swatch { --proc: var(--accent); position: relative; display: inline-block; width: 22px; height: 12px; flex: none; }
.gantt-swatch.plan { border: 1.5px dashed var(--proc); border-radius: 4px; background: color-mix(in srgb, var(--proc) 10%, transparent); }
.gantt-swatch.actual { height: 8px; border-radius: 3px; background: var(--proc); }
.gantt-swatch.ongoing { height: 8px; border-radius: 3px 0 0 3px; background: linear-gradient(90deg, var(--proc) 55%, transparent); }
.gantt-swatch.estimated { height: 8px; border-radius: 3px; background: var(--proc); border-right: 2px dashed var(--text); }
.gantt-swatch.mark { width: 10px; height: 10px; margin: 0 6px; transform: rotate(45deg); background: var(--proc); }
.gantt-swatch.sighting { width: 11px; height: 11px; margin: 0 5px; border: 2.5px solid var(--proc); border-radius: 50%; }
.gantt-swatch.now { width: 2px; height: 16px; margin: 0 10px; background: var(--live); }

/* Details sidebar */
.session-stats { display: grid; grid-template-columns: 1fr auto; gap: 10px 14px; margin: 14px 0 0; font-size: 15px; }
.session-stats dt { color: var(--text-3); }
.session-stats dd { margin: 0; text-align: right; font-variant-numeric: tabular-nums; }
.history-list { display: flex; flex-direction: column; gap: 4px; max-height: 340px; overflow: auto; }
.history-item {
  display: flex;
  align-items: center;
  gap: 12px;
  text-align: left;
  border: 1px solid transparent;
  border-radius: 8px;
  background: transparent;
  color: var(--text);
  padding: 9px 10px;
  width: 100%;
}
.history-item:hover { background: var(--surface-2); }
.history-item.selected { background: #17324c; border-color: #2f5577; }
.history-text { min-width: 0; }
.history-item strong { display: block; font-size: 16px; font-weight: 600; font-variant-numeric: tabular-nums; }
.history-item small { display: block; color: var(--text-2); font-size: 14px; margin-top: 2px; }
.history-dot { width: 9px; height: 9px; border-radius: 50%; flex: none; box-shadow: inset 0 0 0 2px var(--text-3); }
.history-dot.live { background: #ff5a5a; box-shadow: none; }
.history-dot.running { background: var(--live); box-shadow: none; animation: pulse-live 2s ease-out infinite; }

/* Login, boot and dialogs */
.boot { padding: 100px 20px; color: var(--text-2); text-align: center; }
.login {
  max-width: 470px;
  width: calc(100% - 32px);
  margin: 13vh auto;
  padding: 40px 36px 36px;
  text-align: center;
  border: 1px solid var(--line);
  border-radius: 18px;
  background: linear-gradient(180deg, #152131, var(--surface));
  box-shadow: var(--shadow);
}
.login .brand-mark { width: 60px; height: 60px; border-radius: 16px; margin-bottom: 20px; }
.login .brand-mark .icon { width: 34px; height: 34px; }
.login h1 { font-size: 28px; line-height: 1.4; margin-bottom: 10px; }
.login-description { margin-bottom: 28px; }
.login > .button { padding: 12px 24px; min-width: 200px; }
.login > .form-error { margin-top: 20px; text-align: left; }
.dialog-head { display: flex; align-items: flex-start; justify-content: space-between; gap: 20px; margin-bottom: 8px; }
.icon-button { border: 0; border-radius: 8px; background: transparent; color: var(--text-2); font-size: 28px; line-height: 1; padding: 4px 10px; }
.icon-button:hover { background: var(--surface-2); color: var(--text); }
.field { display: block; margin: 18px 0; }
.field > span { display: block; font-size: 16px; font-weight: 600; margin-bottom: 7px; color: var(--text-2); }
.crop-hint { margin: -4px 0 10px; }
.crop-preview { background: #070b10; border: 1px solid var(--line); border-radius: var(--radius); overflow: hidden; }
.crop-placeholder { padding: 46px 25px; color: var(--text-2); text-align: center; font-size: 16px; }
.crop-canvas { display: block; width: 100%; height: auto; max-height: 32vh; object-fit: contain; touch-action: none; cursor: crosshair; }
.crop-numbers { display: grid; grid-template-columns: repeat(4, 1fr); gap: 10px; margin: 12px 0; }
.crop-number span { display: block; font-size: 14px; color: var(--text-3); margin-bottom: 5px; }
.crop-number input { padding: 9px; }
.crop-preview + p { margin-top: 10px; }
.dialog-footer { display: flex; justify-content: flex-end; gap: 10px; margin-top: 22px; border-top: 1px solid var(--line); padding-top: 20px; }
.form-error { color: var(--danger); font-size: 16px; white-space: pre-line; }
.form-error:empty { display: none; }

/* Notifications */
#notifications {
  position: fixed;
  bottom: 25px;
  right: 25px;
  display: flex;
  flex-direction: column;
  gap: 10px;
  z-index: 100;
  max-width: min(500px, calc(100vw - 50px));
}
.notification {
  padding: 14px 18px 14px 20px;
  border: 1px solid #3f7d68;
  border-left: 5px solid var(--live);
  border-radius: var(--radius);
  background: #17322a;
  color: #e1fff3;
  box-shadow: var(--shadow);
  font-size: 17px;
}
.notification.error { border-color: #8c5560; border-left-color: var(--danger); background: #3f252c; color: #ffdcdf; }

/* Wall displays */
@media (min-width: 1800px) {
  body { font-size: 20px; }
  .current-step-name { font-size: 25px; }
  .schedule-delta strong, .current-step .schedule-delta strong { font-size: 34px; }
  .gantt-label { font-size: 20px; }
  .gantt-track { height: 46px; }
  .gantt-scale, .gantt-row { grid-template-columns: 270px minmax(0, 1fr); }
  .expected-time { font-size: 21px; }
  .button { font-size: 18px; }
  .pill { font-size: 16px; }
}

/* The top bar stays one row while it fits: tab icons go first, then the
   connection label (the dot stays, with the label as its tooltip). */
@media (max-width: 1560px) {
  .module-tab { padding: 8px 11px; }
  .module-tab .icon { display: none; }
  .topbar-right { gap: 12px; }
}
/* Seven tabs (an airport with every module, 場周点検 included) still fit one row down to 1280 px. */
@media (max-width: 1440px) {
  .topbar .module-tabs { gap: 2px; }
  .topbar .module-tab { padding: 8px 9px; font-size: 14px; }
}
@media (max-width: 1320px) {
  .topbar-inner { padding-inline: 20px; gap: 12px 14px; }
  .connection { padding: 6px; }
  .connection > span:not(.connection-dot) { position: absolute; width: 1px; height: 1px; overflow: hidden; clip-path: inset(50%); white-space: nowrap; }
  .wall-clock { font-size: 15px; }
}
@media (max-width: 1150px) {
  .topbar-inner { flex-wrap: wrap; }
  .identity, .brand-sub:not(.brand-airport) { display: none; }
  .module-tabs { order: 10; flex-basis: 100%; }
  .module-tab .icon { display: inline; }
  .session-stats { grid-template-columns: 1fr 1fr 1fr 1fr; }
  .current-step-name { font-size: 20px; }
  .analysis-freshness { font-size: 15px; }
  .analysis-lag { font-size: 19px; }
}

@media (max-width: 650px) {
  body { font-size: 17px; }
  .main { padding: 16px 12px 30px; }
  .topbar-inner { padding: 10px 12px; gap: 10px; min-height: 56px; }
  .brand { gap: 9px; }
  .brand-mark { width: 30px; height: 30px; border-radius: 8px; }
  .brand-mark .icon { width: 18px; height: 18px; }
  .brand-name { font-size: 16px; }
  .topbar-right { gap: 6px; flex-wrap: wrap; justify-content: flex-end; font-size: 13px; }
  .wall-clock, .identity { display: none; }
  .connection { padding: 3px 8px; }
  .topbar-right .button { font-size: 13px; padding: 5px 8px; }
  .topbar-right .button .icon { display: none; }
  .topbar-right .user-menu summary .icon { display: inline; }
  .user-role { display: none; }
  .module-tab { padding: 7px 10px; font-size: 14px; }
  .overview-map .map-frame { height: 46dvh; min-height: 260px; }
  .airport-grid { grid-template-columns: 1fr; }
  .page-heading { gap: 10px; }
  .page-heading .title-line { flex-direction: column; align-items: flex-start; gap: 2px; }
  .page-heading h1 { font-size: 21px; }
  .page-heading .muted { font-size: 14px; }
  .page-heading > .button { padding: 8px 12px; }
  .workspace-head { flex-direction: column; align-items: flex-start; gap: 10px; }
  .workspace-head > .actions { justify-content: space-between; width: 100%; gap: 4px; }
  .workspace-head .button { font-size: 14px; padding: 8px 10px; }
  .workspace-head .actions { gap: 5px; }
  .workspace-head h2 { font-size: 22px; }
  .video-overlay { top: 6px; left: 8px; right: 8px; }
  .video-chip { font-size: 12px; padding: 2px 8px; }
  .summary-heading { flex-direction: column; align-items: flex-start; gap: 4px; }
  .summary-heading h3 { font-size: 16px; }
  .analysis-freshness { font-size: 13px; gap: 4px 8px; }
  .analysis-lag { font-size: 16px; }
  .current-steps { display: flex; overflow-x: auto; overflow-y: auto; max-height: 12dvh; }
  .current-step { flex: 0 0 240px; padding: 7px 10px 7px 14px; }
  .current-step-name { font-size: 18px; }
  .current-step .schedule-delta strong { font-size: 26px; }
  .current-step small { font-size: 12px; }
  .current-steps > p { font-size: 15px; }
  .results-panel { padding: 14px 10px; }
  .results-panel > .section-heading { align-items: flex-start; flex-direction: column; }
  .results-controls { justify-content: flex-start; }
  .gantt-scale, .gantt-row { grid-template-columns: 150px minmax(0, 1fr); }
  .gantt-label { font-size: 15px; }
  .results-panel h3 { font-size: 18px; }
  .button.tab { font-size: 14px; padding: 7px 10px; }
  .results-panel > .small { font-size: 13px; }
  .session-stats { grid-template-columns: 1fr auto; }
  .empty-state { flex-direction: column; align-items: flex-start; padding: 20px; }
  .crop-numbers { gap: 6px; }
  .crop-number input { padding: 7px; }
  .login { margin: 10vh auto; padding: 30px 22px; }
  .login h1 { font-size: 25px; }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation: none !important; transition: none !important; }
}

/* Portal shell: module tabs, user menu */
.module-tabs { display: flex; gap: 4px; min-width: 0; flex: 1 1 auto; overflow-x: auto; scrollbar-width: thin; }
.module-tab {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  padding: 8px 14px;
  border-radius: 8px;
  color: var(--text-2);
  font-size: 15px;
  font-weight: 650;
  white-space: nowrap;
  border: 1px solid transparent;
}
.module-tab:hover { color: var(--text); background: var(--surface-2); }
.module-tab.active { color: var(--text); background: #17324c; border-color: var(--accent); }
.user-menu { position: relative; }
.user-menu summary { list-style: none; display: inline-flex; align-items: center; gap: 7px; }
.user-menu summary::-webkit-details-marker { display: none; }
.user-menu-panel {
  position: absolute;
  right: 0;
  top: calc(100% + 8px);
  z-index: 1000;
  min-width: 240px;
  display: flex;
  flex-direction: column;
  align-items: stretch;
  gap: 8px;
  padding: 14px;
  border: 1px solid var(--line-strong);
  border-radius: var(--radius);
  background: var(--surface);
  box-shadow: var(--shadow);
}
.user-menu-panel .button { justify-content: flex-start; }
.user-menu-role { font-weight: 700; }
.user-menu-panel .identity { overflow-wrap: anywhere; }
.demo-chip {
  padding: 3px 10px;
  border-radius: 999px;
  font-size: 13px;
  font-weight: 700;
  color: #1b1300;
  background: var(--warn);
  white-space: nowrap;
}

/* Airport picker and page states */
.demo-notice {
  display: flex;
  gap: 12px;
  align-items: flex-start;
  margin: 0 0 18px;
  padding: 12px 16px;
  border: 1px solid #ffc65c66;
  border-left: 4px solid var(--warn);
  border-radius: var(--radius);
  background: #ffc65c12;
  color: var(--text);
}
.demo-notice .icon { flex: none; width: 20px; height: 20px; margin-top: 2px; color: var(--warn); }
.demo-notice p { margin: 0; display: flex; flex-wrap: wrap; gap: 2px 8px; line-height: 1.6; }
.airport-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(240px, 1fr)); gap: 12px; }
.airport-grid.compact { grid-template-columns: repeat(auto-fill, minmax(170px, 1fr)); margin-top: 12px; }
.airport-card {
  display: flex;
  flex-direction: column;
  gap: 10px;
  padding: 16px 18px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--surface);
}
.airport-card:hover { border-color: var(--accent); background: var(--surface-2); }
.airport-card-name { font-size: 20px; font-weight: 700; }
.airport-card-modules { display: flex; flex-wrap: wrap; gap: 6px; }
.chip { padding: 2px 9px; border-radius: 999px; font-size: 13px; color: var(--text-2); background: var(--surface-3); }
.other-airports { margin-top: 22px; }
.other-airports summary { color: var(--text-2); font-weight: 650; }
.page-state { margin-top: 8px; }

/* Overview and settings */
.overview-grid { display: grid; grid-template-columns: minmax(0, 1fr) 340px; gap: 16px; align-items: start; }
.overview-map { padding: 0; overflow: hidden; }
.overview-map .map-frame { height: min(68dvh, 720px); min-height: 320px; }
.module-cards { display: flex; flex-direction: column; gap: 10px; margin-top: 12px; }
.module-card {
  display: flex;
  gap: 12px;
  align-items: center;
  padding: 12px 14px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--surface-2);
}
.module-card:hover { border-color: var(--accent); }
.module-card-icon { display: inline-grid; place-items: center; width: 38px; height: 38px; border-radius: 10px; background: #17324c; color: var(--accent); flex: none; }
.module-card-text { display: flex; flex-direction: column; min-width: 0; }
.settings-section { max-width: 760px; margin-bottom: 16px; display: flex; flex-direction: column; gap: 10px; }
.module-toggles { display: flex; flex-wrap: wrap; gap: 10px 22px; }
.module-toggle { display: inline-flex; align-items: center; gap: 8px; font-weight: 600; }
.module-toggle input { width: 20px; height: 20px; }
@media (max-width: 1000px) { .overview-grid { grid-template-columns: minmax(0, 1fr); } }

/* Map (Leaflet controls in the dark theme) */
.map-frame { width: 100%; background: #0c131b; }
.map-error { padding: 20px; }
.map-controls { display: flex; flex-direction: column; gap: 4px; }
.map-controls button, .map-compass {
  width: 36px;
  height: 36px;
  display: inline-grid;
  place-items: center;
  color: var(--text);
  background: #111923e6;
  border: 1px solid var(--line-strong);
  border-radius: 8px;
}
.map-compass-needle { display: inline-grid; place-items: center; transition: transform .2s; }
.map-layer-switch { display: flex; gap: 4px; padding: 4px; background: #111923e6; border: 1px solid var(--line-strong); border-radius: 10px; }
.map-layer-switch .button { padding: 5px 10px; font-size: 13px; }
.map-layer-switch .button.active { background: #17324c; border-color: var(--accent); color: var(--text); }
.leaflet-container { font: inherit; background: #0c131b; }
.leaflet-control-attribution { background: #0a0f15cc !important; color: var(--text-2) !important; font-size: 11px; }
.leaflet-control-attribution a { color: var(--accent) !important; }
.leaflet-control-scale-line { background: #0a0f15cc; color: var(--text); border-color: var(--text-2); }

/* Mock video canvas replaces the <video> element */
.mock-video { width: 100%; height: 100%; object-fit: contain; display: block; background: #000; }

/* Shared components (components/ui.js) */
.tiles { display: grid; grid-template-columns: repeat(auto-fit, minmax(170px, 1fr)); gap: 12px; margin-bottom: 16px; }
.tile {
  display: flex;
  flex-direction: column;
  gap: 2px;
  padding: 14px 16px;
  border: 1px solid var(--line);
  border-radius: var(--radius-l);
  background: var(--surface);
  min-width: 0;
}
a.tile:hover { border-color: var(--line-strong); background: var(--surface-2); }
.tile-label { font-size: 15px; color: var(--text-2); font-weight: 600; }
.tile-value { font-size: 30px; line-height: 1.2; font-variant-numeric: tabular-nums; }
.tile.warn .tile-value { color: var(--warn); }
.tile.danger .tile-value { color: var(--danger); }
.tile.live .tile-value { color: var(--live); }
.tile.accent .tile-value { color: var(--accent); }
.badge {
  display: inline-block;
  padding: 1px 8px;
  border-radius: 6px;
  font-size: 13px;
  font-weight: 700;
  line-height: 1.5;
  white-space: nowrap;
  color: var(--text-2);
  background: var(--surface-3);
  border: 1px solid var(--line-strong);
}
.badge.live { color: #04261a; background: var(--live); border-color: transparent; }
.badge.warn { color: #2a1d00; background: var(--warn); border-color: transparent; }
.badge.danger { color: #2c0606; background: var(--danger); border-color: transparent; }
.badge.accent { color: var(--accent-ink); background: var(--accent); border-color: transparent; }
.badge.outline { background: transparent; }
.table-scroll { overflow-x: auto; border: 1px solid var(--line); border-radius: var(--radius-l); background: var(--surface); }
.data-table { width: 100%; border-collapse: collapse; font-size: 16px; }
.data-table th, .data-table td { padding: 11px 14px; text-align: left; border-bottom: 1px solid var(--line); white-space: nowrap; }
.data-table thead th { font-size: 14px; color: var(--text-3); font-weight: 650; letter-spacing: .04em; background: var(--surface-2); position: sticky; top: 0; }
.data-table tbody tr:last-child td { border-bottom: 0; }
.data-table tr.clickable { cursor: pointer; }
.data-table tr.clickable:hover, .data-table tr.clickable:focus-visible { background: var(--surface-2); }
.data-table .numeric { text-align: right; font-variant-numeric: tabular-nums; }
.data-table td.wrap { white-space: normal; min-width: 180px; }
.empty-state.compact { padding: 18px 20px; }
.progress { display: inline-block; position: relative; width: 120px; height: 8px; border-radius: 999px; background: var(--surface-3); overflow: hidden; vertical-align: middle; }
.progress-fill { position: absolute; inset: 0 auto 0 0; background: var(--accent); border-radius: inherit; }
.progress.indeterminate .progress-fill { width: 30% !important; animation: progress-slide 1.4s ease-in-out infinite; }
@keyframes progress-slide { from { left: -30%; } to { left: 100%; } }
.app-dialog {
  color: var(--text);
  background: var(--surface);
  border: 1px solid var(--line-strong);
  border-radius: 16px;
  padding: 24px 26px;
  width: min(720px, calc(100% - 32px));
  max-height: 90dvh;
  box-shadow: 0 24px 60px #000c;
}
.app-dialog.wide { width: min(1100px, calc(100% - 32px)); }
.app-dialog::backdrop { background: #000a; }
.app-dialog .dialog-body { margin-top: 8px; }
.demo-controls { display: flex; flex-direction: column; gap: 8px; padding: 10px 0; border-top: 1px solid var(--line); border-bottom: 1px solid var(--line); }
.demo-controls .field { margin: 0; }
.demo-controls .field > span { font-size: 13px; margin-bottom: 4px; }
.demo-controls select { padding: 6px 8px; font-size: 15px; }
