/* MultiGuard dB page. Colours and fonts are variables, so another look is a
   change here; the charts' styles follow devweb's (tools/devweb/static). */
:root {
  --font: system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  --mono: ui-monospace, "Cascadia Mono", Consolas, monospace;
  --bg: #F4F6F7;
  --surface: #FFFFFF;
  --text: #1F2A31;
  --muted: #66737C;
  --border: #D9DFE3;
  --band: #EEF3F6;
  --head: #26333C;
  --head-text: #FFFFFF;
  --accent: #2A78D6;
  --ok: #1BAF7A;
  --warn: #C98A00;
  --bad: #D3423D;
  --slate: #4E5D66;
  --slate-dark: #26333C;
}
[hidden] { display: none !important; }
* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body { margin: 0; background: var(--bg); color: var(--text); font: 14px/1.45 var(--font); }
h1, h2, h3 { margin: 0; font-weight: 600; }
h1 { font-size: 20px; }
h2 { font-size: 16px; margin: 22px 0 8px; }
a { color: var(--accent); }
code, .mono { font-family: var(--mono); }
button, input, select { font: inherit; color: inherit; }

header.top { display: flex; align-items: center; gap: 12px; background: var(--head); color: var(--head-text);
  padding: 10px 20px; position: sticky; top: 0; z-index: 5; }
header.top .brand { color: var(--head-text); text-decoration: none; font-weight: 700; font-size: 16px; }
header.top .spacer { flex: 1 1 auto; }
header.top .who { opacity: .85; font-size: 13px; }
button.link { background: none; border: 0; color: inherit; text-decoration: underline; cursor: pointer; padding: 0; }

main.app { max-width: 1400px; margin: 0 auto; padding: 16px 20px 40px; }
@media (max-width: 680px) { main.app { padding: 12px 16px 32px; } header.top { padding: 10px 16px; } }

.card { background: var(--surface); border: 1px solid var(--border); border-radius: 6px; padding: 14px 16px; }
.row { display: flex; flex-wrap: wrap; align-items: center; gap: 8px 14px; }
.muted { color: var(--muted); }
.error { color: var(--bad); margin: 8px 0; }
.chip { display: inline-block; padding: 1px 8px; border-radius: 10px; background: var(--band); font-size: 12px; }
.chip.ok { background: #DDF3EA; } .chip.warn { background: #FBEFD2; } .chip.bad { background: #F8DEDD; }
.btn { border: 1px solid var(--border); background: var(--surface); border-radius: 5px; padding: 5px 12px; cursor: pointer; }
.btn:hover { border-color: var(--slate); }
.btn.primary { background: var(--accent); border-color: var(--accent); color: #fff; }
.btn[aria-pressed=true] { background: var(--slate-dark); border-color: var(--slate-dark); color: #fff; }
.seg { display: inline-flex; gap: 4px; }

.login { max-width: 340px; margin: 60px auto; }
.login label { display: block; margin: 10px 0 4px; font-size: 13px; color: var(--muted); }
.login input { width: 100%; padding: 7px 9px; border: 1px solid var(--border); border-radius: 5px; background: var(--surface); }
.login .btn { margin-top: 14px; width: 100%; }

.scroll { overflow-x: auto; }
table.grid { border-collapse: collapse; width: 100%; font-size: 13px; background: var(--surface); }
table.grid th { text-align: left; font-weight: 600; color: var(--muted); padding: 7px 10px 7px 0;
  border-bottom: 1px solid var(--border); white-space: nowrap; font-size: 12px; }
table.grid td { padding: 7px 10px 7px 0; border-bottom: 1px solid var(--border); vertical-align: top; }
table.grid td:first-child, table.grid th:first-child { padding-left: 10px; }
table.grid td.num { text-align: right; font-variant-numeric: tabular-nums; }
table.grid td.nw { white-space: nowrap; }
table.grid tr.link { cursor: pointer; }
table.grid tr.link:hover td { background: var(--band); }
table.grid code { font-size: 12px; word-break: break-all; }

dl.facts { display: grid; grid-template-columns: max-content 1fr; gap: 4px 16px; margin: 10px 0 0; }
dl.facts dt { color: var(--muted); }
dl.facts dd { margin: 0; }

/* -- charts, after devweb ------------------------------------------------ */
.charts { display: grid; grid-template-columns: repeat(auto-fill, minmax(460px, 1fr)); gap: 14px; }
@media (max-width: 560px) { .charts { grid-template-columns: minmax(0, 1fr); } }
.chart { background: var(--surface); border: 1px solid var(--border); border-radius: 6px; padding: 10px 12px 6px; min-width: 0; }
.chart h3 { margin: 0; font-size: 14px; color: var(--slate-dark); }
.chart .sub { color: var(--muted); font-size: 12px; margin: 1px 0 4px; }
.chart .plot { position: relative; }
.chart svg { display: block; width: 100%; overflow: visible; }
.legend { display: flex; flex-wrap: wrap; gap: 2px 6px; margin: 4px 0 2px; }
.legend button { display: inline-flex; align-items: center; gap: 6px; border: 1px solid transparent; background: none;
  padding: 1px 6px; font-size: 12px; color: var(--text); border-radius: 4px; cursor: pointer; }
.legend button:hover { border-color: var(--border); }
.legend button[aria-pressed=false] { color: var(--muted); }
.legend button[aria-pressed=false] .sw { opacity: .25; }
.legend .sw { display: inline-block; width: 14px; height: 3px; border-radius: 2px; }
.ax { font: 11px var(--mono); fill: var(--muted); }
.unit { font: 600 11px var(--font); fill: var(--muted); }
.gridline { stroke: #E6EAED; stroke-width: 1; }
.baseline { stroke: #C9D1D6; stroke-width: 1; }
.cross { stroke: var(--slate); stroke-width: 1; }
.alarmmark { stroke: var(--bad); stroke-width: 1; opacity: .55; }
.clearmark { stroke: var(--ok); stroke-width: 1; opacity: .55; }
.tip { position: fixed; z-index: 20; pointer-events: none; background: var(--surface); color: var(--text);
  border: 1px solid var(--border); border-radius: 4px; box-shadow: 0 4px 14px rgba(38,51,60,.16);
  padding: 6px 9px; font-size: 12px; max-width: 280px; }
.tip .tt { color: var(--muted); margin-bottom: 3px; }
.tip .tr { display: flex; align-items: center; gap: 6px; font-variant-numeric: tabular-nums; }
.tip .tr b { font-weight: 600; margin-left: auto; padding-left: 10px; }
.tip .sw { display: inline-block; width: 10px; height: 10px; border-radius: 50%; }
.tip .mk { color: var(--bad); margin-top: 3px; }
