:root {
  --bg: #f6f7f9; --surface: #ffffff; --surface-2: #f0f2f5; --border: #dde1e7; --text: #16191f; --muted: #5d6573;
  --accent: #0f6b5c; --accent-text: #ffffff; --danger: #b42318; --warn: #a15c07; --ok: #137333; --focus: #2f6fed;
  --radius: 8px; --font: system-ui, -apple-system, "Segoe UI", Roboto, "Noto Sans Arabic", sans-serif; --mono: ui-monospace, "Cascadia Mono", Consolas, monospace;
}
@media (prefers-color-scheme: dark) {
  :root { --bg: #0f1115; --surface: #171a20; --surface-2: #1e222a; --border: #2c323c; --text: #e8eaee; --muted: #9aa3b2; --accent: #3fb59d; --accent-text: #08110f; --danger: #f27a6f; --warn: #e5a54a; --ok: #5cc27a; --focus: #7aa2ff; }
}
* { box-sizing: border-box; }
html, body { margin: 0; background: var(--bg); color: var(--text); font: 15px/1.5 var(--font); }
body.center { min-height: 100dvh; display: grid; place-items: center; padding: 16px; }
h1 { font-size: 1.35rem; margin: 0 0 12px; } h2 { font-size: 1.1rem; margin: 24px 0 8px; } h3 { font-size: .95rem; margin: 16px 0 6px; }
p { margin: 6px 0; } .muted { color: var(--muted); } .mono { font-family: var(--mono); font-size: .85rem; overflow-wrap: anywhere; }
.boot { padding: 24px; color: var(--muted); }
a { color: var(--accent); }
:focus-visible { outline: 3px solid var(--focus); outline-offset: 2px; }
.card { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); padding: 20px; }
.card.narrow { width: 100%; max-width: 440px; }
label { display: block; font-weight: 600; font-size: .85rem; margin: 12px 0 4px; }
input, select, textarea { width: 100%; padding: 9px 10px; border: 1px solid var(--border); border-radius: 6px; background: var(--surface); color: var(--text); font: inherit; }
button { font: inherit; border-radius: 6px; padding: 8px 14px; border: 1px solid var(--border); background: var(--surface-2); color: var(--text); cursor: pointer; min-height: 36px; }
button.primary { background: var(--accent); border-color: var(--accent); color: var(--accent-text); font-weight: 600; }
button.danger { color: var(--danger); border-color: var(--danger); background: transparent; }
button:disabled { opacity: .5; cursor: not-allowed; }
.row { display: flex; gap: 8px; flex-wrap: wrap; align-items: center; } .row > * { flex: 0 0 auto; } .grow { flex: 1 1 200px !important; }
.error { color: var(--danger); font-weight: 600; } .okmsg { color: var(--ok); font-weight: 600; }
.shell { display: grid; grid-template-columns: 220px 1fr; min-height: 100dvh; }
nav.side { background: var(--surface); border-inline-end: 1px solid var(--border); padding: 16px 10px; position: sticky; top: 0; height: 100dvh; overflow-y: auto; }
nav.side .brand { font-weight: 700; padding: 4px 10px 12px; } nav.side .brand small { display: block; font-weight: 400; color: var(--muted); }
nav.side a { display: block; padding: 7px 10px; border-radius: 6px; color: var(--text); text-decoration: none; }
nav.side a[aria-current="page"] { background: var(--surface-2); font-weight: 600; }
nav.side .who { margin-top: 16px; padding: 10px; border-top: 1px solid var(--border); font-size: .85rem; color: var(--muted); overflow-wrap: anywhere; }
main.content { padding: 24px; min-width: 0; }
.tiles { display: grid; grid-template-columns: repeat(auto-fill, minmax(180px, 1fr)); gap: 12px; }
.tile { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); padding: 14px; }
.tile .k { color: var(--muted); font-size: .8rem; } .tile .v { font-size: 1.5rem; font-weight: 700; font-variant-numeric: tabular-nums; } .tile .s { color: var(--muted); font-size: .8rem; }
.meter { height: 8px; background: var(--surface-2); border-radius: 4px; overflow: hidden; margin-top: 6px; } .meter > div { height: 100%; background: var(--accent); }
.meter.warn > div { background: var(--warn); } .meter.bad > div { background: var(--danger); }
.tablewrap { overflow-x: auto; border: 1px solid var(--border); border-radius: var(--radius); background: var(--surface); }
table { border-collapse: collapse; width: 100%; font-size: .88rem; font-variant-numeric: tabular-nums; }
th, td { text-align: start; padding: 8px 10px; border-bottom: 1px solid var(--border); vertical-align: top; }
th { background: var(--surface-2); font-weight: 600; white-space: nowrap; } tr:last-child td { border-bottom: 0; }
.badge { display: inline-block; padding: 1px 8px; border-radius: 999px; font-size: .78rem; font-weight: 600; border: 1px solid var(--border); white-space: nowrap; }
.badge.ok { color: var(--ok); border-color: var(--ok); } .badge.bad { color: var(--danger); border-color: var(--danger); } .badge.warn { color: var(--warn); border-color: var(--warn); }
.panel { margin-top: 16px; } .toolbar { margin: 8px 0 12px; }
dialog { border: 1px solid var(--border); border-radius: var(--radius); background: var(--surface); color: var(--text); padding: 20px; width: min(420px, calc(100vw - 32px)); }
dialog::backdrop { background: rgb(0 0 0 / .45); }
.codes { display: grid; grid-template-columns: repeat(2, 1fr); gap: 6px; font-family: var(--mono); background: var(--surface-2); padding: 10px; border-radius: 6px; }
.notice { border-inline-start: 4px solid var(--warn); background: var(--surface-2); padding: 10px 12px; border-radius: 6px; margin: 12px 0; }
@media (max-width: 760px) {
  .shell { grid-template-columns: 1fr; }
  nav.side { position: static; height: auto; display: flex; flex-wrap: wrap; gap: 4px; }
  nav.side .brand, nav.side .who { width: 100%; }
  main.content { padding: 16px; }
}
@media (prefers-reduced-motion: reduce) { * { transition: none !important; animation: none !important; } }
.sr { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
