/* netaudit design system. Dark-first: this is looked at in a NOC, often at night. */
:root {
  --bg:        #0b0e14;
  --bg-raised: #111621;
  --bg-hover:  #161d2b;
  --bg-sunken: #080a0f;
  --line:      #1e2635;
  --line-soft: #161d29;
  --fg:        #e4e9f2;
  --fg-muted:  #8b97ad;
  --fg-faint:  #5a6579;
  --accent:    #4c8dff;
  --accent-dim:#1c3c6e;
  --ok:        #3fcf8e;
  --warn:      #f5a524;
  --danger:    #ff5f56;
  --mono: ui-monospace, "SF Mono", SFMono-Regular, Menlo, Consolas, monospace;
  --sans: -apple-system, BlinkMacSystemFont, "Segoe UI", Inter, Roboto, sans-serif;
  --r: 8px;
  --shadow: 0 1px 2px rgba(0,0,0,.4), 0 8px 24px -12px rgba(0,0,0,.6);
}
:root[data-theme="light"] {
  --bg: #f6f7f9; --bg-raised: #fff; --bg-hover: #f0f2f6; --bg-sunken: #eceef2;
  --line: #dfe3ea; --line-soft: #eaedf2; --fg: #131722; --fg-muted: #5d6779;
  --fg-faint: #8b95a7; --accent: #1f6feb; --ok: #1a7f4b; --warn: #a8600a;
  --danger: #c5303a; --shadow: 0 1px 2px rgba(16,24,40,.06), 0 8px 24px -16px rgba(16,24,40,.18);
}
* { box-sizing: border-box; }
html, body { margin: 0; padding: 0; }
body {
  background: var(--bg); color: var(--fg); font-family: var(--sans);
  font-size: 13.5px; line-height: 1.5; -webkit-font-smoothing: antialiased;
  font-variant-numeric: tabular-nums;
}
a { color: var(--accent); text-decoration: none; }
a:hover { text-decoration: underline; }

/* ---------- shell ---------- */
.shell { display: grid; grid-template-columns: 216px 1fr; min-height: 100vh; }
.side {
  background: var(--bg-sunken); border-right: 1px solid var(--line);
  display: flex; flex-direction: column; position: sticky; top: 0; height: 100vh;
}
.brand {
  padding: 16px 18px 14px; font-weight: 650; letter-spacing: -.01em; font-size: 15px;
  display: flex; align-items: center; gap: 9px; border-bottom: 1px solid var(--line-soft);
}
.brand .dot { width: 8px; height: 8px; border-radius: 50%; background: var(--ok); flex: none; }
.brand .dot.stale { background: var(--warn); }
.brand small { display:block; color: var(--fg-faint); font-weight: 450; font-size: 11px; letter-spacing: 0; }
.nav { padding: 10px 8px; display: flex; flex-direction: column; gap: 1px; }
.nav a {
  display: flex; align-items: center; gap: 10px; padding: 7px 10px; border-radius: 6px;
  color: var(--fg-muted); font-weight: 500; font-size: 13px;
}
.nav a:hover { background: var(--bg-hover); color: var(--fg); text-decoration: none; }
.nav a.on { background: var(--bg-raised); color: var(--fg); box-shadow: inset 2px 0 0 var(--accent); }
.nav a svg { width: 15px; height: 15px; opacity: .85; flex: none; }
.nav .grp { padding: 14px 10px 5px; font-size: 10.5px; text-transform: uppercase;
  letter-spacing: .07em; color: var(--fg-faint); font-weight: 600; }
.side-foot { margin-top: auto; padding: 12px 14px; border-top: 1px solid var(--line-soft);
  font-size: 11px; color: var(--fg-faint); }

.main { min-width: 0; display: flex; flex-direction: column; }
.top {
  position: sticky; top: 0; z-index: 20; background: color-mix(in srgb, var(--bg) 88%, transparent);
  backdrop-filter: blur(10px); border-bottom: 1px solid var(--line);
  padding: 12px 22px; display: flex; align-items: center; gap: 14px; flex-wrap: wrap;
}
.top h1 { font-size: 15px; margin: 0; font-weight: 620; letter-spacing: -.01em; }
.top .sp { flex: 1; }
.content { padding: 20px 22px 56px; max-width: 1680px; }

/* ---------- controls ---------- */
.seg { display: inline-flex; background: var(--bg-sunken); border: 1px solid var(--line);
  border-radius: 7px; padding: 2px; gap: 2px; }
.seg a { padding: 4px 10px; border-radius: 5px; font-size: 12px; color: var(--fg-muted); font-weight: 520; }
.seg a:hover { color: var(--fg); text-decoration: none; }
.seg a.on { background: var(--bg-raised); color: var(--fg); box-shadow: var(--shadow); }
.btn {
  display: inline-flex; align-items: center; gap: 7px; padding: 6px 12px; font-size: 12.5px;
  border: 1px solid var(--line); background: var(--bg-raised); color: var(--fg);
  border-radius: 7px; cursor: pointer; font-weight: 520; font-family: inherit;
}
.btn:hover { background: var(--bg-hover); }
.btn.ghost { background: transparent; }
input[type=text], input[type=search], select {
  background: var(--bg-sunken); border: 1px solid var(--line); color: var(--fg);
  border-radius: 7px; padding: 6px 10px; font-size: 12.5px; font-family: inherit; min-width: 0;
}
input:focus, select:focus { outline: 2px solid color-mix(in srgb, var(--accent) 45%, transparent);
  outline-offset: -1px; border-color: var(--accent); }
label.chk { display: inline-flex; align-items: center; gap: 6px; font-size: 12.5px;
  color: var(--fg-muted); cursor: pointer; }

/* ---------- cards & tiles ---------- */
.grid { display: grid; gap: 12px; }
.tiles { grid-template-columns: repeat(auto-fit, minmax(178px, 1fr)); margin-bottom: 16px; }
.card { background: var(--bg-raised); border: 1px solid var(--line); border-radius: var(--r); }
.tile { padding: 13px 15px 14px; }
.tile .k { font-size: 11px; text-transform: uppercase; letter-spacing: .06em;
  color: var(--fg-faint); font-weight: 600; }
.tile .v { font-size: 25px; font-weight: 600; letter-spacing: -.02em; margin-top: 5px; line-height: 1.1; }
.tile .v.none { color: var(--fg-faint); font-weight: 400; }
.tile .s { font-size: 11.5px; color: var(--fg-muted); margin-top: 4px; }
.tile.alarm { border-color: color-mix(in srgb, var(--danger) 45%, var(--line)); }
.tile.alarm .v { color: var(--danger); }
.tile.caution { border-color: color-mix(in srgb, var(--warn) 42%, var(--line)); }

.panel { margin-bottom: 16px; overflow: hidden; }
.panel > header {
  padding: 11px 15px; border-bottom: 1px solid var(--line); display: flex;
  align-items: center; gap: 10px; background: var(--bg-raised);
}
.panel > header h2 { font-size: 13px; margin: 0; font-weight: 620; }
.panel > header .sp { flex: 1; }
.panel > header .meta { font-size: 11.5px; color: var(--fg-faint); }

.notice {
  display: flex; gap: 11px; padding: 12px 14px; border-radius: var(--r);
  border: 1px solid color-mix(in srgb, var(--warn) 40%, var(--line));
  background: color-mix(in srgb, var(--warn) 8%, var(--bg-raised)); margin-bottom: 16px;
}
.notice.bad { border-color: color-mix(in srgb, var(--danger) 45%, var(--line));
  background: color-mix(in srgb, var(--danger) 9%, var(--bg-raised)); }
.notice b { display: block; margin-bottom: 2px; }
.notice p { margin: 0; color: var(--fg-muted); font-size: 12.5px; }
.notice svg { width: 17px; height: 17px; flex: none; margin-top: 1px; }

/* ---------- table ---------- */
.tw { overflow-x: auto; }
table { width: 100%; border-collapse: collapse; font-size: 12.5px; }
thead th {
  position: sticky; top: 0; background: var(--bg-sunken); text-align: left;
  font-size: 10.5px; text-transform: uppercase; letter-spacing: .06em; color: var(--fg-faint);
  font-weight: 600; padding: 8px 12px; border-bottom: 1px solid var(--line); white-space: nowrap;
}
tbody td { padding: 7px 12px; border-bottom: 1px solid var(--line-soft); vertical-align: top; }
tbody tr:hover { background: var(--bg-hover); }
tbody tr:last-child td { border-bottom: 0; }
td.n, th.n { text-align: right; font-variant-numeric: tabular-nums; }
.mono { font-family: var(--mono); font-size: 12px; }
.ts { color: var(--fg-muted); white-space: nowrap; font-variant-numeric: tabular-nums; }
.cmd { font-family: var(--mono); font-size: 12px; word-break: break-word; }
.cmd.cfg { color: var(--fg); }
.muted { color: var(--fg-muted); }
.faint { color: var(--fg-faint); }
.dash { color: var(--fg-faint); }
.right { text-align: right; }
.nowrap { white-space: nowrap; }

.pill {
  display: inline-flex; align-items: center; gap: 5px; padding: 1px 7px; border-radius: 999px;
  font-size: 10.5px; font-weight: 600; letter-spacing: .02em; border: 1px solid transparent;
  text-transform: uppercase; white-space: nowrap;
}
.pill.cfg    { color: var(--accent); background: color-mix(in srgb, var(--accent) 14%, transparent);
               border-color: color-mix(in srgb, var(--accent) 32%, transparent); }
.pill.night  { color: var(--warn);   background: color-mix(in srgb, var(--warn) 14%, transparent);
               border-color: color-mix(in srgb, var(--warn) 32%, transparent); }
.pill.bad    { color: var(--danger); background: color-mix(in srgb, var(--danger) 14%, transparent);
               border-color: color-mix(in srgb, var(--danger) 32%, transparent); }
.pill.ok     { color: var(--ok);     background: color-mix(in srgb, var(--ok) 14%, transparent);
               border-color: color-mix(in srgb, var(--ok) 30%, transparent); }
.pill.flat   { color: var(--fg-muted); background: var(--bg-sunken); border-color: var(--line); }

/* ---------- chart ---------- */
.chart { display: block; width: 100%; height: 108px; }
.chart rect.b { fill: var(--accent); opacity: .85; }
.chart rect.b2 { fill: var(--fg-faint); opacity: .32; }
.chart .ax { stroke: var(--line); stroke-width: 1; }
.chart text { fill: var(--fg-faint); font-size: 9.5px; font-family: var(--sans); }

/* ---------- command palette ---------- */
.pal-bg { position: fixed; inset: 0; background: rgba(0,0,0,.5); backdrop-filter: blur(3px);
  display: none; z-index: 100; }
.pal-bg[open] { display: block; }
.pal { position: fixed; top: 12vh; left: 50%; transform: translateX(-50%); width: min(620px, 92vw);
  background: var(--bg-raised); border: 1px solid var(--line); border-radius: 12px;
  box-shadow: 0 24px 64px -16px rgba(0,0,0,.7); overflow: hidden; }
.pal input { width: 100%; border: 0; border-radius: 0; border-bottom: 1px solid var(--line);
  padding: 14px 16px; font-size: 14px; background: transparent; }
.pal input:focus { outline: none; }
.pal ul { list-style: none; margin: 0; padding: 6px; max-height: 52vh; overflow-y: auto; }
.pal li { padding: 8px 11px; border-radius: 6px; cursor: pointer; display: flex; gap: 10px;
  align-items: baseline; }
.pal li[aria-selected="true"] { background: var(--bg-hover); }
.pal li .t { font-weight: 520; }
.pal li .d { color: var(--fg-faint); font-size: 11.5px; margin-left: auto; }
.pal .empty { padding: 18px 16px; color: var(--fg-faint); font-size: 12.5px; }

.kbd { font-family: var(--mono); font-size: 10.5px; border: 1px solid var(--line);
  background: var(--bg-sunken); border-radius: 4px; padding: 1px 5px; color: var(--fg-faint); }

details.exp > summary { cursor: pointer; list-style: none; }
details.exp > summary::-webkit-details-marker { display: none; }
.sublist { background: var(--bg-sunken); border-left: 2px solid var(--accent); margin: 6px 0 2px;
  border-radius: 0 6px 6px 0; padding: 6px 0; }
.sublist div { padding: 3px 12px; font-family: var(--mono); font-size: 11.5px; display: flex; gap: 12px; }
.sublist div span.t { color: var(--fg-faint); flex: none; }

@media (max-width: 900px) {
  .shell { grid-template-columns: 1fr; }
  .side { position: static; height: auto; flex-direction: row; align-items: center;
    overflow-x: auto; border-right: 0; border-bottom: 1px solid var(--line); }
  .nav { flex-direction: row; padding: 8px; }
  .nav .grp, .side-foot, .brand small { display: none; }
  .content { padding: 14px; }
}

/* Config backups: the stored text, and a diff between two versions. */
pre.cfg { margin:0; padding:14px 16px; font-size:12px; line-height:1.5; overflow:auto; max-height:70vh; white-space:pre; }
pre.diff { margin:0; padding:14px 16px; font-size:12px; line-height:1.5; overflow:auto; max-height:60vh; }
pre.diff .add { display:block; background:rgba(46,160,67,.14); }
pre.diff .del { display:block; background:rgba(248,81,73,.14); }
pre.diff .hunk { display:block; opacity:.6; }
.versions a { display:block; padding:6px 10px; border-radius:6px; }
.versions a.on { background:rgba(127,127,127,.15); font-weight:600; }
