:root {
  --bg: #f6f7f9;
  --panel: #ffffff;
  --text: #1c2330;
  --muted: #6b7484;
  --line: #e2e6ec;
  --accent: #2459d6;
  --accent-text: #ffffff;
  --ok: #1d7a46;      --ok-bg: #e3f4ea;
  --crit: #b42318;    --crit-bg: #fde7e5;
  --high: #b54708;    --high-bg: #fdf0e1;
  --med: #8a6d00;     --med-bg: #fbf4d6;
  --low: #3b5bab;     --low-bg: #e6edfb;
  --info: #555e6e;    --info-bg: #eceff3;
  color-scheme: light;
}
/* Dark: follows the OS unless the user picked Light, or forced with the theme button.
   (Same values twice: CSS can't share a block between a media query and a selector.) */
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --bg: #12151b; --panel: #1b2029; --text: #e4e8ef; --muted: #98a1b0; --line: #2c333f;
    --accent: #5b8cff; --accent-text: #0d1117;
    --ok: #6fd39a;   --ok-bg: #173323;
    --crit: #ff8a80; --crit-bg: #3d1a18;
    --high: #ffb067; --high-bg: #3a2614;
    --med: #f1d36b;  --med-bg: #362f12;
    --low: #9db5ff;  --low-bg: #1c2742;
    --info: #b3bbc8; --info-bg: #252b35;
    color-scheme: dark;
  }
}
:root[data-theme="dark"] {
  --bg: #12151b; --panel: #1b2029; --text: #e4e8ef; --muted: #98a1b0; --line: #2c333f;
  --accent: #5b8cff; --accent-text: #0d1117;
  --ok: #6fd39a;   --ok-bg: #173323;
  --crit: #ff8a80; --crit-bg: #3d1a18;
  --high: #ffb067; --high-bg: #3a2614;
  --med: #f1d36b;  --med-bg: #362f12;
  --low: #9db5ff;  --low-bg: #1c2742;
  --info: #b3bbc8; --info-bg: #252b35;
  color-scheme: dark;
}

* { box-sizing: border-box; }
body { margin: 0; background: var(--bg); color: var(--text);
       font: 14px/1.5 system-ui, -apple-system, "Segoe UI", Roboto, sans-serif; }
a { color: var(--accent); text-decoration: none; }
a:hover { text-decoration: underline; }
h1 { font-size: 22px; margin: 0 0 4px; }
h2 { font-size: 16px; margin: 0 0 12px; }
code, .mono { font-family: ui-monospace, Consolas, monospace; }

.top { display: flex; align-items: center; gap: 24px; padding: 10px 20px;
       background: var(--panel); border-bottom: 1px solid var(--line); flex-wrap: wrap; }
.brand { font-weight: 700; color: var(--text); }
.top nav { display: flex; gap: 16px; flex: 1; }
.who { display: flex; gap: 12px; align-items: center; color: var(--muted); }
.theme-toggle { padding: 4px 10px; font-size: 13px; white-space: nowrap; }
.theme-corner { position: fixed; top: 12px; right: 16px; }

main { max-width: 1280px; margin: 0 auto; padding: 20px 16px 48px; }
.head { display: flex; justify-content: space-between; align-items: flex-end; gap: 16px;
        margin-bottom: 16px; flex-wrap: wrap; }
.card { background: var(--panel); border: 1px solid var(--line); border-radius: 8px;
        padding: 16px; margin-bottom: 16px; }
.two { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; }
@media (max-width: 800px) { .two { grid-template-columns: 1fr; } }
.scroll { overflow-x: auto; }

.tiles { display: grid; grid-template-columns: repeat(auto-fit, minmax(170px, 1fr)); gap: 12px; margin-bottom: 16px; }
.tile { background: var(--panel); border: 1px solid var(--line); border-radius: 8px; padding: 12px 14px; }
.tile .label { color: var(--muted); font-size: 12px; text-transform: uppercase; letter-spacing: .04em; }
.tile .value { font-size: 26px; font-weight: 600; }
.tile .small-value { font-size: 16px; padding: 6px 0; }

table.grid { width: 100%; border-collapse: collapse; background: var(--panel); }
.grid th, .grid td { text-align: left; padding: 8px 10px; border-bottom: 1px solid var(--line); vertical-align: top; }
.grid th { font-size: 12px; color: var(--muted); font-weight: 600; white-space: nowrap; }
.grid .num { text-align: right; }
.scroll > table.grid { border: 1px solid var(--line); border-radius: 8px; }

.badge { display: inline-block; padding: 1px 8px; border-radius: 999px; font-size: 12px; font-weight: 600;
         white-space: nowrap; background: var(--info-bg); color: var(--info); }
.badge.ok { background: var(--ok-bg); color: var(--ok); }
.badge.critical { background: var(--crit-bg); color: var(--crit); }
.badge.high { background: var(--high-bg); color: var(--high); }
.badge.medium { background: var(--med-bg); color: var(--med); }
.badge.low { background: var(--low-bg); color: var(--low); }
.bad { color: var(--crit); font-weight: 600; }
.warn { color: var(--high); }
.muted { color: var(--muted); }
.small { font-size: 12px; }
.nowrap { white-space: nowrap; }

.flash { background: var(--low-bg); color: var(--text); border: 1px solid var(--line);
         border-radius: 8px; padding: 10px 14px; margin-bottom: 16px; }
.flash.bad { background: var(--crit-bg); }

button, .button { display: inline-block; font: inherit; padding: 6px 14px; border-radius: 6px; cursor: pointer;
                  border: 1px solid var(--line); background: var(--panel); color: var(--text); }
button:hover, .button:hover { border-color: var(--accent); text-decoration: none; }
.primary { background: var(--accent); color: var(--accent-text); border-color: var(--accent); }
.danger { color: var(--crit); border-color: var(--crit); }
button.link { border: 0; background: none; color: var(--accent); padding: 0; }
form.inline { display: inline; }
.actions { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; }
td.actions { gap: 12px; }

input, select { font: inherit; padding: 6px 8px; border: 1px solid var(--line); border-radius: 6px;
                background: var(--bg); color: var(--text); min-width: 0; }
label { display: flex; flex-direction: column; gap: 4px; font-size: 13px; color: var(--muted); margin-bottom: 10px; flex: 1; }
label.check { flex-direction: row; align-items: center; gap: 8px; color: var(--text); }
.row { display: flex; gap: 12px; align-items: flex-end; flex-wrap: wrap; }
.form { max-width: 640px; }

.login { max-width: 420px; margin: 12vh auto; text-align: center; background: var(--panel);
         border: 1px solid var(--line); border-radius: 10px; padding: 32px; }

h3 { font-size: 14px; margin: 0 0 8px; }
.mt { margin-top: 16px; }
details summary { cursor: pointer; color: var(--muted); margin-top: 8px; }
.row-between { display: flex; justify-content: space-between; align-items: center; gap: 12px; }
ul.plain, ul.steps { list-style: none; padding: 0; margin: 0; }
ul.plain li, ul.steps li { padding: 6px 0; border-bottom: 1px solid var(--line); }
.steps .ok .icon { color: var(--ok); font-weight: 700; }
.steps .fail .icon { color: var(--crit); font-weight: 700; }
.secret .pw { display: flex; gap: 12px; align-items: center; }
.secret code { font-size: 20px; padding: 6px 10px; background: var(--bg); border-radius: 6px; user-select: all; }
