/* KLM OCC — light, modern operations theme */
:root {
  --bg: #f4f6fb;
  --bg-soft: #eef1f8;
  --panel: #ffffff;
  --panel-2: #f4f7fc;
  --line: #e4e9f2;
  --text: #17233c;
  --muted: #64748b;
  --accent: #0b7bc8;      /* KLM-leaning blue, accessible on white */
  --accent-strong: #0a6cb0;
  --accent-soft: #e3f2fd;
  --ok: #0d9e6e;
  --warn: #c77414;
  --bad: #d6403c;
  --wb: #5b6ee1;          /* widebody */
  --nb: #0e9fd8;          /* narrowbody */
  --rj: #12b981;          /* regional / cityhopper */
  --radius: 12px;
  --shadow: 0 1px 2px rgba(16, 24, 40, 0.05), 0 4px 16px rgba(16, 24, 40, 0.05);
  --font: system-ui, -apple-system, 'Segoe UI', Roboto, 'Helvetica Neue', sans-serif;
  --mono: ui-monospace, 'SF Mono', 'Cascadia Mono', 'JetBrains Mono', Consolas, monospace;
}

* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0;
  background: var(--bg);
  background-image: radial-gradient(900px 320px at 75% -120px, #e2edf9 0%, transparent 65%);
  color: var(--text);
  font-family: var(--font);
  font-size: 15px;
  line-height: 1.5;
}
a { color: var(--accent); text-decoration: none; }
a:hover { text-decoration: underline; }
h1 { font-size: 1.5rem; margin: 0 0 2px; letter-spacing: -0.015em; font-weight: 700; }
h2 { font-size: 1.02rem; margin: 0; font-weight: 650; }
.mono { font-family: var(--mono); font-variant-numeric: tabular-nums; }
.strong { font-weight: 600; }
.muted { color: var(--muted); font-size: 0.86em; }

/* top bar */
.topbar {
  position: sticky; top: 0; z-index: 50;
  background: rgba(255, 255, 255, 0.88);
  backdrop-filter: blur(10px);
  border-bottom: 1px solid var(--line);
}
.topbar-inner {
  max-width: 1500px; margin: 0 auto; padding: 10px 20px;
  display: flex; align-items: center; gap: 20px;
}
.brand { display: flex; align-items: center; gap: 10px; color: var(--text); }
.brand:hover { text-decoration: none; }
.brand-mark {
  background: linear-gradient(135deg, #0b7bc8, #2ba7e8);
  color: #fff; font-weight: 800; letter-spacing: 0.06em;
  padding: 3px 9px; border-radius: 8px; font-size: 0.95rem;
}
.brand-name { font-weight: 650; font-size: 0.95rem; }
.nav { display: flex; gap: 4px; margin-left: auto; }
.nav a {
  color: var(--muted); padding: 7px 13px; border-radius: 9px; font-weight: 550; font-size: 0.93rem;
}
.nav a:hover { color: var(--text); text-decoration: none; background: var(--bg-soft); }
.nav a.active { color: var(--accent-strong); background: var(--accent-soft); }
.clock {
  font-family: var(--mono); font-size: 1.12rem; font-weight: 650;
  color: var(--accent-strong); letter-spacing: 0.04em; white-space: nowrap;
}
.clock-z { color: var(--muted); font-size: 0.75em; margin-left: 2px; }

/* layout */
.page { max-width: 1500px; margin: 0 auto; padding: 26px 20px 60px; }
.page-head {
  display: flex; align-items: flex-end; justify-content: space-between;
  gap: 16px; flex-wrap: wrap; margin-bottom: 20px;
}
.sub { color: var(--muted); margin: 0; font-size: 0.92rem; }
.footer {
  border-top: 1px solid var(--line); color: var(--muted);
  font-size: 0.82rem; text-align: center; padding: 18px; background: #fff;
}

.btn {
  display: inline-block; background: var(--accent); color: #fff;
  font-weight: 600; padding: 9px 16px; border-radius: 9px; border: 0;
  font-size: 0.92rem; cursor: pointer; box-shadow: var(--shadow);
}
.btn:hover { text-decoration: none; background: var(--accent-strong); }
.btn-ghost { background: #fff; color: var(--accent-strong); border: 1px solid var(--line); }
.btn-ghost:hover { background: var(--bg-soft); }

/* KPI cards */
.kpi-grid {
  display: grid; grid-template-columns: repeat(auto-fill, minmax(160px, 1fr));
  gap: 12px; margin-bottom: 22px;
}
.kpi {
  background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius);
  padding: 14px 16px; box-shadow: var(--shadow);
}
.kpi-warn { border-color: #f3ce8d; background: linear-gradient(180deg, #fff9ee, #fff); }
.kpi-value { font-family: var(--mono); font-size: 1.7rem; font-weight: 700; line-height: 1.15; }
.kpi-unit { font-size: 0.55em; color: var(--muted); font-weight: 500; margin-left: 3px; }
.kpi-label { color: var(--muted); font-size: 0.82rem; margin-top: 2px; }
.kpi-bar { height: 5px; background: var(--bg-soft); border-radius: 3px; margin-top: 9px; overflow: hidden; }
.kpi-bar span { display: block; height: 100%; background: linear-gradient(90deg, var(--accent), var(--ok)); }

/* panels */
.panel {
  background: var(--panel); border: 1px solid var(--line);
  border-radius: var(--radius); padding: 16px 18px; margin-bottom: 18px;
  box-shadow: var(--shadow);
}
.panel-head {
  display: flex; align-items: center; justify-content: space-between;
  gap: 12px; margin-bottom: 10px;
}
.grid-2 { display: grid; grid-template-columns: 1fr 1fr; gap: 18px; }
.hint { color: var(--muted); font-size: 0.88rem; margin: 4px 0 12px; }
.facts { margin: 0; display: grid; gap: 10px; }
.facts div { display: grid; grid-template-columns: 190px 1fr; gap: 10px; }
.facts dt { color: var(--muted); font-size: 0.88rem; }
.facts dd { margin: 0; font-size: 0.92rem; }

.pill { font-size: 0.8rem; font-weight: 650; padding: 3px 11px; border-radius: 999px; white-space: nowrap; }
.pill-ok { background: #e4f7ef; color: #0b7a56; }
.pill-warn { background: #fdf1de; color: #a3610f; }

.tag {
  display: inline-block; font-size: 0.72rem; font-weight: 650; letter-spacing: 0.03em;
  padding: 2px 8px; border-radius: 6px; text-transform: uppercase;
}
.tag-widebody { background: #e8ebfd; color: #4353c4; }
.tag-narrowbody { background: #e1f3fb; color: #0b6d99; }
.tag-regional { background: #e2f7ee; color: #0b7a56; }
.tag-reserve { background: #fdf1de; color: #a3610f; }

/* tables */
.table-wrap { overflow-x: auto; }
table { border-collapse: collapse; width: 100%; font-size: 0.9rem; }
th {
  text-align: left; color: var(--muted); font-size: 0.75rem; text-transform: uppercase;
  letter-spacing: 0.05em; font-weight: 650; padding: 8px 12px 6px;
  border-bottom: 1px solid var(--line); white-space: nowrap;
}
td { padding: 8px 12px; border-bottom: 1px solid #eef1f7; vertical-align: middle; }
tr:last-child td { border-bottom: 0; }
tbody tr:hover td { background: #f8fafd; }
td .muted { display: block; }

/* filters */
.filters { display: flex; gap: 12px; flex-wrap: wrap; align-items: center; margin-bottom: 16px; }
.filters input[type="search"] {
  flex: 1 1 240px; background: #fff; border: 1px solid var(--line);
  color: var(--text); border-radius: 9px; padding: 9px 14px; font-size: 0.95rem;
  box-shadow: var(--shadow);
}
.filters input[type="search"]:focus { outline: 3px solid var(--accent-soft); border-color: var(--accent); }

.day-tabs { display: flex; gap: 4px; flex-wrap: wrap; }
.day-tab {
  color: var(--muted); font-weight: 600; font-size: 0.85rem;
  padding: 6px 12px; border-radius: 9px; border: 1px solid transparent;
}
.day-tab:hover { color: var(--text); text-decoration: none; background: var(--bg-soft); }
.day-tab.active { color: var(--accent-strong); background: var(--accent-soft); border-color: #cfe7f8; }

/* days-of-week dots */
.days i { font-style: normal; color: #c4cede; margin-right: 1px; font-size: 0.8rem; }
.days i.on { color: var(--accent-strong); font-weight: 700; }

/* rotation board */
.board-legend {
  display: flex; gap: 18px; flex-wrap: wrap; color: var(--muted);
  font-size: 0.82rem; margin-bottom: 10px;
}
.sw { display: inline-block; width: 12px; height: 12px; border-radius: 4px; vertical-align: -1px; margin-right: 5px; }
.sw-widebody { background: var(--wb); }
.sw-narrowbody { background: var(--nb); }
.sw-regional { background: var(--rj); }
.sw-reserve { background: repeating-linear-gradient(45deg, #c7cedd, #c7cedd 3px, #eef1f7 3px, #eef1f7 6px); }

.board {
  position: relative; background: var(--panel); border: 1px solid var(--line);
  border-radius: var(--radius); overflow: auto; max-height: 78vh; margin-bottom: 18px;
  box-shadow: var(--shadow);
}
.board-loading { padding: 40px; text-align: center; color: var(--muted); }
.board-inner { position: relative; min-width: 1300px; }

.board-axis {
  position: sticky; top: 0; z-index: 30; height: 30px;
  background: #fff; border-bottom: 1px solid var(--line);
}
.board-axis .tick {
  position: absolute; top: 0; height: 100%; color: var(--muted);
  font-family: var(--mono); font-size: 0.7rem; padding: 7px 0 0 5px;
  border-left: 1px solid #eef1f7;
}
.board-group {
  position: sticky; left: 0; z-index: 20;
  background: var(--bg-soft); color: var(--muted); font-size: 0.72rem;
  text-transform: uppercase; letter-spacing: 0.08em; font-weight: 700;
  padding: 6px 12px; border-bottom: 1px solid var(--line);
}
.board-row { position: relative; height: 34px; border-bottom: 1px solid #f1f4f9; }
.board-row:hover { background: #f8fafd; }
.board-tail {
  position: sticky; left: 0; z-index: 10; width: 104px; height: 100%;
  background: linear-gradient(90deg, #fff 82%, transparent);
  display: flex; flex-direction: column; justify-content: center;
  padding: 0 10px; line-height: 1.15;
}
.board-tail .reg { font-family: var(--mono); font-weight: 700; font-size: 0.8rem; }
.board-tail .typ { color: var(--muted); font-size: 0.68rem; }
.board-canvas { position: absolute; inset: 0; }

.leg {
  position: absolute; top: 5px; height: 24px; border-radius: 6px;
  color: #fff; font-family: var(--mono); font-size: 0.7rem; font-weight: 700;
  display: flex; align-items: center; padding: 0 6px; overflow: hidden;
  white-space: nowrap; cursor: pointer; border: 0;
}
.leg-widebody { background: var(--wb); }
.leg-narrowbody { background: var(--nb); }
.leg-regional { background: var(--rj); }
.leg-overnight-in { border-radius: 0 6px 6px 0; }
.leg-overnight-out { border-radius: 6px 0 0 6px; }
.leg:hover { filter: brightness(1.08); }
.leg:focus-visible { outline: 2px solid var(--text); }

.now-line {
  position: absolute; top: 0; bottom: 0; width: 2px;
  background: var(--bad); z-index: 15; pointer-events: none; opacity: 0.75;
}

/* leg popover */
.leg-pop {
  position: fixed; z-index: 100; background: #fff;
  border: 1px solid var(--line); border-radius: 12px; padding: 14px 16px;
  min-width: 250px; max-width: 320px; box-shadow: 0 12px 32px rgba(16, 24, 40, 0.18);
  font-size: 0.88rem;
}
.leg-pop h3 { margin: 0 0 6px; font-family: var(--mono); font-size: 1.05rem; }
.leg-pop .route { color: var(--muted); margin-bottom: 8px; }
.leg-pop table { font-size: 0.85rem; }
.leg-pop td { padding: 3px 10px 3px 0; border: 0; }
.leg-pop .close {
  position: absolute; top: 8px; right: 10px; background: none; border: 0;
  color: var(--muted); font-size: 1rem; cursor: pointer;
}

/* fleet */
.fleet-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(280px, 1fr)); gap: 16px; }
.fleet-card details summary { cursor: pointer; color: var(--accent-strong); font-size: 0.86rem; margin-top: 8px; }
.fleet-meta { display: flex; gap: 18px; color: var(--muted); font-size: 0.86rem; }
.fleet-meta .strong { color: var(--text); font-family: var(--mono); }
.tail-list { margin-top: 10px; display: grid; gap: 5px; max-height: 300px; overflow-y: auto; }
.tail { display: flex; gap: 10px; align-items: center; font-size: 0.84rem; }
.tail-idle { opacity: 0.55; }

/* ── duty desk (game) ─────────────────────────────────────────────── */
.setup-form .field { display: grid; gap: 4px; margin-bottom: 14px; }
.setup-form .field span { color: var(--muted); font-size: 0.85rem; }
.setup-form select {
  background: #fff; color: var(--text); border: 1px solid var(--line);
  border-radius: 9px; padding: 9px 12px; font-size: 0.95rem;
}
.howto { margin: 0; padding-left: 18px; display: grid; gap: 8px; font-size: 0.92rem; }

.duty-bar {
  display: flex; align-items: center; gap: 14px; flex-wrap: wrap;
  background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius);
  padding: 10px 16px; margin-bottom: 14px; position: sticky; top: 54px; z-index: 40;
  box-shadow: var(--shadow);
}
.duty-clock { font-size: 1.5rem; font-weight: 700; color: var(--accent-strong); }
.duty-meta { color: var(--muted); font-size: 0.88rem; display: flex; align-items: center; gap: 8px; }
.duty-scores { display: flex; gap: 8px; flex-wrap: wrap; margin-left: auto; }
.score-chip {
  background: var(--bg-soft); border: 1px solid var(--line); border-radius: 8px;
  padding: 4px 10px; font-size: 0.78rem; color: var(--muted); font-weight: 600;
}
.score-chip b { font-family: var(--mono); margin-left: 4px; color: var(--text); }
.score-chip b.pos { color: var(--ok); }
.score-chip b.neg { color: var(--bad); }
.btn-small { padding: 7px 12px; font-size: 0.85rem; }
.mini-btn {
  background: #fff; color: var(--text); border: 1px solid var(--line);
  border-radius: 8px; padding: 5px 10px; font-size: 0.82rem; cursor: pointer;
}
.mini-btn:hover { border-color: var(--accent); color: var(--accent-strong); }

.duty-grid { display: grid; grid-template-columns: repeat(4, 1fr); gap: 14px; margin-bottom: 14px; }
.dpanel {
  background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius);
  display: flex; flex-direction: column; min-height: 300px; max-height: 430px;
  box-shadow: var(--shadow);
}
.dpanel header {
  display: flex; align-items: center; justify-content: space-between;
  padding: 10px 14px; border-bottom: 1px solid var(--line);
}
.dpanel h2 { font-size: 0.82rem; text-transform: uppercase; letter-spacing: 0.07em; color: var(--muted); }
.dpanel .dbody { padding: 10px 14px; overflow-y: auto; flex: 1; }
.dot { font-size: 0.72rem; font-weight: 700; color: var(--warn); }
.sim-tag { font-size: 0.66rem; font-weight: 700; color: #a3610f; border: 1px solid #f3ce8d; background: #fdf6e8; border-radius: 5px; padding: 1px 6px; }

.sched-row {
  display: grid; grid-template-columns: 42px 66px 1fr 56px auto; gap: 8px;
  align-items: center; padding: 5px 0; border-bottom: 1px solid #f1f4f9; font-size: 0.84rem;
}
.sched-reg { font-size: 0.74rem; }
.st { font-size: 0.66rem; font-weight: 800; text-align: center; border-radius: 5px; padding: 2px 0; }
.st-brd { background: #e1f3fb; color: #0b6d99; }
.st-dep { background: #fdf1de; color: #a3610f; }
.st-air { background: #e2f7ee; color: #0b7a56; }
.st-arr { background: #e8ebfd; color: #4353c4; }

.wx-row { display: flex; gap: 12px; padding: 6px 0; border-bottom: 1px solid #f1f4f9; font-size: 0.8rem; flex-wrap: wrap; }

.call-card { text-align: center; padding: 18px 8px; }
.call-card .call-anim { font-size: 2.4rem; animation: shake 0.7s infinite; }
@keyframes shake {
  0%, 100% { transform: rotate(0); } 20% { transform: rotate(-14deg); }
  40% { transform: rotate(10deg); } 60% { transform: rotate(-8deg); } 80% { transform: rotate(5deg); }
}
.call-who { font-weight: 700; margin: 8px 0 2px; }
.call-card .btn { margin-top: 14px; }
.dpanel-phone .dbody { display: flex; flex-direction: column; }

.case-card { display: flex; flex-direction: column; gap: 10px; }
.case-head { display: flex; flex-direction: column; gap: 2px; }
.case-title { font-weight: 700; }
.transcript {
  background: var(--bg-soft); border: 1px solid var(--line); border-radius: 10px;
  padding: 10px; max-height: 150px; overflow-y: auto; display: grid; gap: 8px;
}
.tr-line { display: grid; gap: 1px; font-size: 0.84rem; }
.tr-who { color: var(--muted); font-size: 0.7rem; text-transform: uppercase; letter-spacing: 0.04em; }
.tr-you .tr-text { color: var(--accent-strong); }
.tr-info .tr-text { color: #a3610f; }
.tr-system .tr-text { color: #0b7a56; }
.info-row { display: flex; gap: 6px; flex-wrap: wrap; }
.info-btn.done { opacity: 0.55; }
.opt-col { display: grid; gap: 6px; }
.opt-btn {
  text-align: left; background: #fff; color: var(--text);
  border: 1px solid var(--line); border-radius: 9px; padding: 9px 12px;
  font-size: 0.86rem; cursor: pointer;
}
.opt-btn:hover:not(:disabled) { border-color: var(--accent); background: #fbfdff; }
.opt-btn.locked { opacity: 0.5; cursor: not-allowed; }
.opt-btn .tag { margin-left: 8px; }

.acars-msg {
  display: flex; gap: 10px; align-items: center; width: 100%;
  background: #fff; border: 1px solid var(--line); border-radius: 9px;
  color: var(--text); padding: 9px 12px; margin-bottom: 8px; cursor: pointer; font-size: 0.85rem;
}
.acars-msg:hover { border-color: var(--accent); }
.tag-new { margin-left: auto; font-size: 0.66rem; font-weight: 800; color: var(--warn); }

.duty-log .dbody { max-height: 260px; }
.duty-log { min-height: 0; max-height: none; }
.log-row {
  display: flex; gap: 12px; align-items: baseline; flex-wrap: wrap;
  padding: 7px 0; border-bottom: 1px solid #f1f4f9; font-size: 0.85rem;
}
.log-missed { opacity: 0.85; }
.log-feedback { flex-basis: 100%; color: var(--muted); font-size: 0.8rem; }
.pos { color: var(--ok); }
.neg { color: var(--bad); }

.toast-stack { position: fixed; bottom: 18px; right: 18px; display: grid; gap: 8px; z-index: 200; }
.toast {
  background: #fff; border: 1px solid var(--line); border-left: 4px solid var(--accent);
  border-radius: 10px; padding: 10px 14px; font-size: 0.86rem; max-width: 340px;
  box-shadow: 0 8px 24px rgba(16, 24, 40, 0.16); transition: opacity 0.4s, transform 0.4s;
}
.toast.warn { border-left-color: var(--warn); }
.toast.bad { border-left-color: var(--bad); }
.toast.ok { border-left-color: var(--ok); }
.toast.gone { opacity: 0; transform: translateY(8px); }

.debrief {
  position: fixed; inset: 0; background: rgba(23, 35, 60, 0.45); z-index: 300;
  display: flex; align-items: center; justify-content: center; padding: 16px;
  backdrop-filter: blur(3px);
}
.debrief-card {
  background: #fff; border: 1px solid var(--line); border-radius: 16px;
  padding: 26px 28px; max-width: 560px; width: 100%; max-height: 86vh; overflow-y: auto;
  box-shadow: 0 24px 60px rgba(16, 24, 40, 0.25);
}
.grade { font-size: 3.4rem; font-weight: 800; margin: 6px 0 10px; }
.grade-A, .grade-B { color: var(--ok); }
.grade-C { color: var(--warn); }
.grade-D, .grade-F { color: var(--bad); }
.debrief-list { margin-top: 12px; }
.debrief-actions { display: flex; gap: 10px; margin-top: 18px; }

/* responsive */
@media (max-width: 1100px) { .duty-grid { grid-template-columns: 1fr 1fr; } }
@media (max-width: 860px) {
  .grid-2 { grid-template-columns: 1fr; }
  .facts div { grid-template-columns: 1fr; gap: 0; }
  .brand-name { display: none; }
  .nav { gap: 0; }
  .nav a { padding: 7px 9px; font-size: 0.88rem; }
  .hide-sm { display: none; }
  .page { padding: 18px 12px 50px; }
  .topbar-inner { padding: 8px 12px; gap: 10px; }
  .board { max-height: 70vh; }
  .board-tail { width: 84px; }
  .kpi-value { font-size: 1.4rem; }
}
@media (max-width: 640px) {
  .duty-grid { grid-template-columns: 1fr; }
  .dpanel { min-height: 0; max-height: 380px; }
  .duty-bar { top: 46px; gap: 8px; padding: 8px 10px; }
  .duty-clock { font-size: 1.15rem; }
  .duty-scores { margin-left: 0; }
}

/* hidden attribute must always win, even over display:flex rules */
[hidden] { display: none !important; }
