:root {
  color-scheme: dark;
  --night: #100e16;
  --panel: #181321;
  --border: #51455c;
  --text: #f7f1fa;
  --muted: #bdb1c7;
  --rose: #f782ba;
  --lilac: #a997ff;
  --apricot: #ffad7b;
  --online: #7edca8;
  --radius: 8px;
  --rail: 202px;
  font: 400 15px/1.5 system-ui, -apple-system, "Segoe UI", sans-serif;
  background: var(--night);
  color: var(--text);
}
* { box-sizing: border-box; }
body { margin: 0; }
[hidden] { display: none !important; }
a { color: inherit; text-decoration: none; }
:focus-visible { outline: 2px solid var(--rose); outline-offset: 4px; }
button, input, select { font: inherit; }
button { cursor: pointer; }
button:disabled { opacity: .66; cursor: wait; }
button, input, select { min-height: 44px; }
button { color: var(--text); }
h1, h2, p { margin: 0; }
h1 { letter-spacing: -.035em; font-size: clamp(28px, 3.8vw, 50px); line-height: 1.13; }
h2 { font-size: 18px; letter-spacing: -.025em; }
input, select {
  color: var(--text); background: var(--night); border: 1px solid var(--border);
  border-radius: 6px; padding: .6rem .8rem; min-width: 0;
}
form label { display: grid; gap: .35rem; font-size: .88rem; font-weight: 560; }
.quiet, .primary, .danger {
  border-radius: 6px; padding: .6rem 1rem; font-weight: 680; border: 1px solid var(--border);
  background: var(--panel); transition: border-color 150ms, background-color 150ms;
}
.quiet:hover { border-color: var(--rose); }
.primary { background: var(--rose); color: #24131d; border-color: transparent; }
.danger { background: var(--apricot); color: #26170d; border-color: transparent; }
.access {
  min-height: 100vh; min-height: 100svh; display: flex; align-items: center;
  background: linear-gradient(90deg, var(--night) 0%, #100e16f7 33%, #100e1660 75%, #100e1610),
    url("/assets/night-district.jpg") 78% center / cover no-repeat;
  padding: max(32px, env(safe-area-inset-top)) clamp(24px, 8vw, 160px) max(40px, env(safe-area-inset-bottom));
}
.access-panel { width: min(100%, 375px); }
.access-brand, .signature { display: flex; align-items: center; gap: 6px; font-weight: 830; letter-spacing: .15em; }
.access-brand { margin-left: -10px; font-size: 24px; margin-bottom: 22px; }
.access-brand img, .signature img { border-radius: 6px; flex-shrink: 0; }
.access h1 { font-size: clamp(34px, 4vw, 46px); margin-bottom: 25px; }
form:not(.filters) { display: grid; gap: 14px; }
.notice { color: var(--apricot); font-size: .9rem; }
.notice:empty { display: none; }
.app { display: grid; grid-template-columns: var(--rail) minmax(0, 1fr); grid-template-rows: auto 1fr; min-height: 100vh; }
.topbar {
  display: flex; gap: 8px; align-items: center; justify-content: space-between; grid-column: 1/-1;
  border-bottom: 1px solid var(--border); padding: 8px 22px 8px 14px; min-height: 62px; background: var(--night);
  position: sticky; top: 0; z-index: 2;
}
.signature { font-size: 21px; }
.top-actions, .form-actions { display: flex; gap: 10px; align-items: center; flex-wrap: wrap; }
.network-status {
  display: inline-flex; align-items: center; gap: 7px; color: var(--muted); font-size: 13px; padding-right: 6px;
}
.network-status::before { content: ""; display: block; width: 7px; height: 7px; border-radius: 50%; background: var(--apricot); }
.network-status[data-state="online"]::before { background: var(--online); }
.power { color: var(--apricot); }
.nav { padding: 12px 8px; border-right: 1px solid var(--border); }
.nav button {
  display: flex; align-items: center; gap: 10px; width: 100%; background: transparent;
  border: 1px solid transparent; border-radius: 6px; text-align: left; padding: 6px 11px;
}
.nav button + button { margin-top: 3px; }
.nav button span { font-size: 22px; width: 24px; text-align: center; }
.nav button b { font-size: 14px; font-weight: 550; }
.nav .mobile-label { display: none; }
.nav button[aria-current="page"] { background: #35263e; border-color: #57405d; box-shadow: inset 2px 0 var(--rose); }
.nav button:hover { background: #241b2d; }
.workspace { width: 100%; min-width: 0; }
.host-photo {
  background: linear-gradient(90deg, #100e16ed, #100e1648 78%), url("/assets/night-district.jpg") 58% 47% / cover;
  border-bottom: 1px solid var(--border); min-height: 192px; padding: clamp(18px, 3vw, 35px);
  display: flex; align-items: end; justify-content: space-between; flex-wrap: wrap; gap: 12px;
}
.host-photo h1 { font-size: clamp(40px, 5.8vw, 73px); }
.host-photo p { margin-top: 5px; font-weight: 620; }
dl { margin: 0; }
.host-photo dl { display: grid; row-gap: 4px; font-size: .86rem; }
.host-photo dl div { display: grid; grid-template-columns: minmax(7.5rem, auto) auto; gap: 8px; }
dt { color: var(--muted); }
dd { margin: 0; font-variant-numeric: tabular-nums; }
.metrics, .strip { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); }
.metrics { gap: 8px; }
.metrics, .chart, .strip { margin: 12px 16px; }
.panel, .metric {
  border: 1px solid var(--border); border-radius: var(--radius);
  background: linear-gradient(158deg, #1c1624, var(--panel));
}
.metric { padding: 10px 12px; --indicator: var(--rose); }
.metric.apricot { --indicator: var(--apricot); }
.metric.lilac { --indicator: var(--lilac); }
.metric > span, .metric small { color: var(--muted); font-size: .83rem; display: block; }
.metric strong { display: block; font-size: clamp(19px, 3vw, 27px); font-variant-numeric: tabular-nums; margin: 3px 0; letter-spacing: -.035em; }
progress {
  display: block; height: 5px; border: 0; width: 100%; margin-top: 5px; appearance: none;
  background: #31273a; border-radius: 6px; color: var(--indicator);
}
progress::-webkit-progress-bar { background: #31273a; border-radius: 6px; }
progress::-webkit-progress-value { background: var(--indicator); border-radius: 6px; }
progress::-moz-progress-bar { background: var(--indicator); border-radius: 6px; }
progress:not([value]) { opacity: .5; }
progress:not([value])::-webkit-progress-value { background: transparent; }
.chart { padding: 10px 14px; }
.overview-alert-panel { margin: 12px 16px; padding: 10px 14px; }
.overview-alert-panel .section-head > p { font-size: .81rem; }
#overview-alert-list {
  margin: 8px 0 0; padding: 0; list-style: none; display: grid;
  grid-template-columns: repeat(auto-fit, minmax(min(100%, 215px), 1fr)); gap: 8px;
}
#overview-alert-list li { display: grid; gap: 2px; border-left: 2px solid var(--apricot); padding: 4px 9px; overflow-wrap: anywhere; }
#overview-alert-list li[data-severity="critical"] { border-color: var(--rose); }
#overview-alert-list small { color: var(--muted); font-size: .79rem; }
#overview-alert-list .overview-alert-severity { color: var(--apricot); }
#overview-alert-list li[data-severity="critical"] .overview-alert-severity { color: var(--rose); }
.section-head { display: flex; align-items: center; justify-content: space-between; flex-wrap: wrap; gap: 10px; }
.legend { display: flex; gap: 13px; color: var(--muted); font-size: 13px; }
.legend span { display: flex; align-items: center; gap: 5px; }
.legend span::before { content: ""; width: 13px; height: 2px; background: var(--rose); }
.legend span + span::before { background: none; height: 0; border-top: 2px dashed var(--lilac); }
canvas { display: block; width: 100%; height: clamp(165px, 26vh, 268px); margin-top: 10px; }
.chart-status { color: var(--muted); font-size: 13px; min-height: 20px; }
.strip button { display: grid; text-align: left; background: transparent; border: 0; padding: 9px 12px; }
.strip button + button { border-left: 1px solid var(--border); }
.strip span { color: var(--muted); font-size: .83rem; }
.strip strong { font-size: .91rem; font-variant-numeric: tabular-nums; }
.strip button:hover { background: #2b1e32; }
.detail { padding: 20px 16px; }
.detail h1 { margin-bottom: 16px; }
.detail h2:not(:first-child) { margin-top: 18px; margin-bottom: 6px; }
.detail .chart { margin: 12px 0; }
.detail .panel:not(.chart) { margin-bottom: 10px; padding: 10px 12px; }
.records { display: grid; gap: 8px; }
.record { display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: 6px 14px; }
.record strong { overflow-wrap: anywhere; }
.record small { color: var(--muted); }
.record .summary { text-align: right; font-variant-numeric: tabular-nums; }
.network-targets > summary { cursor: pointer; min-height: 44px; padding: 9px 0; font-weight: 650; }
.detail .network-targets .record { background: transparent; border: 0; border-top: 1px solid var(--border);
  border-radius: 0; margin: 0; padding: 9px 0; }
.network-targets .summary { max-width: 11em; overflow-wrap: anywhere; }
.note { color: var(--muted); }
.hardware-status { margin-bottom: 12px; font-size: .87rem; font-variant-numeric: tabular-nums; }
.hardware-overview, .hardware-disk-grid {
  display: grid; grid-template-columns: repeat(auto-fit, minmax(min(100%, 320px), 1fr));
  gap: 12px; align-items: start;
}
.hardware-overview .hardware-panel, .hardware-disk-grid .hardware-disk { min-width: 0; margin: 0; }
.hardware-model, .hardware-disk h3 { overflow-wrap: anywhere; font-weight: 680; }
.hardware-model { margin: 6px 0 12px; color: var(--lilac); }
.hardware-disk h3, .hardware-disk h4, #hardware-memory-processes h3 { font-size: .95rem; margin: 7px 0 3px; }
.hardware-values {
  display: grid; grid-template-columns: repeat(auto-fit, minmax(min(100%, 125px), 1fr));
  gap: 9px 14px; margin: 10px 0; font-variant-numeric: tabular-nums;
}
.hardware-values :is(dt, small), .hardware-core-stats span, .hardware-mounts small {
  color: var(--muted); font-size: .83rem;
}
.hardware-values dd { margin: 0; font-weight: 690; line-height: 1.35; overflow-wrap: anywhere; }
.hardware-values small, .hardware-cores small, .hardware-mounts small {
  display: block; color: var(--muted); font-weight: 400; overflow-wrap: anywhere;
}
.hardware-cores, .hardware-mounts { list-style: none; padding: 0; margin: 10px 0; }
.hardware-cores li, .hardware-mounts li {
  padding: 7px 0; border-top: 1px solid var(--border); overflow-wrap: anywhere;
}
.hardware-cores li {
  display: grid; grid-template-columns: minmax(66px, .7fr) minmax(0, 3fr); gap: 6px 9px;
  align-items: baseline; font-variant-numeric: tabular-nums;
}
.hardware-cores li progress { grid-column: 1 / -1; height: 4px; accent-color: var(--rose); }
.hardware-core-stats { display: flex; justify-content: end; flex-wrap: wrap; gap: 4px 10px; }
#hardware-top-memory li { display: flex; justify-content: space-between; gap: 8px; }
#hardware-top-memory strong { flex-shrink: 0; font-variant-numeric: tabular-nums; }
.hardware-history :is(h2, .filters) { margin-bottom: 8px; }
.hardware-history canvas { touch-action: pan-y; }
.hardware-load { border-bottom: 1px solid var(--border); padding-bottom: 9px; }
#hardware-history-state { font-size: .84rem; }
.service-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(min(100%, 285px), 1fr)); gap: 12px; }
.service-grid .service-card { min-width: 0; margin-bottom: 0; }
#view-services section > h2 { margin: 12px 0 8px; }
.service-card h3, .service-card p, .service-card dd { overflow-wrap: anywhere; }
.service-card h3 { margin: 0; font-size: .95rem; }
.service-card-head { align-items: start; margin-bottom: 5px; }
.service-card p, #services-state { font-size: .86rem; }
.service-scope { color: var(--muted); margin: 4px 0 5px; }
.service-state { font-size: .8rem; color: var(--muted); }
.service-state[data-state="active"] { color: var(--online); }
.service-state[data-state="failed"], .service-failure { color: var(--apricot); }
#services-history :is(h3, .filters) { margin: 8px 0; }
#services-history h3 { font-size: .98rem; }
#services-history canvas { touch-action: pan-y; }
#services-history select { width: 100%; }
.service-events { padding: 0; margin: 8px 0 0; list-style: none; }
.service-events li { padding: 6px 0; border-top: 1px solid var(--border); display: flex; flex-wrap: wrap; justify-content: space-between; gap: 6px 12px; }
.service-events small { color: var(--muted); }
.filters { display: flex; flex-wrap: wrap; gap: 10px; padding-bottom: 6px; }
.filters label { flex: 1 1 160px; }
dialog {
  color: var(--text); background: var(--panel); border: 1px solid var(--border); border-radius: 14px;
  width: min(90vw, 415px); max-height: 90vh; padding: 24px; box-shadow: 0 18px 90px #000b;
}
dialog::backdrop { background: #09070de0; }
dialog h2 { font-size: 26px; }
dialog .form-actions { justify-content: flex-end; }
.caution { color: var(--apricot); font-size: 30px; line-height: 1; }
@media (max-width: 780px) {
  .app { display: block; padding-bottom: calc(69px + env(safe-area-inset-bottom)); }
  .topbar { padding: max(5px, env(safe-area-inset-top)) 8px 4px; }
  .signature { font-size: 16px; letter-spacing: .115em; gap: 0; }
  .network-status { font-size: 12px; }
  .top-actions { gap: 4px; }
  .top-actions button { font-size: 12px; padding: 5px 7px; }
  .nav {
    display: grid; grid-template-columns: repeat(7, minmax(0, 1fr)); position: fixed; inset: auto 0 0;
    padding: 2px max(2px, env(safe-area-inset-right)) env(safe-area-inset-bottom) max(2px, env(safe-area-inset-left));
    background: #14101b; border: 0; border-top: 1px solid var(--border); z-index: 3;
  }
  .nav button { display: grid; justify-items: center; padding: 2px 0; gap: 0; text-align: center; }
  .nav button + button { margin-top: 0; }
  .nav button span { font-size: 20px; line-height: 1.05; }
  .nav button b { font-size: clamp(9px, 2.2vw, 11px); font-weight: 570; }
  .nav .desktop-label { display: none; }
  .nav .mobile-label { display: inline; }
  .nav button[aria-current="page"] { box-shadow: inset 0 -2px var(--rose); }
  .host-photo { min-height: 140px; padding: 12px max(12px, env(safe-area-inset-left)); align-items: end; gap: 4px; }
  .host-photo dl { font-size: 11px; }
  .host-photo dl div { grid-template-columns: auto auto; }
  .host-photo h1 { font-size: clamp(32px, 9vw, 46px); }
  .metrics { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .metrics, .chart, .strip, .overview-alert-panel { margin: 10px; }
  .strip { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .strip button:nth-child(3) { border-left: 0; }
  .strip button:nth-child(n+3) { border-top: 1px solid var(--border); }
  .access { align-items: end; background-position: 65% center; background-image: linear-gradient(0deg, var(--night) 18%, #100e1680 80%), url("/assets/night-district.jpg"); }
  .access-panel { margin: 0 auto; }
}
@media (max-width: 370px) {
  .topbar { gap: 4px; }
  .signature { font-size: 14px; letter-spacing: .08em; }
  .signature img { width: 28px; height: 28px; }
  .top-actions { flex-wrap: nowrap; }
  .topbar .network-status { gap: 0; padding-right: 0; font-size: 0; }
  .nav button b { overflow-wrap: anywhere; max-width: 100%; }
}
@media (prefers-reduced-motion: reduce) { * { transition: none !important; } }

.storage-status { margin: -4px 0 16px; }
.storage-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(min(100%, 340px), 1fr)); gap: 12px; align-items: start; }
.storage-view .storage-card { padding: clamp(14px, 2vw, 20px); margin: 0; min-width: 0; }
.storage-card-head { display: flex; flex-wrap: wrap; align-items: flex-start; justify-content: space-between; gap: 8px 14px; }
.storage-card-head > div:first-child { min-width: 0; }
.storage-card-head h2 { font-size: clamp(1.05rem, 2.4vw, 1.36rem); overflow-wrap: anywhere; margin: 3px 0 0 !important; }
.storage-type { color: var(--muted); font-size: .81rem; }
.storage-badges { display: flex; flex-wrap: wrap; gap: 6px; }
.storage-badge { border: 1px solid currentColor; border-radius: 7px; padding: 2px 7px; color: var(--muted); font-size: .78rem; }
.storage-badge[data-state="excellent"], .storage-badge[data-state="active"] { color: #97e3c5; }
.storage-badge[data-state="standby"] { color: var(--lilac); }
.storage-badge[data-state="warning"] { color: var(--apricot); }
.storage-badge[data-state="critical"], .storage-badge[data-state="unavailable"] { color: #ff94ad; }
.storage-reading { margin: 12px 0; color: var(--muted); font-size: .86rem; }
.storage-facts { display: grid; grid-template-columns: repeat(auto-fit, minmax(min(100%, 136px), 1fr)); gap: 11px 12px; margin: 12px 0; }
.storage-facts dt { color: var(--muted); font-size: .78rem; }
.storage-facts dd { margin: 3px 0 0; overflow-wrap: anywhere; font-variant-numeric: tabular-nums; }
.storage-wear { display: grid; gap: 6px; margin: 12px 0; --indicator: var(--lilac); }
.storage-wear strong { font-size: .86rem; }
.storage-wear progress { width: 100%; }
.storage-details { border-top: 1px solid var(--border); }
.storage-details summary { cursor: pointer; min-height: 44px; padding: 10px 0; font-size: .88rem; }
.storage-details > p { padding-bottom: 10px; }
.storage-table { overflow-x: auto; margin: 0 0 10px; }
.storage-table table { border-collapse: collapse; width: 100%; font-size: .78rem; }
.storage-table :is(td, th) { padding: 7px 8px; border-bottom: 1px solid var(--border); text-align: left; font-variant-numeric: tabular-nums; }
.storage-table th { color: var(--muted); font-weight: 550; }
.storage-problems { list-style: none; display: grid; gap: 8px; padding: 0; margin: 12px 0; }
.storage-problems li { background: #251c2c; border: 1px solid var(--border); border-radius: 8px; padding: 9px 10px; font-size: .83rem; }
.storage-problems p { margin: 4px 0 0; }
.storage-history .filters { margin-top: 8px; }
#storage-power { border-top: 1px solid var(--border); padding-top: 10px; }
#storage-power h3 { margin: 0 0 6px; font-size: 1rem; }
@media (max-width: 780px) {
  .nav .storage-nav { display: none; }
  .storage-view { padding-left: max(12px, env(safe-area-inset-left)); padding-right: max(12px, env(safe-area-inset-right)); }
}

.history-controls { align-items: start; gap: 12px; }
.history-controls > label { flex: 1 1 180px; min-width: 0; }
.history-controls select { width: 100%; }
.history-dates {
  width: 100%; min-width: 0; margin: 0; padding: 8px 12px 12px;
  border: 1px solid var(--border); border-radius: var(--radius);
  display: flex; align-items: end; flex-wrap: wrap; gap: 10px;
}
.history-dates legend { color: var(--muted); font-size: .8rem; padding: 0 6px; }
.history-dates div { flex: 1 1 190px; min-width: 0; align-self: start; }
.history-dates div label + label { margin-top: 8px; }
.history-dates input { width: 100%; }
.history-toolbar {
  display: flex; align-items: center; justify-content: space-between;
  flex-wrap: wrap; gap: 8px 12px; margin: 10px 0;
}
.history-toolbar p { font-size: .85rem; font-variant-numeric: tabular-nums; }
.history-zoom { display: flex; flex-wrap: wrap; gap: 8px; }
.history-zoom button { min-width: 44px; padding: 6px 10px; }
.history-zoom button:disabled { cursor: default; }
.history-chart-panel { min-width: 0; }
.history-chart-panel canvas { touch-action: pan-y; }
.history-legend { display: flex; flex-wrap: wrap; gap: 8px 18px; font-size: .85rem; }
.history-legend span { display: flex; align-items: center; gap: 6px; overflow-wrap: anywhere; }
.history-legend span::before { content: ""; width: 18px; flex: 0 0 auto; border-top: 2px solid var(--rose); }
.history-legend .history-line-1::before { border-top: 2px dashed var(--lilac); }
.history-legend .history-line-2::before { border-top: 2px dotted var(--apricot); }
@media (max-width: 520px) {
  .history-controls > label { flex-basis: 100%; }
  .history-dates div { flex-basis: 100%; }
  .history-dates button { width: 100%; }
}

.chart h3 { margin: 0; font-size: 1rem; }
#view-network .section-head label { color: var(--muted); font-size: .88rem; }
#view-network .section-head label select { margin-left: 6px; }
#view-network canvas { touch-action: pan-y; }
