/* SignFlow — shared styles. Tokens first; light + dark. */
:root {
  --bg: #f6f7f9;
  --surface: #ffffff;
  --surface-2: #f1f3f6;
  --border: #e3e6eb;
  --text: #161a22;
  --muted: #5f6878;
  --faint: #8b93a3;
  --brand: #3b5bdb;
  --brand-hover: #3149b8;
  --brand-soft: #edf1ff;
  --green: #1f8a4c;
  --green-soft: #e6f5ec;
  --orange: #c26a00;
  --orange-soft: #fff3e0;
  --red: #c92a2a;
  --red-soft: #fdecec;
  --grey-soft: #eef0f3;
  --shadow: 0 1px 2px rgba(16, 24, 40, .05), 0 1px 3px rgba(16, 24, 40, .06);
  --shadow-lg: 0 10px 30px rgba(16, 24, 40, .10);
  --radius: 12px;
  --radius-sm: 8px;
  color-scheme: light;
}
@media (prefers-color-scheme: dark) {
  :root {
    --bg: #0f1218;
    --surface: #171b23;
    --surface-2: #1e232d;
    --border: #2a303c;
    --text: #e8eaef;
    --muted: #a0a8b8;
    --faint: #737c8d;
    --brand: #6d8bff;
    --brand-hover: #8aa1ff;
    --brand-soft: #1e2645;
    --green: #4cc47e;
    --green-soft: #15291f;
    --orange: #f0a14a;
    --orange-soft: #2d2213;
    --red: #ff6b6b;
    --red-soft: #321a1c;
    --grey-soft: #252a35;
    --shadow: 0 1px 2px rgba(0, 0, 0, .4);
    --shadow-lg: 0 10px 30px rgba(0, 0, 0, .5);
    color-scheme: dark;
  }
}

* { box-sizing: border-box; }
[hidden] { display: none !important; }
html, body { margin: 0; }
body {
  background: var(--bg);
  color: var(--text);
  font: 15px/1.5 "Inter", system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  -webkit-font-smoothing: antialiased;
}
a { color: var(--brand); text-decoration: none; }
a:hover { text-decoration: underline; }
h1, h2, h3 { margin: 0; line-height: 1.25; letter-spacing: -.01em; }
h1 { font-size: 26px; font-weight: 700; }
h2 { font-size: 18px; font-weight: 650; }
h3 { font-size: 15px; font-weight: 650; }
p { margin: 0 0 .75em; }
.muted { color: var(--muted); }
.faint { color: var(--faint); }
.small { font-size: 13px; }
.mono { font-family: ui-monospace, "SF Mono", Menlo, monospace; font-size: 13px; }
.icon { flex: none; vertical-align: -3px; }
.icon-ms { width: 18px; height: 18px; flex: none; }

/* ---------- Header ---------- */
.topbar {
  position: sticky; top: 0; z-index: 20;
  background: color-mix(in srgb, var(--surface) 88%, transparent);
  backdrop-filter: saturate(1.4) blur(10px);
  border-bottom: 1px solid var(--border);
}
.topbar-inner {
  max-width: 1280px; margin: 0 auto; padding: 0 24px; height: 60px;
  display: flex; align-items: center; gap: 28px;
}
.brand { display: flex; align-items: center; gap: 10px; font-weight: 700; font-size: 17px; color: var(--text); }
.brand:hover { text-decoration: none; }
.brand-mark {
  width: 30px; height: 30px; border-radius: 9px; display: grid; place-items: center;
  background: linear-gradient(135deg, var(--brand), #7048e8); color: #fff;
}
.nav { display: flex; gap: 4px; flex: 1; }
.nav a {
  display: inline-flex; align-items: center; gap: 7px; padding: 7px 12px; border-radius: 8px;
  color: var(--muted); font-weight: 550; font-size: 14px;
}
.nav a:hover { background: var(--surface-2); color: var(--text); text-decoration: none; }
.nav a.active { background: var(--brand-soft); color: var(--brand); }
.usermenu { display: flex; align-items: center; gap: 10px; }
.usermenu .who { text-align: right; line-height: 1.2; }
.usermenu .who strong { display: block; font-size: 14px; }
.usermenu .who span { font-size: 12px; color: var(--muted); }

/* ---------- Layout ---------- */
.page { max-width: 1280px; margin: 0 auto; padding: 28px 24px 64px; }
.page-narrow { max-width: 820px; }
.page-head { display: flex; align-items: flex-end; justify-content: space-between; gap: 16px; margin-bottom: 24px; flex-wrap: wrap; }
.page-head p { margin: 6px 0 0; color: var(--muted); }
.crumbs { font-size: 13px; color: var(--muted); margin-bottom: 8px; display: flex; gap: 6px; align-items: center; }
.crumbs a { color: var(--muted); }
.stack > * + * { margin-top: 20px; }
.row { display: flex; gap: 12px; align-items: center; flex-wrap: wrap; }
.spacer { flex: 1; }
.grid-2 { display: grid; grid-template-columns: 2fr 1fr; gap: 20px; align-items: start; }
@media (max-width: 900px) { .grid-2 { grid-template-columns: 1fr; } .nav a span { display: none; } .usermenu .who { display: none; } }

.card { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); box-shadow: var(--shadow); }
.card-head { display: flex; align-items: center; gap: 12px; padding: 16px 20px; border-bottom: 1px solid var(--border); }
.card-head h2 { font-size: 16px; }
.card-body { padding: 20px; }
.card-foot { padding: 12px 20px; border-top: 1px solid var(--border); background: var(--surface-2); border-radius: 0 0 var(--radius) var(--radius); }

/* ---------- Stat tiles ---------- */
.stats { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 16px; margin-bottom: 24px; }
@media (max-width: 800px) { .stats { grid-template-columns: repeat(2, minmax(0, 1fr)); } }
.stat { padding: 18px 20px; display: flex; gap: 14px; align-items: center; }
.stat-icon { width: 42px; height: 42px; border-radius: 11px; display: grid; place-items: center; flex: none; }
.stat-value { font-size: 26px; font-weight: 700; line-height: 1.1; font-variant-numeric: tabular-nums; }
.stat-label { font-size: 13px; color: var(--muted); }
.tone-green .stat-icon { background: var(--green-soft); color: var(--green); }
.tone-orange .stat-icon { background: var(--orange-soft); color: var(--orange); }
.tone-red .stat-icon { background: var(--red-soft); color: var(--red); }
.tone-brand .stat-icon { background: var(--brand-soft); color: var(--brand); }

/* ---------- Progress ---------- */
.progress { height: 8px; background: var(--surface-2); border-radius: 99px; overflow: hidden; display: flex; }
.progress > span { display: block; height: 100%; }
.progress .g { background: var(--green); }
.progress .o { background: var(--orange); }
.progress .r { background: var(--red); }
.progress .b { background: var(--brand); transition: width .3s ease; }

/* ---------- Pills & dots ---------- */
.pill {
  display: inline-flex; align-items: center; gap: 6px; padding: 3px 10px 3px 8px; border-radius: 99px;
  font-size: 12.5px; font-weight: 600; white-space: nowrap;
}
.pill .dot { width: 7px; height: 7px; border-radius: 50%; background: currentColor; }
.pill-green { background: var(--green-soft); color: var(--green); }
.pill-orange { background: var(--orange-soft); color: var(--orange); }
.pill-red { background: var(--red-soft); color: var(--red); }
.pill-grey { background: var(--grey-soft); color: var(--muted); }
.tag { display: inline-block; padding: 2px 8px; border-radius: 6px; background: var(--surface-2); color: var(--muted); font-size: 12px; font-weight: 600; }

/* ---------- Document list (staff dashboard) ---------- */
.doclist { list-style: none; margin: 0; padding: 0; }
.doc {
  display: grid; grid-template-columns: 6px 1fr auto auto; gap: 18px; align-items: center;
  padding: 16px 20px 16px 0; border-bottom: 1px solid var(--border);
}
.doc:last-child { border-bottom: 0; }
.doc .bar { align-self: stretch; border-radius: 0 4px 4px 0; }
.doc.green .bar { background: var(--green); }
.doc.orange .bar { background: var(--orange); }
.doc.red .bar { background: var(--red); }
.doc-title { font-weight: 600; color: var(--text); }
.doc-meta { font-size: 13px; color: var(--muted); display: flex; gap: 10px; flex-wrap: wrap; margin-top: 2px; }
.doc-status { text-align: right; }
.doc-status .small { margin-top: 4px; }
@media (max-width: 700px) { .doc { grid-template-columns: 6px 1fr; } .doc-status, .doc .btn { grid-column: 2; text-align: left; } }

/* ---------- Tables ---------- */
.table-wrap { overflow-x: auto; }
table.table { width: 100%; border-collapse: collapse; font-size: 14px; }
.table th {
  text-align: left; font-size: 12px; font-weight: 600; text-transform: uppercase; letter-spacing: .04em;
  color: var(--faint); padding: 10px 16px; border-bottom: 1px solid var(--border); white-space: nowrap;
  background: var(--surface-2);
}
.table td { padding: 12px 16px; border-bottom: 1px solid var(--border); vertical-align: middle; }
.table tr:last-child td { border-bottom: 0; }
.table tbody tr:hover td { background: color-mix(in srgb, var(--surface-2) 60%, transparent); }
.table .num { text-align: right; font-variant-numeric: tabular-nums; }
.person { display: flex; align-items: center; gap: 10px; }
.person strong { display: block; font-weight: 600; color: var(--text); }
.person span { font-size: 12.5px; color: var(--muted); }

/* Matrix */
.matrix th.doc-col { text-transform: none; letter-spacing: 0; font-size: 12px; text-align: center; min-width: 92px; max-width: 120px; white-space: normal; line-height: 1.25; }
.matrix th.doc-col a { color: var(--muted); }
.matrix td.cell { text-align: center; padding: 8px; }
.matrix th:first-child, .matrix td:first-child { position: sticky; left: 0; background: var(--surface); z-index: 1; }
.matrix th:first-child { background: var(--surface-2); }
.sq { display: inline-grid; place-items: center; width: 30px; height: 30px; border-radius: 8px; }
.sq.green { background: var(--green-soft); color: var(--green); }
.sq.orange { background: var(--orange-soft); color: var(--orange); }
.sq.red { background: var(--red-soft); color: var(--red); }
.sq.none { color: var(--faint); }
.legend { display: flex; gap: 16px; font-size: 13px; color: var(--muted); flex-wrap: wrap; }
.legend span { display: inline-flex; align-items: center; gap: 6px; }
.legend i { width: 10px; height: 10px; border-radius: 3px; display: inline-block; }

/* ---------- Avatars ---------- */
.avatar {
  display: inline-grid; place-items: center; border-radius: 50%; font-weight: 650; flex: none;
  background: var(--brand-soft); color: var(--brand); letter-spacing: .02em;
}
.avatar-sm { width: 28px; height: 28px; font-size: 11px; }
.avatar-md { width: 34px; height: 34px; font-size: 12.5px; }
.avatar-lg { width: 56px; height: 56px; font-size: 19px; }

/* ---------- Buttons & forms ---------- */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px; padding: 9px 16px;
  border-radius: var(--radius-sm); border: 1px solid var(--border); background: var(--surface); color: var(--text);
  font: inherit; font-weight: 600; font-size: 14px; cursor: pointer; white-space: nowrap;
  transition: background .15s, border-color .15s, box-shadow .15s, opacity .15s;
}
.btn:hover { background: var(--surface-2); text-decoration: none; }
.btn:focus-visible { outline: 3px solid color-mix(in srgb, var(--brand) 35%, transparent); outline-offset: 1px; }
.btn-primary { background: var(--brand); border-color: var(--brand); color: #fff; }
.btn-primary:hover { background: var(--brand-hover); border-color: var(--brand-hover); }
.btn-danger { color: var(--red); }
.btn-ghost { border-color: transparent; background: transparent; color: var(--muted); }
.btn-ghost:hover { color: var(--text); }
.btn-sm { padding: 6px 11px; font-size: 13px; }
.btn-lg { padding: 13px 22px; font-size: 15px; }
.btn-block { width: 100%; }
.btn[disabled], .btn.disabled { opacity: .45; cursor: not-allowed; pointer-events: none; }

.form-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 18px 20px; }
.form-grid .full { grid-column: 1 / -1; }
@media (max-width: 700px) { .form-grid { grid-template-columns: 1fr; } }
.field label { display: block; font-weight: 600; font-size: 13.5px; margin-bottom: 6px; }
.field .help { font-size: 12.5px; color: var(--muted); margin-top: 5px; }
.field .errors { color: var(--red); font-size: 13px; margin-top: 5px; }
.field ul { list-style: none; padding: 0; margin: 0; display: flex; flex-wrap: wrap; gap: 6px 16px; }
input[type=text], input[type=password], input[type=number], input[type=email], input[type=url], input[type=date], input[type=search], input[type=file], select, textarea {
  width: 100%; padding: 9px 12px; border: 1px solid var(--border); border-radius: var(--radius-sm);
  background: var(--surface); color: var(--text); font: inherit; font-size: 14px;
}
select[multiple] { padding: 6px; }
input:focus, select:focus, textarea:focus { outline: none; border-color: var(--brand); box-shadow: 0 0 0 3px color-mix(in srgb, var(--brand) 20%, transparent); }
input[type=checkbox] { width: 17px; height: 17px; accent-color: var(--brand); vertical-align: -3px; }
.check { display: flex; gap: 10px; align-items: flex-start; font-weight: 500; }
.filters { display: flex; gap: 10px; flex-wrap: wrap; align-items: center; }
.filters input[type=search] { width: 240px; }
.filters select { width: auto; }
.seg { display: inline-flex; background: var(--surface-2); border-radius: 9px; padding: 3px; gap: 2px; }
.seg a { padding: 6px 12px; border-radius: 7px; font-size: 13px; font-weight: 600; color: var(--muted); }
.seg a:hover { text-decoration: none; color: var(--text); }
.seg a.on { background: var(--surface); color: var(--text); box-shadow: var(--shadow); }

/* ---------- Messages ---------- */
.messages { list-style: none; padding: 0; margin: 0 0 20px; display: grid; gap: 8px; }
.msg { padding: 12px 16px; border-radius: var(--radius-sm); border: 1px solid; display: flex; gap: 10px; align-items: center; font-weight: 500; }
.msg-success { background: var(--green-soft); border-color: color-mix(in srgb, var(--green) 30%, transparent); color: var(--green); }
.msg-error { background: var(--red-soft); border-color: color-mix(in srgb, var(--red) 30%, transparent); color: var(--red); }
.msg-info { background: var(--brand-soft); border-color: color-mix(in srgb, var(--brand) 30%, transparent); color: var(--brand); }
.msg-warning { background: var(--orange-soft); border-color: color-mix(in srgb, var(--orange) 30%, transparent); color: var(--orange); }
.msg-warning code { color: inherit; }

/* ---------- Empty states, misc ---------- */
.empty { text-align: center; padding: 48px 20px; color: var(--muted); }
.empty .big { width: 56px; height: 56px; border-radius: 16px; display: grid; place-items: center; margin: 0 auto 14px; background: var(--green-soft); color: var(--green); }
.kv { display: grid; grid-template-columns: max-content 1fr; gap: 10px 20px; font-size: 14px; margin: 0; }
.kv dt { color: var(--muted); }
.kv dd { margin: 0; word-break: break-word; }
.timeline { list-style: none; margin: 0; padding: 0; }
.timeline li { display: flex; gap: 12px; padding: 12px 0; border-bottom: 1px solid var(--border); }
.timeline li:last-child { border-bottom: 0; }
.timeline .ico { width: 30px; height: 30px; border-radius: 50%; display: grid; place-items: center; background: var(--green-soft); color: var(--green); flex: none; }
.hero-status { display: flex; align-items: center; gap: 16px; padding: 18px 20px; border-radius: var(--radius); }
.hero-status.green { background: var(--green-soft); color: var(--green); }
.hero-status.orange { background: var(--orange-soft); color: var(--orange); }
.hero-status.red { background: var(--red-soft); color: var(--red); }
.hero-status strong { font-size: 16px; display: block; }
.hero-status .t { color: var(--text); }

/* ---------- Login ---------- */
.auth {
  /* dvh = the visible height on phones (100vh includes the hidden address bar). */
  min-height: 100vh; min-height: 100dvh; display: grid; place-items: center; padding: 24px;
  background:
    radial-gradient(1000px 500px at 10% -10%, color-mix(in srgb, var(--brand) 18%, transparent), transparent),
    radial-gradient(800px 500px at 110% 110%, color-mix(in srgb, #7048e8 16%, transparent), transparent),
    var(--bg);
}
.auth-card { width: 100%; max-width: 420px; padding: 36px; box-shadow: var(--shadow-lg); }
.auth-card .brand { justify-content: center; font-size: 22px; margin-bottom: 8px; }
.auth-card .brand-mark { width: 40px; height: 40px; border-radius: 12px; }
.auth-card .tagline { text-align: center; color: var(--muted); margin-bottom: 28px; }
@media (max-width: 640px) {
  .auth { padding: 16px; }
  .auth-card { padding: 28px 22px; }
  .auth-card .tagline { margin-bottom: 22px; }
}
.btn-ms { width: 100%; padding: 12px; gap: 12px; font-size: 15px; }
.divider { display: flex; align-items: center; gap: 12px; color: var(--faint); font-size: 12px; margin: 24px 0 16px; text-transform: uppercase; letter-spacing: .06em; }
.divider::before, .divider::after { content: ""; flex: 1; height: 1px; background: var(--border); }
.devusers { display: grid; gap: 6px; max-height: 280px; overflow: auto; }
.devusers button { justify-content: flex-start; gap: 10px; text-align: left; font-weight: 500; }

/* ---------- Receipt ---------- */
.receipt { max-width: 640px; margin: 0 auto; }
.receipt-top { text-align: center; padding: 32px 24px 24px; }
.receipt-top .seal { width: 64px; height: 64px; border-radius: 50%; background: var(--green-soft); color: var(--green); display: grid; place-items: center; margin: 0 auto 14px; }
.quote { border-left: 3px solid var(--brand); padding: 10px 16px; background: var(--surface-2); border-radius: 0 8px 8px 0; font-style: italic; }
@media print {
  .topbar, .no-print { display: none !important; }
  body { background: #fff; }
  .card { box-shadow: none; }
}

/* ---------- Choice widgets (Django renders <div><div><label><input>…) ---------- */
input[type=radio] { width: 17px; height: 17px; accent-color: var(--brand); vertical-align: -3px; margin: 0; }
.field > div:has(> div > label > input[type=checkbox]),
.field > div:has(> div > label > input[type=radio]) { display: flex; flex-wrap: wrap; gap: 6px 18px; }
.field > div > div > label:has(> input) { display: flex; gap: 8px; align-items: center; font-weight: 500; margin: 0; cursor: pointer; }
.field.stacked > div:has(> div > label > input) { flex-direction: column; gap: 8px; }
.field.stacked > div > div > label:has(> input) { padding: 10px 12px; border: 1px solid var(--border); border-radius: var(--radius-sm); }
.field.stacked > div > div > label:has(> input:checked) { border-color: var(--brand); background: var(--surface-2); }
.field.stacked input:disabled + * , .field input:disabled { cursor: not-allowed; }

/* ---------- Admin area ---------- */
.tabs { display: flex; flex-wrap: wrap; gap: 4px; border-bottom: 1px solid var(--border); margin: -4px 0 22px; }
.tabs a { display: inline-flex; gap: 7px; align-items: center; padding: 10px 14px; font-weight: 600; font-size: 14px; color: var(--muted); border-bottom: 2px solid transparent; margin-bottom: -1px; white-space: nowrap; }
.tabs a:hover { color: var(--text); text-decoration: none; }
.tabs a.on { color: var(--brand); border-bottom-color: var(--brand); }
.checklist { list-style: none; margin: 0; padding: 0; }
.checklist li { display: flex; gap: 12px; align-items: flex-start; padding: 12px 0; border-bottom: 1px solid var(--border); }
.checklist li:last-child { border-bottom: 0; }
.checklist .ok { color: var(--green); } .checklist .warn { color: var(--orange); }
.checklist strong { display: block; font-weight: 600; }
.pager { display: flex; gap: 8px; align-items: center; justify-content: flex-end; }
details.panel > summary { cursor: pointer; list-style: none; }
details.panel > summary::-webkit-details-marker { display: none; }

/* ---------- Confirmation dialog ---------- */
.btn-danger-solid { background: var(--red); border-color: var(--red); color: #fff; }
.btn-danger-solid:hover { filter: brightness(.92); }
.dialog { border: 0; padding: 0; border-radius: var(--radius); background: var(--surface); color: var(--text);
  box-shadow: 0 20px 60px rgba(16, 24, 40, .25); width: min(440px, calc(100vw - 32px)); }
.dialog::backdrop { background: rgba(15, 20, 30, .45); backdrop-filter: blur(2px); }
.dialog[open] { animation: dialog-in .14s ease-out; }
@keyframes dialog-in { from { opacity: 0; transform: translateY(6px) scale(.98); } to { opacity: 1; transform: none; } }
.dialog-body { display: flex; gap: 14px; padding: 22px 22px 6px; }
.dialog-body h2 { margin: 2px 0 6px; font-size: 17px; }
.dialog-body p { margin: 0; color: var(--muted); font-size: 14.5px; line-height: 1.5; }
.dialog-icon { flex: none; width: 40px; height: 40px; border-radius: 11px; display: grid; place-items: center;
  background: var(--red-soft); color: var(--red); }
.dialog-icon.tone-brand { background: var(--brand-soft); color: var(--brand); }
.dialog-field { margin-top: 14px; }
.dialog-actions { display: flex; justify-content: flex-end; gap: 10px; padding: 18px 22px 20px; }
@media (prefers-reduced-motion: reduce) { .dialog[open] { animation: none; } }

/* ---------- Reminder banner (e.g. set up 2FA) ---------- */
.nudge { display: flex; align-items: center; gap: 14px; padding: 14px 16px; margin: 0 0 20px;
  border: 1px solid color-mix(in srgb, var(--orange) 35%, transparent); background: var(--orange-soft);
  border-radius: var(--radius); }
.nudge-icon { flex: none; width: 38px; height: 38px; border-radius: 10px; display: grid; place-items: center;
  background: var(--surface); color: var(--orange); }
.nudge-text { flex: 1; min-width: 0; font-size: 14px; }
.nudge-text strong { display: block; }
.nudge-text span { color: var(--muted); }
.nudge-actions { display: flex; gap: 8px; align-items: center; flex: none; }
@media (max-width: 700px) { .nudge { flex-wrap: wrap; } .nudge-actions { width: 100%; justify-content: flex-end; } }

/* ---------- Administration → Settings ---------- */
.settings-layout { display: grid; grid-template-columns: 230px minmax(0, 1fr); gap: 24px; align-items: start; }
.subnav { position: sticky; top: 20px; display: flex; flex-direction: column; gap: 2px; }
.subnav a { display: flex; align-items: center; gap: 10px; padding: 9px 12px; border-radius: var(--radius-sm); color: var(--muted); font-weight: 600; font-size: 14px; }
.subnav a:hover { background: var(--surface-2); color: var(--text); text-decoration: none; }
.subnav a.on { background: var(--brand-soft); color: var(--brand); }
.subnav .state { margin-left: auto; display: inline-flex; align-items: center; gap: 6px; font-size: 11.5px; font-weight: 600; color: var(--faint); white-space: nowrap; }
.subnav .state i { width: 7px; height: 7px; border-radius: 50%; background: var(--faint); }
.subnav .state-green i { background: var(--green); }
.subnav .state-orange i { background: var(--orange); }
.subnav .state-orange { color: var(--orange); }
.subnav a.on .state-label { color: inherit; opacity: .8; }

.fieldset { display: grid; grid-template-columns: 240px minmax(0, 1fr); gap: 14px 32px; padding: 22px 20px; margin: 0; border: 0; }
.fieldset + .fieldset { border-top: 1px solid var(--border); }
.fieldset-head h3 { font-size: 14.5px; margin: 0 0 4px; display: flex; align-items: center; gap: 6px; }
.fieldset-head p { margin: 0; font-size: 13px; color: var(--muted); line-height: 1.5; }
.fieldset.is-dimmed .form-grid { opacity: .5; }
.fieldset.is-dimmed .fieldset-head p::after { content: " Not used while sending is off."; }
details.fieldset > summary { list-style: none; cursor: pointer; }
details.fieldset > summary::-webkit-details-marker { display: none; }
details.fieldset > summary h3 .icon { transition: transform .15s; transform: rotate(-90deg); }
details.fieldset[open] > summary h3 .icon { transform: none; }
details.fieldset:not([open]) { grid-template-columns: 1fr; }
.field-align { padding-top: 30px; }
.presets { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 12px; }
.save-bar { position: sticky; bottom: 0; z-index: 2; }

.steps { list-style: none; margin: 0; display: flex; flex-direction: column; gap: 16px; }
.steps li { display: flex; gap: 14px; align-items: flex-start; }
.steps li p { margin: 3px 0 8px; font-size: 13px; color: var(--muted); }
.steps li strong { font-size: 14px; }
.step-mark { flex: none; width: 26px; height: 26px; border-radius: 50%; display: grid; place-items: center; font-size: 12.5px; font-weight: 700;
  background: var(--surface-2); color: var(--muted); border: 1px solid var(--border); }
.steps li.done .step-mark { background: var(--green-soft); color: var(--green); border-color: transparent; }
.steps li.done strong { color: var(--muted); }
.copy-field { display: flex; gap: 8px; max-width: 560px; }
.copy-field input { font-family: ui-monospace, SFMono-Regular, Menlo, monospace; font-size: 13px; }

@media (max-width: 1060px) { .fieldset { grid-template-columns: 1fr; } .field-align { padding-top: 0; } }
@media (max-width: 860px) {
  .settings-layout { grid-template-columns: minmax(0, 1fr); gap: 16px; }
  .subnav { position: static; flex-direction: row; flex-wrap: wrap; gap: 4px; }
  .subnav a { white-space: nowrap; padding: 8px 10px; }
  .subnav .state-label, .hide-sm { display: none; }
}

/* ---------- Phones ---------- */
/* Hide less important table columns: <table class="table hide-col-3 hide-col-5"> */
@media (max-width: 640px) {
  .hide-col-2 tr > :nth-child(2) { display: none; }
  .hide-col-3 tr > :nth-child(3) { display: none; }
  .hide-col-4 tr > :nth-child(4) { display: none; }
  .hide-col-5 tr > :nth-child(5) { display: none; }
  .hide-col-6 tr > :nth-child(6) { display: none; }
  .hide-col-7 tr > :nth-child(7) { display: none; }
  .hide-col-8 tr > :nth-child(8) { display: none; }

  .page { padding-left: 16px; padding-right: 16px; }
  .topbar-inner { padding-left: 16px; padding-right: 16px; gap: 10px; }
  .usermenu { gap: 4px; margin-left: auto; }
  .legend { display: none; }

  /* The topbar's backdrop-filter would make it the containing block for the fixed tab bar. */
  .topbar { backdrop-filter: none; background: var(--surface); }
  /* Main navigation becomes a bottom tab bar (managers and admins have several sections). */
  .nav { display: none; }
  .nav.nav-multi {
    display: flex; position: fixed; left: 0; right: 0; bottom: 0; z-index: 50; gap: 0;
    background: var(--surface); border-top: 1px solid var(--border);
    padding: 6px 6px calc(6px + env(safe-area-inset-bottom));
  }
  .nav.nav-multi a { flex: 1; flex-direction: column; gap: 3px; padding: 6px 4px; font-size: 11.5px; justify-content: center; }
  .nav.nav-multi a span { display: block; }
  body.has-tabbar { padding-bottom: calc(68px + env(safe-area-inset-bottom)); }
  body.has-tabbar .save-bar { bottom: calc(62px + env(safe-area-inset-bottom)); }
}
