/* DispatchWx ingestion UI. Built on the Invictus Flugtechnik v4.0 design tokens
   (static/ds/tokens.css). This file only wires the ingestion screens to those
   tokens; brand values (color, type, spacing, radii, shadows) live in tokens.css
   so a future restyle changes tokens, not this file. No em-dashes in prose. */

body {
  font: var(--text-body);
  color: var(--color-text);
  /* Signature faint blueprint grid on cloud. */
  background-color: var(--ift-cloud-050);
  background-image:
    linear-gradient(rgba(10, 22, 40, 0.04) 1px, transparent 1px),
    linear-gradient(90deg, rgba(10, 22, 40, 0.04) 1px, transparent 1px);
  background-size: var(--grid-module) var(--grid-module);
  min-height: 100vh;
}

/* ---- Top bar: navy blueprint with the wordmark ---- */
.topbar {
  display: flex; align-items: center; justify-content: space-between;
  gap: var(--space-6);
  padding: var(--space-4) var(--space-8);
  background-color: var(--ift-navy);
  background-image:
    linear-gradient(var(--blueprint-line) 1px, transparent 1px),
    linear-gradient(90deg, var(--blueprint-line) 1px, transparent 1px);
  background-size: var(--grid-module) var(--grid-module);
  border-bottom: var(--rule-weight) solid var(--ift-amber);
}
.brand {
  font-family: var(--font-display); font-weight: var(--weight-medium);
  font-size: var(--text-xl); letter-spacing: var(--tracking-wide);
  color: var(--ift-white); line-height: 1;
}
.brand-sub {
  font-family: var(--font-mono); font-weight: var(--weight-medium);
  font-size: var(--text-2xs); letter-spacing: var(--tracking-widest);
  text-transform: uppercase; color: var(--ift-amber); margin-left: var(--space-3);
}
.brand-tld { color: var(--ift-amber); }

/* Login page */
.login-body { min-height: 100vh; display: flex; align-items: center; justify-content: center;
  background-color: var(--ift-navy);
  background-image: linear-gradient(var(--blueprint-line) 1px, transparent 1px), linear-gradient(90deg, var(--blueprint-line) 1px, transparent 1px);
  background-size: var(--grid-module) var(--grid-module); padding: var(--space-5); }
.login-card { width: 100%; max-width: 360px; background: var(--color-surface);
  border: 1px solid var(--color-border); border-radius: var(--radius-xl);
  box-shadow: var(--shadow-xl); padding: var(--space-8); }
.login-brand .brand { color: var(--ift-navy); font-size: var(--text-2xl); }
.login-sub { font-family: var(--font-mono); font-size: var(--text-2xs); text-transform: uppercase;
  letter-spacing: var(--tracking-widest); color: var(--color-text-muted); margin-top: 6px; }
.login-card .ift-rule { margin: var(--space-4) 0 var(--space-5); }
.login-form { display: flex; flex-direction: column; gap: var(--space-4); }
.login-form label { display: flex; flex-direction: column; gap: 6px; font-family: var(--font-mono);
  font-size: var(--text-2xs); text-transform: uppercase; letter-spacing: var(--tracking-wide); color: var(--color-text-muted); }
.login-form input { height: 40px; box-sizing: border-box; padding: 0 var(--space-3);
  font: var(--text-body-sm); border: 1px solid var(--color-border); border-radius: var(--radius-sm);
  background: var(--color-surface); color: var(--color-text); }
.login-form input:focus { outline: none; border-color: var(--color-primary); box-shadow: var(--focus-ring); }
.login-form button { height: 42px; margin-top: 4px; font: var(--text-label); letter-spacing: var(--tracking-wide);
  color: #fff; background: var(--color-primary); border: none; border-radius: var(--radius-sm); cursor: pointer; }
.login-form button:hover { background: var(--color-primary-hover); }
.login-error { background: rgba(229,72,77,0.09); color: #C13438; font-size: var(--text-xs);
  padding: 10px 12px; border-radius: var(--radius-sm); margin-bottom: var(--space-4); }

/* Sign out control in the top nav */
.nav-logout { display: inline; margin-left: var(--space-4); }
.nav-logout button { background: none; border: none; padding: 0; cursor: pointer;
  font-family: var(--font-sans); font-size: var(--text-xs); color: #7C8BA0; }
.nav-logout button:hover { color: #fff; }
.nav { display: flex; gap: var(--space-5); align-items: center; }
.nav a {
  font-family: var(--font-sans); font-size: var(--text-sm);
  color: var(--ift-cloud-muted); padding-bottom: 2px;
  border-bottom: var(--border-thick) solid transparent;
  transition: var(--transition-base);
}
.nav a:hover { color: var(--ift-white); text-decoration: none; }
.nav a.on { color: var(--ift-white); border-bottom-color: var(--ift-amber); }

/* ---- Layout ---- */
.content { max-width: var(--container-xl); margin: 0 auto; padding: var(--space-8) var(--gutter) var(--space-16); }
h1 { font: var(--text-h3); color: var(--color-text); }
h2 { font: var(--text-h4); color: var(--color-text); margin-top: var(--space-8); }
.hint { font: var(--text-body-sm); color: var(--color-text-muted); margin: var(--space-2) 0 var(--space-5); }

/* ---- Filters card ---- */
.filters {
  display: flex; flex-wrap: wrap; gap: var(--space-5); align-items: flex-end;
  background: var(--color-surface); border: var(--border-hairline) solid var(--color-border);
  border-radius: var(--radius-lg); padding: var(--space-4) var(--space-5); box-shadow: var(--shadow-sm);
}
.filters label {
  display: flex; flex-direction: column; gap: var(--space-1);
  font-family: var(--font-mono); font-size: var(--text-2xs);
  letter-spacing: var(--tracking-wide); text-transform: uppercase; color: var(--color-text-muted);
}
/* Filter controls share one height so inputs, selects and the button line up. */
.filters input, .filters select, .filters button { height: 36px; box-sizing: border-box; }
.filters input, .filters select {
  font-family: var(--font-sans); font-size: var(--text-sm); padding: 0 var(--space-3);
  border: var(--border-hairline) solid var(--color-border); border-radius: var(--radius-sm);
  background: var(--color-surface); color: var(--color-text); min-width: 130px;
  appearance: none; -webkit-appearance: none; transition: var(--transition-base);
}
.filters select {
  padding-right: 30px;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='10' height='6' viewBox='0 0 10 6'%3E%3Cpath d='M1 1l4 4 4-4' stroke='%235E6B7E' stroke-width='1.5' fill='none'/%3E%3C/svg%3E");
  background-repeat: no-repeat; background-position: right 11px center;
}
.filters input:focus, .filters select:focus { outline: none; border-color: var(--color-primary); box-shadow: var(--focus-ring); }

button, .filters button {
  font: var(--text-label); cursor: pointer; color: var(--color-text-on-accent);
  background: var(--color-primary); border: none; border-radius: var(--radius-sm);
  padding: var(--space-2) var(--space-4); letter-spacing: var(--tracking-wide);
  transition: var(--transition-base);
}
button:hover, .filters button:hover { background: var(--color-primary-hover); }
button:focus-visible { outline: none; box-shadow: var(--focus-ring); }

/* ---- Results + tables ---- */
.results-meta {
  font-family: var(--font-mono); font-size: var(--text-xs); color: var(--color-text-muted);
  margin: var(--space-5) 0 var(--space-3); letter-spacing: var(--tracking-wide);
}
.table-scroll {
  overflow-x: auto; border: var(--border-hairline) solid var(--color-border);
  border-radius: var(--radius-lg); background: var(--color-surface); box-shadow: var(--shadow-sm);
}
table.data { width: 100%; border-collapse: collapse; font-size: var(--text-sm); }
table.data th {
  text-align: left; font-family: var(--font-mono); font-weight: var(--weight-medium);
  font-size: var(--text-2xs); letter-spacing: var(--tracking-wide); text-transform: uppercase;
  color: var(--color-text-muted); padding: var(--space-3) var(--space-4);
  border-bottom: var(--border-hairline) solid var(--color-border); white-space: nowrap;
  background: var(--color-surface-sunken); position: sticky; top: 0;
}
table.data td { padding: var(--space-3) var(--space-4); border-bottom: var(--border-hairline) solid var(--color-hairline); vertical-align: top; }
table.data tbody tr:last-child td { border-bottom: none; }
table.data tbody tr:hover td { background: rgba(11, 114, 255, 0.03); }
.mono { font-family: var(--font-mono); }
.nowrap { white-space: nowrap; }
.raw { font-family: var(--font-mono); color: var(--color-text-muted); word-break: break-word; min-width: 300px; }
.empty { color: var(--color-text-muted); text-align: center; padding: var(--space-8); }

/* Flight category (standard aviation convention) */
.cat { text-align: center; font-weight: var(--weight-medium); }
.cat-VFR { color: var(--ift-success); }
.cat-MVFR { color: var(--ift-blue); }
.cat-IFR { color: var(--ift-danger); }
.cat-LIFR { color: #B5179E; }
.cat-na { color: var(--color-text-faint); }

/* ---- Pager ---- */
.pager { display: flex; align-items: center; gap: var(--space-4); margin-top: var(--space-4);
  font-family: var(--font-mono); font-size: var(--text-xs); color: var(--color-text-muted); }
.pager a { padding: var(--space-1) var(--space-3); border: var(--border-hairline) solid var(--color-border);
  border-radius: var(--radius-sm); color: var(--color-primary); }
.pager a:hover { text-decoration: none; background: var(--color-surface); box-shadow: var(--shadow-xs); }

/* ---- Station badges ---- */
.badge { font-family: var(--font-mono); font-size: var(--text-2xs); padding: 2px var(--space-2);
  border-radius: var(--radius-pill); letter-spacing: var(--tracking-wide); text-transform: uppercase; }
.badge.on { background: rgba(30, 158, 90, 0.12); color: var(--ift-success); }
.badge.off { background: rgba(94, 107, 126, 0.14); color: var(--color-text-muted); }
.row-inactive td:not(:last-child) { opacity: 0.55; }

/* ---- Health cards ---- */
.cards { display: grid; grid-template-columns: repeat(auto-fit, minmax(240px, 1fr)); gap: var(--space-4); margin: var(--space-4) 0; }
.card { background: var(--color-surface); border: var(--border-hairline) solid var(--color-border);
  border-radius: var(--radius-lg); padding: var(--space-5); box-shadow: var(--shadow-sm); }
.card-title { font-family: var(--font-mono); font-size: var(--text-2xs); letter-spacing: var(--tracking-widest);
  text-transform: uppercase; color: var(--color-text-muted); }
.card-outcome { font: var(--text-h4); margin: var(--space-2) 0 var(--space-1); }
.card-meta { font-family: var(--font-mono); font-size: var(--text-xs); color: var(--color-text-muted); }
.card-counts { margin-top: var(--space-3); display: flex; flex-wrap: wrap; gap: var(--space-1); }
.pill { font-family: var(--font-mono); font-size: var(--text-2xs); background: var(--color-surface-sunken);
  border: var(--border-hairline) solid var(--color-border); border-radius: var(--radius-pill);
  padding: 2px var(--space-2); color: var(--color-text-muted); }

/* Outcome status colors, reused in the cards and the runs table */
.outcome-SUCCESS { color: var(--ift-success); }
.outcome-NOT_MODIFIED { color: var(--color-text-muted); }
.outcome-FAILED, .outcome-RATE_LIMITED { color: var(--ift-danger); }
.outcome-BACKOFF_ACTIVE, .outcome-LOCKED { color: var(--ift-amber); }

/* Ops observations stat header */
.statbar { display: flex; flex-wrap: wrap; align-items: center; gap: var(--space-5);
  background: var(--color-surface); border: 1px solid var(--color-border); border-radius: var(--radius-lg);
  padding: 14px 18px; margin: 14px 0; box-shadow: var(--shadow-xs); }
.stat { display: flex; flex-direction: column; }
.stat-n { font: 500 20px/1 var(--font-display); color: var(--color-text); }
.stat-l { font-family: var(--font-mono); font-size: 10px; text-transform: uppercase;
  letter-spacing: 0.1em; color: var(--color-text-muted); margin-top: 4px; }
.stat-runs { margin-left: auto; display: flex; flex-wrap: wrap; gap: 8px; }
.run-chip { font-family: var(--font-mono); font-size: 11px; color: var(--color-text-muted);
  border: 1px solid var(--color-border); border-radius: var(--radius-pill); padding: 4px 10px; }
.run-chip:hover { text-decoration: none; border-color: var(--ift-blue); }
.run-chip b { font-weight: 500; }

/* ICAO links and inline toggles on the ops tables */
.icao-link { color: var(--ift-blue); }
.icao-link:hover { text-decoration: underline; }
.mini-btn { font-family: var(--font-mono); font-size: 10px; letter-spacing: 0.04em; text-transform: uppercase;
  background: transparent; color: var(--color-text-muted); border: 1px solid var(--color-border);
  border-radius: var(--radius-sm); padding: 3px 8px; margin-left: 8px; }
.mini-btn:hover { background: var(--color-bg); color: var(--color-text); }
.star { font-family: var(--font-mono); font-size: 11px; background: transparent; color: var(--color-text-muted);
  border: 1px solid var(--color-border); border-radius: var(--radius-pill); padding: 4px 10px; }
.star.on { color: #9A5E00; border-color: var(--ift-amber); background: rgba(255,155,0,0.08); }
.star:hover { border-color: var(--ift-amber); }

/* Raw METAR/TAF token coloring (ceiling + visibility by flight category) and
   TAF change-group line breaks. Used on the observations table and station detail. */
.tok-VFR { color: #1E9E5A; font-weight: 500; }
.tok-MVFR { color: #0B72FF; font-weight: 500; }
.tok-IFR { color: #E5484D; font-weight: 500; }
.tok-LIFR { color: #B5179E; font-weight: 500; }
.tok-change { color: var(--ift-amber); font-weight: 500; }
/* TAF lines: baseline (FM/BECMG) at one indent, conditional (TEMPO/PROB) deeper,
   so the prevailing timeline and the temporary overlays read distinctly. */
.taf-line { display: block; }
.taf-line + .taf-line { margin-top: 3px; }
/* Every line below the TAF header is indented; TEMPO/PROB overlays deeper still. */
.taf-fm, .taf-becmg, .taf-chg { margin-left: 2em; text-indent: -1.4em; }
.taf-tempo, .taf-prob { margin-left: 3.6em; text-indent: -1.4em; }
