/* MatchMiner dashboard — design tokens + components */
:root {
  --bg: #f5f6f8;
  --surface: #ffffff;
  --surface-2: #f8f9fb;
  --surface-3: #eef0f4;
  --border: #e4e7ec;
  --border-strong: #d0d5dd;
  --text: #101828;
  --text-2: #344054;
  --muted: #667085;
  --faint: #98a2b3;
  --primary: #4f46e5;
  --primary-2: #4338ca;
  --primary-soft: #eef2ff;
  --primary-ink: #3730a3;
  --ok: #079455;  --ok-soft: #ecfdf3;
  --warn: #dc6803; --warn-soft: #fffaeb;
  --bad: #d92d20;  --bad-soft: #fef3f2;
  --run: #1570ef;  --run-soft: #eff8ff;
  --idle: #667085; --idle-soft: #f2f4f7;
  --shadow-sm: 0 1px 2px rgba(16, 24, 40, .05);
  --shadow: 0 1px 3px rgba(16, 24, 40, .08), 0 1px 2px rgba(16, 24, 40, .04);
  --shadow-lg: 0 20px 40px -12px rgba(16, 24, 40, .25);
  --radius: 12px;
  --radius-sm: 8px;
  --sidebar: 248px;
  --mono: 'JetBrains Mono', ui-monospace, SFMono-Regular, Menlo, monospace;
  color-scheme: light;
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --bg: #0b0e14; --surface: #121620; --surface-2: #161b26; --surface-3: #1d2330;
    --border: #232a38; --border-strong: #2f3848;
    --text: #f2f4f7; --text-2: #d0d5dd; --muted: #98a2b3; --faint: #667085;
    --primary: #818cf8; --primary-2: #a5b4fc; --primary-soft: rgba(129, 140, 248, .14); --primary-ink: #c7d2fe;
    --ok: #47cd89; --ok-soft: rgba(71, 205, 137, .12);
    --warn: #fdb022; --warn-soft: rgba(253, 176, 34, .12);
    --bad: #f97066; --bad-soft: rgba(249, 112, 102, .12);
    --run: #53b1fd; --run-soft: rgba(83, 177, 253, .12);
    --idle: #98a2b3; --idle-soft: rgba(152, 162, 179, .12);
    --shadow-sm: none; --shadow: 0 0 0 1px rgba(255,255,255,.02); --shadow-lg: 0 20px 40px -12px rgba(0,0,0,.6);
    color-scheme: dark;
  }
}
:root[data-theme="dark"] {
  --bg: #0b0e14; --surface: #121620; --surface-2: #161b26; --surface-3: #1d2330;
  --border: #232a38; --border-strong: #2f3848;
  --text: #f2f4f7; --text-2: #d0d5dd; --muted: #98a2b3; --faint: #667085;
  --primary: #818cf8; --primary-2: #a5b4fc; --primary-soft: rgba(129, 140, 248, .14); --primary-ink: #c7d2fe;
  --ok: #47cd89; --ok-soft: rgba(71, 205, 137, .12);
  --warn: #fdb022; --warn-soft: rgba(253, 176, 34, .12);
  --bad: #f97066; --bad-soft: rgba(249, 112, 102, .12);
  --run: #53b1fd; --run-soft: rgba(83, 177, 253, .12);
  --idle: #98a2b3; --idle-soft: rgba(152, 162, 179, .12);
  --shadow-sm: none; --shadow: 0 0 0 1px rgba(255,255,255,.02); --shadow-lg: 0 20px 40px -12px rgba(0,0,0,.6);
  color-scheme: dark;
}

* { box-sizing: border-box; }
html, body { margin: 0; }
body {
  background: var(--bg); color: var(--text);
  font: 14px/1.5 'Inter', system-ui, -apple-system, 'Segoe UI', sans-serif;
  -webkit-font-smoothing: antialiased;
}
a { color: inherit; text-decoration: none; }
code, .mono { font-family: var(--mono); font-size: .92em; }
h1, h2, h3 { margin: 0; letter-spacing: -.015em; }
h1 { font-size: 22px; font-weight: 700; }
h2 { font-size: 15px; font-weight: 600; }
h3 { font-size: 13px; font-weight: 600; }
p { margin: 0; }
.muted { color: var(--muted); }
.faint { color: var(--faint); }
.small { font-size: 12px; }
.nowrap { white-space: nowrap; }
.num { font-variant-numeric: tabular-nums; }
.hidden { display: none !important; }

/* ── Layout ── */
.shell { display: grid; grid-template-columns: var(--sidebar) 1fr; min-height: 100vh; }
.sidebar {
  position: sticky; top: 0; height: 100vh; display: flex; flex-direction: column;
  background: var(--surface); border-right: 1px solid var(--border); padding: 18px 14px;
}
.brand { display: flex; align-items: center; gap: 10px; padding: 4px 8px 18px; font-weight: 700; font-size: 15px; }
.brand-mark {
  width: 30px; height: 30px; border-radius: 9px; display: grid; place-items: center; color: #fff;
  background: linear-gradient(135deg, #6366f1, #4338ca); box-shadow: 0 4px 12px rgba(79, 70, 229, .35);
}
.nav { display: flex; flex-direction: column; gap: 2px; }
.nav-label { font-size: 11px; font-weight: 600; text-transform: uppercase; letter-spacing: .06em; color: var(--faint); padding: 14px 10px 6px; }
.nav a {
  display: flex; align-items: center; gap: 10px; padding: 8px 10px; border-radius: var(--radius-sm);
  color: var(--text-2); font-weight: 500;
}
.nav a i { font-size: 16px; color: var(--muted); }
.nav a:hover { background: var(--surface-3); }
.nav a.active { background: var(--primary-soft); color: var(--primary-ink); }
.nav a.active i { color: var(--primary); }
.nav .count { margin-left: auto; font-size: 11px; font-weight: 600; padding: 1px 7px; border-radius: 99px; background: var(--run-soft); color: var(--run); }
.sidebar-foot { margin-top: auto; display: flex; flex-direction: column; gap: 10px; padding-top: 14px; border-top: 1px solid var(--border); }
.user { display: flex; align-items: center; gap: 10px; padding: 4px 6px; }
.avatar { width: 30px; height: 30px; border-radius: 50%; display: grid; place-items: center; background: var(--surface-3); font-weight: 600; font-size: 12px; color: var(--text-2); }

.main { min-width: 0; }
.topbar {
  position: sticky; top: 0; z-index: 20; display: flex; align-items: center; gap: 12px;
  padding: 12px 28px; background: color-mix(in srgb, var(--bg) 85%, transparent);
  backdrop-filter: blur(8px); border-bottom: 1px solid var(--border);
}
.crumbs { display: flex; align-items: center; gap: 6px; color: var(--muted); font-size: 13px; min-width: 0; }
.crumbs a:hover { color: var(--text); }
.crumbs .sep { color: var(--faint); }
.crumbs .current { color: var(--text); font-weight: 500; }
.topbar .spacer { flex: 1; }
.menu-toggle { display: none; }
.content { padding: 24px 28px 48px; max-width: 1400px; }
.page-head { display: flex; align-items: flex-start; justify-content: space-between; gap: 16px; margin-bottom: 20px; flex-wrap: wrap; }
.page-head .sub { color: var(--muted); margin-top: 4px; }
.actions { display: flex; gap: 8px; flex-wrap: wrap; align-items: center; }
.stack { display: flex; flex-direction: column; gap: 16px; }
.row { display: flex; gap: 12px; align-items: center; }
.grid { display: grid; gap: 16px; }
.grid-1 { grid-template-columns: minmax(0, 1fr); }
.grid-2 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.grid-3 { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.grid-4 { grid-template-columns: repeat(4, minmax(0, 1fr)); }
.grid-cards { grid-template-columns: repeat(auto-fill, minmax(300px, 1fr)); }
.split { display: grid; grid-template-columns: minmax(0, 2fr) minmax(0, 1fr); gap: 16px; align-items: start; }

/* ── Cards ── */
.card { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); box-shadow: var(--shadow-sm); }
.card-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 14px 18px; border-bottom: 1px solid var(--border); }
.card-head .hint { color: var(--muted); font-size: 12px; }
.card-body { padding: 18px; }
.card-foot { padding: 12px 18px; border-top: 1px solid var(--border); background: var(--surface-2); border-radius: 0 0 var(--radius) var(--radius); }
a.card:hover { border-color: var(--border-strong); box-shadow: var(--shadow); }

.kpi { padding: 16px 18px; }
.kpi .label { color: var(--muted); font-size: 12px; font-weight: 500; display: flex; align-items: center; gap: 6px; }
.kpi .value { font-size: 26px; font-weight: 700; letter-spacing: -.02em; margin-top: 4px; font-variant-numeric: tabular-nums; }
.kpi .meta { font-size: 12px; color: var(--muted); margin-top: 2px; }
.kpi .meta .bad { color: var(--bad); }

/* ── Buttons ── */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 6px; height: 34px; padding: 0 12px;
  border-radius: var(--radius-sm); border: 1px solid var(--border-strong); background: var(--surface);
  color: var(--text-2); font: 500 13px/1 inherit; cursor: pointer; white-space: nowrap; box-shadow: var(--shadow-sm);
  transition: background .12s, border-color .12s, color .12s;
}
.btn:hover { background: var(--surface-2); color: var(--text); }
.btn i { font-size: 15px; }
.btn-primary { background: var(--primary); border-color: var(--primary); color: #fff; }
.btn-primary:hover { background: var(--primary-2); border-color: var(--primary-2); color: #fff; }
.btn-ghost { border-color: transparent; background: transparent; box-shadow: none; }
.btn-ghost:hover { background: var(--surface-3); }
.btn-danger { color: var(--bad); }
.btn-danger:hover { background: var(--bad-soft); border-color: var(--bad); color: var(--bad); }
.btn-sm { height: 28px; padding: 0 9px; font-size: 12px; }
.btn-icon { width: 30px; padding: 0; height: 30px; }
.btn[disabled], .btn.htmx-request { opacity: .6; pointer-events: none; }
form.inline { display: inline; margin: 0; }

/* ── Pills & chips ── */
.pill {
  display: inline-flex; align-items: center; gap: 6px; height: 22px; padding: 0 8px; border-radius: 99px;
  font-size: 12px; font-weight: 500; white-space: nowrap;
}
.pill i { width: 6px; height: 6px; border-radius: 50%; background: currentColor; }
.pill-ok { background: var(--ok-soft); color: var(--ok); }
.pill-warn { background: var(--warn-soft); color: var(--warn); }
.pill-bad { background: var(--bad-soft); color: var(--bad); }
.pill-run { background: var(--run-soft); color: var(--run); }
.pill-run i { animation: pulse 1.4s ease-in-out infinite; }
.pill-idle { background: var(--idle-soft); color: var(--idle); }
.pill-muted { background: transparent; color: var(--faint); border: 1px dashed var(--border-strong); }
@keyframes pulse { 0%, 100% { opacity: 1; } 50% { opacity: .25; } }
.chip { display: inline-flex; align-items: center; gap: 5px; height: 22px; padding: 0 8px; border-radius: 6px; background: var(--surface-3); color: var(--text-2); font-size: 12px; font-weight: 500; }
.chip.ref { background: var(--primary-soft); color: var(--primary-ink); }
.dots { display: inline-flex; gap: 3px; }
.dot { width: 8px; height: 8px; border-radius: 2px; background: var(--surface-3); border: 1px solid var(--border-strong); }
.dot.ok { background: var(--ok); border-color: var(--ok); }
.dot.bad { background: var(--bad); border-color: var(--bad); }
.dot.idle { background: var(--surface-3); }
.dot.muted { background: transparent; border-style: dashed; }

/* ── Progress ── */
.progress { height: 6px; border-radius: 99px; background: var(--surface-3); overflow: hidden; }
.progress > span { display: block; height: 100%; background: var(--primary); border-radius: inherit; transition: width .3s; }
.progress.ok > span { background: var(--ok); }
.progress-row { display: flex; align-items: center; gap: 10px; }
.progress-row .progress { flex: 1; }
.progress-row .num { font-size: 12px; color: var(--muted); min-width: 36px; text-align: right; }

/* ── Tables ── */
.table-wrap { overflow-x: auto; }
.table-scroll-hint { display: none; padding: 8px 14px; color: var(--muted); font-size: 12px; border-bottom: 1px solid var(--border); }
.table-scroll-hint i { margin-right: 6px; }
table.table { width: 100%; border-collapse: separate; border-spacing: 0; }
.table th {
  text-align: left; font-size: 12px; font-weight: 500; color: var(--muted); padding: 10px 14px;
  background: var(--surface-2); border-bottom: 1px solid var(--border); white-space: nowrap; position: sticky; top: 0;
}
.table td { padding: 11px 14px; border-bottom: 1px solid var(--border); vertical-align: middle; }
.table tr:last-child td { border-bottom: 0; }
.table tbody tr:hover td { background: var(--surface-2); }
.table .title-cell { font-weight: 500; }
.table .title-cell a:hover { color: var(--primary); }
.table td.right, .table th.right { text-align: right; }
.cell-stack { display: flex; flex-direction: column; gap: 4px; }

/* ── Matrix (league seasons × sources) ── */
.matrix th.src { min-width: 240px; }
.matrix .season-cell { font-weight: 600; white-space: nowrap; }
.matrix .season-cell a:hover { color: var(--primary); }
.mcell { display: flex; flex-direction: column; gap: 8px; }
.mcell-top { display: flex; align-items: center; justify-content: space-between; gap: 8px; }
.mcell-actions { display: flex; gap: 4px; }
.mcell-empty { color: var(--faint); font-size: 12px; }
.src-head { display: flex; align-items: center; justify-content: space-between; gap: 8px; }
.src-head .name { font-weight: 600; color: var(--text); display: flex; align-items: center; gap: 6px; }

/* ── Forms ── */
.field { display: flex; flex-direction: column; gap: 6px; }
.field label { font-size: 13px; font-weight: 500; color: var(--text-2); }
.field .help { font-size: 12px; color: var(--muted); }
.input, select.input, textarea.input {
  height: 36px; padding: 0 12px; border-radius: var(--radius-sm); border: 1px solid var(--border-strong);
  background: var(--surface); color: var(--text); font: inherit; width: 100%;
}
textarea.input { height: auto; padding: 10px 12px; font-family: var(--mono); font-size: 12px; }
.input:focus { outline: 2px solid var(--primary-soft); border-color: var(--primary); }
.check { display: flex; align-items: center; gap: 8px; font-size: 13px; color: var(--text-2); }
.search { position: relative; }
.search i { position: absolute; left: 10px; top: 50%; transform: translateY(-50%); color: var(--faint); }
.search .input { padding-left: 32px; height: 34px; width: 240px; }

/* ── Tabs / segmented ── */
.segmented { display: inline-flex; padding: 3px; background: var(--surface-3); border-radius: 9px; gap: 2px; flex-wrap: wrap; }
.segmented a { padding: 5px 11px; border-radius: 7px; font-size: 13px; font-weight: 500; color: var(--muted); }
.segmented a:hover { color: var(--text); }
.segmented a.active { background: var(--surface); color: var(--text); box-shadow: var(--shadow); }

/* ── Dropdown menu (details) ── */
.dropdown { position: relative; display: inline-block; }
.dropdown > summary { list-style: none; }
.dropdown > summary::-webkit-details-marker { display: none; }
.dropdown-menu {
  position: absolute; right: 0; top: calc(100% + 6px); z-index: 30; min-width: 220px; padding: 6px;
  background: var(--surface); border: 1px solid var(--border); border-radius: 10px; box-shadow: var(--shadow-lg);
}
.dropdown-menu button, .dropdown-menu a {
  display: flex; align-items: center; gap: 9px; width: 100%; padding: 8px 10px; border: 0; border-radius: 6px;
  background: transparent; color: var(--text-2); font: 500 13px/1.2 inherit; text-align: left; cursor: pointer;
}
.dropdown-menu button:hover, .dropdown-menu a:hover { background: var(--surface-3); color: var(--text); }
.dropdown-menu i { color: var(--muted); font-size: 15px; }
.dropdown-menu .sep { height: 1px; background: var(--border); margin: 5px 2px; }
.dropdown-menu .danger { color: var(--bad); }
.dropdown-menu .danger i { color: var(--bad); }
.dropdown-menu .hint { padding: 6px 10px 2px; font-size: 11px; color: var(--faint); text-transform: uppercase; letter-spacing: .05em; }

/* ── Callouts / empty ── */
.callout { display: flex; gap: 12px; padding: 12px 14px; border-radius: 10px; border: 1px solid var(--border); background: var(--surface-2); }
.callout i { font-size: 17px; }
.callout.info { background: var(--run-soft); border-color: transparent; color: var(--text-2); }
.callout.info i { color: var(--run); }
.callout.warn { background: var(--warn-soft); border-color: transparent; }
.callout.warn i { color: var(--warn); }
.callout.bad { background: var(--bad-soft); border-color: transparent; }
.callout.bad i { color: var(--bad); }
.empty { text-align: center; padding: 48px 20px; color: var(--muted); }
.empty i { font-size: 30px; color: var(--faint); display: block; margin-bottom: 10px; }
.empty h3 { color: var(--text); font-size: 15px; margin-bottom: 4px; }
.empty .actions { justify-content: center; margin-top: 16px; }
.steps { display: grid; grid-template-columns: repeat(4, 1fr); gap: 12px; counter-reset: step; }
.step { padding: 14px; border: 1px solid var(--border); border-radius: 10px; background: var(--surface); }
.step::before { counter-increment: step; content: counter(step); display: inline-grid; place-items: center; width: 22px; height: 22px; border-radius: 50%; background: var(--primary-soft); color: var(--primary-ink); font-size: 12px; font-weight: 600; margin-bottom: 8px; }
.step h3 { margin-bottom: 2px; }
.step p { color: var(--muted); font-size: 12px; }

/* ── League cards ── */
.league-card { display: flex; flex-direction: column; gap: 14px; padding: 18px; }
.league-card .top { display: flex; justify-content: space-between; align-items: flex-start; gap: 10px; }
.league-card .name { font-size: 16px; font-weight: 600; }
.league-card .meta { display: flex; gap: 14px; color: var(--muted); font-size: 12px; }
.league-card .chips { display: flex; gap: 6px; flex-wrap: wrap; }
.badge-icon { width: 38px; height: 38px; border-radius: 10px; display: grid; place-items: center; background: var(--primary-soft); color: var(--primary); font-size: 18px; flex-shrink: 0; }

/* ── Task list ── */
.task-row { display: flex; align-items: center; gap: 12px; padding: 12px 18px; border-bottom: 1px solid var(--border); }
.task-row:last-child { border-bottom: 0; }
.task-row .grow { flex: 1; min-width: 0; }
.task-row .title { font-weight: 500; }
.task-row .target { color: var(--muted); font-size: 12px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.err { color: var(--bad); font-size: 12px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; max-width: 460px; }
pre.code {
  margin: 0; padding: 14px; background: var(--surface-2); border: 1px solid var(--border); border-radius: 10px;
  font: 12px/1.55 var(--mono); color: var(--text-2); overflow: auto; max-height: 60vh; white-space: pre;
}
.kv { display: grid; grid-template-columns: 130px 1fr; gap: 8px 16px; font-size: 13px; }
.kv dt { color: var(--muted); }
.kv dd { margin: 0; min-width: 0; overflow-wrap: anywhere; }

/* ── Match page ── */
.scoreboard { display: grid; grid-template-columns: 1fr auto 1fr; align-items: center; gap: 24px; padding: 28px 24px; }
.team { display: flex; align-items: center; gap: 14px; }
.team.away { flex-direction: row-reverse; text-align: right; }
.team img { width: 52px; height: 52px; object-fit: contain; }
.team .tname { font-size: 18px; font-weight: 600; }
.team .tmeta { color: var(--muted); font-size: 12px; }
.score { text-align: center; }
.score .big { font-size: 40px; font-weight: 700; letter-spacing: -.02em; font-variant-numeric: tabular-nums; }
.score .ht { color: var(--muted); font-size: 12px; }
.info-strip { display: flex; gap: 22px; flex-wrap: wrap; padding: 12px 24px; border-top: 1px solid var(--border); color: var(--muted); font-size: 13px; }
.info-strip span { display: inline-flex; gap: 6px; align-items: center; }
.timeline { display: flex; flex-direction: column; }
.tl-item { display: grid; grid-template-columns: 1fr 52px 1fr; align-items: center; padding: 7px 0; border-bottom: 1px dashed var(--border); font-size: 13px; }
.tl-item:last-child { border-bottom: 0; }
.tl-item .min { text-align: center; font-weight: 600; color: var(--muted); font-variant-numeric: tabular-nums; }
.tl-item .home { text-align: right; padding-right: 8px; }
.tl-item .away { padding-left: 8px; }
.tl-item .sub { color: var(--muted); font-size: 12px; }
.icon-goal { color: var(--ok); }
.icon-yellow { color: #eab308; }
.icon-red { color: var(--bad); }
.stat { display: grid; grid-template-columns: 40px 1fr 40px; gap: 10px; align-items: center; padding: 6px 0; }
.stat .v { font-weight: 600; font-variant-numeric: tabular-nums; }
.stat .v.r { text-align: right; }
.stat .label { text-align: center; font-size: 12px; color: var(--muted); margin-bottom: 4px; }
.stat-bar { display: flex; height: 6px; border-radius: 99px; overflow: hidden; background: var(--surface-3); gap: 2px; }
.stat-bar .h { background: var(--primary); }
.stat-bar .a { background: var(--warn); }
.lineup { display: flex; flex-direction: column; }
.player { display: flex; align-items: center; gap: 10px; padding: 6px 0; border-bottom: 1px solid var(--border); font-size: 13px; }
.player:last-child { border-bottom: 0; }
.player .no { width: 24px; text-align: center; color: var(--muted); font-variant-numeric: tabular-nums; font-size: 12px; }
.player img { width: 26px; height: 26px; border-radius: 50%; object-fit: cover; background: var(--surface-3); }
.player .pos { margin-left: auto; color: var(--muted); font-size: 12px; }
.source-card .pages { display: flex; flex-direction: column; }
.page-row { display: flex; align-items: center; gap: 10px; padding: 9px 0; border-bottom: 1px solid var(--border); }
.page-row:last-child { border-bottom: 0; }
.page-row .pname { font-weight: 500; font-family: var(--mono); font-size: 12px; }
.page-row .grow { flex: 1; }

/* ── Dialog ── */
dialog.modal {
  width: min(860px, calc(100vw - 32px)); max-height: calc(100vh - 64px); padding: 0; border: 1px solid var(--border);
  border-radius: 14px; background: var(--surface); color: var(--text); box-shadow: var(--shadow-lg);
}
dialog.modal::backdrop { background: rgba(16, 24, 40, .45); backdrop-filter: blur(2px); }
dialog.modal.sm { width: min(520px, calc(100vw - 32px)); }
.modal-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 14px 18px; border-bottom: 1px solid var(--border); }
.modal-body { padding: 18px; overflow: auto; max-height: calc(100vh - 200px); }
.modal-foot { display: flex; justify-content: flex-end; gap: 8px; padding: 12px 18px; border-top: 1px solid var(--border); }

/* ── Toasts ── */
.toasts { position: fixed; right: 20px; bottom: 20px; z-index: 100; display: flex; flex-direction: column; gap: 8px; max-width: min(420px, calc(100vw - 40px)); }
.toast {
  display: flex; gap: 10px; align-items: flex-start; padding: 12px 14px; border-radius: 10px; background: var(--surface);
  border: 1px solid var(--border); box-shadow: var(--shadow-lg); font-size: 13px; animation: toast-in .18s ease-out;
}
.toast i { font-size: 16px; margin-top: 1px; }
.toast.success i { color: var(--ok); }
.toast.info i { color: var(--run); }
.toast.warning i { color: var(--warn); }
.toast.error i { color: var(--bad); }
.toast button { margin-left: auto; border: 0; background: none; color: var(--faint); cursor: pointer; padding: 0 0 0 8px; }
@keyframes toast-in { from { transform: translateY(8px); opacity: 0; } }

/* ── Login ── */
.auth { min-height: 100vh; display: grid; place-items: center; padding: 24px; background:
  radial-gradient(900px 500px at 10% -10%, var(--primary-soft), transparent 60%), var(--bg); }
.auth-card { width: min(400px, 100%); padding: 32px; }
.auth-card .brand { padding: 0 0 20px; justify-content: center; font-size: 18px; }

/* ── System Monitoring & Health Strip ── */
.health-strip {
  display: flex; justify-content: space-between; align-items: center; gap: 16px;
  padding: 12px 18px; background: var(--surface); border: 1px solid var(--border);
  border-radius: var(--radius); flex-wrap: wrap; box-shadow: var(--shadow-sm);
}
.health-main { display: flex; align-items: center; gap: 24px; flex-wrap: wrap; }
.health-indicator { display: flex; align-items: center; gap: 10px; }
.health-status-text { font-weight: 600; font-size: 14px; }
.health-status-text.ok { color: var(--ok); }
.health-status-text.warn { color: var(--warn); }
.health-status-text.bad { color: var(--bad); }

.pulse-dot {
  width: 10px; height: 10px; border-radius: 50%; display: inline-block; position: relative;
}
.pulse-dot.ok { background: var(--ok); box-shadow: 0 0 0 0 rgba(7, 148, 85, .5); animation: pulse-ok 2s infinite; }
.pulse-dot.warn { background: var(--warn); box-shadow: 0 0 0 0 rgba(220, 104, 3, .5); animation: pulse-warn 2s infinite; }
.pulse-dot.bad { background: var(--bad); box-shadow: 0 0 0 0 rgba(217, 45, 32, .5); animation: pulse-bad 2s infinite; }

@keyframes pulse-ok {
  0% { transform: scale(0.95); box-shadow: 0 0 0 0 rgba(7, 148, 85, 0.7); }
  70% { transform: scale(1); box-shadow: 0 0 0 6px rgba(7, 148, 85, 0); }
  100% { transform: scale(0.95); box-shadow: 0 0 0 0 rgba(7, 148, 85, 0); }
}
@keyframes pulse-warn {
  0% { transform: scale(0.95); box-shadow: 0 0 0 0 rgba(220, 104, 3, 0.7); }
  70% { transform: scale(1); box-shadow: 0 0 0 6px rgba(220, 104, 3, 0); }
  100% { transform: scale(0.95); box-shadow: 0 0 0 0 rgba(220, 104, 3, 0); }
}
@keyframes pulse-bad {
  0% { transform: scale(0.95); box-shadow: 0 0 0 0 rgba(217, 45, 32, 0.7); }
  70% { transform: scale(1); box-shadow: 0 0 0 6px rgba(217, 45, 32, 0); }
  100% { transform: scale(0.95); box-shadow: 0 0 0 0 rgba(217, 45, 32, 0); }
}

.health-metrics { display: flex; align-items: center; gap: 20px; flex-wrap: wrap; }
.health-metric { display: flex; align-items: center; gap: 8px; font-size: 13px; }
.health-metric .metric-icon { color: var(--muted); }
.health-metric .metric-label { color: var(--muted); }
.health-metric .metric-val { font-weight: 600; font-variant-numeric: tabular-nums; }
.meter-wrapper { display: flex; align-items: center; gap: 8px; }

.meter-bar {
  width: 90px; height: 6px; background: var(--surface-3); border-radius: 99px; overflow: hidden; position: relative;
}
.meter-bar.large { width: 100%; height: 8px; }
.meter-fill { height: 100%; border-radius: 99px; transition: width .3s ease; }
.meter-fill.ok { background: var(--ok); }
.meter-fill.warn { background: var(--warn); }
.meter-fill.bad { background: var(--bad); }

.stat-box {
  display: flex; flex-direction: column; gap: 4px; padding: 14px 16px; background: var(--surface-2);
  border: 1px solid var(--border); border-radius: var(--radius-sm);
}
.stat-box-label { font-size: 12px; color: var(--muted); font-weight: 500; }
.stat-box-val { font-size: 20px; font-weight: 700; letter-spacing: -.02em; font-variant-numeric: tabular-nums; }

.kv-list { display: flex; flex-direction: column; }
.kv-item {
  display: flex; justify-content: space-between; align-items: center; padding: 9px 0;
  border-bottom: 1px solid var(--border); font-size: 13px;
}
.kv-item:last-child { border-bottom: 0; }
.kv-key { color: var(--muted); }
.kv-val { font-weight: 500; }

.tab-link {
  display: inline-flex; align-items: center; gap: 8px; padding: 10px 18px; font-size: 14px;
  font-weight: 500; color: var(--muted); text-decoration: none; border-bottom: 2px solid transparent;
  transition: all .15s ease;
}
.tab-link:hover { color: var(--text); }
.tab-link.active { color: var(--primary); border-bottom-color: var(--primary); font-weight: 600; }

.risk-badge {
  display: inline-flex; align-items: center; padding: 2px 8px; border-radius: 99px; font-size: 11px;
  font-weight: 600; text-transform: uppercase; letter-spacing: .03em;
}
.risk-clear { background: var(--ok-soft); color: var(--ok); }
.risk-warn { background: var(--warn-soft); color: var(--warn); }
.risk-crit { background: var(--bad-soft); color: var(--bad); }

.spin { animation: spin 1.5s linear infinite; display: inline-block; }
@keyframes spin { 100% { transform: rotate(360deg); } }

/* ── Responsive ── */
@media (max-width: 1100px) {
  .grid-4 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .split { grid-template-columns: 1fr; }
  .steps { grid-template-columns: repeat(2, 1fr); }
}
@media (max-width: 860px) {
  .table-scroll-hint { display: block; }
  .matrix-scroll { max-width: 100%; scrollbar-width: auto; }
  .matrix-scroll::-webkit-scrollbar { height: 8px; }
  .matrix-scroll::-webkit-scrollbar-thumb { background: var(--border-strong); border-radius: 8px; }
  .shell { grid-template-columns: 1fr; }
  .sidebar { position: fixed; left: 0; z-index: 50; width: var(--sidebar); transform: translateX(-100%); transition: transform .2s; }
  body.nav-open .sidebar { transform: none; box-shadow: var(--shadow-lg); }
  .menu-toggle { display: inline-flex; }
  .topbar, .content { padding-left: 16px; padding-right: 16px; }
  .grid-2, .grid-3 { grid-template-columns: 1fr; }
  .scoreboard { grid-template-columns: 1fr; text-align: center; }
  .team, .team.away { flex-direction: column; text-align: center; }
  .search .input { width: 100%; }
}
@media (max-width: 520px) {
  .grid-4, .steps { grid-template-columns: 1fr; }
}

/* Visual polish and clearer interaction states */
body {
  background: radial-gradient(700px 420px at 85% -160px, var(--primary-soft), transparent 75%), var(--bg);
}
.sidebar {
  background: linear-gradient(165deg, var(--surface), var(--surface-2));
}
.brand { letter-spacing: -.02em; }
.brand-mark { border-radius: 11px; }
.nav a { transition: background .16s ease, color .16s ease, transform .16s ease; }
.nav a:hover { transform: translateX(3px); }
.topbar { box-shadow: 0 2px 14px rgba(16, 24, 40, .035); }
.content { padding-top: 30px; }
.page-head { margin-bottom: 24px; }
.page-head h1 { font-size: clamp(24px, 2vw, 30px); letter-spacing: -.035em; }
.page-head .sub { line-height: 1.6; max-width: 68ch; }
.card { transition: border-color .16s ease, box-shadow .16s ease, transform .16s ease; }
a.card:hover { transform: translateY(-3px); border-color: var(--primary); box-shadow: var(--shadow); }
.kpi { min-height: 118px; border-top: 2px solid var(--primary); }
.kpi .value { font-size: 30px; }
.btn { height: 38px; }
.btn-sm { height: 30px; }
.btn-icon { height: 32px; width: 32px; }
:where(a, button, input, select, textarea, summary, .matrix-scroll):focus-visible {
  outline: 2px solid var(--primary);
  outline-offset: 3px;
}
.league-card { position: relative; padding: 22px; gap: 18px; }
.league-card .name { font-size: 18px; }
.league-card .meta { gap: 18px; }
.league-card .meta i { color: var(--primary); }
.league-card::after { content: '↗'; position: absolute; right: 20px; bottom: 17px; color: var(--muted); font-size: 17px; }
.league-card .chips { padding-right: 24px; }
.league-search { position: relative; display: inline-flex; align-items: center; min-width: min(300px, 100%); }
.league-search i { position: absolute; left: 13px; color: var(--muted); pointer-events: none; }
.league-search input { width: 100%; height: 40px; padding: 0 14px 0 38px; border: 1px solid var(--border-strong); border-radius: var(--radius-sm); background: var(--surface); color: var(--text); font: inherit; }
.league-search input::placeholder { color: var(--faint); }
.example-link { color: var(--primary-ink); text-decoration: underline; text-underline-offset: 3px; overflow-wrap: anywhere; }
.matrix-detail-link { display: inline-flex; align-items: center; gap: 5px; color: var(--primary-ink); font-weight: 600; }
.matrix-detail-link:hover { text-decoration: underline; text-underline-offset: 3px; }
.tl-item { grid-template-columns: minmax(0, 1fr) minmax(76px, auto) minmax(0, 1fr); }
.tl-item .min { font-size: 11px; line-height: 1.3; padding: 0 5px; }
.nav-backdrop { display: none; }

/* Keep every source and its actions visible on tablet and mobile. */
@media (max-width: 1100px) {
  .shell { grid-template-columns: 1fr; }
  .sidebar { position: fixed; inset: 0 auto 0 0; z-index: 52; width: min(280px, 85vw); transform: translateX(-102%); transition: transform .2s ease; }
  body.nav-open .sidebar { transform: none; box-shadow: var(--shadow-lg); }
  .menu-toggle { display: inline-flex; }
  body.nav-open .nav-backdrop { display: block; position: fixed; inset: 0; z-index: 51; border: 0; background: rgba(5, 10, 24, .58); cursor: pointer; }
  .content { max-width: none; }
  .table-scroll-hint { display: none; }
  .matrix-scroll { overflow: visible; }
  .matrix, .matrix thead, .matrix tbody { display: block; width: 100%; }
  .matrix thead tr { display: flex; gap: 10px; padding: 12px; border-bottom: 1px solid var(--border); }
  .matrix thead th:first-child { display: none; }
  .matrix thead th.src { display: block; flex: 1; min-width: 0; border: 1px solid var(--border); border-radius: 10px; padding: 10px 12px; position: static; }
  .matrix tbody tr { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px; padding: 16px 12px; border-bottom: 1px solid var(--border); }
  .matrix tbody tr:last-child { border-bottom: 0; }
  .matrix tbody td { display: block; min-width: 0; padding: 14px; border: 1px solid var(--border); border-radius: 10px; background: var(--surface-2); }
  .matrix tbody td:first-child { grid-column: 1 / -1; padding: 0 2px 2px; border: 0; background: transparent; }
  .matrix tbody td[data-source]::before { content: attr(data-source); display: block; margin-bottom: 10px; color: var(--muted); font-size: 12px; font-weight: 700; letter-spacing: .02em; }
  .matrix tbody td[colspan] { grid-column: 1 / -1; }
  .matrix .mcell-top { align-items: flex-start; }
}
@media (max-width: 860px) {
  .topbar, .content { padding-left: 18px; padding-right: 18px; }
  .page-head { align-items: stretch; }
}
@media (max-width: 650px) {
  .matrix thead tr { flex-direction: column; }
  .matrix tbody tr { grid-template-columns: 1fr; }
  .matrix tbody td:first-child { grid-column: 1; }
  .league-search { width: 100%; }
  .topbar .crumbs { overflow: hidden; white-space: nowrap; text-overflow: ellipsis; }
  .topbar .crumbs .current { overflow: hidden; text-overflow: ellipsis; }
  .scoreboard { padding: 20px 14px; }
  .tl-item { grid-template-columns: minmax(0, 1fr) 82px minmax(0, 1fr); }
}
@media (prefers-reduced-motion: reduce) {
  .card, .nav a, .sidebar { transition: none; }
  .pill-run i, .pulse-dot { animation: none; }
}
