/* AUTH — admin panel and sign-in pages.
   Patch _0032: redesigned. A calm, crisp console: cool grey canvas, white
   surfaces with hairline borders (no drop shadows on everything), one deep
   evergreen for AUTH itself (the sidebar and primary buttons), text labels
   instead of mystery symbols, and boxes in a grid that become one box per
   row on a phone. System fonts — the CSP allows no outside fonts, and they
   are what the person's own computer renders best. */

:root {
  /* Patch _0032: the owner's colours — orange, light grey, dark grey and white.
     Dark grey text on light backgrounds and light buttons; white text on dark ones. */
  --canvas: #f1f2f4;          /* light grey page */
  --surface: #ffffff;
  --surface-2: #f6f7f8;
  --ink: #2a2e33;             /* dark grey text */
  --ink-soft: #60666d;
  --ink-faint: #8f959b;
  --line: #e2e4e7;
  --line-strong: #cfd3d8;
  --brand: #2a2e33;           /* dark grey sidebar */
  --brand-2: #3a3f45;
  --orange: #f08a3c;          /* buttons and highlights (dark grey text on it) */
  --orange-deep: #e07624;
  --orange-ink: #a64b0a;      /* orange text on white */
  --orange-tint: #fdeee2;
  --accent: var(--orange-ink);
  --accent-deep: #8a3e08;
  --accent-tint: var(--orange-tint);
  --ok: #2f7a4f;
  --ok-bg: #e6f3eb;
  --danger: #c0392b;
  --danger-bg: #fdecea;
  --warn: #9a5b00;
  --warn-bg: #fff3dc;
  --info: #4a5360;
  --info-bg: #eceef1;
  --gold: #a64b0a;
  --gold-bg: #fdeee2;
  --radius: 10px;
  --radius-sm: 7px;
  --side-w: 244px;
  /* names kept from before _0032 (utility classes use them) */
  --paper: var(--canvas);
  --paper-raised: var(--surface);
  --accent-ink: var(--ink);
  --success: var(--ok);
  --success-bg: var(--ok-bg);
}

* { box-sizing: border-box; }

html, body {
  margin: 0;
  padding: 0;
  background: var(--canvas);
  color: var(--ink);
  font-family: system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  font-size: 15px;
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
}

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

h1 { font-size: 1.55rem; font-weight: 650; letter-spacing: -0.015em; line-height: 1.25; margin: 0 0 1.1rem; }
h1 + .admin-hint, h1 + .admin-welcome { margin-top: -0.75rem; }
.sub { color: var(--ink-soft); font-size: 0.82rem; }
h1 .admin-hint { font-size: 0.95rem; font-weight: 400; margin: 0 0 0 0.35rem; }
h2 { font-size: 1.02rem; font-weight: 650; margin: 0 0 0.8rem; letter-spacing: -0.005em; }
h3 { font-size: 0.92rem; font-weight: 650; }

code {
  font-family: ui-monospace, "SF Mono", "Cascadia Mono", Consolas, monospace;
  font-size: 0.85em;
  background: var(--surface-2);
  border: 1px solid var(--line);
  border-radius: 5px;
  padding: 0.08em 0.38em;
}

:focus-visible { outline: 3px solid rgba(240, 138, 60, 0.45); outline-offset: 2px; border-radius: 4px; }

/* --- Sign-in and person pages --- */

body.auth-page { display: flex; align-items: center; justify-content: center; min-height: 100vh; }
.auth-shell { width: 100%; max-width: 400px; padding: 1.5rem; }
.auth-card { background: var(--surface); border: 1px solid var(--line); border-radius: 14px; padding: 2rem; box-shadow: 0 1px 2px rgba(21, 32, 43, 0.04), 0 8px 24px rgba(21, 32, 43, 0.05); }
.auth-brand { font-weight: 700; letter-spacing: 0.01em; color: var(--brand); margin: 0 0 1.25rem; font-size: 1rem; }
.auth-sub { color: var(--ink-soft); margin: -0.75rem 0 1.25rem; font-size: 0.92rem; }
.auth-card .auth-sub:last-child { margin: 1.1rem 0 0; }

/* --- Forms --- */

.auth-form label, .stack-form label { display: block; font-size: 0.86rem; font-weight: 500; color: var(--ink-soft); margin-bottom: 0.9rem; }
input[type=text], input[type=email], input[type=password], input[type=number], input[type=url], input[type=search], select, textarea {
  font: inherit; font-size: 0.92rem; color: var(--ink);
  background: var(--surface); border: 1px solid var(--line-strong); border-radius: var(--radius-sm);
  padding: 0.48rem 0.65rem; min-height: 38px;
}
textarea { min-height: 0; }
input:focus, select:focus, textarea:focus { outline: none; border-color: var(--orange); box-shadow: 0 0 0 3px rgba(240, 138, 60, 0.22); }
.auth-form input, .stack-form input, .stack-form select { display: block; width: 100%; margin-top: 0.3rem; }
.stack-form input[type=checkbox], .auth-form input[type=checkbox] { display: inline; width: auto; margin: 0 0.4rem 0 0; min-height: 0; }
input[type=checkbox], input[type=radio] { accent-color: var(--orange-deep); width: 16px; height: 16px; vertical-align: -3px; }

button {
  font: inherit; font-size: 0.9rem; font-weight: 600;
  background: var(--orange); color: var(--ink);
  border: 1px solid var(--orange); border-radius: var(--radius-sm);
  padding: 0.5rem 1rem; min-height: 38px; cursor: pointer;
  display: inline-flex; align-items: center; justify-content: center; gap: 0.4rem;
}
button:hover { background: var(--orange-deep); border-color: var(--orange-deep); }
button.dark { background: var(--ink); border-color: var(--ink); color: #fff; }
button.dark:hover { background: #3a3f45; border-color: #3a3f45; }
button.secondary { background: var(--surface); color: var(--ink); border-color: var(--line-strong); }
button.secondary:hover { background: var(--surface-2); border-color: var(--ink-faint); }
button.danger { background: var(--danger); border-color: var(--danger); color: #fff; }
button.danger:hover { background: #a93226; border-color: #a93226; }
button .ic { width: 16px; height: 16px; }

.auth-error, .flash-error, .flash-success {
  border-radius: var(--radius-sm); padding: 0.7rem 0.9rem; font-size: 0.9rem; margin: 0 0 1rem;
  border: 1px solid; overflow-wrap: anywhere;
}
.auth-error, .flash-error { background: var(--danger-bg); color: #8e2a20; border-color: #f2c4bf; }
.flash-success { background: var(--ok-bg); color: #24603d; border-color: #c3e2cf; }

/* --- Admin shell: sidebar + content --- */

.side {
  position: fixed; top: 0; left: 0; bottom: 0; width: var(--side-w); z-index: 40;
  background: var(--brand); color: #d6e4df;
  display: flex; flex-direction: column;
}
.side-head { display: flex; align-items: center; justify-content: space-between; padding: 1.1rem 1rem 1rem 1.15rem; }
.brand { display: flex; align-items: center; gap: 0.65rem; color: #fff; }
.brand:hover { color: #fff; text-decoration: none; }
.brand-mark {
  width: 34px; height: 34px; border-radius: 9px; display: grid; place-items: center;
  background: var(--orange); color: var(--ink); font-weight: 800; font-size: 1rem;
}
.brand-text { display: flex; flex-direction: column; font-weight: 700; letter-spacing: 0.02em; line-height: 1.15; }
.brand-text small { font-weight: 400; font-size: 0.75rem; color: #a7adb3; letter-spacing: 0; }
.side-toggle { display: none; background: transparent; border-color: rgba(255,255,255,0.25); color: #fff; min-height: 36px; padding: 0.3rem 0.55rem; }
.side-toggle:hover { background: rgba(255,255,255,0.08); border-color: rgba(255,255,255,0.4); }
.side-toggle .ic { width: 20px; height: 20px; }
.side-menu { display: flex; flex-direction: column; flex: 1; min-height: 0; overflow-y: auto; padding: 0.25rem 0.7rem 0.9rem; }
.side-list, .side-sub { list-style: none; margin: 0; padding: 0; }
.side-list > li > a {
  display: flex; align-items: center; gap: 0.7rem;
  padding: 0.55rem 0.7rem; margin: 1px 0; border-radius: 8px;
  color: #d9dcdf; font-size: 0.93rem; font-weight: 500;
}
.side-list > li > a .ic { width: 18px; height: 18px; color: #a7adb3; }
.side-list > li > a:hover { background: rgba(255,255,255,0.07); color: #fff; text-decoration: none; }
.side-list > li > a.active { background: rgba(255,255,255,0.1); color: #fff; box-shadow: inset 3px 0 0 var(--orange); }
.side-list > li > a.active .ic { color: var(--orange); }
.side-sub { margin: 0.1rem 0 0.5rem 2.15rem; border-left: 1px solid rgba(255,255,255,0.14); }
.side-sub a, .side-sub button.admin-nav-logout {
  display: block; width: 100%; text-align: left; padding: 0.34rem 0.75rem; margin-left: -1px;
  border-left: 2px solid transparent; color: #b5babf; font-size: 0.86rem; font-weight: 500;
  background: none; border-top: 0; border-right: 0; border-bottom: 0; border-radius: 0; min-height: 0;
}
.side-sub a:hover, .side-sub button.admin-nav-logout:hover { color: #fff; text-decoration: none; background: none; }
.side-sub a.active { color: #fff; border-left-color: var(--orange); }
.side-foot { margin-top: auto; padding-top: 0.9rem; border-top: 1px solid rgba(255,255,255,0.1); }
.side-me { display: flex; align-items: center; gap: 0.6rem; padding: 0 0.7rem 0.4rem; }
.avatar { width: 32px; height: 32px; border-radius: 50%; display: grid; place-items: center; background: var(--brand-2); color: #eceef0; font-size: 0.78rem; font-weight: 700; flex: none; }
.side-me-name { display: flex; flex-direction: column; color: #fff; font-size: 0.88rem; font-weight: 600; line-height: 1.2; }
.side-me-name small { color: #a7adb3; font-weight: 400; font-size: 0.75rem; }
.side-account { margin-left: 1.55rem; }

.admin-main { margin-left: var(--side-w); padding: 2rem 2.25rem 4rem; max-width: calc(1240px + var(--side-w)); }
.banner-error, .banner-note { margin-left: var(--side-w); }
.admin-hint { color: var(--ink-soft); margin: 0 0 1.4rem; font-size: 0.9rem; max-width: 80ch; }
.admin-welcome { color: var(--ink-soft); margin: 0 0 1.4rem; font-size: 0.92rem; }

/* --- Surfaces --- */

.panel { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: 1.25rem 1.35rem; margin-bottom: 1.25rem; }
.panel > h2:first-child { margin-top: 0; }
.panel .admin-hint { margin-bottom: 1rem; }
.stack-form { max-width: 460px; }

/* Stat tiles (Dashboard) */
.stat-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(170px, 1fr)); gap: 0.9rem; margin: 0 0 1.25rem; }
.stat-card { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: 1rem 1.1rem; display: flex; flex-direction: column-reverse; gap: 0.15rem; }
.stat-num { font-size: 1.75rem; font-weight: 700; letter-spacing: -0.02em; color: var(--ink); font-variant-numeric: tabular-nums; }
.stat-label { color: var(--ink-soft); font-size: 0.84rem; font-weight: 500; }

/* Box grids: Dashboard, Consumers, Housekeeping, Tools — one box per row on a phone */
.box-grid, .tool-grid, .hk-grid, .dash-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(290px, 1fr)); gap: 0.9rem; margin: 0 0 1.25rem; }
.dash-grid { grid-template-columns: repeat(auto-fill, minmax(340px, 1fr)); }

/* Tables */
table { width: 100%; border-collapse: collapse; font-size: 0.9rem; }
th, td { text-align: left; padding: 0.6rem 0.75rem; border-bottom: 1px solid var(--line); vertical-align: middle; }
th { color: var(--ink-soft); font-weight: 600; font-size: 0.8rem; background: var(--surface-2); }
thead th:first-child { border-top-left-radius: var(--radius-sm); }
thead th:last-child { border-top-right-radius: var(--radius-sm); }
tbody tr:last-child > td { border-bottom: 0; }
td { font-variant-numeric: tabular-nums; }

.inline-form { display: flex; gap: 0.45rem; align-items: center; flex-wrap: wrap; }
.inline-form input[type=text], .inline-form input[type=email], .inline-form input[type=password], .inline-form input[type=number], .inline-form input[type=url] { flex: 1; min-width: 0; }
.inline-form button { min-height: 36px; padding: 0.4rem 0.85rem; font-size: 0.86rem; }

.error-shell { text-align: center; padding: 3rem 1.5rem; }
.error-shell h1 { font-size: 3rem; }

@media (prefers-reduced-motion: reduce) { * { transition: none !important; animation: none !important; } }

.passkey-btn { width: 100%; margin-top: 0.6rem; }
.auth-form button[type=submit] { width: 100%; }
.delete-list { font-size: .88rem; margin: .25rem 0 1rem 1.1rem; padding: 0; }
.delete-list li { margin: .2rem 0; }

/* Patch _0030: what used to be written into the pages as style="…" (the
 * Content Security Policy now refuses inline styles). !important keeps each one
 * as strong as the inline style it replaces. */
.u-banner-warn { background:#fff4d6 !important; color:#6b4b00 !important; border:1px solid #e6c56b !important; padding:.6rem !important; }
.u-bd-2px-solid-accent { border:2px solid var(--accent) !important; }
.u-bd-2px-solid-danger { border:2px solid var(--danger) !important; }
.u-box-accent { border:1px solid var(--accent) !important; border-radius:4px !important; padding:.6rem .8rem !important; }
.u-country-list { max-height:14rem !important; overflow:auto !important; border:1px solid #ccc !important; padding:.4rem !important; columns:3 !important; font-size:.85rem !important; }
.u-d-block-m-0 { display:block !important; margin:0 !important; }
.u-d-inline { display:inline !important; }
.u-d-inline-block-mr-1rem { display:inline-block !important; margin-right:1rem !important; }
.u-d-inline-flex-ml-0-5rem { display:inline-flex !important; margin-left:.5rem !important; }
.u-flex-wrap-wrap { flex-wrap:wrap !important; }
.u-fs-0-8rem { font-size:.8rem !important; }
.u-fs-0-95rem-mt-1-5rem { font-size:.95rem !important; margin-top:1.5rem !important; }
.u-fs-0-95rem-mt-1rem { font-size:.95rem !important; margin-top:1rem !important; }
.u-fs-1-1rem-lh-1-8 { font-size:1.1rem !important; line-height:1.8 !important; }
.u-fs-1-2rem-ls-0-08em { font-size:1.2rem !important; letter-spacing:.08em !important; }
.u-fs-1rem-lh-1-6 { font-size:1rem !important; line-height:1.6 !important; }
.u-fw-700-td-none { font-weight:700 !important; text-decoration:none !important; }
.u-link-button { background:none !important; border:none !important; padding:0 !important; cursor:pointer !important; font:inherit !important; color:inherit !important; }
.u-m-0 { margin:0 !important; }
.u-m-0-0-0-5rem { margin:0 0 .5rem !important; }
.u-m-0-3rem-0-0 { margin:.3rem 0 0 !important; }
.u-maxh-8rem { max-height:8rem !important; }
.u-mb-0-2rem { margin-bottom:.2rem !important; }
.u-mt-0-4rem { margin-top:.4rem !important; }
.u-mt-0-5rem { margin-top:.5rem !important; }
.u-mt-0-6rem { margin-top:.6rem !important; }
.u-mt-0-8rem { margin-top:.8rem !important; }
.u-mt-1-5rem { margin-top:1.5rem !important; }
.u-mt-1rem { margin-top:1rem !important; }
.u-offscreen { position:absolute !important; left:-10000px !important; top:auto !important; width:1px !important; height:1px !important; overflow:hidden !important; }
.u-p-0-15rem-0-5rem-fs-0-8rem { padding:.15rem .5rem !important; font-size:.8rem !important; }
.u-p-0-2rem-0-5rem-fs-0-8rem { padding:.2rem .5rem !important; font-size:.8rem !important; }
.u-pre-box { background:#f6f6f2 !important; border:1px solid #ddd !important; padding:.6rem !important; font-size:.85rem !important; white-space:pre-wrap !important; }
.u-pre-box-small { white-space:pre-wrap !important; word-break:break-all !important; background:#f6f6f2 !important; border:1px solid #ddd !important; padding:.5rem !important; }
.u-qr-frame { background:#fff !important; display:inline-block !important; padding:8px !important; border-radius:6px !important; }
.u-ta-center-m-0-75rem-0 { text-align:center !important; margin:.75rem 0 !important; }
.u-ta-left { text-align:left !important; }
.u-tabs-row { display:flex !important; flex-wrap:wrap !important; gap:.25rem 1rem !important; margin:.5rem 0 1rem !important; border-bottom:1px solid #ccc !important; padding-bottom:.4rem !important; }
.u-top-right-small { text-align:right !important; font-size:.85rem !important; margin:0 0 .5rem !important; }
.u-w-100 { width:100% !important; }
.u-w-100-ff-monospace { width:100% !important; font-family:monospace !important; }
.u-w-100-fs-0-85rem-bc-collapse { width:100% !important; font-size:.85rem !important; border-collapse:collapse !important; }
.u-w-100-h-24rem-ff-monospace { width:100% !important; height:24rem !important; font-family:monospace !important; }
.u-w-14rem { width:14rem !important; }
.u-w-9rem { width:9rem !important; }
.u-wb-break-all { word-break:break-all !important; }
.u-ws-nowrap { white-space:nowrap !important; }

/* Admin panel banners (lib/admin-ui.php) */
.banner-error { background: #9c3b30; color: #fff; padding: 10px 16px; font-weight: 600; }
.banner-note { background: #fff4d6; color: #6b4b00; padding: 8px 16px; font-weight: 600; border-bottom: 1px solid #e6c56b; }

/* Audit log (was a <style> block in audit.php) */
.audit td { font-size: 0.85rem; vertical-align: top; padding: 0.3rem 0.45rem; } .audit td.d { white-space: pre-wrap; word-break: break-word; }

/* Test consumer page (was in consumer-test.php) */
.page-test .json { background:#f6f6f2; border:1px solid #ddd; padding:.6rem; font-size:.82rem; white-space:pre-wrap; word-break:break-word; max-height:28rem; overflow:auto; } .page-test .ok { color:#2e6b3a; font-weight:700; } .page-test .bad { color:#9c3b30; font-weight:700; } .page-test textarea.json { width:100%; min-height:8rem; font-family:monospace; }

/* Texts page (was in texts.php) */
.tx td, .tx th { padding: 0.3rem 0.45rem; vertical-align: top; font-size: 0.85rem; }
  .tx td.en { width: 40%; color: var(--ink-soft); white-space: pre-wrap; }
  .tx .pw { white-space: pre-wrap; }
  .tx details form { margin-top: 0.2rem; }
  .tx summary { cursor: pointer; list-style: none; }
  .tx summary::-webkit-details-marker { display: none; }
  .tx summary:hover { text-decoration: underline; }
  .tx details[open] summary { display: none; }
  .tx textarea { width: 100%; font: inherit; }
  .tx .st { font-size: 0.75rem; white-space: nowrap; }
  .tx .st-missing { color: #b00020; font-weight: 600; }
  .tx .st-draft { color: #8a5a00; }
  .tx .st-verified { color: #1f5fa8; }
  .tx .st-approved { color: #2e7d32; }
  .tx tr:target td { background: #fff6cc; }
  .tx-bar { display: flex; flex-wrap: wrap; gap: 0.5rem; align-items: center; margin: 0.6rem 0; }
  .tx-bar button { padding: 0.35rem 0.7rem; font-size: 0.82rem; }

/* --- Patch _0031/_0032: symbols, buttons, tooltips, pills --- */

.u-sprite { position: absolute; width: 0; height: 0; overflow: hidden; }
.ic { width: 16px; height: 16px; display: inline-block; vertical-align: middle; fill: none; stroke: currentColor; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; flex: none; }
.ic-form { display: inline-flex; margin: 0; vertical-align: middle; }
.ic-btn {
  display: inline-flex; align-items: center; justify-content: center;
  width: 32px; height: 32px; min-height: 0; padding: 0; margin: 0 1px; border-radius: 8px;
  background: transparent; color: var(--ink-soft); border: 1px solid transparent;
  cursor: pointer; font-size: 1rem; line-height: 1; vertical-align: middle; text-decoration: none;
}
.ic-btn:hover { background: #eef2f5; color: var(--ink); border-color: var(--line); text-decoration: none; }
.ic-btn .ic { width: 17px; height: 17px; }
.ic-btn.danger, button.ic-btn.danger, .ic-btn.ring { background: transparent; border-color: transparent; color: var(--danger); }
.ic-btn.danger:hover, button.ic-btn.danger:hover, .ic-btn.ring:hover { background: var(--danger-bg); color: #a93226; border-color: #f2c4bf; }
.ic-btn.make { color: var(--orange-deep); }
.ic-btn.make:hover { background: var(--orange-tint); color: var(--accent-deep); border-color: #f6cfae; }
.ic-btn.make .ic, .ic-btn.admin-on .ic { fill: currentColor; }
.ic-btn[aria-expanded="true"] { background: var(--orange-tint); color: var(--accent-deep); border-color: #f6cfae; }
.inline-form .ic-btn, .list-bar .ic-btn { min-height: 0; padding: 0; }

.pill {
  display: inline-flex; align-items: center; gap: 0.3rem; white-space: nowrap;
  font-size: 0.75rem; font-weight: 600; line-height: 1; padding: 0.3rem 0.55rem; border-radius: 999px;
  background: #eef1f4; color: #46525f; vertical-align: middle; margin: 1px 3px 1px 0;
}
.pill.ok { background: var(--ok-bg); color: var(--ok); }
.pill.warn { background: var(--warn-bg); color: var(--warn); }
.pill.bad { background: var(--danger-bg); color: #a12f23; }
.pill.info { background: var(--info-bg); color: var(--info); }
.pill.admin { background: var(--gold-bg); color: var(--gold); }
.pill::before { content: ""; width: 6px; height: 6px; border-radius: 50%; background: currentColor; opacity: 0.75; }
.pill.plain::before { display: none; }

[data-tip] { position: relative; }
[data-tip]:hover::after, [data-tip]:focus-visible::after {
  content: attr(data-tip); position: absolute; bottom: calc(100% + 7px); left: 50%; transform: translateX(-50%); z-index: 80;
  background: var(--ink); color: #fff; font-size: 0.75rem; font-weight: 500; line-height: 1.3; padding: 0.35rem 0.55rem; border-radius: 6px;
  white-space: nowrap; pointer-events: none; box-shadow: 0 4px 12px rgba(0,0,0,0.15);
}
td.act [data-tip]:hover::after, td.act [data-tip]:focus-visible::after { left: auto; right: 0; transform: none; }

/* --- Compact lists --- */

.list-bar { display: flex; flex-wrap: wrap; align-items: center; gap: 0.5rem 0.75rem; margin: 0 0 0.9rem; font-size: 0.86rem; }
.list-bar label { display: inline-flex; align-items: center; gap: 0.35rem; color: var(--ink-soft); font-size: 0.84rem; font-weight: 500; }
.list-bar label > .ic { color: var(--ink-faint); margin-right: -1.95rem; position: relative; z-index: 1; margin-left: 0.6rem; }
.list-bar input[type=search] { padding-left: 2.1rem; min-width: 16rem; }
.list-bar select, .list-bar input { min-height: 36px; padding-top: 0.35rem; padding-bottom: 0.35rem; }
.list-bar button { min-height: 36px; padding: 0.35rem 0.85rem; font-size: 0.86rem; }
.list-bar .per-page { margin-left: auto; }
.pager { display: inline-flex; align-items: center; gap: 0.2rem; color: var(--ink-soft); font-size: 0.84rem; white-space: nowrap; font-variant-numeric: tabular-nums; }
.pager .ic-btn { border-color: var(--line); background: var(--surface); }

table.compact { font-size: 0.9rem; border: 1px solid var(--line); border-radius: var(--radius-sm); border-collapse: separate; border-spacing: 0; overflow: hidden; }
table.compact th, table.compact td { padding: 0.5rem 0.7rem; }
table.compact td.act { white-space: nowrap; text-align: right; width: 1%; }
table.compact td.nw, table.compact .nw { white-space: nowrap; }
table.compact .sub { color: var(--ink-soft); font-size: 0.82rem; }
table.compact td > a:first-child { font-weight: 600; color: var(--ink); }
table.compact td > a:first-child:hover { color: var(--accent); }
table.compact .who { display: flex; align-items: center; gap: 0.6rem; }
table.compact .who .avatar { width: 30px; height: 30px; background: #e7edf1; color: #46525f; font-size: 0.72rem; }
table.compact .who-text { display: flex; flex-direction: column; line-height: 1.25; min-width: 0; }
table.compact .who-text a { font-weight: 600; color: var(--ink); }
table.compact tbody tr:hover > td { background: #fafbfc; }
table.compact tr.row-panel > td { background: var(--surface-2); padding: 0.85rem 1rem; box-shadow: inset 3px 0 0 var(--accent); }
table.compact tr.row-panel:hover > td { background: var(--surface-2); }
table.compact tr.row-detail > td { background: #fbfcfd; font-size: 0.84rem; white-space: pre-wrap; word-break: break-word; color: var(--ink-soft); padding: 0.75rem 1rem 0.9rem 2rem; }
table.compact tr[data-expand] { cursor: pointer; }
table.compact tr[data-expand] td:first-child::before { content: ""; display: inline-block; width: 6px; height: 6px; margin: 0 0.6rem 0.15rem 0; border-right: 1.5px solid var(--ink-faint); border-bottom: 1.5px solid var(--ink-faint); transform: rotate(-45deg); transition: transform .12s; }
table.compact tr[data-expand][aria-expanded="true"] td:first-child::before { transform: rotate(45deg); }
.chip { display: inline-flex; align-items: center; gap: 0.15rem; background: #eef1f4; border-radius: 999px; padding: 0.12rem 0.2rem 0.12rem 0.6rem; font-size: 0.8rem; font-weight: 500; margin: 1px 3px 1px 0; white-space: nowrap; color: #2f3b47; }
.chip.admin { background: var(--gold-bg); color: var(--gold); font-weight: 600; }
.chip.admin .ic { width: 13px; height: 13px; fill: currentColor; }
.chip .ic-form .ic-btn, .chip .ic-form button.ic-btn.danger { width: 20px; height: 20px; border-radius: 50%; color: var(--ink-faint); }
.chip .ic-form .ic-btn:hover, .chip .ic-form button.ic-btn.danger:hover { color: var(--danger); background: var(--danger-bg); border-color: transparent; }
.chip .ic-form .ic-btn .ic { width: 11px; height: 11px; }
.chip.solo { padding-right: 0.6rem; gap: 0.3rem; }
.panel-form { display: flex; flex-wrap: wrap; align-items: flex-end; gap: 0.6rem 0.8rem; margin: 0; }
.panel-form label { display: flex; flex-direction: column; font-size: 0.8rem; font-weight: 500; color: var(--ink-soft); gap: 0.25rem; }
.panel-form label.cb { flex-direction: row; align-items: center; gap: 0.4rem; min-height: 38px; }
.panel-form input[type=text], .panel-form input[type=email], .panel-form input[type=password], .panel-form input[type=number], .panel-form select { min-width: 14rem; }
.panel-form + .panel-form { margin-top: 0.7rem; }
.panel-note { font-size: 0.82rem; color: var(--ink-soft); margin: 0.5rem 0 0; }
.panel-box { background: var(--surface-2); border: 1px solid var(--line); border-radius: var(--radius-sm); padding: 0.9rem 1rem; margin: 0 0 1rem; }
.section-head { display: flex; align-items: center; gap: 0.75rem; margin: 0 0 0.8rem; flex-wrap: wrap; }
.section-head h1, .section-head h2 { margin: 0; }
.section-head .grow { flex: 1; }
.btn-add { display: inline-flex; align-items: center; gap: 0.4rem; padding-left: 0.8rem; }
.btn-add .ic { width: 16px; height: 16px; }
.btn-add[aria-expanded="true"] { box-shadow: 0 0 0 3px rgba(240, 138, 60, 0.25); }
.btn-link { font-size: 0.86rem; font-weight: 500; }

/* Consumer tabs */
.tabs.u-tabs-row { border-bottom: 1px solid var(--line) !important; gap: 0 1.4rem !important; padding-bottom: 0 !important; margin: 0.6rem 0 1.25rem !important; overflow-x: auto; flex-wrap: nowrap !important; }
.tabs.u-tabs-row a { color: var(--ink-soft); font-weight: 500; font-size: 0.9rem; padding: 0.6rem 0; border-bottom: 2px solid transparent; white-space: nowrap; }
.tabs.u-tabs-row a:hover { color: var(--ink); text-decoration: none; }
.tabs.u-tabs-row a[aria-current="page"] { color: var(--ink); border-bottom-color: var(--orange); font-weight: 650 !important; }
.panel > nav.u-tabs-row { border-bottom: 1px solid var(--line) !important; gap: 0 1.2rem !important; padding-bottom: 0 !important; }
.panel > nav.u-tabs-row a { padding: 0.45rem 0; border-bottom: 2px solid transparent; color: var(--ink-soft); font-size: 0.88rem; }
.panel > nav.u-tabs-row a[aria-current="page"] { color: var(--ink); border-bottom-color: var(--orange); }

/* --- Consumers: one card each --- */
.ccard {
  display: flex; flex-direction: column; gap: 0.85rem;
  background: var(--surface); border: 1px solid var(--line); border-radius: 12px; padding: 1.1rem 1.15rem 1rem;
  color: var(--ink); min-height: 176px; transition: border-color .12s, box-shadow .12s;
}
.ccard:hover { border-color: #f2b383; box-shadow: 0 6px 18px rgba(42, 46, 51, 0.08); color: var(--ink); text-decoration: none; }
.ccard-top { display: flex; align-items: center; gap: 0.8rem; }
.mono { width: 44px; height: 44px; border-radius: 11px; display: grid; place-items: center; font-weight: 750; font-size: 1rem; letter-spacing: 0.02em; flex: none; }
.mono-0 { background: var(--orange-tint); color: var(--orange-ink); }
.mono-1 { background: #e7e9ec; color: var(--ink); }
.mono-2 { background: #fbe0c9; color: #8a3e08; }
.mono-3 { background: #dcdfe3; color: #3a3f45; }
.mono-4 { background: #fff4ea; color: #b85a12; border: 1px solid #f6cfae; }
.mono-5 { background: #f1f2f4; color: #4a5058; border: 1px solid var(--line-strong); }
.mono-self { background: var(--ink); color: var(--orange); }
.ccard-name { font-weight: 650; font-size: 1.02rem; line-height: 1.25; }
.ccard-dom { color: var(--ink-soft); font-size: 0.84rem; }
.ccard-pills { display: flex; flex-wrap: wrap; gap: 0.3rem; min-height: 22px; }
.ccard-stats { display: grid; grid-template-columns: 1fr 1fr 1.4fr; gap: 0.5rem; margin: auto 0 0; padding-top: 0.8rem; border-top: 1px solid var(--line); }
.ccard-stats div { display: flex; flex-direction: column-reverse; }
.ccard-stats dt { font-size: 0.76rem; color: var(--ink-soft); font-weight: 500; }
.ccard-stats dd { margin: 0; font-weight: 650; font-size: 1.05rem; font-variant-numeric: tabular-nums; }
.ccard-stats dd.small { font-size: 0.86rem; font-weight: 600; padding-top: 0.15rem; }
.ccard.add { align-items: center; justify-content: center; border: 1.5px dashed var(--line-strong); background: transparent; color: var(--ink); font-weight: 600; cursor: pointer; font-size: 0.95rem; min-height: 176px; }
.ccard.add:hover { background: var(--surface); border-color: var(--orange); box-shadow: none; }
.ccard.add .ic { color: var(--orange-deep); }
.ccard.add .ic { width: 22px; height: 22px; }

/* --- Housekeeping and Dashboard boxes --- */
.hk { display: flex; flex-direction: column; gap: 0.45rem; background: var(--surface); border: 1px solid var(--line); border-radius: 12px; padding: 1rem 1.1rem; }
.hk.bad { border-color: #f0c2bc; box-shadow: inset 3px 0 0 var(--danger); }
.hk-head { display: flex; align-items: center; justify-content: space-between; gap: 0.6rem; }
.hk-title { font-weight: 650; font-size: 0.95rem; }
.hk-text { color: var(--ink-soft); font-size: 0.88rem; overflow-wrap: anywhere; }
.hk.bad .hk-text { color: #8e2a20; }
.hk-foot { margin-top: auto; padding-top: 0.35rem; display: flex; align-items: center; justify-content: space-between; gap: 0.5rem; font-size: 0.84rem; color: var(--ink-faint); }
.hk-foot form { margin: 0; }
.hk details { font-size: 0.82rem; color: var(--ink-soft); white-space: pre-wrap; }
.hk details summary { cursor: pointer; color: var(--orange-ink); }
.tool { display: flex; flex-direction: column; gap: 0.4rem; background: var(--surface); border: 1px solid var(--line); border-radius: 12px; padding: 1rem 1.1rem; color: var(--ink); }
.tool:hover { border-color: #f2b383; color: var(--ink); text-decoration: none; }
.tool-title { display: flex; align-items: center; gap: 0.55rem; font-weight: 650; }
.tool-title .ic { width: 18px; height: 18px; color: var(--orange-deep); }
.tool-text { color: var(--ink-soft); font-size: 0.86rem; }
.dash-box { background: var(--surface); border: 1px solid var(--line); border-radius: 12px; padding: 1.1rem 1.2rem; }
.dash-box h2 { display: flex; align-items: center; justify-content: space-between; gap: 0.5rem; }
.dash-box h2 a { font-size: 0.84rem; font-weight: 500; }
.dash-box ul { list-style: none; margin: 0; padding: 0; }
.dash-box li { display: flex; justify-content: space-between; gap: 0.75rem; padding: 0.5rem 0; border-top: 1px solid var(--line); font-size: 0.88rem; }
.dash-box li:first-child { border-top: 0; }
.dash-box .big { font-size: 2rem; font-weight: 700; letter-spacing: -0.02em; font-variant-numeric: tabular-nums; }
.status-list { list-style: none; margin: 0; padding: 0; }
.status-list li { display: flex; gap: 0.75rem; align-items: center; padding: 0.6rem 0; border-bottom: 1px solid var(--line); font-size: 0.9rem; flex-wrap: wrap; }
.status-list li:last-child { border-bottom: none; }
.status-list li .what { min-width: 11rem; font-weight: 600; }
.status-list li .txt { flex: 1; }

/* --- Phones and narrow windows --- */
@media (max-width: 900px) {
  .side { position: sticky; bottom: auto; width: auto; height: auto; }
  .side-head { padding: 0.65rem 0.9rem; }
  .side-toggle { display: inline-flex; }
  .side-menu { display: none; padding-top: 0; max-height: calc(100vh - 60px); }
  .side.open .side-menu { display: flex; }
  .admin-main { margin-left: 0; padding: 1.25rem 1rem 3rem; }
  .banner-error, .banner-note { margin-left: 0; }
}
@media (max-width: 720px) {
  h1 { font-size: 1.3rem; }
  .box-grid, .tool-grid, .hk-grid, .dash-grid, .stat-grid { grid-template-columns: 1fr; }
  .stat-grid { grid-template-columns: 1fr 1fr; }
  .list-bar input[type=search] { min-width: 0; width: 100%; }
  .list-bar label:first-child { flex: 1 1 100%; }
  .list-bar .per-page { margin-left: 0; }
  /* lists become one box per row; page.js puts the column name on each cell */
  table, thead, tbody, th, td, tr { display: block; }
  table.compact { border: 0; overflow: visible; }
  thead { display: none; }
  tbody tr { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: 0.7rem 0.85rem; margin-bottom: 0.6rem; }
  table.compact td, td { border: 0; padding: 0.2rem 0; }
  td[data-label]:not(:first-child)::before { content: attr(data-label); display: block; font-size: 0.72rem; color: var(--ink-faint); font-weight: 600; margin-top: 0.25rem; }
  td:empty { display: none; }
  table.compact tbody tr:hover > td { background: transparent; }
  .u-pre-box { word-break: break-all !important; font-size: 0.78rem !important; }
  .admin-main { overflow-x: hidden; }
  table.compact tbody tr:not(.row-panel):not(.row-detail) { display: grid; grid-template-columns: 1fr 1fr; gap: 0.15rem 0.9rem; }
  table.compact tbody tr > td:first-child, table.compact td.act, table.compact td[colspan] { grid-column: 1 / -1; }
  table.compact td.act { width: auto; text-align: left; padding-top: 0.5rem; margin-top: 0.4rem; border-top: 1px solid var(--line); }
  .panel:has(> table.compact) { background: transparent; border: 0; padding: 0; }
  table.compact tr.row-panel, table.compact tr.row-detail { margin-top: -0.5rem; border-top-left-radius: 0; border-top-right-radius: 0; }
  table.compact tr.row-panel > td { box-shadow: none; padding: 0.2rem 0; }
  .panel { padding: 1rem; }
  .panel-form input[type=text], .panel-form input[type=email], .panel-form input[type=password], .panel-form input[type=number], .panel-form select { min-width: 0; width: 100%; }
  .panel-form label { width: 100%; }
  .ccard-stats { grid-template-columns: 1fr 1fr 1.4fr; }
}

/* --- Patch _0033: the sign-in head (which app you sign in to), trusted devices --- */
.auth-top { display: flex; align-items: center; justify-content: space-between; gap: 0.75rem; margin: 0 0 1.1rem; }
.auth-top .auth-brand { margin: 0; }
.auth-top .auth-lang { margin: 0 !important; }
.auth-head { display: flex; align-items: center; gap: 0.75rem; margin: 0 0 0.35rem; }
.auth-head h1 { margin: 0; font-size: 1.3rem; line-height: 1.25; }
.cbadge { flex: none; display: inline-flex; align-items: center; justify-content: center; width: 40px; height: 40px; border-radius: 10px;
  font-weight: 700; font-size: 1.1rem; color: #fff; background: var(--ink); }
.cbadge.tone-0 { background: var(--orange); color: var(--ink); }
.cbadge.tone-1 { background: var(--ink); color: #fff; }
.cbadge.tone-2 { background: var(--ink-soft); color: #fff; }
.cbadge.small { width: 22px; height: 22px; border-radius: 6px; font-size: 0.75rem; }
.auth-trust { color: var(--ink-faint); font-size: 0.8rem; margin: 0 0 1.1rem; }
.auth-welcome { background: var(--surface-2); border-left: 3px solid var(--orange); border-radius: var(--radius-sm); padding: 0.55rem 0.75rem; margin: 0 0 1.1rem; font-size: 0.9rem; color: var(--ink); }
.auth-back { margin: 1.1rem 0 0; font-size: 0.86rem; }
.auth-for { display: inline-flex; align-items: center; gap: 0.4rem; margin: 0; font-size: 0.84rem; color: var(--ink-soft); }
.cb-line { display: flex !important; align-items: flex-start; gap: 0.45rem; font-weight: 400 !important; color: var(--ink) !important; }
.cb-line input[type=checkbox] { flex: none; margin: 0.2rem 0 0 !important; }
.tf-second { font-size: 0.84rem; }
.trusted-list td, .trusted-list th { padding: 0.4rem 0.5rem 0.4rem 0; border-bottom: 1px solid var(--line); text-align: left; vertical-align: top; }
.trusted-list .sub { color: var(--ink-faint); }

/* --- Patch _0033: long lists — filters with chips, sort headers, saved views, actions on many --- */
.filter-chips { display: flex; flex-wrap: wrap; align-items: center; gap: 0.4rem; margin: -0.4rem 0 0.8rem; }
.fchip { display: inline-flex; align-items: center; gap: 0.3rem; background: var(--orange-tint); color: var(--orange-ink); border-radius: 999px; padding: 0.15rem 0.35rem 0.15rem 0.7rem; font-size: 0.8rem; font-weight: 500; }
.fchip a { display: inline-flex; align-items: center; justify-content: center; width: 20px; height: 20px; border-radius: 50%; color: inherit; text-decoration: none; font-weight: 700; }
.fchip a:hover { background: rgba(166, 75, 10, 0.12); }
.fchip-clear { font-size: 0.8rem; margin-left: 0.25rem; }
a.sort { color: inherit; text-decoration: none; display: inline-flex; align-items: center; gap: 0.25rem; white-space: nowrap; }
a.sort:hover { color: var(--ink); text-decoration: underline; }
a.sort.on { color: var(--ink); }
a.sort .arrow { font-size: 0.65rem; color: var(--orange-deep); }
.views-bar { display: flex; flex-wrap: wrap; align-items: center; gap: 0.4rem; margin: 0 0 0.75rem; font-size: 0.84rem; }
.views-bar > .sub { color: var(--ink-faint); font-weight: 600; margin-right: 0.2rem; }
.vchip { display: inline-flex; align-items: center; gap: 0.1rem; background: var(--surface-2); border: 1px solid var(--line); border-radius: 999px; padding: 0.05rem 0.2rem 0.05rem 0.7rem; }
.vchip a { color: var(--ink); text-decoration: none; font-weight: 500; }
.vchip a:hover { text-decoration: underline; }
.vchip .ic-form { display: inline-flex; }
button.vchip-x { background: transparent; border: 0; color: var(--ink-faint); min-height: 0; width: 22px; height: 22px; padding: 0; border-radius: 50%; font-weight: 700; }
button.vchip-x:hover { background: var(--danger-bg); color: var(--danger); }
.views-save { display: inline-flex; align-items: center; gap: 0.35rem; margin-left: auto; }
.views-save input[type=text] { min-height: 32px; padding: 0.25rem 0.55rem; font-size: 0.84rem; width: 11rem; }
.views-save button { min-height: 32px; padding: 0.25rem 0.7rem; font-size: 0.82rem; }
table.selectable th.sel, table.selectable td.sel { width: 1%; padding-right: 0.25rem; }
table.compact tr.suspended > td { background: var(--surface-2); }
table.compact tr.suspended .who-text a { color: var(--ink-soft); }
.bulk-bar { position: sticky; bottom: 0.75rem; z-index: 5; display: flex; flex-wrap: wrap; align-items: center; gap: 0.5rem 0.75rem;
  margin: 0.75rem 0 0; padding: 0.6rem 0.8rem; background: var(--brand); color: #fff; border-radius: var(--radius); box-shadow: 0 6px 20px rgba(21, 32, 43, 0.18); font-size: 0.86rem; }
.bulk-bar .bulk-count { font-weight: 700; }
.bulk-bar .bulk-all { display: inline-flex; align-items: center; gap: 0.35rem; color: #fff; }
.bulk-bar select { min-height: 34px; padding: 0.25rem 0.5rem; font-size: 0.86rem; max-width: 100%; }
.bulk-bar button { min-height: 34px; padding: 0.3rem 0.9rem; }
.bulk-preview { border: 2px solid var(--orange); }
.bulk-preview h2 { margin-top: 0; }
.bulk-confirm { margin-top: 0.6rem; }
.pw-apply { border: 1px solid var(--line); border-radius: var(--radius-sm); padding: 0.5rem 0.8rem; margin: 0.5rem 0 0.9rem; }
.pw-apply legend { font-size: 0.84rem; font-weight: 600; color: var(--ink-soft); padding: 0 0.3rem; }
.pw-apply label { display: flex !important; align-items: center; gap: 0.4rem; font-weight: 400 !important; color: var(--ink) !important; margin: 0.25rem 0 !important; }
.pw-apply input[type=radio] { margin: 0 !important; width: 16px !important; display: inline !important; }
button.small { min-height: 28px; padding: 0.15rem 0.6rem; font-size: 0.8rem; }
@media (max-width: 720px) {
  .auth-head h1 { font-size: 1.15rem; }
  .views-save { margin-left: 0; width: 100%; }
  .views-save input[type=text] { flex: 1; width: auto; }
  .bulk-bar { bottom: 0.5rem; }
  .bulk-bar select, .bulk-bar button { flex: 1 1 100%; }
  table.selectable td.sel { grid-column: 1 / -1; padding: 0; }
  table.selectable td.sel + td[data-label]::before { display: none; }
}

/* --- Patch _0034: list density, personal-detail columns, readiness, name-change requests --- */
.density { display: inline-flex; gap: 0; }
.density button { border-radius: 0; min-height: 32px; }
.density button:first-child { border-radius: var(--radius-sm) 0 0 var(--radius-sm); }
.density button:last-child { border-radius: 0 var(--radius-sm) var(--radius-sm) 0; margin-left: -1px; }
.density button[aria-pressed="true"] { background: var(--ink); border-color: var(--ink); color: #fff; }
html.density-normal table.compact { font-size: 0.97rem; }
html.density-normal table.compact th, html.density-normal table.compact td { padding: 0.85rem 0.9rem; }
html.density-normal table.compact .ic-btn { width: 38px; height: 38px; }
html.density-normal table.compact .sub { font-size: 0.86rem; }
.col-chooser { position: relative; font-size: 0.84rem; }
.col-chooser > summary { cursor: pointer; list-style: none; padding: 0.35rem 0.7rem; border: 1px solid var(--line-strong); border-radius: var(--radius-sm); background: var(--surface); color: var(--ink); min-height: 36px; display: inline-flex; align-items: center; }
.col-chooser > summary::-webkit-details-marker { display: none; }
.col-chooser > summary::after { content: "▾"; margin-left: 0.35rem; color: var(--ink-faint); }
.col-chooser-box { position: absolute; z-index: 6; top: calc(100% + 4px); left: 0; min-width: 14rem; background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: 0.6rem 0.8rem; box-shadow: 0 8px 24px rgba(21, 32, 43, 0.12); display: flex; flex-direction: column; gap: 0.3rem; }
.col-chooser-box label.cb { display: flex; align-items: center; gap: 0.4rem; color: var(--ink); font-weight: 400; }
.col-chooser-box button { align-self: flex-start; margin-top: 0.3rem; }
table.compact td.pcol { white-space: nowrap; }
.kit-ready li.warn .txt .sub { color: var(--warn); }
.profile-request-lines { white-space: normal; margin: 0.5rem 0; }
.profile-form textarea, .auth-form textarea { width: 100%; display: block; margin-top: 0.3rem; font: inherit; }
@media (max-width: 720px) {
  .col-chooser-box { position: static; box-shadow: none; }
  .density { width: 100%; }
  .density button { flex: 1; }
}

/* Kept last: hidden always wins */
[hidden] { display: none !important; }
