:root {
    color-scheme: dark;
    font-family: Inter, "Segoe UI", Arial, sans-serif;
    background: #080d18;
    color: #eff5ff;
    font-synthesis: none;
    text-rendering: optimizeLegibility;
    --line: rgba(139, 171, 214, .13);
    --cyan: #42dcff;
}

* { box-sizing: border-box; }
html, body { min-width: 320px; min-height: 100%; margin: 0; }
body {
    background: radial-gradient(ellipse at 78% -15%, rgba(22, 105, 189, .22), transparent 40%),
        radial-gradient(ellipse at 4% 34%, rgba(7, 160, 187, .08), transparent 35%), #080d18;
}
button { font: inherit; }
.dashboard-shell { width: min(1440px, 100%); margin: 0 auto; padding: 42px 46px 28px; }
.dashboard-header { display: flex; justify-content: space-between; align-items: center; gap: 24px; padding-bottom: 34px; }
.brand-lockup { display: flex; align-items: center; gap: 19px; }
.brand-mark { width: 48px; height: 48px; display: flex; align-items: end; gap: 4px; padding: 10px; border: 1px solid rgba(66, 220, 255, .23); border-radius: 15px; background: linear-gradient(145deg, rgba(57, 190, 255, .18), rgba(55, 105, 219, .09)); box-shadow: 0 0 28px rgba(37, 170, 255, .1); }
.brand-mark span { width: 6px; border-radius: 4px; background: linear-gradient(#60e8ff, #3486ff); }
.brand-mark span:nth-child(1) { height: 13px; }.brand-mark span:nth-child(2) { height: 23px; }.brand-mark span:nth-child(3) { height: 17px; }
.eyebrow { margin: 0 0 7px; color: #7d91ad; font-size: .68rem; font-weight: 700; letter-spacing: .15em; }
h1, h2, p { margin-top: 0; }
.dashboard-header h1 { margin: 0; font-size: clamp(1.65rem, 3vw, 2.1rem); font-weight: 700; letter-spacing: -.035em; }
.dashboard-subtitle { margin: 5px 0 0; color: #9cacc2; font-size: .92rem; }
.refresh-indicator { display: flex; align-items: center; gap: 9px; padding: 10px 14px; border: 1px solid var(--line); border-radius: 999px; color: #a5b4c9; font-size: .78rem; white-space: nowrap; }
.refresh-dot, .status-dot { display: inline-block; width: 7px; height: 7px; flex: 0 0 auto; border-radius: 50%; background: var(--cyan); box-shadow: 0 0 10px rgba(66, 220, 255, .7); }
.dashboard-section { margin: 0 0 26px; padding: 24px; border: 1px solid var(--line); border-radius: 20px; background: linear-gradient(140deg, rgba(17, 28, 46, .95), rgba(12, 20, 34, .93)); box-shadow: 0 18px 48px rgba(0, 0, 0, .18); }
.section-heading { display: flex; justify-content: space-between; align-items: center; gap: 16px; margin-bottom: 20px; }
.section-heading .eyebrow { margin-bottom: 5px; }
.section-heading h2 { margin: 0; font-size: 1.18rem; font-weight: 650; letter-spacing: -.015em; }
.status-badge { display: inline-flex; align-items: center; gap: 8px; padding: 7px 12px; border-radius: 999px; font-size: .77rem; font-weight: 650; }
.status-live { color: #75f0cb; border: 1px solid rgba(67, 226, 178, .21); background: rgba(36, 174, 130, .1); }
.status-live .status-dot { background: #47e3b2; box-shadow: 0 0 10px rgba(71, 227, 178, .5); }
.status-offline { color: #f1b27f; border: 1px solid rgba(230, 151, 90, .2); background: rgba(181, 102, 47, .1); }
.status-offline .status-dot { background: #f2a05f; box-shadow: 0 0 9px rgba(242, 160, 95, .45); }
.overview-toolbar { display: flex; justify-content: space-between; align-items: center; gap: 18px; margin: 0 0 18px; }
.mode-switch { display: inline-flex; gap: 3px; padding: 4px; border: 1px solid var(--line); border-radius: 12px; background: rgba(5, 11, 21, .48); }
.mode-button { padding: 8px 13px; border: 0; border-radius: 8px; background: transparent; color: #94a5bc; font-size: .78rem; cursor: pointer; transition: color .16s ease, background .16s ease, box-shadow .16s ease; }
.mode-button:hover { color: #e9f4ff; }.mode-button:focus-visible { outline: 2px solid var(--cyan); outline-offset: 2px; }
.mode-selected { color: #e9faff; background: linear-gradient(110deg, rgba(29, 175, 217, .24), rgba(55, 120, 230, .2)); box-shadow: inset 0 0 0 1px rgba(76, 202, 255, .16); }
.telemetry-time { display: flex; flex-direction: column; align-items: flex-end; gap: 2px; color: #c0ccdd; font-size: .78rem; }
.telemetry-time .eyebrow { margin: 0; font-size: .59rem; }
.status-message { margin: 0 0 16px; padding: 11px 14px; border: 1px solid rgba(66, 174, 255, .17); border-radius: 10px; background: rgba(31, 112, 179, .09); color: #b7d7ef; font-size: .82rem; }
.status-message code { color: #74dfff; }
.metric-grid { display: grid; gap: 12px; }
.system-grid { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.playfield-grid { grid-template-columns: repeat(4, minmax(0, 1fr)); }
.metric-card { min-width: 0; padding: 16px 17px 15px; border: 1px solid rgba(130, 163, 207, .12); border-radius: 14px; background: linear-gradient(145deg, rgba(26, 40, 62, .72), rgba(17, 29, 47, .67)); }
.metric-card-heading { display: flex; justify-content: space-between; align-items: center; gap: 8px; color: #95a8c1; font-size: .75rem; font-weight: 550; }
.info-mark { display: inline-grid; width: 16px; height: 16px; place-items: center; border: 1px solid rgba(143, 174, 213, .38); border-radius: 50%; color: #89a2c2; font-size: .67rem; }
.metric-value { display: flex; align-items: baseline; gap: 6px; min-height: 39px; margin-top: 9px; color: #f0f7ff; font-size: clamp(1.35rem, 2.3vw, 1.75rem); font-weight: 650; letter-spacing: -.04em; font-variant-numeric: tabular-nums; }
.metric-unit { color: #a1b3ca; font-size: .79rem; font-weight: 500; letter-spacing: 0; }
.metric-detail { min-height: 17px; margin-top: 4px; color: #75cce4; font-size: .67rem; }
.metric-progress { height: 4px; overflow: hidden; margin-top: 9px; border-radius: 999px; background: rgba(129, 154, 187, .14); }
.metric-progress span { display: block; height: 100%; border-radius: inherit; background: linear-gradient(90deg, #21d2dc, #4b8eff); transition: width .35s ease; }
.section-note { color: #8699b2; font-size: .75rem; }
.history-toolbar { display: flex; justify-content: space-between; align-items: center; gap: 14px; margin: 0 0 17px; }
.history-range-switch { display: flex; flex-wrap: wrap; gap: 5px; padding: 4px; border: 1px solid var(--line); border-radius: 12px; background: rgba(5, 11, 21, .48); }
.history-range-button { padding: 8px 11px; border: 0; border-radius: 8px; background: transparent; color: #94a5bc; font-size: .75rem; cursor: pointer; }
.history-range-button:hover:not(:disabled) { color: #e9f4ff; }.history-range-button:focus-visible { outline: 2px solid var(--cyan); outline-offset: 2px; }
.history-range-button:disabled { cursor: not-allowed; opacity: .5; }
.history-range-selected { color: #e9faff; background: linear-gradient(110deg, rgba(29, 175, 217, .24), rgba(55, 120, 230, .2)); box-shadow: inset 0 0 0 1px rgba(76, 202, 255, .16); }
.history-summary, .history-loading { color: #8297b2; font-size: .74rem; white-space: nowrap; }
.history-loading { display: inline-flex; align-items: center; gap: 8px; }
.history-spinner { width: 13px; height: 13px; border: 2px solid rgba(66, 220, 255, .25); border-top-color: var(--cyan); border-radius: 50%; animation: history-spin .8s linear infinite; }
@keyframes history-spin { to { transform: rotate(360deg); } }
.history-message, .history-empty { padding: 12px 14px; border: 1px solid rgba(66, 174, 255, .17); border-radius: 10px; background: rgba(31, 112, 179, .09); color: #b7d7ef; font-size: .82rem; }
.history-empty { color: #8297b2; text-align: center; }
.historical-chart-grid { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 12px; }
.trend-card { min-width: 0; padding: 13px 14px 8px; border: 1px solid rgba(130, 163, 207, .12); border-radius: 14px; background: linear-gradient(145deg, rgba(26, 40, 62, .72), rgba(17, 29, 47, .67)); }
.trend-card-header { display: flex; justify-content: space-between; align-items: center; gap: 8px; min-height: 26px; }
.trend-card-header h3 { overflow: hidden; margin: 0; color: #dce9f8; font-size: .78rem; font-weight: 600; text-overflow: ellipsis; white-space: nowrap; }
.trend-legend { display: inline-flex; align-items: center; gap: 6px; padding: 3px 4px; border: 0; background: transparent; color: #91a8c2; font-size: .66rem; white-space: nowrap; cursor: pointer; }
.trend-legend:focus-visible { outline: 2px solid var(--cyan); outline-offset: 2px; border-radius: 4px; }
.trend-legend-hidden { opacity: .45; text-decoration: line-through; }
.trend-legend-swatch { width: 13px; height: 2px; border-radius: 2px; background: var(--cyan); box-shadow: 0 0 8px rgba(66, 220, 255, .55); }
.trend-plot-layout { display: grid; grid-template-columns: 34px minmax(0, 1fr); align-items: stretch; gap: 4px; }
.trend-y-axis { display: flex; flex-direction: column; justify-content: space-between; padding: 3px 0 4px; color: #7187a3; font-size: .6rem; font-variant-numeric: tabular-nums; text-align: right; }
.trend-chart { display: block; width: 100%; height: 142px; overflow: visible; }
.trend-x-axis { display: flex; justify-content: space-between; margin: 0 2px 0 39px; color: #7187a3; font-size: .6rem; font-variant-numeric: tabular-nums; }
.trend-grid-line { stroke: rgba(139, 171, 214, .12); stroke-width: 1; vector-effect: non-scaling-stroke; }
.trend-series-line { fill: none; stroke: var(--cyan); stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; vector-effect: non-scaling-stroke; }
.trend-series-point { fill: #122235; stroke: var(--cyan); stroke-width: 1.6; vector-effect: non-scaling-stroke; }
.trend-series-point:hover { fill: #effaff; r: 5; }
.trend-chart-empty { display: grid; min-height: 150px; place-items: center; color: #7187a3; font-size: .75rem; }
.dashboard-footer { padding: 3px 4px; color: #667a94; font-size: .72rem; text-align: center; }
.dashboard-footer span { padding: 0 5px; color: #3d9fc6; }
#blazor-error-ui { display: none; position: fixed; right: 16px; bottom: 16px; z-index: 1000; padding: 14px 18px; border: 1px solid rgba(244, 136, 112, .3); border-radius: 10px; background: #381e2b; color: #ffe8e2; }
#blazor-error-ui .reload { margin-left: 12px; color: #86ddff; }
#blazor-error-ui .dismiss { margin-left: 12px; cursor: pointer; }

@media (max-width: 900px) {
    .dashboard-shell { padding: 28px 24px 22px; }
    .system-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
    .playfield-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
    .historical-chart-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}
@media (max-width: 540px) {
    .dashboard-shell { padding: 20px 14px 16px; }
    .dashboard-header { align-items: flex-start; padding-bottom: 23px; }
    .brand-lockup { gap: 12px; }.brand-mark { width: 40px; height: 40px; border-radius: 12px; }
    .dashboard-subtitle { max-width: 245px; font-size: .82rem; }
    .refresh-indicator { display: none; }
    .dashboard-section { margin-bottom: 16px; padding: 17px 14px; border-radius: 16px; }
    .section-heading { margin-bottom: 16px; }
    .overview-toolbar { align-items: flex-start; flex-direction: column; gap: 12px; }
    .mode-switch { width: 100%; }.mode-button { flex: 1; padding: 8px 5px; font-size: .72rem; }
    .history-toolbar { align-items: flex-start; flex-direction: column; }
    .history-range-switch { width: 100%; }
    .history-range-button { flex: 1 1 30%; padding: 8px 5px; font-size: .68rem; }
    .historical-chart-grid { grid-template-columns: 1fr; }
    .telemetry-time { align-items: flex-start; }
    .metric-grid { gap: 9px; }
    .system-grid, .playfield-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
    .metric-card { padding: 13px 12px; border-radius: 12px; }
    .metric-card-heading { font-size: .69rem; }
    .metric-value { font-size: 1.32rem; }
    .section-note { max-width: 115px; text-align: right; }
}
@media (max-width: 360px) {
    .system-grid, .playfield-grid, .historical-chart-grid { grid-template-columns: 1fr; }
}
