/* baseline: twin-theme design language, same structure as horizon.
     dark   dense ruled tables, mono numerals, violet accent (the app's hue)
     light  paper and ink, a darker violet for small text
   All theme differences live in the token blocks; components consume tokens.
   data-theme is stamped on <html> by the boot snippet in each page head. */

:root {
  color-scheme: dark;
  --bg: #0c0d11;
  --surface: #121319;
  --surface-2: #181a22;
  --line: #252834;
  --line-soft: #1c1e27;
  --track: #262a36;

  --text: #eef0f6;
  --text-muted: #b2b8c6;
  --text-dim: #8a91a1;

  --accent: #8b7cf6;
  --accent-text: #a99ffa;
  --accent-soft: rgba(139, 124, 246, 0.12);
  --accent-line: rgba(139, 124, 246, 0.45);

  --good: #2fd6c0;
  --good-soft: rgba(47, 214, 192, 0.12);
  --bad: #ff5f9e;
  --bad-soft: rgba(255, 95, 158, 0.12);
  --warn: #f5c84a;
  --warn-soft: rgba(245, 200, 74, 0.12);
  --info: #6fb3f2;
  --info-soft: rgba(111, 179, 242, 0.12);
  --gray: #7d8494;

  --display: 'Barlow Condensed', 'Arial Narrow', sans-serif;
  --body: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
  --mono: 'JetBrains Mono', 'SF Mono', Menlo, monospace;

  --sp: 24px;
  --radius: 4px;
  --maxw: 1240px;
}

@media (prefers-color-scheme: light) {
  :root:not([data-theme]) {
    color-scheme: light;
    --bg: #f4f2f8; --surface: #fbfaff; --surface-2: #ece9f4;
    --line: #d8d3e4; --line-soft: #e2deec; --track: #e0dbea;
    --text: #17152a; --text-muted: #45415c; --text-dim: #625d78;
    --accent: #6a5ae0; --accent-text: #5545c8; --accent-soft: rgba(106, 90, 224, 0.09); --accent-line: rgba(106, 90, 224, 0.45);
    --good: #0d7a68; --good-soft: rgba(13, 122, 104, 0.1); --bad: #c22d5f; --bad-soft: rgba(194, 45, 95, 0.09);
    --warn: #8a6400; --warn-soft: rgba(138, 100, 0, 0.1); --info: #1f63a8; --info-soft: rgba(31, 99, 168, 0.09); --gray: #6c687c;
  }
}
:root[data-theme="light"] {
  color-scheme: light;
  --bg: #f4f2f8; --surface: #fbfaff; --surface-2: #ece9f4;
  --line: #d8d3e4; --line-soft: #e2deec; --track: #e0dbea;
  --text: #17152a; --text-muted: #45415c; --text-dim: #625d78;
  --accent: #6a5ae0; --accent-text: #5545c8; --accent-soft: rgba(106, 90, 224, 0.09); --accent-line: rgba(106, 90, 224, 0.45);
  --good: #0d7a68; --good-soft: rgba(13, 122, 104, 0.1); --bad: #c22d5f; --bad-soft: rgba(194, 45, 95, 0.09);
  --warn: #8a6400; --warn-soft: rgba(138, 100, 0, 0.1); --info: #1f63a8; --info-soft: rgba(31, 99, 168, 0.09); --gray: #6c687c;
}

* { box-sizing: border-box; }
html { height: 100%; }
body {
  margin: 0; min-height: 100%;
  background: var(--bg); color: var(--text);
  font-family: var(--body); font-size: 14px; line-height: 1.5;
  -webkit-font-smoothing: antialiased;
}
:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; border-radius: 2px; }
a { color: var(--accent-text); text-decoration: none; }
a:hover { text-decoration: underline; }
code { font-family: var(--mono); font-size: 12px; background: var(--surface-2); padding: 1px 5px; border-radius: 3px; }
.dim { color: var(--text-dim); }
.muted { color: var(--text-muted); }
.mono { font-family: var(--mono); }
.gate { min-height: 100vh; display: grid; place-items: center; padding: 24px; color: var(--text-muted); font-family: var(--mono); font-size: 13px; text-align: center; }

/* ── shell (slots inside <lh-nav>) ─────────────────────────────────────── */
.brand { display: inline-flex; align-items: center; gap: 9px; color: var(--accent); }
.brand svg { width: 26px; height: 26px; flex: none; }
.brand-name { font-family: var(--display); font-weight: 700; font-size: 17px; letter-spacing: 0.12em; text-transform: uppercase; color: var(--text); line-height: 1; }
.bl-tabs { display: flex; align-items: center; gap: 4px; }
.bl-tabs a {
  font-family: var(--mono); font-size: 12px; font-weight: 600; letter-spacing: 0.08em; text-transform: uppercase;
  color: var(--text-muted); padding: 6px 12px; border-radius: 999px; white-space: nowrap;
}
.bl-tabs a:hover { background: var(--surface-2); color: var(--text); text-decoration: none; }
.bl-tabs a[aria-current="page"] { background: var(--accent-soft); color: var(--accent-text); }
.bl-tabs .count { font-size: 10px; background: var(--accent-soft); color: var(--accent-text); border-radius: 999px; padding: 1px 6px; margin-left: 2px; }
.bl-actions { display: inline-flex; align-items: center; gap: 10px; }
.run-text { font-family: var(--mono); font-size: 10px; letter-spacing: 0.08em; text-transform: uppercase; color: var(--text-dim); white-space: nowrap; }
.icon-btn {
  font-size: 12px; height: 26px; padding: 0 8px; background: none; color: var(--text-muted);
  border: 1px solid var(--line); border-radius: var(--radius); cursor: pointer;
}
.icon-btn:hover { color: var(--text); border-color: var(--accent-line); }

.app { min-height: 100vh; }
.topbar { max-width: var(--maxw); margin: 0 auto; padding: 22px var(--sp) 0; display: flex; align-items: baseline; gap: 14px; flex-wrap: wrap; }
.topbar h1 { margin: 0; font-size: 21px; font-weight: 600; letter-spacing: -0.01em; }
.topbar .spacer { flex: 1; }
.content { max-width: var(--maxw); margin: 0 auto; padding: 16px var(--sp) 64px; }

/* ── buttons & forms ───────────────────────────────────────────────────── */
.btn {
  display: inline-flex; align-items: center; gap: 6px; font: 600 13px var(--body);
  padding: 7px 14px; border-radius: var(--radius); border: 1px solid var(--line);
  background: var(--surface-2); color: var(--text); cursor: pointer;
}
.btn:hover { border-color: var(--accent-line); }
.btn.primary { background: var(--accent); border-color: var(--accent); color: #fff; }
.btn.primary:hover { filter: brightness(1.08); }
.btn.danger { color: var(--bad); }
.btn.small { font-size: 12px; padding: 4px 10px; }
.btn.link { background: none; border: none; color: var(--accent-text); padding: 2px 4px; }
.btn:disabled { opacity: 0.55; cursor: not-allowed; }
label.field { display: grid; gap: 6px; font-size: 12px; color: var(--text-muted); margin: 0 0 14px; }
input[type=text], input[type=search], input[type=number], textarea, select {
  font: 13px var(--body); color: var(--text); background: var(--bg);
  border: 1px solid var(--line); border-radius: var(--radius); padding: 7px 9px; width: 100%;
}
textarea { font-family: var(--mono); font-size: 12px; min-height: 76px; resize: vertical; }
select { width: auto; }
input:focus, textarea:focus, select:focus { outline: none; border-color: var(--accent); }

/* ── status ────────────────────────────────────────────────────────────── */
.pill { display: inline-block; font: 600 11px var(--mono); letter-spacing: 0.04em; padding: 2px 8px; border-radius: 999px; white-space: nowrap; }
.pill.pass { background: var(--good-soft); color: var(--good); }
.pill.fail { background: var(--bad-soft); color: var(--bad); }
.pill.excepted { background: var(--info-soft); color: var(--info); }
.pill.unknown, .pill.unset { background: var(--warn-soft); color: var(--warn); }
.pill.neutral { background: var(--surface-2); color: var(--text-muted); }
.tag { font: 600 10px var(--mono); letter-spacing: 0.06em; text-transform: uppercase; color: var(--text-dim); border: 1px solid var(--line); border-radius: 3px; padding: 1px 5px; white-space: nowrap; }
.tag.ticket { color: var(--bad); border-color: var(--bad-soft); }
.tag.site { color: var(--info); border-color: var(--info-soft); }
.tag.group { color: var(--accent-text); border-color: var(--accent-line); }
.dot { display: inline-block; width: 8px; height: 8px; border-radius: 50%; background: var(--gray); }
.dot.good { background: var(--good); } .dot.bad { background: var(--bad); } .dot.warn { background: var(--warn); }

/* ── summary strip ─────────────────────────────────────────────────────── */
.stats { display: grid; grid-template-columns: repeat(auto-fit, minmax(170px, 1fr)); gap: 12px; margin: 4px 0 18px; }
.stat { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: 12px 14px; }
.stat .n { font: 600 28px/1.1 var(--mono); }
.stat .l { font-size: 12px; color: var(--text-muted); margin-top: 2px; }
.stat.bad .n { color: var(--bad); } .stat.good .n { color: var(--good); } .stat.warn .n { color: var(--warn); }
.bar { display: flex; height: 6px; border-radius: 3px; overflow: hidden; background: var(--track); min-width: 80px; }
.bar i { display: block; height: 100%; }

/* ── panels, notices, tables ───────────────────────────────────────────── */
.panel { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); margin: 0 0 18px; }
.panel > h2, .panel-head { margin: 0; padding: 12px 16px; border-bottom: 1px solid var(--line-soft); display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
.panel > h2, .panel-head h2 { font: 700 14px var(--display); letter-spacing: 0.1em; text-transform: uppercase; margin: 0; }
.panel-body { padding: 14px 16px; }
.notice { border: 1px solid var(--line); border-left: 3px solid var(--warn); background: var(--surface); border-radius: var(--radius); padding: 12px 16px; margin: 0 0 18px; color: var(--text-muted); }
.notice.info { border-left-color: var(--info); }
.notice.accent { border-left-color: var(--accent); }
.notice b { color: var(--text); }
.notice details summary { cursor: pointer; color: var(--accent-text); margin-top: 6px; }

.table-wrap { overflow-x: auto; }
table { width: 100%; border-collapse: collapse; }
th, td { text-align: left; padding: 9px 12px; border-bottom: 1px solid var(--line-soft); vertical-align: top; }
th { font: 600 10.5px var(--mono); letter-spacing: 0.08em; text-transform: uppercase; color: var(--text-dim); white-space: nowrap; }
td.num, th.num { text-align: right; font-family: var(--mono); }
tr.click { cursor: pointer; }
tr.click:hover td { background: var(--surface-2); }
tbody tr:last-child td { border-bottom: none; }
.site-name { font-weight: 600; }
.reason { font-size: 12px; color: var(--text-muted); }
.help { font-size: 12px; color: var(--text-dim); margin-top: 2px; }

.filters { display: flex; gap: 8px; flex-wrap: wrap; align-items: center; margin: 0 0 14px; }
.chip { font: 600 12px var(--body); padding: 5px 11px; border-radius: 999px; border: 1px solid var(--line); background: var(--surface); color: var(--text-muted); cursor: pointer; }
.chip[aria-pressed="true"] { background: var(--accent-soft); color: var(--accent-text); border-color: var(--accent-line); }
.filters input[type=search] { max-width: 240px; }

/* ── check rows (site + standard pages) ────────────────────────────────── */
.std { table-layout: fixed; }
.std th:nth-child(1) { width: 38%; } .std th:nth-child(3) { width: 96px; } .std th:nth-child(4) { width: 130px; }
.std th:nth-child(5) { width: 48px; } .std th:nth-child(6) { width: 76px; }
.checks { table-layout: fixed; }
.checks td:nth-child(1) { width: 118px; }
.checks td:nth-child(2) { width: 36%; }
.checks td:nth-child(5) { width: 150px; }
.check-label { font-weight: 600; }
.value-cell { font-size: 13px; max-width: 360px; overflow-wrap: anywhere; }
.row-actions { white-space: nowrap; text-align: right; }

.kv { display: grid; grid-template-columns: max-content 1fr; gap: 6px 18px; font-size: 13px; }
.kv dt { color: var(--text-dim); }
.kv dd { margin: 0; }
.cols { display: grid; grid-template-columns: repeat(auto-fit, minmax(280px, 1fr)); gap: 18px; }

/* ── drawer + toast ────────────────────────────────────────────────────── */
.drawer-scrim { position: fixed; inset: 0; background: rgba(0, 0, 0, 0.45); z-index: 900; }
.drawer {
  position: fixed; top: 0; right: 0; bottom: 0; width: min(480px, 100vw); z-index: 901;
  background: var(--surface); border-left: 1px solid var(--line); padding: 22px 22px 32px; overflow-y: auto;
}
.drawer h2 { font-size: 18px; margin: 0 28px 4px 0; }
.drawer .close { position: absolute; top: 14px; right: 14px; background: none; border: none; color: var(--text-muted); font-size: 16px; cursor: pointer; }
.drawer .actions { display: flex; gap: 8px; margin-top: 8px; flex-wrap: wrap; }
.drawer .err { color: var(--bad); font-size: 12px; min-height: 16px; }
.toast {
  position: fixed; left: 50%; bottom: 22px; transform: translate(-50%, 20px); opacity: 0; pointer-events: none;
  background: var(--surface-2); border: 1px solid var(--line); color: var(--text); padding: 9px 16px; border-radius: var(--radius);
  font-size: 13px; transition: opacity 160ms, transform 160ms; z-index: 950;
}
.toast.show { opacity: 1; transform: translate(-50%, 0); }
.toast.bad { border-color: var(--bad); }

.empty { padding: 28px 16px; text-align: center; color: var(--text-muted); }

@media (max-width: 720px) {
  :root { --sp: 16px; }
  body { overflow-x: clip; }
  .run-text, #themeBtn, .bl-tabs .count { display: none; }
  .bl-tabs { gap: 0; }
  .bl-tabs a { padding: 6px 7px; letter-spacing: 0.02em; font-size: 11px; }
  .bl-actions .btn.small { padding: 4px 8px; }
  .stats { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 8px; }
  .stat .n { font-size: 22px; }
  .notice { overflow-wrap: anywhere; }
  th, td { padding: 8px 8px; }
  .hide-sm { display: none; }
  .checks, .std { table-layout: auto; }
  .std th:nth-child(n) { width: auto; }
  .checks td:nth-child(n) { width: auto; }
}
