/* Minimal, accessible defaults. WCAG 2.1 AA: text contrast at least 4.5:1,
   visible focus, states distinguished by text and not colour alone
   (specification.md 11.2). */
:root {
  --bg: #ffffff;
  --fg: #16191d;          /* 15.9:1 on white */
  --muted: #55606e;       /* 5.9:1 on white */
  --line: #c9d1da;
  --accent: #0b4f9e;      /* 7.4:1 on white */
  --error: #8c1420;       /* 7.6:1 on white */
  --notice-bg: #eef4fb;
}
* { box-sizing: border-box; }
body {
  margin: 0;
  background: var(--bg);
  color: var(--fg);
  font: 16px/1.5 system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
}
a { color: var(--accent); }
:focus-visible { outline: 3px solid var(--accent); outline-offset: 2px; }
.skip-link {
  position: absolute; left: -9999px;
}
.skip-link:focus { left: 8px; top: 8px; background: var(--bg); padding: 8px; z-index: 10; }
.topbar {
  display: flex; align-items: center; justify-content: space-between;
  gap: 16px; padding: 12px 20px; border-bottom: 1px solid var(--line);
}
.topbar nav { display: flex; align-items: center; gap: 16px; }
.brand { font-weight: 600; text-decoration: none; }
main { max-width: 1100px; margin: 0 auto; padding: 24px 20px 64px; }
h1 { font-size: 1.6rem; margin: 0 0 4px; }
h2 { font-size: 1.15rem; margin: 32px 0 8px; }
.meta, .hint { color: var(--muted); font-size: 0.9rem; }
.field { margin: 0 0 16px; max-width: 26rem; }
label { display: block; font-weight: 500; margin-bottom: 4px; }
input[type="text"], input[type="email"], input[type="password"] {
  width: 100%; padding: 8px 10px; font: inherit;
  border: 1px solid var(--line); border-radius: 4px; background: var(--bg); color: var(--fg);
}
button {
  font: inherit; padding: 8px 16px; border: 1px solid var(--accent);
  border-radius: 4px; background: var(--accent); color: #fff; cursor: pointer;
}
form.inline { display: inline; }
form.inline button { background: none; color: var(--accent); border-color: var(--line); }
table { border-collapse: collapse; width: 100%; margin: 12px 0; }
th, td { text-align: left; padding: 8px 10px; border-bottom: 1px solid var(--line); }
thead th { border-bottom: 2px solid var(--line); font-size: 0.85rem; text-transform: uppercase;
  letter-spacing: 0.03em; color: var(--muted); }
dl { display: grid; grid-template-columns: max-content 1fr; gap: 4px 16px; margin: 8px 0; }
dt { color: var(--muted); }
.error { color: var(--error); font-weight: 500; }
.notice { background: var(--notice-bg); border-left: 4px solid var(--accent);
  padding: 10px 14px; margin: 12px 0; }
.messages { list-style: none; margin: 12px auto; padding: 0 20px; max-width: 1100px; }
.msg { padding: 8px 12px; border-left: 4px solid var(--accent); background: var(--notice-bg); }
.msg-error { border-color: var(--error); }
.totp-uri code { word-break: break-all; font-size: 0.8rem; }
.disabled { color: var(--muted); text-decoration: none; cursor: not-allowed; }
.visually-hidden {
  position: absolute; width: 1px; height: 1px; overflow: hidden;
  clip: rect(0 0 0 0); white-space: nowrap;
}
/* Narrow screens: 390 px is a tested breakpoint (specification.md 11.2). */
@media (max-width: 640px) {
  .topbar { flex-direction: column; align-items: flex-start; }
  dl { grid-template-columns: 1fr; }
  table, thead, tbody, tr, th, td { display: block; }
  thead { display: none; }
  tr { border-bottom: 2px solid var(--line); padding: 8px 0; }
  td, th { border: none; padding: 2px 0; }
}

.badge {
  display: inline-block; padding: 1px 6px; border-radius: 3px;
  background: var(--accent); color: #fff; font-size: 0.75rem; font-weight: 600;
}
.hash { font-size: 0.8rem; color: var(--muted); }
td[rowspan] { vertical-align: top; }

tr.selected th, tr.selected td { background: var(--notice-bg); }
tr.changed td { border-left: 3px solid var(--accent); }
tr.changed del { color: var(--muted); }
textarea { width: 100%; font: inherit; padding: 6px 8px; border: 1px solid var(--line);
  border-radius: 4px; }
