/* MDRender Cloud Push Server — dark-first console theme.
   Direction: "control room at night" — deep slate-blue ink, one brass signal
   accent, serif wordmark, quiet hairline structure. */

/* The hidden attribute must win. Classes like .field-row set display:flex,
   and an author display rule beats the browser's [hidden] stylesheet, so
   JS-hidden sections (e.g. account-only plan fields on a server plan) would
   otherwise stay on screen. */
[hidden] { display: none !important; }

:root {
  color-scheme: dark;
  --ink: #0f1420;
  --surface: #161d2b;
  --surface-2: #1d2637;
  --line: #2a3446;
  --line-strong: #3b4863;
  --text: #e7eaf1;
  --muted: #98a4bb;
  --accent: #e0a44a;
  --accent-ink: #23190a;
  --accent-weak: rgba(224, 164, 74, 0.14);
  --danger: #e0705a;
  --danger-weak: rgba(224, 112, 90, 0.14);
  --ok: #6cc59a;
  --warn: #e0c04a;

  --radius: 10px;
  --radius-sm: 7px;

  --font-serif: "Iowan Old Style", "Palatino Linotype", Palatino, Georgia, ui-serif, serif;
  --font-sans: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Ubuntu,
    Cantarell, "Helvetica Neue", Arial, sans-serif;
  --font-mono: ui-monospace, "SF Mono", SFMono-Regular, Menlo, Consolas,
    "Liberation Mono", monospace;

  --nav-w: 236px;
}

@media (prefers-color-scheme: light) {
  :root {
    color-scheme: light;
    --ink: #f5f4f0;
    --surface: #ffffff;
    --surface-2: #efede7;
    --line: #dcd8cf;
    --line-strong: #c6c1b6;
    --text: #1b1f27;
    --muted: #5c6577;
    --accent: #a8691a;
    --accent-ink: #ffffff;
    --accent-weak: rgba(168, 105, 26, 0.12);
    --danger: #b3472f;
    --danger-weak: rgba(179, 71, 47, 0.1);
    --ok: #1f7a53;
    --warn: #8a6d12;
  }
}

*,
*::before,
*::after { box-sizing: border-box; }

html { -webkit-text-size-adjust: 100%; }

body {
  margin: 0;
  min-height: 100vh;
  display: grid;
  grid-template-columns: var(--nav-w) 1fr;
  /* min-height above the content: keep the slack below it, never between
     the sidebar and main (the mobile layout would open with a blank gap). */
  align-content: start;
  background: var(--ink);
  color: var(--text);
  font-family: var(--font-sans);
  font-size: 15px;
  line-height: 1.55;
  -webkit-font-smoothing: antialiased;
}

body.no-nav { grid-template-columns: 1fr; }

a { color: var(--accent); text-underline-offset: 2px; }
a:hover { text-decoration: underline; }

:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
  border-radius: 3px;
}

/* ---- Sidebar ---- */

aside.side {
  position: sticky;
  top: 0;
  align-self: start;
  height: 100vh;
  padding: 1.6rem 1.1rem;
  border-right: 1px solid var(--line);
  background: linear-gradient(180deg, var(--surface) 0%, var(--ink) 100%);
  display: flex;
  flex-direction: column;
  gap: 1.4rem;
}

.brand {
  display: flex;
  align-items: center;
  gap: 0.65rem;
  color: var(--text);
  text-decoration: none;
  line-height: 1.1;
}
.brand:hover { text-decoration: none; }
.brand-icon {
  width: 34px;
  height: 34px;
  border-radius: 9px;
  flex: none;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.35);
}
.brand-text b {
  font-family: var(--font-serif);
  font-weight: 600;
  font-size: 1.4rem;
  letter-spacing: 0.005em;
}
.brand-text > span {
  display: block;
  margin-top: 0.15rem;
  color: var(--muted);
  font-size: 0.74rem;
  letter-spacing: 0.08em;
}

.side nav { display: flex; flex-direction: column; gap: 0.15rem; }
.side nav a {
  color: var(--text);
  text-decoration: none;
  padding: 0.46rem 0.7rem;
  border-radius: var(--radius-sm);
  border: 1px solid transparent;
}
.side nav a:hover { background: var(--surface-2); text-decoration: none; }
.side nav a.active {
  background: var(--accent-weak);
  border-color: var(--line-strong);
  color: var(--text);
}
.side nav a.active::before {
  content: "";
  display: inline-block;
  width: 6px;
  height: 6px;
  margin-right: 0.55rem;
  border-radius: 50%;
  background: var(--accent);
  vertical-align: middle;
}

.side .logout { margin-top: auto; }

/* Hamburger: only the small-screen layout shows it. */
.nav-toggle { display: none; }

/* ---- Main ---- */

main {
  padding: clamp(1.5rem, 4vw, 2.8rem);
  max-width: 1120px;
  width: 100%;
}

h1 {
  font-family: var(--font-serif);
  font-weight: 600;
  font-size: clamp(1.6rem, 3.4vw, 2.05rem);
  line-height: 1.15;
  margin: 0 0 0.4rem;
  letter-spacing: 0.005em;
}

h2 {
  font-size: 1.02rem;
  font-weight: 600;
  letter-spacing: 0.005em;
  color: var(--text);
  margin: 2rem 0 0.6rem;
}

p.lede { color: var(--muted); margin: 0 0 1.4rem; max-width: 68ch; }

/* ---- Callouts ---- */

.callout {
  display: flex;
  align-items: center;
  gap: 0.6rem;
  padding: 0.8rem 1rem;
  border-radius: var(--radius);
  border: 1px solid var(--line-strong);
  margin: 0 0 1.4rem;
}
.callout[hidden] { display: none; }
.callout-icon { flex: none; color: var(--muted); }
.callout.success {
  background: rgba(46, 160, 67, 0.15);
  border-color: rgba(46, 160, 67, 0.55);
  color: #56d364;
}
.callout.success .callout-icon { color: #3fb950; }
.callout.error {
  background: rgba(248, 81, 73, 0.15);
  border-color: rgba(248, 81, 73, 0.55);
  color: #ff7b72;
}
.callout.error .callout-icon { color: var(--danger); }

.actions-end { text-align: right; margin: 1.2rem 0 0; }

dl.details {
  display: grid;
  grid-template-columns: auto 1fr;
  gap: 0.35rem 1rem;
  margin: 0.6rem 0 0;
}
dl.details dt { color: var(--muted); }
dl.details dd { margin: 0; overflow-wrap: anywhere; }

/* Inline "label units" field rows (e.g. the billing plan dialog). */
.field-row {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.4rem;
  margin: 0.6rem 0;
}
.field-row input[type="text"] { width: auto; flex: 0 1 6rem; min-width: 4rem; }
.field-row .unit { color: var(--muted); font-size: 0.82rem; }
.field-row .unit input[type="text"] { min-width: 3.5rem; }
.field-row .row-title {
  flex: 0 0 7.5rem;
  color: var(--text);
  font-size: 0.85rem;
  font-weight: 600;
}
#plan-dialog { width: min(680px, 94vw); }

/* ---- Tabs ---- */

.tabs {
  display: flex;
  flex-wrap: wrap;
  gap: 0.4rem;
  margin: 1rem 0 1.4rem;
  border-bottom: 1px solid var(--line);
}
.tabs a {
  padding: 0.5rem 0.9rem;
  color: var(--muted);
  text-decoration: none;
  border-bottom: 2px solid transparent;
  margin-bottom: -1px;
}
.tabs a:hover { color: var(--text); }
.tabs a.active { color: var(--text); border-bottom-color: var(--accent); }

/* ---- Stat cards ---- */

.stats {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(190px, 1fr));
  gap: 0.9rem;
  margin: 1.4rem 0;
}
.stat {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 1rem 1.1rem;
  display: flex;
  flex-direction: column;
  gap: 0.35rem;
}
.stat-label { color: var(--muted); font-size: 0.82rem; }
.stat-value { font-size: 1.35rem; font-weight: 600; letter-spacing: 0.01em; }

/* ---- Tables ---- */

.table-wrap {
  overflow-x: auto;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--surface);
}

table { width: 100%; border-collapse: collapse; font-size: 0.925rem; }

thead th {
  text-align: left;
  font-weight: 600;
  font-size: 0.82rem;
  color: var(--muted);
  padding: 0.7rem 0.9rem;
  border-bottom: 1px solid var(--line-strong);
  white-space: nowrap;
}

tbody td,
tbody th {
  padding: 0.72rem 0.9rem;
  border-bottom: 1px solid var(--line);
  vertical-align: top;
}

/* Key-value tables (Status, server details) put the row label in a th. */
tbody th {
  text-align: left;
  font-weight: 600;
  font-size: 0.925rem;
  color: var(--muted);
}

tbody tr:last-child td,
tbody tr:last-child th { border-bottom: 0; }
tbody tr:hover { background: var(--surface-2); }

/* ---- Forms & buttons ---- */

form.inline { display: inline-block; margin: 0 0.35rem 0.35rem 0; }

/* Stacked page forms: constrain the width so fields are not comically long,
   and space the fields and submit button out. */
form.stack {
  display: flex;
  flex-direction: column;
  max-width: 30rem;
}
form.stack > label { margin-top: 0.9rem; }
form.stack > label:first-child { margin-top: 0; }
form.stack > .btn-primary,
form.stack > button[type="submit"] { margin-top: 1.5rem; align-self: flex-start; }

/* Save + a secondary action share the form's last row: primary on the
   left, the secondary pushed to the form's right edge. */
.form-actions {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 0.8rem;
  margin-top: 1.5rem;
}

button,
.btn {
  font: inherit;
  color: var(--text);
  background: var(--surface-2);
  border: 1px solid var(--line-strong);
  padding: 0.44rem 0.85rem;
  border-radius: var(--radius-sm);
  cursor: pointer;
  text-decoration: none;
  display: inline-block;
}
button:hover, .btn:hover { background: var(--line); text-decoration: none; }
button:active { transform: translateY(1px); }

.btn-primary {
  background: var(--accent);
  border-color: var(--accent);
  color: var(--accent-ink);
  font-weight: 600;
}
.btn-primary:hover { filter: brightness(1.06); background: var(--accent); }

.btn-danger { color: var(--danger); border-color: var(--line-strong); }
.btn-danger:hover { background: var(--danger-weak); border-color: var(--danger); }

label { display: block; margin-bottom: 0.35rem; color: var(--muted); font-size: 0.85rem; }

input[type="password"],
input[type="text"],
input[type="email"],
input[type="search"],
select {
  font: inherit;
  width: 100%;
  color: var(--text);
  background: var(--ink);
  border: 1px solid var(--line-strong);
  border-radius: var(--radius-sm);
  padding: 0.5rem 0.7rem;
}
input::placeholder { color: var(--muted); }
select {
  appearance: none;
  background-image: linear-gradient(45deg, transparent 50%, var(--muted) 50%),
    linear-gradient(135deg, var(--muted) 50%, transparent 50%);
  background-position: right 0.9rem center, right 0.6rem center;
  background-size: 5px 5px, 5px 5px;
  background-repeat: no-repeat;
  padding-right: 1.8rem;
}

/* Icon-only action buttons (label carried by title/aria-label). */
button.icon-btn,
a.icon-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 0.42rem 0.5rem;
  line-height: 0;
  vertical-align: middle;
}
/* Anchors sit where `form.inline` buttons do, so match its spacing. */
a.icon-btn { margin: 0 0.35rem 0.35rem 0; }

/* ---- Code, status, empties ---- */

code {
  font-family: var(--font-mono);
  font-size: 0.85em;
  background: var(--surface-2);
  border: 1px solid var(--line);
  border-radius: 5px;
  padding: 0.08em 0.34em;
}

pre {
  font-family: var(--font-mono);
  font-size: 0.85rem;
  line-height: 1.5;
  background: var(--ink);
  border: 1px solid var(--line);
  border-left: 3px solid var(--line-strong);
  border-radius: var(--radius-sm);
  padding: 0.75rem 0.9rem;
  overflow-x: auto;
  margin: 0.3rem 0 0.8rem;
}

.chip {
  display: inline-flex;
  align-items: center;
  gap: 0.4em;
  color: var(--muted);
  font-size: 0.85rem;
  white-space: nowrap;
}
.chip::before {
  content: "";
  width: 0.5em;
  height: 0.5em;
  border-radius: 50%;
  background: currentColor;
  flex: none;
}
.chip.pending { color: var(--warn); }
.chip.acked, .chip.done, .chip.received { color: var(--ok); }
.chip.failed, .chip.error { color: var(--danger); }

.empty { color: var(--muted); font-style: italic; }

/* ---- The one bold moment: enrolment code ---- */

.code-display {
  font-family: var(--font-mono);
  font-size: clamp(1.9rem, 7vw, 3rem);
  letter-spacing: 0.26em;
  text-indent: 0.26em;
  color: var(--accent);
  background: var(--accent-weak);
  border: 1px dashed var(--line-strong);
  border-radius: var(--radius);
  padding: 0.5em 0.5em 0.5em 0.6em;
  text-align: center;
  margin: 1rem 0;
  user-select: all;
}

/* QR must sit on light ground to scan; keep it white in both schemes. */
.qr {
  display: inline-block;
  background: #fff;
  padding: 0.9rem;
  border-radius: var(--radius);
  line-height: 0;
}
.qr svg { width: min(320px, 72vw); height: auto; display: block; }

/* ---- Login ---- */

body.no-nav main { max-width: none; }
.login-card {
  position: relative; /* anchors the magic-link completion spinner */
  max-width: 360px;
  margin: 12vh auto 0;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 2rem;
}
.login-head {
  display: flex;
  align-items: center;
  gap: 0.8rem;
  margin-bottom: 0.5rem;
}
.login-card h1 { margin: 0; }
.login-card form {
  display: flex;
  flex-direction: column;
  gap: 0.85rem;
  margin-top: 0.4rem;
}
.login-card label { margin-bottom: 0; }
/* The form's flex gap separates every row evenly; the submit button gets extra
   breathing room so it never reads as part of the password field (or of the
   error line, when one is showing). */
.login-card .btn-primary { width: 100%; margin-top: 0.6rem; }
/* Constrain password-manager icons (LastPass, 1Password, …) to the field and
   leave room for them so they do not overlap the text or escape the border. */
.field { position: relative; }
input[type="password"] { padding-right: 2.75rem; }
.login-icon {
  width: 46px;
  height: 46px;
  border-radius: 13px;
  flex: none;
  display: block;
  box-shadow: 0 6px 20px rgba(0, 0, 0, 0.4);
}
.auth-block { margin-top: 0.4rem; }
.auth-block > div { display: flex; flex-direction: column; gap: 0.7rem; }
.auth-block > div[hidden] { display: none; }
/* Sign-in method tabs: "Magic link" / "Email & password". Both panels are
   server-rendered; the template picks the default and this styles the strip. */
.auth-tabs {
  display: flex;
  gap: 0.2rem;
  margin: 0.5rem 0 1.1rem;
  border-bottom: 1px solid var(--line);
}
.auth-tab {
  flex: 1;
  padding: 0.55rem 0.3rem;
  font: inherit;
  font-size: 0.92rem;
  color: var(--muted);
  background: none;
  border: none;
  border-bottom: 2px solid transparent;
  margin-bottom: -1px;
  cursor: pointer;
}
.auth-tab:hover { color: var(--fg); }
.auth-tab.active {
  color: var(--fg);
  font-weight: 600;
  border-bottom-color: var(--accent);
}
/* Magic-link return: cover the card with a spinner while the sign-in link
   is exchanged for a session, so it never looks like a dead login form. */
.auth-block > .auth-busy:not([hidden]) {
  position: absolute;
  inset: 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 0.9rem;
  background: var(--surface);
  border-radius: var(--radius);
  padding: 2rem;
  text-align: center;
  z-index: 1;
}
.busy-title { margin: 0; font-weight: 600; }
.busy-spinner {
  width: 30px;
  height: 30px;
  border: 3px solid var(--line);
  border-top-color: var(--accent);
  border-radius: 50%;
  animation: busy-spin 0.8s linear infinite;
}
@keyframes busy-spin { to { transform: rotate(360deg); } }
@media (prefers-reduced-motion: reduce) {
  .busy-spinner { animation-duration: 2s; }
}
.login-alt { margin: 0; text-align: center; }
.login-alt a { color: var(--muted); font-size: 0.88rem; }
.login-alt a:hover { color: var(--accent); }
.divider {
  display: flex;
  align-items: center;
  gap: 0.7rem;
  margin: 1.1rem 0;
  color: var(--muted);
  font-size: 0.78rem;
}
.divider::before, .divider::after {
  content: "";
  flex: 1;
  height: 1px;
  background: var(--line);
}
.social-row { display: flex; flex-direction: column; gap: 0.6rem; }
button.social {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 0.6rem;
  width: 100%;
  padding: 0.6rem;
  font: inherit;
  color: var(--fg);
  background: var(--surface-2);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  cursor: pointer;
}
button.social:hover { border-color: var(--accent); }

/* Linked sign-in methods listed on the profile page: identity on the left,
   Remove pushed to the row's right edge. */
.linked-signins { margin: 0 0 1rem; padding-left: 1.1rem; }
.linked-signins li {
  display: flex;
  align-items: center;
  gap: 0.7rem;
  margin: 0.45rem 0;
}
.linked-signins form.inline { margin: 0 0 0 auto; }
.linked-signins .btn { padding: 0.15rem 0.55rem; font-size: 0.8rem; }
.login-msg { margin: 0.9rem 0 0; font-size: 0.88rem; color: var(--muted); }
.login-msg:empty { display: none; }
.login-msg-error { color: var(--danger); }
.login-foot { margin: 1.2rem 0 0; text-align: center; }
.login-card hr { border: none; border-top: 1px solid var(--line); margin: 1.4rem 0; }
.admin-details { margin-top: 1.4rem; border-top: 1px solid var(--line); padding-top: 1rem; }
.admin-details summary {
  cursor: pointer;
  color: var(--muted);
  font-size: 0.88rem;
  list-style: none;
}
.admin-details summary::-webkit-details-marker { display: none; }
.admin-details summary:hover { color: var(--accent); }
.admin-details[open] summary { margin-bottom: 0.9rem; }
.inline-form { display: inline; }

/* Collapsible "Register a new client" disclosure, button-styled summary. */
.disclosure { margin-top: 1.4rem; }
.disclosure > summary {
  display: inline-block;
  padding: 0.5rem 0.95rem;
  border: 1px solid var(--line-strong);
  border-radius: var(--radius);
  background: var(--surface-2);
  color: var(--text);
  cursor: pointer;
  list-style: none;
  font-size: 0.9rem;
}
.disclosure > summary::-webkit-details-marker { display: none; }
.disclosure > summary:hover { border-color: var(--accent); }
.disclosure[open] > summary { margin-bottom: 1rem; }

/* ---- Click to copy ---- */

.copy-wrap { position: relative; }
.copy-wrap pre { padding-right: 5.25rem; }
.copy-btn {
  font: inherit;
  font-size: 0.78rem;
  padding: 0.24rem 0.6rem;
  color: var(--muted);
  background: var(--surface-2);
  border: 1px solid var(--line-strong);
  border-radius: 6px;
  cursor: pointer;
}
.copy-btn:hover { color: var(--text); background: var(--line); }
.copy-btn.copied { color: var(--ok); border-color: var(--ok); }
.copy-wrap .copy-btn { position: absolute; top: 0.5rem; right: 0.5rem; }
.code-actions { margin: -0.4rem 0 1.2rem; }

.code-display { position: relative; cursor: copy; }
.code-display.copied::after {
  content: "Copied";
  position: absolute;
  top: 0.5rem;
  right: 0.7rem;
  font-family: var(--font-mono);
  font-size: 0.8rem;
  letter-spacing: 0;
  text-indent: 0;
  color: var(--ok);
}

/* ---- Confirm dialog ---- */

dialog.confirm {
  border: 1px solid var(--line-strong);
  background: var(--surface);
  color: var(--text);
  border-radius: var(--radius);
  padding: 1.4rem 1.5rem;
  width: min(560px, 92vw);
  max-width: 92vw;
  max-height: 90vh;
  overflow-x: hidden;
  overflow-y: auto;
  box-shadow: 0 20px 60px rgba(0, 0, 0, 0.55);
}
dialog.confirm form { display: flex; flex-direction: column; }
dialog.confirm label { margin-top: 0.5rem; }
dialog.confirm .field + label { margin-top: 0.7rem; }
dialog.confirm::backdrop { background: rgba(4, 7, 12, 0.62); }
dialog.confirm h2 { margin: 0 0 0.5rem; font-size: 1.15rem; }
dialog.confirm p { margin: 0 0 1.2rem; color: var(--muted); }
.confirm-actions {
  display: flex;
  gap: 0.6rem;
  justify-content: flex-end;
  margin-top: 1.4rem;
}
.confirm-actions button[type="submit"] { min-width: 9rem; }
.pw-toggle {
  position: absolute;
  right: 0.5rem;
  top: 50%;
  transform: translateY(-50%);
  background: none;
  border: 0;
  padding: 0.2rem;
  color: var(--muted);
  cursor: pointer;
  display: inline-flex;
  align-items: center;
}
.pw-toggle:hover { color: var(--text); background: none; }
/* Keep the -50% centring while pressed: `button:active` above would otherwise
   replace it, yanking the eye out from under the pointer so the release lands
   on the input and the synthesized click misses the button. */
.pw-toggle:active { transform: translateY(-50%) translateY(1px); }
button[disabled], .btn-primary[disabled] { opacity: 0.5; cursor: not-allowed; }

/* ---- Accordion cards (pushes / pending) ---- */

/* One short card per push: date + status in the summary, the full record
   behind it. details[name] keeps a single card open per list. */
.acc {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  margin-top: 0.8rem;
  overflow: hidden;
}
.acc > summary {
  list-style: none;
  cursor: pointer;
  display: flex;
  align-items: center;
  gap: 0.7rem;
  padding: 0.75rem 1rem;
  min-height: 46px;
}
.acc > summary::-webkit-details-marker { display: none; }
.acc > summary:hover { background: var(--surface-2); }
/* Date and who wrap together as one cluster; chip + chevron stay put. */
.acc-lead {
  flex: 1 1 auto;
  min-width: 0;
  display: flex;
  flex-wrap: wrap;
  align-items: baseline;
  gap: 0.1rem 0.65rem;
}
.acc-when { font-weight: 600; }
.acc-who { color: var(--muted); overflow-wrap: break-word; min-width: 0; }
.acc-amt { flex: none; font-weight: 600; font-variant-numeric: tabular-nums; }
.acc > summary .chip { flex: none; }
/* Closed: chevron right; open: chevron down. */
.acc > summary::after {
  content: "";
  flex: none;
  width: 0.55rem;
  height: 0.55rem;
  border-right: 2px solid var(--muted);
  border-bottom: 2px solid var(--muted);
  transform: rotate(-45deg);
  transition: transform 0.15s ease;
}
.acc[open] > summary::after { transform: rotate(45deg); }
.acc > .acc-body {
  padding: 0.7rem 1rem 1rem;
  border-top: 1px solid var(--line);
}
.acc-actions { margin-top: 0.9rem; }

/* ---- Pending groups ---- */

section.push-group { margin-top: 0.8rem; }
section.push-group h2 {
  margin: 0 0 0.5rem;
  text-transform: none;
  letter-spacing: 0;
  font-size: 1rem;
  color: var(--text);
}
section.push-group table { margin-top: 0.6rem; }
section.push-group .table-wrap { border: 0; background: transparent; }

/* ---- Footer (every page, logins included) ---- */
.site-footer {
  margin-top: 2.4rem;
  padding-top: 1rem;
  border-top: 1px solid var(--line);
  font-size: 0.85rem;
  display: flex;
  flex-wrap: wrap;
  gap: 0.3rem 1.4rem;
}
.site-footer a { color: var(--muted); }
.site-footer a:hover { color: var(--text); }
.site-footer span { color: var(--muted); }

/* ---- Legal pages ---- */
main ul { margin: 0 0 1rem; padding-left: 1.3rem; }
main li { margin: 0.3rem 0; }
main li::marker { color: var(--muted); }

/* ---- Motion (answers actions only; one quiet entrance) ---- */

@media (prefers-reduced-motion: no-preference) {
  main { animation: rise 0.32s ease-out both; }
  @keyframes rise {
    from { opacity: 0; transform: translateY(6px); }
    to { opacity: 1; transform: none; }
  }
}

/* ---- Small screens ---- */

@media (max-width: 768px) {
  body { grid-template-columns: 1fr; }

  /* Top bar: brand and the hamburger; the nav (and log out) live in the
     panel it opens. app.js flips aria-expanded and .nav-open. */
  aside.side {
    position: static;
    height: auto;
    border-right: 0;
    border-bottom: 1px solid var(--line);
    display: grid;
    grid-template-columns: 1fr auto;
    grid-template-areas: "brand toggle";
    align-items: center;
    padding: 0.7rem 0.9rem;
    gap: 0.7rem 0.8rem;
  }
  .brand { grid-area: brand; }
  .nav-toggle {
    grid-area: toggle;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: 0.45rem 0.6rem;
  }
  .nav-toggle[aria-expanded="true"] {
    border-color: var(--accent);
    color: var(--accent);
  }
  .side nav { grid-area: nav; display: none; }
  .side .logout { grid-area: logout; display: none; }
  .side.nav-open { grid-template-areas: "brand toggle" "nav nav" "logout logout"; }
  .side.nav-open nav { display: flex; flex-direction: column; gap: 0.15rem; }
  .side.nav-open nav a { padding: 0.65rem 0.7rem; }
  .side.nav-open .logout { display: block; margin-top: 0; }
  .side.nav-open .logout button { width: 100%; }

  main { padding: 1.2rem; }

  /* Data tables restack: each row becomes a block of labelled values
     (app.js copies the column headings into data-label). Key-value tables
     without a thead keep their two-column shape; browsers without :has()
     keep the horizontal scroll fallback. */
  .table-wrap table:has(thead) { display: block; }
  .table-wrap table:has(thead) thead { display: none; }
  .table-wrap table:has(thead) tbody,
  .table-wrap table:has(thead) tr,
  .table-wrap table:has(thead) td { display: block; width: 100%; }
  .table-wrap table:has(thead) tr {
    padding: 0.6rem 0 0.15rem;
    border-bottom: 1px solid var(--line);
  }
  .table-wrap table:has(thead) tr:last-child { border-bottom: 0; }
  .table-wrap table:has(thead) td {
    padding: 0.15rem 1rem;
    border: 0;
    overflow-wrap: anywhere;
  }
  .table-wrap table:has(thead) td::before {
    content: attr(data-label);
    display: block;
    color: var(--muted);
    font-size: 0.74rem;
    font-weight: 600;
    margin-bottom: 0.05rem;
  }
  .table-wrap table:not(:has(thead)) td { overflow-wrap: anywhere; }

  /* Comfortable tap targets, and 16px fields so iOS Safari does not zoom
     into an input on focus. */
  button, .btn { padding: 0.55rem 0.95rem; }
  button.icon-btn, a.icon-btn { padding: 0.5rem 0.6rem; }
  input[type="text"], input[type="email"], input[type="password"],
  input[type="search"], select { font-size: 16px; }

  .login-card { margin-top: 6vh; padding: 1.3rem 1.2rem; }
}
