:root {
  color-scheme: dark;
  --page: #0b1c34;
  --surface: #142d4b;
  --inset: #0e233e;
  --text: #eef5ff;
  --chart-label: #b8cce4;
  --chart-grid: #304e71;
  --chart-line: #52aaff;
  font-family: "Segoe UI", system-ui, sans-serif;
  color: var(--text);
  background: var(--page);
  --nav: #07162d;
  --accent: #79c3ff;
  accent-color: var(--accent);
  --muted: #b8cce4;
  --line: #304e71;
  --green: #40d5ae;
  font-synthesis: none;
}
.login { display: grid; grid-template-columns: minmax(0, 1fr); place-items: center; padding: 20px; }
.login main.panel { max-width: 430px; padding: 28px; }
.login h1 { margin: 18px 0; font-size: 26px; }
.login form { display: grid; gap: 14px; }
.login [role=alert] { color: #ffd090; }
* { box-sizing: border-box; }
body { display: grid; grid-template-columns: 230px minmax(0, 1fr); margin: 0; min-height: 100vh; }
aside { background: var(--nav); color: var(--text); padding: 24px 15px; position: sticky; top: 0; height: 100vh; display: flex; flex-direction: column; }
.brand { display: flex; align-items: center; gap: 11px; padding: 0 6px; color: var(--text); text-decoration: none; font-size: 17px; font-weight: 750; }
.brand > span { display: grid; place-items: center; width: 42px; height: 42px; border-radius: 12px 4px 12px 4px; color: #061d3a; background: #68baff; font-size: 17px; letter-spacing: -.08em; }
.brand small { display: block; color: #a4b8c8; font-size: 9px; letter-spacing: .19em; margin-top: 3px; }
nav { display: grid; gap: 4px; margin-top: 30px; }
nav p { margin: 12px 10px 4px; font-size: 11px; color: #9aafc2; font-weight: 650; text-transform: uppercase; letter-spacing: .09em; }
nav a { color: #d1deeb; font-size: 14px; text-decoration: none; padding: 10px 12px; border-radius: 8px; display: flex; align-items: center; gap: 10px; }
nav a:hover { background: #123359; }
nav a[aria-current] { background: #194779; color: #e4f3ff; font-weight: 650; }
nav i { width: 18px; text-align: center; font-style: normal; font-size: 17px; }
.sidebar-foot { margin-top: auto; padding: 12px 6px 0; color: #c0cedb; font-size: 13px; border-top: 1px solid #314358; }
main { min-width: 0; padding: 0 32px 40px; max-width: 1700px; width: 100%; margin: 0 auto; }
.topbar, .page-head, .panel-head, .fan, .toolbar { display: flex; justify-content: space-between; align-items: center; gap: 16px; }
.topbar { min-height: 68px; margin: 0 -32px; padding: 0 32px; background: var(--surface); border-bottom: 1px solid var(--line); color: var(--muted); font-size: 13px; }
.topbar b { margin: 0 8px; color: #8796a8; }
.topbar strong { color: var(--text); }
.page-head { padding: 29px 0 24px; }
h1, h2, p, ul { margin: 0; }
h1 { font-size: clamp(26px, 3vw, 38px); letter-spacing: -.035em; line-height: 1.12; }
h2 { font-size: 17px; letter-spacing: -.01em; }
.page-head p, .panel-head p { color: var(--muted); margin-top: 7px; font-size: 14px; }
.mode, .toolbar label { display: flex; align-items: center; gap: 8px; color: var(--muted); font-size: 13px; }
button, input, select, .button { font: inherit; border-radius: 8px; padding: 8px 11px; font-size: 13px; }
input:not([type=checkbox]), select { border: 1px solid #48688e; background: var(--inset); color: var(--text); min-width: 0; }
button, .primary { border: 1px solid transparent; background: var(--accent); color: #071b36; cursor: pointer; font-weight: 650; }
button:hover, .primary:hover { background: #a1d8ff; }
button:disabled { opacity: .5; cursor: default; }
.button { text-decoration: none; white-space: nowrap; }
a { color: var(--accent); }
:focus-visible { outline: 3px solid #8abaff; outline-offset: 3px; }
.panel, .metrics article, .fleet-metrics a { background: var(--surface); border: 1px solid var(--line); border-radius: 12px; box-shadow: 0 2px 5px #0004; }
.panel { padding: 19px; min-width: 0; }
.panel-head a, .text-action, #export { font-size: 13px; font-weight: 650; text-decoration: none; }
.panel-head a:hover, .text-action:hover, #export:hover { text-decoration: underline; }
button.text-action, button.text-action:hover { background: transparent; color: var(--accent); }
.device-actions { display: flex; flex-wrap: wrap; align-items: center; gap: 4px 12px; }
.device-actions .text-action { padding: 0; border: 0; }
.fleet-metrics, .metrics { display: grid; gap: 14px; margin-bottom: 16px; }
.fleet-metrics { grid-template-columns: repeat(4, minmax(0, 1fr)); }
.fleet-metrics a { padding: 15px; text-decoration: none; display: grid; gap: 8px; color: var(--muted); font-size: 13px; }
.fleet-metrics a:hover { border-color: #569dea; }
.fleet-metrics strong, .metrics strong { color: var(--text); font-size: 31px; line-height: 1; font-variant-numeric: tabular-nums; }
.metric-icon { display: grid; place-items: center; background: #173f6a; color: #79c3ff; border-radius: 8px; width: 33px; height: 33px; font-size: 18px; }
.metric-icon.blue { background: #263956; color: #a7c7ff; }
.metric-icon.green { background: #1b3e37; color: #8aebd3; }
.metric-icon.amber { background: #433321; color: #ffd090; }
.overview-grid, .panels { display: grid; grid-template-columns: minmax(0, 1.15fr) minmax(0, 1fr); gap: 16px; margin-bottom: 16px; }
.panels:has([hidden]) { grid-template-columns: 1fr; }
.panels:has(#chart-panel[hidden]):has(#device-panel[hidden]) { display: none; }
.health-content { display: flex; align-items: center; gap: 22px; margin-top: 20px; }
.ring { isolation: isolate; position: relative; background: conic-gradient(var(--green) 0 var(--online, 0%), #2c4053 var(--online, 0%) 100%); width: 106px; flex: 0 0 106px; height: 106px; border-radius: 50%; display: flex; flex-direction: column; align-items: center; justify-content: center; }
.ring::before { content: ""; position: absolute; inset: 10px; border-radius: inherit; background: var(--surface); z-index: -1; }
.ring strong { font-size: 22px; }
.ring small { color: var(--muted); font-size: 11px; }
.health-legend { flex: 1; font-size: 13px; display: grid; gap: 9px; }
.health-legend b { float: right; }
.status-dot { width: 8px; height: 8px; border-radius: 50%; background: #21b692; display: inline-block; margin-right: 5px; }
.status-dot.offline { background: #788ba1; }
.toolbar { background: var(--surface); border: 1px solid var(--line); padding: 8px 12px; margin-bottom: 16px; border-radius: 9px; }
.notice { font-size: 13px; color: #a6d4ff; }
.notice.alert { color: #ffd090; }
.metrics { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.metrics article { padding: 16px; display: grid; gap: 9px; }
.metrics span, .metrics small, .hint, .fan p { color: var(--muted); font-size: 13px; }
canvas { display: block; width: 100%; height: 258px; margin: 12px 0; }
.fan { border-top: 1px solid var(--line); margin-top: 18px; padding-top: 16px; }
.fan p, .hint { margin-top: 8px; overflow-wrap: anywhere; }
.badge { background: #1a3b35; color: #8aebd3; border-radius: 20px; padding: 4px 8px; font-size: 12px; white-space: nowrap; }
.badge.offline { background: #263748; color: #c4d0df; }
ul { list-style: none; padding: 0; }
.compact-list li, #events li { display: flex; justify-content: space-between; align-items: center; gap: 12px; padding: 12px 0; border-bottom: 1px solid var(--line); font-size: 13px; }
.compact-list li:last-child, #events li:last-child { border-bottom: 0; }
.compact-list .empty { margin-top: 18px; padding: 15px; border-radius: 8px; background: var(--inset); color: var(--muted); }
.compact-list small, td small { display: block; color: var(--muted); margin-top: 3px; }
#events li { justify-content: flex-start; }
time { color: var(--muted); }
.filters, form { display: flex; flex-wrap: wrap; align-items: end; gap: 10px; margin: 14px 0; }
.filters input { min-width: 205px; flex: 1; }
form label { display: grid; gap: 5px; font-size: 13px; color: var(--muted); }
form label:has([type=checkbox]) { display: flex; align-items: center; padding-bottom: 7px; }
.table-wrap { overflow: auto; }
table { width: 100%; border-collapse: collapse; text-align: left; font-size: 13px; min-width: 590px; }
th { background: #19385c; color: #bdcadd; font-weight: 650; }
th, td { padding: 11px 12px; border-bottom: 1px solid var(--line); }
details { margin-top: 16px; }
summary { cursor: pointer; color: var(--accent); font-weight: 650; }
[hidden] { display: none !important; }
@media (max-width: 1050px) {
  .overview-grid { grid-template-columns: 1fr; }
  .fleet-metrics { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}
@media (max-width: 760px) {
  body { grid-template-columns: 1fr; }
  aside { position: static; height: auto; padding: 12px; }
  nav { display: flex; flex-wrap: wrap; margin-top: 10px; }
  nav p, .sidebar-foot { display: none; }
  nav a { padding: 6px 8px; }
  main { padding: 0 15px 24px; }
  .topbar { margin: 0 -15px; padding: 8px 15px; }
  .panels { grid-template-columns: 1fr; }
}
@media (max-width: 460px) {
  .page-head, .topbar { align-items: flex-start; flex-direction: column; }
  .metrics { grid-template-columns: 1fr; }
  .toolbar { flex-wrap: wrap; }
}

.topbar-title { display: flex; align-items: center; gap: 12px; }
#sidebar-toggle {
  width: 34px;
  height: 34px;
  display: grid;
  place-items: center;
  padding: 0 0 3px;
  border-color: var(--line);
  background: var(--inset);
  color: var(--accent);
  font-size: 25px;
  line-height: 1;
}
#sidebar-toggle:hover { border-color: var(--accent); }
.page-head { padding-block: 19px 17px; }
.page-head h1 { font-size: clamp(23px, 2.3vw, 32px); }
.fleet-metrics a { position: relative; gap: 7px; padding: 12px 42px 12px 14px; }
.fleet-metrics a > span:not(.metric-icon) { line-height: 1.25; }
.fleet-metrics strong { font-size: 28px; }
.fleet-metrics .metric-icon { position: absolute; top: 11px; right: 11px; width: 27px; height: 27px; font-size: 15px; }
.activity { margin-bottom: 16px; }
.activity label { color: var(--muted); font-size: 13px; }
.activity-grid { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 12px; margin-top: 14px; }
.activity-grid article { background: var(--inset); border: 1px solid var(--line); border-radius: 8px; padding: 12px; min-width: 0; }
.activity-grid h3 { color: var(--muted); font-size: 13px; margin: 0 0 4px; font-weight: 600; }
.activity-grid strong { font-size: 22px; font-variant-numeric: tabular-nums; }
.activity-grid canvas { height: 90px; margin: 8px 0 0; }
.sidebar-compact { grid-template-columns: 64px minmax(0, 1fr); }
.sidebar-compact aside { padding-inline: 9px; align-items: center; }
.sidebar-compact .brand { padding: 0; }
.sidebar-compact .brand > div, .sidebar-compact nav p, .sidebar-compact .sidebar-foot span:last-child { display: none; }
.sidebar-compact nav { margin-top: 18px; }
.sidebar-compact nav a { width: 42px; justify-content: center; position: relative; }
.sidebar-compact nav a span { position: absolute; width: 1px; height: 1px; overflow: hidden; clip-path: inset(50%); white-space: nowrap; }
.sidebar-compact .sidebar-foot .status-dot { margin-right: 0; }
@media (max-width: 760px) {
  .sidebar-compact { grid-template-columns: minmax(0, 1fr); }
  .sidebar-compact aside { flex-direction: row; flex-wrap: wrap; gap: 8px; }
  .sidebar-compact nav { margin-top: 0; }
  .sidebar-compact nav a { width: 34px; }
}
@media (max-width: 550px) {
  .activity-grid { grid-template-columns: 1fr; }
  .activity label { display: grid; gap: 4px; }
  .fleet-metrics a { padding-right: 36px; }
}
