:root {
    color-scheme: dark;
    --canvas: #13171d;
    --sidebar: #171c24;
    --topbar: #161b23;
    --surface: #1a212b;
    --raised: #202833;
    --rule: #323e4c;
    --ink: #f0f3f7;
    --muted: #abb7c8;
    --neutral-bg: #28323d;
    --accent: #ffab76;
    --accent-bg: #34261e;
    --action: #b63e0b;
    --action-hover: #9e3306;
    --healthy: #83dfba;
    --healthy-bg: #1c362f;
    --failure: #ffa2b2;
    --failure-bg: #3b242b;
    --missing: #d4bdff;
    --missing-bg: #302941;
    --warning: #ffd389;
    --warning-bg: #3d3020;
    --focus: #ffae78;
}

:root[data-theme="light"] {
    color-scheme: light;
    --canvas: #f1f3f6;
    --sidebar: #fff;
    --topbar: #fff;
    --surface: #fff;
    --raised: #f4f6f9;
    --rule: #d5ddea;
    --ink: #172131;
    --muted: #526378;
    --neutral-bg: #e9eef4;
    --accent: #a6370b;
    --accent-bg: #fdefe3;
    --action: #ae3605;
    --action-hover: #962e05;
    --healthy: #145a45;
    --healthy-bg: #e2f2eb;
    --failure: #a92744;
    --failure-bg: #fbe7ec;
    --missing: #6239a6;
    --missing-bg: #eee7fa;
    --warning: #76500b;
    --warning-bg: #fceed6;
    --focus: #a63a0b;
}

body { margin: 0; background: var(--canvas); color: var(--ink); font: 14px/1.55 "Segoe UI", "Malgun Gothic", system-ui, sans-serif; }
[hidden] { display: none !important; }
a { color: inherit; text-decoration: none; }
a:hover { color: var(--accent); }
button:focus-visible, a:focus-visible, input:focus-visible, select:focus-visible,
.table-responsive:focus-visible { outline: 2px solid var(--focus); outline-offset: 3px; }
.skip-link { position: fixed; z-index: 3; top: 8px; left: 8px; transform: translateY(-160%); padding: 8px 12px; background: var(--surface); }
.skip-link:focus { transform: none; }
.shell { min-height: 100vh; display: grid; grid-template-columns: 224px minmax(0, 1fr); }
.sidebar { position: sticky; top: 0; height: 100vh; display: flex; flex-direction: column; border-right: 1px solid var(--rule); background: var(--sidebar); }
.brand { display: flex; align-items: center; gap: 12px; padding: 24px; white-space: nowrap; line-height: 1.15; }
.brand strong { display: block; font-size: 20px; }
.brand small, .profile small { display: block; color: var(--muted); font-size: 12px; }
.brand-mark, .profile-mark { display: grid; place-items: center; flex: 0 0 auto; }
.brand-mark { width: 38px; height: 38px; border-radius: 10px; background: var(--action); color: #fff; font-size: 25px; }
.sidebar-nav { display: grid; gap: 8px; padding: 22px 15px; }
.sidebar-nav a { position: relative; min-height: 44px; display: flex; align-items: center; gap: 11px; padding: 8px 14px; border-radius: 9px; }
.sidebar-nav a span { width: 18px; text-align: center; font-size: 19px; line-height: 1; color: var(--muted); }
.sidebar-nav a:hover { background: var(--raised); }
.sidebar-nav a[aria-current="page"] { background: var(--accent-bg); font-weight: 700; }
.sidebar-nav a[aria-current="page"], .sidebar-nav a[aria-current="page"] span { color: var(--accent); }
.sidebar-nav a[aria-current="page"]::before { content: ""; position: absolute; inset: 9px auto 9px 0; width: 3px; border-radius: 3px; background: var(--accent); }
.profile { display: flex; align-items: center; flex-wrap: wrap; gap: 7px 10px; margin: auto 16px 18px; padding: 14px 7px 0; border-top: 1px solid var(--rule); font-size: 12px; }
.profile-mark { width: 34px; height: 34px; border-radius: 50%; background: var(--accent-bg); color: var(--accent); font-weight: 700; }
.profile-action { padding: 3px 0; margin-left: auto; color: var(--muted); background: none; border: 0; font-size: 11px; }
.profile-action:hover { color: var(--accent); }
.topbar { min-height: 72px; display: flex; justify-content: space-between; align-items: center; gap: 12px; padding: 12px 32px; border-bottom: 1px solid var(--rule); background: var(--topbar); color: var(--muted); font-size: 13px; }
.topbar-actions, .toolbar, .page-controls { display: flex; align-items: center; flex-wrap: wrap; gap: 10px; }
.bell-icon { position: relative; width: 14px; height: 12px; border: 1.5px solid currentColor; border-radius: 8px 8px 2px 2px; margin-top: -2px; }
.bell-icon::after { content: ""; position: absolute; width: 4px; height: 2px; left: 3.5px; bottom: -4px; border-radius: 3px; background: currentColor; }
.main { padding: 31px 32px 36px; }
.page-header { display: flex; justify-content: space-between; align-items: baseline; gap: 10px 18px; flex-wrap: wrap; margin-bottom: 26px; }
h1, h2, h3 { color: var(--ink); font-weight: 700; letter-spacing: -.02em; }
h1 { font-size: 35px; line-height: 1.22; margin: 0 0 7px; word-break: keep-all; overflow-wrap: anywhere; }
h1[tabindex="-1"]:focus { outline: none; }
h2 { font-size: 21px; margin: 0; }
h3 { font-size: 15px; margin: 0; }
.page-header p, .muted { color: var(--muted); }
.page-header p { margin: 0; }
.datetime, .detail-label, .table-count { color: var(--muted); font-size: 12px; }
.datetime { white-space: nowrap; }

.card { color: var(--ink); background: var(--surface); border: 1px solid var(--rule); border-radius: 11px; }
.metrics { margin-bottom: 22px; }
.metric { display: grid; grid-template-columns: 1fr auto; min-height: 105px; gap: 3px 12px; padding: 13px 17px; }
.metric .detail-label { font-size: 13px; font-weight: 650; }
.metric-value { align-self: end; font-size: 36px; font-weight: 720; line-height: 1.04; }
.metric-unit { align-self: end; color: var(--muted); font-size: 12px; }
.metric-icon { grid-column: 2; grid-row: 1; width: 32px; height: 32px; border-radius: 9px; display: grid; place-items: center; font-size: 21px; }
.is-healthy { --state: var(--healthy); --state-bg: var(--healthy-bg); }
.is-failure { --state: var(--failure); --state-bg: var(--failure-bg); }
.is-missing { --state: var(--missing); --state-bg: var(--missing-bg); }
.is-warning { --state: var(--warning); --state-bg: var(--warning-bg); }
.is-neutral { --state: var(--muted); --state-bg: var(--neutral-bg); }
.metric-icon, .status, .incident-banner { color: var(--state); background: var(--state-bg); }
.status { display: inline-flex; align-items: center; gap: 6px; width: fit-content; background: var(--state-bg, var(--neutral-bg)); color: var(--state, var(--muted)); border-radius: 6px; padding: 3px 8px; font-size: 12px; font-weight: 700; white-space: nowrap; line-height: 1.35; }
.status::before { content: ""; width: 6px; height: 6px; border-radius: 50%; background: currentColor; opacity: .93; }
.incident-banner { display: flex; align-items: center; justify-content: space-between; gap: 12px; flex-wrap: wrap; min-height: 57px; padding: 10px 16px; border-radius: 9px; margin-bottom: 22px; }
.incident-banner strong { font-size: 15px; }
.incident-banner span { margin-inline-end: auto; font-size: 13px; }

.btn.control, .btn.primary, .form-select, .form-control { min-height: 38px; border: 1px solid var(--rule); border-radius: 8px; color: var(--ink); background-color: var(--surface); font-size: 13px; }
.btn.control, .btn.primary { font-weight: 650; padding-inline: 12px; display: inline-flex; align-items: center; justify-content: center; gap: 6px; }
.btn.control:hover { border-color: var(--accent); color: var(--accent); background: var(--surface); }
.btn.primary { border-color: var(--action); color: #fff; background: var(--action); }
.btn.primary:hover, .btn.primary:focus { border-color: var(--action-hover); background: var(--action-hover); color: #fff; }
.btn:disabled { opacity: .55; }
.form-control, .form-select { background: var(--raised); }
.form-select { width: auto; background-image: none; padding-inline: 11px; cursor: pointer; }
.form-control:focus, .form-select:focus { color: var(--ink); background-color: var(--raised); border-color: var(--accent); box-shadow: none; }
.form-control::placeholder { color: var(--muted); opacity: 1; }
.table-toolbar { display: flex; justify-content: space-between; align-items: center; gap: 12px 18px; flex-wrap: wrap; min-height: 68px; padding: 12px 20px; }
.table-title { display: flex; align-items: baseline; gap: 14px; }
.search { display: flex; align-items: center; border: 1px solid var(--rule); border-radius: 8px; background: var(--raised); color: var(--muted); }
.search span { padding-left: 11px; font-size: 20px; line-height: 1; }
.search .form-control { width: min(238px, 48vw); min-height: 36px; border: 0; background: transparent; }
.table-responsive { position: relative; }
.dashboard-table { color: var(--ink); margin: 0; vertical-align: middle; font-size: 13px; min-width: 650px; }
.dashboard-table.overview-table { min-width: 810px; }
.dashboard-table > :not(caption) > * > * { border-color: var(--rule); padding: 9px 14px; }
.dashboard-table > :not(caption) > * > :first-child { padding-left: 21px; }
.dashboard-table thead { background: var(--raised); color: var(--muted); font-size: 12px; }
.dashboard-table thead th { border-bottom: none; font-weight: 680; }
.dashboard-table td { min-height: 64px; overflow-wrap: anywhere; }
.dashboard-table td strong { display: block; font-size: 14px; }
.dashboard-table .row-accent td { background: var(--accent-bg); }
.dashboard-table .row-accent td:first-child { box-shadow: inset 3px 0 var(--accent); }
.table-note { display: block; margin-top: 4px; color: var(--muted); font-size: 12px; }
.table-note.accent { color: var(--accent); }
.last-received { display: inline-flex; gap: 7px; text-align: center; white-space: nowrap; }
.endpoint-entry + .endpoint-entry { margin-top: 8px; }
.endpoint-entry .status { display: flex; margin-top: 3px; }
.arrow-link { display: inline-grid; place-items: center; width: 32px; min-height: 32px; border-radius: 6px; font-size: 21px; color: var(--muted); }
.arrow-link:hover { background: var(--raised); }
.table-footer { min-height: 58px; display: flex; justify-content: space-between; align-items: center; flex-wrap: wrap; gap: 8px 16px; padding: 9px 20px; }
.page-controls .btn { min-height: 29px; font-size: 12px; }
.empty { text-align: center; color: var(--muted); padding: 48px 16px !important; margin: 0; }

.notice { border: 1px solid var(--rule); border-radius: 9px; padding: 12px 16px; margin-bottom: 16px; background: var(--warning-bg); color: var(--warning); }
.notice button { margin-left: 12px; }
.login-card { max-width: 440px; margin: clamp(44px, 13vh, 125px) auto 24px; padding: 27px; }
.login-card h1 { font-size: 28px; }
.login-card p { margin-bottom: 20px; }
.login-card .form-label { font-weight: 700; }
.login-card .primary { margin-top: 16px; min-height: 43px; }
.form-error { padding-top: 10px; margin-bottom: 0 !important; color: var(--failure); }
.login-card .form-control { min-height: 43px; }
.section-card { padding: 19px 21px; margin-bottom: 16px; }
.section-card > h2 { margin-bottom: 15px; }
.facts { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 12px 18px; margin: 0; }
.facts dt { color: var(--muted); font-size: 12px; }
.facts dd { overflow-wrap: anywhere; margin: 4px 0 0; }
.details-header { margin-bottom: 15px; }
.detail-metric .card { min-height: 102px; padding: 14px 17px; justify-content: space-between; }
.detail-metric .card strong { font-size: 19px; }
.detail-grid { display: grid; grid-template-columns: minmax(0, 1.55fr) minmax(280px, 1fr); gap: 16px; }
.checklist { margin: 0; list-style: none; padding: 0; }
.checklist li { border-top: 1px solid var(--rule); padding: 9px 0; display: flex; justify-content: space-between; align-items: center; gap: 8px; }
.checklist li:first-child { border-top: 0; }
.checklist time { color: var(--muted); }
.progress-list { list-style: none; margin: 0; padding: 0 0 0 9px; }
.progress-list li { position: relative; margin-left: 3px; padding: 0 0 13px 14px; border-left: 1px solid var(--rule); }
.progress-list li:before { content: ""; position: absolute; top: 6px; left: -4px; width: 7px; height: 7px; background: var(--state, var(--accent)); border-radius: 50%; }
.progress-list li:last-child { border-color: transparent; padding-bottom: 0; }
.progress-list span { display: block; color: var(--muted); font-size: 12px; }
.server-card .server-subtitle { margin: 0 0 10px; color: var(--muted); }
.server-card .btn { margin-top: 13px; }
.customer-directory { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 13px; }
.customer-link { display: flex; justify-content: space-between; gap: 12px; min-width: 0; padding: 14px 17px; }
.customer-link small { display: block; color: var(--muted); }
.customer-link:hover { border-color: var(--accent); }
.registration-card { max-width: 900px; gap: 22px; padding: 21px; }
.registration-card .form-label { font-weight: 650; }
.registration-card .form-select { width: 100%; appearance: auto; }
.registration-card > h2 { margin-bottom: -15px; }
.registration-card p { margin-bottom: 11px; }
.registration-actions { display: flex; justify-content: flex-end; }
.copy-field { display: flex; flex-wrap: wrap; gap: 8px; }
.copy-field .form-control { flex: 1 1 225px; width: auto; }
.credential-value, #token-installation code { font-family: Consolas, monospace; color: var(--ink); }
.registration-card .credential-value[readonly] { background: var(--raised); }
#token-installation { margin: 10px 0 0; overflow-wrap: anywhere; }
.server-card-actions { display: flex; flex-wrap: wrap; gap: 8px; }

@media (max-width: 1100px) {
    .shell { grid-template-columns: 195px minmax(0, 1fr); }
    .topbar { padding-inline: 22px; }
    .main { padding-inline: 22px; }
}

@media (max-width: 760px) {
    .shell { display: block; }
    .sidebar { position: static; height: auto; border-right: 0; border-bottom: 1px solid var(--rule); flex-flow: row wrap; }
    .brand { padding: 12px 15px; }
    .brand strong { font-size: 18px; }
    .brand-mark { width: 34px; height: 34px; font-size: 21px; }
    .sidebar-nav { order: 3; display: flex; justify-content: space-between; width: 100%; gap: 4px; padding: 0 10px 8px; }
    .sidebar-nav a { justify-content: center; flex: 1; padding: 6px; gap: 6px; font-size: 12px; white-space: nowrap; }
    .sidebar-nav a span { font-size: 17px; }
    .profile { margin: 0 12px 0 auto; padding: 0; border: 0; }
    .profile span { display: none; }
    .profile-action { min-height: 44px; font-size: 12px; }
    .topbar { min-height: 55px; padding: 7px 14px; font-size: 12px; }
    .topbar #breadcrumb { word-break: keep-all; }
    .topbar-actions { gap: 6px; flex-wrap: nowrap; flex-shrink: 0; }
    .topbar-actions .btn, .topbar-actions .status { font-size: 12px; }
    #top-incidents { display: none; }
    .main { padding: 18px 12px 24px; }
    h1 { font-size: 28px; }
    .page-header { margin-bottom: 18px; }
    .page-header p { font-size: 13px; }
    .metric { min-height: 87px; padding: 9px 12px; }
    .metric-value { font-size: 27px; }
    .metric-icon { width: 27px; height: 27px; font-size: 17px; }
    .table-toolbar, .table-footer { padding-inline: 12px; }
    .table-toolbar .toolbar { width: 100%; }
    .table-toolbar .search { min-width: 0; flex: 1; }
    .search .form-control { width: 100%; }
    .detail-grid, .customer-directory { grid-template-columns: 1fr; }
    .facts { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}
