/* Mild dark NOC theme: grey-blue surfaces, not black. */
:root {
  --bg: #24272e;
  --panel: #2c3038;
  --panel-2: #33373f;
  --line: #3d424c;
  --text: #d8dbe1;
  --muted: #8d939e;
  --accent: #5b9df0;
  --ok: #4cb782;
  --bad: #e5655b;
  --warn: #d6a54a;
  --rx: #5b9df0;
  --tx: #c58af0;
  --mono: ui-monospace, "JetBrains Mono", "Cascadia Mono", Consolas, monospace;
  color-scheme: dark;
}
* { box-sizing: border-box; }
html, body { margin: 0; background: var(--bg); color: var(--text); }
body { font: 13.5px/1.45 system-ui, -apple-system, "Segoe UI", Roboto, sans-serif; display: flex; min-height: 100vh; }
a { color: var(--accent); text-decoration: none; }
a:hover { text-decoration: underline; }
code, .mono, td.mono, input.mono { font-family: var(--mono); font-size: 12.5px; }

/* layout */
.side { width: 200px; flex: none; background: var(--panel); border-right: 1px solid var(--line); display: flex; flex-direction: column; position: sticky; top: 0; height: 100vh; }
.side .brand { padding: 14px 16px; font-weight: 600; border-bottom: 1px solid var(--line); }
.side .brand small { display: block; color: var(--muted); font-weight: 400; font-family: var(--mono); font-size: 11.5px; }
.side nav { display: flex; flex-direction: column; padding: 8px; gap: 2px; flex: 1; }
.side nav a { color: var(--muted); padding: 7px 10px; border-radius: 5px; }
.side nav a:hover { background: var(--panel-2); color: var(--text); text-decoration: none; }
.side nav a.on { background: var(--panel-2); color: var(--text); box-shadow: inset 2px 0 var(--accent); }
.side form { padding: 10px; border-top: 1px solid var(--line); }
.side form button { width: 100%; }
main { flex: 1; min-width: 0; padding: 18px 22px 40px; }
h1 { font-size: 17px; font-weight: 600; margin: 0 0 14px; display: flex; gap: 10px; align-items: baseline; flex-wrap: wrap; }
h1 .sub { color: var(--muted); font-size: 12.5px; font-weight: 400; }
h2 { font-size: 13px; font-weight: 600; margin: 0 0 10px; color: var(--text); text-transform: uppercase; letter-spacing: .04em; }

.panel { background: var(--panel); border: 1px solid var(--line); border-radius: 6px; padding: 14px; margin-bottom: 14px; }
.panel.flush { padding: 0; overflow: hidden; }
.panel.flush h2 { padding: 12px 14px 0; }
.grid { display: grid; gap: 14px; }
.g2 { grid-template-columns: repeat(auto-fit, minmax(380px, 1fr)); }
.tiles { display: grid; grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); gap: 10px; margin-bottom: 14px; }
.tile { background: var(--panel); border: 1px solid var(--line); border-radius: 6px; padding: 10px 12px; }
.tile .k { color: var(--muted); font-size: 11.5px; text-transform: uppercase; letter-spacing: .04em; }
.tile .v { font-family: var(--mono); font-size: 21px; margin-top: 2px; font-variant-numeric: tabular-nums; }
.tile .s { color: var(--muted); font-family: var(--mono); font-size: 11.5px; }
.bar { height: 4px; background: var(--panel-2); border-radius: 2px; margin-top: 6px; overflow: hidden; }
.bar i { display: block; height: 100%; background: var(--accent); width: 0; }
.bar i.warn { background: var(--warn); } .bar i.bad { background: var(--bad); }

/* tables */
.scroll { overflow-x: auto; }
table { width: 100%; border-collapse: collapse; }
th, td { text-align: left; padding: 6px 10px; border-bottom: 1px solid var(--line); white-space: nowrap; vertical-align: middle; }
th { color: var(--muted); font-weight: 500; font-size: 11.5px; text-transform: uppercase; letter-spacing: .04em; background: var(--panel-2); position: sticky; top: 0; }
tbody tr:hover td { background: #30343c; }
td.num, th.num { text-align: right; font-family: var(--mono); font-variant-numeric: tabular-nums; }
td.wrap { white-space: normal; word-break: break-all; }
.empty { color: var(--muted); padding: 14px; }

/* status */
.pill { display: inline-block; padding: 0 7px; border-radius: 3px; font-size: 11.5px; font-family: var(--mono); border: 1px solid currentColor; line-height: 18px; }
.ok { color: var(--ok); } .bad { color: var(--bad); } .warn { color: var(--warn); } .muted { color: var(--muted); }
.dot { display: inline-block; width: 7px; height: 7px; border-radius: 50%; background: currentColor; margin-right: 6px; }

/* forms */
input, select, textarea, button { font: inherit; color: var(--text); }
input, select, textarea { background: var(--bg); border: 1px solid var(--line); border-radius: 4px; padding: 5px 8px; min-width: 0; }
input:focus, select:focus, textarea:focus { outline: 1px solid var(--accent); border-color: var(--accent); }
textarea { width: 100%; font-family: var(--mono); font-size: 12.5px; }
button, .btn { background: var(--panel-2); border: 1px solid var(--line); border-radius: 4px; padding: 5px 12px; cursor: pointer; color: var(--text); display: inline-block; }
button:hover, .btn:hover { border-color: var(--muted); text-decoration: none; }
button.primary { background: #3b6fb0; border-color: #3b6fb0; color: #fff; }
button.primary:hover { background: #4579bb; }
button.danger { color: var(--bad); }
button.sm { padding: 1px 8px; font-size: 12px; }
button:disabled { opacity: .5; cursor: wait; }
.form-row { display: flex; gap: 8px; flex-wrap: wrap; align-items: flex-end; }
.form-row label { display: flex; flex-direction: column; gap: 3px; color: var(--muted); font-size: 11.5px; }
.inline { display: inline; margin: 0; }
h2 .sub { color: var(--muted); font-weight: 400; text-transform: none; letter-spacing: 0; font-size: 12px; }
.stack { display: flex; flex-direction: column; gap: 10px; margin-bottom: 8px; }
.stack label { display: flex; flex-direction: column; gap: 3px; color: var(--muted); font-size: 11.5px; }
.stack label > span { font-size: 11px; }
.tiles.ports { grid-template-columns: repeat(auto-fill, minmax(230px, 1fr)); }
.tiles.ports .s { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.filters { display: flex; gap: 8px; margin-bottom: 10px; flex-wrap: wrap; }

pre.out { background: #1e2126; border: 1px solid var(--line); border-radius: 4px; padding: 10px 12px; margin: 10px 0 0; font-family: var(--mono); font-size: 12.5px; white-space: pre; overflow: auto; max-height: 520px; min-height: 40px; }
pre.out.tall { max-height: 75vh; }
.flash { padding: 8px 12px; border-radius: 4px; margin-bottom: 12px; border: 1px solid currentColor; background: var(--panel); }
.demo { background: #3a3424; color: var(--warn); padding: 4px 10px; border-radius: 4px; font-size: 12px; margin-bottom: 12px; display: inline-block; }
.legend { display: flex; gap: 14px; font-size: 12px; color: var(--muted); }
.legend b { font-family: var(--mono); font-weight: 500; color: var(--text); }
.sw { display: inline-block; width: 10px; height: 3px; vertical-align: middle; margin-right: 5px; }
canvas.spark { width: 100%; height: 120px; display: block; margin-top: 8px; }
.note { color: var(--muted); font-size: 12px; margin: 6px 0 0; }
.tabs { display: flex; gap: 4px; flex-wrap: wrap; margin-bottom: 10px; }
.tabs a { padding: 4px 10px; border: 1px solid var(--line); border-radius: 4px; color: var(--muted); font-family: var(--mono); font-size: 12px; }
.tabs a.on { color: var(--text); border-color: var(--accent); }

@media (max-width: 760px) {
  body { flex-direction: column; }
  .side { width: auto; height: auto; position: static; }
  .side nav { flex-direction: row; flex-wrap: wrap; }
  main { padding: 14px 16px; }
  .g2 { grid-template-columns: 1fr; }
}

.bulkbar { display: flex; gap: 8px; flex-wrap: wrap; align-items: center; padding: 8px 12px; }
.bulkbar label { display: flex; gap: 6px; align-items: center; color: var(--muted); font-size: 11.5px; }
.bulkbar .sep { width: 1px; align-self: stretch; background: var(--line); margin: 0 4px; }

.cores { display: flex; gap: 6px; flex-wrap: wrap; }
.core { width: 34px; text-align: center; }
.cbar { height: 56px; background: var(--line); border-radius: 3px; position: relative; overflow: hidden; }
.cbar i { position: absolute; left: 0; right: 0; bottom: 0; background: var(--accent); transition: height .4s; }
.cbar i.warn { background: var(--warn); } .cbar i.bad { background: var(--bad); }
.core .cl { font-family: var(--mono); font-size: 10.5px; color: var(--muted); line-height: 15px; }
.core .cl.warn { color: var(--warn); } .core .cl.bad { color: var(--bad); }

a.tile { color: inherit; text-decoration: none; } a.tile:hover { border-color: var(--muted); } .tile.sel { border-color: var(--accent); }

.side nav .navhead { color: var(--muted); padding: 7px 10px 2px; font-size: 11px; text-transform: uppercase; letter-spacing: .06em; opacity: .7; }
.side nav a.navsub { padding-left: 22px; }

.term { min-height: 380px; white-space: pre-wrap; } .term .ok { color: var(--accent); } .term .bad { color: var(--bad); }
.chips { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 10px; } .chip { font-family: var(--mono); font-size: 11.5px; }

.badge { display: inline-block; min-width: 16px; padding: 0 5px; border-radius: 8px; background: var(--bad); color: #fff; font-size: 10.5px; line-height: 16px; text-align: center; }
.checks { display: grid; grid-template-columns: repeat(auto-fill, minmax(300px, 1fr)); gap: 6px 14px; } .checks label { display: flex; gap: 6px; align-items: center; color: var(--text); font-size: 12.5px; }

table.text td { white-space: normal; vertical-align: top; }
.side nav { overflow-y: auto; }
.side nav button.navhead { all: unset; box-sizing: border-box; cursor: pointer; display: flex; align-items: center; gap: 6px; color: var(--muted);
  padding: 7px 10px; border-radius: 5px; }
.side nav button.navhead:hover { background: var(--panel-2); color: var(--text); }
.side nav button.navhead:focus-visible { outline: 1px solid var(--accent); }
.side nav button.navhead .arrow { display: inline-block; width: 10px; font-size: 10px; transition: transform .15s ease-out; }
.side nav button.navhead.open .arrow { transform: rotate(90deg); }
.side nav .navgroup { display: flex; flex-direction: column; gap: 2px; }
.side nav .navgroup[hidden] { display: none; }
@media (prefers-reduced-motion: reduce) { .side nav button.navhead .arrow { transition: none; } }
