/* ===== Theme palettes (derived from BidBuddy) ===== */
:root {
  --bg: #f4f6fa; --card: #ffffff; --line: #e6e9ee; --fg: #1a2330; --muted: #9aa3b2;
  --accent: #1f5fa8;
  --chip-bg: #e5eefb; --chip-fg: #1f5fa8;
  --shadow: 0 1px 3px rgba(20,30,50,.06);
  --page-shadow: 0 1px 4px rgba(20,30,50,.18);
  --add-fg: #1f7a3d; --add-chip-bg: #e3f1e8;
  --del-fg: #b03a4a; --del-chip-bg: #fdeef0;
  /* Highlight colors are the same rgba in both themes; only the page's blend
     mode changes (multiply over the white canvas here, screen over the
     inverted black canvas in dark mode — see .page-canvas / --hl-blend). */
  --hl-add: rgba(74, 201, 126, .45);
  --hl-del: rgba(255, 99, 99, .45);
  --hl-field: rgba(255, 204, 0, .45);
  --page-filter: none;
  --hl-blend: multiply;
  --page-bg: #fff;
  --page-num-bg: rgba(255,255,255,.7);
  --page-num-fg: #8892a0;
  --topbar-h: 49px;
  --tabbar-h: 37px;
  --chrome-h: calc(var(--topbar-h) + var(--tabbar-h));
  --warn-bg: #fdf0d2; --limit-bg: #f8e08e; --warn-fg: #a07c00;
}
:root[data-theme="dark"] {
  --bg: #0f1115; --card: #181b22; --line: #2a2f3a; --fg: #e8eaf0; --muted: #9aa3b2;
  --accent: #4f8cff;
  --chip-bg: #1f2b40; --chip-fg: #9fc0ff;
  --shadow: 0 1px 3px rgba(0,0,0,.4);
  /* --page-filter now inverts only .page-canvas (the rendered PDF bitmap).
     .page's own background/shadow and .hl-layer's blend mode are authored
     directly below instead of relying on an ancestor filter to invert them —
     mix-blend-mode under a filtered ancestor silently drops the blend on
     WebKit (https://bugs.webkit.org/show_bug.cgi?id=176830), which is why
     highlights were invisible in dark mode. */
  --page-shadow: 0 0 0 1px var(--line), 0 1px 4px rgba(0,0,0,.5);
  --page-filter: invert(1) hue-rotate(180deg);
  --hl-blend: screen;
  --page-bg: #000;
  --page-num-bg: rgba(0,0,0,.55);
  --page-num-fg: #aab2c0;
  --add-fg: #6bd58c; --add-chip-bg: #14301f;
  --del-fg: #ff9aa8; --del-chip-bg: #38262b;
  --warn-bg: #3d3313; --limit-bg: #57470f; --warn-fg: #ffd24a;
}
@media (prefers-color-scheme: dark) {
  :root[data-theme="system"] {
    --bg: #0f1115; --card: #181b22; --line: #2a2f3a; --fg: #e8eaf0; --muted: #9aa3b2;
    --accent: #4f8cff;
    --chip-bg: #1f2b40; --chip-fg: #9fc0ff;
    --shadow: 0 1px 3px rgba(0,0,0,.4);
    --page-shadow: 0 0 0 1px var(--line), 0 1px 4px rgba(0,0,0,.5);
    --page-filter: invert(1) hue-rotate(180deg);
    --hl-blend: screen;
    --page-bg: #000;
    --page-num-bg: rgba(0,0,0,.55);
    --page-num-fg: #aab2c0;
    --add-fg: #6bd58c; --add-chip-bg: #14301f;
    --del-fg: #ff9aa8; --del-chip-bg: #38262b;
    --warn-bg: #3d3313; --limit-bg: #57470f; --warn-fg: #ffd24a;
  }
}

* { box-sizing: border-box; }
html, body { height: 100%; }
/* The chrome + screens fill exactly 100dvh, so the document itself must never
   move: any gesture that chains out of an inner scroller (.info-screen past
   its end, or a horizontal pan the PDF panes have no content for) would
   rubber-band the whole page — taking the sticky topbar/tabbar with it.
   This must be on html, not body: WebKit only reads the viewport's
   overscroll-behavior from the document element (LocalFrameView::
   *OverscrollBehavior → WKScrollView bounces), so a body-only value is
   silently ignored on iPadOS. */
html, body { overscroll-behavior: none; }
body { margin: 0; font: 15px/1.4 -apple-system, "Segoe UI", Roboto, system-ui, sans-serif;
  background: var(--bg); color: var(--fg);
  /* App-like feel: no accidental text selection / iOS callout on tap, except
     where explicitly re-enabled (PDF panes, the route value). */
  user-select: none; -webkit-user-select: none; -webkit-touch-callout: none; }
input, textarea, select { user-select: text; -webkit-user-select: text; -webkit-touch-callout: default; }
.hidden { display: none !important; }
.muted { color: var(--muted); }
h1, h2, h3 { color: var(--fg); }

/* ===== Top bar ===== */
.topbar { position: sticky; top: 0; z-index: 5; display: flex; align-items: center; gap: 12px;
  height: var(--topbar-h); padding: 0 14px; background: var(--card); border-bottom: 1px solid var(--line); }
.brand { font-size: 17px; display: inline-flex; align-items: center; gap: 8px; white-space: nowrap; }
.brand-mark { width: 26px; height: 26px; border-radius: 8px; display: inline-flex;
  align-items: center; justify-content: center; font-size: 15px; background: var(--accent); color: #fff; }
.topbar-actions { display: flex; align-items: center; gap: 8px; margin-left: auto; }
.theme-btn { background: var(--chip-bg); color: var(--chip-fg); border: 1px solid var(--line);
  border-radius: 8px; padding: 6px 12px; cursor: pointer; font-weight: 600; white-space: nowrap;
  transition: filter .12s ease; }
.theme-btn:hover { filter: brightness(.97); }
.icon-btn { display: inline-flex; align-items: center; justify-content: center; padding: 6px 8px; }
.icon-btn svg { display: block; }
.theme-btn:disabled { opacity: .5; cursor: default; }
/* ===== Hamburger menu ===== */
.app-menu { position: fixed; top: calc(var(--topbar-h) + 6px); right: 10px; z-index: 55;
  min-width: 230px; padding: 6px; background: var(--card); border: 1px solid var(--line);
  border-radius: 12px; box-shadow: 0 8px 24px rgba(15,20,30,.25); }
.menu-item { display: flex; align-items: center; gap: 10px; width: 100%; padding: 9px 10px;
  background: none; border: 0; border-radius: 8px; font: inherit; font-size: 14px;
  font-weight: 600; color: var(--fg); cursor: pointer; text-align: left; }
button.menu-item:hover { background: var(--chip-bg); }
.menu-item > svg { flex-shrink: 0; color: var(--muted); }
.mi-label { flex: 1; min-width: 0; }
.menu-val { color: var(--accent); font-size: 13px; }
.menu-chev { color: var(--muted); }
.menu-back > svg { color: var(--fg); }
.mi-check { visibility: hidden; color: var(--accent); }
.menu-item.checked .mi-check { visibility: visible; }
.menu-note { margin: 6px 4px 2px; padding: 8px 10px; max-width: 250px; border-radius: 8px;
  background: var(--chip-bg); font-size: 12px; line-height: 1.4; color: var(--muted); }
.menu-foot { display: flex; align-items: center; justify-content: space-between; gap: 12px;
  margin-top: 4px; padding: 8px 10px 4px; border-top: 1px solid var(--line);
  font-size: 11px; letter-spacing: .4px; color: var(--muted); opacity: .8; }

/* ===== About modal ===== */
.about-modal { width: min(380px, 100%); }
.about-body { text-align: center; padding-bottom: 20px; }
.about-logo { width: 56px; height: 56px; margin: 10px auto 12px; border-radius: 16px;
  display: flex; align-items: center; justify-content: center; font-size: 26px;
  background: var(--accent); color: #fff; }
.about-name { display: block; font-size: 19px; letter-spacing: -.2px; }
.about-version { font-size: 12px; color: var(--muted); margin: 2px 0 4px; }
.about-section { text-align: left; margin: 14px 2px 0; }
.about-h { margin: 0 0 4px; font-size: 11px; font-weight: 700; letter-spacing: .6px;
  text-transform: uppercase; color: var(--muted); }
.about-p { margin: 0 0 6px; font-size: 13px; line-height: 1.45; color: var(--fg); }
.about-p:last-child { margin-bottom: 0; }

.summary-chip { display: inline-flex; align-items: center; gap: 8px; font-size: 12px; font-weight: 700;
  border: 1px solid var(--line); border-radius: 999px; padding: 4px 10px; background: var(--card);
  white-space: nowrap; overflow: hidden; }
.summary-chip .s-add { color: var(--add-fg); }
.summary-chip .s-del { color: var(--del-fg); }

/* ===== Tab row (second bar: view tabs + compare tools + staged-flight actions) ===== */
.tabbar { position: sticky; top: var(--topbar-h); z-index: 5; display: flex; align-items: center;
  gap: 10px; height: var(--tabbar-h); padding: 0 14px; background: var(--card);
  border-bottom: 1px solid var(--line); }
.tabbar .view-toggle { margin-left: 0; }
.tabbar-actions { display: flex; align-items: center; gap: 8px; margin-left: auto; }
.danger-btn { color: var(--del-fg); border-color: var(--del-fg); background: var(--del-chip-bg); }
.activate-btn { color: var(--add-fg); border-color: var(--add-fg); background: var(--add-chip-bg);
  display: inline-flex; align-items: center; gap: 6px; }
.activate-btn svg { display: block; }

/* ===== Flight switcher (current / next chips) ===== */
.flight-switch { display: flex; align-items: center; gap: 8px; min-width: 0; }
.fs-chip { display: flex; flex-direction: column; align-items: stretch; flex-shrink: 0;
  border: 1px solid var(--line); border-radius: 10px; background: var(--card); color: var(--fg);
  padding: 3px 12px; font: inherit; cursor: pointer; min-width: 168px; text-align: left; }
.fs-chip.active { border-color: var(--accent); box-shadow: 0 0 0 1px var(--accent) inset; }
.fs-top { display: flex; align-items: baseline; justify-content: space-between; gap: 12px; }
.fs-tag { font-size: 9px; font-weight: 700; letter-spacing: .08em; text-transform: uppercase;
  color: var(--muted); }
.fs-chip.active .fs-tag { color: var(--accent); }
.fs-times { font-size: 10px; font-weight: 600; color: var(--muted); white-space: nowrap;
  font-variant-numeric: tabular-nums; }
.fs-label { display: flex; align-items: baseline; gap: 12px;
  font-size: 13px; font-weight: 700; white-space: nowrap; overflow: hidden; max-width: 220px; }
.fs-label.fs-none { color: var(--muted); font-weight: 600; }
/* Route is centred in the space beside the ident, so it sits under the times. */
.fs-label .fs-route { flex: 1; text-align: center; font-weight: 500; color: var(--muted); }
/* Empty next slot: dashed border hints "stage one here". */
.fs-chip.fs-empty { border-style: dashed; }

/* ===== Upload screen ===== */
.upload-screen { position: relative; display: flex; align-items: center; justify-content: center;
  min-height: calc(100dvh - var(--chrome-h)); padding: 24px 16px; }
.app-version { position: absolute; bottom: 14px; left: 0; right: 0; text-align: center;
  font-size: 11px; letter-spacing: .4px; color: var(--muted); opacity: .55; pointer-events: none; }
.upload-card { max-width: 620px; width: 100%; background: var(--card); border: 1px solid var(--line);
  border-radius: 18px; padding: 32px 28px; text-align: center; box-shadow: var(--shadow); }
.upload-logo { width: 56px; height: 56px; margin: 0 auto 14px; border-radius: 16px;
  display: flex; align-items: center; justify-content: center; font-size: 26px;
  background: var(--chip-bg); color: var(--chip-fg); }
.upload-card h1 { margin: 0 0 6px; font-size: 23px; letter-spacing: -.2px; }
.upload-sub { margin: 0 0 22px; color: var(--muted); font-size: 14px; }

.dz-row { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; }
@media (max-width: 560px) { .dz-row { grid-template-columns: 1fr; } }

.dropzone { display: block; cursor: pointer; border: 1.5px dashed var(--line); border-radius: 14px;
  padding: 24px 14px; background: var(--bg);
  transition: border-color .15s ease, background .15s ease, transform .15s ease; }
.dropzone:hover { border-color: var(--accent); }
.dropzone input[type=file] { position: absolute; width: 1px; height: 1px; opacity: 0; }
.dropzone:focus-within { border-color: var(--accent); }
.dropzone.drag { border-color: var(--accent); background: var(--chip-bg); transform: scale(1.01); }
.dropzone.loaded { border-style: solid; border-color: var(--accent); }
.dropzone.error { border-style: solid; border-color: var(--del-fg); }
.dz-icon { color: var(--accent); display: flex; justify-content: center; margin-bottom: 8px; }
.dz-main { font-size: 15px; font-weight: 700; color: var(--fg); }
.dz-hint { margin-top: 4px; font-size: 12px; color: var(--muted); }
.dz-file { margin-top: 8px; font-size: 12px; font-weight: 600; color: var(--accent); word-break: break-all; }
.parse-status { margin-top: 16px; font-size: 13px; min-height: 18px; }
.parse-status.error { color: var(--del-fg); }

/* ===== Compare screen ===== */
.compare-screen { display: flex; flex-direction: column; height: calc(100dvh - var(--chrome-h)); }
.nodiff-banner { padding: 8px 14px; text-align: center; font-weight: 600; font-size: 13px;
  background: var(--add-chip-bg); color: var(--add-fg); border-bottom: 1px solid var(--line); }
.nodiff-banner.warn { background: var(--del-chip-bg); color: var(--del-fg); }
.diff-wrap { flex: 1; display: flex; min-height: 0; }
.pane { flex: 1; min-width: 0; display: flex; flex-direction: column;
  user-select: text; -webkit-user-select: text; -webkit-touch-callout: default; }
.pane + .pane { border-left: 1px solid var(--line); }
.pane-head { display: flex; align-items: center; gap: 8px; padding: 6px 10px;
  background: var(--card); border-bottom: 1px solid var(--line); font-size: 12px; min-height: 30px; }
.pane-tag { font-weight: 800; text-transform: uppercase; letter-spacing: .5px; font-size: 10px;
  border-radius: 6px; padding: 2px 7px; }
.tag-del { background: var(--del-chip-bg); color: var(--del-fg); }
.tag-add { background: var(--add-chip-bg); color: var(--add-fg); }
.pane-file { color: var(--muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.pane-scroll { flex: 1; overflow: auto; -webkit-overflow-scrolling: touch;
  touch-action: pan-x pan-y; overscroll-behavior: contain; }
.pane-zoom { width: max-content; min-width: 100%; transform-origin: 0 0; display: flow-root; }
.pages { padding: 0 8px; }

.page { position: relative; margin: 12px auto; background: var(--page-bg); box-shadow: var(--page-shadow);
  isolation: isolate; }
.page-canvas { position: absolute; inset: 0; width: 100%; height: 100%;
  /* Dark mode: invert only the rendered PDF bitmap. .hl-layer deliberately
     sits outside this filter (see --hl-blend in :root) rather than nesting a
     mix-blend-mode element under a filtered ancestor, which WebKit drops. */
  filter: var(--page-filter); }
/* pdf.js text layer: invisible glyph-aligned spans over the canvas raster,
   so the only selectable text in the app is the actual PDF content. */
.textLayer { position: absolute; inset: 0; z-index: 1; overflow: clip;
  line-height: 1; text-align: initial; transform-origin: 0 0; }
.textLayer span { color: transparent; position: absolute;
  white-space: pre; cursor: text; transform-origin: 0% 0%; }
/* Line-break markers pdf.js inserts between spans: left as normal (non-
   positioned) elements. Absolutely positioning them with no explicit left/top
   falls back to their "static position", which stacks them all at the
   layer's top-left — a fake selectable bar running down the left edge. */
.textLayer br { color: transparent; cursor: text; }
/* Unpositioned wrapper spans around tagged/marked-content runs would otherwise
  sit at the layer's default top-left, producing a bogus selection sliver down
  the left edge for every line (pdf.js issue 14205). */
.textLayer span.markedContent { top: 0; height: 0; }
.textLayer ::selection { background: rgba(31, 95, 168, .35); }
.textLayer br::selection { background: transparent; }
.hl-layer { position: absolute; inset: 0; z-index: 2; pointer-events: none; mix-blend-mode: var(--hl-blend); overflow: hidden; }
.hl { position: absolute; border-radius: 2px; }
.hl-add { background: var(--hl-add); }
.hl-del { background: var(--hl-del); }
.hl-field { background: var(--hl-field); }
.page-num { position: absolute; right: 6px; bottom: 4px; z-index: 3; font-size: 10px;
  color: var(--page-num-fg); background: var(--page-num-bg); border-radius: 4px; padding: 0 4px; }
/* pdf.js's text layer measures glyphs on a scratch <canvas> it appends to
   <body> (getCtx in text_layer.js) and leaves unstyled — pdf_viewer.css,
   which this app doesn't ship, is what normally hides it. Left inline, it
   adds a 21px line box below the 100dvh layout, giving the document real
   scroll range (the sticky topbar/tabbar then scroll away on iPad). A 2D
   context keeps measuring fine on a display:none canvas. */
.hiddenCanvasElement { display: none; }

/* ===== Buttons / toast ===== */
.primary-btn { background: var(--accent); color: #fff; border: none; border-radius: 8px;
  padding: 8px 14px; font-weight: 700; cursor: pointer; }
.update-toast { position: fixed; left: 50%; transform: translateX(-50%);
  bottom: calc(16px + env(safe-area-inset-bottom)); z-index: 50;
  display: flex; align-items: center; gap: 12px; background: var(--card); color: var(--fg);
  border: 1px solid var(--line); border-radius: 12px; padding: 10px 14px; box-shadow: var(--shadow); }
.toast-x { background: none; border: none; color: var(--muted); cursor: pointer; font-size: 14px; padding: 4px 6px; }
.toast-x:hover { color: var(--fg); }

/* Add-to-Home-Screen banner (iPad/iPhone in-browser only). Floats under the
   topbar — near Safari's Share button on iPad — since screens fill the rest. */
.install-banner { position: fixed; left: 50%; transform: translateX(-50%);
  top: calc(var(--chrome-h) + 10px); z-index: 40;
  /* left:50% halves the shrink-to-fit space; max-content restores it. */
  width: max-content; max-width: min(92vw, 540px);
  display: flex; align-items: center; gap: 10px; background: var(--card); color: var(--fg);
  border: 1px solid var(--line); border-radius: 12px; padding: 10px 14px; box-shadow: var(--shadow);
  font-size: 13px; }
.ib-glyph { flex-shrink: 0; color: var(--accent); }

@media (max-width: 700px) {
  .brand { font-size: 15px; }
  .theme-btn { padding: 6px 8px; font-size: 12px; }
  .summary-chip { font-size: 11px; }
  .topbar, .tabbar { overflow-x: auto; }
  .summary-chip .s-word { display: none; }
  .summary-chip { flex-shrink: 0; }
  .fs-label { max-width: 130px; font-size: 12px; }
  .fs-label .fs-route { display: none; }
}

/* ===== Flight info view ===== */
.view-toggle { display: flex; border: 1px solid var(--line); border-radius: 8px; overflow: hidden; margin-left: 10px; flex-shrink: 0; }
.view-toggle button { border: 0; background: var(--card); color: var(--muted); padding: 5px 12px; font: inherit; font-size: 13px; cursor: pointer; white-space: nowrap; }
.view-toggle button.active { background: var(--chip-bg); color: var(--chip-fg); font-weight: 600; }
/* overscroll-behavior: contain mirrors .pane-scroll — the screen's own
   end-of-scroll stays inside it instead of chaining to the document. */
.info-screen { height: calc(100dvh - var(--chrome-h)); overflow-y: auto; overscroll-behavior: contain;
  padding: 18px 14px calc(18px + env(safe-area-inset-bottom)); }
.info-cards { display: flex; gap: 16px; justify-content: center; align-items: flex-start; flex-wrap: wrap; max-width: 1160px; margin: 0 auto; }
.info-card { position: relative; flex: 1 1 400px; max-width: 560px; min-width: 0; background: var(--card); border: 1px solid var(--line); border-radius: 12px; box-shadow: var(--shadow); padding: 14px 18px 18px; }
/* Release picker floats top-right in the card so the header text flows
   around it instead of underneath. */
.ic-pick { float: right; margin: 2px 0 6px 12px; max-width: 60%;
  display: flex; align-items: center; justify-content: flex-end; flex-wrap: wrap; gap: 6px; }
.ic-pick-sel { font: inherit; font-size: 13px; font-weight: 700; color: var(--fg);
  background: var(--bg); border: 1px solid var(--line); border-radius: 8px;
  padding: 4px 8px; max-width: 100%; }
.ic-flight { font-size: 24px; font-weight: 800; line-height: 1.2; }
.ic-date { font-size: 15px; font-weight: 600; margin-top: 1px; }
.ic-meta { font-size: 14px; color: var(--fg); margin-top: 2px; }
.ic-date.ic-changed, .ic-meta.ic-changed { display: inline-block; }
.ic-file { font-size: 12px; margin-top: 4px; overflow-wrap: anywhere; display: flex; align-items: center; gap: 5px; }
.ic-file svg { width: 13px; height: 13px; flex-shrink: 0; }
.ic-noofp { margin-top: 8px; padding: 8px 10px; border-radius: 8px; background: var(--del-chip-bg); color: var(--del-fg); font-size: 13px; }
.ic-sec { margin-top: 14px; }
/* Quick Info: placeholder action buttons under the card header. They stay
   disabled (grayed) until their features ship. */
.ic-quick { display: flex; flex-wrap: wrap; gap: 8px; padding: 4px 0 2px; }
.ic-quick-btn { flex: 1 1 auto; display: inline-flex; align-items: center; justify-content: center;
  gap: 7px; font: inherit; font-size: 13px; font-weight: 600; white-space: nowrap;
  background: var(--chip-bg); color: var(--chip-fg); border: 1px solid var(--line);
  border-radius: 10px; padding: 8px 10px; cursor: pointer; transition: filter .12s ease; }
.ic-quick-btn:hover:enabled { filter: brightness(.97); }
.ic-quick-btn:disabled { opacity: .45; cursor: default; }
.ic-quick-btn svg { flex: 0 0 auto; }

/* ===== "RLSE nn Updates" panel (Latest card of a pair, above Quick Info) =====
   An inset panel on the page tint: title + "Compared with … • n changes",
   a 2-up grid of icon tiles (category, computed headline with the new value
   in amber), and the actions row. "Changes Reviewed" puts .ic-ack on the
   card: the word marks fade, and this section fades and collapses upward on
   the same .6s clock — it is a one-row grid whose track animates 1fr → 0fr
   (content-sized, no max-height guess), the body clips, and the section's
   top margin goes too so Quick Info slides up flush under the filename row. */
.ic-upd-sec { display: grid; grid-template-rows: 1fr;
  transition: grid-template-rows .6s ease, opacity .6s ease, margin-top .6s ease; }
.ic-upd-body { min-height: 0; overflow: hidden; }
.ic-ack .ic-upd-sec { grid-template-rows: 0fr; opacity: 0; margin-top: 0; pointer-events: none; }
/* Coming back (dropdown returns to Latest, or a newer release lands): the
   card renders with .ic-expand and the panel plays the collapse in reverse —
   same .6s ease from the collapsed state — while the word marks fade back
   in on their own .8s. Keyframes, not transitions: the card is freshly
   inserted, so there is no prior state to transition from. */
@keyframes upd-in { from { grid-template-rows: 0fr; opacity: 0; margin-top: 0; } }
@keyframes mark-in { from { background-color: transparent; } }
.ic-expand .ic-upd-sec { animation: upd-in .6s ease; }
.ic-expand .ic-changed, .ic-expand .ic-chg-w { animation: mark-in .8s ease; }
@media (prefers-reduced-motion: reduce) {
  .ic-upd-sec, .ic-expand .ic-upd-sec, .ic-expand .ic-changed, .ic-expand .ic-chg-w { animation: none; transition: none; }
}
.ic-upd { background: var(--bg); border: 1px solid var(--line); border-radius: 12px; padding: 12px 12px 12px; }
.ic-upd-head { display: flex; align-items: flex-start; justify-content: space-between; gap: 12px; }
.ic-upd-titles { min-width: 0; }
.ic-upd-title { font-size: 16px; font-weight: 700; line-height: 1.25; }
.ic-upd-sub { margin-top: 3px; font-size: 12px; color: var(--muted); white-space: pre-wrap; }
.ic-upd-badge { flex: 0 0 auto; font-size: 11px; font-weight: 700; letter-spacing: .02em;
  padding: 2px 8px; border-radius: 6px; background: var(--chip-bg); color: var(--chip-fg); }
.ic-upd-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; margin-top: 12px; }
.ic-tile { display: flex; align-items: center; gap: 12px; min-width: 0; padding: 12px 12px;
  background: var(--card); border: 1px solid var(--line); border-radius: 10px; }
.ic-tile-icon { flex: 0 0 auto; display: inline-flex; }
.ic-tile-icon svg { width: 28px; height: 28px; stroke-width: 1.7; }
.ic-tile-text { min-width: 0; }
.ic-tile-label { font-size: 15px; font-weight: 700; line-height: 1.2; }
.ic-tile-detail { margin-top: 2px; font-size: 13px; line-height: 1.3; color: var(--muted);
  font-variant-numeric: tabular-nums; overflow-wrap: anywhere;
  white-space: pre-line; } /* weights stack one per line */
.ic-tile-hot { color: var(--warn-fg); font-weight: 600; }
.ic-upd-actions { display: flex; justify-content: flex-end; gap: 10px; margin-top: 12px; }
.ic-upd-all { background: var(--card); color: var(--fg); padding: 7px 14px; font-size: 13px; }
/* Green, like the diff's "added" side: reviewing is the positive action.
   Flips the theme tokens the way the danger button does — deep green/white
   in light, mint/ink in dark. */
.ic-upd-ack { display: inline-flex; align-items: center; gap: 7px; padding: 7px 14px; font-size: 13px;
  background: var(--add-fg); color: var(--card); }
.ic-upd-ack:hover { filter: brightness(1.06); }
.ic-upd-ack svg { width: 15px; height: 15px; stroke-width: 3; }
.ic-ack .ic-upd-ack { pointer-events: none; }
@media (max-width: 420px) { .ic-upd-grid { grid-template-columns: 1fr; } }

/* FMS Load mode: the quick-action button shows as active while the card body
   is swapped for the FMC-entry steps; the aircraft picker sits above them. */
.ic-quick-btn.active { background: var(--accent); border-color: var(--accent); color: #fff; }
.ic-quick-btn.active:hover:enabled { filter: brightness(1.08); }
.fms-aircraft { display: flex; justify-content: space-between; align-items: center;
  gap: 12px; margin-top: 14px; font-size: 14px; }
.ic-sec-title { display: flex; align-items: baseline; justify-content: space-between; gap: 8px; font-size: 13px; font-weight: 800; letter-spacing: .07em; text-transform: uppercase; color: var(--fg); margin-bottom: 5px; border-bottom: 1px solid var(--line); padding-bottom: 3px; }
.ic-clock, .ic-push { font-size: 13px; font-weight: 400; letter-spacing: 0; text-transform: none; color: var(--fg); font-variant-numeric: tabular-nums; white-space: nowrap; }
.ic-clock b, .ic-push b { font-weight: 700; }
.ic-push-t.push-soon { color: var(--warn-fg); }
.ic-push-t.push-past { color: var(--del-fg); }
.ic-row { display: flex; justify-content: space-between; align-items: baseline; gap: 12px; padding: 2px 0; font-size: 14px; }
.ic-row.ic-col { flex-direction: column; align-items: stretch; gap: 2px; }
.ic-sec-3col { display: grid; grid-template-columns: minmax(88px, auto) 1fr auto; column-gap: 12px; align-items: baseline; }
.ic-sec-3col .ic-sec-title { grid-column: 1 / -1; }
.ic-row3 { display: contents; }
.ic-row3 > * { padding: 2px 0; }
.ic-mid { text-align: center; font-weight: 600; font-variant-numeric: tabular-nums; }
.ic-label { color: var(--muted); flex: 0 0 auto; }
.ic-value { text-align: right; font-variant-numeric: tabular-nums; min-width: 0; }
.ic-col .ic-value { text-align: left; }
.ic-value b { font-weight: 700; }
.ic-stack { white-space: pre-line; } /* stacked OUT/OFF, ON/IN lines */
/* Change marks are green like the compare page's "added" side: new-release
   values are additions, not warnings. "Changes reviewed" (.ic-ack on the
   card) fades them to transparent in place. */
.ic-changed { background: var(--add-chip-bg); border-radius: 4px; padding: 0 4px; transition: background-color .8s ease; }
.ic-chg-w { background: var(--add-chip-bg); border-radius: 3px; padding: 0 2px; margin: 0 -2px; transition: background-color .8s ease; }
.ic-ack .ic-changed, .ic-ack .ic-chg-w { background: transparent; }
.ic-route { font-family: ui-monospace, SFMono-Regular, Menlo, monospace; font-size: 13px; overflow-wrap: anywhere; }
.ic-remarks { white-space: pre-wrap; font-family: ui-monospace, SFMono-Regular, Menlo, monospace; font-size: 12.5px; border: 1px solid var(--line); border-radius: 8px; padding: 10px; }

/* Route value: selectable like normal text, plus a tap-to-copy shortcut for
   the common case of wanting the whole route. */
.ic-copy { position: relative; cursor: pointer; -webkit-tap-highlight-color: transparent;
  user-select: text; -webkit-user-select: text; -webkit-touch-callout: default; }
.ic-copy:active { opacity: .6; }
.ic-copy.copied::after {
  content: "Copied"; position: absolute; right: 0; top: -19px;
  font-size: 11px; font-weight: 700; letter-spacing: .02em;
  color: var(--add-fg); background: var(--add-chip-bg);
  border-radius: 6px; padding: 1px 6px;
  animation: copy-flash 1.1s ease forwards;
}
@keyframes copy-flash {
  0% { opacity: 0; transform: translateY(2px); }
  15% { opacity: 1; transform: translateY(0); }
  75% { opacity: 1; }
  100% { opacity: 0; }
}
.ic-row.wt-close { cursor: pointer; }
/* Caution triangle (Lucide "triangle-alert" outline) instead of a full-value
   tint: stays legible next to word-level change highlights (green ic-chg-w)
   instead of layering another background under them. Sits right before the
   weight it warns about. Colored via mask so it tracks --warn-fg per theme. */
.ic-row.wt-close .ic-value::before {
  content: ""; display: inline-block; width: 14px; height: 14px; margin-right: 5px;
  vertical-align: -2px; background-color: var(--warn-fg);
  -webkit-mask: url("data:image/svg+xml,<svg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='black' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'><path d='m21.73 18-8-14a2 2 0 0 0-3.48 0l-8 14A2 2 0 0 0 4 21h16a2 2 0 0 0 1.73-3Z'/><path d='M12 9v4'/><path d='M12 17h.01'/></svg>") center / contain no-repeat;
  mask: url("data:image/svg+xml,<svg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='black' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'><path d='m21.73 18-8-14a2 2 0 0 0-3.48 0l-8 14A2 2 0 0 0 4 21h16a2 2 0 0 0 1.73-3Z'/><path d='M12 9v4'/><path d='M12 17h.01'/></svg>") center / contain no-repeat;
}
.wt-note { font-size: 12.5px; color: var(--muted); background: var(--warn-bg); border-radius: 6px; padding: 4px 8px; margin: 2px 0 4px; }
.limit-code { cursor: help; text-decoration: underline dotted; text-underline-offset: 2px; }
.info-drop { min-height: 120px; }

/* Blank info view: center the hero card vertically, like the upload screen.
   36px offsets the .info-screen vertical padding. */
.info-empty { flex: 1 1 100%; display: flex; align-items: center; justify-content: center;
  min-height: calc(100dvh - var(--chrome-h) - 36px); }

/* Single-release OFP pane: fills the right column, scrolls its pages
   internally, and stays put (sticky) while the info card scrolls past. */
.info-ofp { flex: 1 1 400px; max-width: 560px; position: sticky; top: 0;
  height: calc(100dvh - var(--chrome-h) - 36px);
  background: var(--card); border: 1px solid var(--line); border-radius: 12px;
  box-shadow: var(--shadow); overflow: hidden; }
.info-ofp.drag { border-color: var(--accent); }
.info-ofp .pane-head { border-radius: 12px 12px 0 0; }
.ofp-compare { position: relative; overflow: hidden; margin-left: auto; flex-shrink: 0;
  font-size: 11px; font-weight: 700; padding: 3px 9px; }
.ofp-compare input[type=file] { position: absolute; width: 1px; height: 1px; opacity: 0; }

/* ===== Promote (new release) button ===== */
/* Must fit inside .pane-head's 30px min-height (18px content line), or the
   NEW header outgrows the ORIGINAL one and the panes fall out of alignment. */
.pane-head .promote-btn { margin-left: auto; flex-shrink: 0;
  padding-top: 2px; padding-bottom: 2px; line-height: 12px; }
/* overflow: hidden (here and on .ofp-compare) clips the hidden file input's
   internal "Choose File" control: WebKit lays that control out ~85px wide
   regardless of the 1px host, and with nothing between .pane-head and <body>
   clipping, it extended the document 65px past the viewport — the Compare
   view could then be panned sideways on iPad. */
.promote-btn { position: relative; overflow: hidden; font-size: 11px; font-weight: 700; padding: 3px 9px; cursor: pointer; }
.promote-btn input[type=file] { position: absolute; width: 1px; height: 1px; opacity: 0; }
.promote-btn.busy { opacity: .55; pointer-events: none; }

/* ===== Confirm dialog (boarding-pass stub) ===== */
.confirm-backdrop { background: rgba(15,20,30,.5);
  backdrop-filter: blur(5px); -webkit-backdrop-filter: blur(5px);
  animation: confirm-fade .16s ease-out; }
/* The shared backdrop top-aligns (right for the tall settings modal); auto
   vertical margins re-center this short dialog. */
.confirm-modal { width: min(400px, 100%); padding: 0; margin-top: auto; margin-bottom: auto;
  animation: confirm-pop .22s cubic-bezier(.2, .85, .3, 1.08); }
.confirm-head { display: flex; align-items: center; gap: 13px; padding: 17px 18px 13px; }
.confirm-icon { flex: none; width: 40px; height: 40px; border-radius: 13px;
  display: flex; align-items: center; justify-content: center; font-size: 19px;
  background: var(--chip-bg); color: var(--chip-fg); }
.confirm-eyebrow { font-size: 10px; font-weight: 800; text-transform: uppercase;
  letter-spacing: 1.4px; color: var(--accent); margin-bottom: 2px; }
.confirm-title { margin: 0; font-size: 17px; letter-spacing: -.2px; }
.confirm-tear { border-top: 1.5px dashed var(--line); margin: 0 12px; }
.confirm-msg { margin: 0; padding: 13px 18px 4px; font-size: 13.5px; line-height: 1.55;
  color: var(--fg); }
.confirm-actions { display: flex; justify-content: flex-end; gap: 10px; padding: 14px 18px 16px; }
.confirm-modal.danger .confirm-icon { background: var(--del-chip-bg); color: var(--del-fg); }
.confirm-modal.danger .confirm-eyebrow { color: var(--del-fg); }
/* Danger button flips the theme tokens: maroon/white in light, pink/ink in dark. */
.confirm-modal.danger .primary-btn { background: var(--del-fg); color: var(--card); }
@keyframes confirm-fade { from { opacity: 0; } }
@keyframes confirm-pop { from { opacity: 0; transform: translateY(12px) scale(.95); } }
@media (prefers-reduced-motion: reduce) {
  .confirm-backdrop, .confirm-modal { animation: none; }
}

/* ===== Settings modal ===== */
.modal-backdrop { position: fixed; inset: 0; z-index: 60; background: rgba(15,20,30,.45);
  display: flex; align-items: flex-start; justify-content: center;
  padding: max(4vh, 20px) 16px calc(20px + env(safe-area-inset-bottom)); }
.settings-modal { width: min(440px, 100%); max-height: 88dvh; display: flex; flex-direction: column;
  background: var(--card); border: 1px solid var(--line); border-radius: 14px; box-shadow: var(--shadow); }
.sm-head { display: flex; align-items: center; justify-content: space-between;
  padding: 12px 16px; border-bottom: 1px solid var(--line); }
.sm-body { overflow-y: auto; padding: 12px 16px 16px; }
.sm-master-row { display: flex; align-items: center; justify-content: space-between; gap: 10px;
  padding: 6px 0 10px; border-bottom: 1px solid var(--line); }
.sm-master { display: flex; align-items: center; gap: 8px; font-weight: 600; font-size: 14px; }
.sm-sec { margin-top: 12px; }
.sm-sec.dragging, .sm-row.dragging { position: relative; z-index: 2; opacity: .92;
  background: var(--card); border-radius: 8px; box-shadow: 0 4px 14px rgba(15,20,30,.3); }
.dragging .sm-handle, .dragging.sm-row .sm-handle { cursor: grabbing; }
.sm-sec-head { display: flex; align-items: center; gap: 8px; font-size: 12px; font-weight: 800;
  letter-spacing: .07em; text-transform: uppercase; padding-bottom: 3px; border-bottom: 1px solid var(--line); }
.sm-hl-col { margin-left: auto; font-size: 9.5px; font-weight: 600; letter-spacing: .04em;
  color: var(--muted); text-transform: none; }
.sm-no-hl .sm-hl-col { opacity: .35; }
.sm-hl-all { display: flex; align-items: center; gap: 6px; flex-shrink: 0; }
.sm-color-row { display: flex; align-items: center; justify-content: flex-end; gap: 8px; padding: 8px 0 2px; }
.sm-color-label { font-size: 11px; color: var(--muted); }
.sm-swatch { width: 20px; height: 20px; border-radius: 50%; border: 1px solid var(--line);
  cursor: pointer; padding: 0; }
.sm-swatch.sel { outline: 2px solid var(--accent); outline-offset: 2px; }
.sm-no-hl .sm-color-row { opacity: .35; pointer-events: none; }
.sm-hl-btn { font: inherit; font-size: 11px; font-weight: 600; color: var(--chip-fg);
  background: var(--chip-bg); border: 1px solid var(--line); border-radius: 6px;
  padding: 2px 9px; cursor: pointer; }
.sm-no-hl .sm-hl-all { opacity: .35; pointer-events: none; }
.sm-row { display: flex; align-items: center; gap: 10px; padding: 5px 0 5px 14px; font-size: 14px; }
.sm-row-label { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.sm-handle { cursor: grab; color: var(--muted); touch-action: none; padding: 2px 4px;
  user-select: none; -webkit-user-select: none; }
.sm-show, .sm-hl { width: 17px; height: 17px; flex-shrink: 0; }
.sm-hl { accent-color: var(--hl-swatch, #e0b400); }
.sm-no-hl .sm-hl { opacity: .35; pointer-events: none; }
.sm-del { flex-shrink: 0; }
.sm-sec-del { margin-left: auto; text-transform: none; letter-spacing: 0; }
.sm-addsec, .sm-addnote { display: flex; gap: 8px; margin-top: 16px; align-items: center; }
.sm-addsec + .sm-addnote { margin-top: 10px; }
.sm-note-label, .sm-sec-name-input { flex: 1; min-width: 0; }
.sm-note-label, .sm-note-sec, .sm-sec-name-input { font: inherit; font-size: 13px; padding: 6px 8px;
  border: 1px solid var(--line); border-radius: 8px; background: var(--bg); color: var(--fg); }
.sm-sec-name-input[aria-invalid="true"] { border-color: var(--del-fg); }
.sm-foot { margin-top: 18px; display: flex; justify-content: center; }
.sm-reset { background: none; border: 1px solid var(--del-fg); color: var(--del-fg);
  border-radius: 8px; padding: 6px 14px; font-weight: 600; cursor: pointer; font-size: 13px; }
.sm-reset.confirm { background: var(--del-fg); color: var(--card); }
/* Custom note inputs in the info card: read like a plain value row at rest
   (no chrome, same size/alignment as .ic-value); the field border only
   appears while the note is focused for editing. */
.ic-note-input { font: inherit; font-size: 14px; text-align: right; min-width: 0; flex: 1;
  font-variant-numeric: tabular-nums; -webkit-appearance: none; appearance: none;
  border: 1px solid transparent; border-radius: 6px; padding: 0 6px; margin: -1px -6px -1px 0;
  background: transparent; color: var(--fg); }
.ic-note-input::placeholder { color: var(--muted); opacity: 1; }
.ic-note-input:focus { outline: none; border-color: var(--line); background: var(--bg); }
