:root {
    --bg: #0b111a;
    --bg-surface: rgba(17, 26, 39, 0.86);
    --bg-elev: rgba(23, 34, 51, 0.92);
    --border: rgba(154, 168, 188, 0.18);
    --border-strong: rgba(154, 168, 188, 0.28);
    --text-main: #e8edf5;
    --text-mid: #acb8cb;
    --text-dim: #7e8ca4;
    --ok: #2dd4bf;
    --warn: #f59e0b;
    --bad: #f87171;
    --info: #60a5fa;
    --mono: "JetBrains Mono", "SFMono-Regular", Menlo, monospace;
    --body: "Inter", -apple-system, BlinkMacSystemFont, sans-serif;
    --brand: "Sora", "Inter", sans-serif;
    --shadow: 0 20px 50px rgba(2, 8, 20, 0.35);
}

*,
*::before,
*::after {
    box-sizing: border-box;
}

html,
body {
    margin: 0;
    min-height: 100%;
}

body {
    font-family: var(--body);
    color: var(--text-main);
    background: var(--bg);
    overflow-x: hidden;
}

.bg-orb {
    position: fixed;
    width: 580px;
    height: 580px;
    border-radius: 50%;
    filter: blur(80px);
    z-index: -3;
    opacity: 0.26;
}

.bg-orb-a {
    background: #1e40af;
    top: -220px;
    right: -100px;
}

.bg-orb-b {
    background: #0f766e;
    bottom: -260px;
    left: -140px;
}

.bg-grid {
    position: fixed;
    inset: 0;
    background-image:
        linear-gradient(rgba(172, 184, 203, 0.05) 1px, transparent 1px),
        linear-gradient(90deg, rgba(172, 184, 203, 0.05) 1px, transparent 1px);
    background-size: 42px 42px;
    mask-image: radial-gradient(circle at center, black 38%, transparent 90%);
    z-index: -2;
    pointer-events: none;
}

.page {
    width: min(1380px, 94vw);
    margin: 22px auto 40px;
    display: grid;
    gap: 16px;
}

.panel {
    background: linear-gradient(155deg, var(--bg-surface), var(--bg-elev));
    border: 1px solid var(--border);
    border-radius: 16px;
    box-shadow: var(--shadow);
    backdrop-filter: blur(14px);
}

.topbar {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 14px 16px;
    gap: 14px;
    position: sticky;
    top: 10px;
    z-index: 20;
}

.topbar-left,
.topbar-right {
    display: flex;
    align-items: center;
    gap: 10px;
}

.brand-wrap {
    display: flex;
    align-items: center;
    gap: 10px;
}

.brand-mark {
    width: 12px;
    height: 32px;
    border-radius: 999px;
    background: linear-gradient(180deg, #60a5fa, #2dd4bf);
    box-shadow: 0 0 18px rgba(96, 165, 250, 0.65);
}

.brand-title {
    margin: 0;
    font-family: var(--brand);
    letter-spacing: 0.06em;
    font-size: 15px;
    font-weight: 800;
}

.brand-sub {
    margin: 2px 0 0;
    font-size: 10px;
    color: var(--text-dim);
    letter-spacing: 0.12em;
}

.pipe {
    width: 1px;
    height: 22px;
    background: var(--border);
}

.live-chip,
.refresh-chip {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    border: 1px solid var(--border);
    background: rgba(10, 17, 30, 0.45);
    border-radius: 999px;
    padding: 7px 11px;
    font-size: 12px;
    color: var(--text-mid);
}

.refresh-chip strong {
    color: var(--text-main);
    font-family: var(--mono);
    font-size: 12px;
}

.dot {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background: var(--warn);
    box-shadow: 0 0 12px rgba(245, 158, 11, 0.8);
}

.dot.ok {
    background: var(--ok);
    box-shadow: 0 0 12px rgba(45, 212, 191, 0.8);
}

.dot.bad {
    background: var(--bad);
    box-shadow: 0 0 12px rgba(248, 113, 113, 0.8);
}

.top-link {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    text-decoration: none;
    color: var(--text-mid);
    border: 1px solid var(--border);
    background: rgba(10, 17, 30, 0.45);
    border-radius: 10px;
    padding: 7px 12px;
    font-size: 12px;
    transition: 0.18s ease;
}

.top-link:hover {
    border-color: var(--border-strong);
    color: var(--text-main);
    transform: translateY(-1px);
}

.top-link i {
    width: 14px;
    height: 14px;
}

.hero {
    padding: 24px;
    display: grid;
    grid-template-columns: 1.5fr 1fr;
    gap: 18px;
}

.hero-kicker {
    margin: 0;
    text-transform: uppercase;
    letter-spacing: 0.14em;
    color: var(--info);
    font-family: var(--mono);
    font-size: 11px;
}

.hero h1 {
    margin: 9px 0 10px;
    font-family: var(--brand);
    font-size: clamp(25px, 3vw, 37px);
    line-height: 1.08;
    letter-spacing: -0.02em;
}

.hero-desc {
    margin: 0 0 15px;
    color: var(--text-mid);
    max-width: 66ch;
    line-height: 1.45;
    font-size: 14px;
}

.hero-tags {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
}

.tag {
    border: 1px solid var(--border);
    background: rgba(13, 21, 34, 0.68);
    border-radius: 999px;
    padding: 6px 11px;
    font-family: var(--mono);
    font-size: 11px;
    color: var(--text-mid);
}

.hero-side {
    display: grid;
    gap: 10px;
}

.hero-metric {
    border: 1px solid var(--border);
    border-radius: 12px;
    background: rgba(13, 22, 36, 0.65);
    padding: 12px 14px;
    display: grid;
    gap: 6px;
}

.metric-label {
    font-size: 11px;
    text-transform: uppercase;
    letter-spacing: 0.08em;
    color: var(--text-dim);
}

.metric-value {
    font-family: var(--brand);
    letter-spacing: 0.01em;
    font-size: 22px;
    line-height: 1;
}

.mono {
    font-family: var(--mono);
}

.kpi-grid {
    display: grid;
    grid-template-columns: repeat(6, minmax(0, 1fr));
    gap: 12px;
}

.kpi {
    padding: 14px;
    display: grid;
    gap: 8px;
}

.kpi p {
    margin: 0;
    text-transform: uppercase;
    font-size: 10px;
    letter-spacing: 0.1em;
    color: var(--text-dim);
}

.kpi h3 {
    margin: 0;
    font-family: var(--mono);
    font-size: clamp(17px, 1.9vw, 25px);
    line-height: 1;
}

.kpi span {
    font-size: 11px;
    color: var(--text-mid);
}

.grid-two {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 16px;
}

.section-head {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 10px;
    margin-bottom: 12px;
}

.section-head h2 {
    margin: 0;
    font-size: 15px;
    font-weight: 700;
    letter-spacing: 0.01em;
}

.badge {
    border: 1px solid var(--border);
    border-radius: 999px;
    padding: 4px 10px;
    font-size: 11px;
    color: var(--text-mid);
    background: rgba(9, 15, 26, 0.65);
}

.panel {
    padding: 16px;
}

.status-rail,
.metric-stack {
    display: grid;
    gap: 8px;
}

.status-row,
.metric-row {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 10px;
    border: 1px solid var(--border);
    border-radius: 10px;
    background: rgba(12, 18, 29, 0.65);
    padding: 8px 10px;
}

.status-row span,
.metric-row span {
    color: var(--text-mid);
    font-size: 12px;
}

.status-row strong,
.metric-row strong {
    font-family: var(--mono);
    font-size: 12px;
}

.section-note {
    margin: 12px 0 0;
    color: var(--text-dim);
    font-size: 12px;
    line-height: 1.4;
}

.table-wrap {
    border: 1px solid var(--border);
    border-radius: 12px;
    overflow: auto;
    max-height: 460px;
}

.table-wrap.compact {
    max-height: 320px;
}

table {
    width: 100%;
    border-collapse: collapse;
    min-width: 640px;
}

thead th {
    position: sticky;
    top: 0;
    z-index: 1;
    background: rgba(11, 17, 30, 0.97);
    color: var(--text-mid);
    text-transform: uppercase;
    letter-spacing: 0.08em;
    font-size: 10px;
    padding: 10px 10px;
    text-align: left;
    border-bottom: 1px solid var(--border);
}

tbody td {
    border-bottom: 1px solid rgba(154, 168, 188, 0.1);
    padding: 9px 10px;
    font-size: 12px;
    color: var(--text-main);
    white-space: nowrap;
}

tbody tr:last-child td {
    border-bottom: none;
}

tbody tr:nth-child(odd) {
    background: rgba(13, 21, 34, 0.42);
}

.muted {
    color: var(--text-dim);
}

.pill {
    display: inline-flex;
    align-items: center;
    border: 1px solid var(--border);
    border-radius: 999px;
    padding: 3px 8px;
    font-size: 11px;
    font-family: var(--mono);
    background: rgba(8, 14, 24, 0.5);
}

.pill.ok {
    border-color: rgba(45, 212, 191, 0.45);
    color: var(--ok);
}

.pill.bad {
    border-color: rgba(248, 113, 113, 0.45);
    color: var(--bad);
}

.pill.warn {
    border-color: rgba(245, 158, 11, 0.45);
    color: var(--warn);
}

.pill.info {
    border-color: rgba(96, 165, 250, 0.45);
    color: var(--info);
}

.tab-group {
    display: inline-flex;
    background: rgba(9, 15, 26, 0.66);
    border: 1px solid var(--border);
    border-radius: 10px;
    padding: 3px;
    gap: 4px;
}

.tab {
    border: none;
    background: transparent;
    color: var(--text-mid);
    padding: 7px 10px;
    font-size: 11px;
    border-radius: 7px;
    cursor: pointer;
    font-family: var(--mono);
}

.tab.active {
    color: var(--text-main);
    background: rgba(96, 165, 250, 0.18);
}

.record-summary {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 10px;
    margin-bottom: 12px;
}

.record-summary > div {
    border: 1px solid var(--border);
    border-radius: 10px;
    background: rgba(12, 18, 29, 0.65);
    padding: 10px;
}

.record-label {
    margin: 0 0 8px;
    font-size: 11px;
    color: var(--text-mid);
    text-transform: uppercase;
    letter-spacing: 0.08em;
}

.record-value {
    margin: 0;
    font-family: var(--mono);
    font-size: 16px;
}

.text-ok {
    color: var(--ok);
}

.text-bad {
    color: var(--bad);
}

.text-warn {
    color: var(--warn);
}

.text-info {
    color: var(--info);
}

.reveal {
    opacity: 0;
    transform: translateY(10px);
    animation: fadeUp 420ms cubic-bezier(0.2, 0.8, 0.2, 1) forwards;
}

.reveal.delay-1 { animation-delay: 50ms; }
.reveal.delay-2 { animation-delay: 90ms; }
.reveal.delay-3 { animation-delay: 130ms; }
.reveal.delay-4 { animation-delay: 170ms; }

@keyframes fadeUp {
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

@media (max-width: 1260px) {
    .kpi-grid {
        grid-template-columns: repeat(3, minmax(0, 1fr));
    }
}

@media (max-width: 980px) {
    .topbar {
        flex-direction: column;
        align-items: flex-start;
    }

    .topbar-right {
        width: 100%;
        justify-content: space-between;
        flex-wrap: wrap;
    }

    .hero {
        grid-template-columns: 1fr;
    }

    .grid-two {
        grid-template-columns: 1fr;
    }

    .record-summary {
        grid-template-columns: 1fr;
    }
}

@media (max-width: 720px) {
    .page {
        width: calc(100vw - 22px);
        margin-top: 12px;
    }

    .kpi-grid {
        grid-template-columns: repeat(2, minmax(0, 1fr));
    }

    .topbar-left {
        flex-wrap: wrap;
    }

    .refresh-chip {
        width: 100%;
        justify-content: space-between;
    }
}
