/* Payout Gateway CRM — light and dark themes. Theme follows the system unless the user picks one
   (html[data-theme="light" | "dark"]). */
:root {
  --bg: #f4f6f9;
  --panel: #ffffff;
  --panel-2: #f8fafc;
  --panel-3: #eef2f7;
  --ink: #1b2430;
  --ink-2: #344054;
  --muted: #667085;
  --line: #e4e7ec;
  --line-2: #d0d5dd;
  --accent: #2f5d9e;
  --accent-ink: #ffffff;
  --accent-soft: #e8f0fb;
  --ok: #1f7a4a;
  --ok-soft: #e6f4ec;
  --warn: #a65d00;
  --warn-soft: #fff3e0;
  --bad: #b42318;
  --bad-soft: #fdecea;
  --info: #3b5bdb;
  --info-soft: #edf2ff;
  --idle: #7a8494;
  --idle-soft: #f0f2f5;
  --chart-a: #2f5d9e;
  --chart-b: #d9480f;
  --shadow: 0 1px 2px rgba(16, 24, 40, .05), 0 1px 3px rgba(16, 24, 40, .07);
  --shadow-lg: 0 12px 32px rgba(16, 24, 40, .18);
  --radius: 10px;
  --mono: ui-monospace, SFMono-Regular, Consolas, "Liberation Mono", monospace;
  color-scheme: light;
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --bg: #0e131a; --panel: #151c26; --panel-2: #1a2230; --panel-3: #212b3b; --ink: #e6eaf0; --ink-2: #c5cdd9; --muted: #93a0b3;
    --line: #263042; --line-2: #33405a; --accent: #6f9ee3; --accent-ink: #0b1220; --accent-soft: #1c2a3e;
    --ok: #4cc38a; --ok-soft: #12281d; --warn: #f0a548; --warn-soft: #2d2213; --bad: #f2766b; --bad-soft: #321716;
    --info: #8ea3fb; --info-soft: #1b2140; --idle: #8b96a8; --idle-soft: #1d2533; --chart-a: #6f9ee3; --chart-b: #f08c4a;
    --shadow: none; --shadow-lg: 0 12px 32px rgba(0, 0, 0, .5); color-scheme: dark;
  }
}
:root[data-theme="dark"] {
  --bg: #0e131a; --panel: #151c26; --panel-2: #1a2230; --panel-3: #212b3b; --ink: #e6eaf0; --ink-2: #c5cdd9; --muted: #93a0b3;
  --line: #263042; --line-2: #33405a; --accent: #6f9ee3; --accent-ink: #0b1220; --accent-soft: #1c2a3e;
  --ok: #4cc38a; --ok-soft: #12281d; --warn: #f0a548; --warn-soft: #2d2213; --bad: #f2766b; --bad-soft: #321716;
  --info: #8ea3fb; --info-soft: #1b2140; --idle: #8b96a8; --idle-soft: #1d2533; --chart-a: #6f9ee3; --chart-b: #f08c4a;
  --shadow: none; --shadow-lg: 0 12px 32px rgba(0, 0, 0, .5); color-scheme: dark;
}

* { box-sizing: border-box; }
html, body { margin: 0; padding: 0; }
body { background: var(--bg); color: var(--ink); font: 14px/1.45 system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif; }
a { color: var(--accent); text-decoration: none; }
a:hover { text-decoration: underline; }
code, pre, .mono, kbd { font-family: var(--mono); font-size: 12.5px; }
.boot { padding: 40px; color: var(--muted); }
.sub { color: var(--muted); font-size: 12.5px; font-weight: 400; }
.icon { width: 16px; height: 16px; fill: none; stroke: currentColor; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; flex: none; }

/* ── Layout ── */
.shell { display: grid; grid-template-columns: 228px minmax(0, 1fr); min-height: 100vh; }
.nav { background: var(--panel); border-right: 1px solid var(--line); padding: 16px 12px; display: flex; flex-direction: column; gap: 2px; position: sticky; top: 0; height: 100vh; overflow-y: auto; }
.brand { display: flex; align-items: center; gap: 10px; font-weight: 700; font-size: 15px; padding: 2px 8px 14px; color: var(--ink); }
.brand:hover { text-decoration: none; }
.brand small { display: block; font-weight: 400; color: var(--muted); font-size: 12px; }
.logo { display: inline-grid; place-items: center; width: 32px; height: 32px; border-radius: 9px; background: var(--accent); color: var(--accent-ink); }
.logo .icon { width: 18px; height: 18px; }
.nav-group { margin-top: 6px; }
.nav-title { font-size: 11px; text-transform: uppercase; letter-spacing: .06em; color: var(--muted); padding: 8px 10px 4px; font-weight: 600; }
.nav a:not(.brand) { display: flex; align-items: center; gap: 10px; color: var(--ink-2); padding: 7px 10px; border-radius: 8px; font-weight: 500; }
.nav a:not(.brand):hover { background: var(--panel-2); text-decoration: none; }
.nav a.active { background: var(--accent-soft); color: var(--accent); }
.nav .spacer { flex: 1; min-height: 12px; }
.nav .who { color: var(--muted); font-size: 12px; padding: 10px; border-top: 1px solid var(--line); display: flex; flex-direction: column; gap: 4px; }
.main-wrap { min-width: 0; display: flex; flex-direction: column; }
.topbar { position: sticky; top: 0; z-index: 20; display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 10px 28px; background: color-mix(in srgb, var(--bg) 88%, transparent); backdrop-filter: blur(6px); border-bottom: 1px solid var(--line); }
.topbar-right { display: flex; gap: 8px; align-items: center; }
.search { flex: 1; max-width: 640px; display: flex; align-items: center; gap: 8px; background: var(--panel); border: 1px solid var(--line-2); border-radius: 10px; padding: 0 10px; }
.search:focus-within { outline: 2px solid var(--accent); outline-offset: 1px; }
.search .icon { color: var(--muted); }
.search input.search-input { flex: 1; border: none; background: transparent; padding: 9px 0; min-width: 0; outline: none; }
kbd { border: 1px solid var(--line-2); border-bottom-width: 2px; border-radius: 5px; padding: 0 6px; color: var(--muted); font-size: 11px; background: var(--panel-2); }
.main { padding: 20px 28px 60px; min-width: 0; }
.page-head { display: flex; align-items: flex-start; justify-content: space-between; gap: 12px; margin-bottom: 16px; flex-wrap: wrap; }
.page-head h1 { font-size: 21px; margin: 0 0 2px; }
.page-head .sub { max-width: 760px; }
.back { display: inline-flex; align-items: center; gap: 4px; font-size: 13px; margin-bottom: 8px; }

/* ── Panels & grids ── */
.panel { background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius); box-shadow: var(--shadow); min-width: 0; }
.panel + .panel, .panel + .tiles, .tiles + .two, .panel + .two, .verdict + .jstrip, .jstrip + .two, .alert + .panel, .alert + .verdict { margin-top: 16px; }
.panel-head { display: flex; align-items: center; justify-content: space-between; padding: 12px 16px; border-bottom: 1px solid var(--line); gap: 10px; flex-wrap: wrap; }
.panel-head.stack { flex-direction: column; align-items: stretch; }
.panel-head h2 { font-size: 14px; margin: 0; }
.panel-body { padding: 14px 16px; }
.two { display: grid; grid-template-columns: minmax(0, 2fr) minmax(0, 1fr); gap: 16px; align-items: start; }
.two > div > .panel + .panel { margin-top: 16px; }
.journey-cols { grid-template-columns: minmax(0, 1.7fr) minmax(280px, 1fr); }
@media (max-width: 1100px) { .two, .journey-cols { grid-template-columns: minmax(0, 1fr); } }
.tiles { display: grid; grid-template-columns: repeat(auto-fit, minmax(165px, 1fr)); gap: 12px; margin-top: 16px; }
.tile { display: block; background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius); padding: 13px 15px; box-shadow: var(--shadow); color: inherit; }
a.tile:hover { text-decoration: none; border-color: var(--accent); }
.tile .label { color: var(--muted); font-size: 11.5px; text-transform: uppercase; letter-spacing: .04em; font-weight: 600; }
.tile .value { font-size: 25px; font-weight: 700; margin-top: 3px; font-variant-numeric: tabular-nums; }
.tile .hint { color: var(--muted); font-size: 12px; margin-top: 1px; }
.tile.warn { border-color: var(--warn); } .tile.warn .value { color: var(--warn); }
.tile.bad { border-color: var(--bad); } .tile.bad .value { color: var(--bad); }
.tile.info .value { color: var(--info); }

/* ── Flow diagram ── */
.flow { display: flex; flex-direction: column; gap: 18px; }
.lane-title { font-weight: 600; font-size: 13px; margin-bottom: 8px; }
.lane-row { display: grid; grid-template-columns: minmax(110px, 1fr) minmax(150px, 1.6fr) minmax(110px, 1fr) minmax(150px, 1.6fr) minmax(110px, 1fr); align-items: center; gap: 0; }
.fnode { border: 1px solid var(--line-2); background: var(--panel-2); border-radius: 10px; padding: 10px 12px; text-align: center; display: flex; flex-direction: column; gap: 2px; }
.fnode strong { font-size: 14px; }
.farrow { display: flex; flex-direction: column; align-items: stretch; padding: 0 8px; color: var(--ink); min-width: 0; }
a.farrow:hover { text-decoration: none; }
a.farrow:hover .farrow-main { text-decoration: underline; }
.farrow-label { text-align: center; display: flex; flex-direction: column; margin-bottom: 6px; }
.farrow-main { font-weight: 600; font-variant-numeric: tabular-nums; }
.farrow-line { position: relative; height: 3px; border-radius: 2px; background: var(--idle); margin-right: 8px; }
.farrow-line::after { content: ""; position: absolute; right: -9px; top: -5px; border-left: 10px solid var(--idle); border-top: 6.5px solid transparent; border-bottom: 6.5px solid transparent; }
.farrow.ok .farrow-line { background: var(--ok); } .farrow.ok .farrow-line::after { border-left-color: var(--ok); }
.farrow.warn .farrow-line { background: var(--warn); } .farrow.warn .farrow-line::after { border-left-color: var(--warn); }
.farrow.bad .farrow-line { background: var(--bad); } .farrow.bad .farrow-line::after { border-left-color: var(--bad); }
.farrow.warn .sub { color: var(--warn); } .farrow.bad .sub { color: var(--bad); }
.farrow.idle .farrow-main { color: var(--muted); }

/* ── Provider cards ── */
.cards { display: grid; grid-template-columns: repeat(auto-fill, minmax(250px, 1fr)); gap: 12px; padding: 14px 16px; }
.pcard { display: flex; flex-direction: column; gap: 8px; border: 1px solid var(--line); border-left: 4px solid var(--idle); border-radius: 10px; padding: 12px; background: var(--panel); color: inherit; }
.pcard:hover { text-decoration: none; border-color: var(--accent); }
.pcard.ok { border-left-color: var(--ok); } .pcard.warn { border-left-color: var(--warn); } .pcard.bad { border-left-color: var(--bad); }
.pcard-head { display: flex; justify-content: space-between; align-items: flex-start; gap: 8px; }
.pcard-stats { display: grid; grid-template-columns: repeat(5, minmax(0, 1fr)); gap: 4px; }
.stat { display: flex; flex-direction: column; }
.stat .k { font-size: 10.5px; color: var(--muted); text-transform: uppercase; letter-spacing: .03em; }
.stat .v { font-weight: 600; font-variant-numeric: tabular-nums; }
.stat.bad .v { color: var(--bad); }
.pcard-foot { font-size: 12px; color: var(--muted); }
.spark { width: 100%; height: 34px; display: block; }
.spark .bar-a { fill: var(--chart-a); opacity: .75; } .spark .bar-b { fill: var(--chart-b); } .spark .axis { stroke: var(--line); }

/* ── Tables ── */
.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); vertical-align: top; }
th { font-size: 12px; color: var(--muted); font-weight: 600; background: var(--panel-2); white-space: nowrap; position: sticky; top: 0; z-index: 1; }
tbody tr:last-child td { border-bottom: none; }
tbody tr.click { cursor: pointer; }
tbody tr.click:hover td { background: var(--panel-2); }
tbody tr.current td { background: var(--accent-soft); }
td.num, th.num { text-align: right; font-variant-numeric: tabular-nums; white-space: nowrap; }
td .sub { margin-top: 2px; }
.empty { padding: 26px; text-align: center; color: var(--muted); }
.empty.ok { color: var(--ok); }
.trunc { max-width: 320px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.trunc.path { max-width: 230px; }
.nowrap { white-space: nowrap; }
.says-cell { min-width: 180px; max-width: 320px; }
.ticket { font-weight: 600; }
.flags { display: flex; flex-wrap: wrap; gap: 4px; margin-top: 4px; }

/* ── Badges, chips ── */
.badge { display: inline-block; padding: 2px 8px; border-radius: 999px; font-size: 11.5px; font-weight: 600; white-space: nowrap; background: var(--panel-2); color: var(--muted); border: 1px solid var(--line); vertical-align: middle; }
.badge.ok { background: var(--ok-soft); color: var(--ok); border-color: transparent; }
.badge.warn { background: var(--warn-soft); color: var(--warn); border-color: transparent; }
.badge.bad { background: var(--bad-soft); color: var(--bad); border-color: transparent; }
.badge.info { background: var(--info-soft); color: var(--info); border-color: transparent; }
.badge.idle { background: var(--idle-soft); color: var(--idle); border-color: transparent; }
.badges { display: inline-flex; flex-wrap: wrap; gap: 4px; }
.badges.col { flex-direction: column; align-items: flex-start; }
.chips { display: flex; flex-wrap: wrap; gap: 6px; }
.chip { border: 1px solid var(--line-2); background: var(--panel); border-radius: 999px; padding: 4px 12px; cursor: pointer; font-size: 12.5px; font-weight: 500; color: var(--ink-2); }
.chip:hover { background: var(--panel-2); }
.chip.active { background: var(--accent); border-color: var(--accent); color: var(--accent-ink); }
.chip-check { border: 1px solid var(--line-2); border-radius: 8px; padding: 5px 10px; background: var(--panel); font-size: 13px; }
.jchips { display: flex; flex-wrap: wrap; gap: 4px; }
.jchip { font-size: 11.5px; padding: 1px 7px; border-radius: 6px; border: 1px solid var(--line); white-space: nowrap; color: var(--muted); background: var(--panel-2); }
.jchip.ok { color: var(--ok); background: var(--ok-soft); border-color: transparent; }
.jchip.warn { color: var(--warn); background: var(--warn-soft); border-color: transparent; }
.jchip.bad { color: var(--bad); background: var(--bad-soft); border-color: transparent; }
.jchip.info { color: var(--info); background: var(--info-soft); border-color: transparent; }
.says { font-size: 12.5px; color: var(--ink-2); }
.says strong { color: var(--ink); }
.says-box { background: var(--panel-2); border: 1px solid var(--line); border-radius: 8px; padding: 8px 12px; margin-bottom: 12px; font-size: 13px; }
.tip { display: inline-grid; place-items: center; width: 15px; height: 15px; margin-left: 5px; border-radius: 50%; border: 1px solid var(--line-2); color: var(--muted); font-size: 10px; font-weight: 700; cursor: help; vertical-align: 1px; }

/* ── Forms & buttons ── */
.filters { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; }
input, select, textarea, button { font: inherit; color: inherit; }
input[type=text], input[type=password], input[type=number], input[type=search], select, textarea {
  background: var(--panel); border: 1px solid var(--line-2); border-radius: 8px; padding: 7px 10px; min-width: 0;
}
input[type=search] { min-width: 210px; }
textarea { width: 100%; min-height: 70px; font-family: var(--mono); font-size: 12.5px; }
input:focus, select:focus, textarea:focus, button:focus-visible, a:focus-visible, summary:focus-visible { outline: 2px solid var(--accent); outline-offset: 1px; }
.btn { display: inline-flex; align-items: center; gap: 6px; background: var(--panel); border: 1px solid var(--line-2); border-radius: 8px; padding: 7px 12px; cursor: pointer; font-weight: 500; color: var(--ink); white-space: nowrap; }
a.btn:hover { text-decoration: none; }
.btn:hover { background: var(--panel-2); }
.btn.primary { background: var(--accent); color: var(--accent-ink); border-color: var(--accent); }
.btn.primary:hover { filter: brightness(1.06); }
.btn.danger { color: var(--bad); border-color: var(--bad); }
.btn.ghost { border-color: transparent; background: transparent; color: var(--ink-2); }
.btn.ghost:hover { background: var(--panel-3); }
.btn.small { padding: 4px 9px; font-size: 12.5px; }
.btn.tiny { padding: 2px 5px; font-size: 12px; border-radius: 6px; }
.btn.tiny .icon { width: 13px; height: 13px; }
.btn:disabled { opacity: .55; cursor: default; }
.field { display: flex; flex-direction: column; gap: 5px; margin-bottom: 12px; }
.field label { font-weight: 600; font-size: 12.5px; }
.field .help { color: var(--muted); font-size: 12px; }
.row { display: flex; gap: 12px; flex-wrap: wrap; }
.row > .field { flex: 1 1 200px; }
.check { display: inline-flex; align-items: center; gap: 8px; font-weight: 500; cursor: pointer; }
.live { display: flex; align-items: center; gap: 8px; }
.live-stamp { color: var(--muted); font-size: 12px; font-variant-numeric: tabular-nums; }
.live-toggle { border-color: var(--line-2) !important; }
.live-dot { width: 8px; height: 8px; border-radius: 50%; background: var(--idle); }
.live-toggle.on .live-dot { background: var(--ok); box-shadow: 0 0 0 3px var(--ok-soft); }
.idtext { display: inline-flex; align-items: center; gap: 4px; max-width: 100%; }
.idtext code { word-break: break-all; }

/* ── Alerts & attention ── */
.alert { padding: 10px 12px; border-radius: 8px; margin-bottom: 12px; border: 1px solid transparent; }
.alert.bad { background: var(--bad-soft); color: var(--bad); }
.alert.warn { background: var(--warn-soft); color: var(--warn); }
.alert.ok { background: var(--ok-soft); color: var(--ok); }
.alert.info { background: var(--info-soft); color: var(--info); }
.attention { list-style: none; margin: 0; padding: 0; }
.attention li { padding: 11px 16px; border-bottom: 1px solid var(--line); display: flex; gap: 10px; align-items: flex-start; }
.attention li:last-child { border-bottom: none; }
.attention .what { flex: 1; min-width: 0; }
.attention .what a, .attention .what strong { font-weight: 600; word-break: break-word; }
.toast { position: fixed; right: 18px; bottom: 18px; z-index: 60; padding: 10px 14px; border-radius: 8px; background: var(--ink); color: var(--bg); box-shadow: var(--shadow-lg); max-width: 420px; }
.toast.bad { background: var(--bad); color: #fff; }

/* ── Payout journey ── */
.verdict { border-radius: var(--radius); border: 1px solid var(--line); border-left: 5px solid var(--info); background: var(--panel); padding: 14px 18px; box-shadow: var(--shadow); }
.verdict.ok { border-left-color: var(--ok); background: linear-gradient(90deg, var(--ok-soft), var(--panel) 60%); }
.verdict.warn { border-left-color: var(--warn); background: linear-gradient(90deg, var(--warn-soft), var(--panel) 60%); }
.verdict.bad { border-left-color: var(--bad); background: linear-gradient(90deg, var(--bad-soft), var(--panel) 60%); }
.verdict.info { background: linear-gradient(90deg, var(--info-soft), var(--panel) 60%); }
.verdict-title { font-size: 17px; font-weight: 700; margin-bottom: 4px; }
.verdict p { margin: 3px 0; color: var(--ink-2); }
.jstrip { list-style: none; margin: 16px 0 0; padding: 0; display: grid; grid-template-columns: repeat(7, minmax(0, 1fr)); gap: 0; background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius); box-shadow: var(--shadow); overflow: hidden; }
.jstep { position: relative; padding: 14px 12px 12px 12px; border-right: 1px solid var(--line); min-width: 0; }
.jstep:last-child { border-right: none; background: var(--panel-2); }
.jstep::before { content: ""; position: absolute; left: 0; right: 0; top: 0; height: 3px; background: var(--idle); opacity: .5; }
.jstep.ok::before { background: var(--ok); opacity: 1; } .jstep.warn::before { background: var(--warn); opacity: 1; }
.jstep.bad::before { background: var(--bad); opacity: 1; } .jstep.info::before { background: var(--info); opacity: 1; }
.jdot { display: inline-block; width: 9px; height: 9px; border-radius: 50%; background: var(--idle); margin-right: 6px; vertical-align: 1px; }
.jstep.ok .jdot { background: var(--ok); } .jstep.warn .jdot { background: var(--warn); } .jstep.bad .jdot { background: var(--bad); } .jstep.info .jdot { background: var(--info); }
.jwho { display: inline; font-size: 10.5px; text-transform: uppercase; letter-spacing: .04em; color: var(--muted); font-weight: 600; }
.jtitle { font-weight: 700; margin-top: 4px; }
.jtext { font-size: 12.5px; color: var(--ink-2); margin-top: 2px; overflow-wrap: anywhere; }
@media (max-width: 1250px) { .jstrip { grid-template-columns: repeat(4, minmax(0, 1fr)); } .jstep { border-bottom: 1px solid var(--line); } }
@media (max-width: 640px) { .jstrip { grid-template-columns: minmax(0, 1fr); } .jstep { border-right: none; } }

.timeline { list-style: none; margin: 0; padding: 0; }
.ev { display: grid; grid-template-columns: 84px 18px minmax(0, 1fr); gap: 0 10px; position: relative; padding-bottom: 14px; }
.ev::before { content: ""; position: absolute; left: 102px; top: 16px; bottom: -2px; width: 2px; background: var(--line); }
.ev:last-child::before { display: none; }
.ev-time { text-align: right; display: flex; flex-direction: column; font-variant-numeric: tabular-nums; }
.ev-time .clock { font-weight: 600; font-size: 12.5px; }
.ev-time .offset { color: var(--muted); font-size: 11.5px; }
.ev-dot { width: 12px; height: 12px; border-radius: 50%; background: var(--idle); margin: 3px auto 0; box-shadow: 0 0 0 3px var(--panel); position: relative; z-index: 1; }
.ev.ok .ev-dot { background: var(--ok); } .ev.warn .ev-dot { background: var(--warn); } .ev.bad .ev-dot { background: var(--bad); } .ev.info .ev-dot { background: var(--info); }
.ev-body { min-width: 0; }
.ev-who { font-size: 10.5px; text-transform: uppercase; letter-spacing: .04em; color: var(--muted); font-weight: 600; display: flex; flex-wrap: wrap; gap: 4px; align-items: center; }
.ev-who .arrow { opacity: .7; }
.ev-title { display: flex; flex-wrap: wrap; gap: 6px; align-items: center; margin-top: 1px; }
.ev-says { font-size: 12.5px; margin-top: 2px; color: var(--muted); }
.ev-text { font-size: 12.5px; color: var(--ink-2); margin-top: 2px; overflow-wrap: anywhere; }
.disclosure { margin-top: 6px; }
.disclosure summary { cursor: pointer; color: var(--accent); font-size: 12.5px; user-select: none; }
.disclosure-body { margin-top: 6px; padding: 10px 12px; border: 1px solid var(--line); border-radius: 8px; background: var(--panel-2); }
.disclosure-body h4 { margin: 10px 0 4px; font-size: 12px; color: var(--muted); text-transform: uppercase; letter-spacing: .03em; }
.drawer-body > .disclosure { border: 1px solid var(--line); border-radius: 8px; padding: 8px 12px; margin: 8px 0; }
.drawer-body > .disclosure > .disclosure-body { border: none; padding: 0; background: transparent; }

/* ── Drawer ── */
.backdrop { position: fixed; inset: 0; background: rgba(10, 14, 20, .45); z-index: 40; display: flex; justify-content: flex-end; }
.drawer { background: var(--panel); width: min(880px, 100%); height: 100%; overflow-y: auto; border-left: 1px solid var(--line); box-shadow: var(--shadow-lg); }
.drawer-head { position: sticky; top: 0; background: var(--panel); border-bottom: 1px solid var(--line); padding: 14px 18px; display: flex; justify-content: space-between; gap: 10px; align-items: center; z-index: 2; flex-wrap: wrap; }
.drawer-head h2 { margin: 0; font-size: 16px; }
.drawer-body { padding: 16px 18px 40px; }
.kv { display: grid; grid-template-columns: 180px minmax(0, 1fr); gap: 7px 14px; margin: 0 0 14px; }
.kv dt { color: var(--muted); font-size: 12.5px; }
.kv dd { margin: 0; word-break: break-word; }
pre.json { background: var(--panel-2); border: 1px solid var(--line); border-radius: 8px; padding: 10px 12px; overflow: auto; max-height: 360px; margin: 6px 0 12px; white-space: pre-wrap; word-break: break-all; }
.disclosure-body pre.json { background: var(--panel); }
h3.sec { font-size: 12.5px; margin: 18px 0 6px; color: var(--muted); text-transform: uppercase; letter-spacing: .04em; }
.actions { display: flex; gap: 8px; flex-wrap: wrap; margin: 10px 0 4px; }
.copy { display: flex; gap: 6px; align-items: center; margin: 4px 0 12px; }
.copy code { background: var(--panel-2); border: 1px solid var(--line); border-radius: 6px; padding: 3px 7px; word-break: break-all; }

/* ── Providers ── */
.pgrid { display: grid; grid-template-columns: repeat(auto-fill, minmax(440px, 1fr)); gap: 16px; }
.pgrid > .panel + .panel { margin-top: 0; }
.checklist { list-style: none; margin: 0 0 8px; padding: 0; display: flex; flex-direction: column; gap: 8px; }
.check-item { display: flex; gap: 10px; align-items: flex-start; }
.check-item .mark { flex: none; display: inline-grid; place-items: center; width: 20px; height: 20px; border-radius: 50%; font-size: 12px; font-weight: 700; background: var(--idle-soft); color: var(--idle); }
.check-item.ok .mark { background: var(--ok-soft); color: var(--ok); }
.check-item.warn .mark { background: var(--warn-soft); color: var(--warn); }
.check-item.bad .mark { background: var(--bad-soft); color: var(--bad); }
.check-item.info .mark { background: var(--info-soft); color: var(--info); }
.changes .from { color: var(--bad); font-family: var(--mono); font-size: 12px; }
.changes .to { color: var(--ok); font-family: var(--mono); font-size: 12px; }

/* ── Guide ── */
.toc { display: flex; flex-wrap: wrap; gap: 6px 16px; margin: 0 0 14px; font-size: 13px; }
.guide p { margin: 6px 0; }
.steps { margin: 0; padding-left: 0; list-style: none; display: flex; flex-direction: column; gap: 10px; }
.steps li { border-left: 3px solid var(--accent); padding: 2px 0 2px 12px; }
.plain { margin: 0; padding-left: 18px; display: flex; flex-direction: column; gap: 6px; }

/* ── Login ── */
.login { min-height: 100vh; display: grid; place-items: center; padding: 16px; }
.login .panel { width: 100%; max-width: 400px; }
.login-brand { display: flex; gap: 12px; align-items: center; margin-bottom: 18px; }
.login h1 { font-size: 18px; margin: 0 0 2px; }
.login p { color: var(--muted); margin: 0; font-size: 13px; }
.login .btn { width: 100%; justify-content: center; }

/* ── Pager, charts ── */
.pager { display: flex; justify-content: space-between; align-items: center; padding: 10px 16px; border-top: 1px solid var(--line); color: var(--muted); font-size: 12.5px; gap: 10px; }
.chart { width: 100%; height: 170px; display: block; }
.chart .bar-a { fill: var(--chart-a); }
.chart .bar-b { fill: var(--chart-b); }
.chart .axis { stroke: var(--line-2); }
.chart .grid { stroke: var(--line); stroke-dasharray: 3 4; }
.chart text { fill: var(--muted); font-size: 10px; }
.legend { display: flex; gap: 14px; color: var(--muted); font-size: 12px; }
.legend .sw { display: inline-block; width: 10px; height: 10px; border-radius: 2px; margin-right: 5px; vertical-align: -1px; }
.legend .sw.a { background: var(--chart-a); }
.legend .sw.b { background: var(--chart-b); }

/* ── Small screens ── */
@media (max-width: 900px) {
  .lane-row { grid-template-columns: minmax(0, 1fr); gap: 6px; }
  .farrow { padding: 0; }
  .farrow-line { width: 3px; height: 18px; margin: 0 auto 8px; }
  .farrow-line::after { right: auto; left: -5px; top: auto; bottom: -9px; border-left: 6.5px solid transparent; border-right: 6.5px solid transparent; border-top: 10px solid var(--idle); border-bottom: none; }
  .farrow.ok .farrow-line::after { border-top-color: var(--ok); border-left-color: transparent; }
  .farrow.warn .farrow-line::after { border-top-color: var(--warn); border-left-color: transparent; }
  .farrow.bad .farrow-line::after { border-top-color: var(--bad); border-left-color: transparent; }
  .pgrid { grid-template-columns: minmax(0, 1fr); }
}
@media (max-width: 760px) {
  .shell { grid-template-columns: minmax(0, 1fr); }
  .nav { position: static; height: auto; flex-direction: row; flex-wrap: wrap; border-right: none; border-bottom: 1px solid var(--line); padding: 10px 16px; }
  .nav-group { display: contents; }
  .nav-title, .nav .spacer, .nav .who { display: none; }
  .brand { width: 100%; padding-bottom: 6px; }
  .topbar { padding: 10px 16px; position: static; }
  .main { padding: 16px; }
  .kv { grid-template-columns: minmax(0, 1fr); }
  .ev { grid-template-columns: 64px 16px minmax(0, 1fr); }
  .ev::before { left: 79px; }
  .pcard-stats { grid-template-columns: repeat(3, minmax(0, 1fr)); }
  input[type=search] { min-width: 0; width: 100%; }
}

/* ── List pages: tabs, filters, active-filter pills ── */
.list-head { display: flex; flex-direction: column; gap: 12px; padding: 12px 16px 14px; border-bottom: 1px solid var(--line); }
.tabs { display: flex; flex-wrap: wrap; gap: 4px; }
.tab { display: inline-flex; align-items: center; gap: 7px; border: 1px solid transparent; background: transparent; border-radius: 8px; padding: 6px 11px; cursor: pointer; font-size: 13px; font-weight: 500; color: var(--ink-2); }
.tab:hover { background: var(--panel-2); }
.tab.active { background: var(--accent-soft); color: var(--accent); border-color: color-mix(in srgb, var(--accent) 22%, transparent); font-weight: 600; }
.count { display: inline-block; min-width: 20px; padding: 0 6px; border-radius: 999px; background: var(--panel-3); color: var(--muted); font-size: 11.5px; font-weight: 600; line-height: 18px; text-align: center; font-variant-numeric: tabular-nums; }
.tab.active .count { background: var(--accent); color: var(--accent-ink); }
.count.info { background: var(--info-soft); color: var(--info); }
.count.warn { background: var(--warn-soft); color: var(--warn); }
.count.bad { background: var(--bad-soft); color: var(--bad); }
.fbar { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; }
.fsearch { display: flex; align-items: center; gap: 6px; flex: 1 1 280px; max-width: 520px; background: var(--panel); border: 1px solid var(--line-2); border-radius: 8px; padding: 0 10px; }
.fsearch .icon { color: var(--muted); }
.fsearch input[type=search] { border: none; background: transparent; padding: 7px 0; flex: 1; min-width: 0; outline: none; }
.fsearch:focus-within { outline: 2px solid var(--accent); outline-offset: 1px; }
.fsearch input[type=search]:focus { outline: none; }
.adv-toggle.open { background: var(--panel-3); }
.adv-toggle .count { background: var(--accent); color: var(--accent-ink); }
.adv { display: grid; grid-template-columns: repeat(auto-fill, minmax(210px, 1fr)); gap: 12px; padding: 12px; background: var(--panel-2); border: 1px solid var(--line); border-radius: 10px; }
.adv[hidden] { display: none; }
.ffield { display: flex; flex-direction: column; gap: 5px; font-size: 11.5px; color: var(--muted); font-weight: 600; text-transform: uppercase; letter-spacing: .03em; }
.ffield select, .ffield input[type=search] { width: 100%; min-width: 0; font-size: 13.5px; text-transform: none; letter-spacing: 0; font-weight: 400; color: var(--ink); }
.ffield .chip-check { text-transform: none; letter-spacing: 0; font-weight: 500; color: var(--ink); font-size: 13px; align-self: flex-start; }
.fpills { display: flex; flex-wrap: wrap; gap: 6px; align-items: center; }
.fpill { display: inline-flex; align-items: center; gap: 2px; padding: 2px 2px 2px 10px; border-radius: 999px; background: var(--accent-soft); color: var(--accent); font-size: 12.5px; font-weight: 600; border: 1px solid color-mix(in srgb, var(--accent) 20%, transparent); }
.fpill .k { font-weight: 500; opacity: .8; }
.fpill button { border: none; background: transparent; color: inherit; cursor: pointer; width: 20px; height: 20px; border-radius: 50%; font-size: 14px; line-height: 1; margin-left: 2px; }
.fpill button:hover { background: color-mix(in srgb, var(--accent) 16%, transparent); }
.empty { display: flex; flex-direction: column; align-items: center; gap: 8px; }
.row-more { color: var(--muted); font-size: 18px; margin-left: 8px; vertical-align: middle; }
tbody tr.click:hover .row-more { color: var(--accent); }

/* ── Status checks ── */
.sc-hero { display: flex; justify-content: space-between; gap: 18px; flex-wrap: wrap; align-items: flex-start; background: var(--panel); border: 1px solid var(--line); border-left: 5px solid var(--idle); border-radius: var(--radius); padding: 16px 18px; box-shadow: var(--shadow); }
.sc-hero.ok { border-left-color: var(--ok); background: linear-gradient(90deg, var(--ok-soft), var(--panel) 55%); }
.sc-hero.warn { border-left-color: var(--warn); background: linear-gradient(90deg, var(--warn-soft), var(--panel) 55%); }
.sc-hero.bad { border-left-color: var(--bad); background: linear-gradient(90deg, var(--bad-soft), var(--panel) 55%); }
.sc-hero-main { flex: 1 1 360px; min-width: 0; }
.sc-hero-title { font-size: 17px; font-weight: 700; display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
.sc-hero-title .sub { font-size: 13px; }
.sc-hero-text { color: var(--ink-2); margin-top: 4px; overflow-wrap: anywhere; }
.pulse { width: 11px; height: 11px; border-radius: 50%; background: var(--idle); flex: none; }
.pulse.ok { background: var(--ok); box-shadow: 0 0 0 4px var(--ok-soft); animation: pulse 2s ease-in-out infinite; }
.pulse.warn { background: var(--warn); box-shadow: 0 0 0 4px var(--warn-soft); }
.pulse.bad { background: var(--bad); box-shadow: 0 0 0 4px var(--bad-soft); }
@keyframes pulse { 50% { box-shadow: 0 0 0 7px var(--ok-soft); } }
@media (prefers-reduced-motion: reduce) { .pulse.ok { animation: none; } }
.sc-switches { flex: 1 1 340px; max-width: 560px; display: flex; flex-direction: column; gap: 6px; }
.sc-switch-list { display: flex; flex-wrap: wrap; gap: 6px; }
.sc-switch { display: inline-flex; align-items: center; gap: 8px; padding: 3px 3px 3px 10px; border: 1px solid var(--line-2); border-radius: 999px; background: var(--panel); font-size: 13px; }
.sc-switch .name::before { content: ""; display: inline-block; width: 7px; height: 7px; border-radius: 50%; background: var(--idle); margin-right: 7px; vertical-align: 1px; }
.sc-switch.on { border-color: color-mix(in srgb, var(--ok) 45%, transparent); }
.sc-switch.on .name::before { background: var(--ok); }
.sc-switch .btn.small { border-radius: 999px; padding: 2px 10px; }
.sc-list, .sc-side { margin-top: 16px; }
.feed { list-style: none; margin: 0; padding: 0; }
.feed li { display: flex; gap: 12px; padding: 9px 16px; border-bottom: 1px solid var(--line); cursor: pointer; }
.feed li:last-child { border-bottom: none; }
.feed li:hover { background: var(--panel-2); }
.feed-time { color: var(--muted); font-size: 12px; font-variant-numeric: tabular-nums; padding-top: 2px; flex: none; width: 60px; }
.feed-body { min-width: 0; flex: 1; overflow-wrap: anywhere; }
@media (max-width: 760px) { .fsearch { flex-basis: 100%; max-width: none; } .sc-switches { max-width: none; } }

/* Drawers: room between the summary box and the details under it. */
.drawer-body .verdict { margin-bottom: 16px; }
.drawer-body .verdict + .kv { margin-top: 0; }

/* Phones: list rows become stacked cards, each value under its column name. */
@media (max-width: 760px) {
  table.stack thead { display: none; }
  table.stack, table.stack tbody, table.stack td { display: block; width: 100%; }
  table.stack tr { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 6px 14px; padding: 12px 14px; border-bottom: 1px solid var(--line); }
  table.stack td:first-child, table.stack td[data-label=""], table.stack td:not([data-label]) { grid-column: 1 / -1; }
  table.stack tbody tr:last-child { border-bottom: none; }
  table.stack td { border: none; padding: 3px 0; }
  table.stack td[data-label]::before { content: attr(data-label); display: block; font-size: 10.5px; color: var(--muted); text-transform: uppercase; letter-spacing: .04em; font-weight: 600; margin-bottom: 1px; }
  table.stack td:empty, table.stack td[data-label=""]::before { display: none; }
  table.stack td.num { text-align: left; }
  table.stack .trunc, table.stack .says-cell, table.stack .trunc.path { max-width: none; white-space: normal; }
  table.stack tbody tr.click:hover td { background: transparent; }
  table.stack tbody tr.click:active { background: var(--panel-2); }
  /* The whole card opens the details on a phone, so the row's "›" hint is not needed there. */
  table.stack .row-more, table.stack td.more-only { display: none; }
}
