/* Central Auth console look, for the Backoffice's merged Central Auth / IT
 * Console surface.
 *
 * Ported from the Central Auth app's own console.css so the two read as one
 * product. Visual direction comes from the Central Auth Console design:
 * dark top bar, light work surface, left navigation grouped by task, a
 * breadcrumb and page header on every screen, bordered cards and tables.
 *
 * The rest of the Backoffice keeps app.css; this file is only loaded by
 * console_base.html and never alongside app.css (the two define the same
 * element selectors).
 *
 * Class names from the old console (.toolbar, .table-wrap, .pill, .btn,
 * .panel, .lede, .note, .muted, .mono, .pager ...) are kept and restyled here
 * so the page templates did not need to be rewritten to adopt the new look.
 */

:root {
  color-scheme: light;
  --c-bar:        #0a0c14;
  --c-bar-raised: #141720;
  --c-bar-line:   #1e2535;
  --c-bar-text:   #e2e8f0;
  --c-bar-dim:    #a0aec0;

  --bg:        #f5f6fa;
  --surface:   #ffffff;
  --sunken:    #fafbfd;
  --hover:     #f0f1f7;
  --border:    #e4e7ef;
  --border-2:  #d5d9e4;
  --text:      #1b1f2e;
  --muted:     #5b6378;
  --dim:       #6b7388;

  --accent:      #4c51bf;
  --accent-lt:   #667eea;
  --accent-dk:   #3c40a0;
  --accent-tint: #eef0fd;
  --on-accent:   #ffffff;
  --teal:        #38b2ac;
  --teal-tint:   #e6f6f5;
  --teal-text:   #22736e;

  --ok:        #2f855a;  --ok-bg:   #e7f5ec;
  --warn:      #a86a12;  --warn-bg: #fdf3e1;
  --bad:       #c53030;  --bad-bg:  #fdecec;
  --good:      #2f855a;

  --r-sm: 6px;
  --r-md: 8px;
  --r-lg: 10px;
  --r-xl: 12px;

  --ease: cubic-bezier(.2, .7, .2, 1);
  --bar-h: 48px;
  --nav-w: 236px;

  /* Tokens for what used to be hard-coded, so dark mode can swap them. */
  --row-line:  #eef0f5;
  --row-hover: #f7f8fc;
  --sep:       #aab0c2;
  --bad-line:  #f0c4c4;
  --ok-line:   #b9e0c8;
  --warn-line: #ecd29b;
  --warn-text: #7a4c0a;
  --focus-ring: #667eea33;
  --lift:      rgba(76, 81, 191, .12);
  --hero-edge: transparent;
}

/* Dark mode. Follows the system unless the visitor chose a side with the
 * toggle (console_base.html sets data-theme on <html> before first paint, so
 * there is no flash). The two blocks below are the SAME tokens: one is the
 * system default, the other the explicit choice. Keep them identical. */
@media (prefers-color-scheme: dark) {
:root:not([data-theme="light"]) {
  color-scheme: dark;
  --bg:        #0d0f18;
  --surface:   #141720;
  --sunken:    #10131c;
  --hover:     #1b2030;
  --border:    #1e2535;
  --border-2:  #2d3748;
  --text:      #e2e8f0;
  --muted:     #a0aec0;
  --dim:       #8a94a8;

  /* On dark the accent steps LIGHTER so links and button fills keep contrast;
     --on-accent flips to near-black so the button label stays readable. */
  --accent:      #818cf8;
  --accent-lt:   #a5b4fc;
  --accent-dk:   #a5b4fc;
  --accent-tint: #1e2240;
  --on-accent:   #0d0f18;
  --teal:        #4fd1c5;
  --teal-tint:   #12302f;
  --teal-text:   #81e6d9;

  --ok:        #68d391;  --ok-bg:   #12301f;
  --warn:      #f6ad55;  --warn-bg: #33260e;
  --bad:       #fc8181;  --bad-bg:  #3a1717;
  --good:      #68d391;

  --row-line:  #1b2030;
  --row-hover: #181c29;
  --sep:       #4a5568;
  --bad-line:  #5b2323;
  --ok-line:   #1f4d33;
  --warn-line: #5a4216;
  --warn-text: #fbd38d;
  --focus-ring: #818cf833;
  --lift:      rgba(0, 0, 0, .45);
  --hero-edge: #1e2535;
}
}
:root[data-theme="dark"] {
  color-scheme: dark;
  --bg:        #0d0f18;
  --surface:   #141720;
  --sunken:    #10131c;
  --hover:     #1b2030;
  --border:    #1e2535;
  --border-2:  #2d3748;
  --text:      #e2e8f0;
  --muted:     #a0aec0;
  --dim:       #8a94a8;

  /* On dark the accent steps LIGHTER so links and button fills keep contrast;
     --on-accent flips to near-black so the button label stays readable. */
  --accent:      #818cf8;
  --accent-lt:   #a5b4fc;
  --accent-dk:   #a5b4fc;
  --accent-tint: #1e2240;
  --on-accent:   #0d0f18;
  --teal:        #4fd1c5;
  --teal-tint:   #12302f;
  --teal-text:   #81e6d9;

  --ok:        #68d391;  --ok-bg:   #12301f;
  --warn:      #f6ad55;  --warn-bg: #33260e;
  --bad:       #fc8181;  --bad-bg:  #3a1717;
  --good:      #68d391;

  --row-line:  #1b2030;
  --row-hover: #181c29;
  --sep:       #4a5568;
  --bad-line:  #5b2323;
  --ok-line:   #1f4d33;
  --warn-line: #5a4216;
  --warn-text: #fbd38d;
  --focus-ring: #818cf833;
  --lift:      rgba(0, 0, 0, .45);
  --hero-edge: #1e2535;
}

* { box-sizing: border-box; margin: 0; }

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

body {
  background: var(--bg);
  color: var(--text);
  font: 16px/1.6 -apple-system, "Segoe UI", system-ui, sans-serif;
  min-height: 100dvh;
  display: flex;
  flex-direction: column;
}

a { color: var(--accent); text-decoration: none; }
a:hover { color: var(--accent-dk); text-decoration: underline; }

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

.sr-only {
  position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px;
  overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; border: 0;
}

.skip-link {
  position: absolute; left: .75rem; top: -3rem; z-index: 100;
  background: var(--surface); color: var(--accent); padding: .5rem .9rem;
  border-radius: var(--r-md); border: 1px solid var(--border-2);
  transition: top 160ms var(--ease);
}
.skip-link:focus { top: .5rem; }

/* ---- top bar ---- */

.c-topbar {
  height: var(--bar-h);
  flex: none;
  background: var(--c-bar);
  color: var(--c-bar-text);
  display: flex;
  align-items: center;
  gap: 14px;
  padding: 0 16px;
  position: sticky;
  top: 0;
  z-index: 40;
}
.c-brand {
  display: flex; align-items: center; gap: 10px;
  color: var(--c-bar-text); white-space: nowrap;
}
.c-brand:hover { color: #fff; text-decoration: none; }
.c-brand img { width: 26px; height: 26px; border-radius: 6px; display: block; }
.c-brand strong { font-weight: 700; letter-spacing: -.01em; }
.c-crumb-sep { color: #4a5568; }
.c-scope { color: var(--c-bar-dim); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; min-width: 0; }
.c-topbar-end { margin-left: auto; display: flex; align-items: center; gap: 6px; }
.c-chip {
  font-size: 11px; font-weight: 700; text-transform: uppercase; letter-spacing: .08em;
  color: #4fd1c5; background: #38b2ac1f; border: 1px solid #38b2ac40;
  border-radius: 999px; padding: 3px 9px; white-space: nowrap;
}
.c-signout {
  color: var(--c-bar-dim); font-size: 15px; padding: 6px 10px;
  border-radius: var(--r-sm); transition: background 160ms var(--ease), color 160ms var(--ease);
}
.c-signout:hover { background: var(--c-bar-raised); color: #fff; text-decoration: none; }

.c-strip {
  height: 2px; flex: none;
  background: linear-gradient(90deg, #818cf8, #667eea 35%, #38b2ac 70%, #4fd1c5);
}

/* ---- frame: sidebar + main ---- */

.c-frame { flex: 1; display: flex; min-height: 0; }

.c-nav {
  width: var(--nav-w); flex: none;
  background: var(--surface);
  border-right: 1px solid var(--border);
  padding: 12px 10px;
  display: flex; flex-direction: column; gap: 14px;
  position: sticky; top: calc(var(--bar-h) + 2px);
  align-self: flex-start;
  height: calc(100dvh - var(--bar-h) - 2px);
  overflow-y: auto;
}
.c-nav-group { display: flex; flex-direction: column; gap: 2px; }
.c-nav-title {
  font-size: 11px; font-weight: 700; letter-spacing: .08em; text-transform: uppercase;
  color: var(--dim); padding: 6px 10px;
}
.c-nav a {
  position: relative;
  display: flex; align-items: center; gap: 10px;
  min-height: 38px; padding: 0 10px;
  border-radius: var(--r-sm);
  color: var(--text); font-size: 15px; text-decoration: none;
  transition: background 160ms var(--ease);
}
.c-nav a:hover { background: var(--hover); }
.c-nav a[aria-current="page"] { background: var(--accent-tint); color: var(--accent-dk); font-weight: 600; }
.c-nav a[aria-current="page"]::before {
  content: ""; position: absolute; left: 0; top: 8px; bottom: 8px; width: 3px;
  border-radius: 2px; background: linear-gradient(180deg, #818cf8, #38b2ac);
}
.c-tile {
  width: 24px; height: 24px; border-radius: 6px; flex: none;
  display: grid; place-items: center;
  color: #fff; font: 700 10px/1 system-ui, sans-serif; letter-spacing: .02em;
}

.c-main {
  flex: 1; min-width: 0;
  padding: 18px 28px 40px;
  display: flex; flex-direction: column; gap: 16px;
}
.c-content { display: flex; flex-direction: column; gap: 16px; min-width: 0; max-width: 1180px; width: 100%; }

.c-trail {
  display: flex; align-items: center; flex-wrap: wrap; gap: 6px;
  font-size: 14px; color: var(--muted);
}
.c-trail .sep { color: var(--sep); }

/* ---- page header ---- */

.toolbar {
  display: flex; flex-wrap: wrap; gap: .75rem 1rem;
  align-items: center; justify-content: space-between;
}
.toolbar h1 { margin: 0; }
.toolbar form { flex: 1 1 260px; max-width: 380px; }
.toolbar input { margin: 0; }

h1 { font-size: 1.5rem; line-height: 1.2; font-weight: 600; letter-spacing: -.01em; text-wrap: balance; }
h2 { font-size: 1.1rem; line-height: 1.3; font-weight: 600; margin-top: 1.5rem; margin-bottom: .6rem; }
h2:first-child { margin-top: 0; }
p  { max-width: 70ch; }
code {
  font-family: ui-monospace, SFMono-Regular, Menlo, monospace;
  font-size: .9em; background: var(--hover); padding: .1em .4em; border-radius: 4px;
}

.muted { color: var(--dim); font-size: 14px; }
.note  { color: var(--muted); font-size: 16px; }
.lede  { color: var(--muted); font-size: 17px; line-height: 1.6; }
.hint  { margin-top: .4rem; margin-bottom: 1rem; }
p.lede[style*="--bad"], p.lede[style*="--good"] {
  padding: .7rem .9rem; border-radius: var(--r-md); border: 1px solid;
  font-size: 16px; max-width: 70ch;
}
p.lede[style*="--bad"]  { background: var(--bad-bg); border-color: var(--bad-line); }
p.lede[style*="--good"] { background: var(--ok-bg);  border-color: var(--ok-line); }

.error {
  background: var(--bad-bg); border: 1px solid var(--bad-line); color: var(--bad);
  padding: .7rem .9rem; border-radius: var(--r-md);
}
.notice {
  background: var(--warn-bg); border: 1px solid var(--warn-line); color: var(--warn-text);
  padding: .7rem .9rem; border-radius: var(--r-md); font-size: 16px;
}

/* ---- buttons ---- */

button, .btn {
  display: inline-flex; align-items: center; justify-content: center;
  min-height: 36px; padding: .45rem 1rem;
  font: inherit; font-size: 15px; font-weight: 600;
  color: var(--on-accent); background: var(--accent);
  border: 1px solid transparent; border-radius: var(--r-md);
  cursor: pointer; text-decoration: none; text-align: center;
  transition: background 160ms var(--ease), border-color 160ms var(--ease), transform 120ms var(--ease);
}
button:hover, .btn:hover { background: var(--accent-dk); color: var(--on-accent); text-decoration: none; }
button:active, .btn:active { transform: scale(.98); }
.btn--quiet {
  background: var(--surface); color: var(--text); border-color: var(--border-2);
}
.btn--quiet:hover { background: var(--hover); color: var(--text); }
.btn--danger { background: var(--surface); color: var(--bad); border-color: var(--bad-line); }
.btn--danger:hover { background: var(--bad-bg); color: var(--bad); }
/* Table-row actions read as links with a border, not as a column of slabs. */
td .btn, td button {
  min-height: 30px; padding: .2rem .65rem; font-size: 14px;
  background: var(--surface); color: var(--accent); border-color: var(--border-2);
}
td .btn:hover, td button:hover { background: var(--accent-tint); color: var(--accent-dk); }
td form { display: inline; }
form[style*="max-width"] button, form button[type=submit] { margin-top: 1rem; }
td form button[type=submit] { margin-top: 0; }
.actions { display: flex; flex-wrap: wrap; gap: .6rem; margin: 1rem 0; }
.actions form { margin: 0; }

/* ---- forms ---- */

label { display: block; margin: 1rem 0 .3rem; color: var(--muted); font-size: 15px; font-weight: 500; }
input[type=text], input[type=email], input[type=password], input[type=url], input[type=search],
input[type=number], select, textarea {
  width: 100%; min-height: 40px;
  padding: .55rem .8rem;
  font: inherit; font-size: 16px;
  background: var(--surface); color: var(--text);
  border: 1px solid var(--border-2); border-radius: var(--r-md);
  transition: border-color 160ms var(--ease), box-shadow 160ms var(--ease);
}
input:focus, select:focus, textarea:focus {
  outline: none; border-color: var(--accent-lt);
  box-shadow: 0 0 0 3px var(--focus-ring);
}
input::placeholder { color: var(--dim); }
input[type=checkbox], input[type=radio] { width: auto; min-height: 0; accent-color: var(--accent); margin-right: .5rem; }
label:has(> input[type=checkbox]), .checkrow { display: flex; align-items: center; gap: 10px; color: var(--text); font-size: 16px; }
/* A top-level form is a card of its own; inline forms inside tables and the
   toolbar stay bare. */
.c-content > form {
  max-width: 620px !important; background: var(--surface); border: 1px solid var(--border);
  border-radius: var(--r-lg); padding: .5rem 1.4rem 1.4rem;
}
.c-content > form + form { margin-top: -4px; }
.c-content > .actions, .c-content > form[style*="max-width"] { margin-top: 0; }
.keybox, textarea.keybox, input.keybox {
  font-family: ui-monospace, SFMono-Regular, Menlo, monospace;
  letter-spacing: .08em; word-break: break-all; color: var(--text);
}

/* ---- tables and cards ---- */

.table-wrap {
  overflow-x: auto;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--r-lg);
}
table { width: 100%; border-collapse: collapse; }
th, td { padding: .75rem 1rem; text-align: left; font-size: 16px; vertical-align: middle; }
th {
  font-size: 13px; font-weight: 600; color: var(--muted);
  background: var(--sunken); white-space: nowrap;
}
tbody tr { border-top: 1px solid var(--row-line); transition: background 120ms var(--ease); }
tbody tr:first-child { border-top: 0; }
tbody tr:hover { background: var(--row-hover); }
td .muted { display: block; font-size: 14px; }
td a { font-weight: 500; }
tbody th { background: transparent; width: 220px; }
.empty { padding: 2rem 1rem; text-align: center; color: var(--dim); font-size: 16px; }

.mono {
  font-family: ui-monospace, SFMono-Regular, Menlo, monospace;
  font-variant-numeric: tabular-nums; font-size: 14px; color: var(--muted); white-space: nowrap;
}
.nowrap { white-space: nowrap; }

.panel {
  background: var(--surface); border: 1px solid var(--border);
  border-radius: var(--r-lg); padding: 1rem 1.25rem; margin-top: 1rem;
}
.panel h2 { margin-top: 0; }

.pill {
  display: inline-block; font-size: 12px; font-weight: 600; letter-spacing: .02em;
  padding: .15rem .6rem; border-radius: 999px; white-space: nowrap;
  background: var(--hover); color: var(--muted);
}
.pill--ok, .pill--on   { background: var(--ok-bg);   color: var(--ok); }
.pill--warn            { background: var(--warn-bg); color: var(--warn); }
.pill--bad             { background: var(--bad-bg);  color: var(--bad); }
.pill--off             { background: var(--hover);   color: var(--muted); }

/* ---- overview ---- */

.c-hero {
  position: relative; overflow: hidden;
  border-radius: var(--r-xl); background: var(--c-bar); color: var(--c-bar-text);
  padding: 22px 24px; box-shadow: 0 0 0 1px var(--hero-edge);
  display: grid; grid-template-columns: auto minmax(0, 1fr); gap: 20px; align-items: center;
}
.c-hero::before {
  content: ""; position: absolute; inset: 0;
  background:
    radial-gradient(600px 220px at 85% 0%, rgba(102,126,234,.35), transparent 70%),
    radial-gradient(420px 200px at 60% 120%, rgba(56,178,172,.25), transparent 70%);
}
.c-hero > * { position: relative; }
.c-hero img { width: 64px; height: 64px; border-radius: 14px; box-shadow: 0 0 0 1px var(--c-bar-line); display: block; }
.c-facts { display: grid; grid-template-columns: repeat(auto-fit, minmax(170px, 1fr)); gap: 12px 28px; }
.c-facts dt { font-size: 12px; text-transform: uppercase; letter-spacing: .08em; color: #8a94a8; }
.c-facts dd { margin: 0; font-weight: 600; font-size: 16px; overflow-wrap: anywhere; }

.c-stats { display: grid; grid-template-columns: repeat(auto-fit, minmax(190px, 1fr)); gap: 12px; }
.c-stat {
  display: flex; flex-direction: column; gap: 4px;
  background: var(--surface); border: 1px solid var(--border); border-radius: var(--r-lg);
  padding: 14px 16px; color: var(--text); text-decoration: none;
  transition: border-color 160ms var(--ease), box-shadow 160ms var(--ease);
}
a.c-stat:hover { border-color: var(--accent-lt); box-shadow: 0 4px 14px var(--lift); text-decoration: none; color: var(--text); }
.c-stat-label { display: flex; align-items: center; gap: 8px; font-size: 14px; color: var(--muted); }
.c-stat-label i { width: 8px; height: 8px; border-radius: 2px; display: block; }
.c-stat-value { font-size: 28px; font-weight: 600; letter-spacing: -.02em; font-variant-numeric: tabular-nums; }

/* ---- pager ---- */

.pager { display: flex; align-items: center; justify-content: center; gap: 1rem; font-size: 15px; }
.pager a {
  color: var(--accent); padding: .35rem .8rem; background: var(--surface);
  border: 1px solid var(--border-2); border-radius: var(--r-sm);
}
.pager a:hover { background: var(--accent-tint); text-decoration: none; }
.pager-off { color: var(--dim); padding: .35rem .8rem; }
.pager-at { color: var(--muted); }

/* ---- footer credit ---- */

.powered { padding: 1.4rem 1rem calc(1.2rem + env(safe-area-inset-bottom)); text-align: center; }
.powered a { color: var(--dim); font-size: 14px; opacity: .85; }
.powered a:hover { opacity: 1; text-decoration: none; }

/* ---- mobile and tablet: bottom tab bar (house nav standard) ---- */

.c-tabbar { display: none; }

@media (max-width: 1024px) {
  .c-nav { display: none; }
  .c-main { padding: 16px 16px 24px; }
  .c-scope { display: none; }
  .c-tabbar {
    display: flex; position: fixed; left: 0; right: 0; bottom: 0; z-index: 50;
    height: calc(60px + env(safe-area-inset-bottom));
    padding-bottom: env(safe-area-inset-bottom);
    background: #0a0c14; border-top: 1px solid #1e2535;
  }
  .c-tabbar a {
    flex: 1; display: flex; flex-direction: column; align-items: center; justify-content: center;
    gap: 4px; color: #718096; text-decoration: none;
    font-size: 10px; font-weight: 700; letter-spacing: .05em; text-transform: uppercase;
    transition: color 160ms var(--ease);
  }
  .c-tabbar a:hover { color: #818cf8; }
  .c-tabbar a[aria-current="page"] { color: var(--accent-lt); }
  .c-tabbar .c-tile { background: none !important; font-size: 18px; width: auto; height: auto; color: inherit; }
  body { padding-bottom: calc(60px + env(safe-area-inset-bottom)); }
}

@media (max-width: 720px) {
  .c-hero { grid-template-columns: 1fr; }
  th, td { padding: .65rem .75rem; }
}

@media (prefers-reduced-motion: reduce) {
  * { transition-duration: .01ms !important; animation-duration: .01ms !important; }
}

/* ---- Backoffice additions ---- */

/* Top-bar identity: the signed-in address, hidden where the bar is tight. */
.c-who { color: var(--c-bar-dim); font-size: 14px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; max-width: 240px; }

.c-nav-note { color: var(--dim); font-size: 14px; line-height: 1.5; padding: 2px 10px 0; }
.c-nav .c-out { margin-left: auto; color: var(--dim); font-size: 14px; }
.c-nav-rule { border: 0; border-top: 1px solid var(--border); margin: 0 10px; }

/* Domain switcher: one pill per enabled domain, inside the page so it works
   where the sidebar is hidden. */
.c-switch { display: flex; flex-wrap: wrap; gap: 8px; }
.c-switch a {
  display: inline-flex; align-items: center; min-height: 34px; padding: 0 14px;
  font-size: 15px; font-weight: 600; text-decoration: none;
  color: var(--text); background: var(--surface);
  border: 1px solid var(--border-2); border-radius: 999px;
  transition: background 160ms var(--ease), border-color 160ms var(--ease);
}
.c-switch a:hover { background: var(--hover); text-decoration: none; }
.c-switch a[aria-current="page"] {
  background: var(--accent-tint); color: var(--accent-dk); border-color: var(--accent-lt);
}

/* Two-door overview: IT Console and the Central Auth console side by side. */
.c-doors { display: grid; grid-template-columns: repeat(auto-fit, minmax(300px, 1fr)); gap: 16px; }
.c-door { display: flex; flex-direction: column; gap: 10px; margin: 0; }
.c-door h2 { margin: 0; display: flex; align-items: center; gap: 10px; }
.c-door ul { margin: 0; padding-left: 1.2rem; color: var(--muted); }
.c-door .btn { align-self: flex-start; margin-top: auto; }

/* Row actions: buttons and the reset-password disclosure sit in one line. */
.row-actions { display: flex; flex-wrap: wrap; align-items: flex-start; gap: 8px; }
.row-actions form { margin: 0; }
td details > summary {
  list-style: none; cursor: pointer;
  display: inline-flex; align-items: center; min-height: 30px; padding: .2rem .65rem;
  font-size: 14px; font-weight: 600; color: var(--accent);
  background: var(--surface); border: 1px solid var(--border-2); border-radius: var(--r-md);
}
td details > summary::-webkit-details-marker { display: none; }
td details > summary:hover { background: var(--accent-tint); color: var(--accent-dk); }
td details[open] > summary { margin-bottom: 8px; }
td details form { min-width: 240px; }
td details label { margin-top: 0; }
td details button[type=submit] { margin-top: 8px; }

/* A group or a person's access, one panel each. */
.c-member-list { list-style: none; padding: 0; margin: 0; display: flex; flex-direction: column; gap: 6px; }
.c-member-list li { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 6px 0; border-top: 1px solid var(--row-line); }
.c-member-list li:first-child { border-top: 0; }
.c-member-list form { margin: 0; }
.c-member-list button { min-height: 30px; padding: .2rem .65rem; font-size: 14px; background: var(--surface); color: var(--accent); border-color: var(--border-2); }
.c-member-list button:hover { background: var(--accent-tint); color: var(--accent-dk); }
.c-formrow { display: flex; flex-wrap: wrap; align-items: flex-end; gap: 10px 12px; }
.c-formrow > div { flex: 1 1 220px; min-width: 0; }
.c-formrow label { margin-top: 0; }
.c-formrow button { margin-top: 0 !important; }
.panel > form { margin: 0; }
.c-access-list { display: flex; flex-direction: column; gap: 8px; margin: 12px 0; }
.c-access-list p { margin: 2px 0 0 28px; }
.c-access-list .is-off { color: var(--dim); }

@media (max-width: 720px) {
  .c-who { display: none; }
  /* Phone: each row becomes its own card, labelled from data-label. */
  .table-stack thead { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
  .table-stack, .table-stack tbody, .table-stack tr, .table-stack td { display: block; width: 100%; }
  .table-stack tr { padding: 8px 0 12px; }
  .table-stack td { padding: 5px 14px; white-space: normal; }
  .table-stack td[data-label]::before {
    content: attr(data-label); display: block; font-size: 12px; font-weight: 700;
    text-transform: uppercase; letter-spacing: .08em; color: var(--dim); margin-bottom: 2px;
  }
}

.c-hero h1 { font-size: 1.6rem; margin-bottom: 6px; }
.c-hero .lede { color: var(--c-bar-dim); margin-bottom: 14px; }
.panel h3 { margin: 0; font-size: 1.05rem; font-weight: 600; }
.panel .muted { display: block; margin-top: 2px; }

/* Panels stack their parts with an even gap rather than per-element margins. */
.panel { display: flex; flex-direction: column; gap: 14px; margin-top: 0; }
.panel > h2, .panel > h3, .panel > p, .panel > ul, .panel > form { margin: 0; }
.panel .muted { margin-top: 0; }
.c-formrow + .c-formrow { padding-top: 14px; border-top: 1px solid var(--row-line); }
.c-access-list label { margin: 0; }
.c-access-list label.is-off { flex-wrap: wrap; row-gap: 0; }
.c-access-list label.is-off .muted { flex-basis: 100%; margin-left: 28px; }

/* ---- theme toggle (top bar) ---- */
.c-theme {
  margin: 0; min-height: 32px; min-width: 32px; padding: 0 8px;
  background: transparent; color: var(--c-bar-dim);
  border: 0; border-radius: var(--r-sm); font-size: 17px; line-height: 1;
}
.c-theme:hover { background: var(--c-bar-raised); color: #fff; transform: none; }
