:root {
    color-scheme: dark;
    --bg: #0d0d0f;
    --panel: #17171b;
    --panel-2: #202027;
    --panel-3: #121216;
    --line: #303039;
    --text: #f5f2ed;
    --muted: #aaa5a0;
    --accent: #d83a32;
    --accent-2: #ff6a58;
    --success: #48d17b;
    --warning: #f1b84b;
    --danger: #ff6a58;
    --shadow: 0 12px 34px rgba(0, 0, 0, .3);
}

* { box-sizing: border-box; }
html { font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif; background: var(--bg); color: var(--text); }
body { margin: 0; min-height: 100vh; background: radial-gradient(circle at 85% 0, rgba(216,58,50,.11), transparent 28rem), var(--bg); }
a { color: var(--accent-2); text-decoration: none; }
a:hover { color: #ff8c7d; }
h1, h2, h3, p { margin-top: 0; }
h1 { margin-bottom: 0; font-size: clamp(1.35rem, 3vw, 1.85rem); }
h2 { margin-bottom: 0; font-size: 1.1rem; }
h3 { margin-top: 1rem; font-size: .95rem; }

.topbar { position: sticky; top: 0; z-index: 10; display: flex; justify-content: space-between; align-items: center; gap: 1rem; padding: .72rem max(1rem, calc((100vw - 1480px) / 2)); border-bottom: 1px solid var(--line); background: rgba(13,13,15,.94); backdrop-filter: blur(16px); }
.topbar nav { display: flex; gap: .2rem; flex-wrap: wrap; }
.topbar nav a { color: var(--muted); padding: .48rem .65rem; border-radius: .45rem; font-size: .82rem; }
.topbar nav a:hover, .topbar nav a.active { color: var(--text); background: var(--panel-2); }
.eyebrow { display: block; margin-bottom: .18rem; color: var(--accent-2); font-size: .64rem; font-weight: 800; letter-spacing: .13em; text-transform: uppercase; }
.container { width: min(1480px, calc(100% - 1.25rem)); margin: 0 auto; padding: .85rem 0 2rem; }

.hero { display: flex; justify-content: space-between; gap: 1rem; align-items: center; padding: .72rem .9rem; margin-bottom: .75rem; border: 1px solid rgba(72,209,123,.25); border-radius: .7rem; background: rgba(72,209,123,.055); }
.hero p { margin: .18rem 0 0; color: var(--muted); font-size: .8rem; }
.hero-meta { color: var(--muted); font-size: .78rem; white-space: nowrap; }
.status-dot { display: inline-block; width: .52rem; height: .52rem; margin-right: .4rem; border-radius: 50%; background: var(--success); box-shadow: 0 0 14px rgba(72,209,123,.72); }

section { margin-bottom: .8rem; }
.data-segment, .panel { padding: .8rem; border: 1px solid var(--line); border-radius: .76rem; background: linear-gradient(145deg, var(--panel-3), rgba(23,23,27,.88)); box-shadow: var(--shadow); }
.dashboard-groups { display: grid; grid-template-columns: repeat(2, minmax(0,1fr)); gap: .65rem; margin-bottom: .8rem; }
.dashboard-groups .data-segment { margin-bottom: 0; }
.section-heading { display: flex; justify-content: space-between; align-items: end; gap: .75rem; margin-bottom: .58rem; }
.muted { color: var(--muted); font-size: .76rem; }
.metric-grid, .segment-grid { display: grid; gap: .42rem; }
.metric-grid { grid-template-columns: repeat(5, minmax(0,1fr)); }
.metric-grid-wide { grid-template-columns: repeat(auto-fit, minmax(155px,1fr)); }
.segment-grid.three { grid-template-columns: repeat(3, minmax(0,1fr)); }
.segment-grid.four { grid-template-columns: repeat(4, minmax(0,1fr)); }
.segment-grid.five { grid-template-columns: repeat(5, minmax(0,1fr)); }
.metric-card { min-height: 88px; display: flex; flex-direction: column; justify-content: space-between; gap: .32rem; padding: .62rem .68rem; border: 1px solid var(--line); border-radius: .58rem; background: linear-gradient(145deg, var(--panel-2), var(--panel)); box-shadow: 0 8px 22px rgba(0,0,0,.22); }
.metric-card span { color: var(--muted); font-size: .68rem; font-weight: 650; }
.metric-card strong { font-size: clamp(1.18rem, 2.2vw, 1.62rem); line-height: 1; }
.metric-card strong.name-value { font-size: clamp(.92rem, 1.6vw, 1.18rem); line-height: 1.12; }
.metric-card small { color: var(--muted); font-size: .66rem; line-height: 1.22; }
.metric-card.accent-card { border-color: rgba(216,58,50,.52); background: linear-gradient(145deg, rgba(216,58,50,.18), var(--panel)); }

.summary-grid { display: grid; grid-template-columns: repeat(2,minmax(0,1fr)); gap: .55rem; }
.spotlight { min-height: 125px; display: flex; flex-direction: column; justify-content: center; }
.spotlight h2 { margin-bottom: .35rem; }
.spotlight-value { display: block; margin: .1rem 0 .3rem; font-size: clamp(1.65rem, 3vw, 2.35rem); line-height: 1; }

.panel-foot { margin: .65rem 0 0; }
.table-wrap { overflow-x: auto; }
table { width: 100%; border-collapse: collapse; font-size: .78rem; }
th, td { padding: .52rem .48rem; border-bottom: 1px solid var(--line); text-align: left; white-space: nowrap; }
th { color: var(--muted); font-size: .6rem; letter-spacing: .07em; text-transform: uppercase; }
tbody tr:hover { background: rgba(255,255,255,.025); }
.selected-row { background: rgba(216,58,50,.08); }
.empty { color: var(--muted); text-align: center; padding: 1.4rem; }
.empty.compact { padding: .6rem 0 0; text-align: left; }
.note-cell { max-width: 25rem; overflow: hidden; text-overflow: ellipsis; }
.badge { display: inline-flex; padding: .2rem .42rem; border: 1px solid rgba(72,209,123,.3); border-radius: 999px; color: var(--success); background: rgba(72,209,123,.08); font-size: .64rem; }
.status-ignored { color: var(--warning); border-color: rgba(241,184,75,.35); background: rgba(241,184,75,.08); }
.status-failed { color: var(--danger); border-color: rgba(255,106,88,.35); background: rgba(216,58,50,.1); }
.status-captured { color: #91b8ff; border-color: rgba(145,184,255,.35); background: rgba(145,184,255,.08); }
.warning { color: var(--warning); font-weight: 750; }
.button, button { display: inline-flex; align-items: center; justify-content: center; min-height: 32px; padding: .44rem .68rem; border: 0; border-radius: .45rem; background: var(--accent); color: white; font: inherit; font-size: .76rem; font-weight: 750; cursor: pointer; }
.button:hover, button:hover { background: #ef493f; color: white; }
.button.secondary { background: var(--panel-2); color: var(--text); border: 1px solid var(--line); }

.search-form { display: flex; align-items: center; gap: .4rem; flex-wrap: wrap; }
.search-form input { width: min(330px,70vw); }

.inspector pre { max-height: 24rem; overflow: auto; padding: .75rem; border: 1px solid var(--line); border-radius: .55rem; background: #09090b; color: #e6e1da; white-space: pre-wrap; overflow-wrap: anywhere; font-size: .76rem; }
.details-grid { display: grid; grid-template-columns: repeat(3,minmax(0,1fr)); gap: .45rem; margin: 0; }
.details-grid div { padding: .58rem; border: 1px solid var(--line); border-radius: .55rem; background: var(--panel-2); }
dt { color: var(--muted); font-size: .62rem; text-transform: uppercase; letter-spacing: .07em; }
dd { margin: .2rem 0 0; overflow-wrap: anywhere; font-size: .82rem; }
.processing-note { margin-top: .65rem; }

.login-page { display: grid; place-items: center; padding: 1rem; }
.login-card { width: min(420px,100%); padding: 1.35rem; border: 1px solid var(--line); border-radius: .85rem; background: var(--panel); box-shadow: var(--shadow); }
.login-card p { color: var(--muted); line-height: 1.5; }
.login-card form { display: grid; gap: .72rem; margin-top: 1rem; }
.login-card .public-back { display: inline-block; margin-top: .9rem; font-size: .8rem; }
label { display: grid; gap: .35rem; color: var(--muted); font-size: .78rem; font-weight: 650; }
input { width: 100%; min-height: 39px; padding: .55rem .65rem; border: 1px solid var(--line); border-radius: .5rem; background: #101013; color: var(--text); font: inherit; }
input:focus { outline: 2px solid rgba(216,58,50,.35); border-color: var(--accent); }
.alert { margin-top: .65rem; padding: .62rem; border: 1px solid rgba(255,106,88,.35); border-radius: .5rem; background: rgba(216,58,50,.1); color: #ffb2a8; font-size: .8rem; }

@media (max-width: 1180px) {
    .dashboard-groups { grid-template-columns: 1fr; }
    .segment-grid.five { grid-template-columns: repeat(3,minmax(0,1fr)); }
}
@media (max-width: 900px) {
    .metric-grid, .metric-grid-wide, .segment-grid.four { grid-template-columns: repeat(2,minmax(0,1fr)); }
    .segment-grid.three, .segment-grid.five { grid-template-columns: repeat(2,minmax(0,1fr)); }
    .details-grid { grid-template-columns: repeat(2,minmax(0,1fr)); }
}
@media (max-width: 680px) {
    .topbar, .hero, .section-heading { align-items: flex-start; flex-direction: column; }
    .topbar { position: static; }
    .topbar nav { width: 100%; }
    .hero-meta { white-space: normal; }
    .metric-grid, .metric-grid-wide, .details-grid, .summary-grid, .segment-grid.three, .segment-grid.four, .segment-grid.five { grid-template-columns: 1fr; }
    .metric-card { min-height: 80px; }
    .search-form { width: 100%; }
    .search-form input { width: 100%; }
}
