/* Pulse Admin cockpit. Vitra.ai brand tokens (plan §4, brand spec §1) on the DESIGN.md app scale.
   Violet is reserved for the primary action, the selected nav item, focus rings, active toggles and the Staging chip.
   Sentence case everywhere; nothing is set in uppercase. No inline styles are used by the scripts. */

/* ---------- Tokens: light ---------- */
:root {
  color-scheme: light;

  --accent: #8143fd;
  --accent-strong: #5e18ea;
  --accent-lift: #a67aff;
  --accent-wash: #efe7ff;
  --accent-hover-bg: #f6f3ff;
  --accent-text: #5e18ea;
  --accent-ring: rgb(129 67 253 / 0.11);
  --accent-border: rgb(129 67 253 / 0.36);

  --ink: #101014;
  --ink-2: #2e3440;
  --ink-3: #525a69;
  --ink-4: #656c7a;
  --ink-5: #6b7280;
  --on-accent: #ffffff;

  --page: #fafafb;
  --surface: #ffffff;
  --surface-2: #fafbfc;
  --surface-sunken: #f4f5f7;
  --line: #e7e9ee;
  --line-soft: #f0f2f5;
  --line-strong: #d5d8df;
  --scrim: rgb(16 16 20 / 0.36);

  --success: #12b76a; --success-soft: #ecfdf3; --success-text: #027a48;
  --warning: #f5a623; --warning-soft: #fffaeb; --warning-text: #b54708;
  --error: #ef4444;   --error-soft: #fef3f2;   --error-text: #b42318;
  --info: #43a9fd;    --info-soft: #eff8ff;    --info-text: #175cd3;

  --teal: #0f9f8f;   --teal-soft: #ecfdf8;
  --sky: #2585d9;    --sky-soft: #eff8ff;
  --amber: #c97908;  --amber-soft: #fff8e7;
  --indigo: #4e5de7; --indigo-soft: #eef0ff;

  --receipt-bg: #f6f1e7; --receipt-rule: #ede6d8; --receipt-ink: #1c1a17; --receipt-pencil: #6e675b;

  --font-sans: "Satoshi", "Instrument Sans", ui-sans-serif, system-ui, -apple-system, "Segoe UI", sans-serif;
  --font-mono: "Geist Mono", ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;

  --r-control: 10px;
  --r-card: 16px;
  --r-pill: 999px;

  --elev-1: 0 1px 2px #1010140a, 0 1px 1px #10101408;
  --elev-3: 0 4px 8px -2px #1010140d, 0 14px 32px -8px #1010141f;
  --elev-4: 0 8px 16px -6px #10101412, 0 28px 60px -16px #10101429;
  --glow-violet: 0 8px 26px -8px #8143fd73, 0 2px 6px -2px #8143fd47;

  --ease: cubic-bezier(0.16, 1, 0.3, 1);
  --dur-fast: 180ms;
  --dur: 250ms;

  --sidebar: 248px;
  --rail: 72px;
}

/* ---------- Tokens: dark (the site's night product section) ---------- */
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    color-scheme: dark;
    --accent-text: #a67aff;
    --accent-wash: rgb(129 67 253 / 0.18);
    --accent-hover-bg: rgb(129 67 253 / 0.10);
    --accent-ring: rgb(129 67 253 / 0.30);
    --accent-border: rgb(166 122 255 / 0.55);
    --ink: #ffffff;
    --ink-2: #d5d6dc;
    --ink-3: #a9abb6;
    --ink-4: #9a9ca7;
    --ink-5: #8a8c96;
    --page: #0b0b10;
    --surface: #111117;
    --surface-2: #15151b;
    --surface-sunken: #0e0e13;
    --line: rgb(255 255 255 / 0.10);
    --line-soft: rgb(255 255 255 / 0.05);
    --line-strong: rgb(255 255 255 / 0.18);
    --scrim: rgb(0 0 0 / 0.6);
    --success-soft: rgb(109 214 168 / 0.10); --success-text: #6dd6a8;
    --warning-soft: rgb(245 165 36 / 0.10);  --warning-text: #f5a524;
    --error-soft: rgb(255 138 138 / 0.10);   --error-text: #ff8a8a;
    --info-soft: rgb(73 204 249 / 0.10);     --info-text: #49ccf9;
    --teal: #3fd1bf;   --teal-soft: rgb(63 209 191 / 0.12);
    --sky: #6cb8f5;    --sky-soft: rgb(108 184 245 / 0.12);
    --amber: #f5b54a;  --amber-soft: rgb(245 181 74 / 0.12);
    --indigo: #97a0ff; --indigo-soft: rgb(151 160 255 / 0.12);
    --receipt-bg: #1f1c17; --receipt-rule: #3a342a; --receipt-ink: #ede6d8; --receipt-pencil: #b5ab98;
    --elev-1: 0 1px 2px rgb(0 0 0 / 0.4);
    --elev-3: 0 14px 32px -8px rgb(0 0 0 / 0.7);
    --elev-4: 0 28px 60px -16px rgb(0 0 0 / 0.8);
  }
}
:root[data-theme="dark"] {
  color-scheme: dark;
  --accent-text: #a67aff;
  --accent-wash: rgb(129 67 253 / 0.18);
  --accent-hover-bg: rgb(129 67 253 / 0.10);
  --accent-ring: rgb(129 67 253 / 0.30);
  --accent-border: rgb(166 122 255 / 0.55);
  --ink: #ffffff;
  --ink-2: #d5d6dc;
  --ink-3: #a9abb6;
  --ink-4: #9a9ca7;
  --ink-5: #8a8c96;
  --page: #0b0b10;
  --surface: #111117;
  --surface-2: #15151b;
  --surface-sunken: #0e0e13;
  --line: rgb(255 255 255 / 0.10);
  --line-soft: rgb(255 255 255 / 0.05);
  --line-strong: rgb(255 255 255 / 0.18);
  --scrim: rgb(0 0 0 / 0.6);
  --success-soft: rgb(109 214 168 / 0.10); --success-text: #6dd6a8;
  --warning-soft: rgb(245 165 36 / 0.10);  --warning-text: #f5a524;
  --error-soft: rgb(255 138 138 / 0.10);   --error-text: #ff8a8a;
  --info-soft: rgb(73 204 249 / 0.10);     --info-text: #49ccf9;
  --teal: #3fd1bf;   --teal-soft: rgb(63 209 191 / 0.12);
  --sky: #6cb8f5;    --sky-soft: rgb(108 184 245 / 0.12);
  --amber: #f5b54a;  --amber-soft: rgb(245 181 74 / 0.12);
  --indigo: #97a0ff; --indigo-soft: rgb(151 160 255 / 0.12);
  --receipt-bg: #1f1c17; --receipt-rule: #3a342a; --receipt-ink: #ede6d8; --receipt-pencil: #b5ab98;
  --elev-1: 0 1px 2px rgb(0 0 0 / 0.4);
  --elev-3: 0 14px 32px -8px rgb(0 0 0 / 0.7);
  --elev-4: 0 28px 60px -16px rgb(0 0 0 / 0.8);
}

/* ---------- Base ---------- */
*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0;
  background: var(--page);
  color: var(--ink-2);
  font: 500 14px/20px var(--font-sans);
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}
h1, h2, h3, h4 { color: var(--ink); margin: 0; font-weight: 700; }
p { margin: 0; }
a { color: var(--accent-text); text-decoration-thickness: 1px; text-underline-offset: 3px; }
a:hover { color: var(--accent); }
code, pre, kbd, .mono { font-family: var(--font-mono); font-size: 12px; line-height: 16px; font-variant-numeric: tabular-nums; }
.mono { color: var(--ink-3); }
button, input, select, textarea { font: inherit; color: inherit; }
[hidden] { display: none !important; }
::selection { background: var(--accent-wash); }
:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; border-radius: 6px; }
.visually-hidden { position: absolute !important; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
.skip-link { position: absolute; left: 12px; top: 12px; z-index: 50; padding: 10px 14px; border-radius: var(--r-control); background: var(--surface); color: var(--ink); transform: translateY(-200%); opacity: 0; }
.skip-link:focus { transform: none; opacity: 1; box-shadow: var(--elev-3); }

.icon { width: 18px; height: 18px; flex: 0 0 auto; fill: none; stroke: currentColor; stroke-width: 1.75; stroke-linecap: round; stroke-linejoin: round; }
.icon-small { width: 14px; height: 14px; }
.mark { display: block; }
.mark .mark-deep { fill: var(--accent-strong); }
.mark .mark-violet { fill: var(--accent); }

/* ---------- Shell ---------- */
.shell { display: grid; grid-template-columns: var(--sidebar) minmax(0, 1fr); min-height: 100vh; }
.sidebar {
  position: sticky; top: 0; height: 100vh;
  display: flex; flex-direction: column; gap: 20px;
  padding: 20px 14px 14px;
  background: var(--surface);
  border-right: 1px solid var(--line);
  overflow-y: auto;
  z-index: 20;
}
.content { min-width: 0; display: flex; flex-direction: column; }
.main { padding: 32px 40px 96px; width: 100%; max-width: 1360px; outline: none; }
.topbar { display: none; }
.nav-scrim { display: none; }

.brand { display: flex; align-items: center; gap: 10px; padding: 4px 8px; text-decoration: none; color: var(--ink); border-radius: var(--r-control); }
.brand:hover { color: var(--ink); }
.brand-mark { width: 30px; height: 30px; }
.brand-text { display: flex; flex-direction: column; line-height: 1.1; }
.brand-name { font-weight: 700; font-size: 15px; color: var(--ink); letter-spacing: -0.01em; }
.brand-sub { font-size: 12px; color: var(--ink-5); }

.nav { display: flex; flex-direction: column; gap: 16px; }
.nav-group { display: flex; flex-direction: column; gap: 2px; }
.nav-group-label { padding: 0 12px 4px; font-size: 12px; line-height: 16px; color: var(--ink-5); font-weight: 500; }
.nav-link {
  position: relative;
  display: flex; align-items: center; gap: 10px;
  min-height: 40px; padding: 8px 12px;
  border-radius: var(--r-control);
  color: var(--ink-3); text-decoration: none; font-weight: 500;
  transition: background var(--dur-fast) var(--ease), color var(--dur-fast) var(--ease);
}
.nav-link:hover { background: var(--accent-hover-bg); color: var(--ink); }
.nav-link.is-active { background: var(--accent-wash); color: var(--accent-text); font-weight: 700; }
.nav-link.is-active .icon { stroke: var(--accent); }
.nav-label { flex: 1; min-width: 0; }
.nav-badge { min-width: 22px; padding: 1px 7px; border-radius: var(--r-pill); background: var(--accent-wash); color: var(--accent-text); font: 700 12px/18px var(--font-sans); text-align: center; font-variant-numeric: tabular-nums; }
.nav-badge-warning { background: var(--warning-soft); color: var(--warning-text); }
.sidebar-foot { margin-top: auto; display: flex; flex-direction: column; gap: 10px; padding-top: 12px; border-top: 1px solid var(--line); }
.nav-foot { gap: 2px; }

.account .menu-trigger { width: 100%; justify-content: flex-start; gap: 10px; min-height: 44px; padding: 6px 8px; }
.menu-trigger-label { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; text-align: left; color: var(--ink-3); font-size: 13px; }
.avatar { display: inline-grid; place-items: center; width: 28px; height: 28px; border-radius: var(--r-pill); background: var(--accent-wash); color: var(--accent-text); font-weight: 700; font-size: 13px; flex: 0 0 auto; }
.account .menu { bottom: calc(100% + 6px); top: auto; left: 0; right: 0; }

/* Icon rail at 1024 and below */
@media (max-width: 1024px) {
  .shell { grid-template-columns: var(--rail) minmax(0, 1fr); }
  .sidebar { padding: 16px 10px 12px; align-items: stretch; }
  .brand { justify-content: center; padding: 4px 0; }
  .sidebar .brand-text, .sidebar .nav-label, .sidebar .menu-trigger-label, .sidebar .menu-trigger > .icon-small { display: none; }
  .nav-group-label { font-size: 0; height: 1px; padding: 0; margin: 4px 10px; background: var(--line); }
  .nav-group:first-child .nav-group-label { display: none; }
  .nav-link { justify-content: center; padding: 8px; }
  .nav-badge { position: absolute; top: 4px; right: 4px; min-width: 0; width: 9px; height: 9px; padding: 0; font-size: 0; border: 2px solid var(--surface); box-sizing: content-box; background: var(--accent); }
  .nav-badge-warning { background: var(--warning); }
  .account .menu-trigger { justify-content: center; }
  .account .menu { left: 0; right: auto; width: 240px; }
  .main { padding: 28px 28px 96px; }
}

/* Top bar and off-canvas menu at 760 and below */
@media (max-width: 760px) {
  .shell { grid-template-columns: minmax(0, 1fr); }
  .topbar {
    display: flex; align-items: center; gap: 8px;
    position: sticky; top: 0; z-index: 15;
    height: 56px; padding: 0 12px;
    background: var(--surface); border-bottom: 1px solid var(--line);
  }
  .brand-compact { gap: 8px; }
  .brand-compact .brand-mark { width: 26px; height: 26px; }
  .sidebar {
    position: fixed; left: 0; top: 0; bottom: 0; width: 284px; height: auto;
    transform: translateX(-100%); transition: transform var(--dur) var(--ease);
    padding: 20px 14px 14px; align-items: stretch; box-shadow: var(--elev-4);
    visibility: hidden;
  }
  .sidebar .brand-text, .sidebar .nav-label, .sidebar .menu-trigger-label, .sidebar .menu-trigger > .icon-small { display: initial; }
  .sidebar .brand-text { display: flex; }
  .sidebar .brand { justify-content: flex-start; padding: 4px 8px; }
  .nav-group-label { font-size: 12px; height: auto; padding: 0 12px 4px; margin: 0; background: none; }
  .nav-group:first-child .nav-group-label { display: block; }
  .nav-link { justify-content: flex-start; padding: 8px 12px; }
  .nav-badge { position: static; width: auto; height: auto; min-width: 22px; padding: 1px 7px; font-size: 12px; border: 0; background: var(--accent-wash); }
  .nav-badge-warning { background: var(--warning-soft); }
  .account .menu-trigger { justify-content: flex-start; }
  .account .menu { right: 0; width: auto; }
  body.nav-open .sidebar { transform: none; visibility: visible; }
  body.nav-open .nav-scrim { display: block; position: fixed; inset: 0; background: var(--scrim); z-index: 19; }
  .main { padding: 20px 16px 96px; }
}

/* ---------- Page structure ---------- */
.page-header { display: flex; align-items: flex-start; justify-content: space-between; gap: 16px 24px; flex-wrap: wrap; margin-bottom: 24px; }
.page-heading { min-width: 0; max-width: 760px; }
.page-title { font-size: 24px; line-height: 30px; letter-spacing: -0.025em; outline: none; }
.page-description { margin-top: 6px; color: var(--ink-3); }
.page-actions { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; }
.back-link { display: inline-flex; align-items: center; gap: 6px; margin-bottom: 10px; color: var(--ink-3); text-decoration: none; font-size: 13px; min-height: 32px; }
.back-link:hover { color: var(--ink); }
.back-link .icon { width: 16px; height: 16px; }

.stack { display: flex; flex-direction: column; gap: 20px; }
.row { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; }
.spacer { flex: 1; }
.muted { color: var(--ink-4); }
.faint { color: var(--ink-5); font-size: 13px; }
.strong { color: var(--ink); font-weight: 700; }
.cell-title { display: block; color: var(--ink); font-weight: 700; }
.cell-sub { display: block; margin-top: 2px; color: var(--ink-5); font-size: 12px; line-height: 16px; }
.cell-sub.mono { font-size: 12px; }
.nowrap { white-space: nowrap; }
.num { font-variant-numeric: tabular-nums; }
.text-right { text-align: right; }

.panel {
  background: linear-gradient(180deg, var(--surface), var(--surface-2));
  border-radius: var(--r-card);
  box-shadow: inset 0 0 0 1px var(--line), var(--elev-1);
  padding: 20px;
}
.panel + .panel { margin-top: 20px; }
.stack > .panel + .panel, .stack > * + .panel { margin-top: 0; }
.panel { display: flex; flex-direction: column; gap: 12px; }
.panel-head { display: flex; justify-content: space-between; align-items: flex-start; gap: 12px; flex-wrap: wrap; margin-bottom: 2px; }
.module-group { gap: 0; }
.template-meta { margin-bottom: 20px; }
.delete-reason { margin: -12px 0 16px; }
.editor-meta .field + .field, .form-grid .field + .field { margin-top: 0; }
.table-region + p, .table-region + .faint { margin-top: 12px; }
.panel-actions { display: flex; gap: 8px; flex-wrap: wrap; }
.section-title { font-size: 18px; line-height: 24px; letter-spacing: -0.01em; }
.section-description { margin-top: 4px; color: var(--ink-3); max-width: 760px; }
.panel-flat { box-shadow: none; background: none; padding: 0; }

.metric-line { display: flex; flex-wrap: wrap; align-items: baseline; gap: 6px 10px; margin: 0 0 20px; color: var(--ink-3); font-variant-numeric: tabular-nums; }
.metric { color: var(--ink-3); text-decoration: none; white-space: nowrap; }
a.metric:hover { color: var(--accent-text); }
.metric-value { color: var(--ink); font-weight: 700; }
.metric-warning .metric-value { color: var(--warning-text); }
.metric-error .metric-value { color: var(--error-text); }
.metric-sep { color: var(--line-strong); }

.note { display: flex; gap: 10px; align-items: flex-start; padding: 12px 14px; border-radius: var(--r-control); background: var(--info-soft); color: var(--ink-2); border: 1px solid transparent; }
.note .icon { margin-top: 1px; stroke: var(--info-text); }
.note-warning { background: var(--warning-soft); }
.note-warning .icon { stroke: var(--warning-text); }
.note-error { background: var(--error-soft); }
.note-error .icon { stroke: var(--error-text); }
.note-success { background: var(--success-soft); }
.note-success .icon { stroke: var(--success-text); }
.note strong { color: var(--ink); }

/* ---------- Buttons ---------- */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  min-height: 40px; padding: 8px 14px;
  border: 0; border-radius: var(--r-control);
  font: 700 13px/18px var(--font-sans);
  cursor: pointer; text-decoration: none; white-space: nowrap;
  transition: background var(--dur-fast) var(--ease), box-shadow var(--dur-fast) var(--ease), transform var(--dur-fast) var(--ease), color var(--dur-fast) var(--ease);
}
.btn .icon { width: 16px; height: 16px; }
.btn:disabled, .btn[aria-disabled="true"] { opacity: 0.52; cursor: not-allowed; box-shadow: none; transform: none; }
.btn:focus-visible { outline: 2px solid var(--accent); outline-offset: 3px; }
/* D8: the brand's violet gradient is allowed on the single primary action per screen. */
.btn-primary { background: linear-gradient(180deg, var(--accent), var(--accent-strong)); color: var(--on-accent); box-shadow: var(--glow-violet); }
.btn-primary:hover:not(:disabled) { color: var(--on-accent); transform: translateY(-1px); box-shadow: 0 12px 30px -10px #5e18ea99; }
.btn-primary:active:not(:disabled) { transform: none; background: var(--accent-strong); }
.btn-secondary { background: var(--surface); color: var(--ink); box-shadow: inset 0 0 0 1px var(--line-strong), var(--elev-1); }
.btn-secondary:hover:not(:disabled) { color: var(--ink); box-shadow: inset 0 0 0 1px var(--accent-border), var(--elev-1); }
.btn-ghost { background: transparent; color: var(--ink-2); }
.btn-ghost:hover:not(:disabled) { background: var(--accent-hover-bg); color: var(--accent-text); }
.btn-danger { background: var(--surface); color: var(--error-text); box-shadow: inset 0 0 0 1px var(--line-strong); }
.btn-danger:hover:not(:disabled) { background: var(--error-soft); color: var(--error-text); box-shadow: inset 0 0 0 1px var(--error-text); }
.btn-icon { padding: 8px; width: 40px; }
.btn-small { min-height: 32px; padding: 5px 10px; font-size: 12.5px; }
.btn-small.btn-icon { width: 32px; }
a.btn-secondary { color: var(--ink); }

/* ---------- Form controls ---------- */
.control {
  width: 100%; min-height: 40px; padding: 8px 12px;
  border: 1px solid var(--line-strong); border-radius: var(--r-control);
  background: var(--surface); color: var(--ink);
  font: 500 13px/18px var(--font-sans);
  box-shadow: var(--elev-1);
  transition: border-color var(--dur-fast) var(--ease), box-shadow var(--dur-fast) var(--ease);
}
.control::placeholder { color: var(--ink-5); }
.control:hover { border-color: var(--ink-5); }
.control:focus, .control:focus-visible { outline: none; border-color: var(--accent-border); box-shadow: 0 0 0 4px var(--accent-ring); }
.control:disabled { opacity: 0.6; cursor: not-allowed; }
select.control { appearance: none; padding-right: 34px; background-image: linear-gradient(45deg, transparent 50%, var(--ink-4) 50%), linear-gradient(135deg, var(--ink-4) 50%, transparent 50%); background-position: calc(100% - 17px) 50%, calc(100% - 12px) 50%; background-size: 5px 5px; background-repeat: no-repeat; cursor: pointer; }
textarea.control { min-height: 88px; resize: vertical; line-height: 20px; }
input[type="file"].control { padding: 6px 8px; }
.field { display: flex; flex-direction: column; gap: 6px; }
.field + .field { margin-top: 16px; }
.field-label { color: var(--ink); font-weight: 700; font-size: 13px; }
.field-hint { color: var(--ink-4); font-size: 12.5px; line-height: 18px; }
.form-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(200px, 1fr)); gap: 16px; }
.form-grid .field + .field { margin-top: 0; }
.check { display: flex; gap: 10px; align-items: flex-start; min-height: 40px; padding: 8px 0; cursor: pointer; color: var(--ink-2); }
.check input { width: 18px; height: 18px; margin-top: 1px; accent-color: var(--accent); flex: 0 0 auto; }
.inline-error { color: var(--error-text); font-size: 13px; margin-top: 8px; }
.org-picker { display: flex; flex-direction: column; gap: 8px; }

.toolbar { display: flex; flex-wrap: wrap; align-items: center; gap: 10px; margin-bottom: 14px; }
.toolbar .control { width: auto; min-width: 170px; }
.toolbar-count { margin-left: auto; color: var(--ink-4); font-size: 13px; font-variant-numeric: tabular-nums; }
.search { position: relative; flex: 1 1 260px; max-width: 380px; }
.search .control { width: 100%; padding-left: 36px; }
.search-icon { position: absolute; left: 12px; top: 50%; transform: translateY(-50%); width: 16px; height: 16px; color: var(--ink-5); pointer-events: none; }

/* ---------- Toggle switch (real checkbox, role="switch") ---------- */
.switch {
  appearance: none; -webkit-appearance: none; margin: 0;
  position: relative; flex: 0 0 auto;
  width: 40px; height: 24px; border-radius: var(--r-pill);
  background: var(--line-strong); cursor: pointer;
  transition: background var(--dur-fast) var(--ease);
}
.switch::after {
  content: ""; position: absolute; top: 3px; left: 3px;
  width: 18px; height: 18px; border-radius: 50%;
  background: #fff; box-shadow: 0 1px 2px rgb(16 16 20 / 0.25);
  transition: transform var(--dur-fast) var(--ease);
}
.switch:checked { background: var(--accent); }
.switch:checked::after { transform: translateX(16px); }
.switch:disabled { opacity: 0.5; cursor: not-allowed; }
.switch:focus-visible { outline: 2px solid var(--accent); outline-offset: 3px; }

.toggle-row {
  display: flex; align-items: center; gap: 14px;
  min-height: 56px; padding: 12px 14px;
  border-top: 1px solid var(--line-soft);
  cursor: pointer;
}
.toggle-row:first-child { border-top: 0; }
.toggle-row:hover { background: var(--accent-hover-bg); }
.toggle-row.is-changed { box-shadow: inset 3px 0 0 var(--accent); }
.toggle-text { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 2px; }
.toggle-label { color: var(--ink); font-weight: 700; }
.toggle-description { color: var(--ink-3); font-size: 13px; line-height: 18px; }
.toggle-meta { display: flex; flex-wrap: wrap; gap: 6px; align-items: center; margin-top: 4px; }
.toggle-state { color: var(--ink-4); font-size: 12px; min-width: 22px; text-align: right; }

/* ---------- Badges and chips ---------- */
.badge {
  display: inline-flex; align-items: center; gap: 6px;
  padding: 2px 9px; border-radius: var(--r-pill);
  font: 700 12px/18px var(--font-sans); white-space: nowrap;
  background: var(--surface-sunken); color: var(--ink-3);
  box-shadow: inset 0 0 0 1px var(--line);
}
.badge-dot { width: 6px; height: 6px; border-radius: 50%; background: currentColor; opacity: 0.85; }
.badge-violet { background: var(--accent-wash); color: var(--accent-text); box-shadow: none; }
.badge-success { background: var(--success-soft); color: var(--success-text); box-shadow: none; }
.badge-warning { background: var(--warning-soft); color: var(--warning-text); box-shadow: none; }
.badge-error { background: var(--error-soft); color: var(--error-text); box-shadow: none; }
.badge-info { background: var(--info-soft); color: var(--info-text); box-shadow: none; }
.tag { display: inline-flex; align-items: center; padding: 1px 8px; border-radius: var(--r-pill); font-size: 12px; line-height: 18px; color: var(--ink-3); background: var(--surface-sunken); box-shadow: inset 0 0 0 1px var(--line); white-space: nowrap; }

.env-chip {
  display: inline-flex; align-items: center; gap: 6px;
  padding: 2px 10px; border-radius: var(--r-pill);
  font: 700 12px/18px var(--font-sans); white-space: nowrap;
}
.env-dot { width: 7px; height: 7px; border-radius: 50%; background: currentColor; }
.env-ink { background: var(--surface-sunken); color: var(--ink); box-shadow: inset 0 0 0 1px var(--line-strong); }
.env-violet { background: var(--accent-wash); color: var(--accent-text); }
.env-teal { background: var(--teal-soft); color: var(--teal); }
.env-sky { background: var(--sky-soft); color: var(--sky); }
.env-amber { background: var(--amber-soft); color: var(--amber); }
.env-indigo { background: var(--indigo-soft); color: var(--indigo); }
.env-none { color: var(--ink-5); }
.chips { display: flex; flex-wrap: wrap; gap: 6px; }

/* ---------- Table ---------- */
.table-region {
  overflow: auto; max-width: 100%;
  background: var(--surface);
  border-radius: var(--r-card);
  box-shadow: inset 0 0 0 1px var(--line), var(--elev-1);
}
.table-region:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
.table { width: 100%; min-width: 640px; border-collapse: separate; border-spacing: 0; text-align: left; }
.table th {
  position: sticky; top: 0; z-index: 1;
  padding: 10px 14px; background: var(--surface-2);
  color: var(--ink-4); font-weight: 500; font-size: 12.5px; line-height: 18px; white-space: nowrap;
  border-bottom: 1px solid var(--line);
}
.table th:first-child { border-top-left-radius: var(--r-card); }
.table th:last-child { border-top-right-radius: var(--r-card); }
.table td { padding: 12px 14px; border-bottom: 1px solid var(--line-soft); vertical-align: middle; color: var(--ink-2); }
.table tbody tr:last-child td { border-bottom: 0; }
.table tr.is-clickable { cursor: pointer; }
.table tr.is-clickable:hover td { background: var(--accent-hover-bg); }
.table tr.is-clickable:focus-visible { outline: 2px solid var(--accent); outline-offset: -2px; }
.table tr.is-selected td { background: var(--accent-hover-bg); }
.table .col-check { width: 44px; padding-right: 0; }
.table .col-check input { width: 18px; height: 18px; accent-color: var(--accent); cursor: pointer; margin: 0; vertical-align: middle; }
.table .col-actions { text-align: right; white-space: nowrap; }
.table .col-message { max-width: 360px; }
.table .col-open { width: 40px; color: var(--ink-5); }
.table .col-open .icon { width: 16px; height: 16px; }
.table-group td { background: var(--surface-2); color: var(--ink); font-weight: 700; padding-top: 10px; padding-bottom: 10px; }
.clamp { display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }

/* Phones: rows keep one line per value and the table scrolls sideways inside its own region. */
@media (max-width: 760px) {
  .table td { white-space: nowrap; }
  .table .col-message { white-space: normal; min-width: 240px; }
  .page-actions { width: 100%; }
}

/* ---------- Tabs, filter bar and pager (listControls in ui.js) ---------- */
.tabs { display: flex; gap: 4px; margin: -8px 0 20px; border-bottom: 1px solid var(--line); overflow-x: auto; }
.tab {
  display: inline-flex; align-items: center; gap: 8px;
  min-height: 40px; padding: 8px 12px; margin-bottom: -1px;
  border-bottom: 2px solid transparent;
  color: var(--ink-3); text-decoration: none; font-weight: 500; white-space: nowrap;
}
.tab:hover { color: var(--ink); }
.tab.is-active { color: var(--accent-text); border-bottom-color: var(--accent); font-weight: 700; }
.tab-count { min-width: 22px; padding: 0 7px; border-radius: var(--r-pill); background: var(--surface-sunken); color: var(--ink-4); font: 700 12px/18px var(--font-sans); text-align: center; font-variant-numeric: tabular-nums; }
.tab.is-active .tab-count { background: var(--accent-wash); color: var(--accent-text); }

.filter-bar .control { min-width: 150px; }
.filter-bar select.control { max-width: 240px; text-overflow: ellipsis; }
.filter-bar .search { min-width: 220px; }
.check-inline { min-height: 40px; padding: 0; align-items: center; white-space: nowrap; font-size: 13px; }
.check-inline input { margin-top: 0; }
.filter-chips { display: flex; flex-wrap: wrap; gap: 8px; margin: -4px 0 14px; }
.filter-chip { display: inline-flex; align-items: center; gap: 2px; padding: 0 2px 0 12px; border-radius: var(--r-pill); background: var(--accent-wash); color: var(--accent-text); font-weight: 700; font-size: 12.5px; line-height: 18px; }
.filter-chip .btn { min-height: 28px; width: 28px; padding: 4px; color: inherit; border-radius: var(--r-pill); }
.filter-chip .btn .icon { width: 14px; height: 14px; }
.list-intro { display: flex; flex-wrap: wrap; align-items: center; gap: 4px 8px; margin: -8px 0 16px; color: var(--ink-3); font-size: 13px; }

.pager { display: flex; align-items: center; flex-wrap: wrap; gap: 8px 16px; justify-content: flex-end; margin-top: 12px; color: var(--ink-4); font-size: 13px; font-variant-numeric: tabular-nums; }
.pager-range { margin-right: auto; color: var(--ink-3); }
.pager-size, .pager-page { display: inline-flex; align-items: center; gap: 8px; }
.pager-size .control { width: auto; min-width: 0; min-height: 32px; padding-top: 5px; padding-bottom: 5px; }
.pager-nav { display: inline-flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.pager-jump { width: 64px; min-height: 32px; padding: 5px 8px; text-align: center; }
.pager-jump::-webkit-inner-spin-button { opacity: 0.5; }

.link-button { display: inline; padding: 0; border: 0; background: none; color: var(--ink); font-weight: 700; text-align: left; cursor: pointer; text-decoration: underline; text-decoration-color: var(--line-strong); text-underline-offset: 3px; }
.link-button:hover { color: var(--accent-text); text-decoration-color: currentColor; }
.cell-title.link-button { display: inline; }
.org-cell { display: flex; flex-direction: column; align-items: flex-start; gap: 2px; }
.org-name { display: inline-flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.cell-default { display: block; margin-top: 4px; color: var(--ink-5); font-size: 12px; line-height: 16px; }
@media (max-width: 760px) {
  .filter-bar .search { flex-basis: 100%; max-width: none; }
  .filter-bar .control { flex: 1 1 140px; min-width: 0; }
  .toolbar-count { flex-basis: 100%; margin-left: 0; }
  .pager { justify-content: flex-start; }
  .pager-range { flex-basis: 100%; }
}

/* Sticky action bars (selection and unsaved changes) */
.action-bar {
  position: sticky; bottom: 16px; z-index: 5;
  display: flex; align-items: center; flex-wrap: wrap; gap: 10px 14px;
  margin-top: 16px; padding: 10px 12px 10px 16px;
  background: var(--surface); border-radius: var(--r-card);
  box-shadow: inset 0 0 0 1px var(--accent-border), var(--elev-3);
}
.action-bar-text { color: var(--ink); font-weight: 700; }
.action-bar-sub { color: var(--ink-3); font-size: 13px; }
.action-bar .spacer { flex: 1; }

/* ---------- Empty, error and loading states ---------- */
.empty { display: flex; flex-direction: column; align-items: center; text-align: center; gap: 8px; padding: 48px 20px; border-radius: var(--r-card); background: var(--surface); box-shadow: inset 0 0 0 1px var(--line); }
.empty-icon { display: grid; place-items: center; width: 44px; height: 44px; border-radius: 12px; background: var(--accent-wash); color: var(--accent-text); margin-bottom: 4px; }
.empty-icon .icon { width: 22px; height: 22px; }
.empty-title { font-size: 16px; line-height: 22px; }
.empty-body { color: var(--ink-3); max-width: 460px; }
.empty .btn { margin-top: 8px; }
.empty-error .empty-icon { background: var(--error-soft); color: var(--error-text); }
.empty-compact { padding: 28px 16px; }

.loading { display: flex; flex-direction: column; gap: 10px; }
.skeleton { border-radius: 10px; background: linear-gradient(90deg, var(--surface-sunken) 0%, var(--line-soft) 50%, var(--surface-sunken) 100%); background-size: 200% 100%; animation: shimmer 1.4s linear infinite; }
.skeleton-title { height: 28px; width: 260px; margin-bottom: 8px; }
.skeleton-row { height: 44px; }
@keyframes shimmer { from { background-position: 200% 0; } to { background-position: -200% 0; } }

/* ---------- Toasts ---------- */
.toasts { position: fixed; right: 20px; bottom: 20px; z-index: 100; display: flex; flex-direction: column; gap: 8px; align-items: flex-end; pointer-events: none; }
.toast {
  pointer-events: auto;
  display: flex; align-items: center; gap: 12px;
  max-width: min(460px, calc(100vw - 32px));
  padding: 10px 8px 10px 16px; border-radius: 12px;
  background: var(--ink); color: var(--page);
  box-shadow: var(--elev-4);
  animation: toast-in var(--dur) var(--ease);
}
:root[data-theme="dark"] .toast { background: #1d1d25; color: #fff; box-shadow: inset 0 0 0 1px var(--line), var(--elev-4); }
@media (prefers-color-scheme: dark) { :root:not([data-theme="light"]) .toast { background: #1d1d25; color: #fff; box-shadow: inset 0 0 0 1px var(--line), var(--elev-4); } }
.toast-message { flex: 1; }
.toast-success .toast-message::before { content: "✓ "; color: #6dd6a8; font-weight: 700; }
.toast-error .toast-message::before { content: "! "; color: #ff8a8a; font-weight: 700; }
.toast-action { min-height: 32px; padding: 4px 10px; border: 0; border-radius: 8px; background: rgb(166 122 255 / 0.18); color: #c9b2ff; font-weight: 700; cursor: pointer; }
.toast-action:hover { background: rgb(166 122 255 / 0.3); }
.toast-close { display: grid; place-items: center; width: 32px; height: 32px; border: 0; border-radius: 8px; background: transparent; color: inherit; opacity: 0.7; cursor: pointer; }
.toast-close:hover { opacity: 1; background: rgb(255 255 255 / 0.1); }
.toast-close .icon { width: 16px; height: 16px; }
.toast.is-leaving { opacity: 0; transform: translateY(6px); transition: opacity var(--dur-fast), transform var(--dur-fast); }
@keyframes toast-in { from { opacity: 0; transform: translateY(8px); } to { opacity: 1; transform: none; } }
@media (max-width: 760px) { .toasts { left: 12px; right: 12px; bottom: 12px; align-items: stretch; } .toast { max-width: none; } }

/* ---------- Dialogs and drawers ---------- */
dialog { color: var(--ink-2); }
dialog::backdrop { background: var(--scrim); }
.dialog {
  width: min(480px, calc(100vw - 32px)); padding: 0; border: 0;
  border-radius: var(--r-card); background: var(--surface);
  box-shadow: inset 0 0 0 1px var(--line), var(--elev-4);
}
.dialog[open] { animation: pop-in var(--dur) var(--ease); }
.dialog-body { padding: 22px 22px 8px; display: flex; flex-direction: column; gap: 10px; }
.dialog-title { font-size: 18px; line-height: 24px; }
.dialog-body p { color: var(--ink-3); }
.dialog-body .consequence { color: var(--ink); font-weight: 700; }
.dialog-actions { display: flex; justify-content: flex-end; flex-wrap: wrap; gap: 8px; padding: 16px 22px 20px; }
@keyframes pop-in { from { opacity: 0; transform: translateY(8px) scale(0.98); } to { opacity: 1; transform: none; } }

.drawer {
  position: fixed; inset: 0 0 0 auto; margin: 0;
  width: min(520px, 100vw); max-width: 100vw; height: 100dvh; max-height: 100dvh;
  padding: 0; border: 0; border-left: 1px solid var(--line);
  background: var(--surface); box-shadow: var(--elev-4);
  display: none; flex-direction: column;
}
.drawer[open] { display: flex; animation: slide-in var(--dur) var(--ease); }
.drawer-wide { width: min(760px, 100vw); }
.drawer-head { display: flex; justify-content: space-between; align-items: flex-start; gap: 12px; padding: 18px 16px 14px 22px; border-bottom: 1px solid var(--line); }
.drawer-title { font-size: 18px; line-height: 24px; overflow-wrap: anywhere; }
.drawer-subtitle { margin-top: 4px; color: var(--ink-4); font-size: 13px; overflow-wrap: anywhere; }
.drawer-body { flex: 1; overflow-y: auto; padding: 20px 22px; display: flex; flex-direction: column; gap: 18px; }
.drawer-foot { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; justify-content: flex-end; padding: 14px 22px; border-top: 1px solid var(--line); background: var(--surface-2); }
.drawer-foot .spacer { flex: 1; }
.drawer-section { display: flex; flex-direction: column; gap: 10px; }
.drawer-section + .drawer-section { padding-top: 18px; border-top: 1px solid var(--line-soft); }
.drawer-section-title { font-size: 14px; line-height: 20px; }
@keyframes slide-in { from { transform: translateX(24px); opacity: 0; } to { transform: none; opacity: 1; } }

.details-list { display: grid; grid-template-columns: minmax(110px, max-content) 1fr; gap: 8px 16px; margin: 0; }
.details-list dt { color: var(--ink-4); font-size: 13px; }
.details-list dd { margin: 0; color: var(--ink-2); overflow-wrap: anywhere; }

pre.block, .code-block {
  margin: 0; padding: 12px 14px; max-height: 320px; overflow: auto;
  white-space: pre-wrap; overflow-wrap: anywhere;
  background: var(--surface-sunken); border-radius: var(--r-control); box-shadow: inset 0 0 0 1px var(--line);
  color: var(--ink-2);
}
details.disclosure { border-radius: var(--r-control); box-shadow: inset 0 0 0 1px var(--line); }
details.disclosure > summary { display: flex; align-items: center; gap: 8px; min-height: 40px; padding: 8px 12px; cursor: pointer; color: var(--ink); font-weight: 700; list-style: none; }
details.disclosure > summary::-webkit-details-marker { display: none; }
details.disclosure > summary::before { content: "›"; display: inline-block; width: 12px; color: var(--ink-4); transition: transform var(--dur-fast) var(--ease); }
details.disclosure[open] > summary::before { transform: rotate(90deg); }
details.disclosure > :not(summary) { margin: 0 12px 12px; }

.attachments { display: flex; flex-wrap: wrap; gap: 8px; }
.attachment-thumb { max-width: 160px; max-height: 120px; border-radius: 8px; box-shadow: inset 0 0 0 1px var(--line); cursor: zoom-in; background: var(--surface-sunken); }

/* ---------- Menu ---------- */
.menu-wrap { position: relative; }
.menu {
  position: absolute; top: calc(100% + 6px); right: 0; z-index: 30;
  min-width: 220px; padding: 6px;
  background: var(--surface); border-radius: 12px;
  box-shadow: inset 0 0 0 1px var(--line), var(--elev-3);
}
.menu-item { display: flex; align-items: center; gap: 10px; width: 100%; min-height: 40px; padding: 8px 10px; border: 0; border-radius: 8px; background: none; color: var(--ink-2); text-align: left; cursor: pointer; }
.menu-item:hover, .menu-item:focus-visible { background: var(--accent-hover-bg); color: var(--ink); outline: none; }
.menu-item span { flex: 1; }
.menu-check { stroke: var(--accent); }
.menu-heading { padding: 6px 10px 4px; color: var(--ink-5); font-size: 12px; }
.menu-sep { height: 1px; margin: 6px 4px; background: var(--line); }
.option-list { display: flex; flex-direction: column; gap: 8px; }
.option {
  display: flex; align-items: center; gap: 12px; min-height: 56px; padding: 10px 14px;
  border-radius: var(--r-control); box-shadow: inset 0 0 0 1px var(--line); cursor: pointer;
}
.option:hover { box-shadow: inset 0 0 0 1px var(--accent-border); }
.option:has(input:checked) { box-shadow: inset 0 0 0 2px var(--accent); background: var(--accent-hover-bg); }
.option input { accent-color: var(--accent); width: 18px; height: 18px; margin: 0; }
.option-text { flex: 1; display: flex; flex-direction: column; gap: 2px; }
.option-sub { color: var(--ink-4); font-size: 12.5px; }
.option-text .env-chip { align-self: flex-start; }

/* ---------- Auth ---------- */
.auth { min-height: 100vh; display: grid; place-items: center; padding: 24px 16px; background: radial-gradient(52rem 26rem at 50% -14rem, rgb(129 67 253 / 0.10), transparent), var(--page); }
.auth-card { width: min(420px, 100%); padding: 32px 28px; border-radius: 20px; background: var(--surface); box-shadow: inset 0 0 0 1px var(--line), var(--elev-3); display: flex; flex-direction: column; gap: 16px; }
.auth-brand { display: flex; align-items: center; gap: 12px; margin-bottom: 8px; }
.auth-mark { width: 40px; height: 40px; }
.auth-product { color: var(--ink); font-weight: 700; font-size: 17px; line-height: 22px; }
.auth-sub { color: var(--ink-4); font-size: 13px; }
.auth-title { font-size: 24px; line-height: 30px; letter-spacing: -0.025em; }
.auth-text { color: var(--ink-3); }
.auth-form { display: flex; flex-direction: column; gap: 14px; }
.auth-form .btn { width: 100%; }
.auth-status { color: var(--ink-3); font-size: 13px; }
.auth-status:empty { display: none; }
.auth-actions { display: flex; flex-wrap: wrap; gap: 8px; }

/* ---------- Overview ---------- */
.needs-list { display: flex; flex-direction: column; }
.needs-item { display: flex; align-items: center; gap: 14px; min-height: 60px; padding: 12px 4px; border-top: 1px solid var(--line-soft); color: var(--ink-2); text-decoration: none; }
.needs-item:first-child { border-top: 0; }
.needs-item:hover { color: var(--ink); }
.needs-item:hover .needs-go { color: var(--accent-text); }
.needs-icon { display: grid; place-items: center; width: 36px; height: 36px; border-radius: 10px; background: var(--warning-soft); color: var(--warning-text); flex: 0 0 auto; }
.needs-icon.is-violet { background: var(--accent-wash); color: var(--accent-text); }
.needs-icon.is-error { background: var(--error-soft); color: var(--error-text); }
.needs-text { flex: 1; min-width: 0; display: flex; flex-direction: column; }
.needs-title { color: var(--ink); font-weight: 700; }
.needs-sub { color: var(--ink-4); font-size: 13px; }
.needs-go { color: var(--ink-5); }
.env-summary { display: flex; flex-direction: column; gap: 8px; }
.env-card { display: grid; grid-template-columns: minmax(0, 1fr) auto; align-items: center; gap: 4px 12px; padding: 12px 14px; border-radius: 12px; box-shadow: inset 0 0 0 1px var(--line); text-decoration: none; color: var(--ink-3); }
.env-card .env-chip { justify-self: start; }
.env-card .faint { grid-column: 1; }
.env-card-count { grid-column: 2; grid-row: 1 / span 2; }
.env-card:hover { box-shadow: inset 0 0 0 1px var(--accent-border); color: var(--ink-3); }
.env-card-count { color: var(--ink); font-weight: 700; font-size: 20px; line-height: 26px; font-variant-numeric: tabular-nums; }
.grid-2 { display: grid; grid-template-columns: minmax(0, 3fr) minmax(0, 2fr); gap: 20px; align-items: start; }
.grid-2 > .panel + .panel { margin-top: 0; }
@media (max-width: 1100px) { .grid-2 { grid-template-columns: minmax(0, 1fr); } }

/* ---------- Templates editor ---------- */
.module-group { padding: 0; overflow: hidden; }
.module-group + .module-group { margin-top: 16px; }
.module-group-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; flex-wrap: wrap; padding: 14px 14px 12px; border-bottom: 1px solid var(--line); }
.module-group-count { color: var(--ink-4); font-size: 13px; font-variant-numeric: tabular-nums; }
.surface-tag { font-size: 11.5px; }
.key { font-family: var(--font-mono); font-size: 12px; color: var(--ink-5); }
.retired-row { display: flex; align-items: center; gap: 12px; padding: 12px 14px; border-top: 1px solid var(--line-soft); }
.retired-row:first-child { border-top: 0; }
.diff { font-variant-numeric: tabular-nums; }
.diff-add { color: var(--success-text); font-weight: 700; }
.diff-remove { color: var(--error-text); font-weight: 700; }
.editor-meta { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 2fr); gap: 16px; }
@media (max-width: 760px) { .editor-meta { grid-template-columns: minmax(0, 1fr); } }
.conflict { margin-bottom: 16px; }

/* ---------- Learnings ---------- */
.alerts { display: flex; flex-direction: column; gap: 8px; margin-bottom: 16px; }
.stat-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(180px, 1fr)); gap: 0; border-radius: var(--r-card); background: var(--surface); box-shadow: inset 0 0 0 1px var(--line); overflow: hidden; margin-bottom: 20px; }
.stat { padding: 14px 16px; border-right: 1px solid var(--line-soft); border-bottom: 1px solid var(--line-soft); display: flex; flex-direction: column; gap: 2px; }
.stat-label { color: var(--ink-4); font-size: 12.5px; }
.stat-value { color: var(--ink); font-weight: 700; font-size: 18px; line-height: 24px; font-variant-numeric: tabular-nums; }
.stat-sub { color: var(--ink-4); font-size: 12.5px; }
.bars { display: flex; align-items: flex-end; gap: 4px; height: 44px; margin: 4px 0; }
.bar { display: flex; flex-direction: column; align-items: center; justify-content: flex-end; height: 100%; width: 16px; }
.bar i { display: block; width: 100%; background: var(--accent); border-radius: 3px 3px 0 0; min-height: 2px; }
.bar b { font-size: 10px; line-height: 12px; color: var(--ink-5); font-weight: 500; }
.bar-l0 i { height: 4%; } .bar-l1 i { height: 20%; } .bar-l2 i { height: 40%; } .bar-l3 i { height: 60%; } .bar-l4 i { height: 80%; } .bar-l5 i { height: 100%; }
.queue { display: flex; flex-direction: column; gap: 10px; outline: none; border-radius: var(--r-card); }
.queue:focus-visible { box-shadow: 0 0 0 3px var(--accent-ring); }
.qrow { padding: 14px 16px; border-radius: 12px; background: var(--surface); box-shadow: inset 0 0 0 1px var(--line); display: flex; flex-direction: column; gap: 8px; }
.qrow.is-cursor { box-shadow: inset 0 0 0 2px var(--accent), 0 0 0 4px var(--accent-ring); }
.qhead { display: flex; gap: 8px; flex-wrap: wrap; align-items: center; font-variant-numeric: tabular-nums; }
.qactions { display: flex; gap: 8px; flex-wrap: wrap; align-items: center; }
.qactions .control { flex: 1 1 220px; width: auto; }
kbd { display: inline-block; min-width: 20px; padding: 0 5px; border-radius: 5px; box-shadow: inset 0 0 0 1px var(--line-strong), 0 1px 0 var(--line-strong); color: var(--ink-3); text-align: center; font-size: 11px; line-height: 18px; }
.notebody { white-space: pre-wrap; font-family: var(--font-mono); font-size: 12px; background: var(--receipt-bg); color: var(--receipt-ink); border: 1px solid var(--receipt-rule); border-radius: 8px; padding: 10px 12px; max-height: 320px; overflow: auto; margin: 0; }
.audit-list { margin: 0; padding-left: 18px; font-size: 12.5px; color: var(--ink-3); }

/* ---------- Review page (server-rendered, sanitised HTML) ---------- */
.review-page { display: flex; flex-direction: column; gap: 12px; margin-bottom: 20px; color: var(--ink-2); }
.review-page h1, .review-page h2, .review-page h3 { color: var(--ink); }
.review-page h2 { font-size: 18px; line-height: 24px; margin-top: 12px; }
.review-page .tp-grid { display: grid; grid-template-columns: minmax(0, 1fr) 300px; gap: 24px; }
.review-page img.master { width: 100%; max-width: 720px; border-radius: 12px; box-shadow: inset 0 0 0 1px var(--line); display: block; }
.review-page .why { margin: 8px 0 16px; font-size: 15px; }
.review-page .strip { display: flex; gap: 12px; overflow-x: auto; padding: 4px 0; }
.review-page .strip figure { margin: 0; flex: 0 0 auto; }
.review-page .strip img { height: 160px; border-radius: 8px; border: 1px solid var(--line); }
.review-page figcaption { font-size: 12px; color: var(--ink-4); }
.review-page .territories { display: flex; border: 1px solid var(--line); border-radius: 12px; overflow: hidden; margin: 16px 0; }
.review-page .territories > div { flex: 1; padding: 10px 12px; border-right: 1px solid var(--line); font-size: 13px; }
.review-page .territories > div:last-child { border-right: 0; }
.review-page .territories .pick { background: var(--accent-wash); }
.review-page .territories .score { color: var(--ink-4); }
.review-page .pill { display: inline-block; border: 1px solid var(--line); border-radius: var(--r-pill); padding: 2px 10px; font-size: 12px; color: var(--ink-3); }
.review-page ul.err li { color: var(--error-text); }
.state { padding: 10px 14px; border-radius: 10px; margin: 0; font-weight: 700; }
.state.amber, .review-page .state.amber { background: var(--warning-soft); color: var(--warning-text); }
.tp-receipt { background: var(--receipt-bg); border: 1px solid var(--receipt-rule); border-radius: 0; padding: 14px 16px; font-family: var(--font-mono); font-size: 12px; color: var(--receipt-ink); align-self: start; }
.tp-receipt h2 { font-size: 12px; margin: 0 0 10px; color: var(--receipt-pencil); }
.tp-receipt .line { display: flex; justify-content: space-between; gap: 8px; padding: 3px 0; border-bottom: 1px dashed var(--receipt-rule); }
.tp-receipt .line small { color: var(--receipt-pencil); display: block; }
.tp-receipt .total { margin-top: 10px; font-weight: 700; }
.signoff { padding: 10px 12px; background: var(--accent-hover-bg); border-radius: 10px; box-shadow: inset 0 0 0 1px var(--accent-border); }
.review-internal { border-top: 2px solid var(--accent); margin-top: 24px; padding-top: 12px; }
.review-internal table { font-size: 12px; border-collapse: collapse; }
.review-internal td, .review-internal th { padding: 4px 8px; border-bottom: 1px solid var(--line-soft); text-align: left; }
@media (max-width: 1024px) { .review-page .tp-grid { grid-template-columns: 1fr; } .review-page .tp-receipt { order: 2; } }

/* ---------- Standalone pages (Canva return, downloads) ---------- */
.standalone { max-width: 560px; margin: 0 auto; padding: 64px 20px; display: flex; flex-direction: column; gap: 12px; }
.standalone h1 { font-size: 24px; line-height: 30px; letter-spacing: -0.025em; }
.standalone .sub { color: var(--ink-4); }

/* ---------- Motion preferences ---------- */
.skill-library { display: grid; grid-template-columns: repeat(auto-fit, minmax(min(100%, 320px), 1fr)); gap: 16px; align-items: stretch; }
.skill-card { display: flex; flex-direction: column; gap: 10px; min-height: 220px; padding: 20px; border: 1px solid var(--line); border-radius: 14px; background: var(--surface); }
.skill-card-top { display: flex; align-items: flex-start; justify-content: space-between; gap: 12px; }
.skill-card h2 { font-size: 19px; line-height: 25px; margin: 0 0 8px; }
.skill-card p { margin: 0; line-height: 1.45; }
.skill-card .row { margin-top: auto; padding-top: 8px; }

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation: none !important; transition: none !important; scroll-behavior: auto !important; }
}
