:root {
  color-scheme: dark;
  --bg: #0c1016;
  --sidebar: #10151d;
  --panel: #141b25;
  --border: #273140;
  --text: #eef4fc;
  --muted: #a1afc1;
  --mint: #6ee7b7;
  --blue: #8bb9ff;
  --amber: #f5c37b;
  --red: #ff999c;
  --mono: "Cascadia Mono", "SFMono-Regular", Consolas, monospace;
  font-family: "Inter", "Segoe UI", system-ui, sans-serif;
  line-height: 1.45;
}

*, *::before, *::after { box-sizing: border-box; }
body { margin: 0; background: var(--bg); color: var(--text); font-size: 1rem; }
h1, h2, p, ul, dl, dd { margin: 0; }
h1 { font-size: clamp(1.62rem, 3.1vw, 2.1rem); letter-spacing: -.045em; line-height: 1.2; overflow-wrap: anywhere; }
h2 { font-size: 1rem; font-weight: 650; letter-spacing: -.012em; }
a { color: inherit; text-decoration: none; }
button, input, select { font: inherit; }
button { cursor: pointer; }
[hidden] { display: none !important; }
:focus-visible { outline: 2px solid var(--mint); outline-offset: 3px; }
.muted { color: var(--muted); }
.caption { margin-top: .18rem; font-size: .875rem; }
.eyebrow { font-size: .875rem; margin-bottom: .3rem; }
.code { font-family: var(--mono); font-variant-numeric: tabular-nums; }
.body-note { padding: .9rem 1rem; color: var(--muted); overflow-wrap: anywhere; }
.text-link, .text-button { color: var(--blue); font-size: .875rem; }
.text-link:hover { text-decoration: underline; }

.brand { display: flex; align-items: center; gap: .7rem; font-weight: 700; letter-spacing: -.02em; white-space: nowrap; }
.brand-mark { display: inline-flex; align-items: flex-end; justify-content: center; gap: 3px; padding-bottom: 7px; width: 32px; height: 32px; border-radius: 9px; background: #193c35; border: 1px solid #2c574c; }
.brand-mark i { display: block; width: 3px; height: 7px; background: var(--mint); border-radius: 1px; }
.brand-mark i:nth-child(2) { height: 11px; }
.brand-mark i:nth-child(3) { height: 15px; }

.layout { display: grid; grid-template-columns: 195px minmax(0, 1fr); min-height: 100vh; }
.sidebar { position: sticky; top: 0; height: 100vh; display: flex; flex-direction: column; background: var(--sidebar); border-right: 1px solid var(--border); padding: 1.2rem .8rem .9rem; }
.sidebar > .brand { padding-inline: .25rem; margin-bottom: 1.55rem; }
.sidebar nav { display: grid; gap: .3rem; }
.sidebar nav a { display: flex; align-items: center; justify-content: space-between; gap: .45rem; min-height: 38px; padding: .5rem .68rem; color: var(--muted); font-size: .875rem; white-space: nowrap; border: 1px solid transparent; border-radius: 8px; }
.sidebar nav a:is(:hover, [aria-current="page"]) { background: #182431; color: var(--text); }
.sidebar nav a[aria-current="page"] { border-color: #314157; color: var(--mint); }
.nav-count { color: var(--muted); font-family: var(--mono); font-size: .78rem; }
.sidebar-footer { display: grid; gap: .55rem; margin-top: auto; padding: .5rem .25rem 0; font-size: .82rem; }
.signout, .secondary-button { border: 1px solid #344356; border-radius: 8px; background: #18212d; color: var(--text); font-weight: 600; font-size: .875rem; padding: .45rem .75rem; }
.signout:hover, .secondary-button:hover { background: #223044; }
.secondary-button:disabled { opacity: .6; cursor: wait; }
main { min-width: 0; padding: 1.25rem clamp(1rem, 2.4vw, 2.2rem) 2rem; max-width: 1760px; }
.topbar { display: flex; justify-content: space-between; align-items: center; gap: .9rem; margin-bottom: 1.05rem; }
.host-meta { font-size: .875rem; margin-top: .35rem; }
.live-box { display: flex; align-items: center; gap: .85rem; }
.live-details { display: grid; gap: .22rem; justify-items: end; white-space: nowrap; }
.refresh-time { font-family: var(--mono); font-size: .78rem; }
.notice { border: 1px solid #534327; color: var(--amber); background: #231f19; border-radius: 9px; padding: .65rem .85rem; margin-bottom: .85rem; font-size: .875rem; }

.view { display: grid; gap: .85rem; }
.metrics { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: .75rem; }
.metric, .card { background: var(--panel); border: 1px solid var(--border); border-radius: 11px; min-width: 0; }
.metric { --metric-color: var(--text); position: relative; padding: .7rem .9rem; min-height: 112px; overflow: hidden; }
.metric.accent-mint { --metric-color: var(--mint); }
.metric.accent-blue { --metric-color: var(--blue); }
.metric.accent-amber { --metric-color: var(--amber); }
.metric h2 { color: var(--muted); font-size: .875rem; }
.metric-value { color: var(--metric-color); line-height: 1.18; font-size: clamp(1.38rem, 2.7vw, 1.95rem); font-variant-numeric: tabular-nums; font-weight: 650; letter-spacing: -.055em; margin: .22rem 0 .31rem; }
.metric-note { font-size: .82rem; position: relative; z-index: 1; overflow-wrap: anywhere; }
.mini { position: absolute; right: .7rem; top: .62rem; width: 33%; height: 32px; opacity: .78; }
.meter { height: 4px; background: #293342; border-radius: 20px; margin-top: .48rem; overflow: hidden; }
.meter > span { display: block; height: 100%; width: 0; background: var(--metric-color); border-radius: inherit; }

.split { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: .85rem; }
.overview-primary, .overview-secondary { grid-template-columns: minmax(0, 1.78fr) minmax(0, 1fr); }
.systems { grid-template-columns: minmax(0, 1.3fr) minmax(0, 1fr); }
.card-head { display: flex; align-items: center; justify-content: space-between; gap: .7rem; padding: .85rem 1rem; min-height: 55px; }
.card-head.wrap { flex-wrap: wrap; }
.card-head .inline-note, .current-rate { font-size: .8rem; }
.chart { width: calc(100% - 1.2rem); margin: 0 .6rem .45rem; height: 224px; display: block; }
.chart-short { height: 154px; }
.legend { display: flex; gap: .75rem; flex-wrap: wrap; margin-top: .36rem; font-size: .875rem; color: var(--muted); }
.legend span { display: inline-flex; align-items: center; gap: .35rem; }
.legend span::before { content: ""; width: 9px; height: 3px; border-radius: 1px; background: var(--mint); }
.legend .legend-memory::before { background: var(--blue); }
.current-rate { color: var(--muted); font-family: var(--mono); }
.segmented { display: flex; padding: 2px; gap: 2px; background: #0f151e; border: 1px solid var(--border); border-radius: 8px; }
.segmented button { color: var(--muted); background: transparent; border: 0; font-size: .86rem; padding: .28rem .52rem; border-radius: 5px; }
.segmented button[aria-pressed="true"] { color: var(--text); background: #263447; }
.segmented button:hover { color: var(--text); }

.service-list { list-style: none; padding: 0 .95rem .6rem; }
.service-list li { display: flex; justify-content: space-between; align-items: center; gap: .55rem; min-height: 35px; padding: .24rem .05rem; border-top: 1px solid #253040; font-size: .91rem; }
.status { display: inline-flex; align-items: center; gap: .36rem; white-space: nowrap; font-size: .86rem; }
.status > span { width: 7px; height: 7px; border-radius: 50%; background: currentColor; flex-shrink: 0; }
.status.good { color: var(--mint); }
.status.warn { color: var(--amber); }
.status.bad { color: var(--red); }
.status.neutral { color: var(--muted); }

.table-card { min-width: 0; }
.scroll-table { overflow-x: auto; }
table { width: 100%; border-collapse: collapse; font-size: .9rem; }
th { font-weight: 600; color: var(--muted); background: #111821; }
th, td { text-align: left; padding: .49rem .87rem; border-top: 1px solid var(--border); }
tbody tr:hover { background: #192432; }
td { overflow-wrap: anywhere; }
td.code, td.number, td:has(.status), th { white-space: nowrap; }
.filters { display: flex; gap: .5rem; flex-wrap: wrap; }
input, select { background: #101720; border: 1px solid #344356; border-radius: 7px; color: var(--text); padding: .48rem .64rem; font-size: .875rem; }
input::placeholder { color: #8898ab; }
.filters input { width: clamp(10rem, 20vw, 15rem); }
select { appearance: none; padding-right: 2rem; background-image: linear-gradient(45deg, transparent 50%, #a1afc1 50%), linear-gradient(135deg, #a1afc1 50%, transparent 50%); background-size: 5px 5px; background-repeat: no-repeat; background-position: calc(100% - 15px) 55%, calc(100% - 10px) 55%; }
.empty { color: var(--muted); padding: .9rem; text-align: center; }
.account-cards { display: grid; grid-template-columns: repeat(auto-fit, minmax(min(205px, 100%), 1fr)); gap: .75rem; }
.account-card { padding: .7rem .85rem; }
.account-card p { margin-top: .3rem; font-size: .875rem; overflow-wrap: anywhere; }
.cores { padding: 0 1rem .9rem; display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: .42rem 1rem; max-height: 230px; overflow: auto; }
.core { display: grid; grid-template-columns: 3rem minmax(12px, 1fr) 2.7rem; align-items: center; gap: .36rem; font-size: .82rem; }
.core > span { white-space: nowrap; }
.core .meter { margin: 0; --metric-color: var(--mint); }
.core .number { text-align: right; font-family: var(--mono); }
.details { padding: 0 1rem .65rem; }
.details > div { display: flex; align-items: center; justify-content: space-between; gap: .7rem; border-top: 1px solid var(--border); padding: .43rem 0; font-size: .9rem; }
.details dt { color: var(--muted); }
.details dd { text-align: right; font-family: var(--mono); }
.scan-counts { display: flex; gap: .8rem; flex-wrap: wrap; }
.scan-details { max-width: 550px; }
.findings { list-style: none; padding: 0 1rem .6rem; max-height: 30rem; overflow: auto; }
.findings li { display: grid; grid-template-columns: 5.25rem minmax(0, 1fr); gap: .55rem; align-items: start; padding: .5rem 0; border-top: 1px solid var(--border); font-size: .875rem; overflow-wrap: anywhere; }

.login-page { display: grid; place-items: center; padding: 1.15rem; min-height: 100vh; background-color: var(--bg); background-image: radial-gradient(ellipse at 55% 20%, #172d34 0, transparent 53%), linear-gradient(#7292aa0b 1px, transparent 1px), linear-gradient(90deg, #7292aa0b 1px, transparent 1px); background-size: 100% 100%, 32px 32px, 32px 32px; }
.login-panel { width: min(100%, 410px); background: var(--panel); border: 1px solid #334254; border-radius: 15px; padding: clamp(1.2rem, 6vw, 2rem); box-shadow: 0 25px 80px #03060c7a; }
.login-panel .brand { margin-bottom: 1.45rem; }
.login-panel h1 { margin-bottom: .37rem; }
.login-panel form { margin-top: 1.3rem; }
.login-panel label { display: block; font-size: .875rem; font-weight: 600; margin-bottom: .4rem; }
.password-field { display: flex; align-items: center; position: relative; }
.password-field input { width: 100%; min-height: 45px; padding-right: 4rem; font-size: 1rem; }
.password-field .text-button { position: absolute; right: .4rem; border: 0; border-radius: 5px; background: transparent; padding: .35rem .45rem; }
.primary-button { width: 100%; min-height: 44px; margin-top: .9rem; border: 0; border-radius: 7px; background: var(--mint); color: #0b261e; font-weight: 750; font-size: .95rem; }
.primary-button:hover { background: #9ff3ce; }
.form-error { margin-bottom: .72rem; padding: .5rem .65rem; border: 1px solid #673f49; border-radius: 6px; background: #392630; color: var(--red); font-size: .875rem; }

@media (max-width: 1060px) {
  .layout { grid-template-columns: 163px minmax(0, 1fr); }
  .sidebar { padding-inline: .55rem; }
  .metrics { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .overview-primary, .overview-secondary, .systems { grid-template-columns: minmax(0, 1fr); }
}

@media (max-width: 680px) {
  .layout { display: block; }
  .sidebar { position: static; display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: .65rem; height: auto; padding: .65rem .75rem .45rem; border: 0; border-bottom: 1px solid var(--border); }
  .sidebar > .brand { margin: 0; }
  .sidebar-footer { grid-column: 2; grid-row: 1; margin: 0; padding: 0; align-items: center; }
  .sidebar-footer .muted { display: none; }
  .sidebar nav { grid-column: 1 / -1; display: flex; flex-wrap: wrap; padding: 2px; }
  main { padding: .9rem .7rem 1.3rem; }
  .topbar { align-items: start; }
  .live-box { display: grid; gap: .3rem; }
  .live-box button { padding: .26rem .45rem; }
  .live-details { gap: .1rem; }
  .host-meta { line-height: 1.25; }
  .split { grid-template-columns: minmax(0, 1fr); }
  .metric { padding-inline: .68rem; }
  .mini { opacity: .55; width: 27%; }
  .chart { height: 200px; }
  .chart-short { height: 138px; }
  .card-head { padding: .68rem .78rem; }
  .filters { width: 100%; }
  .filters input { flex: 1; min-width: 8.5rem; }
}
