/* Wahoo Fleet Dashboard — styled to match Breaker (WMElectricalDesign/Breaker),
   the Wahoo Marine engineering web-tool look: black title bar with the foil mark
   and a Hydroflare underline, a plain light-grey workspace (Breaker's dot grid is
   its drawing canvas only, not the theme), white cards with a
   Hydroflare top rule, light buttons with a Hydroflare hover, Host Grotesk.
   Brand (Brand Guidelines 1.0): Hydroflare #FFD100, black, white, Cool Gray #53565A.
   Raw colours live HERE as tokens; the rules below use only these names. */
:root {
    --bar: #000000;            /* title bar + status bar */
    --accent: #FFD100;         /* Hydroflare — the accent everywhere */
    --brand-gray: #53565A;
    --bar-ink: #ffffff;
    --bar-ink-dim: #9b9ea2;
    --bar-line: #43464a;       /* control borders on the dark bar */
    --paper: #f3f4f6;          /* workspace behind the cards */
    --card: #ffffff;
    --card-line: #d0d7de;
    --rule: #eaeef2;
    --rule-soft: #f0f3f6;
    --ink: #24292f;
    --ink-dim: #6e7781;
    --ink-faint: #9b9ea2;
    --wash: #f6f8fa;
    --hover: #f0f4f8;
    --chip: #eef2f6;
    --link: #0969da;
    --ok: #1a7f37;      --ok-bg: #e6f6ec;
    --warn: #8a6100;    --warn-bg: #fff4d6;
    --bad: #c0392b;     --bad-bg: #fde8e7;
    --shadow: 0 8px 30px rgba(13, 27, 42, 0.10);
    --mono: ui-monospace, SFMono-Regular, Menlo, monospace;
    color-scheme: light;
}

* { box-sizing: border-box; }
[hidden] { display: none !important; }
html, body { margin: 0; min-height: 100%; }
body {
    display: flex; flex-direction: column; min-height: 100vh;
    font: 13px/1.45 "Host Grotesk", -apple-system, BlinkMacSystemFont, "Segoe UI", Helvetica, Arial, sans-serif;
    color: var(--ink);
    background: var(--paper);
}
a { color: var(--link); text-decoration: none; }
a:hover { text-decoration: underline; }
code, .mono { font-family: var(--mono); font-size: 12px; }

/* ---------- title bar (Breaker #topbar) ---------- */
.topbar {
    position: sticky; top: 0; z-index: 5; flex: none;
    display: flex; align-items: center; gap: 18px; flex-wrap: wrap;
    padding: 8px 14px;
    background: var(--bar); color: var(--bar-ink);
    border-bottom: 3px solid var(--accent);
}
.brand { display: flex; align-items: center; gap: 8px; min-width: 0; }
.foilmark { width: 26px; height: 26px; flex: none; }
.brand h1 { margin: 0; font-size: 17px; font-weight: 800; letter-spacing: 0.18em; text-transform: uppercase; }
.brand .sub { font-size: 12px; color: var(--bar-ink-dim); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }

/* nav = Breaker's segmented control, on the dark bar */
.nav { display: flex; border: 1px solid var(--bar-line); border-radius: 8px; overflow: hidden; }
.nav:empty { display: none; }
.nav a { color: var(--bar-ink-dim); padding: 5px 14px; font-size: 12px; white-space: nowrap; text-decoration: none; }
.nav a:hover { color: var(--bar-ink); }
.nav a.active { background: var(--accent); color: #000; font-weight: 600; }
.who { margin-left: auto; display: flex; align-items: center; gap: 10px; color: var(--bar-ink-dim); font-size: 12px; }
.who .badge { border-color: var(--accent); color: var(--accent); background: transparent; }
/* buttons on the dark bar (Breaker #btn-ask) */
.topbar button {
    border: 1px solid var(--bar-line); background: transparent; color: var(--bar-ink);
    border-radius: 8px; padding: 5px 12px; font-weight: 600;
}
.topbar button:hover { border-color: var(--accent); color: var(--accent); }

.main { flex: 1 0 auto; width: 100%; padding: 16px; max-width: 1500px; margin: 0 auto; }

/* ---------- cards (Breaker #inspector) ---------- */
.panel {
    background: var(--card);
    border: 1px solid var(--card-line); border-top: 3px solid var(--accent);
    border-radius: 10px; box-shadow: var(--shadow);
    padding: 14px 16px; margin-bottom: 16px;
}
.panel h2 { margin: 0 0 10px; font-size: 16px; line-height: 1.25; }
.panel h3 {
    margin: 16px 0 6px; font-size: 11px; font-weight: 600;
    text-transform: uppercase; letter-spacing: 0.4px; color: var(--ink-dim);
}
.panel.error { border-top-color: var(--bad); color: var(--bad); }
.narrow { max-width: 420px; margin: 48px auto; }
.muted { color: var(--ink-dim); }
.secondary { color: var(--ink-dim); }
.error { color: var(--bad); }
.row { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; }
.spacer { flex: 1; }
.mt { margin-top: 12px; }

.grid { display: grid; gap: 4px 24px; grid-template-columns: repeat(auto-fill, minmax(220px, 1fr)); }
.kv { padding: 4px 0; border-bottom: 1px solid var(--rule-soft); }
.kv .k { color: var(--ink-dim); font-size: 11px; }
.kv .v { overflow-wrap: anywhere; }

/* ---------- forms ---------- */
label { display: block; color: var(--ink-dim); font-size: 11px; text-transform: uppercase; letter-spacing: 0.4px; margin: 12px 0 4px; }
input, select, textarea {
    width: 100%; padding: 7px 10px; border-radius: 6px;
    background: var(--card); color: var(--ink);
    border: 1px solid var(--card-line); font: inherit;
}
input:focus, select:focus, textarea:focus { outline: none; border-color: var(--accent); box-shadow: 0 0 0 2px rgba(255, 209, 0, 0.35); }
.row input, .row select { width: auto; min-width: 180px; }

/* ---------- buttons (Breaker #insp-actions / .seg.on) ---------- */
button {
    appearance: none; -webkit-appearance: none;
    border: 1px solid var(--card-line); background: var(--wash); color: var(--ink);
    border-radius: 6px; padding: 4px 11px; font: inherit; font-size: 12px; cursor: pointer; white-space: nowrap;
}
button:hover { border-color: var(--accent); }
button.primary { background: var(--accent); border-color: var(--accent); color: #000; font-weight: 600; }
button.primary:hover { border-color: #000; }
button.danger { background: transparent; border-color: var(--card-line); color: var(--bad); }
button.danger:hover { border-color: var(--bad); }
button:disabled { opacity: 0.5; cursor: default; }
.qr { width: 196px; height: 196px; padding: 8px; background: #fff; border: 1px solid var(--rule); border-radius: 8px; }

/* ---------- tables ---------- */
.table-wrap { overflow-x: auto; }
table { width: 100%; border-collapse: collapse; }
th, td { text-align: left; padding: 6px 8px; border-bottom: 1px solid var(--rule); vertical-align: top; }
th { color: var(--ink-dim); font-weight: 600; font-size: 11px; text-transform: uppercase; letter-spacing: 0.4px; white-space: nowrap; }
tr.click { cursor: pointer; }
tr.click:hover td { background: var(--hover); }
td.num, th.num { text-align: right; font-variant-numeric: tabular-nums; }
.nowrap { white-space: nowrap; }
pre {
    margin: 6px 0 0; padding: 8px 12px; border-radius: 6px; max-height: 320px; overflow: auto;
    background: var(--bar); color: var(--bar-ink); white-space: pre-wrap;
    font-family: var(--mono); font-size: 11.5px;
}

/* ---------- badges: pills (Breaker .chip) ---------- */
.badge {
    display: inline-block; padding: 0 9px; border-radius: 999px; font-size: 11px; line-height: 18px;
    background: var(--chip); color: var(--ink); border: 1px solid transparent; white-space: nowrap;
}
.badge.ok { background: var(--ok-bg); color: var(--ok); }
.badge.warn { background: var(--warn-bg); color: var(--warn); }
.badge.bad { background: var(--bad-bg); color: var(--bad); }
.badge.accent { background: var(--accent); color: #000; font-weight: 600; }

/* ---------- tabs = segmented control (Breaker #scope-seg, light) ---------- */
.tabs { display: inline-flex; flex-wrap: wrap; border: 1px solid var(--card-line); border-radius: 8px; overflow: hidden; margin-bottom: 12px; }
.tabs button { border: none; border-radius: 0; background: transparent; color: var(--ink-dim); padding: 6px 12px; }
.tabs button + button { border-left: 1px solid var(--card-line); }
.tabs button:hover { color: var(--ink); }
.tabs button.active { background: var(--accent); color: #000; font-weight: 600; }

/* ---------- commands ---------- */
.presets { display: grid; gap: 10px; grid-template-columns: repeat(auto-fill, minmax(260px, 1fr)); }
.preset { background: var(--wash); border: 1px solid var(--rule); border-radius: 8px; padding: 10px 12px; }
.preset .name { font-weight: 700; font-family: var(--mono); font-size: 12px; }
.preset .desc { color: var(--ink-dim); font-size: 12px; margin: 4px 0 8px; }
.preset input { margin-top: 6px; }
.hardline { border-left: 3px solid var(--accent); padding: 4px 10px; margin: 0 0 12px; color: var(--ink-dim); font-size: 12px; }

/* ---------- status bar (Breaker #statusbar) ---------- */
.statusbar {
    flex: none; display: flex; justify-content: space-between; gap: 12px;
    padding: 4px 14px; background: var(--bar); color: var(--bar-ink-dim);
    font-size: 11px; font-family: var(--mono);
}
.statusbar span { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; min-width: 0; }

@media (max-width: 700px) {
    .brand .sub { display: none; }
    .nav { order: 3; flex-basis: 100%; }
    .who { margin-left: 0; }
    .statusbar span:first-child { display: none; }
}
