/* Phone-first base styles (section 11.2): 360px minimum, 44px tap targets, high contrast.
   System fonts only: nothing is fetched from another host (hard constraint 2). */
:root {
  --bg: #f4f5f7;
  --surface: #ffffff;
  --text: #14181f;
  --muted: #4a5361;
  --line: #c9ced6;
  --brand: #123a6b;
  --brand-text: #ffffff;
  --ok: #0b6b3a;
  --ok-bg: #e3f4ea;
  --warn: #7a4b00;
  --warn-bg: #fdf0d5;
  --bad: #a11a1a;
  --bad-bg: #fbe4e4;
  --na-bg: #eceef2;
  --radius: 10px;
  --tap: 44px;
}
@media (prefers-color-scheme: dark) {
  :root {
    --bg: #0f1318;
    --surface: #191f27;
    --text: #f1f3f6;
    --muted: #b3bcc8;
    --line: #3a4350;
    --brand: #0d2c52;
    --ok: #7fe0a8;
    --ok-bg: #12301f;
    --warn: #ffd27a;
    --warn-bg: #3a2c0c;
    --bad: #ff9c9c;
    --bad-bg: #3d1717;
    --na-bg: #232b35;
  }
}
* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font: 17px/1.45 system-ui, -apple-system, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
}
a { color: inherit; }
.skip { position: absolute; left: -999px; }
.skip:focus { left: 8px; top: 8px; background: var(--surface); padding: 8px; z-index: 10; }
.topbar {
  display: flex; align-items: center; justify-content: space-between; gap: 12px;
  background: var(--brand); color: var(--brand-text);
  padding: 0 16px; min-height: 56px;
}
.topbar a, .topbar .linklike { color: var(--brand-text); }
.brand { font-weight: 700; text-decoration: none; font-size: 1.1rem; }
.topbar nav { display: flex; align-items: center; gap: 4px; }
.topbar nav a, .linklike {
  display: inline-flex; align-items: center; min-height: var(--tap); padding: 0 12px;
  background: none; border: 0; font: inherit; cursor: pointer; text-decoration: underline;
}
.inline { display: inline; margin: 0; }
main { padding: 16px; max-width: 960px; margin: 0 auto; }
.card {
  background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius);
  padding: 16px; margin-bottom: 16px;
}
.narrow { max-width: 420px; margin-left: auto; margin-right: auto; }
h1 { font-size: 1.4rem; margin: 0 0 12px; }
h2 { font-size: 1.1rem; margin: 0 0 8px; }
label { display: block; font-weight: 600; margin: 12px 0 4px; }
input[type="text"], input[type="password"] {
  width: 100%; min-height: var(--tap); padding: 8px 12px; font: inherit;
  color: var(--text); background: var(--surface);
  border: 2px solid var(--muted); border-radius: 8px;
}
input:focus-visible, button:focus-visible, a:focus-visible {
  outline: 3px solid #f2a900; outline-offset: 2px;
}
button.primary, a.button {
  display: inline-flex; align-items: center; justify-content: center;
  min-height: var(--tap); padding: 0 20px; margin-top: 16px;
  background: var(--brand); color: var(--brand-text);
  border: 0; border-radius: 8px; font: inherit; font-weight: 600;
  text-decoration: none; cursor: pointer;
}
button.primary { width: 100%; }
.error { color: var(--bad); background: var(--bad-bg); padding: 10px 12px; border-radius: 8px; }
.messages { list-style: none; padding: 0; margin: 0 0 16px; }
.msg { padding: 10px 12px; border-radius: 8px; background: var(--na-bg); margin-bottom: 8px; }
.muted { color: var(--muted); }

/* Health page: one row per check; stacks on a phone, no hover-only information. */
.checks { list-style: none; margin: 0; padding: 0; }
.check {
  display: grid; grid-template-columns: 1fr; gap: 4px;
  padding: 12px 0; border-top: 1px solid var(--line);
}
.check:first-child { border-top: 0; }
.check .name { font-weight: 600; }
.check .value { overflow-wrap: anywhere; }
.check .detail { color: var(--muted); font-size: 0.92rem; overflow-wrap: anywhere; }
.badge {
  display: inline-block; padding: 2px 10px; border-radius: 999px;
  font-size: 0.85rem; font-weight: 700; margin-right: 8px;
}
.badge.ok { color: var(--ok); background: var(--ok-bg); }
.badge.warn { color: var(--warn); background: var(--warn-bg); }
.badge.bad { color: var(--bad); background: var(--bad-bg); }
.badge.na { color: var(--muted); background: var(--na-bg); }
@media (min-width: 640px) {
  .check { grid-template-columns: 220px 1fr; column-gap: 16px; }
  .check .detail { grid-column: 2; }
}

/* Tables: scroll sideways inside their own box on a phone; the page itself never does. */
.scroll { overflow-x: auto; margin: 8px 0 16px; }
table { border-collapse: collapse; width: 100%; font-size: 0.95rem; }
th, td { text-align: left; padding: 8px 10px; border-bottom: 1px solid var(--line); vertical-align: top; }
thead th { border-bottom: 2px solid var(--muted); white-space: nowrap; }
tbody th { font-weight: 600; }
.num { text-align: right; font-variant-numeric: tabular-nums; white-space: nowrap; }
.mono { font-family: ui-monospace, Consolas, monospace; font-size: 0.8rem; overflow-wrap: anywhere; }
