:root {
    color-scheme: dark;
    font: 14px/1.5 -apple-system, BlinkMacSystemFont, "SF Pro Text", "Inter", "PingFang SC", "Hiragino Sans GB", "Microsoft YaHei", sans-serif;
    --bg: #070a12;
    --surface: rgba(16, 21, 35, .86);
    --surface-2: rgba(22, 29, 47, .92);
    --inset: rgba(9, 13, 23, .72);
    --line: rgba(255, 255, 255, .08);
    --line-strong: rgba(255, 255, 255, .14);
    --ink: #f3f5f8;
    --ink-2: #b4bdd0;
    --muted: #76829b;
    --gold: #f0cf78;
    --gold-dim: #c59b45;
    --gold-bg: rgba(240, 207, 120, .12);
    --gold-line: rgba(240, 207, 120, .3);
    --good: #34d399;
    --good-bg: rgba(52, 211, 153, .12);
    --good-line: rgba(52, 211, 153, .28);
    --warn: #f5b95b;
    --warn-bg: rgba(245, 185, 91, .12);
    --bad: #f87171;
    --bad-bg: rgba(248, 113, 113, .12);
    --bad-line: rgba(248, 113, 113, .28);
    --cobalt: #60a5fa;
    --radius: 16px;
    --radius-sm: 10px;
    --max-w: 1360px;
    color: var(--ink);
    background: var(--bg);
    -webkit-font-smoothing: antialiased;
}

* { box-sizing: border-box; }
[hidden] { display: none !important; }
body {
    margin: 0; min-width: 280px; min-height: 100vh;
    background:
        radial-gradient(ellipse 68% 36% at 50% -10%, rgba(240, 207, 120, .1), transparent 72%),
        radial-gradient(ellipse 46% 32% at 88% 12%, rgba(96, 165, 250, .07), transparent 68%),
        var(--bg);
}
a { color: var(--gold); text-decoration: none; }
h1, h2, p { margin: 0; }
h1 { font-size: clamp(22px, 2.3vw, 28px); line-height: 1.2; font-weight: 700; letter-spacing: -.03em; }
h2 { font-size: 15px; line-height: 1.3; font-weight: 650; letter-spacing: -.015em; color: var(--ink); }
.muted { color: var(--muted); font-size: 12px; }
.sr-only { position: absolute; width: 1px; height: 1px; margin: -1px; overflow: hidden; clip-path: inset(50%); white-space: nowrap; }
.ic { width: 16px; height: 16px; flex: none; fill: none; stroke: currentColor; stroke-width: 1.7; stroke-linecap: round; stroke-linejoin: round; }

button, select, input {
    font: inherit;
    min-height: 36px;
    border-radius: var(--radius-sm);
    border: 1px solid var(--line-strong);
    background: var(--inset);
    color: var(--ink);
    padding: 6px 11px;
    transition: background-color .15s ease, border-color .15s ease, color .15s ease, box-shadow .15s ease, transform .15s ease;
}
button, select { cursor: pointer; }
select { padding-right: 26px; }
button:hover:not(:disabled), select:hover:not(:disabled) { border-color: rgba(255, 255, 255, .24); background: rgba(255, 255, 255, .06); }
button:disabled { cursor: default; opacity: .42; }
input:focus, select:focus { outline: none; border-color: var(--gold-dim); box-shadow: 0 0 0 3px rgba(240, 207, 120, .14); }
:focus-visible { outline: 2px solid var(--gold); outline-offset: 2px; }

.btn-gold {
    display: inline-flex; align-items: center; justify-content: center; gap: 7px;
    border: 1px solid rgba(255, 232, 165, .52);
    background: linear-gradient(180deg, #f3d689, #d5a54a);
    color: #13100a; font-weight: 700; white-space: nowrap;
    box-shadow: inset 0 1px 0 rgba(255, 250, 224, .65), 0 6px 20px -8px rgba(240, 207, 120, .48);
}
.btn-gold:hover:not(:disabled) {
    background: linear-gradient(180deg, #f8e09e, #dfb056);
    border-color: rgba(255, 240, 194, .75); color: #13100a;
}
.btn-subtle { background: rgba(255, 255, 255, .04); border-color: var(--line); color: var(--ink-2); white-space: nowrap; }
.btn-subtle:hover:not(:disabled) { background: rgba(255, 255, 255, .09); color: var(--ink); }
.btn-ghost {
    display: inline-flex; align-items: center; gap: 6px;
    background: transparent; border-color: transparent; color: var(--ink-2); white-space: nowrap;
}
.btn-ghost:hover:not(:disabled) { background: rgba(255, 255, 255, .06); border-color: var(--line); color: var(--ink); }

.brand { display: inline-flex; align-items: center; gap: 10px; color: var(--ink); flex: none; }
.brand-mark { width: 34px; height: 34px; display: block; flex: none; }
.brand-mark svg { width: 100%; height: 100%; display: block; }
.brand-copy { display: flex; flex-direction: column; line-height: 1.05; }
.brand-copy strong { font-size: 15.5px; font-weight: 720; letter-spacing: -.02em; }
.brand-copy small { font-size: 9.5px; font-weight: 650; letter-spacing: .16em; color: var(--gold); margin-top: 2px; opacity: .88; }
.eyebrow { display: inline-block; font-size: 10.5px; font-weight: 700; letter-spacing: .16em; color: var(--gold); margin-bottom: 10px; }

/* --- Login Stage (Perfectly Centered Dark Obsidian Studio) --- */
.login-screen {
    display: grid; place-items: center; min-height: 100vh; min-height: 100svh;
    padding: clamp(16px, 4vw, 48px);
}
.login-shell {
    display: grid; grid-template-columns: minmax(0, 1.06fr) minmax(0, .94fr);
    width: min(100%, 920px); overflow: hidden; border-radius: 24px;
    border: 1px solid var(--line-strong);
    background: linear-gradient(155deg, rgba(19, 25, 42, .94), rgba(11, 15, 26, .98));
    box-shadow: inset 0 1px 0 rgba(255, 255, 255, .08), 0 32px 80px -28px rgba(0, 0, 0, .75);
}
.login-showcase {
    display: flex; flex-direction: column; justify-content: space-between; gap: 28px;
    padding: clamp(28px, 4vw, 44px);
    background:
        radial-gradient(ellipse 90% 60% at 15% 100%, rgba(240, 207, 120, .14), transparent 65%),
        linear-gradient(160deg, rgba(255, 255, 255, .03), transparent 60%);
    border-right: 1px solid var(--line);
}
.showcase-body h2 { font-size: clamp(20px, 2.2vw, 25px); line-height: 1.3; font-weight: 680; letter-spacing: -.025em; }
.showcase-body p { margin-top: 10px; font-size: 13px; color: var(--ink-2); line-height: 1.6; }
.showcase-card {
    padding: 16px 18px 12px; border-radius: 16px;
    border: 1px solid rgba(240, 207, 120, .2);
    background: rgba(8, 12, 22, .68);
    box-shadow: inset 0 1px 0 rgba(255, 255, 255, .06);
}
.showcase-card-top { display: flex; align-items: center; justify-content: space-between; font-size: 12px; color: var(--ink-2); margin-bottom: 10px; }
.live-chip {
    font-style: normal; font-size: 10px; font-weight: 700; letter-spacing: .12em;
    padding: 2px 8px; border-radius: 999px; color: var(--gold);
    background: var(--gold-bg); border: 1px solid var(--gold-line);
}
.showcase-svg { width: 100%; height: auto; display: block; }

.login-panel { align-self: center; padding: clamp(28px, 4.5vw, 52px); }
.login-panel h1 { font-size: clamp(24px, 2.6vw, 30px); }
#login-help { margin-top: 8px; color: var(--muted); font-size: 13px; }
.login-panel form { display: grid; gap: 16px; margin-top: 26px; }
.field { display: grid; gap: 7px; }
.field label { font-size: 12.5px; font-weight: 600; color: var(--ink-2); }
.field input { width: 100%; min-width: 0; min-height: 46px; padding: 10px 14px; font-size: 15px; }
.password-wrap { position: relative; }
.password-wrap input { padding-right: 68px; }
#toggle-password {
    position: absolute; inset: 5px 5px 5px auto; min-height: 0; min-width: 48px;
    padding: 0 10px; border-color: transparent; background: transparent; color: var(--muted); font-size: 12px; font-weight: 600;
}
#toggle-password:hover { color: var(--ink); background: rgba(255, 255, 255, .07); }
#login-submit { min-height: 46px; margin-top: 4px; font-size: 14.5px; }
.alert-error {
    margin: 0 0 16px; padding: 10px 14px; border-radius: var(--radius-sm); font-size: 13px;
    color: var(--bad); background: var(--bad-bg); border: 1px solid var(--bad-line);
}
.login-panel .alert-error { margin: 0; }

/* --- Centered Executive Top App Bar --- */
.app-bar {
    position: sticky; top: 0; z-index: 30;
    background: rgba(7, 10, 18, .78);
    backdrop-filter: blur(18px); -webkit-backdrop-filter: blur(18px);
    border-bottom: 1px solid var(--line);
}
.app-bar-inner {
    width: min(100%, var(--max-w)); margin-inline: auto;
    padding: 11px clamp(16px, 3vw, 32px);
    display: flex; align-items: center; justify-content: space-between; gap: 16px;
}
.top-nav {
    display: flex; align-items: center; gap: 4px;
    padding: 4px; border-radius: 13px;
    background: rgba(255, 255, 255, .035); border: 1px solid var(--line);
    overflow-x: auto; scrollbar-width: none;
}
.top-nav::-webkit-scrollbar { display: none; }
.top-nav button {
    display: inline-flex; align-items: center; gap: 6px;
    min-height: 34px; padding: 5px 13px; border: 1px solid transparent; border-radius: 9px;
    background: transparent; color: var(--ink-2); font-size: 13px; font-weight: 560; white-space: nowrap;
}
.top-nav button:hover { color: var(--ink); background: rgba(255, 255, 255, .05); border-color: transparent; }
.top-nav button[aria-current] {
    color: var(--gold); font-weight: 660;
    background: linear-gradient(180deg, rgba(240, 207, 120, .16), rgba(240, 207, 120, .06));
    border-color: var(--gold-line);
    box-shadow: inset 0 1px 0 rgba(255, 240, 195, .18);
}
.top-nav button .ic { width: 15px; height: 15px; opacity: .75; }
.top-nav button[aria-current] .ic { opacity: 1; }
.app-bar-actions { display: flex; align-items: center; gap: 8px; flex: none; }

/* --- Centered Main Stage --- */
.stage {
    width: min(100%, var(--max-w)); margin-inline: auto;
    padding: 24px clamp(16px, 3vw, 32px) 56px;
}
.page-head {
    display: flex; align-items: flex-end; justify-content: space-between; gap: 14px 20px;
    margin-bottom: 20px;
}
.status-line { display: flex; align-items: center; gap: 8px; margin-top: 6px; color: var(--muted); font-size: 12px; font-variant-numeric: tabular-nums; }
#live-dot { width: 7px; height: 7px; border-radius: 50%; background: var(--muted); flex: none; }
#live-dot.live { background: var(--good); box-shadow: 0 0 0 3px rgba(52, 211, 153, .18), 0 0 10px rgba(52, 211, 153, .55); }
.page-controls { display: flex; align-items: center; gap: 10px; flex-shrink: 0; }
.mobile-period { display: none; }

.segmented {
    display: inline-flex; align-items: center; gap: 2px; padding: 3px;
    border-radius: 11px; background: rgba(255, 255, 255, .04); border: 1px solid var(--line);
}
.segmented button {
    min-height: 30px; padding: 4px 12px; border: 0; border-radius: 8px;
    background: transparent; color: var(--ink-2); font-size: 12.5px; font-weight: 560; white-space: nowrap;
}
.segmented button:hover { color: var(--ink); background: rgba(255, 255, 255, .05); }
.segmented button[aria-pressed="true"] {
    background: rgba(240, 207, 120, .16); color: var(--gold); font-weight: 680;
    box-shadow: inset 0 0 0 1px var(--gold-line);
}
.segmented-sm button { min-height: 27px; padding: 3px 10px; font-size: 12px; }
#refresh.is-loading .ic { animation: spin .75s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }

/* --- Bento Grids & Tiered Obsidian Surfaces --- */
.kpi-strip { display: grid; grid-template-columns: repeat(var(--cols, 4), minmax(0, 1fr)); gap: 14px; margin-bottom: 16px; }
.bento-hero { display: grid; grid-template-columns: minmax(0, 1.55fr) minmax(0, 1fr); gap: 16px; margin-bottom: 16px; }
.bento-3 { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 16px; margin-bottom: 16px; }
.bento-2 { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 16px; margin-bottom: 16px; }
.bento-1 { display: grid; grid-template-columns: minmax(0, 1fr); gap: 16px; margin-bottom: 16px; }

.kpi, .surface {
    min-width: 0; border-radius: var(--radius);
    border: 1px solid var(--line);
    background: var(--surface);
    box-shadow: inset 0 1px 0 rgba(255, 255, 255, .045), 0 14px 36px -24px rgba(0, 0, 0, .65);
}
.surface { padding: 20px 22px; }
.surface-hero {
    background: linear-gradient(155deg, rgba(24, 31, 50, .92), rgba(13, 18, 30, .95));
    border-color: rgba(240, 207, 120, .18);
}
.surface-head { display: flex; align-items: flex-start; justify-content: space-between; gap: 12px; margin-bottom: 16px; flex-wrap: wrap; }
.surface-head p { margin-top: 3px; }
.surface-right { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.tag {
    font-size: 11px; font-weight: 600; color: var(--ink-2); font-variant-numeric: tabular-nums;
    padding: 3px 9px; border-radius: 999px; background: rgba(255, 255, 255, .045); border: 1px solid var(--line); white-space: nowrap;
}

.kpi {
    position: relative; padding: 17px 19px 16px; display: flex; flex-direction: column; gap: 5px;
    transition: border-color .16s ease, transform .16s ease, background-color .16s ease;
}
.kpi-top { display: flex; align-items: center; justify-content: space-between; gap: 8px; }
.kpi-top > span { font-size: 12.5px; font-weight: 580; color: var(--muted); }
.kpi-arrow { font-style: normal; font-size: 13px; color: var(--muted); transition: transform .16s ease, color .16s ease; }
.kpi-tag {
    font-style: normal; font-size: 11px; font-weight: 650; padding: 1px 8px; border-radius: 999px;
    background: rgba(255, 255, 255, .06); color: var(--ink-2);
}
.kpi strong {
    display: block; font-size: clamp(22px, 2.2vw, 29px); line-height: 1.16; font-weight: 720;
    letter-spacing: -.03em; font-variant-numeric: tabular-nums; color: var(--ink); overflow-wrap: anywhere;
}
.kpi strong.val-compact { font-size: clamp(18px, 1.9vw, 24px); }
.kpi small { font-size: 11.5px; color: var(--muted); overflow-wrap: anywhere; }
.kpi-link-hit { color: inherit; }
.kpi-link-hit::after { content: ""; position: absolute; inset: 0; border-radius: inherit; }
.kpi.is-link:hover { border-color: var(--gold-line); background: var(--surface-2); transform: translateY(-2px); }
.kpi.is-link:hover .kpi-arrow { color: var(--gold); transform: translate(2px, -2px); }
.kpi.tone-gold { border-top: 2px solid var(--gold); }
.kpi.tone-gold strong { color: var(--gold); }
.kpi.tone-good { border-top: 2px solid var(--good); }
.kpi.tone-good strong { color: var(--good); }
.kpi.tone-good .kpi-tag { background: var(--good-bg); color: var(--good); }
.kpi.tone-waiting { border-top: 2px solid var(--warn); }
.kpi.tone-waiting strong { color: var(--warn); }
.kpi.tone-waiting .kpi-tag { background: var(--warn-bg); color: var(--warn); }
.kpi.tone-bad { border-top: 2px solid var(--bad); }
.kpi.tone-bad strong { color: var(--bad); }

/* --- Interactive SVG Area + Bar Chart --- */
.viz-chart { display: grid; gap: 10px; }
.viz-head { display: flex; align-items: center; justify-content: space-between; gap: 10px; min-height: 24px; }
.viz-readout {
    font-size: 12.5px; font-weight: 600; color: var(--ink-2); font-variant-numeric: tabular-nums;
    padding: 3px 10px; margin-left: -10px; border-radius: 7px; transition: background-color .14s ease, color .14s ease;
}
.viz-readout.is-live { background: var(--gold-bg); color: var(--gold); }
.viz-cap { font-size: 11px; color: var(--muted); font-variant-numeric: tabular-nums; white-space: nowrap; }
.viz-stage { width: 100%; height: 172px; }
.viz-stage svg { width: 100%; height: 100%; display: block; overflow: visible; }
.viz-grid line { stroke: rgba(255, 255, 255, .06); stroke-width: 1; vector-effect: non-scaling-stroke; stroke-dasharray: 3 4; }
.viz-grid line:last-child { stroke: rgba(255, 255, 255, .1); stroke-dasharray: none; }
.viz-line { fill: none; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; vector-effect: non-scaling-stroke; pointer-events: none; }
.viz-area { pointer-events: none; }
.viz-hit { fill: transparent; cursor: crosshair; }
.viz-guide { stroke: transparent; stroke-width: 1; vector-effect: non-scaling-stroke; pointer-events: none; }
.viz-bar { pointer-events: none; opacity: .55; transition: opacity .12s ease; }
.viz-dot { pointer-events: none; stroke: #0d121f; stroke-width: 1.5; vector-effect: non-scaling-stroke; transition: r .12s ease; }
.viz-col:focus-visible { outline: none; }
.viz-col:hover .viz-guide, .viz-col:focus-visible .viz-guide, .viz-col.is-active .viz-guide { stroke: rgba(240, 207, 120, .45); }
.viz-col:hover .viz-bar, .viz-col.is-active .viz-bar { opacity: .95; }
.viz-col:hover .viz-dot, .viz-col.is-active .viz-dot { r: 5; }

.viz-gold .va-top { stop-color: #f0cf78; stop-opacity: .32; }
.viz-gold .va-bottom { stop-color: #f0cf78; stop-opacity: 0; }
.viz-gold .vb-top { stop-color: #f0cf78; stop-opacity: .55; }
.viz-gold .vb-bottom { stop-color: #b7852d; stop-opacity: .1; }
.viz-gold .viz-line { stroke: #f0cf78; }
.viz-gold .viz-dot { fill: #f7e1a0; }

.viz-cobalt .va-top { stop-color: #60a5fa; stop-opacity: .3; }
.viz-cobalt .va-bottom { stop-color: #60a5fa; stop-opacity: 0; }
.viz-cobalt .vb-top { stop-color: #60a5fa; stop-opacity: .5; }
.viz-cobalt .vb-bottom { stop-color: #2563eb; stop-opacity: .08; }
.viz-cobalt .viz-line { stroke: #60a5fa; }
.viz-cobalt .viz-dot { fill: #93c5fd; }

.viz-emerald .va-top { stop-color: #34d399; stop-opacity: .32; }
.viz-emerald .va-bottom { stop-color: #34d399; stop-opacity: 0; }
.viz-emerald .vb-top { stop-color: #34d399; stop-opacity: .52; }
.viz-emerald .vb-bottom { stop-color: #059669; stop-opacity: .08; }
.viz-emerald .viz-line { stroke: #34d399; }
.viz-emerald .viz-dot { fill: #6ee7b7; }

.viz-crimson .va-top { stop-color: #f87171; stop-opacity: .32; }
.viz-crimson .va-bottom { stop-color: #f87171; stop-opacity: 0; }
.viz-crimson .vb-top { stop-color: #f87171; stop-opacity: .55; }
.viz-crimson .vb-bottom { stop-color: #b91c1c; stop-opacity: .1; }
.viz-crimson .viz-line { stroke: #f87171; }
.viz-crimson .viz-dot { fill: #fca5a5; }

.viz-axis { display: flex; justify-content: space-between; font-size: 11px; color: var(--muted); font-variant-numeric: tabular-nums; }

/* --- Donut Ring Chart --- */
.donut-layout { display: grid; grid-template-columns: 124px minmax(0, 1fr); align-items: center; gap: 18px; }
.donut-ring { position: relative; width: 124px; height: 124px; margin-inline: auto; }
.donut-ring svg { width: 100%; height: 100%; transform: rotate(-90deg); display: block; }
.donut-track { fill: none; stroke: rgba(255, 255, 255, .07); stroke-width: 11; }
.donut-arc { fill: none; stroke-width: 11; stroke-linecap: round; }
.arc-good { stroke: var(--good); }
.arc-waiting { stroke: var(--gold); }
.arc-cobalt { stroke: var(--cobalt); }
.arc-bad { stroke: var(--bad); }
.donut-center {
    position: absolute; inset: 0; display: flex; flex-direction: column; align-items: center; justify-content: center;
    text-align: center; padding: 14px;
}
.donut-center strong { font-size: 13.5px; font-weight: 720; font-variant-numeric: tabular-nums; line-height: 1.15; }
.donut-center span { font-size: 10.5px; color: var(--muted); margin-top: 2px; }
.donut-legend { list-style: none; margin: 0; padding: 0; display: grid; gap: 10px; }
.donut-legend li { display: flex; align-items: center; justify-content: space-between; gap: 8px; font-size: 12.5px; }
.legend-left { display: inline-flex; align-items: center; gap: 8px; color: var(--ink-2); }
.legend-right { display: inline-flex; align-items: baseline; gap: 7px; font-variant-numeric: tabular-nums; }
.legend-right b { font-weight: 660; color: var(--ink); }
.legend-right em { font-style: normal; font-size: 11px; color: var(--muted); min-width: 30px; text-align: right; }

/* --- Proportional Meters --- */
.meter-list { list-style: none; margin: 0; padding: 0; display: grid; gap: 12px; }
.meter-row { display: flex; align-items: baseline; justify-content: space-between; gap: 10px; margin-bottom: 5px; }
.meter-val { display: inline-flex; align-items: baseline; gap: 7px; font-variant-numeric: tabular-nums; flex: none; }
.meter-val b { font-size: 13px; font-weight: 680; color: var(--ink); }
.meter-val em { font-style: normal; font-size: 11px; color: var(--muted); }
.meter-track { height: 5px; border-radius: 999px; background: rgba(255, 255, 255, .07); overflow: hidden; }
.meter-track i { display: block; height: 100%; width: var(--w, 0%); border-radius: inherit; }
.fill-gold { background: linear-gradient(90deg, #b8842a, #f0cf78); }
.fill-cobalt { background: linear-gradient(90deg, #2563eb, #60a5fa); }
.fill-emerald { background: linear-gradient(90deg, #059669, #34d399); }
.fill-crimson { background: linear-gradient(90deg, #b91c1c, #f87171); }
.meter-name { min-width: 0; font-size: 13px; color: var(--ink); overflow-wrap: anywhere; }
.meter-name small { color: var(--muted); font-size: 11.5px; margin-left: 5px; }

/* --- Ops Pulse Grid & Positive Health States --- */
.pulse-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px; }
.pulse-tile {
    display: flex; flex-direction: column; gap: 3px; padding: 12px 13px; border-radius: 12px;
    background: var(--inset); border: 1px solid var(--line); color: var(--ink);
    transition: border-color .15s ease, background-color .15s ease;
}
.pulse-tile:hover { border-color: var(--gold-line); background: rgba(240, 207, 120, .06); }
.pulse-tile span { font-size: 11.5px; color: var(--muted); }
.pulse-tile strong { font-size: 20px; font-weight: 720; font-variant-numeric: tabular-nums; line-height: 1.2; }
.pulse-tile small { font-size: 11px; color: var(--muted); }
.txt-good { color: var(--good); }
.txt-warn { color: var(--warn); }
.txt-bad { color: var(--bad); }

.health-state {
    display: flex; align-items: center; gap: 13px; padding: 16px 18px; border-radius: 12px;
    border: 1px solid var(--line); background: var(--inset);
}
.health-icon {
    width: 34px; height: 34px; border-radius: 10px; display: grid; place-items: center; flex: none;
    background: rgba(255, 255, 255, .05); color: var(--ink-2);
}
.health-icon svg { width: 18px; height: 18px; fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; }
.health-good { border-color: var(--good-line); background: rgba(52, 211, 153, .06); }
.health-good .health-icon { background: var(--good-bg); color: var(--good); }
.health-state strong { display: block; font-size: 13.5px; font-weight: 650; color: var(--ink); }
.health-state p { margin-top: 2px; font-size: 12px; color: var(--muted); }
.empty { color: var(--muted); padding: 24px 0; text-align: center; font-size: 13px; }

/* --- Section Bar & Payment Attribution --- */
.section-block { margin-bottom: 16px; }
.section-bar { display: flex; align-items: flex-end; justify-content: space-between; gap: 12px 18px; margin-bottom: 12px; flex-wrap: wrap; }
.section-bar h2 { font-size: 16px; }
.section-bar p { margin-top: 3px; }
.pill-filters { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }

.dot { width: 7px; height: 7px; border-radius: 50%; display: inline-block; flex: none; background: var(--muted); }
.dot-good { background: var(--good); }
.dot-waiting { background: var(--gold); }
.dot-bad { background: var(--bad); }
.dot-cobalt { background: var(--cobalt); }

/* --- Streamlined Record Explorer --- */
.records { margin-top: 20px; }
.records-top {
    display: flex; align-items: center; justify-content: space-between; gap: 12px 16px; flex-wrap: wrap;
    padding-bottom: 14px; margin-bottom: 14px; border-bottom: 1px solid var(--line);
}
.records-heading { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
.pill-count {
    font-size: 11.5px; font-weight: 650; font-variant-numeric: tabular-nums;
    padding: 2px 9px; border-radius: 999px; color: var(--gold);
    background: var(--gold-bg); border: 1px solid var(--gold-line);
}
.pill-tabs, .shortcut-pills, .active-chips { display: flex; align-items: center; gap: 6px; flex-wrap: wrap; }
.pill-tabs button, .shortcut-pills button {
    min-height: 31px; padding: 4px 12px; font-size: 12.5px; font-weight: 560;
    border-color: var(--line); background: rgba(255, 255, 255, .03); color: var(--ink-2);
}
.shortcut-pills button { border-radius: 999px; min-height: 30px; padding: 3px 11px; }
.pill-tabs [aria-pressed="true"], .shortcut-pills [aria-pressed="true"] {
    color: var(--gold); background: var(--gold-bg); border-color: var(--gold-line); font-weight: 660;
}

.records-bar {
    display: flex; align-items: center; gap: 10px; flex-wrap: wrap;
    padding: 10px 12px; margin-bottom: 12px; border-radius: 12px;
    background: var(--inset); border: 1px solid var(--line);
}
.search-box {
    position: relative; display: flex; align-items: center; gap: 6px; flex: 1 1 250px; min-width: 0;
}
.search-ic { position: absolute; left: 11px; color: var(--muted); pointer-events: none; }
.search-box input { width: 100%; min-width: 0; padding-left: 33px; background: rgba(255, 255, 255, .03); }
.inline-controls { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.control-pair { display: flex; align-items: center; gap: 6px; }
.control-pair select { max-width: 155px; }
.filter-note { margin: -2px 0 10px; font-size: 12px; color: var(--muted); }
.active-chips { margin-bottom: 12px; }
.active-chips button {
    min-height: 29px; padding: 3px 11px; font-size: 12px; border-radius: 999px;
    color: var(--gold); background: var(--gold-bg); border-color: var(--gold-line);
}
.active-chips button span { margin-left: 6px; font-size: 14px; }

/* --- Data Tables --- */
.table-scroll, .summary-scroll {
    max-width: 100%; overflow: auto; border-radius: 12px;
    border: 1px solid var(--line); background: var(--inset);
}
.table-scroll { max-height: 62vh; }
.summary-scroll { max-height: 320px; }
.data-table { width: 100%; border-spacing: 0; text-align: left; font-size: 13px; font-variant-numeric: tabular-nums; }
.data-table :is(th, td) { padding: 10px 13px; border-bottom: 1px solid rgba(255, 255, 255, .055); }
.data-table thead th {
    position: sticky; top: 0; z-index: 1; background: #101626; border-bottom-color: var(--line);
    color: var(--muted); font-size: 12px; font-weight: 650; white-space: nowrap;
}
.data-table thead th:has(button) { padding: 0; }
.data-table thead button {
    display: flex; align-items: center; justify-content: space-between; gap: 6px; width: 100%; min-height: 39px;
    border: 0; border-radius: 0; padding: 6px 13px; background: transparent; color: inherit; font-weight: inherit;
}
.data-table thead button:hover { background: rgba(255, 255, 255, .05); color: var(--ink); }
.data-table th[aria-sort]:not([aria-sort="none"]) { background: rgba(240, 207, 120, .1); color: var(--gold); }
.data-table tbody td { white-space: nowrap; color: var(--ink-2); }
.data-table tbody td.wrap { white-space: normal; min-width: 120px; max-width: 240px; overflow-wrap: anywhere; color: var(--ink); }
.data-table tbody tr:hover { background: rgba(240, 207, 120, .045); }
.data-table tbody tr:last-child :is(th, td) { border-bottom: 0; }
.data-table td.number { text-align: right; color: var(--ink); font-weight: 560; }
.compact-table thead th:nth-child(n+2) button { justify-content: flex-end; }
.dim { font-style: normal; font-size: 11px; color: var(--muted); margin-left: 5px; font-weight: 400; }
.drill-btn {
    display: inline-flex; align-items: center; gap: 8px; min-height: 32px; padding: 4px 8px; margin: -4px -8px;
    border-color: transparent; background: transparent; color: var(--ink); font-weight: 600;
}
.drill-btn:hover { background: var(--gold-bg); color: var(--gold); border-color: transparent; }

.record-missing { color: #525d74; }
.record-times time { display: block; }
.record-times time + time { margin-top: 2px; color: var(--muted); }
.record-badge {
    display: inline-flex; align-items: center; gap: 5px; white-space: nowrap;
    padding: 2px 9px; border-radius: 999px; font-size: 12px; font-weight: 620;
    background: rgba(255, 255, 255, .07); color: var(--ink-2);
}
.record-badge::before { content: ""; width: 6px; height: 6px; border-radius: 50%; background: currentColor; flex: none; }
.record-badge-good { background: var(--good-bg); color: var(--good); }
.record-badge-bad { background: var(--bad-bg); color: var(--bad); }
.record-badge-waiting { background: var(--warn-bg); color: var(--warn); }

.id-chip {
    display: inline-flex; align-items: center; max-width: 175px; min-height: 25px;
    padding: 1px 7px; border-radius: 6px; border: 1px solid var(--line);
    background: rgba(255, 255, 255, .035); color: var(--ink-2); text-align: left;
}
.id-chip code { font-family: ui-monospace, "SF Mono", Menlo, Consolas, monospace; font-size: 12px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; display: block; }
.id-chip:hover { border-color: var(--gold-line); background: var(--gold-bg); color: var(--gold); }

.copy-toast {
    position: fixed; left: 50%; bottom: 24px; transform: translateX(-50%); z-index: 60;
    padding: 9px 16px; border-radius: 999px; font-size: 12.5px; font-weight: 600;
    background: #131a2c; color: var(--gold); border: 1px solid var(--gold-line);
    box-shadow: 0 16px 40px rgba(0, 0, 0, .55);
}

/* --- Pagination & Mobile Cards --- */
.pagination, .page-nav, .page-size-wrap { display: flex; align-items: center; gap: 8px; }
.pagination { justify-content: space-between; flex-wrap: wrap; padding-top: 14px; }
.page-size-wrap, .page-nav span { font-size: 12px; color: var(--muted); font-variant-numeric: tabular-nums; }

.record-cards { display: grid; gap: 9px; list-style: none; padding: 0; margin: 0; }
.record-card { border: 1px solid var(--line); border-radius: 12px; background: var(--inset); }
.record-card summary {
    display: grid; grid-template-columns: minmax(0, 1fr) fit-content(42%) 12px; align-items: center;
    gap: 10px; min-height: 62px; padding: 11px 13px; cursor: pointer;
}
.record-card summary::-webkit-details-marker { display: none; }
.card-title, .card-sub, .card-hi small { display: block; }
.card-title { font-weight: 650; color: var(--ink); font-size: 13.5px; }
.card-sub, .card-hi small { font-size: 11px; color: var(--muted); margin-top: 2px; }
.card-hi { text-align: right; font-size: 12.5px; font-weight: 650; }
.card-arrow { justify-self: center; width: 6px; height: 6px; border-right: 1.5px solid var(--muted); border-bottom: 1.5px solid var(--muted); transform: translateY(-2px) rotate(45deg); }
.record-card[open] .card-arrow { transform: translateY(2px) rotate(225deg); }
.card-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px 12px; margin: 0; padding: 12px 13px; border-top: 1px solid var(--line); }
.card-grid dt { font-size: 11px; color: var(--muted); }
.card-grid dd { margin: 2px 0 0; font-size: 12.5px; overflow-wrap: anywhere; }

/* --- Shimmer Skeletons --- */
.sk {
    display: block; border-radius: 6px;
    background: linear-gradient(90deg, rgba(255,255,255,.04) 25%, rgba(255,255,255,.09) 50%, rgba(255,255,255,.04) 75%);
    background-size: 200% 100%; animation: shimmer 1.4s ease-in-out infinite;
}
@keyframes shimmer { from { background-position: 200% 0; } to { background-position: -200% 0; } }
.sk-box { gap: 10px; }
.sk-s { height: 12px; width: 38%; }
.sk-l { height: 28px; width: 64%; }
.sk-m { height: 11px; width: 52%; }
.sk-panel { display: grid; gap: 14px; }
.sk-chart { height: 170px; width: 100%; border-radius: 10px; }
.sk-table { display: grid; gap: 10px; padding: 14px; border: 1px solid var(--line); border-radius: 12px; }
.sk-row { display: grid; grid-template-columns: 1.2fr 1.6fr 1fr .8fr; gap: 12px; }
.sk-row .sk { height: 14px; }

@media (prefers-reduced-motion: reduce) {
    *, *::before, *::after { animation-duration: .01ms !important; transition-duration: .01ms !important; }
}

/* --- Responsive Breakpoints --- */
@media (max-width: 1120px) {
    .kpi-strip { grid-template-columns: repeat(2, minmax(0, 1fr)); }
    .bento-hero, .bento-3 { grid-template-columns: minmax(0, 1fr); }
    .app-bar-inner { flex-wrap: wrap; }
    .top-nav { order: 3; width: 100%; justify-content: space-between; }
}
@media (max-width: 820px) {
    .bento-2 { grid-template-columns: minmax(0, 1fr); }
    .login-shell { grid-template-columns: minmax(0, 1fr); max-width: 440px; }
    .login-showcase { border-right: 0; border-bottom: 1px solid var(--line); padding: 22px 24px; gap: 14px; }
    .showcase-body, .showcase-card { display: none; }
}
@media (max-width: 720px) {
    .stage { padding: 16px 12px 36px; }
    .page-head { flex-direction: column; align-items: stretch; margin-bottom: 14px; }
    .page-controls { display: grid; grid-template-columns: minmax(0, 1fr) auto; }
    #period-pills { display: none; }
    .mobile-period { display: block; }
    .mobile-period select { width: 100%; min-height: 42px; font-size: 16px; }
    .kpi-strip, .bento-hero, .bento-3, .bento-2 { gap: 10px; margin-bottom: 12px; }
    .surface { padding: 15px; }
    .kpi { padding: 13px 14px; }
    .donut-layout { grid-template-columns: minmax(0, 1fr); justify-items: center; }
    .donut-legend { width: 100%; }
    .inline-controls { width: 100%; }
    .control-pair { flex: 1 1 100%; }
    .control-pair select { max-width: none; width: 100%; font-size: 16px; min-height: 42px; }
    .search-box input { font-size: 16px; min-height: 42px; }
    .top-nav button { padding: 6px 10px; font-size: 12px; }
    .viz-cap { display: none; }
}
