/* FO Hunt owner dashboard. Colors are the app's coyote theme (src/ui/theme.ts); the chart
   series (s1 One State, s2 Elite and single series, s3 Extra states) passed the dataviz
   palette validator against these surfaces in both modes. */
:root {
  color-scheme: light;
  --bg: #F4F1EA; --surface: #FFFFFF; --raise: #FAF8F3; --line: #D6CFC2; --grid: #E6E1D7;
  --text: #141414; --muted: #5C574F; --accent: #7D5F33; --accent-ink: #FFFFFF;
  --danger: #B3361B; --ok: #2F6B33; --warn: #8A5A00;
  --s1: #2F6DB0; --s2: #9A6F1F; --s3: #7650B8;
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    color-scheme: dark;
    --bg: #15161A; --surface: #1F2126; --raise: #25282E; --line: #30333A; --grid: #2A2D33;
    --text: #EDE9E2; --muted: #A39E95; --accent: #C9A877; --accent-ink: #15161A;
    --danger: #F08A6C; --ok: #9CC79A; --warn: #E8B44C;
    --s1: #3A7FC4; --s2: #B8892B; --s3: #8466CC;
  }
}
:root[data-theme="dark"] {
  color-scheme: dark;
  --bg: #15161A; --surface: #1F2126; --raise: #25282E; --line: #30333A; --grid: #2A2D33;
  --text: #EDE9E2; --muted: #A39E95; --accent: #C9A877; --accent-ink: #15161A;
  --danger: #F08A6C; --ok: #9CC79A; --warn: #E8B44C;
  --s1: #3A7FC4; --s2: #B8892B; --s3: #8466CC;
}

* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0; background: var(--bg); color: var(--text);
  font: 15px/1.45 system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
}
[hidden] { display: none !important; }
a { color: var(--accent); }
button, input, select { font: inherit; color: inherit; }
.muted { color: var(--muted); }
.small { font-size: 13px; }
.num { font-variant-numeric: tabular-nums; }

/* Top bar */
.top {
  display: flex; align-items: center; justify-content: space-between; gap: 12px; flex-wrap: wrap;
  padding: 12px 16px; border-bottom: 1px solid var(--line); background: var(--surface);
  position: sticky; top: 0; z-index: 5;
}
.brand { display: flex; align-items: center; gap: 10px; }
.brand img { border-radius: 6px; }
.brand-name { font-weight: 800; letter-spacing: .08em; text-transform: uppercase; font-size: 15px; }
.brand-sub { color: var(--muted); font-size: 12px; letter-spacing: .06em; text-transform: uppercase; }
.who { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; font-size: 13px; color: var(--muted); }

/* Buttons and inputs */
button { cursor: pointer; border-radius: 8px; border: 1px solid var(--line); background: var(--surface); padding: 7px 12px; min-height: 36px; }
button:hover { background: var(--raise); }
button:disabled { opacity: .5; cursor: default; }
button.primary { background: var(--accent); color: var(--accent-ink); border-color: var(--accent); font-weight: 700; }
button.ghost { background: transparent; }
button.link { border: 0; background: none; color: var(--accent); padding: 4px 0; min-height: 0; text-decoration: underline; }
button.danger { color: var(--danger); }
button:focus-visible, input:focus-visible, select:focus-visible, a:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
input, select { background: var(--raise); border: 1px solid var(--line); border-radius: 8px; padding: 8px 10px; min-height: 38px; width: 100%; }
label { display: grid; gap: 4px; font-size: 13px; color: var(--muted); }
.error { color: var(--danger); min-height: 1em; margin: 0; }

/* Sign in */
.signin { padding: 40px 16px; display: grid; place-items: start center; }
.card { background: var(--surface); border: 1px solid var(--line); border-radius: 12px; padding: 16px; }
.narrow { width: 100%; max-width: 380px; display: grid; gap: 12px; }
.narrow h1 { margin: 0; font-size: 22px; }
.narrow p { margin: 0; }

/* Filters and jump links */
#app { max-width: 1180px; margin: 0 auto; padding: 16px; }
.filters { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; margin-bottom: 10px; }
.seg { display: inline-flex; border: 1px solid var(--line); border-radius: 9px; overflow: hidden; background: var(--surface); }
.seg button { border: 0; border-radius: 0; background: transparent; padding: 7px 12px; }
.seg button + button { border-left: 1px solid var(--line); }
.seg button[aria-checked="true"] { background: var(--accent); color: var(--accent-ink); font-weight: 700; }
.chip { border-radius: 999px; font-size: 13px; font-weight: 700; letter-spacing: .04em; }
.chip.test { border-color: var(--warn); color: var(--warn); }
.chip.live { border-color: var(--ok); color: var(--ok); }
.jump { display: flex; flex-wrap: wrap; gap: 6px 14px; margin: 4px 0 18px; font-size: 14px; }
.jump a { text-decoration: none; color: var(--muted); font-weight: 600; }
.jump a:hover { color: var(--accent); }

/* Sections */
.section { margin-bottom: 28px; scroll-margin-top: 80px; }
.section > h2 { font-size: 13px; letter-spacing: .12em; text-transform: uppercase; color: var(--muted); margin: 0 0 10px; }
.section .body { display: grid; gap: 12px; transition: opacity .2s; }
.section.loading .body { opacity: .5; }
.grid { display: grid; gap: 12px; grid-template-columns: repeat(auto-fit, minmax(160px, 1fr)); }
.cols { display: grid; gap: 12px; grid-template-columns: repeat(auto-fit, minmax(320px, 1fr)); }
@media (max-width: 400px) { .cols { grid-template-columns: 1fr; } .grid { grid-template-columns: 1fr 1fr; } }

/* Stat tiles */
.tile { background: var(--surface); border: 1px solid var(--line); border-radius: 12px; padding: 12px 14px; min-width: 0; }
.tile .label { font-size: 13px; color: var(--muted); }
.tile .value { font-size: 26px; font-weight: 700; line-height: 1.15; margin-top: 2px; overflow-wrap: anywhere; }
.tile .note { font-size: 12px; color: var(--muted); margin-top: 2px; }
.hero { display: flex; flex-wrap: wrap; align-items: baseline; gap: 6px 18px; }
.hero .value { font-size: 52px; font-weight: 800; letter-spacing: -.01em; line-height: 1; }
.hero .sub { color: var(--muted); }

/* Cards with a title */
.panel { background: var(--surface); border: 1px solid var(--line); border-radius: 12px; padding: 14px; min-width: 0; }
.panel h3 { margin: 0 0 2px; font-size: 15px; }
.panel .sub { margin: 0 0 10px; font-size: 13px; color: var(--muted); }
.empty { color: var(--muted); font-size: 14px; padding: 6px 0; }
.missing { border-style: dashed; }
.missing h3::before { content: "\25CB  "; color: var(--muted); }
.banner { border: 1px solid var(--warn); color: var(--text); background: color-mix(in srgb, var(--warn) 12%, var(--surface)); border-radius: 10px; padding: 10px 12px; font-size: 14px; }
.banner.bad { border-color: var(--danger); background: color-mix(in srgb, var(--danger) 10%, var(--surface)); }

/* Status words always carry an icon and a label, never color alone. */
.status { font-weight: 700; font-size: 13px; white-space: nowrap; }
.status.good { color: var(--ok); } .status.good::before { content: "\2713 "; }
.status.warn { color: var(--warn); } .status.warn::before { content: "\25B2 "; }
.status.bad { color: var(--danger); } .status.bad::before { content: "\2715 "; }

/* Tables */
.table-wrap { overflow-x: auto; }
table { width: 100%; border-collapse: collapse; font-size: 14px; }
th { text-align: left; font-weight: 600; color: var(--muted); font-size: 12px; text-transform: uppercase; letter-spacing: .06em; padding: 6px 8px; border-bottom: 1px solid var(--line); white-space: nowrap; }
td { padding: 8px; border-bottom: 1px solid var(--grid); vertical-align: top; }
td.r, th.r { text-align: right; font-variant-numeric: tabular-nums; }
td:first-child { white-space: nowrap; }
tr:last-child td { border-bottom: 0; }

/* Charts (drawn at the box's pixel width by app.js) */
.chart-box { width: 100%; min-height: 190px; }
.chart { display: block; overflow: visible; }
.chart .grid-line { stroke: var(--grid); stroke-width: 1; }
.chart .base { stroke: var(--line); stroke-width: 1; }
.chart .tick { fill: var(--muted); font-size: 11px; font-variant-numeric: tabular-nums; }
.chart .bar { fill: var(--s2); }
.chart .bar:hover, .chart .bar.on { filter: brightness(1.18); }
.chart .hit { fill: transparent; }
.chart .line { fill: none; stroke: var(--s2); stroke-width: 2; stroke-linejoin: round; stroke-linecap: round; }
.chart .area { fill: var(--s2); opacity: .1; }
.chart .dot { fill: var(--s2); stroke: var(--surface); stroke-width: 2; }
.chart .cross { stroke: var(--muted); stroke-width: 1; }
details.table { margin-top: 8px; font-size: 13px; }
details.table summary { cursor: pointer; color: var(--muted); }
.tip {
  position: fixed; z-index: 20; pointer-events: none; background: var(--surface); color: var(--text);
  border: 1px solid var(--line); border-radius: 8px; padding: 6px 9px; font-size: 13px; box-shadow: 0 4px 16px rgba(0,0,0,.25);
}
.tip strong { display: block; font-size: 15px; }

/* Plan mix bar (part to whole) */
.mix { display: flex; height: 22px; border-radius: 4px; overflow: hidden; gap: 2px; background: var(--surface); }
.mix span { display: block; min-width: 2px; }
.legend { display: flex; flex-wrap: wrap; gap: 6px 16px; margin-top: 8px; font-size: 14px; }
.legend i { display: inline-block; width: 12px; height: 12px; border-radius: 3px; margin-right: 6px; vertical-align: -1px; }
.s1 { background: var(--s1); } .s2 { background: var(--s2); } .s3 { background: var(--s3); }

/* Meter */
.meter { height: 8px; border-radius: 4px; background: var(--grid); overflow: hidden; margin: 6px 0 2px; }
.meter span { display: block; height: 100%; background: var(--s2); border-radius: 4px; }
.meter.over span { background: var(--warn); }
td button { white-space: nowrap; }

/* Lists: feedback, activity */
.list { display: grid; gap: 0; }
.item { padding: 10px 0; border-bottom: 1px solid var(--grid); display: grid; gap: 4px; }
.item:last-child { border-bottom: 0; }
.item .meta { font-size: 12px; color: var(--muted); display: flex; flex-wrap: wrap; gap: 4px 10px; }
.item .msg { white-space: pre-wrap; overflow-wrap: anywhere; }
.item .actions { display: flex; gap: 6px; flex-wrap: wrap; }
.kind { font-size: 11px; font-weight: 800; letter-spacing: .08em; text-transform: uppercase; border: 1px solid var(--line); border-radius: 999px; padding: 1px 8px; }
.kind.broken { border-color: var(--danger); color: var(--danger); }
.kind.idea { border-color: var(--accent); color: var(--accent); }
.new-dot::before { content: "\25CF "; color: var(--accent); }

/* Forms in panels */
.form { display: grid; gap: 10px; grid-template-columns: repeat(auto-fit, minmax(140px, 1fr)); align-items: end; }
.form .wide { grid-column: 1 / -1; }
.check { display: flex; align-items: center; gap: 8px; font-size: 14px; color: var(--text); }
.check input { width: auto; min-height: 0; }
.ok-msg { color: var(--ok); font-size: 14px; margin: 0; }
.ok-msg:empty, .error:empty { display: none; }
