:root {
  --bg: #0f1115;
  --surface: #171a21;
  --card: #1e222c;
  --border: #2a2f3a;
  --text: #e4e6eb;
  --muted: #8a93a6;
  --primary: #4fc3f7;
  --critical: #ef5350;
  --warning: #ffb74d;
  --info: #66bb6a;
  --success: #66bb6a;
  --font-ui: "Instrument Sans", -apple-system, BlinkMacSystemFont, "Segoe UI", system-ui, sans-serif;
  /* Monospace used only for NOTAM body text + the NOTAM ID chip — keeps
     the Q-line / A-B-C-E columns and tabular content aligned. */
  --font-mono: "Courier New", ui-monospace, monospace;
}

* { box-sizing: border-box; }
body {
  margin: 0;
  font-family: var(--font-ui);
  background: var(--bg);
  color: var(--text);
  font-size: 14px;
  -webkit-text-size-adjust: 100%;
  text-size-adjust: 100%;
}

/* Login */
.login-wrap {
  min-height: 100vh; display: grid; place-items: center;
}
.login-card {
  background: var(--surface); border: 1px solid var(--border);
  padding: 32px; border-radius: 12px; width: 320px; max-width: calc(100vw - 32px);
  display: flex; flex-direction: column; gap: 12px;
}
.login-card h1 { margin: 0; font-size: 22px; }
.login-card .subtitle { color: var(--muted); margin: 0 0 8px; }
.login-card label { display: flex; flex-direction: column; gap: 4px; }
.login-card label span { color: var(--muted); font-size: 12px; }
.login-card input {
  background: var(--card); border: 1px solid var(--border); color: var(--text);
  padding: 9px 11px; border-radius: 6px; font-size: 14px;
}
.login-card input:focus { outline: 2px solid var(--primary); }
.login-card button {
  margin-top: 8px;
  background: var(--primary); color: #001b29; border: 0;
  padding: 10px; border-radius: 6px; font-weight: 700; cursor: pointer;
}

/* Top bar */
.topbar {
  display: flex; align-items: center; gap: 16px;
  padding: 10px 16px; background: var(--surface);
  border-bottom: 1px solid var(--border);
}
.topbar .brand { font-weight: 800; letter-spacing: 0.5px; }
.topbar nav { display: flex; gap: 12px; flex: 1; }
.topbar nav a {
  color: var(--muted); text-decoration: none; padding: 6px 10px;
  border-radius: 6px;
}
.topbar nav a.active, .topbar nav a:hover { color: var(--text); background: var(--card); }
.topbar .user { display: flex; gap: 8px; align-items: center; color: var(--muted); }
.topbar .user .link {
  background: none; border: 0; color: var(--muted);
  text-decoration: underline; cursor: pointer; font-size: 13px;
}

/* Sticky bar */
.sticky-bar {
  display: flex; align-items: center; gap: 12px;
  padding: 10px 16px; background: var(--surface);
  border-bottom: 1px solid var(--border); position: sticky; top: 0; z-index: 5;
}
.sticky-bar .primary {
  background: var(--primary); color: #001b29; border: 0;
  padding: 8px 14px; border-radius: 6px; font-weight: 700; cursor: pointer;
}
.sticky-bar .filter-form { display: flex; gap: 6px; flex: 1; }
.sticky-bar .filter-input {
  flex: 1; background: var(--card); border: 1px solid var(--border);
  color: var(--text); padding: 8px 10px; border-radius: 6px;
  font-family: var(--font-ui); letter-spacing: 1px; text-transform: uppercase;
}
.sticky-bar .filter-form button {
  background: var(--card); border: 1px solid var(--border); color: var(--text);
  padding: 7px 12px; border-radius: 6px; cursor: pointer;
}
.sticky-bar .clear { color: var(--muted); align-self: center; font-size: 12px; }
.sticky-bar .count { color: var(--muted); font-size: 12px; }

/* Flash */
.flash { padding: 8px 16px; border-radius: 6px; margin: 8px 16px; }
.flash.ok    { background: rgba(102,187,106,0.15); border: 1px solid var(--success); color: var(--success); }
.flash.error { background: rgba(239,83,80,0.15);   border: 1px solid var(--critical); color: var(--critical); }

/* Modal (fetch summary) */
.modal-backdrop {
  position: fixed; inset: 0; background: rgba(0,0,0,0.55);
  display: flex; align-items: center; justify-content: center;
  z-index: 1000; padding: 16px;
}
.modal-card {
  background: var(--bg, #1e1e1e); color: inherit;
  border: 1px solid rgba(255,255,255,0.12); border-radius: 10px;
  width: 100%; max-width: 480px; padding: 0;
  box-shadow: 0 10px 40px rgba(0,0,0,0.6);
}
.modal-head {
  display: flex; align-items: center; justify-content: space-between;
  padding: 14px 18px; border-bottom: 1px solid rgba(255,255,255,0.08);
}
.modal-head h2 { margin: 0; font-size: 16px; font-weight: 600; }
.modal-close {
  background: none; border: 0; color: inherit;
  font-size: 22px; line-height: 1; cursor: pointer; padding: 0 4px;
}
.modal-files { list-style: none; margin: 0; padding: 12px 18px 4px; }
.modal-file { padding: 8px 0; border-bottom: 1px dashed rgba(255,255,255,0.06); }
.modal-file:last-child { border-bottom: 0; }
.modal-file-head {
  display: flex; align-items: center; gap: 8px;
  font-size: 14px; flex-wrap: wrap;
}
.modal-file.ok   .modal-file-mark { color: var(--success); font-weight: 700; }
.modal-file.fail .modal-file-mark { color: var(--critical); font-weight: 700; }
.modal-file-label  { font-weight: 600; }
.modal-file-name   { color: var(--muted); font-family: var(--font-ui); font-size: 12px; }
.modal-file-count  { margin-left: auto; color: var(--muted); font-size: 12px; }
.modal-file-sub    { color: var(--muted); font-size: 12px; margin-top: 2px; padding-left: 22px; }
.modal-file.fail .modal-file-sub { color: var(--critical); }
.modal-stats {
  padding: 12px 18px; font-size: 13px;
  border-top: 1px solid rgba(255,255,255,0.08);
}
.modal-stats strong { color: var(--success); }
.modal-foot { padding: 12px 18px 16px; display: flex; justify-content: flex-end; }

/* Inbox */
.inbox { padding: 12px 16px 40px; }
.empty {
  text-align: center; padding: 60px 20px; color: var(--muted);
}
.empty h2 { color: var(--text); margin: 0 0 8px; }
.empty .hint { font-size: 13px; }

.icao-group {
  background: var(--surface); border: 1px solid var(--border);
  border-radius: 10px; margin-bottom: 10px; padding: 8px 12px;
}
.icao-group summary {
  cursor: pointer; display: flex; align-items: center; gap: 12px;
  padding: 4px 0; list-style: none;
}
.icao-group summary::-webkit-details-marker { display: none; }
.icao-group .icao {
  font-weight: 800; font-size: 17px; letter-spacing: 1.5px; color: var(--primary);
}
.icao-group .badge {
  background: rgba(79,195,247,0.15); color: var(--primary);
  border: 1px solid rgba(79,195,247,0.4);
  padding: 2px 8px; border-radius: 8px; font-size: 11px; font-weight: 700;
}

.category { margin-left: 4px; padding: 8px 0; }
.category h3 {
  margin: 4px 0 6px; font-size: 13px; color: var(--muted); font-weight: 700;
  text-transform: uppercase; letter-spacing: 0.5px;
}
.category h3 small { color: var(--muted); font-weight: 400; }

.cards { display: flex; flex-direction: column; gap: 8px; }

.card {
  background: var(--card); border: 1px solid var(--border);
  border-left-width: 4px; border-radius: 8px; padding: 10px 12px;
  position: relative;
}
.card.urgency-border-critical { border-left-color: var(--critical); }
.card.urgency-border-warning  { border-left-color: var(--warning); }
.card.urgency-border-info     { border-left-color: var(--info); }

.card-head {
  display: flex; flex-wrap: wrap; gap: 10px; align-items: baseline;
  font-size: 12px; color: var(--muted); margin-bottom: 6px;
}
.card-head .notam-id { font-weight: 700; color: var(--text); font-family: var(--font-mono); }
.card-head .icao     { font-weight: 700; color: var(--primary); }
.card-head .condition {
  background: rgba(255,183,77,0.15); color: var(--warning);
  padding: 1px 6px; border-radius: 4px; font-size: 11px;
}

/* Temporal status pill: expired (grey), current (green), future (cyan).
   Replaces the urgency/category tag in card headers. */
.temporal {
  padding: 1px 8px; border-radius: 999px;
  font-size: 11px; font-weight: 700;
  text-transform: uppercase; letter-spacing: 0.5px;
}
.temporal-expired {
  background: rgba(255,152,0,0.16); color: #ff9800;
  border: 1px solid #ff9800;
}
.temporal-current {
  background: rgba(102,187,106,0.15); color: var(--success);
  border: 1px solid var(--success);
}
.temporal-future {
  background: rgba(79,195,247,0.15); color: var(--primary);
  border: 1px solid var(--primary);
}
.temporal-cancelled {
  background: rgba(239,83,80,0.18); color: var(--critical);
  border: 1px solid var(--critical);
}

/* Effective-time line, on its own row below the NOTAM ID for breathing room:
   start → end (duration) - schedule. Mono + muted throughout. */
.card-main .times {
  display: block;
  font-family: var(--font-mono); font-size: 12.5px; line-height: 1.4;
  color: var(--muted); margin: 0 0 8px;
}
.card-main .times .duration { margin-left: 4px; }

.card .raw {
  white-space: pre-wrap; word-break: break-word;
  font-family: var(--font-mono); font-size: 12.5px; line-height: 1.4;
  margin: 0 0 8px; color: var(--text);
}

.card-actions { display: flex; gap: 6px; flex-wrap: wrap; }
.card-actions button {
  background: var(--surface); border: 1px solid var(--border); color: var(--text);
  padding: 5px 12px; border-radius: 6px; font-size: 12px; cursor: pointer;
}
.card-actions button:hover { background: var(--border); }
.card-actions .muted { color: var(--muted); }
.card-actions .undo {
  border-color: var(--primary); color: var(--primary);
  padding: 6px 14px;
}
.card-head .decided-by {
  margin-left: auto; color: var(--muted); font-size: 11px; font-style: italic;
}
.card-head .decided-by strong { color: var(--text); font-style: normal; }

/* Right column: the vote list lives in its own track so it never pushes
   the NOTAM text down. The card grows to whichever column is taller. */
.deck-card .decisions-log {
  grid-area: log;
  /* nudge the first line onto the NOTAM-ID baseline */
  padding-top: 2px;
}
.decisions {
  margin: 0;
  padding: 0;
  list-style: none;
  color: var(--muted);
  font-size: 11px;
  font-style: italic;
  text-align: right;
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  gap: 1px;
  pointer-events: none;  /* keep clicks falling through to the card body */
}
.decisions li { list-style: none; display: block; }
.decisions strong { color: var(--text); font-style: normal; }
.decisions .verb { font-weight: 600; font-style: normal; }
.decisions .verb-saved   { color: var(--info); }      /* green */
.decisions .verb-ignored { color: var(--critical); }  /* red */
.decisions .verb-starred { color: var(--warning); }   /* yellow */
.decisions .verb-remark  { color: var(--primary); }
.decisions .verb-unread  { color: var(--muted); }
.decisions .superseded {
  text-decoration: line-through;
  color: var(--muted);
}
.decisions .superseded strong,
.decisions .superseded .verb {
  color: var(--muted);
  font-weight: normal;
}

.urgency-critical { color: var(--critical); }
.urgency-warning  { color: var(--warning); }
.urgency-info     { color: var(--info); }

/* Airport list (homepage) — tile grid */
.airport-list { padding: 12px 16px 40px; max-width: 1400px; margin: 0 auto; }

.tile-section { margin-bottom: 24px; }
.tile-section-title {
  margin: 0 0 10px; font-size: 13px; color: var(--muted);
  text-transform: uppercase; letter-spacing: 1px; font-weight: 700;
}
.empty-section { color: var(--muted); padding: 12px 4px; margin: 0; }

.tiles {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(120px, 1fr));
  gap: 8px;
}
.tile {
  position: relative;
  display: grid;
  grid-template-columns: 1fr auto;
  grid-template-rows: auto 1fr;
  gap: 4px;
  min-height: 72px;
  padding: 8px 12px 8px 16px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-left: 5px solid var(--country, var(--border));
  border-radius: 8px;
  text-decoration: none; color: inherit;
  transition: background 120ms ease, transform 120ms ease;
}
.tile:hover { background: var(--card); transform: translateY(-1px); }
.tile:focus-visible {
  outline: 2px solid var(--primary); outline-offset: -2px;
}
.tile-icao {
  grid-column: 1; grid-row: 1;
  justify-self: start; align-self: start;
  font-family: var(--font-ui);
  font-weight: 800; font-size: 18px; letter-spacing: 1.5px;
  color: var(--text);
}
.tile-unread {
  grid-column: 2; grid-row: 2;
  justify-self: end; align-self: end;
  font-weight: 800; font-size: 16px; line-height: 1;
  color: var(--muted); opacity: 0.55;
  font-variant-numeric: tabular-nums;
}
/* "No work pending" tiles — either the airport has no NOTAMs in the
   latest fetch, or every NOTAM it has has been decided. Stays on the
   list but renders as a dark-grey card so it visually recedes. */
.tile-zero {
  background: #15171c;
  border-color: #22252d;
  border-left-color: #2f333d;
}
.tile-zero .tile-icao   { color: var(--muted); }
.tile-zero .tile-unread { color: var(--muted); opacity: 0.35; }
.tile-zero:hover {
  background: #1b1e25; transform: translateY(-1px);
}

.tile-presence {
  position: absolute; top: 4px; right: 8px;
  font-size: 12px; color: var(--primary);
  background: rgba(79,195,247,0.12);
  border: 1px solid var(--primary);
  border-radius: 999px;
  padding: 1px 6px;
  line-height: 1;
}
.airport-row {
  background: var(--surface); border: 1px solid var(--border);
  border-left-width: 4px; border-radius: 10px;
}
.airport-row.urgency-border-critical { border-left-color: var(--critical); }
.airport-row.urgency-border-warning  { border-left-color: var(--warning); }
.airport-row.urgency-border-info     { border-left-color: var(--info); }
.airport-link {
  display: flex; align-items: center; gap: 14px;
  padding: 14px 18px; text-decoration: none; color: inherit;
}
.airport-link:hover { background: var(--card); }
.airport-link:focus,
.airport-link:focus-visible {
  outline: 2px solid var(--primary); outline-offset: -2px;
  background: var(--card);
}
.icao-big {
  font-size: 22px; font-weight: 800; letter-spacing: 2px;
  color: var(--primary); font-family: var(--font-ui);
}
.urgency-pill {
  text-transform: uppercase; font-size: 10px; font-weight: 700;
  padding: 3px 8px; border-radius: 8px; letter-spacing: 0.5px;
}
.urgency-pill.urgency-critical {
  background: rgba(239,83,80,0.18); color: var(--critical); border: 1px solid var(--critical);
}
.urgency-pill.urgency-warning {
  background: rgba(255,183,77,0.18); color: var(--warning); border: 1px solid var(--warning);
}
.urgency-pill.urgency-info {
  background: rgba(102,187,106,0.15); color: var(--info); border: 1px solid var(--info);
}
.count-pill {
  margin-left: auto; background: var(--card); color: var(--muted);
  padding: 4px 10px; border-radius: 8px; font-size: 12px; font-weight: 600;
  border: 1px solid var(--border);
}
.chev { color: var(--muted); font-size: 22px; line-height: 1; }

/* Deck */
.topbar .back {
  color: var(--muted); text-decoration: none; padding: 6px 10px; border-radius: 6px;
}
.topbar .back:hover { background: var(--card); color: var(--text); }
.deck-title { font-weight: 800; font-size: 18px; letter-spacing: 2px; color: var(--primary); }
.pill-count { font-weight: 400; opacity: 0.7; }

/* Airport-switcher dropdown — the deck title becomes a menu listing the
   airports the user filtered on the dashboard. Only rendered when >1 match. */
.deck-nav { position: relative; }
.deck-nav-trigger {
  display: inline-flex; align-items: center; gap: 6px;
  background: none; border: 0; cursor: pointer;
  padding: 2px 4px; margin: -2px -4px; border-radius: 6px;
  font-family: var(--font-ui);
}
.deck-nav-trigger:hover { background: var(--card); }
.deck-nav-caret { font-size: 12px; letter-spacing: 0; opacity: 0.7; }
.deck-nav.open .deck-nav-caret { transform: rotate(180deg); }
.deck-nav-panel {
  display: none;
  position: absolute; top: calc(100% + 6px); left: 0;
  min-width: 140px; max-height: 60vh; overflow-y: auto;
  background: var(--surface); border: 1px solid var(--border);
  border-radius: 8px; box-shadow: 0 8px 24px rgba(0,0,0,0.45);
  padding: 4px; z-index: 30;
}
.deck-nav.open .deck-nav-panel { display: block; }
.deck-nav-item {
  display: flex; align-items: center; gap: 8px;
  padding: 6px 8px; border-radius: 6px;
  text-decoration: none; color: var(--text);
}
.deck-nav-item:hover { background: var(--card); }
.deck-nav-sep { height: 1px; margin: 4px 6px; background: var(--border); }
.deck-nav-count { color: var(--muted); font-size: 14px; font-variant-numeric: tabular-nums; }
/* No undecided NOTAMs — grey out like the dashboard's .tile-zero. */
.deck-nav-item.zero .deck-nav-swatch { background: #2f333d; }
.deck-nav-item.zero .deck-nav-icao { color: var(--muted); }
.deck-nav-item.active { box-shadow: inset 0 0 0 1px var(--primary); }
.deck-nav-swatch {
  flex: none; width: 4px; height: 16px; border-radius: 2px;
  background: var(--border);
}
.deck-nav-icao {
  font-family: var(--font-ui);
  font-weight: 700; font-size: 16px; letter-spacing: 1.5px;
}

.deck-bar {
  display: flex; align-items: center;
  padding: 10px 16px; background: var(--surface);
  border-bottom: 1px solid var(--border);
  position: sticky; top: 0; z-index: 10;
}
.deck-bar-inner { width: 100%; display: flex; justify-content: center; align-items: center; }

.deck-bar .hints { color: var(--muted); font-size: 12px; margin-left: auto; }

/* Narrow/mobile: hide the decision log column so cards don't squash;
   stack status and temporal pill groups on separate lines. */
@media (max-width: 600px) {
  .deck-card .decisions-log { display: none; }
  .deck-card {
    grid-template-columns: 1fr;
    grid-template-areas: "main" "foot";
  }
  /* Pills: two centred rows (status + temporal) */
  .deck-bar .pills { flex-direction: column; align-items: center; gap: 8px; flex-wrap: nowrap; }
  .pill-group { display: flex; flex-wrap: nowrap; gap: 6px; }
  .pill-sep { display: none; }
  /* Topbar: drop username text to save space; keep the logout button */
  .topbar .user span { display: none; }
}
kbd {
  background: var(--card); border: 1px solid var(--border);
  padding: 1px 6px; border-radius: 4px; font-family: inherit;
  font-size: 12px; color: var(--text);
}

.deck {
  display: flex; flex-direction: column; align-items: center;
  padding: 16px 16px 60px;
}
.deck-search-bar {
  width: 100%; max-width: 780px;
  background: var(--card); border: 1px solid var(--border); color: var(--text);
  padding: 9px 12px; border-radius: 8px; font-size: 13px;
  font-family: var(--font-ui); margin-bottom: 16px;
}
.deck-search-bar::placeholder { color: var(--muted); }
.deck-search-bar:focus { outline: 2px solid var(--primary); border-color: var(--primary); }
mark.search-hl {
  background: #ffe600; color: #000;
  border-radius: 2px; padding: 0 1px;
}
#deck-stack { width: 100%; max-width: 780px; display: flex; flex-direction: column; gap: 16px; }
/* Persistent deck header (title bar + search/pill bar) — cards scroll
   under it. --deck-header-h is measured in deck.html so the scroll offset
   below stays accurate. */
.deck-card {
  position: relative;
  scroll-margin-top: 12px;
  /* Top row: NOTAM content | vote log. Bottom row: full-width actions. */
  display: grid;
  grid-template-columns: 1fr auto;
  grid-template-areas:
    "main log"
    "foot foot";
  column-gap: 16px; row-gap: 12px;
  align-items: start;
  background: var(--card); border: 1px solid var(--border); border-left-width: 6px;
  border-radius: 12px; padding: 18px 20px;
  box-shadow: 0 6px 20px rgba(0,0,0,0.35);
}
/* Top-left cell: header + NOTAM text. min-width:0 lets the raw block wrap
   instead of forcing the card wider. */
.deck-card .card-main { grid-area: main; min-width: 0; }
.deck-card .card-foot { grid-area: foot; }
.deck-card .raw {
  white-space: pre-wrap; word-break: break-word;
  font-family: var(--font-mono); font-size: 13px; line-height: 1.5;
  margin: 12px 0 16px; color: var(--text);
}
.deck-actions { display: flex; gap: 8px; flex-wrap: wrap; }
.deck-actions .act {
  flex: 1; min-width: 90px;
  padding: 10px 14px; border-radius: 8px; cursor: pointer; font-weight: 600;
  border: 1px solid var(--border); background: var(--surface); color: var(--text);
}
.deck-actions .act:hover { background: var(--border); }
.deck-actions .act:disabled { opacity: 0.3; cursor: not-allowed; }
.deck-actions .act:disabled:hover { background: var(--surface); }
.deck-actions .ignore { border-color: var(--critical); color: var(--critical); }
.deck-actions .save   { border-color: var(--success); color: var(--success); }
.deck-actions .star   { border-color: var(--warning); color: var(--warning); }
.deck-actions .remark { border-color: var(--primary); color: var(--primary); }

/* Active vs passive cards in the deck list view */
.deck-card.passive { cursor: pointer; }
.deck-card.passive .deck-actions,
.deck-card.passive .remark-row { display: none; }
.deck-card.active  { box-shadow: 0 0 0 2px var(--primary); }

/* Brief confirmation pulse when a decision lands (card stays in place). */
.deck-card.just-decided {
  animation: deck-pulse 400ms ease;
}
@keyframes deck-pulse {
  0%   { box-shadow: 0 0 0 2px var(--primary); }
  100% { box-shadow: 0 6px 20px rgba(0,0,0,0.35); }
}

/* Filter pills in the deck bar. */
.deck-bar .pills { display: flex; gap: 6px; align-items: center; flex-wrap: wrap; justify-content: center; }
/* On wide screens pill-group is transparent — children flow as direct pill-row members.
   Must be scoped to min-width so it doesn't override the narrow-screen display:flex rule
   (same specificity, later source order would otherwise win). */
@media (min-width: 601px) {
  .pill-group { display: contents; }
}
.pill {
  background: var(--surface); border: 1px solid var(--border); color: var(--muted);
  padding: 4px 12px; border-radius: 999px; font-size: 12px; font-weight: 600;
  cursor: pointer;
}
.pill:hover { color: var(--text); background: var(--border); }
.pill.active[data-temporal="cancelled"] { color: var(--critical); border-color: var(--critical); background: rgba(239,83,80,0.18); }
.pill.active[data-temporal="expired"]   { color: #ff9800;         border-color: #ff9800;         background: rgba(255,152,0,0.16); }
.pill.active[data-temporal="current"]   { color: var(--success);  border-color: var(--success);  background: rgba(102,187,106,0.15); }
.pill.active[data-temporal="future"]    { color: var(--primary);  border-color: var(--primary);  background: rgba(79,195,247,0.15); }
.pill.active[data-status="unread"]      { color: var(--text);     border-color: var(--text);     background: rgba(255,255,255,0.10); }
.pill.active[data-status="ignored"]     { color: var(--critical); border-color: var(--critical); background: rgba(239,83,80,0.18); }
.pill.active[data-status="saved"]       { color: var(--success);  border-color: var(--success);  background: rgba(102,187,106,0.15); }
.pill.active[data-status="starred"]     { color: var(--warning);  border-color: var(--warning);  background: rgba(255,193,7,0.15); }
.pill-sep { color: var(--border); padding: 0 2px; line-height: 26px; user-select: none; }

/* Remark input row (active card only) */
.remark-row {
  display: flex; gap: 8px; margin-top: 12px;
}
.remark-row .remark-input {
  flex: 1; background: var(--card); border: 1px solid var(--primary);
  color: var(--text); padding: 10px 12px; border-radius: 6px; font-size: 14px;
}
.remark-row .remark-input:focus { outline: 2px solid var(--primary); }
.remark-row .remark-save {
  padding: 10px 16px; border-radius: 6px; border: 1px solid var(--primary);
  background: var(--primary); color: #001b29; font-weight: 700; cursor: pointer;
}
.remark-row .remark-save:disabled {
  opacity: 0.35; cursor: not-allowed;
}
.remark-row .remark-clear {
  padding: 10px 14px; border-radius: 6px; border: 1px solid var(--border);
  background: transparent; color: var(--text); opacity: 0.5; cursor: pointer;
}
.remark-row .remark-clear:hover { opacity: 1; background: var(--surface); }

/* Starred cards (rendered in the Saved tab union) get a prominent
   yellow border on all sides plus a soft glow */
.card.card-status-starred {
  border: 2px solid var(--warning);
  box-shadow: 0 0 0 1px rgba(255,183,77,0.3), 0 0 18px rgba(255,183,77,0.18);
  padding: 9px 11px;   /* compensate so the thicker border doesn't shift the layout */
}

/* List-card action buttons */
.card-actions .act-remove-star {
  border-color: var(--warning); color: var(--warning);
}
.card-actions .act-to-ignore {
  border-color: var(--muted); color: var(--muted);
}

/* Inline search input shared by deck and list views */
.search-input {
  flex: 1; min-width: 160px; max-width: 360px;
  background: var(--card); border: 1px solid var(--border); color: var(--text);
  padding: 7px 10px; border-radius: 6px; font-size: 13px;
}
.search-input:focus { outline: 2px solid var(--primary); }

/* Reconstructed full NOTAM block, hidden by default — toggled globally
   by Space (body.show-raw). */
.raw-full {
  display: none;
  background: rgba(0,0,0,0.25);
  border: 1px solid var(--border); border-radius: 6px;
  padding: 8px 10px; margin: 6px 0 0;
  white-space: pre-wrap; word-break: break-word;
  font-family: var(--font-mono); font-size: 12px; line-height: 1.45;
  color: var(--muted);
}
body.show-raw .raw-full,
.deck-card.show-raw .raw-full { display: block; }


/* Presence pill on airport-list rows ("alice is reviewing"). */
.presence-pill {
  display: inline-flex; align-items: center; gap: 4px;
  padding: 2px 8px; margin-left: 8px;
  background: rgba(79,195,247,0.12); color: var(--primary);
  border: 1px solid var(--primary); border-radius: 999px;
  font-size: 12px;
}

/* Conflict toast (optimistic-concurrency 409). */
#toast-host {
  position: fixed; top: 20px; left: 50%; transform: translateX(-50%);
  display: flex; flex-direction: column; gap: 8px; z-index: 2000;
  pointer-events: none;
}
.conflict-toast {
  background: var(--critical); color: #fff;
  padding: 10px 16px; border-radius: 8px; font-size: 13px;
  box-shadow: 0 4px 16px rgba(0,0,0,0.5);
  animation: toast-in 180ms ease;
}
@keyframes toast-in {
  from { opacity: 0; transform: translateY(-8px); }
  to   { opacity: 1; transform: translateY(0); }
}

/* Filter checkbox in the Saved tab sticky bar */
.checkbox-label {
  display: inline-flex; align-items: center; gap: 6px;
  color: var(--muted); font-size: 13px; cursor: pointer;
}
.checkbox-label input { accent-color: var(--primary); cursor: pointer; }

/* Remark text shown on list-view cards */
/* Saved remark — metadata, not a decision. The attribution line mirrors the
   decision-log style (muted italic, coloured verb, bold author); the remark
   text drops to the next line. */
.remark-shown {
  /* 12px below to match the buttons → remark-input gap (.remark-row margin). */
  margin: 8px 0 12px; padding: 8px 12px;
  background: rgba(79,195,247,0.08); border-left: 3px solid var(--primary);
  border-radius: 4px;
}
.remark-shown[hidden] { display: none; }
.remark-shown .remark-meta {
  color: var(--muted); font-size: 11px; font-style: italic;
}
.remark-shown .remark-meta strong { color: var(--text); font-style: normal; }
.remark-shown .remark-meta .verb-remark {
  color: var(--primary); font-weight: 600; font-style: normal;
}
.remark-shown .remark-text {
  margin-top: 2px; font-size: 13px; color: var(--text);
  white-space: pre-wrap; word-break: break-word;
}

.primary-link {
  display: inline-block; margin-top: 12px;
  background: var(--primary); color: #001b29;
  padding: 8px 16px; border-radius: 6px; font-weight: 700; text-decoration: none;
}

/* Admin page */
.admin-wrap {
  max-width: 680px; margin: 28px auto; padding: 0 20px 60px;
}
.admin-page-title {
  font-size: 22px; font-weight: 700; margin: 0 0 20px; letter-spacing: -0.3px;
}
.admin-flash {
  padding: 10px 14px; border-radius: 6px; margin-bottom: 16px;
  font-size: 13px; border-left: 3px solid var(--info);
  background: var(--surface); border: 1px solid var(--border);
  border-left: 3px solid var(--info);
}
.admin-flash-error { border-left-color: var(--critical) !important; }
.admin-flash-info  { border-left-color: var(--primary) !important; }
.admin-section {
  margin-bottom: 36px;
}
.admin-section-head {
  display: flex; align-items: center; gap: 16px; margin-bottom: 4px;
}
.admin-section-title {
  font-size: 13px; font-weight: 700; letter-spacing: 0.08em;
  text-transform: uppercase; color: var(--muted);
  margin: 0 0 12px;
}
.admin-section-head .admin-section-title { margin: 0; }
.admin-hint {
  font-size: 12px; color: var(--muted); margin: 4px 0 0;
}

/* SCRAPE button */
.btn-scrape {
  background: var(--warning); color: #1a1000;
  border: none; border-radius: 6px; padding: 7px 16px;
  font-family: var(--font-ui); font-size: 12px; font-weight: 700;
  letter-spacing: 0.06em; cursor: pointer; transition: opacity 0.15s;
}
.btn-scrape:hover { opacity: 0.85; }

/* Scrape live-progress panel. No margin on the container itself so the idle
   (empty-but-for-whitespace) state collapses to nothing; spacing lives on the
   head/log, which only render when there's something to show. */
.scrape-status-head {
  display: flex; align-items: center; gap: 8px;
  font-size: 12px; font-weight: 700; margin: 12px 0 6px;
}
.scrape-head-running { color: var(--warning); }
.scrape-head-ok      { color: var(--success); }
.scrape-head-error   { color: var(--critical); }
.scrape-status-count {
  margin-left: auto; color: var(--muted); font-weight: 400;
  font-variant-numeric: tabular-nums;
}
.scrape-spinner {
  width: 12px; height: 12px; border-radius: 50%;
  border: 2px solid rgba(255,183,77,0.3); border-top-color: var(--warning);
  animation: scrape-spin 0.7s linear infinite;
}
@keyframes scrape-spin { to { transform: rotate(360deg); } }
.scrape-log {
  margin: 0; max-height: 300px; overflow-y: auto;
  background: var(--bg); border: 1px solid var(--border); border-radius: 6px;
  padding: 10px 12px;
  font-family: var(--font-mono); font-size: 12px; line-height: 1.5;
  color: var(--muted); white-space: pre-wrap; word-break: break-word;
}

/* Admin tables */
.admin-table {
  width: 100%; border-collapse: collapse; font-size: 13px;
}
.admin-table th {
  color: var(--muted); font-weight: 600; font-size: 11px;
  letter-spacing: 0.06em; text-transform: uppercase;
  padding: 6px 10px; border-bottom: 1px solid var(--border);
  text-align: left;
}
.admin-table td {
  padding: 7px 10px; border-bottom: 1px solid var(--border);
  vertical-align: middle;
}
.admin-table .row-inactive td { opacity: 0.4; }
.col-icao { font-family: var(--font-mono); font-size: 13px; }
.col-status { width: 40px; }
.col-toggle { width: 52px; }
.col-trash  { width: 36px; }
.col-empty  { color: var(--muted); font-style: italic; padding: 12px 10px; }

/* Status dot */
.status-dot {
  display: inline-block; width: 8px; height: 8px; border-radius: 50%;
  vertical-align: middle;
}
.dot-green { background: var(--success); box-shadow: 0 0 4px var(--success); }
.dot-red   { background: var(--critical); box-shadow: 0 0 4px var(--critical); }

/* Toggle switch */
.toggle-btn {
  position: relative; display: inline-block;
  width: 36px; height: 20px; border-radius: 10px;
  border: none; cursor: pointer; padding: 0;
  transition: background 0.2s;
  flex-shrink: 0;
}
.toggle-on  { background: var(--success); }
.toggle-off { background: var(--border); }
.toggle-thumb {
  position: absolute; top: 2px;
  width: 16px; height: 16px; border-radius: 50%;
  background: #fff; transition: left 0.2s;
}
.toggle-on  .toggle-thumb { left: 18px; }
.toggle-off .toggle-thumb { left: 2px; }

/* Trash icon button */
.btn-trash {
  background: none; border: none; cursor: pointer;
  color: var(--muted); padding: 5px; border-radius: 5px;
  display: flex; align-items: center; justify-content: center;
  transition: color 0.15s, background 0.15s;
}
.btn-trash:hover {
  color: var(--critical);
  background: rgba(239, 83, 80, 0.12);
}

/* Add form */
.admin-add-form {
  display: flex; gap: 8px; flex-wrap: wrap; align-items: center;
}
.admin-icao-input {
  background: var(--card); border: 1px solid var(--border); color: var(--text);
  padding: 8px 10px; border-radius: 6px; font-family: var(--font-mono);
  font-size: 13px; width: 110px;
}
.admin-icao-input:focus { outline: 2px solid var(--primary); }
.admin-type-select {
  background: var(--card); border: 1px solid var(--border); color: var(--text);
  padding: 8px 10px; border-radius: 6px; font-size: 13px;
}

/* ── Top-level tabs (Airports | Records) ─────────────────────────────────── */
.topbar nav.tabs a { font-weight: 600; }
.topbar nav.tabs a.active {
  color: var(--text); background: var(--card);
  box-shadow: inset 0 -2px 0 var(--primary);
}

/* ── Records grid (read-only oversight spreadsheet) ──────────────────────── */
/* Bounded-height scroll container so the sticky header pins while rows scroll.
   Deliberately denser and flatter than the card deck. */
.records-wrap { height: calc(100vh - 50px); overflow: auto; }
.records-empty { color: var(--muted); padding: 24px 16px; font-style: italic; }

.records-table {
  width: 100%; border-collapse: collapse; table-layout: fixed;
  font-family: var(--font-mono); font-size: 13px;
}

/* Each header cell stacks a column title above its filter control. */
.records-table thead th {
  position: sticky; top: 0; z-index: 2;
  background: var(--surface); border-bottom: 1px solid var(--border);
  padding: 6px 8px; text-align: left; vertical-align: top;
}
.rec-col-title {
  color: var(--muted); font-size: 11px; font-weight: 600;
  letter-spacing: 0.06em; text-transform: uppercase; margin-bottom: 5px;
}
.records-table .rec-filter {
  width: 100%; box-sizing: border-box;
  background: var(--card); border: 1px solid var(--border); color: var(--text);
  padding: 4px 6px; border-radius: 5px; font-size: 12px; font-family: var(--font-mono);
}
.records-table .rec-filter:focus { outline: 1px solid var(--primary); }

.records-table tbody td {
  padding: 6px 8px; border-bottom: 1px solid var(--border);
  vertical-align: top; overflow: hidden;
}
.records-table tbody tr:nth-child(even) td { background: rgba(255, 255, 255, 0.018); }
.records-table tbody tr:hover td { background: var(--surface); }

/* Fixed column widths (table-layout: fixed); NOTAM Text takes what's left. */
.records-table .col-icao  { width: 78px; }
.records-table .col-date  { width: 132px; color: var(--muted); white-space: nowrap; }
.records-table .col-sched { width: 150px; color: var(--muted); }
.records-table .col-id    { width: 96px; }
.records-table .col-decision { width: 90px; }
.records-table .col-by   { width: 120px; }
.records-table .col-at   { width: 132px; color: var(--muted); white-space: nowrap; }

/* NOTAM text: one truncated line by default, full text only on row focus. */
.rec-text {
  font-family: var(--font-mono); font-size: 12px;
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.rec-row { cursor: default; }
.rec-row:focus { outline: none; }
.rec-row:focus td { background: rgba(79, 195, 247, 0.10); }
.rec-row:focus td.col-icao { box-shadow: inset 3px 0 0 var(--primary); }
.rec-row:focus .rec-text { white-space: pre-wrap; overflow: visible; word-break: break-word; }

/* Decision label — colour mirrors the deck pill vocabulary. */
.rec-decision { font-weight: 600; font-size: 12px; }
.rec-decision-unread  { color: var(--muted); }
.rec-decision-saved   { color: var(--success); }
.rec-decision-starred { color: var(--warning); }
.rec-decision-ignored { color: var(--critical); }

/* ICAO swatch — same country hue as the dashboard tiles. */
.rec-icao-tab {
  display: inline-block; width: 4px; height: 12px; border-radius: 2px;
  margin-right: 7px; vertical-align: -1px;
}

/* ── Records page navigation — centred in the topbar ─────────────────────── */
.records-topbar { position: relative; }
.records-pager {
  position: absolute; left: 50%; transform: translateX(-50%);
  display: flex; align-items: center; gap: 6px;
}
.pager-btn {
  background: var(--card); border: 1px solid var(--border); color: var(--text);
  width: 26px; height: 26px; border-radius: 6px; cursor: pointer;
  font-size: 15px; line-height: 1;
  display: flex; align-items: center; justify-content: center;
}
.pager-btn:hover:not(:disabled) { background: var(--border); }
.pager-btn:disabled { opacity: 0.4; cursor: default; }
.pager-select {
  background: var(--card); border: 1px solid var(--border); color: var(--text);
  padding: 4px 8px; border-radius: 6px; font-size: 12px; cursor: pointer;
}
.pager-select:disabled { opacity: 0.4; }

/* ── Date-column header trigger + from/to popover ────────────────────────── */
.records-table th.col-date { position: relative; }
.rec-date-trigger {
  background: none; border: 0; padding: 0; cursor: pointer;
  color: var(--muted); font-size: 11px; font-weight: 600;
  letter-spacing: 0.06em; text-transform: uppercase; font-family: var(--font-mono);
  display: inline-flex; align-items: center; gap: 4px; margin-bottom: 5px;
}
.rec-date-trigger:hover { color: var(--text); }
.rec-caret { font-size: 9px; }
.records-table th.col-date.filter-active .rec-date-trigger { color: var(--primary); }
.records-table th.col-date.menu-open   .rec-date-trigger { color: var(--text); }

.rec-date-menu {
  position: absolute; top: 100%; left: 0; z-index: 20; margin-top: 4px;
  width: 214px; background: var(--card); border: 1px solid var(--border);
  border-radius: 8px; padding: 10px; box-shadow: 0 8px 24px rgba(0, 0, 0, 0.45);
  display: flex; flex-direction: column; gap: 6px;
  font-family: var(--font-ui); text-transform: none; letter-spacing: normal;
}
/* `display: flex` above would otherwise beat the low-specificity UA
   `[hidden] { display: none }`, so re-assert it — the popover opens on click only. */
.rec-date-menu[hidden] { display: none; }
/* Rightmost (Decision At) drops leftwards so it doesn't clip off-screen. */
.records-table th.col-date:last-child .rec-date-menu { left: auto; right: 0; }
.rec-date-row { display: flex; align-items: center; gap: 8px; }
.rec-date-label {
  color: var(--muted); font-size: 11px; width: 34px; flex-shrink: 0;
  text-transform: uppercase; letter-spacing: 0.04em;
}
.rec-date-input {
  flex: 1; min-width: 0;
  background: var(--surface); border: 1px solid var(--border); color: var(--text);
  padding: 4px 6px; border-radius: 5px; font-size: 12px; font-family: var(--font-mono);
}
.rec-date-input:focus { outline: 1px solid var(--primary); }
.rec-date-range { width: 100%; accent-color: var(--primary); cursor: pointer; }
.rec-date-clear {
  align-self: flex-end; margin-top: 2px;
  background: none; border: 0; color: var(--muted); cursor: pointer;
  font-size: 12px; text-decoration: underline; padding: 2px 0;
}
.rec-date-clear:hover { color: var(--text); }
