/* Netvizo dashboard — functional styling, light/dark tokens. */
:root {
  color-scheme: light;
  --bg: #f6f6f4; --surface: #fcfcfb; --surface-2: #f0efec; --border: #e2e1dc;
  --text: #0b0b0b; --text-2: #52514e; --text-3: #7a7974; --link: #1c5cab;
  --series-1: #2a78d6; --series-2: #eb6834; --series-3: #1baf7a; --series-4: #eda100; --series-5: #e87ba4;
  --good: #0ca30c; --warning: #fab219; --serious: #ec835a; --critical: #d03b3b; --unknown: #8a8984;
  --band: rgba(208, 59, 59, .10); --grid: #ebeae6;
  --radius: 6px; --font: system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  --mono: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    color-scheme: dark;
    --bg: #121211; --surface: #1a1a19; --surface-2: #242422; --border: #33332f;
    --text: #f0efec; --text-2: #c3c2b7; --text-3: #8f8e86; --link: #86b6ef;
    --series-1: #3987e5; --series-2: #d95926; --series-3: #199e70; --series-4: #c98500; --series-5: #d55181;
    --band: rgba(230, 103, 103, .14); --grid: #2b2b28;
  }
}
:root[data-theme="dark"] {
  color-scheme: dark;
  --bg: #121211; --surface: #1a1a19; --surface-2: #242422; --border: #33332f;
  --text: #f0efec; --text-2: #c3c2b7; --text-3: #8f8e86; --link: #86b6ef;
  --series-1: #3987e5; --series-2: #d95926; --series-3: #199e70; --series-4: #c98500; --series-5: #d55181;
  --band: rgba(230, 103, 103, .14); --grid: #2b2b28;
}
* { box-sizing: border-box; }
body { margin: 0; background: var(--bg); color: var(--text); font: 14px/1.45 var(--font); }
a { color: var(--link); text-decoration: none; }
a:hover { text-decoration: underline; }
h1 { font-size: 20px; margin: 0 0 16px; }
h2 { font-size: 15px; margin: 0 0 10px; }
h3 { font-size: 13px; margin: 0 0 6px; color: var(--text-2); font-weight: 600; }
code, .mono { font-family: var(--mono); font-size: 12px; }
.muted { color: var(--text-3); }
.small { font-size: 12px; }

header.top { display: flex; align-items: center; gap: 20px; padding: 10px 16px; background: var(--surface);
  border-bottom: 1px solid var(--border); flex-wrap: wrap; }
header.top .brand { font-weight: 700; letter-spacing: .3px; color: var(--text); }
header.top nav { display: flex; gap: 14px; flex-wrap: wrap; }
header.top nav a { color: var(--text-2); padding: 4px 0; }
header.top nav a.active { color: var(--text); font-weight: 600; border-bottom: 2px solid var(--series-1); }
header.top .user { margin-left: auto; display: flex; gap: 10px; align-items: center; color: var(--text-3); }
main { max-width: 1280px; margin: 0 auto; padding: 20px 16px 48px; }

.card { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); padding: 14px 16px; }
.grid { display: grid; gap: 14px; }
.grid.cols-4 { grid-template-columns: repeat(auto-fit, minmax(160px, 1fr)); }
.grid.cols-2 { grid-template-columns: repeat(auto-fit, minmax(420px, 1fr)); }
@media (max-width: 520px) { .grid.cols-2 { grid-template-columns: 1fr; } }
.stack > * + * { margin-top: 14px; }
.row { display: flex; gap: 10px; align-items: center; flex-wrap: wrap; }
.spacer { flex: 1; }

.tile .value { font-size: 28px; font-weight: 650; }
.tile .label { color: var(--text-2); }

.status { display: inline-flex; align-items: center; gap: 6px; font-weight: 600; white-space: nowrap; }
.status::before { content: ""; width: 10px; height: 10px; border-radius: 50%; background: var(--unknown); flex: none; }
.status.healthy::before { background: var(--good); }
.status.degraded::before { background: var(--warning); }
.status.warning::before { background: var(--warning); }
.status.offline::before, .status.critical::before, .status.fail::before { background: var(--critical); }
.status.unavailable::before { background: var(--serious); }
.status.resolved::before { background: var(--good); }
.status .icon { font-size: 11px; }

table { width: 100%; border-collapse: collapse; }
th, td { text-align: left; padding: 7px 8px; border-bottom: 1px solid var(--border); vertical-align: top; }
th { color: var(--text-2); font-weight: 600; font-size: 12px; text-transform: uppercase; letter-spacing: .3px; }
tr:last-child td { border-bottom: 0; }
.table-wrap { overflow-x: auto; }
td.num, th.num { text-align: right; font-variant-numeric: tabular-nums; }

.btn { display: inline-block; padding: 6px 12px; border-radius: var(--radius); border: 1px solid var(--border);
  background: var(--surface-2); color: var(--text); cursor: pointer; font: inherit; }
.btn:hover { border-color: var(--text-3); text-decoration: none; }
.btn.primary { background: var(--series-1); border-color: var(--series-1); color: #fff; }
.btn.danger { color: var(--critical); }
.btn.small { padding: 3px 8px; font-size: 12px; }
.seg { display: inline-flex; border: 1px solid var(--border); border-radius: var(--radius); overflow: hidden; }
.seg button { border: 0; border-right: 1px solid var(--border); background: var(--surface); color: var(--text-2); padding: 5px 12px; cursor: pointer; font: inherit; }
.seg button:last-child { border-right: 0; }
.seg button[aria-pressed="true"] { background: var(--surface-2); color: var(--text); font-weight: 600; }

form.stack label, .field label { display: block; font-weight: 600; margin-bottom: 4px; color: var(--text-2); font-size: 12px; }
input, select, textarea { font: inherit; color: var(--text); background: var(--surface); border: 1px solid var(--border);
  border-radius: var(--radius); padding: 6px 8px; width: 100%; }
textarea { font-family: var(--mono); font-size: 12px; min-height: 260px; }
.inline-form { display: inline; }
.flash { padding: 10px 12px; border-radius: var(--radius); border: 1px solid var(--border); background: var(--surface-2); }
.flash.error { border-color: var(--critical); }
.flash.ok { border-color: var(--good); }
.secret { font-family: var(--mono); word-break: break-all; background: var(--surface-2); padding: 8px; border-radius: var(--radius); }

.chart-card { position: relative; }
.chart-card .meta { color: var(--text-3); font-size: 12px; margin: -4px 0 8px; }
.chart-box { position: relative; height: 220px; }
.legend { display: flex; gap: 14px; flex-wrap: wrap; font-size: 12px; color: var(--text-2); margin-bottom: 6px; }
.legend span::before { content: ""; display: inline-block; width: 14px; height: 2px; vertical-align: middle; margin-right: 6px; background: var(--c); }
details.data summary { cursor: pointer; color: var(--text-3); font-size: 12px; margin-top: 8px; }
details.data table { font-size: 12px; }
.empty { color: var(--text-3); padding: 20px 0; text-align: center; }
.evidence { font-family: var(--mono); font-size: 12px; white-space: pre-wrap; background: var(--surface-2); padding: 10px; border-radius: var(--radius); overflow-x: auto; }
.timeline { list-style: none; padding: 0; margin: 0; }
.timeline li { padding: 6px 0; border-bottom: 1px solid var(--border); }
.tabs { display: flex; gap: 4px; border-bottom: 1px solid var(--border); margin-bottom: 16px; flex-wrap: wrap; }
.tabs a { padding: 8px 12px; color: var(--text-2); border-bottom: 2px solid transparent; }
.tabs a.active { color: var(--text); border-color: var(--series-1); font-weight: 600; }
.login { max-width: 360px; margin: 10vh auto; }

.nowrap { white-space: nowrap; }
/* Box role form: one line where there is room, wrapped on phones. */
.role-form { flex-wrap: wrap; }
@media (min-width: 1100px) { .role-form { flex-wrap: nowrap; } }

/* Account: two-factor setup and recovery codes. */
.steps { margin: 0; padding-left: 20px; }
.steps > li + li { margin-top: 12px; }
.qr { margin: 8px 0; }
.qr svg { display: block; width: 196px; height: 196px; border-radius: 4px; }
.codes { display: grid; grid-template-columns: repeat(2, max-content); gap: 4px 24px; font-size: 14px; }

/* Count tiles that filter the box list. */
a.tile.filter { display: block; color: inherit; }
a.tile.filter:hover { text-decoration: none; border-color: var(--text-3); }
a.tile.filter.on { border-color: var(--series-1); box-shadow: inset 0 0 0 1px var(--series-1); }

/* "?" explanation on hover or tap, instead of a paragraph on the page. */
.help { position: relative; display: inline-flex; align-items: center; justify-content: center; width: 16px; height: 16px;
  border-radius: 50%; border: 1px solid var(--border); color: var(--text-3); font-size: 11px; font-weight: 600;
  cursor: help; vertical-align: middle; margin-left: 4px; text-transform: none; letter-spacing: 0; }
.help:hover, .help:focus { color: var(--text); border-color: var(--text-3); outline: none; }
.help:hover::after, .help:focus::after { content: attr(data-tip); position: absolute; left: -8px; top: calc(100% + 6px); z-index: 20;
  width: max-content; max-width: min(360px, 80vw); padding: 8px 10px; border-radius: var(--radius);
  background: var(--surface); border: 1px solid var(--border); box-shadow: 0 4px 14px rgba(0, 0, 0, .12);
  color: var(--text); font-size: 12px; font-weight: 400; line-height: 1.45; white-space: normal; text-align: left; }
details > summary { cursor: pointer; }
@media (max-width: 520px) {
  .grid.tiles { grid-template-columns: repeat(3, 1fr); gap: 8px; }
  .grid.tiles .tile { padding: 8px 10px; }
  .grid.tiles .tile .value { font-size: 20px; }
  .grid.tiles .tile .label { font-size: 12px; }
}
details.row-more { margin-top: 4px; }
details.row-more > summary { color: var(--text-3); }
details.row-more[open] > div { margin-top: 6px; }
