/* Los Amigos Deer Intelligence — phone-first, light and dark.
 *
 * Chart colors follow the validated reference palette:
 *   station bars      single series, categorical slot 1 (blue)
 *   confidence tiers  ordinal one-hue blue ramp, validated in both modes
 * Both ramps cleared the palette validator (lightness monotone, adjacent dL,
 * light-end contrast, single hue) against the surfaces declared below.
 */

:root {
  color-scheme: light;

  --page:            #f9f9f7;
  --surface-1:       #fcfcfb;
  --text-primary:    #0b0b0b;
  --text-secondary:  #52514e;
  --text-muted:      #898781;
  --gridline:        #e1e0d9;
  --baseline:        #c3c2b7;
  --border:          rgba(11, 11, 11, 0.10);

  --series-1:        #2a78d6;
  --track:           #cde2fb;

  /* Ordinal confidence ramp, light: steps 250 / 350 / 450 / 600 */
  --tier-high:       #184f95;
  --tier-moderate:   #2a78d6;
  --tier-low:        #5598e7;
  --tier-none:       #86b6ef;

  --status-good:     #0ca30c;
  --status-warning:  #fab219;
  --status-serious:  #ec835a;
  --status-critical: #d03b3b;

  --radius:          10px;
  --gap:             16px;
  --font: system-ui, -apple-system, "Segoe UI", sans-serif;
}

@media (prefers-color-scheme: dark) {
  :root:where(:not([data-theme="light"])) {
    color-scheme: dark;

    --page:           #0d0d0d;
    --surface-1:      #1a1a19;
    --text-primary:   #ffffff;
    --text-secondary: #c3c2b7;
    --text-muted:     #898781;
    --gridline:       #2c2c2a;
    --baseline:       #383835;
    --border:         rgba(255, 255, 255, 0.10);

    --series-1:       #3987e5;
    --track:          #2c2c2a;

    /* Ordinal confidence ramp, dark: steps 550 / 400 / 250 / 150 */
    --tier-high:      #1c5cab;
    --tier-moderate:  #3987e5;
    --tier-low:       #86b6ef;
    --tier-none:      #b7d3f6;
  }
}

* { box-sizing: border-box; }

body {
  margin: 0;
  font-family: var(--font);
  background: var(--page);
  color: var(--text-primary);
  font-size: 16px;
  line-height: 1.5;
  -webkit-text-size-adjust: 100%;
}

a { color: var(--series-1); text-decoration: none; }
a:hover { text-decoration: underline; }

/* ---------------------------------------------------------------- structure */

header.topbar {
  position: sticky;
  top: 0;
  z-index: 20;
  background: var(--surface-1);
  border-bottom: 1px solid var(--border);
  padding: 10px 16px;
}

.topbar-inner {
  display: flex;
  flex-wrap: wrap;
  align-items: baseline;
  gap: 8px 18px;
  max-width: 1180px;
  margin: 0 auto;
}

.brand {
  font-weight: 650;
  letter-spacing: -0.01em;
  color: var(--text-primary);
  margin-right: auto;
}
.brand small { display: block; font-weight: 400; font-size: 12px; color: var(--text-muted); }

nav.main a {
  color: var(--text-secondary);
  padding: 6px 0;
  margin-right: 14px;
  display: inline-block;
  font-size: 15px;
}
nav.main a.active { color: var(--text-primary); font-weight: 600; }
nav.main .pill {
  display: inline-block;
  min-width: 20px;
  padding: 0 6px;
  margin-left: 4px;
  border-radius: 999px;
  background: var(--gridline);
  color: var(--text-secondary);
  font-size: 12px;
  text-align: center;
}

main { max-width: 1180px; margin: 0 auto; padding: 20px 16px 64px; }

h1 { font-size: 22px; margin: 0 0 4px; letter-spacing: -0.01em; }
h2 { font-size: 17px; margin: 28px 0 12px; letter-spacing: -0.005em; }
h3 { font-size: 15px; margin: 0 0 8px; }
p.lede { color: var(--text-secondary); margin: 0 0 20px; max-width: 68ch; }

.card {
  background: var(--surface-1);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 16px;
}

.grid { display: grid; gap: var(--gap); }
.grid.cols-2 { grid-template-columns: repeat(auto-fit, minmax(300px, 1fr)); }
.grid.cols-3 { grid-template-columns: repeat(auto-fit, minmax(230px, 1fr)); }

/* --------------------------------------------------------------- stat tiles */

.tiles {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
  gap: 12px;
  margin-bottom: 8px;
}

.tile {
  background: var(--surface-1);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 14px 16px;
}
.tile .label {
  font-size: 13px;
  color: var(--text-secondary);
  margin-bottom: 2px;
}
.tile .value {
  font-size: 28px;
  font-weight: 650;
  letter-spacing: -0.02em;
  line-height: 1.15;
}
.tile .sub { font-size: 12px; color: var(--text-muted); margin-top: 2px; }

.hero {
  font-size: 52px;
  font-weight: 650;
  letter-spacing: -0.03em;
  line-height: 1.05;
}

/* -------------------------------------------------------------- bar figures */

figure.chart { margin: 0; }
figure.chart figcaption {
  font-size: 13px;
  color: var(--text-secondary);
  margin-bottom: 12px;
}

.barlist { display: grid; gap: 8px; }
.barrow {
  display: grid;
  grid-template-columns: minmax(96px, 132px) 1fr auto;
  align-items: center;
  gap: 10px;
  font-size: 14px;
}
.barrow .name { color: var(--text-secondary); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.barrow .track {
  background: var(--track);
  border-radius: 4px;
  height: 12px;
  overflow: hidden;
}
.barrow .fill {
  display: block;
  height: 100%;
  background: var(--series-1);
  border-radius: 0 4px 4px 0;
  min-width: 2px;
}
.barrow .num {
  font-variant-numeric: tabular-nums;
  color: var(--text-primary);
  font-size: 13px;
}

/* Stacked ordinal tier bar. 2px surface gap between segments. */
.tierbar {
  display: flex;
  height: 16px;
  border-radius: 4px;
  overflow: hidden;
  gap: 2px;
  background: var(--surface-1);
}
.tierbar span { display: block; min-width: 3px; }
.tierbar .t-high     { background: var(--tier-high); }
.tierbar .t-moderate { background: var(--tier-moderate); }
.tierbar .t-low      { background: var(--tier-low); }
.tierbar .t-none     { background: var(--tier-none); }

.legend {
  display: flex;
  flex-wrap: wrap;
  gap: 6px 16px;
  margin-top: 12px;
  font-size: 13px;
  color: var(--text-secondary);
}
.legend span.swatch {
  display: inline-block;
  width: 10px;
  height: 10px;
  border-radius: 3px;
  margin-right: 6px;
  vertical-align: baseline;
}
.legend b { font-variant-numeric: tabular-nums; color: var(--text-primary); font-weight: 600; }

/* ------------------------------------------------------------------ tables */

table { width: 100%; border-collapse: collapse; font-size: 14px; }
th, td { text-align: left; padding: 8px 10px; border-bottom: 1px solid var(--gridline); }
th { color: var(--text-muted); font-weight: 500; font-size: 12px; text-transform: uppercase; letter-spacing: 0.04em; }
td.num, th.num { text-align: right; font-variant-numeric: tabular-nums; }
tbody tr:last-child td { border-bottom: none; }
.scroll { overflow-x: auto; }

/* ------------------------------------------------------------------ badges */

.badge {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  padding: 2px 8px;
  border-radius: 999px;
  font-size: 12px;
  font-weight: 550;
  border: 1px solid var(--border);
  color: var(--text-secondary);
  background: var(--surface-1);
  white-space: nowrap;
}
.badge .dot { width: 8px; height: 8px; border-radius: 50%; background: currentColor; }
.badge.tier-high     { color: var(--tier-high); }
.badge.tier-moderate { color: var(--tier-moderate); }
.badge.tier-low      { color: var(--tier-low); }
.badge.tier-none     { color: var(--text-muted); }
.badge.good     { color: var(--status-good); }
.badge.warning  { color: var(--status-warning); }
.badge.serious  { color: var(--status-serious); }
.badge.critical { color: var(--status-critical); }

/* ------------------------------------------------------------------ queue */

.queue-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
  gap: 14px;
}

.qcard {
  background: var(--surface-1);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  overflow: hidden;
  display: flex;
  flex-direction: column;
}
.qcard .thumb {
  aspect-ratio: 4 / 3;
  background: var(--gridline);
  display: block;
  object-fit: cover;
  width: 100%;
}
.qcard .thumb.missing {
  display: grid;
  place-items: center;
  color: var(--text-muted);
  font-size: 12px;
  text-align: center;
  padding: 8px;
}
.qcard .body { padding: 10px 12px 12px; display: grid; gap: 6px; }
.qcard .meta { font-size: 12px; color: var(--text-muted); }
.qcard .fname {
  font-size: 12px;
  color: var(--text-secondary);
  word-break: break-all;
  font-family: ui-monospace, SFMono-Regular, Menlo, monospace;
}
.qcard .top-cand { font-size: 14px; }

/* ------------------------------------------------------------------ detail */

.detail { display: grid; gap: var(--gap); grid-template-columns: 1fr; }
@media (min-width: 900px) { .detail { grid-template-columns: 1.1fr 1fr; } }

.frame {
  background: var(--surface-1);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  overflow: hidden;
}
.frame img { width: 100%; display: block; }
.frame .missing { padding: 40px 16px; text-align: center; color: var(--text-muted); }

.candidate {
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 12px;
  margin-bottom: 10px;
  background: var(--surface-1);
}
.candidate header {
  display: flex;
  align-items: center;
  gap: 8px;
  justify-content: space-between;
  margin-bottom: 6px;
}
.candidate .why { margin: 6px 0 10px; padding-left: 18px; color: var(--text-secondary); font-size: 13px; }
.candidate .why li { margin: 2px 0; }

.score {
  font-variant-numeric: tabular-nums;
  font-size: 13px;
  color: var(--text-secondary);
}

/* ------------------------------------------------------------------- forms */

form.filters {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  align-items: center;
  margin-bottom: 16px;
  padding: 12px;
  background: var(--surface-1);
  border: 1px solid var(--border);
  border-radius: var(--radius);
}

select, input[type="text"], input[type="search"], input[type="number"], textarea {
  font: inherit;
  font-size: 15px;
  padding: 8px 10px;
  border-radius: 8px;
  border: 1px solid var(--baseline);
  background: var(--surface-1);
  color: var(--text-primary);
  min-height: 40px;
}

button {
  font: inherit;
  font-size: 15px;
  font-weight: 550;
  padding: 9px 14px;
  min-height: 42px;
  border-radius: 8px;
  border: 1px solid var(--baseline);
  background: var(--surface-1);
  color: var(--text-primary);
  cursor: pointer;
}
button:hover { border-color: var(--text-muted); }
button.primary { background: var(--series-1); border-color: var(--series-1); color: #ffffff; }
button.primary:hover { filter: brightness(1.06); }
button.ghost { border-style: dashed; color: var(--text-secondary); }

.actions { display: flex; flex-wrap: wrap; gap: 8px; }

.section-heading { display: flex; justify-content: space-between; gap: 12px; align-items: start; }
.section-heading h2 { margin-bottom: 4px; }
.compact-tiles { margin: 14px 0; }
.profile-editor details { margin-top: 16px; }
.profile-editor summary { cursor: pointer; font-weight: 650; }
.profile-form { display: grid; gap: 14px; margin-top: 14px; }
.profile-form fieldset {
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 12px;
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
  gap: 10px;
}
.profile-form legend { color: var(--text-secondary); font-weight: 650; padding: 0 5px; }
.profile-form label { display: grid; gap: 4px; color: var(--text-secondary); font-size: 13px; }
.profile-form .wide-fields { grid-template-columns: repeat(auto-fit, minmax(260px, 1fr)); }
.profile-form textarea { min-height: 92px; resize: vertical; }
.profile-form button { justify-self: start; }
.revision-history { overflow-x: auto; }

.notice {
  padding: 10px 12px;
  border-radius: 8px;
  border: 1px solid var(--border);
  background: var(--surface-1);
  color: var(--text-secondary);
  font-size: 14px;
  margin-bottom: 16px;
}
.notice.ok { border-left: 3px solid var(--status-good); }
.notice.warn { border-left: 3px solid var(--status-warning); }

.pager { display: flex; gap: 12px; align-items: center; margin-top: 20px; font-size: 14px; color: var(--text-secondary); }

.gallery { display: grid; grid-template-columns: repeat(auto-fill, minmax(130px, 1fr)); gap: 8px; }
.gallery img, .gallery .ph {
  width: 100%;
  aspect-ratio: 4 / 3;
  object-fit: cover;
  border-radius: 8px;
  background: var(--gridline);
  display: block;
}
.gallery .ph { display: grid; place-items: center; font-size: 11px; color: var(--text-muted); }
.gallery-item { display: grid; gap: 5px; }
.gallery .review-link {
  color: var(--text-secondary);
  font-size: 12px;
  text-align: center;
  text-decoration: underline;
  text-underline-offset: 2px;
}

.kv { display: grid; grid-template-columns: max-content 1fr; gap: 4px 14px; font-size: 14px; }
.kv dt { color: var(--text-muted); }
.kv dd { margin: 0; }

.muted { color: var(--text-muted); }
.small { font-size: 13px; }
.mono { font-family: ui-monospace, SFMono-Regular, Menlo, monospace; font-size: 12px; word-break: break-all; }

/* ------------------------------------------------------ quality calibration */
.quality-head { display: flex; justify-content: space-between; align-items: start; gap: 20px; }
.quality-progress { min-width: 155px; text-align: right; }
.quality-progress strong { display: block; font-size: 25px; line-height: 1.1; }
.quality-progress span { color: var(--text-muted); font-size: 12px; }
.progress-track { height: 8px; overflow: hidden; background: var(--gridline); border-radius: 999px; margin: 14px 0 22px; }
.progress-track span { display: block; height: 100%; background: var(--status-good); border-radius: inherit; }
.quality-layout { display: grid; grid-template-columns: minmax(0, 1.55fr) minmax(320px, 0.75fr); gap: 18px; align-items: start; }
.quality-frame { min-height: 420px; border-radius: var(--radius); background: #050505; display: grid; place-items: center; overflow: hidden; }
.quality-frame img { display: block; width: 100%; max-height: 74vh; object-fit: contain; }
.quality-panel form { display: grid; gap: 9px; }
.quality-choice { width: 100%; min-height: 64px; padding: 10px 12px; text-align: left; border: 1px solid var(--border); border-radius: 8px; background: var(--surface-1); color: var(--text-primary); cursor: pointer; }
.quality-choice:hover { border-color: var(--series-1); transform: translateY(-1px); }
.quality-choice strong, .quality-choice span { display: block; }
.quality-choice strong { font-size: 15px; }
.quality-choice span { color: var(--text-secondary); font-size: 12px; line-height: 1.35; margin-top: 2px; }
.quality-choice.usable { border-left: 5px solid var(--status-good); }
.quality-choice.context { border-left: 5px solid var(--series-1); }
.quality-choice.unusable { border-left: 5px solid var(--status-critical); }
.quality-choice.unsure { border-left: 5px solid var(--status-warning); }
.quality-choice:disabled { cursor: not-allowed; opacity: 0.55; transform: none; }
.quality-note { color: var(--text-secondary); font-size: 12px; margin-top: 4px; }
.quality-panel textarea { width: 100%; resize: vertical; }
.quality-meta { margin-top: 18px; padding-top: 16px; border-top: 1px solid var(--border); }
.quality-complete { max-width: 650px; margin: 60px auto; text-align: center; }
.quality-summary { margin-top: 24px; }

@media (max-width: 780px) {
  .quality-head { display: block; }
  .quality-progress { text-align: left; margin-top: 10px; }
  .quality-layout { grid-template-columns: 1fr; }
  .quality-frame { min-height: 260px; }
}

/* ========================================================================== */
/* Los Amigos field intelligence design system                                */
/* ========================================================================== */

:root {
  color-scheme: light;
  --page: #f3f0e8;
  --surface-1: #fffdf8;
  --surface-2: #ebe6d9;
  --text-primary: #17211b;
  --text-secondary: #5e655f;
  --text-muted: #8b8e88;
  --gridline: #e5e0d4;
  --baseline: #cbc4b5;
  --border: rgba(30, 42, 34, 0.12);
  --forest: #15241d;
  --forest-soft: #21362b;
  --forest-faint: #e8eee8;
  --copper: #b96f37;
  --copper-light: #d79a61;
  --cream: #f6f0e4;
  --series-1: #426b55;
  --track: #e0e6de;
  --tier-high: #28563e;
  --tier-moderate: #52785f;
  --tier-low: #88a08d;
  --tier-none: #c4cec5;
  --status-good: #3d7b50;
  --status-warning: #a36a20;
  --status-serious: #aa573f;
  --status-critical: #9b3c38;
  --radius: 14px;
  --gap: 18px;
  --font: "Avenir Next", Avenir, "Segoe UI", sans-serif;
  --display: "Iowan Old Style", "Palatino Linotype", Georgia, serif;
  --shadow-sm: 0 1px 2px rgba(24, 33, 27, 0.04), 0 8px 24px rgba(24, 33, 27, 0.035);
  --shadow-md: 0 18px 50px rgba(18, 30, 23, 0.12);
}

@media (prefers-color-scheme: dark) {
  :root:where(:not([data-theme="light"])) {
    color-scheme: light;
    --page: #f3f0e8;
    --surface-1: #fffdf8;
    --text-primary: #17211b;
    --text-secondary: #5e655f;
    --text-muted: #8b8e88;
    --gridline: #e5e0d4;
    --baseline: #cbc4b5;
    --border: rgba(30, 42, 34, 0.12);
    --series-1: #426b55;
    --track: #e0e6de;
    --tier-high: #28563e;
    --tier-moderate: #52785f;
    --tier-low: #88a08d;
    --tier-none: #c4cec5;
  }
}

html { background: var(--forest); }
body {
  background: var(--page);
  color: var(--text-primary);
  font-family: var(--font);
  font-size: 15px;
  letter-spacing: -0.006em;
  min-height: 100vh;
}
a { color: #315e47; font-weight: 520; }
a:hover { color: var(--copper); text-decoration: none; }
a:focus-visible, button:focus-visible, input:focus-visible, select:focus-visible,
textarea:focus-visible, summary:focus-visible {
  outline: 3px solid rgba(185, 111, 55, 0.34);
  outline-offset: 2px;
}

.skip-link {
  position: fixed;
  left: 16px;
  top: -60px;
  z-index: 100;
  padding: 10px 14px;
  border-radius: 8px;
  background: var(--cream);
  color: var(--forest);
}
.skip-link:focus { top: 12px; }

.app-shell { min-height: 100vh; }
.sidebar {
  position: fixed;
  inset: 0 auto 0 0;
  z-index: 30;
  display: flex;
  width: 252px;
  flex-direction: column;
  padding: 28px 18px 20px;
  overflow-y: auto;
  background:
    radial-gradient(circle at 12% 5%, rgba(215, 154, 97, 0.11), transparent 23%),
    var(--forest);
  color: var(--cream);
  box-shadow: 8px 0 30px rgba(16, 28, 21, 0.08);
}
.brand-lockup {
  display: block;
  width: 96px;
  color: var(--cream);
  margin: 0 auto 34px;
}
.brand-lockup:hover { color: #fff; }
.brand-lockup img {
  display: block;
  width: 100%;
  height: auto;
  filter: drop-shadow(0 7px 16px rgba(0,0,0,0.18));
}
.nav-label {
  margin: 0 12px 10px;
  color: rgba(246, 240, 228, 0.38);
  font-size: 10px;
  font-weight: 700;
  letter-spacing: 0.16em;
  text-transform: uppercase;
}
.sidebar nav.main { display: grid; gap: 4px; }
.sidebar nav.main a {
  display: grid;
  grid-template-columns: 25px minmax(0, 1fr) auto;
  align-items: center;
  gap: 8px;
  min-height: 44px;
  margin: 0;
  padding: 8px 11px;
  border: 1px solid transparent;
  border-radius: 10px;
  color: rgba(246, 240, 228, 0.7);
  font-size: 13px;
  font-weight: 520;
}
.sidebar nav.main a:hover { background: rgba(255,255,255,0.045); color: #fff; }
.sidebar nav.main a.active {
  border-color: rgba(215, 154, 97, 0.18);
  background: linear-gradient(100deg, rgba(215, 154, 97, 0.17), rgba(215, 154, 97, 0.06));
  color: #fff;
}
.nav-glyph { color: var(--copper-light); font-family: Georgia, serif; font-size: 18px; text-align: center; }
.sidebar nav.main .pill {
  min-width: 25px;
  margin: 0;
  padding: 2px 7px;
  border: 1px solid rgba(255,255,255,0.08);
  background: rgba(255,255,255,0.08);
  color: rgba(255,255,255,0.76);
  font-size: 10px;
}
.sidebar-footer {
  margin-top: auto;
  padding: 20px 10px 4px;
  border-top: 1px solid rgba(255,255,255,0.08);
}
.connection-state {
  display: flex;
  align-items: center;
  gap: 8px;
  color: rgba(246, 240, 228, 0.62);
  font-size: 10px;
  letter-spacing: 0.02em;
}
.connection-state > span, .data-trust > span, .login-trust > span, .connection-dot {
  width: 7px;
  height: 7px;
  flex: none;
  border-radius: 50%;
  background: #75b987;
  box-shadow: 0 0 0 4px rgba(117, 185, 135, 0.11);
}
.reviewer { margin-top: 16px; }
.reviewer small { display: block; color: rgba(246,240,228,0.4); font-size: 10px; }
.reviewer strong { display: block; margin-top: 2px; color: var(--cream); font-size: 12px; font-weight: 600; text-transform: capitalize; }
.logout-form { margin-top: 10px; }
button.logout-button {
  min-height: 0;
  padding: 0;
  border: 0;
  background: transparent;
  color: rgba(246,240,228,0.48);
  font-size: 11px;
  font-weight: 500;
}
button.logout-button:hover { color: var(--copper-light); }

.workspace { min-height: 100vh; margin-left: 252px; }
.mobile-bar { display: none; }
.workspace main {
  max-width: 1380px;
  margin: 0 auto;
  padding: 44px 46px 80px;
}
.workspace-state {
  display: inline-flex;
  margin-bottom: 18px;
  padding: 5px 9px;
  border: 1px solid rgba(163,106,32,0.2);
  border-radius: 999px;
  background: #f4ead7;
  color: #855718;
  font-size: 10px;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

h1, h2 { font-family: var(--display); color: var(--text-primary); font-weight: 550; }
h1 { font-size: clamp(34px, 4vw, 48px); line-height: 1.02; letter-spacing: -0.035em; }
h2 { font-size: 24px; letter-spacing: -0.02em; }
h3 { color: var(--text-primary); font-size: 13px; font-weight: 700; letter-spacing: 0.02em; }
p.lede { color: var(--text-secondary); font-size: 16px; line-height: 1.55; }
.eyebrow {
  margin-bottom: 9px;
  color: var(--copper);
  font-size: 10px;
  font-weight: 750;
  letter-spacing: 0.17em;
  text-transform: uppercase;
}
.eyebrow.light { color: var(--copper-light); }
.page-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 30px;
  margin-bottom: 28px;
}
.page-head h1 { margin-bottom: 8px; }
.page-head .lede { margin-bottom: 0; }
.data-trust {
  display: flex;
  align-items: center;
  gap: 11px;
  min-width: 214px;
  padding: 11px 14px;
  border: 1px solid var(--border);
  border-radius: 12px;
  background: rgba(255,253,248,0.72);
  box-shadow: var(--shadow-sm);
}
.data-trust strong, .data-trust small { display: block; }
.data-trust strong { font-size: 11px; }
.data-trust small { margin-top: 1px; color: var(--text-muted); font-size: 9px; }

.command-card {
  position: relative;
  display: grid;
  grid-template-columns: minmax(0, 1.4fr) minmax(250px, 0.6fr);
  gap: 28px;
  align-items: end;
  min-height: 248px;
  margin-bottom: 18px;
  padding: 32px 34px;
  overflow: hidden;
  border: 1px solid rgba(255,255,255,0.06);
  border-radius: 18px;
  background:
    radial-gradient(circle at 88% -30%, rgba(215,154,97,0.26), transparent 44%),
    linear-gradient(128deg, #16251e, #22382c);
  color: var(--cream);
  box-shadow: var(--shadow-md);
}
.command-card::after {
  content: "";
  position: absolute;
  width: 260px;
  height: 260px;
  right: -80px;
  bottom: -150px;
  border: 1px solid rgba(246,240,228,0.08);
  border-radius: 50%;
  box-shadow: 0 0 0 28px rgba(246,240,228,0.025), 0 0 0 56px rgba(246,240,228,0.015);
}
.command-main, .command-actions { position: relative; z-index: 1; }
.command-kicker {
  color: var(--copper-light);
  font-size: 10px;
  font-weight: 750;
  letter-spacing: 0.17em;
  text-transform: uppercase;
}
.command-card .hero {
  margin-top: 8px;
  color: #fff;
  font-family: var(--display);
  font-size: clamp(64px, 7vw, 88px);
  font-weight: 500;
  letter-spacing: -0.055em;
}
.command-label { color: rgba(246,240,228,0.84); font-size: 14px; font-weight: 650; }
.command-main p, .command-actions p { max-width: 650px; color: rgba(246,240,228,0.48); font-size: 11px; line-height: 1.55; }
.command-actions { display: grid; gap: 9px; }
.button {
  display: flex;
  align-items: center;
  justify-content: space-between;
  min-height: 44px;
  padding: 10px 14px;
  border-radius: 9px;
  font-size: 12px;
  font-weight: 650;
}
.button.primary { background: var(--copper-light); color: var(--forest); }
.button.primary:hover { background: #e3aa72; color: var(--forest); }
.button.secondary { border: 1px solid rgba(255,255,255,0.13); color: rgba(255,255,255,0.8); }
.button.secondary:hover { border-color: rgba(255,255,255,0.3); color: #fff; }

.card, .tile {
  border: 1px solid var(--border);
  background: var(--surface-1);
  box-shadow: var(--shadow-sm);
}
.card { padding: 20px; border-radius: var(--radius); }
.tiles { grid-template-columns: repeat(6, minmax(0, 1fr)); gap: 10px; margin: 0 0 18px; }
.tile { position: relative; min-height: 112px; padding: 17px 18px; border-radius: 12px; }
.tile::before {
  content: "";
  position: absolute;
  inset: 0 auto 0 0;
  width: 3px;
  border-radius: 12px 0 0 12px;
  background: var(--copper-light);
  opacity: 0;
  transition: opacity 150ms ease;
}
.tile:hover::before { opacity: 1; }
.tile .label { color: var(--text-muted); font-size: 10px; font-weight: 700; letter-spacing: 0.08em; text-transform: uppercase; }
.tile .value { margin-top: 8px; font-family: var(--display); font-size: 32px; font-weight: 550; }
.tile .sub { margin-top: 5px; font-size: 10px; }
.grid { gap: var(--gap); }

.notice {
  padding: 12px 14px;
  border-color: rgba(66,107,85,0.16);
  border-left: 3px solid var(--series-1);
  border-radius: 9px;
  background: var(--forest-faint);
  color: #536258;
  font-size: 12px;
}
.notice.ok { background: #edf5ee; }
.notice.warn { background: #f7eedf; }

table { font-size: 12px; }
th, td { padding: 10px 11px; }
th { color: var(--text-muted); font-size: 9px; font-weight: 750; letter-spacing: 0.1em; }
tbody tr { transition: background 120ms ease; }
tbody tr:hover { background: rgba(66,107,85,0.035); }
.scroll { border-radius: 10px; }

.badge { padding: 3px 8px; border-color: var(--border); background: #f8f6f0; font-size: 9px; font-weight: 750; letter-spacing: 0.04em; text-transform: uppercase; }
.badge.good { background: #edf4ed; }
.badge.warning { background: #f7ecda; }
.badge.serious, .badge.critical { background: #f8e8e4; }

form.filters {
  gap: 9px;
  padding: 13px;
  border-radius: 12px;
  box-shadow: var(--shadow-sm);
}
select, input[type="text"], input[type="search"], input[type="number"],
input[type="password"], textarea {
  min-height: 42px;
  border-color: var(--baseline);
  border-radius: 8px;
  background: #fffefa;
  color: var(--text-primary);
  font-size: 13px;
}
input::placeholder, textarea::placeholder { color: #aaa89f; }
button {
  min-height: 42px;
  border-color: var(--baseline);
  border-radius: 8px;
  background: #fffefa;
  font-size: 12px;
  font-weight: 650;
}
button.primary { border-color: var(--forest); background: var(--forest); color: #fff; }
button.primary:hover { background: var(--forest-soft); filter: none; }
button.ghost { border-style: solid; background: transparent; }

.queue-grid { grid-template-columns: repeat(auto-fill, minmax(245px, 1fr)); gap: 16px; }
.qcard { border-radius: 14px; box-shadow: var(--shadow-sm); transition: transform 160ms ease, box-shadow 160ms ease; }
.qcard:hover { transform: translateY(-2px); box-shadow: 0 16px 32px rgba(28,38,31,0.09); }
.qcard .thumb { aspect-ratio: 16 / 10; }
.qcard .body { gap: 8px; padding: 13px 14px 15px; }
.qcard .top-cand { display: flex; align-items: center; justify-content: space-between; font-family: var(--display); font-size: 17px; }
.qcard .meta { color: var(--text-secondary); font-size: 10px; }
.qcard .fname { color: var(--text-muted); font-size: 9px; }

.frame { border: 0; border-radius: 14px; background: #101511; box-shadow: var(--shadow-md); }
.frame img { max-height: 76vh; object-fit: contain; }
.candidate { padding: 15px; border-radius: 11px; box-shadow: var(--shadow-sm); }
.candidate header strong { font-family: var(--display); font-size: 17px; }
.candidate .why { font-size: 11px; line-height: 1.5; }
.detail { align-items: start; }

.gallery { grid-template-columns: repeat(auto-fill, minmax(165px, 1fr)); gap: 12px; }
.gallery img, .gallery .ph { border-radius: 10px; transition: transform 160ms ease, box-shadow 160ms ease; }
.gallery a:hover img { transform: translateY(-2px); box-shadow: var(--shadow-md); }
.profile-summary { border-left: 3px solid var(--copper-light); }
.profile-editor summary { color: #315e47; }
.profile-form fieldset { background: #fbf8f1; }

.quality-progress strong { font-family: var(--display); font-weight: 550; }
.progress-track { height: 6px; background: #dedace; }
.progress-track span { background: var(--copper); }
.quality-frame { border-radius: 14px; box-shadow: var(--shadow-md); }
.quality-choice { border-radius: 10px; background: #fffefa; box-shadow: 0 1px 0 rgba(0,0,0,0.02); }
.quality-choice:hover { border-color: var(--copper); transform: translateY(-1px); }

.barrow .fill { background: linear-gradient(90deg, #315a45, #6f9079); }
.barrow .track { height: 9px; }
.tierbar { height: 12px; border-radius: 999px; }
.tierbar span { border-radius: 999px; }

.login-page { overflow: hidden; background: var(--forest); }
.login-shell {
  display: grid;
  grid-template-columns: minmax(420px, 1.1fr) minmax(420px, 0.9fr);
  width: 100%;
  max-width: none;
  min-height: 100vh;
  margin: 0;
  padding: 0;
}
.login-story {
  position: relative;
  display: flex;
  flex-direction: column;
  min-height: 100vh;
  padding: 44px 56px 42px;
  overflow: hidden;
  background:
    radial-gradient(circle at 18% 20%, rgba(215,154,97,0.17), transparent 25%),
    radial-gradient(ellipse at 110% 100%, rgba(87,124,98,0.38), transparent 50%),
    linear-gradient(145deg, #13221b, #1c3025 65%, #263e30);
  color: var(--cream);
}
.login-story::before, .login-story::after {
  content: "";
  position: absolute;
  width: 580px;
  height: 580px;
  border: 1px solid rgba(246,240,228,0.07);
  border-radius: 48% 52% 45% 55%;
  transform: rotate(22deg);
}
.login-story::before { right: -300px; bottom: -250px; box-shadow: 0 0 0 55px rgba(246,240,228,0.018), 0 0 0 110px rgba(246,240,228,0.012); }
.login-story::after { left: -470px; top: 140px; }
.login-brand { position: relative; z-index: 1; width: 120px; margin: 0; }
.login-story-copy { position: relative; z-index: 1; max-width: 610px; margin: auto 0; }
.login-story-copy h1 {
  margin: 0;
  color: #fff;
  font-size: clamp(48px, 5.8vw, 78px);
  line-height: 0.98;
  letter-spacing: -0.055em;
}
.login-story-copy p { max-width: 520px; margin-top: 24px; color: rgba(246,240,228,0.6); font-size: 16px; line-height: 1.65; }
.login-trust { position: relative; z-index: 1; display: flex; align-items: center; gap: 10px; color: rgba(246,240,228,0.48); font-size: 10px; }
.login-panel { display: grid; place-items: center; min-height: 100vh; padding: 48px; background: #f7f3ea; }
.login-form-wrap { width: min(100%, 400px); }
.login-form-wrap h2 { margin: 0 0 10px; font-size: 42px; }
.login-intro { margin: 0 0 32px; color: var(--text-secondary); font-size: 13px; line-height: 1.6; }
.login-form { display: grid; gap: 8px; }
.login-form label { margin-top: 10px; color: var(--text-secondary); font-size: 11px; font-weight: 700; }
.login-form input { width: 100%; min-height: 48px; padding: 11px 13px; border-radius: 9px; background: #fff; }
.login-submit { display: flex; align-items: center; justify-content: space-between; width: 100%; margin-top: 16px; min-height: 50px; padding: 11px 16px; }
.login-help { margin-top: 25px; color: var(--text-muted); font-size: 10px; text-align: center; }
.login-mobile-mark { display: none; }
.login-mobile-mark img { display: block; width: 72px; height: auto; }

@media (max-width: 1050px) {
  .workspace main { padding: 36px 30px 72px; }
  .command-card { grid-template-columns: 1fr; }
  .command-actions { grid-template-columns: 1fr 1fr; }
  .command-actions p { grid-column: 1 / -1; }
  .tiles { grid-template-columns: repeat(3, minmax(0, 1fr)); }
}

@media (max-width: 820px) {
  body { background: var(--page); }
  .sidebar {
    inset: auto 0 0;
    width: auto;
    height: 74px;
    padding: 7px max(8px, env(safe-area-inset-right)) calc(7px + env(safe-area-inset-bottom)) max(8px, env(safe-area-inset-left));
    overflow-x: auto;
    background: rgba(21,36,29,0.98);
    box-shadow: 0 -8px 30px rgba(16,28,21,0.13);
  }
  .sidebar .brand-lockup, .sidebar .nav-label, .sidebar-footer { display: none; }
  .sidebar nav.main { display: flex; min-width: max-content; gap: 3px; }
  .sidebar nav.main a {
    display: flex;
    min-width: 76px;
    min-height: 56px;
    flex-direction: column;
    justify-content: center;
    gap: 1px;
    padding: 4px 7px;
    font-size: 9px;
  }
  .sidebar nav.main .nav-glyph { font-size: 17px; line-height: 1; }
  .sidebar nav.main .pill { position: absolute; margin: -28px 0 0 28px; }
  .workspace { margin-left: 0; }
  .mobile-bar {
    position: sticky;
    top: 0;
    z-index: 20;
    display: flex;
    align-items: center;
    justify-content: space-between;
    min-height: 56px;
    padding: 9px 16px;
    border-bottom: 1px solid var(--border);
    background: rgba(243,240,232,0.94);
    backdrop-filter: blur(16px);
  }
  .mobile-brand { display: block; width: 37px; color: var(--forest); }
  .mobile-brand img { display: block; width: 100%; height: auto; }
  .connection-dot { margin-right: 5px; }
  .workspace main { padding: 26px 16px 110px; }
  .page-head { display: block; }
  .data-trust { width: fit-content; margin-top: 16px; }
  .command-card { min-height: 0; padding: 25px 22px; }
  .command-actions { grid-template-columns: 1fr; }
  .command-actions p { grid-column: auto; }
  .tiles { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .tile { min-height: 100px; padding: 14px; }
  .tile .value { font-size: 28px; }
  .quality-layout { grid-template-columns: 1fr; }
  .quality-frame { min-height: 250px; }
  .login-page { overflow: auto; }
  .login-shell { display: block; min-height: 100vh; }
  .login-story { display: none; }
  .login-panel { min-height: 100vh; padding: 34px 22px; }
  .login-mobile-mark { display: block; margin-bottom: 32px; }
  .login-form-wrap h2 { font-size: 38px; }
}

@media (max-width: 480px) {
  h1 { font-size: 35px; }
  .queue-grid { grid-template-columns: 1fr; }
  .quality-head { display: block; }
  .quality-progress { margin-top: 12px; text-align: left; }
  .detail { grid-template-columns: 1fr; }
  .actions button { flex: 1 1 140px; }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { scroll-behavior: auto !important; transition: none !important; }
}
