:root {
    color-scheme: dark;
    font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
    font-synthesis: none;
    --background: #090d12;
    --surface: #111820;
    --surface-raised: #17212b;
    --surface-soft: #0e151c;
    --border: #263440;
    --border-bright: #344655;
    --text: #edf4f5;
    --muted: #8fa0aa;
    --muted-soft: #6f818c;
    --accent: #85d8bb;
    --accent-soft: #173c34;
    --green: #7cdaa0;
    --amber: #e4bb71;
    --red: #ed858e;
    --focus: #b9e8da;
}

* { box-sizing: border-box; }
[hidden] { display: none !important; }
html { min-width: 320px; background: var(--background); }
body {
    min-width: 320px;
    min-height: 100vh;
    margin: 0;
    background:
        radial-gradient(circle at 12% -10%, #17342f66 0, transparent 32rem),
        radial-gradient(circle at 92% 4%, #162b3b66 0, transparent 30rem),
        var(--background);
    color: var(--text);
}
button, input { font: inherit; }
a { color: inherit; }
.icon-definitions { position: absolute; width: 0; height: 0; overflow: hidden; }
svg { fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; }
.page { width: min(100% - 48px, 1280px); margin: 0 auto; padding: 18px 0 32px; }
.card { min-width: 0; border: 1px solid var(--border); border-radius: 16px; background: #111920cc; box-shadow: 0 18px 50px #00000012; }

.status-bar { display: flex; align-items: center; gap: 20px; min-height: 54px; padding: 0 0 14px; border-bottom: 1px solid #24313b; }
.brand { display: inline-flex; align-items: center; gap: 11px; flex: none; text-decoration: none; }
.brand-mark { display: grid; place-items: center; width: 36px; height: 36px; border: 1px solid #335047; border-radius: 11px; background: linear-gradient(145deg, #1d4036, #11251f); color: #a7e2ce; box-shadow: inset 0 1px #ffffff12; }
.brand-mark svg { width: 20px; height: 20px; }
.brand > span:last-child { display: flex; flex-direction: column; gap: 1px; }
.brand strong { font-size: 13px; font-weight: 720; letter-spacing: -.01em; }
.brand small { color: var(--muted-soft); font-size: 9px; letter-spacing: .02em; }
.header-context { display: flex; align-items: center; gap: 16px; min-width: 0; }
.status-updated { margin-left: auto; color: var(--muted-soft); font-size: 10px; white-space: nowrap; }
.account-menu { display: flex; align-items: center; gap: 12px; padding-left: 15px; border-left: 1px solid var(--border); }
.account-copy { display: flex; flex-direction: column; align-items: flex-end; gap: 1px; }
.account-copy strong { font-size: 11px; font-weight: 650; }
.account-copy small { color: var(--muted-soft); font-size: 9px; }
.account-menu form { margin: 0; }
.logout-button { padding: 7px 10px; border: 1px solid #35434d; border-radius: 8px; background: #141c23; color: #aebbc1; font-size: 10px; cursor: pointer; transition: border-color .16s ease, color .16s ease, background .16s ease; }
.logout-button:hover { border-color: #50616d; background: #1a252e; color: #edf3f4; }

.dashboard-state { display: inline-flex; align-items: center; gap: 8px; color: #c7ebd2; font-size: 11px; font-weight: 650; white-space: nowrap; }
.state-dot { width: 7px; height: 7px; flex: none; border-radius: 50%; background: var(--green); box-shadow: 0 0 0 3px #28503a; }
.dashboard-state.is-unknown { color: #aeb9bf; }
.dashboard-state.is-unknown .state-dot { background: #788992; box-shadow: none; }
.dashboard-state.is-warning { color: #f0cc8c; }
.dashboard-state.is-warning .state-dot { background: var(--amber); box-shadow: 0 0 0 3px #554025; }
.dashboard-state.is-critical { color: #f2b2b8; }
.dashboard-state.is-critical .state-dot { background: var(--red); box-shadow: 0 0 0 3px #5a3036; }
.presence-inline { display: inline-flex; align-items: center; gap: 5px; color: var(--muted); font-size: 10px; white-space: nowrap; }

.alert-banner { display: flex; align-items: center; gap: 12px; margin-top: 12px; padding: 10px 13px; border: 1px solid #584629; border-left: 3px solid #b98b4d; border-radius: 9px; background: #211c14; color: #e7cca0; font-size: 11px; text-decoration: none; }
.alert-banner.is-critical { border-color: #63383e; border-left-color: var(--red); background: #25171b; color: #f2b4b9; }
.alert-banner-count { flex: none; font-weight: 750; }
.alert-banner [data-alert-preview] { min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.alert-banner > span:last-child { margin-left: auto; }

.hero { display: grid; grid-template-columns: minmax(0, 1fr) auto; align-items: end; gap: 40px; margin-top: 24px; padding: clamp(26px, 5vw, 54px); overflow: hidden; border: 1px solid #2a3a45; border-radius: 22px; background: linear-gradient(125deg, #16231f 0%, #121c24 58%, #131923 100%); box-shadow: inset 0 1px #ffffff0a, 0 24px 80px #00000026; position: relative; }
.hero::after { content: ""; position: absolute; width: 280px; height: 280px; right: -80px; top: -150px; border: 1px solid #8de1c31a; border-radius: 50%; box-shadow: 0 0 0 46px #8de1c309, 0 0 0 92px #8de1c305; pointer-events: none; }
.eyebrow, .section-index { margin: 0 0 8px; color: #8fc7b5; font-size: 9px; font-weight: 760; letter-spacing: .18em; }
h1 { max-width: 760px; margin: 0; font-size: clamp(30px, 4vw, 52px); font-weight: 680; letter-spacing: -.05em; line-height: 1.04; }
.subtitle { max-width: 670px; margin: 14px 0 0; color: #9eacb3; font-size: clamp(13px, 1.5vw, 15px); line-height: 1.55; }
.hero-status { display: flex; flex-direction: column; min-width: 160px; padding: 14px 16px; border: 1px solid #30443e; border-radius: 13px; background: #0d1715aa; position: relative; z-index: 1; }
.hero-status-label { margin-bottom: 8px; color: #748880; font-size: 9px; letter-spacing: .11em; text-transform: uppercase; }
.hero-status strong { color: #c6eddf; font-size: 12px; }
.hero-status small { margin-top: 3px; color: #7f918a; font-size: 10px; }

.section { padding-top: 34px; }
.section-heading { display: flex; align-items: flex-end; justify-content: space-between; gap: 16px; margin-bottom: 13px; }
.section-heading .section-index { margin-bottom: 5px; color: #6f9287; }
h2 { margin: 0; font-size: 19px; font-weight: 660; letter-spacing: -.03em; }
.section-note { color: var(--muted-soft); font-size: 10px; white-space: nowrap; }
.section-note:empty { display: none; }

.service-grid { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 11px; }
.service-card { display: grid; grid-template-columns: 40px minmax(0, 1fr); align-items: center; gap: 11px; min-height: 92px; padding: 14px; color: inherit; text-decoration: none; transition: transform .16s ease, background .16s ease, border-color .16s ease, box-shadow .16s ease; }
a.service-card:hover { transform: translateY(-2px); border-color: #435763; background: var(--surface-raised); box-shadow: 0 18px 35px #00000026; }
.service-icon, .smart-icon { display: grid; place-items: center; width: 40px; height: 40px; border: 1px solid #30414c; border-radius: 12px; background: linear-gradient(145deg, #1d2932, #141e25); color: #b7cbc9; }
.service-icon svg, .smart-icon svg { width: 21px; height: 21px; }
.service-copy { display: flex; flex-direction: column; min-width: 0; gap: 3px; }
.service-copy strong { overflow: hidden; font-size: 13px; font-weight: 680; text-overflow: ellipsis; white-space: nowrap; }
.service-copy small { overflow: hidden; color: var(--muted); font-size: 10px; text-overflow: ellipsis; white-space: nowrap; }
.service-card-meta { display: flex; grid-column: 1 / -1; align-items: center; gap: 8px; padding-top: 10px; border-top: 1px solid #25323b; }
.access-badge { padding: 3px 6px; border: 1px solid #34444e; border-radius: 99px; color: #8ea0a9; font-size: 8px; font-weight: 700; letter-spacing: .06em; text-transform: uppercase; }
.external-icon { width: 13px; height: 13px; margin-left: auto; color: #71868a; }
.planned { border-style: dashed; background: #0e1419aa; }
.planned .service-icon { color: #7e8d95; background: #151d23; }
.planned .access-badge { border-color: #303a42; color: #75838b; }
.service-status { display: inline-block; width: 8px; height: 8px; flex: none; border-radius: 50%; }
.service-status.is-unknown { background: #788992; }
.service-status.is-online { background: var(--green); box-shadow: 0 0 0 3px #294c38; }
.service-status.is-offline { background: var(--red); box-shadow: 0 0 0 3px #553036; }

.device-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(290px, 1fr)); gap: 11px; }
.device-details { min-width: 0; border: 1px solid var(--border); border-radius: 16px; background: #111920cc; transition: border-color .16s ease, box-shadow .16s ease; }
.device-details:hover, .device-details[open] { border-color: #40535f; box-shadow: 0 16px 36px #0000001c; }
.device-summary { display: grid; grid-template-columns: 40px minmax(0, 1fr) auto; align-items: center; gap: 10px 12px; min-height: 104px; padding: 15px; list-style: none; cursor: pointer; }
.device-summary::-webkit-details-marker { display: none; }
.device-summary:focus-visible { outline: 2px solid var(--focus); outline-offset: 3px; }
.device-name { display: flex; flex-direction: column; min-width: 0; gap: 3px; }
.device-name strong { font-size: 13px; font-weight: 680; }
.device-name small { color: var(--muted); font-size: 10px; }
.device-expand-label { color: #97a7ae; font-size: 10px; white-space: nowrap; }
.device-expand-label::after { content: "  ▾"; }
.device-details[open] .device-expand-label::after { content: "  ▴"; }
.device-meta { display: flex; grid-column: 1 / -1; align-items: center; justify-content: space-between; flex-wrap: wrap; gap: 7px 12px; padding-top: 11px; border-top: 1px solid #28353e; }
.device-reading { display: inline-flex; align-items: center; gap: 8px; font-size: 12px; font-weight: 650; }
.device-volume { display: inline-flex; align-items: center; gap: 7px; color: var(--muted); font-size: 10px; }
.device-volume strong { color: #dce5e6; font-size: 11px; font-variant-numeric: tabular-nums; }
.mute-indicator { padding: 3px 6px; border: 1px solid #67503d; border-radius: 5px; color: #e5c395; font-weight: 650; }
.device-controls { display: flex; align-items: center; flex-wrap: wrap; gap: 7px; padding: 13px 15px 15px; border-top: 1px solid #28353e; }
.device-controls form { margin: 0; }
.device-controls .tv-control, .device-controls .tv-control .tv-action-button { width: 100%; }
.device-unavailable, .readonly-note { margin: 0; color: var(--muted); font-size: 10px; line-height: 1.5; }
.tv-volume { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 7px; width: 100%; }
.tv-volume form:last-child { grid-column: 1 / -1; }
.tv-volume .tv-action-button { width: 100%; }
.tv-action-button { display: inline-flex; align-items: center; justify-content: center; gap: 7px; min-height: 35px; padding: 7px 10px; border: 1px solid #3c4a52; border-radius: 8px; background: #1c2730; color: #d6e0e2; font-size: 10px; font-weight: 650; cursor: pointer; }
.tv-power-button { border-color: #426457; background: #193029; color: #d8f0e7; }
.tv-action-button svg { width: 14px; height: 14px; }
.tv-action-button:hover:not(:disabled) { border-color: #667984; background: #293842; }
.tv-action-button:disabled { opacity: .55; cursor: wait; }
.tv-action-status { flex-basis: 100%; margin: 2px 0 0; color: #c7e8d1; font-size: 10px; }
.tv-action-status.is-pending { color: #adb9bc; }
.tv-action-status.is-error { color: #f0a6ac; }

.metric-grid { display: grid; grid-template-columns: repeat(6, minmax(0, 1fr)); overflow: hidden; border: 1px solid var(--border); border-radius: 16px; background: #10171dcc; }
.metric-item { display: flex; flex-direction: column; min-width: 0; min-height: 108px; padding: 15px; border-left: 1px solid #26333c; }
.metric-item:first-child { border-left: 0; }
.metric-item > span { color: #9aaab2; font-size: 10px; }
.metric-item strong { margin-top: auto; padding-top: 12px; font-size: clamp(23px, 2.4vw, 30px); font-weight: 590; font-variant-numeric: tabular-nums; letter-spacing: -.045em; white-space: nowrap; }
.metric-item small { min-height: 13px; margin-top: 7px; color: #7f9099; font-size: 9px; }

.history-grid { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); overflow: hidden; border: 1px solid var(--border); border-radius: 16px; background: #10171dcc; }
.history-card { display: flex; flex-direction: column; min-width: 0; gap: 10px; padding: 15px; border-left: 1px solid #26333c; }
.history-card:first-child { border-left: 0; }
.history-card-heading { display: flex; justify-content: space-between; gap: 8px; color: #c2ccd0; font-size: 11px; font-weight: 620; }
.history-card-heading span:last-child { color: #74858e; font-weight: 400; }
.history-card svg { display: block; width: 100%; height: 58px; }
.history-baseline { fill: none; stroke: #344047; stroke-width: 1; vector-effect: non-scaling-stroke; }
.history-line { fill: none; stroke: #8dddc2; stroke-width: 2.5; stroke-linecap: round; stroke-linejoin: round; vector-effect: non-scaling-stroke; }
.history-note { margin: 0; color: #82939b; font-size: 9px; font-variant-numeric: tabular-nums; white-space: nowrap; }

.admin-grid { display: grid; grid-template-columns: minmax(0, 1.1fr) minmax(0, .9fr); gap: 28px; }
.admin-panel { min-width: 0; }
.server-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); margin: 0; overflow: hidden; border: 1px solid var(--border); border-radius: 16px; background: #10171dcc; }
.server-item { min-width: 0; padding: 13px 15px; }
.server-item:nth-child(even) { border-left: 1px solid #26333c; }
.server-item:nth-child(n + 3) { border-top: 1px solid #26333c; }
.server-item dt { margin-bottom: 5px; color: #7f919b; font-size: 9px; }
.server-item dd { margin: 0; overflow-wrap: anywhere; color: #dce4e5; font-size: 11px; font-weight: 620; }
.docker-details { overflow: hidden; border: 1px solid var(--border); border-radius: 16px; background: #10171dcc; }
.docker-details.has-failure { border-color: #623f44; }
.docker-summary { display: flex; align-items: center; gap: 12px; min-height: 48px; padding: 11px 14px; list-style: none; cursor: pointer; }
.docker-summary::-webkit-details-marker { display: none; }
.docker-summary:focus-visible { outline: 2px solid var(--focus); outline-offset: -3px; }
.docker-counts { min-width: 0; color: #c2ccd0; font-size: 10px; }
.has-failure .docker-counts { color: #eeaab0; }
.docker-expand-label { flex: none; margin-left: auto; color: #7f9099; font-size: 9px; }
.docker-expand-label::after { content: "  ▾"; }
.docker-details[open] .docker-expand-label::after { content: "  ▴"; }
.docker-rows { border-top: 1px solid #26333c; }
.docker-row { display: grid; grid-template-columns: minmax(120px, 1fr) minmax(0, 1.3fr); align-items: center; gap: 11px; min-height: 41px; padding: 8px 13px; }
.docker-row + .docker-row { border-top: 1px solid #25313a; }
.docker-row.is-failure { background: #281d21; }
.docker-row.is-archived { opacity: .62; }
.docker-heading { display: flex; align-items: center; gap: 9px; }
.docker-heading strong { min-width: 0; overflow: hidden; font-size: 10px; font-weight: 650; text-overflow: ellipsis; white-space: nowrap; }
.docker-meta { display: flex; flex-wrap: wrap; gap: 3px 10px; color: #84949c; font-size: 9px; }
.docker-placeholder { padding: 14px; color: #89979f; font-size: 10px; }
.alerts-list { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 0 18px; margin: 0; padding: 0; list-style: none; }
.alert-row { display: flex; align-items: flex-start; gap: 10px; padding: 10px 2px; border-top: 1px solid #29353e; color: #c9d1d4; font-size: 11px; line-height: 1.4; }
.alert-dot { width: 7px; height: 7px; flex: none; margin-top: 4px; border-radius: 50%; }
.alert-row.is-warning .alert-dot { background: var(--amber); }
.alert-row.is-critical .alert-dot { background: var(--red); }
footer { display: flex; justify-content: space-between; gap: 16px; margin-top: 48px; padding: 18px 0 6px; border-top: 1px solid #24313b; color: #697982; font-size: 9px; }

.login-page { display: grid; grid-template-rows: 1fr auto; }
.login-layout { display: grid; grid-template-columns: minmax(0, 1.15fr) minmax(340px, .85fr); align-items: center; gap: clamp(48px, 9vw, 130px); width: min(100% - 48px, 1080px); min-height: calc(100vh - 52px); margin: 0 auto; padding: 60px 0; }
.login-brand-mark { display: grid; place-items: center; width: 48px; height: 48px; margin-bottom: 28px; border: 1px solid #396356; border-radius: 15px; background: linear-gradient(145deg, #234e40, #122820); color: #b9ead9; font-size: 18px; font-weight: 760; box-shadow: 0 18px 45px #00000026; }
.login-brand h1 { max-width: 580px; }
.login-features { display: grid; gap: 11px; margin: 30px 0 0; padding: 0; color: #95a5ac; font-size: 11px; list-style: none; }
.login-features li { display: flex; align-items: center; gap: 10px; }
.login-features li span { width: 6px; height: 6px; border-radius: 50%; background: var(--accent); box-shadow: 0 0 0 3px var(--accent-soft); }
.login-card { padding: clamp(26px, 4vw, 38px); background: #111920e8; box-shadow: 0 28px 80px #00000038; }
.login-card-heading { margin-bottom: 25px; }
.login-card-heading h2 { font-size: 23px; }
.login-card-heading > p:last-child { margin: 9px 0 0; color: var(--muted); font-size: 11px; line-height: 1.5; }
.login-card form { display: flex; flex-direction: column; }
.login-card label { margin: 0 0 7px; color: #aebbc1; font-size: 10px; font-weight: 620; }
.login-card input[type="text"], .login-card input[type="password"] { width: 100%; margin-bottom: 17px; padding: 12px 13px; border: 1px solid #34434e; border-radius: 9px; outline: none; background: #0b1116; color: var(--text); font-size: 14px; transition: border-color .16s ease, box-shadow .16s ease; }
.login-card input:focus { border-color: #649987; box-shadow: 0 0 0 3px #315e4f35; }
.login-button { display: flex; align-items: center; justify-content: space-between; margin-top: 3px; padding: 12px 14px; border: 1px solid #85d8bb55; border-radius: 9px; background: #a6dfcc; color: #10201b; font-size: 11px; font-weight: 750; cursor: pointer; transition: transform .16s ease, background .16s ease; }
.login-button:hover { transform: translateY(-1px); background: #bcebdc; }
.form-error { margin: 0 0 19px; padding: 11px 13px; border: 1px solid #60373b; border-radius: 9px; background: #28191c; color: #efb9bd; font-size: 10px; line-height: 1.45; }
.login-security-note { margin: 20px 0 0; color: #687983; font-size: 9px; line-height: 1.5; text-align: center; }
.login-footer { display: block; width: min(100% - 48px, 1080px); margin: 0 auto; padding: 15px 0 20px; text-align: center; }

.logout-button:focus-visible, a:focus-visible, button:focus-visible, summary:focus-visible { outline: 2px solid var(--focus); outline-offset: 3px; }

@media (max-width: 1040px) {
    .service-grid { grid-template-columns: repeat(3, minmax(0, 1fr)); }
    .metric-grid { grid-template-columns: repeat(3, minmax(0, 1fr)); }
    .metric-item:nth-child(4) { border-left: 0; }
    .metric-item:nth-child(n + 4) { border-top: 1px solid #26333c; }
    .history-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
    .history-card:nth-child(3) { border-left: 0; }
    .history-card:nth-child(n + 3) { border-top: 1px solid #26333c; }
    .admin-grid { grid-template-columns: 1fr; gap: 34px; }
}

@media (max-width: 760px) {
    .page { width: min(100% - 28px, 660px); padding-top: 12px; }
    .status-bar { display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: 11px 14px; }
    .brand { grid-column: 1; grid-row: 1; }
    .account-menu { grid-column: 2; grid-row: 1; }
    .header-context { grid-column: 1; grid-row: 2; }
    .status-updated { grid-column: 2; grid-row: 2; margin-left: 0; text-align: right; }
    .account-copy { display: none; }
    .hero { grid-template-columns: 1fr; align-items: start; gap: 24px; margin-top: 17px; padding: 28px 24px; }
    .hero-status { width: min(100%, 250px); }
    .section { padding-top: 29px; }
    .service-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
    .metric-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
    .metric-item:nth-child(3), .metric-item:nth-child(5) { border-left: 0; }
    .metric-item:nth-child(4) { border-left: 1px solid #26333c; }
    .metric-item:nth-child(n + 3) { border-top: 1px solid #26333c; }
    .alerts-list { grid-template-columns: 1fr; }
    .login-layout { grid-template-columns: 1fr; gap: 42px; width: min(100% - 32px, 500px); padding: 45px 0; }
    .login-brand { text-align: center; }
    .login-brand-mark { margin-right: auto; margin-left: auto; }
    .login-features { display: none; }
}

@media (max-width: 480px) {
    .page { width: min(100% - 22px, 430px); }
    .brand small, .presence-inline { display: none; }
    .header-context { max-width: 185px; overflow: hidden; }
    .status-updated { font-size: 9px; }
    .hero { padding: 24px 19px; border-radius: 17px; }
    .hero-status { min-width: 0; }
    .section-heading { align-items: flex-start; }
    .section-heading > .section-note { max-width: 125px; white-space: normal; text-align: right; }
    .service-grid { grid-template-columns: 1fr; }
    .service-card { grid-template-columns: 38px minmax(0, 1fr) auto; min-height: 72px; }
    .service-card-meta { grid-column: 3; padding: 0; border: 0; }
    .service-icon { width: 38px; height: 38px; }
    .access-badge { display: none; }
    .metric-item { min-height: 96px; padding: 13px; }
    .history-card { padding: 12px; }
    .server-grid { grid-template-columns: 1fr; }
    .server-item:nth-child(even) { border-left: 0; }
    .server-item:nth-child(n + 2) { border-top: 1px solid #26333c; }
    .docker-row { grid-template-columns: 1fr; gap: 4px; }
    .docker-meta { padding-left: 17px; }
    footer { flex-direction: column; gap: 5px; }
    .login-layout { width: min(100% - 24px, 430px); }
    .login-card { padding: 24px 20px; }
}

@media (prefers-reduced-motion: reduce) {
    *, *::before, *::after { scroll-behavior: auto !important; transition: none !important; }
}
