/* Flight Data -- same chart-paper palette as the SaferSkies Logbook so the
   two apps feel like one family. */

:root {
  --paper: #f2f4f3; --field: #ffffff; --zebra: #e9edec; --rule: #c9d2d0; --rule-strong: #97a5a2;
  --ink: #16211f; --ink-soft: #5a6a67; --chrome: #1f2a2e; --chrome-ink: #dde5e3;
  --blue: #1b6ca8; --magenta: #b3005e; --caution: #9a6a00; --good: #1d6b3f; --head: #dfe6e3;
  --alert-bg: #fde8ef; --warn-bg: #fff4d6; --info-bg: #e6f0f8;
  --map-water: #dbe7ee; --map-land: #f4f1e8; --map-border: #b9b3a2; --map-grat: rgba(27,108,168,.14);
  --font: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  --mono: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  --radius: 3px;
}
* { box-sizing: border-box; }
[hidden] { display: none !important; }
html, body { margin: 0; height: 100%; background: var(--paper); color: var(--ink); font-family: var(--font); font-size: 13px; line-height: 1.45; }
body { display: grid; grid-template-rows: auto 1fr; grid-template-columns: minmax(0,1fr); height: 100dvh; overflow: hidden; }
a { color: var(--blue); }
h1 { font-size: 16px; margin: 0; font-weight: 600; }
h2 { font-size: 14px; margin: 0 0 8px; font-weight: 600; }
h3 { font-size: 13px; margin: 0 0 6px; font-weight: 600; }
code, pre, .mono { font-family: var(--mono); font-size: 12px; }
pre { white-space: pre-wrap; background: var(--field); border: 1px solid var(--rule); padding: 8px; border-radius: var(--radius); max-height: 70vh; overflow: auto; }

/* chrome */
.chrome { display: flex; align-items: center; gap: 18px; padding: 0 14px; height: 44px; background: var(--chrome); color: var(--chrome-ink); }
.brand { display: flex; align-items: center; gap: 8px; color: inherit; text-decoration: none; }
.brand-mark { width: 14px; height: 14px; border-radius: 50%; background: linear-gradient(135deg, var(--blue), var(--magenta)); }
.brand-name { font-weight: 600; }
.brand-version { opacity: .6; font-size: 11px; }
.tabs { display: flex; gap: 2px; flex: 1; overflow-x: auto; }
.tab { color: var(--chrome-ink); text-decoration: none; padding: 6px 10px; border-radius: var(--radius); opacity: .8; white-space: nowrap; }
.tab:hover { opacity: 1; background: rgba(255,255,255,.08); }
.tab.is-current { opacity: 1; background: rgba(255,255,255,.14); }
.signout { display: flex; align-items: center; gap: 10px; margin: 0; }
.who { opacity: .75; font-size: 12px; }
.link-button { background: none; border: 0; color: var(--chrome-ink); cursor: pointer; text-decoration: underline; padding: 0; }

/* page */
.page { overflow: auto; padding: 12px 14px 30px; display: flex; flex-direction: column; gap: 12px; }
.page.is-map { padding: 0; overflow: hidden; gap: 0; }
.toolbar { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
.toolbar.inner { margin-bottom: 8px; }
.spacer { flex: 1; }
.hint { color: var(--ink-soft); font-size: 12px; }
.back { text-decoration: none; white-space: nowrap; }
.card { background: var(--field); border: 1px solid var(--rule); border-radius: var(--radius); padding: 12px; overflow-x: auto; min-width: 0; }
.two-col { display: grid; grid-template-columns: repeat(auto-fit, minmax(380px, 1fr)); gap: 12px; align-items: start; }

/* buttons & inputs */
button, .button, .file-button { font: inherit; font-size: 12.5px; padding: 5px 10px; border: 1px solid var(--rule-strong); border-radius: var(--radius); background: var(--field); color: var(--ink); cursor: pointer; text-decoration: none; display: inline-block; line-height: 1.3; }
button:hover, .button:hover, .file-button:hover { border-color: var(--blue); }
button.primary, .file-button.primary { background: var(--blue); border-color: var(--blue); color: #fff; }
button.danger { color: var(--magenta); border-color: var(--magenta); }
button.is-on { background: var(--head); border-color: var(--blue); }
button:disabled { opacity: .5; cursor: default; }
input, select, textarea { font: inherit; font-size: 13px; padding: 5px 7px; border: 1px solid var(--rule-strong); border-radius: var(--radius); background: var(--field); color: var(--ink); }
input[type="search"] { min-width: 240px; }
label.check { display: flex; align-items: center; gap: 6px; }
.seg { display: inline-flex; gap: 2px; align-items: center; }
.seg button { border-radius: 0; }
.seg button:first-child { border-radius: var(--radius) 0 0 var(--radius); }
.seg button:last-child { border-radius: 0 var(--radius) var(--radius) 0; }
.seg.layers label, #ring-set label { display: inline-flex; gap: 4px; align-items: center; padding: 3px 6px; font-size: 12px; }
.form-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(170px, 1fr)); gap: 8px 12px; margin-top: 10px; }
.form-grid label { display: flex; flex-direction: column; gap: 3px; font-size: 12px; color: var(--ink-soft); }
.form-grid label.check { flex-direction: row; align-items: center; align-self: end; color: var(--ink); }
.form-grid label.wide, .form-grid .wide { grid-column: 1 / -1; }
.form-grid input, .form-grid select { width: 100%; }
.actions { display: flex; gap: 8px; align-items: center; }

/* tables */
table.grid { width: 100%; border-collapse: collapse; }
table.grid th, table.grid td { text-align: left; padding: 5px 7px; border-bottom: 1px solid var(--rule); vertical-align: top; }
table.grid th { background: var(--head); font-weight: 600; position: sticky; top: 0; z-index: 1; white-space: nowrap; }
table.grid tbody tr:nth-child(even) { background: var(--zebra); }
table.grid tbody tr:hover { background: #e3ecf4; }
table.grid td.num, table.grid th.num { text-align: right; font-variant-numeric: tabular-nums; }
table.grid.small { font-size: 12px; }
table.grid tr.clickable { cursor: pointer; }
table.grid td.mono { font-family: var(--mono); font-size: 12px; }
.badge { display: inline-block; min-width: 18px; padding: 0 5px; border-radius: 9px; font-size: 11px; background: var(--rule); color: var(--ink); text-align: center; }
.badge.alert { background: var(--magenta); color: #fff; }
.badge.warn { background: var(--caution); color: #fff; }
.badge.info { background: var(--blue); color: #fff; }
.pill { display: inline-block; padding: 1px 7px; border-radius: 10px; font-size: 11px; border: 1px solid var(--rule-strong); margin-right: 3px; }
.pill.prelim { border-color: var(--magenta); color: var(--magenta); font-weight: 600; }
.pill.etops { border-color: var(--blue); color: var(--blue); }
.pill.reclear { border-color: var(--caution); color: var(--caution); }

/* severity rows */
tr.sev-alert td:first-child, .sev-alert .sev { color: var(--magenta); font-weight: 600; }
tr.sev-warn td:first-child, .sev-warn .sev { color: var(--caution); font-weight: 600; }
tr.sev-info td:first-child, .sev-info .sev { color: var(--blue); }
.finding { border-left: 4px solid var(--rule-strong); padding: 6px 10px; margin: 0 0 6px; background: var(--field); border-radius: var(--radius); }
.finding.alert { border-left-color: var(--magenta); background: var(--alert-bg); }
.finding.warn { border-left-color: var(--caution); background: var(--warn-bg); }
.finding.info { border-left-color: var(--blue); background: var(--info-bg); }
.finding .name { font-weight: 600; }
.finding .msg { display: block; }
.finding.pass { opacity: .7; }
.finding.error { border-left-color: var(--magenta); }

/* import */
.import-form { display: flex; align-items: center; gap: 10px; }
.drop-overlay { position: fixed; inset: 0; background: rgba(27,108,168,.18); border: 4px dashed var(--blue); display: flex; align-items: center; justify-content: center; font-size: 22px; color: var(--blue); z-index: 50; pointer-events: none; }

/* plan page */
.plan-head h1 { font-size: 15px; }
.subtabs { display: flex; gap: 2px; flex-wrap: wrap; border-bottom: 1px solid var(--rule); }
.subtabs button { border: 0; border-bottom: 2px solid transparent; border-radius: 0; background: none; padding: 6px 10px; }
.subtabs button.is-on { border-bottom-color: var(--blue); font-weight: 600; }
.plan-body { display: flex; flex-direction: column; gap: 12px; }
.kv { display: grid; grid-template-columns: max-content 1fr; gap: 3px 14px; font-size: 13px; }
.kv dt { color: var(--ink-soft); }
.kv dd { margin: 0; }
.route-box { display: flex; gap: 8px; align-items: flex-start; }
.route-box textarea { flex: 1; font-family: var(--mono); font-size: 13px; min-height: 58px; resize: vertical; }
.overview-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(300px, 1fr)); gap: 12px; align-items: start; }
.cols-3 { columns: 3; column-gap: 20px; font-size: 12px; }
.notam { border-bottom: 1px solid var(--rule); padding: 6px 0; font-size: 12px; }
.notam .id { font-family: var(--mono); font-weight: 600; }
.notam .cat { color: var(--ink-soft); }
.notam .when { color: var(--ink-soft); font-size: 11px; }
.wx { font-family: var(--mono); font-size: 12px; white-space: pre-wrap; padding: 2px 0; }
.remarks li { margin: 0 0 2px; }
.filters { display: flex; gap: 10px; flex-wrap: wrap; margin-bottom: 8px; }
.filters label { display: inline-flex; gap: 4px; align-items: center; font-size: 12px; }

/* map */
.map-body { display: grid; grid-template-columns: minmax(0, 1fr) 320px; height: 100%; min-height: 0; }
.page.is-map { display: grid; grid-template-rows: auto minmax(0, 1fr); }
.page.is-map .toolbar { padding: 6px 10px; border-bottom: 1px solid var(--rule); background: var(--field); }
.map-stage { position: relative; background: var(--map-water); overflow: hidden; }
.map-stage svg { width: 100%; height: 100%; display: block; cursor: grab; touch-action: none; user-select: none; -webkit-user-select: none; }
.map-stage svg:active { cursor: grabbing; }
.map-zoom { position: absolute; right: 10px; top: 10px; display: flex; flex-direction: column; gap: 4px; }
.map-zoom button { width: 30px; height: 30px; padding: 0; font-size: 16px; }
.map-panel { border-left: 1px solid var(--rule); background: var(--field); overflow: auto; padding: 10px; }
.panel-filters { display: flex; flex-wrap: wrap; gap: 4px 10px; margin-bottom: 8px; }
.panel-filters label { font-size: 12px; display: inline-flex; gap: 4px; align-items: center; }
.event-list { list-style: none; margin: 0; padding: 0; font-size: 12px; }
.event-list li { padding: 4px 6px; border-bottom: 1px solid var(--rule); cursor: pointer; display: grid; grid-template-columns: 52px 1fr; gap: 6px; }
.event-list li:hover, .event-list li.is-selected { background: var(--zebra); }
.event-list .t { font-family: var(--mono); color: var(--ink-soft); }
.event-list .cat { display: inline-block; width: 8px; height: 8px; border-radius: 50%; margin-right: 4px; }
.sphere { fill: var(--map-water); }
.land { fill: var(--map-land); stroke: var(--map-border); stroke-width: .5; }
.grat { fill: none; stroke: var(--map-grat); stroke-width: .6; }
.route { fill: none; stroke: var(--magenta); stroke-width: 2; }
.route.alternate { stroke: var(--caution); stroke-dasharray: 5 3; }
.route.refile { stroke: var(--blue); stroke-dasharray: 2 3; }
.wp { fill: #fff; stroke: var(--magenta); stroke-width: 1.5; }
.wp.pseudo { stroke: var(--ink-soft); }
.wp-label { font-size: 10px; fill: var(--ink); paint-order: stroke; stroke: #fff; stroke-width: 3; }
.apt { fill: var(--blue); stroke: #fff; stroke-width: 1; }
.apt-label { font-size: 11px; font-weight: 600; fill: var(--blue); paint-order: stroke; stroke: #fff; stroke-width: 3; }
.adq { fill: var(--good); stroke: #fff; stroke-width: 1; }
.adq-label { font-size: 9px; fill: var(--good); paint-order: stroke; stroke: #fff; stroke-width: 2; }
.ring { fill: none; stroke: var(--good); stroke-width: 1; opacity: .8; }
.ring.r60 { stroke-dasharray: 2 2; } .ring.r120 { stroke-dasharray: 5 3; } .ring.r207 { stroke-dasharray: 8 3 2 3; }
.ring-fill { fill: rgba(29,107,63,.07); stroke: none; }
.ev { stroke: #fff; stroke-width: 1; }
.ev.nav { fill: var(--blue); } .ev.etops { fill: #7a3fb3; } .ev.fuel { fill: var(--caution); } .ev.release { fill: var(--ink-soft); }
.ev.comm { fill: #0b8a8a; } .ev.engine { fill: #b35b00; } .ev.alert { fill: var(--magenta); }
.etp { fill: #7a3fb3; stroke: #fff; stroke-width: 1; }
.etp-label { font-size: 10px; fill: #7a3fb3; paint-order: stroke; stroke: #fff; stroke-width: 3; }
.map-tip { position: absolute; background: var(--chrome); color: var(--chrome-ink); padding: 6px 8px; border-radius: var(--radius); font-size: 12px; pointer-events: none; max-width: 300px; white-space: pre-line; z-index: 5; }

/* checks page */
.test-results { margin-top: 10px; font-size: 12px; }
.test-results .hit { color: var(--magenta); font-weight: 600; }
.facts-help { margin-top: 10px; font-size: 12px; }
.facts-help dl { display: grid; grid-template-columns: max-content 1fr; gap: 2px 12px; }
.facts-help dt { font-family: var(--mono); }
.bulk-box { margin-top: 10px; }
.bulk-box textarea { width: 100%; font-family: var(--mono); }

/* login */
.login-page { display: block; background: var(--chrome); }
.login-card { max-width: 380px; margin: 12vh auto; background: var(--field); padding: 24px; border-radius: 6px; }
.login-card h1 { font-size: 20px; margin-bottom: 4px; }
.login-card label { display: block; margin: 10px 0 3px; color: var(--ink-soft); font-size: 12px; }
.login-card input { width: 100%; }
.login-card button { margin-top: 14px; width: 100%; padding: 8px; }
.lede { color: var(--ink-soft); margin: 0 0 8px; }
.problem { background: var(--alert-bg); color: var(--magenta); padding: 8px; border-radius: var(--radius); margin: 8px 0; }
.code-input { font-size: 22px; letter-spacing: .3em; text-align: center; }

/* toasts */
.toast-stack { position: fixed; right: 14px; bottom: 14px; display: flex; flex-direction: column; gap: 6px; z-index: 100; }
.toast { background: var(--chrome); color: var(--chrome-ink); padding: 8px 12px; border-radius: var(--radius); box-shadow: 0 2px 10px rgba(0,0,0,.3); max-width: 420px; }
.toast.bad { background: var(--magenta); color: #fff; }

@media (max-width: 800px) {
  .map-body { grid-template-columns: 1fr; grid-template-rows: 1fr 220px; }
  .map-panel { border-left: 0; border-top: 1px solid var(--rule); }
  .chrome { gap: 8px; }
  .who { display: none; }
}
