/* ==========================================================================
   Ascentium Studio - design system
   One stylesheet for the public site, the app, the owner panel and the installer.
   Mobile first. Light and dark themes through CSS variables. No external fonts or requests.
   ========================================================================== */

:root {
  --brand-rgb: 47 111 237; /* space separated on purpose: rgb(var(--brand-rgb) / .2) is invalid with commas */
  --brand: rgb(var(--brand-rgb));
  --brand-strong: #2158d6;
  --on-brand: #fff;
  --brand-soft: rgb(var(--brand-rgb) / .09);
  --brand-line: rgb(var(--brand-rgb) / .28);

  --bg: #f5f6fa;
  --surface: #ffffff;
  --surface-2: #f8f9fc;
  --surface-3: #eef0f6;
  --text: #0f172a;
  --text-2: #334155;
  --muted: #64748b;
  --line: #e3e7ef;
  --line-strong: #cfd5e2;

  --ok: #12805c;   --ok-bg: #e7f6ef;   --ok-line: #b7e4d0;
  --warn: #9a5b00; --warn-bg: #fff4de; --warn-line: #f6dca2;
  --bad: #c0262d;  --bad-bg: #fdecec;  --bad-line: #f5c2c4;
  --info: #1e5fd0; --info-bg: #eaf1fe; --info-line: #c4d8fb;

  --radius: 14px;
  --radius-sm: 10px;
  --radius-xs: 7px;
  --shadow-1: 0 1px 2px rgb(16 24 40 / .05), 0 1px 3px rgb(16 24 40 / .04);
  --shadow-2: 0 4px 12px rgb(16 24 40 / .07), 0 2px 4px rgb(16 24 40 / .04);
  --shadow-3: 0 18px 40px rgb(16 24 40 / .14), 0 4px 10px rgb(16 24 40 / .06);
  --ring: 0 0 0 3px rgb(var(--brand-rgb) / .28);

  --font: ui-sans-serif, system-ui, -apple-system, "Segoe UI Variable Text", "Segoe UI", Roboto, "Helvetica Neue", Arial, "Noto Sans", sans-serif;
  --mono: ui-monospace, SFMono-Regular, "SF Mono", Menlo, Consolas, monospace;

  --sidebar-w: 268px;
  --topbar-h: 60px;
  --page-pad: clamp(16px, 3vw, 32px);
  color-scheme: light;
}

:root[data-theme="dark"] {
  --bg: #0a0e17;
  --surface: #111827;
  --surface-2: #151d2e;
  --surface-3: #1b2438;
  --text: #eef1f7;
  --text-2: #cbd3e1;
  --muted: #94a0b6;
  --line: #222c42;
  --line-strong: #2f3b57;
  --brand-soft: rgb(var(--brand-rgb) / .16);
  --brand-line: rgb(var(--brand-rgb) / .45);
  --ok: #4ade9f;   --ok-bg: #0f2a22;   --ok-line: #1b5a45;
  --warn: #fbbf4a; --warn-bg: #2d2208; --warn-line: #6b4d12;
  --bad: #ff8a8f;  --bad-bg: #321418;  --bad-line: #74282e;
  --info: #8db6ff; --info-bg: #11213f; --info-line: #27457f;
  --shadow-1: 0 1px 2px rgb(0 0 0 / .4);
  --shadow-2: 0 6px 16px rgb(0 0 0 / .4);
  --shadow-3: 0 22px 48px rgb(0 0 0 / .55);
  color-scheme: dark;
}

/* ---------- reset & base ---------- */
*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; scroll-behavior: smooth; }
body {
  margin: 0; background: var(--bg); color: var(--text); font: 400 16px/1.55 var(--font);
  -webkit-font-smoothing: antialiased; text-rendering: optimizeLegibility; min-height: 100vh;
}
h1, h2, h3, h4 { margin: 0 0 .5em; line-height: 1.2; letter-spacing: -.015em; font-weight: 650; color: var(--text); }
h1 { font-size: clamp(1.6rem, 1.2rem + 1.6vw, 2.25rem); }
h2 { font-size: clamp(1.25rem, 1.05rem + .8vw, 1.6rem); }
h3 { font-size: 1.05rem; }
p { margin: 0 0 1em; }
a { color: var(--brand); text-decoration: none; }
a:hover { text-decoration: underline; text-underline-offset: 3px; }
img, svg { max-width: 100%; }
hr { border: 0; border-top: 1px solid var(--line); margin: 1.5rem 0; }
code, kbd, pre { font-family: var(--mono); font-size: .88em; }
code { background: var(--surface-3); padding: .12em .4em; border-radius: 6px; }
pre { background: var(--surface-3); padding: 14px 16px; border-radius: var(--radius-sm); overflow: auto; line-height: 1.5; }
kbd { background: var(--surface); border: 1px solid var(--line-strong); border-bottom-width: 2px; border-radius: 6px; padding: .1em .45em; }
::selection { background: rgb(var(--brand-rgb) / .3); color: inherit; }
:root[data-theme="dark"] ::selection { background: rgb(var(--brand-rgb) / .55); }
:focus-visible { outline: none; box-shadow: var(--ring); border-radius: var(--radius-xs); }
.i { flex: none; vertical-align: middle; }
.sr-only { position: absolute !important; width: 1px; height: 1px; padding: 0; margin: -1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; border: 0; }
.skip { position: absolute; left: 12px; top: -60px; z-index: 100; background: var(--brand); color: var(--on-brand); padding: 10px 16px; border-radius: 10px; transition: top .15s; }
.skip:focus { top: 12px; }
.muted { color: var(--muted); }
.small { font-size: .875rem; }
.xs { font-size: .78rem; }
.nowrap { white-space: nowrap; }
.right { text-align: right; }
.center { text-align: center; }
.mono { font-family: var(--mono); }
.strong { font-weight: 650; }
.hidden, [hidden] { display: none !important; }
.when-light, .when-dark { display: inline-flex; }
:root[data-theme="dark"] .when-light, :root:not([data-theme="dark"]) .when-dark { display: none; }
.stack > * + *, .stack-sm > * + *, .stack-lg > * + * { margin-top: var(--gap, 16px); }
.stack-sm { --gap: 8px; } .stack-lg { --gap: 28px; }
.cluster { display: flex; flex-wrap: wrap; align-items: center; gap: var(--gap, 10px); }
.cluster-between { justify-content: space-between; }
.grow { flex: 1 1 auto; min-width: 0; }
.grid { display: grid; gap: var(--gap, 16px); }
.grid-2 { grid-template-columns: repeat(auto-fit, minmax(min(100%, 320px), 1fr)); }
.grid-3 { grid-template-columns: repeat(auto-fit, minmax(min(100%, 250px), 1fr)); }
.grid-4 { grid-template-columns: repeat(auto-fit, minmax(min(100%, 150px), 1fr)); } /* 4 across on tablets, 2 x 2 on phones: never a lonely fourth card */
.split { display: grid; gap: 20px; grid-template-columns: minmax(0, 1fr); }
/* The app shell already uses 268px for the menu, so two columns only start when there is room for both. */
@media (min-width: 1240px) { .split { grid-template-columns: minmax(0, 1fr) 340px; align-items: start; } .split-wide { grid-template-columns: minmax(0, 1fr) 420px; } }

/* ---------- buttons ---------- */
.btn {
  --b: var(--line-strong); --bg-btn: var(--surface); --fg: var(--text);
  display: inline-flex; align-items: center; justify-content: center; gap: 8px; min-height: 42px; padding: 0 16px;
  font: 600 .94rem/1 var(--font); color: var(--fg); background: var(--bg-btn); border: 1px solid var(--b); border-radius: 11px;
  cursor: pointer; text-decoration: none; transition: background .15s, border-color .15s, box-shadow .15s, transform .05s; user-select: none; white-space: nowrap;
  box-shadow: var(--shadow-1);
}
.btn:hover { text-decoration: none; border-color: var(--brand-line); background: var(--surface-2); }
.btn:active { transform: translateY(1px); }
.btn[disabled], .btn.is-disabled { opacity: .55; cursor: not-allowed; pointer-events: none; }
.btn-primary { --bg-btn: var(--brand); --b: var(--brand); --fg: var(--on-brand); box-shadow: 0 1px 2px rgb(var(--brand-rgb) / .35), inset 0 1px 0 rgb(255 255 255 / .14); }
.btn-primary:hover { background: var(--brand-strong); border-color: var(--brand-strong); }
.btn-ghost { --bg-btn: transparent; --b: transparent; box-shadow: none; color: var(--text-2); }
.btn-ghost:hover { background: var(--surface-3); border-color: transparent; }
.btn-danger { --fg: var(--bad); --b: var(--bad-line); }
.btn-danger:hover { background: var(--bad-bg); border-color: var(--bad); }
.btn-danger-solid { --bg-btn: var(--bad); --b: var(--bad); --fg: #fff; }
.btn-sm { min-height: 34px; padding: 0 12px; font-size: .86rem; border-radius: 9px; }
.btn-lg { min-height: 50px; padding: 0 24px; font-size: 1.02rem; border-radius: 13px; }
.btn-block { width: 100%; }
.btn-icon { width: 42px; padding: 0; } .btn-icon.btn-sm { width: 34px; }
.btn.is-loading { position: relative; color: transparent !important; pointer-events: none; }
.btn.is-loading::after { content: ""; position: absolute; width: 18px; height: 18px; border-radius: 50%; border: 2px solid var(--fg); border-top-color: transparent; animation: spin .7s linear infinite; }
.btn-primary.is-loading::after { border-color: var(--on-brand); border-top-color: transparent; }
@keyframes spin { to { transform: rotate(360deg); } }

/* ---------- forms ---------- */
.field { display: grid; gap: 6px; }
.field > label, .label { font-weight: 600; font-size: .9rem; color: var(--text-2); display: flex; align-items: center; justify-content: space-between; gap: 8px; }
.hint { color: var(--muted); font-size: .84rem; }
.input, .select, .textarea {
  width: 100%; min-height: 44px; padding: 10px 13px; font: inherit; color: var(--text); background: var(--surface);
  border: 1px solid var(--line-strong); border-radius: 11px; transition: border-color .15s, box-shadow .15s; -webkit-appearance: none; appearance: none;
}
.textarea { min-height: 110px; resize: vertical; line-height: 1.5; }
.select { padding-right: 38px; background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='16' height='16' viewBox='0 0 24 24' fill='none' stroke='%2364748b' stroke-width='2.2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='m6 9 6 6 6-6'/%3E%3C/svg%3E"); background-repeat: no-repeat; background-position: right 12px center; }
.input::placeholder, .textarea::placeholder { color: #9aa5b8; }
.input:hover, .select:hover, .textarea:hover { border-color: var(--brand-line); }
.input:focus, .select:focus, .textarea:focus { outline: none; border-color: var(--brand); box-shadow: var(--ring); }
.input[aria-invalid="true"], .is-invalid { border-color: var(--bad); }
.input[readonly], .input:disabled { background: var(--surface-3); color: var(--muted); }
.input-sm { min-height: 36px; padding: 6px 10px; font-size: .92rem; border-radius: 9px; }
.input-group { position: relative; }
.input-group .input { padding-right: 46px; }
.input-group .toggle-pw { position: absolute; right: 4px; top: 4px; }
.form-grid { display: grid; gap: 18px; grid-template-columns: repeat(auto-fit, minmax(min(100%, 240px), 1fr)); }
.form-grid .span-all { grid-column: 1 / -1; }
.check { display: flex; align-items: flex-start; gap: 10px; cursor: pointer; font-size: .94rem; }
.check input { appearance: none; -webkit-appearance: none; flex: none; width: 20px; height: 20px; margin: 1px 0 0; border: 1.5px solid var(--line-strong); border-radius: 6px; background: var(--surface); display: grid; place-content: center; cursor: pointer; transition: .12s; }
.check input[type="radio"] { border-radius: 50%; }
.check input::after { content: ""; width: 10px; height: 10px; background: var(--on-brand); clip-path: polygon(14% 44%, 0 65%, 50% 100%, 100% 16%, 80% 0, 43% 62%); transform: scale(0); transition: .12s; }
.check input[type="radio"]::after { clip-path: circle(40%); }
.check input:checked { background: var(--brand); border-color: var(--brand); }
.check input:checked::after { transform: scale(1); }
.switch { display: inline-flex; align-items: center; gap: 10px; cursor: pointer; }
.switch input { appearance: none; -webkit-appearance: none; width: 42px; height: 24px; border-radius: 999px; background: var(--line-strong); position: relative; transition: .18s; cursor: pointer; margin: 0; flex: none; }
.switch input::after { content: ""; position: absolute; top: 3px; left: 3px; width: 18px; height: 18px; border-radius: 50%; background: #fff; box-shadow: 0 1px 3px rgb(0 0 0 / .3); transition: .18s; }
.switch input:checked { background: var(--brand); }
.switch input:checked::after { left: 21px; }
.seg { display: inline-flex; padding: 3px; gap: 2px; background: var(--surface-3); border-radius: 12px; max-width: 100%; overflow-x: auto; }
.seg a, .seg button { border: 0; background: transparent; color: var(--muted); font: 600 .88rem/1 var(--font); padding: 9px 14px; border-radius: 9px; cursor: pointer; white-space: nowrap; text-decoration: none; }
.seg a:hover, .seg button:hover { color: var(--text); text-decoration: none; }
.seg .on { background: var(--surface); color: var(--text); box-shadow: var(--shadow-1); }
.stepper-input { display: inline-flex; align-items: center; border: 1px solid var(--line-strong); border-radius: 11px; background: var(--surface); overflow: hidden; }
.stepper-input button { width: 38px; height: 42px; border: 0; background: transparent; color: var(--text-2); font-size: 1.2rem; cursor: pointer; }
.stepper-input button:hover { background: var(--surface-3); }
.stepper-input input { width: 54px; text-align: center; border: 0; background: transparent; font: 600 1rem var(--font); color: var(--text); -moz-appearance: textfield; padding: 0; min-height: 42px; }
.stepper-input input::-webkit-outer-spin-button, .stepper-input input::-webkit-inner-spin-button { -webkit-appearance: none; margin: 0; }
.stepper-input input:focus { outline: none; background: var(--brand-soft); }
.hp { position: absolute; left: -9999px; width: 1px; height: 1px; overflow: hidden; } /* honeypot */
.strength { display: grid; grid-template-columns: repeat(4, 1fr); gap: 4px; margin-top: 2px; }
.strength i { height: 4px; border-radius: 4px; background: var(--line); transition: background .2s; }
.strength[data-s="1"] i:nth-child(-n+1) { background: var(--bad); }
.strength[data-s="2"] i:nth-child(-n+2) { background: var(--warn); }
.strength[data-s="3"] i:nth-child(-n+3) { background: #7ab51d; }
.strength[data-s="4"] i { background: var(--ok); }

/* ---------- cards & surfaces ---------- */
.card { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); box-shadow: var(--shadow-1); }
.card-pad { padding: clamp(16px, 2.2vw, 24px); }
.card-head { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 10px; padding: 16px clamp(16px, 2.2vw, 24px); border-bottom: 1px solid var(--line); }
.card-head h2, .card-head h3 { margin: 0; font-size: 1.05rem; }
.card-body { padding: clamp(16px, 2.2vw, 24px); }
.card-foot { padding: 14px clamp(16px, 2.2vw, 24px); border-top: 1px solid var(--line); background: var(--surface-2); border-radius: 0 0 var(--radius) var(--radius); }
.card-link { display: block; color: inherit; transition: transform .15s, box-shadow .15s, border-color .15s; }
.card-link.cluster { display: flex; }
.card-link:hover { transform: translateY(-2px); box-shadow: var(--shadow-2); border-color: var(--brand-line); text-decoration: none; }
.tile-icon { width: 44px; height: 44px; border-radius: 12px; display: grid; place-items: center; background: var(--brand-soft); color: var(--brand); flex: none; }
.tile-icon.ok { background: var(--ok-bg); color: var(--ok); } .tile-icon.warn { background: var(--warn-bg); color: var(--warn); } .tile-icon.info { background: var(--info-bg); color: var(--info); }
.stat { padding: 18px 20px; display: grid; gap: 4px; }
.stat .k { color: var(--muted); font-size: .84rem; font-weight: 600; text-transform: uppercase; letter-spacing: .04em; }
.stat .v { font-size: 1.9rem; font-weight: 700; letter-spacing: -.02em; line-height: 1.1; }
.stat .s { color: var(--muted); font-size: .85rem; }

/* ---------- badges, alerts, toasts ---------- */
.badge { display: inline-flex; align-items: center; gap: 5px; padding: 3px 10px; border-radius: 999px; font-size: .76rem; font-weight: 650; background: var(--surface-3); color: var(--text-2); border: 1px solid transparent; white-space: nowrap; }
.badge.ok { background: var(--ok-bg); color: var(--ok); border-color: var(--ok-line); }
.badge.warn { background: var(--warn-bg); color: var(--warn); border-color: var(--warn-line); }
.badge.bad { background: var(--bad-bg); color: var(--bad); border-color: var(--bad-line); }
.badge.info { background: var(--info-bg); color: var(--info); border-color: var(--info-line); }
.badge.brand { background: var(--brand-soft); color: var(--brand); border-color: var(--brand-line); padding: 3px 10px; font-size: .76rem; font-weight: 650; gap: 5px; letter-spacing: 0; }
.dot { width: 8px; height: 8px; border-radius: 50%; background: currentColor; flex: none; }
.alert { display: flex; gap: 12px; padding: 13px 16px; border-radius: var(--radius-sm); border: 1px solid; font-size: .94rem; align-items: flex-start; }
.alert .i { margin-top: 2px; }
.alert-body { min-width: 0; } .alert-body p:last-child { margin-bottom: 0; }
.alert.ok { background: var(--ok-bg); border-color: var(--ok-line); color: var(--ok); }
.alert.warn { background: var(--warn-bg); border-color: var(--warn-line); color: var(--warn); }
.alert.bad, .alert.error { background: var(--bad-bg); border-color: var(--bad-line); color: var(--bad); }
.alert.info { background: var(--info-bg); border-color: var(--info-line); color: var(--info); }
.alert .alert-body { color: var(--text); } .alert strong { color: inherit; }
.toasts { position: fixed; z-index: 90; top: calc(var(--topbar-h) + 10px); right: 14px; display: grid; gap: 10px; width: min(420px, calc(100vw - 28px)); pointer-events: none; }
.toast { pointer-events: auto; display: flex; gap: 12px; align-items: flex-start; padding: 13px 14px 13px 16px; background: var(--surface); border: 1px solid var(--line); border-left: 4px solid var(--info); border-radius: 12px; box-shadow: var(--shadow-3); animation: toast-in .25s ease; font-size: .94rem; }
.toast.success { border-left-color: var(--ok); } .toast.error { border-left-color: var(--bad); } .toast.warn { border-left-color: var(--warn); }
.toast .i { margin-top: 2px; color: var(--info); } .toast.success .i { color: var(--ok); } .toast.error .i { color: var(--bad); } .toast.warn .i { color: var(--warn); }
.toast.out { opacity: 0; transform: translateX(16px); transition: .25s; }
.toast button { margin-left: auto; background: none; border: 0; color: var(--muted); cursor: pointer; padding: 2px; border-radius: 6px; }
@keyframes toast-in { from { opacity: 0; transform: translateY(-8px); } }

/* ---------- progress ---------- */
.progress { height: 10px; background: var(--surface-3); border-radius: 999px; overflow: hidden; }
.progress > i { display: block; height: 100%; width: 0; background: linear-gradient(90deg, var(--brand), rgb(var(--brand-rgb) / .65)); border-radius: inherit; transition: width .4s ease; }
.progress.busy > i { background-size: 32px 32px; background-image: linear-gradient(135deg, rgb(255 255 255 / .22) 25%, transparent 25%, transparent 50%, rgb(255 255 255 / .22) 50%, rgb(255 255 255 / .22) 75%, transparent 75%); animation: stripes 1s linear infinite; }
@keyframes stripes { to { background-position: 32px 0; } }
.meter { display: grid; gap: 8px; }
.meter-top { display: flex; justify-content: space-between; align-items: baseline; gap: 10px; }
.meter-top .big { font-size: 2rem; font-weight: 700; letter-spacing: -.02em; line-height: 1; }
.skeleton { background: linear-gradient(90deg, var(--surface-3) 25%, var(--surface-2) 37%, var(--surface-3) 63%); background-size: 400% 100%; animation: shimmer 1.4s ease infinite; border-radius: 8px; min-height: 14px; }
@keyframes shimmer { 0% { background-position: 100% 50%; } 100% { background-position: 0 50%; } }

/* ---------- tables (become cards on phones) ---------- */
.table-wrap { overflow-x: auto; border: 1px solid var(--line); border-radius: var(--radius); background: var(--surface); box-shadow: var(--shadow-1); }
.table { width: 100%; border-collapse: collapse; font-size: .92rem; }
.table th { text-align: left; font-size: .76rem; text-transform: uppercase; letter-spacing: .05em; color: var(--muted); font-weight: 650; background: var(--surface-2); padding: 11px 16px; border-bottom: 1px solid var(--line); white-space: nowrap; }
.table td { padding: 13px 16px; border-bottom: 1px solid var(--line); vertical-align: middle; }
.table tr:last-child td { border-bottom: 0; }
.table tbody tr:hover td { background: var(--surface-2); }
.table .num { text-align: right; font-variant-numeric: tabular-nums; }
.table .actions { text-align: right; white-space: nowrap; }
@media (max-width: 720px) {
  .table.stackable, .table.stackable tbody, .table.stackable tr, .table.stackable td { display: block; width: 100%; }
  .table.stackable thead { display: none; }
  .table.stackable tr { padding: 12px 14px; border-bottom: 1px solid var(--line); }
  .table.stackable tr:last-child { border-bottom: 0; }
  .table.stackable td { display: flex; justify-content: space-between; gap: 14px; padding: 5px 0; border: 0; text-align: right; }
  .table.stackable td::before { content: attr(data-label); color: var(--muted); font-size: .8rem; font-weight: 600; text-align: left; flex: none; }
  .table.stackable td.actions { justify-content: flex-end; padding-top: 10px; }
  .table.stackable td.actions::before, .table.stackable td[data-label=""]::before { display: none; }
}

/* ---------- empty / misc ---------- */
.empty { text-align: center; padding: 44px 20px; color: var(--muted); display: grid; justify-items: center; gap: 10px; }
.empty .tile-icon { width: 60px; height: 60px; border-radius: 18px; }
.empty h3 { margin: 0; color: var(--text); }
.divider { display: flex; align-items: center; gap: 12px; color: var(--muted); font-size: .82rem; }
.divider::before, .divider::after { content: ""; flex: 1; border-top: 1px solid var(--line); }
.pill-nav { display: flex; gap: 6px; flex-wrap: wrap; }
.tabs { display: flex; gap: 4px; border-bottom: 1px solid var(--line); overflow-x: auto; scrollbar-width: none; }
.tabs a { padding: 11px 14px; color: var(--muted); font-weight: 600; font-size: .93rem; 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-color: var(--brand); }
.kv { display: grid; grid-template-columns: max-content 1fr; gap: 8px 18px; margin: 0; font-size: .94rem; }
.kv dt { color: var(--muted); } .kv dd { margin: 0; min-width: 0; overflow-wrap: anywhere; }
.steps { counter-reset: s; display: grid; gap: 10px; margin: 0; padding: 0; list-style: none; }
.steps li { counter-increment: s; display: grid; grid-template-columns: 28px 1fr; gap: 12px; align-items: start; }
.steps li::before { content: counter(s); width: 28px; height: 28px; border-radius: 50%; background: var(--brand-soft); color: var(--brand); font-weight: 700; font-size: .85rem; display: grid; place-items: center; }
.wizard { display: flex; gap: 6px; margin: 0 0 22px; padding: 0; list-style: none; overflow-x: auto; }
.wizard li { flex: 1 0 auto; min-width: 84px; text-align: center; font-size: .78rem; color: var(--muted); font-weight: 600; padding-top: 12px; border-top: 4px solid var(--line); border-radius: 2px; }
.wizard li.done { border-color: var(--ok); color: var(--ok); } .wizard li.now { border-color: var(--brand); color: var(--text); }
details.disclose { border: 1px solid var(--line); border-radius: var(--radius-sm); background: var(--surface); }
details.disclose > summary { cursor: pointer; padding: 12px 16px; font-weight: 600; list-style: none; display: flex; align-items: center; justify-content: space-between; gap: 10px; }
details.disclose > summary::-webkit-details-marker { display: none; }
details.disclose > summary::after { content: ""; width: 8px; height: 8px; border-right: 2px solid var(--muted); border-bottom: 2px solid var(--muted); transform: rotate(45deg); transition: .15s; margin-right: 4px; }
details.disclose[open] > summary::after { transform: rotate(-135deg); }
details.disclose > .disclose-body { padding: 0 16px 16px; }

/* ---------- app shell ---------- */
.shell { min-height: 100vh; display: grid; grid-template-columns: var(--sidebar-w) minmax(0, 1fr); }
.sidebar {
  position: sticky; top: 0; height: 100vh; overflow-y: auto; background: var(--surface); border-right: 1px solid var(--line);
  display: flex; flex-direction: column; padding: 18px 14px; gap: 18px; z-index: 60;
}
.brand { display: flex; align-items: center; gap: 11px; padding: 4px 8px; color: var(--text); font-weight: 700; font-size: 1.08rem; letter-spacing: -.01em; }
.brand:hover { text-decoration: none; }
.brand-mark { width: 36px; height: 36px; border-radius: 11px; display: grid; place-items: center; background: linear-gradient(135deg, var(--brand), var(--brand-strong)); color: var(--on-brand); box-shadow: 0 4px 12px rgb(var(--brand-rgb) / .35); flex: none; }
.brand img { height: 34px; width: auto; max-width: 200px; object-fit: contain; flex: none; }

/* ---------- owner: logo upload ---------- */
.logo-tiles { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 12px; }
.logo-tile-wrap { margin: 0; display: grid; gap: 6px; }
.logo-tile { display: flex; align-items: center; min-height: 88px; padding: 14px 18px; border-radius: var(--radius-sm); border: 1px solid var(--line); overflow: hidden; }
.logo-tile .brand { padding: 0; color: inherit; max-width: 100%; }
.logo-tile.is-light { background: #fff; color: #0f172a; }
.logo-tile.is-dark { background: #0b1220; color: #fff; border-color: #1f2a44; }
@media (max-width: 520px) { .logo-tiles { grid-template-columns: 1fr; } }
.nav { display: grid; gap: 2px; }
.nav-label { font-size: .72rem; text-transform: uppercase; letter-spacing: .08em; color: var(--muted); font-weight: 700; padding: 14px 12px 6px; }
.nav a { display: flex; align-items: center; gap: 12px; padding: 10px 12px; border-radius: 11px; color: var(--text-2); font-weight: 560; font-size: .94rem; transition: background .12s, color .12s; }
.nav a .i { color: var(--muted); transition: color .12s; }
.nav a:hover { background: var(--surface-3); text-decoration: none; color: var(--text); }
.nav a.on { background: var(--brand-soft); color: var(--brand); font-weight: 650; }
.nav a.on .i { color: var(--brand); }
.nav a .badge { margin-left: auto; }
.nav a.locked { opacity: .6; }
.side-foot { margin-top: auto; display: grid; grid-template-columns: minmax(0, 1fr); gap: 12px; }
.credit-mini { padding: 14px; border-radius: 13px; background: var(--surface-2); border: 1px solid var(--line); display: grid; gap: 9px; }
.credit-mini .row { display: flex; justify-content: space-between; align-items: baseline; font-size: .84rem; color: var(--muted); }
.credit-mini .row b { font-size: 1.15rem; color: var(--text); letter-spacing: -.01em; }
.userchip { display: flex; align-items: center; gap: 11px; padding: 8px; border-radius: 12px; }
.avatar { width: 36px; height: 36px; border-radius: 50%; background: var(--brand-soft); color: var(--brand); display: grid; place-items: center; font-weight: 700; font-size: .9rem; flex: none; }
.userchip .who { min-width: 0; line-height: 1.25; } .userchip .who b { display: block; font-size: .9rem; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; } .userchip .who span { font-size: .78rem; color: var(--muted); }
.main { min-width: 0; display: flex; flex-direction: column; }
.topbar { position: sticky; top: 0; z-index: 50; height: var(--topbar-h); display: flex; align-items: center; gap: 12px; padding: 0 var(--page-pad); background: color-mix(in srgb, var(--bg) 82%, transparent); backdrop-filter: saturate(1.4) blur(14px); -webkit-backdrop-filter: saturate(1.4) blur(14px); border-bottom: 1px solid var(--line); }
.topbar .menu-btn { display: none; }
.topbar .crumb { font-weight: 650; font-size: 1.02rem; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.topbar .spacer { flex: 1; }
.page { width: 100%; max-width: 1180px; margin: 0 auto; padding: clamp(18px, 3vw, 34px) var(--page-pad) 80px; }
.page-narrow { max-width: 760px; }
.page-head { display: flex; flex-wrap: wrap; align-items: flex-end; justify-content: space-between; gap: 14px; margin-bottom: 24px; }
.page-head h1 { margin: 0 0 4px; } .page-head p { margin: 0; color: var(--muted); }
.scrim { display: none; }
@media (max-width: 1020px) {
  .shell { grid-template-columns: minmax(0, 1fr); }
  .sidebar { position: fixed; inset: 0 auto 0 0; width: min(310px, 86vw); transform: translateX(-102%); transition: transform .22s ease; box-shadow: var(--shadow-3); }
  .nav-open .sidebar { transform: none; }
  .scrim { position: fixed; inset: 0; z-index: 55; background: rgb(10 14 23 / .5); backdrop-filter: blur(2px); }
  .nav-open .scrim { display: block; }
  .topbar .menu-btn { display: inline-flex; }
  .nav-open { overflow: hidden; }
}

/* ---------- public site ---------- */
.pub-nav { position: sticky; top: 0; z-index: 50; background: color-mix(in srgb, var(--bg) 85%, transparent); backdrop-filter: saturate(1.4) blur(14px); -webkit-backdrop-filter: saturate(1.4) blur(14px); border-bottom: 1px solid transparent; }
.pub-nav.scrolled { border-color: var(--line); }
.pub-nav .in { max-width: 1180px; margin: 0 auto; height: 68px; padding: 0 var(--page-pad); display: flex; align-items: center; gap: 22px; }
.pub-links { display: flex; gap: 4px; margin-left: 12px; }
.pub-links a { padding: 8px 12px; border-radius: 9px; color: var(--text-2); font-weight: 560; font-size: .94rem; }
.pub-links a:hover { background: var(--surface-3); text-decoration: none; }
.pub-actions { margin-left: auto; display: flex; align-items: center; gap: 8px; }
.pub-menu { display: none; }
.pub-links .only-mobile { display: none; }
.pub-nav .brand { min-width: 0; flex: 0 1 auto; }
.pub-nav .brand span:not(.brand-mark) { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
@media (max-width: 860px) {
  .pub-links { display: none; position: absolute; left: 12px; right: 12px; top: 72px; flex-direction: column; background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: 8px; box-shadow: var(--shadow-3); margin: 0; }
  .pub-links.open { display: flex; }
  .pub-links a { padding: 13px 14px; }
  .pub-menu { display: inline-flex; }
  .pub-actions > a.btn-ghost { display: none; }
  .pub-links .only-mobile:not(.cta) { display: block; }
}
/* On a phone the header keeps the logo, the theme switch and the menu; the sign-in and sign-up links move into the menu. */
@media (max-width: 560px) {
  .pub-nav .in { gap: 10px; }
  .pub-actions > a.btn-primary { display: none; }
  .pub-links .only-mobile.cta { display: block; color: var(--brand); font-weight: 700; }
}
.hero { position: relative; overflow: hidden; padding: clamp(48px, 9vw, 100px) var(--page-pad) clamp(28px, 4vw, 48px); text-align: center; }
.hero::before { content: ""; position: absolute; inset: -20% -10% auto; height: 520px; z-index: -1; background: radial-gradient(60% 60% at 50% 0%, rgb(var(--brand-rgb) / .2), transparent 70%), radial-gradient(40% 50% at 90% 10%, rgb(139 92 246 / .13), transparent 70%); }
.hero .eyebrow { display: inline-flex; align-items: center; gap: 8px; padding: 6px 14px; border-radius: 999px; background: var(--surface); border: 1px solid var(--line); box-shadow: var(--shadow-1); font-size: .86rem; font-weight: 600; color: var(--text-2); margin-bottom: 22px; }
.hero h1 { font-size: clamp(2.2rem, 1.2rem + 4.4vw, 4rem); letter-spacing: -.035em; max-width: 16ch; margin: 0 auto .4em; line-height: 1.06; }
.hero h1 em { font-style: normal; background: linear-gradient(120deg, var(--brand), #8b5cf6); -webkit-background-clip: text; background-clip: text; color: transparent; }
.hero p.lead { font-size: clamp(1.05rem, .95rem + .5vw, 1.25rem); color: var(--muted); max-width: 56ch; margin: 0 auto 28px; }
.section { max-width: 1180px; margin: 0 auto; padding: clamp(40px, 6vw, 84px) var(--page-pad); }
.section-head { text-align: center; max-width: 640px; margin: 0 auto clamp(26px, 4vw, 46px); }
.section-head p { color: var(--muted); font-size: 1.05rem; }
.feature { padding: 24px; display: grid; gap: 12px; align-content: start; }
.feature h3 { margin: 0; } .feature p { margin: 0; color: var(--muted); font-size: .95rem; }
.plan { padding: 28px 24px; display: grid; gap: 16px; align-content: start; position: relative; }
.plan.featured { border-color: var(--brand); box-shadow: 0 0 0 1px var(--brand), var(--shadow-2); }
.plan .ribbon { position: absolute; top: -12px; left: 50%; transform: translateX(-50%); }
.plan .price { font-size: 2.3rem; font-weight: 750; letter-spacing: -.03em; line-height: 1; }
.plan .price small { font-size: .95rem; font-weight: 500; color: var(--muted); letter-spacing: 0; }
.plan ul { list-style: none; padding: 0; margin: 0; display: grid; gap: 10px; font-size: .94rem; }
.plan li { display: flex; gap: 10px; align-items: flex-start; } .plan li .i { color: var(--ok); margin-top: 3px; }
.logos { display: flex; flex-wrap: wrap; justify-content: center; gap: 10px 26px; color: var(--muted); font-weight: 650; font-size: .92rem; }
.pub-foot { border-top: 1px solid var(--line); background: var(--surface); }
.pub-foot .in { max-width: 1180px; margin: 0 auto; padding: 36px var(--page-pad); display: grid; gap: 24px; grid-template-columns: repeat(auto-fit, minmax(min(100%, 200px), 1fr)); }
.pub-foot h4 { font-size: .8rem; text-transform: uppercase; letter-spacing: .07em; color: var(--muted); }
.pub-foot a { display: block; color: var(--text-2); padding: 3px 0; font-size: .94rem; }
.prose { max-width: 760px; margin: 0 auto; } .prose h2 { margin-top: 1.8em; font-size: 1.3rem; } .prose li { margin-bottom: .4em; }
.faq summary { font-weight: 600; }

/* ---------- public: landing page ---------- */
.hero::after { content: ""; position: absolute; inset: 0; z-index: -1; pointer-events: none; background-image: linear-gradient(var(--line) 1px, transparent 1px), linear-gradient(90deg, var(--line) 1px, transparent 1px); background-size: 56px 56px; opacity: .55; -webkit-mask-image: radial-gradient(70% 55% at 50% 0%, #000, transparent 78%); mask-image: radial-gradient(70% 55% at 50% 0%, #000, transparent 78%); }
.hero-cta { justify-content: center; --gap: 12px; }
.hero-points { list-style: none; display: flex; flex-wrap: wrap; justify-content: center; gap: 8px 24px; margin: 24px 0 0; padding: 0; color: var(--muted); font-size: .9rem; }
.hero-points li { display: inline-flex; align-items: center; gap: 7px; }
.hero-points .i { color: var(--ok); }
.showcase { position: relative; max-width: 1020px; margin: clamp(36px, 6vw, 64px) auto 0; text-align: left; }
.showcase::before { content: ""; position: absolute; inset: 10% 8% -8%; z-index: -1; border-radius: 50%; background: rgb(var(--brand-rgb) / .22); filter: blur(64px); }
.win { background: var(--surface); border: 1px solid var(--line); border-radius: 18px; box-shadow: var(--shadow-3); overflow: hidden; }
.win-bar { display: flex; align-items: center; gap: 7px; padding: 12px 16px; border-bottom: 1px solid var(--line); background: var(--surface-2); font-size: .82rem; color: var(--muted); }
.win-bar i { width: 11px; height: 11px; border-radius: 50%; background: var(--line-strong); flex: none; }
.win-bar span { margin-left: 10px; font-weight: 600; flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.win-body { display: grid; grid-template-columns: minmax(0, 1.65fr) minmax(0, 1fr); }
.win-list { padding: 18px; display: grid; gap: 12px; align-content: start; }
.win-list .q { box-shadow: none; }
.win-side { padding: 22px; border-left: 1px solid var(--line); background: var(--surface-2); display: grid; gap: 16px; align-content: start; }
.check-head { display: flex; gap: 12px; align-items: center; }
.check-head b { display: block; line-height: 1.25; }
.check-head .s { color: var(--muted); font-size: .84rem; }
.check-list { list-style: none; margin: 0; padding: 0; display: grid; gap: 10px; font-size: .9rem; }
.check-list li { display: flex; gap: 9px; align-items: flex-start; }
.check-list .i { color: var(--ok); margin-top: 3px; flex: none; }
@media (max-width: 760px) { .win-body { grid-template-columns: minmax(0, 1fr); } .win-side { border-left: 0; border-top: 1px solid var(--line); } .win-list .q:nth-child(n+2) { display: none; } }

.formats { padding-top: clamp(24px, 3vw, 40px); padding-bottom: 0; text-align: center; }
.formats p { margin: 0 0 16px; color: var(--muted); font-size: .8rem; font-weight: 700; text-transform: uppercase; letter-spacing: .09em; }
.format-row { list-style: none; margin: 0; padding: 0; display: flex; flex-wrap: wrap; justify-content: center; gap: 10px; }
.format-row li { display: inline-flex; align-items: center; gap: 9px; padding: 9px 16px; border: 1px solid var(--line); border-radius: 999px; background: var(--surface); box-shadow: var(--shadow-1); font-weight: 650; font-size: .92rem; }
.format-row .i { color: var(--brand); }
.format-row small { color: var(--muted); font-weight: 500; font-size: .84rem; }

.feature-grid { display: grid; gap: 18px; grid-template-columns: repeat(3, minmax(0, 1fr)); }
@media (max-width: 960px) { .feature-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); } }
@media (max-width: 620px) { .feature-grid { grid-template-columns: minmax(0, 1fr); } }
.feature { padding: 26px; gap: 14px; transition: transform .18s, box-shadow .18s, border-color .18s; }
.feature:hover { transform: translateY(-3px); box-shadow: var(--shadow-2); border-color: var(--brand-line); }
.feature .tile-icon { width: 50px; height: 50px; border-radius: 14px; }

.band { background: var(--surface); border-block: 1px solid var(--line); }
.duo { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); gap: clamp(28px, 5vw, 72px); align-items: center; }
@media (max-width: 880px) { .duo { grid-template-columns: minmax(0, 1fr); } }
.duo h2 { font-size: clamp(1.5rem, 1.1rem + 1.6vw, 2.15rem); letter-spacing: -.028em; }
.kicker { display: inline-block; margin-bottom: 12px; color: var(--brand); font-size: .8rem; font-weight: 700; text-transform: uppercase; letter-spacing: .09em; }
.tick-list { list-style: none; margin: 20px 0 26px; padding: 0; display: grid; gap: 14px; }
.tick-list li { display: flex; gap: 12px; align-items: flex-start; }
.tick-list .i { color: var(--ok); margin-top: 2px; flex: none; }
.review-mock { box-shadow: var(--shadow-2); }

.flow { display: grid; gap: 28px; grid-template-columns: repeat(3, minmax(0, 1fr)); }
@media (max-width: 860px) { .flow { grid-template-columns: minmax(0, 1fr); gap: 24px; } }
.flow-step { position: relative; display: grid; gap: 8px; align-content: start; }
.flow-step .n { width: 48px; height: 48px; border-radius: 15px; display: grid; place-items: center; background: linear-gradient(135deg, var(--brand), var(--brand-strong)); color: var(--on-brand); font-weight: 700; font-size: 1.15rem; box-shadow: 0 8px 18px rgb(var(--brand-rgb) / .3); }
.flow-step h3 { margin: 8px 0 0; }
.flow-step p { margin: 0; color: var(--muted); }
@media (min-width: 861px) { .flow-step:not(:last-child)::after { content: ""; position: absolute; top: 24px; left: 64px; right: -16px; border-top: 2px dashed var(--line-strong); } }

.cta-band { position: relative; overflow: hidden; border-radius: 24px; padding: clamp(36px, 6vw, 76px) clamp(20px, 4vw, 48px); text-align: center; color: #fff; background: linear-gradient(135deg, var(--brand-strong), var(--brand) 55%, #7c5cf0); box-shadow: var(--shadow-3); }
.cta-band::before { content: ""; position: absolute; width: 440px; height: 440px; border-radius: 50%; right: -150px; top: -190px; background: rgb(255 255 255 / .12); }
.cta-band::after { content: ""; position: absolute; width: 300px; height: 300px; border-radius: 50%; left: -110px; bottom: -150px; background: rgb(255 255 255 / .08); }
.cta-band > * { position: relative; z-index: 1; }
.cta-band h2 { color: #fff; font-size: clamp(1.65rem, 1.1rem + 2vw, 2.5rem); letter-spacing: -.03em; }
.cta-band p { color: rgb(255 255 255 / .88); max-width: 50ch; margin: 0 auto 26px; font-size: 1.05rem; }
.btn-invert { --bg-btn: #fff; --b: #fff; --fg: #0f172a; box-shadow: 0 8px 22px rgb(0 0 0 / .18); }
.btn-invert:hover { background: #eef2ff; border-color: #eef2ff; }

/* ---------- auth (split screen) ---------- */
.auth { min-height: 100vh; display: grid; grid-template-columns: minmax(0, 1fr); }
@media (min-width: 960px) { .auth { grid-template-columns: minmax(0, 1.05fr) minmax(0, .95fr); } }
.auth-side { display: none; position: relative; overflow: hidden; color: #fff; padding: 48px; background: linear-gradient(150deg, var(--brand-strong), var(--brand) 55%, #7c5cf0); }
@media (min-width: 960px) { .auth-side { display: flex; flex-direction: column; justify-content: space-between; } }
.auth-side::after { content: ""; position: absolute; width: 520px; height: 520px; border-radius: 50%; right: -180px; bottom: -200px; background: rgb(255 255 255 / .1); }
.auth-side::before { content: ""; position: absolute; width: 300px; height: 300px; border-radius: 50%; left: -100px; top: 30%; background: rgb(255 255 255 / .07); }
.auth-side > * { position: relative; z-index: 1; }
.auth-side .brand { color: #fff; } .auth-side .brand-mark { background: rgb(255 255 255 / .2); box-shadow: none; }
.auth-side h2 { color: #fff; font-size: 2rem; letter-spacing: -.025em; max-width: 18ch; }
.auth-side ul { list-style: none; padding: 0; margin: 22px 0 0; display: grid; gap: 14px; }
.auth-side li { display: flex; gap: 12px; align-items: flex-start; opacity: .95; }
.auth-main { display: grid; place-items: center; padding: 28px var(--page-pad); }
.auth-card { width: 100%; max-width: 440px; }
.auth-card h1 { font-size: 1.75rem; margin-bottom: 6px; }
.auth-mobile-brand { display: flex; margin-bottom: 26px; } @media (min-width: 960px) { .auth-mobile-brand { display: none; } }

/* ---------- question studio ---------- */
.type-grid { display: grid; gap: 10px; grid-template-columns: repeat(auto-fit, minmax(min(100%, 230px), 1fr)); }
.type-row { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 12px 14px; border: 1px solid var(--line); border-radius: 12px; background: var(--surface); transition: border-color .15s, background .15s; }
.type-row.on { border-color: var(--brand-line); background: var(--brand-soft); }
.type-row .t { display: grid; line-height: 1.25; } .type-row .t b { font-size: .95rem; } .type-row .t span { color: var(--muted); font-size: .8rem; }
.cost-bar { position: sticky; bottom: 0; z-index: 30; margin: 24px calc(var(--page-pad) * -1) 0; padding: 14px var(--page-pad); background: color-mix(in srgb, var(--surface) 92%, transparent); backdrop-filter: blur(12px); -webkit-backdrop-filter: blur(12px); border-top: 1px solid var(--line); display: flex; flex-wrap: wrap; align-items: center; gap: 12px 20px; justify-content: space-between; box-shadow: 0 -8px 24px rgb(16 24 40 / .06); }
.q-list { display: grid; gap: 12px; }
.q { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); box-shadow: var(--shadow-1); transition: border-color .15s, box-shadow .15s, opacity .15s; overflow: hidden; }
.q.is-off { opacity: .6; }
.q.is-invalid { border-color: var(--bad-line); }
.q:focus-within { border-color: var(--brand-line); }
.q-head { display: flex; align-items: flex-start; gap: 12px; padding: 14px 16px; }
.q-num { color: var(--muted); font-variant-numeric: tabular-nums; font-weight: 650; font-size: .85rem; min-width: 26px; padding-top: 2px; }
.q-main { flex: 1; min-width: 0; }
.q-stem { font-weight: 560; margin: 0 0 8px; overflow-wrap: anywhere; }
.q-opts { list-style: none; margin: 0; padding: 0; display: grid; gap: 6px; }
.q-opts li { display: flex; gap: 10px; padding: 7px 11px; border-radius: 9px; background: var(--surface-2); border: 1px solid transparent; font-size: .93rem; overflow-wrap: anywhere; }
.q-opts li b { color: var(--muted); font-weight: 650; min-width: 18px; }
.q-opts li.right { background: var(--ok-bg); border-color: var(--ok-line); } .q-opts li.right b { color: var(--ok); }
.q-answer { font-size: .9rem; color: var(--text-2); margin-top: 6px; }
.q-expl { font-size: .84rem; color: var(--muted); margin-top: 6px; }
.q-meta { display: flex; flex-wrap: wrap; gap: 6px; align-items: center; margin-top: 10px; }
.q-tools { display: flex; gap: 2px; flex: none; }
.q-edit { border-top: 1px solid var(--line); background: var(--surface-2); padding: 16px; display: grid; gap: 14px; }
.q-errors { margin: 0; padding: 0; list-style: none; display: grid; gap: 6px; }
.q-errors li { display: flex; gap: 8px; color: var(--bad); font-size: .88rem; }
.q-notes li { color: var(--info); }
.passage { white-space: pre-wrap; background: var(--surface-2); border-left: 3px solid var(--brand); padding: 12px 14px; border-radius: 0 10px 10px 0; font-size: .94rem; margin-bottom: 10px; max-height: 260px; overflow: auto; }
.q-sub { border-top: 1px dashed var(--line); padding: 12px 0 0; margin-top: 12px; }
.gen-panel { text-align: center; padding: 38px 20px; display: grid; gap: 18px; justify-items: center; }
.gen-panel .progress { width: min(460px, 100%); height: 12px; }
.spinner { width: 44px; height: 44px; border-radius: 50%; border: 4px solid var(--brand-soft); border-top-color: var(--brand); animation: spin .8s linear infinite; }
.filters { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; }
.chip { border: 1px solid var(--line-strong); background: var(--surface); border-radius: 999px; padding: 6px 13px; font: 600 .84rem var(--font); color: var(--text-2); cursor: pointer; }
.chip:hover { border-color: var(--brand-line); } .chip.on { background: var(--brand); border-color: var(--brand); color: var(--on-brand); }
.q-pick { padding-top: 2px; }
.q-sub-edit { border: 1px solid var(--line); border-radius: var(--radius-sm); background: var(--surface); padding: 14px; display: grid; gap: 12px; margin-top: 12px; }
.q-subs { display: grid; }
.q-feedback:empty { display: none; }
.q-feedback { padding: 10px 12px; border-radius: var(--radius-sm); background: var(--surface); border: 1px dashed var(--line-strong); }
.qf { display: grid; gap: 14px; }
.qf .f-options, .qf .f-tf, .qf .f-text { display: none; }
.qf[data-qtype="mcq"] .f-options { display: grid; gap: 8px; }
.qf[data-qtype="tf"] .f-tf { display: grid; }
.qf[data-qtype="short"] .f-text, .qf[data-qtype="numerical"] .f-text { display: grid; }
.qf:not([data-qtype="numerical"]) .f-num-hint { display: none; }
.opt-list { display: grid; gap: 8px; }
.opt-row { display: grid; grid-template-columns: auto 22px minmax(0, 1fr) auto; gap: 8px; align-items: center; }
.opt-letter { font-weight: 700; color: var(--muted); text-align: center; }
.opt-row:has(input[type="radio"]:checked) .opt-letter { color: var(--ok); }
.opt-row:has(input[type="radio"]:checked) .input { border-color: var(--ok-line); background: var(--ok-bg); }
.credential-sheet { font-family: var(--mono); }
@media (max-width: 600px) {
  .q-head { flex-wrap: wrap; } .q-tools { width: 100%; justify-content: flex-end; border-top: 1px solid var(--line); padding-top: 8px; }
  .q-num { min-width: 0; }
}

/* ---------- modal ---------- */
.modal { position: fixed; inset: 0; z-index: 95; display: grid; place-items: center; padding: 16px; background: rgb(10 14 23 / .55); backdrop-filter: blur(3px); animation: fade .15s ease; }
.modal-box { background: var(--surface); border-radius: 18px; box-shadow: var(--shadow-3); width: min(480px, 100%); padding: 24px; display: grid; gap: 16px; animation: pop .18s ease; max-height: 90vh; overflow: auto; }
@keyframes fade { from { opacity: 0; } } @keyframes pop { from { opacity: 0; transform: translateY(10px) scale(.98); } }

/* ---------- print (credentials sheet, answer key) ---------- */
@media print {
  .sidebar, .topbar, .scrim, .toasts, .no-print, .cost-bar, .pub-nav, .pub-foot { display: none !important; }
  .shell { display: block; } body { background: #fff; color: #000; } .page { padding: 0; max-width: none; }
  .card, .table-wrap { box-shadow: none; border-color: #bbb; } a { color: inherit; }
}
@media (prefers-reduced-motion: reduce) { *, *::before, *::after { animation-duration: .001ms !important; animation-iteration-count: 1 !important; transition-duration: .001ms !important; scroll-behavior: auto !important; } }
@media (max-width: 480px) { .btn-lg { width: 100%; } .page-head .btn { width: auto; } .stat .v { font-size: 1.6rem; } }

/* ---------- builders (subjects, courses, users): suggestion forms and the editable review table ---------- */
.chips { display: flex; flex-wrap: wrap; gap: 6px; }
.chips .chip { padding: 4px 11px; font-size: .8rem; }
.linklike { background: none; border: 0; padding: 0; color: var(--brand); font: inherit; cursor: pointer; text-decoration: underline; }
.builder-table td { vertical-align: top; }
.builder-table .sel, .builder-table .idx { width: 1%; white-space: nowrap; }
.builder-table .idx { color: var(--muted); font-variant-numeric: tabular-nums; padding-top: 18px; }
.builder-table .sel { padding-top: 17px; }
.builder-table input[type=checkbox] { width: 18px; height: 18px; accent-color: var(--brand); cursor: pointer; }
.builder-table .input-sm, .builder-table .select.input-sm, .builder-table .textarea.input-sm { width: 100%; min-width: 120px; }
.builder-table .textarea.input-sm { min-height: 64px; resize: vertical; }
.builder-subjects td[data-cell=name] { min-width: 210px; } .builder-subjects td[data-cell=code] { min-width: 110px; } .builder-subjects td[data-cell=classes] { min-width: 230px; } .builder-subjects td[data-cell=teachers] { min-width: 200px; }
.builder-courses td[data-cell=code] { min-width: 130px; } .builder-courses td[data-cell=name] { min-width: 220px; } .builder-courses td[data-cell=description] { min-width: 320px; } .builder-courses td[data-cell=status] { min-width: 130px; }
.builder-users td[data-cell] { min-width: 130px; } .builder-users td[data-cell=email] { min-width: 230px; } .builder-users td[data-cell=password] { min-width: 150px; } .builder-users td[data-cell=date_of_birth] { min-width: 140px; }
.builder-table tr[data-row]:has([data-f=selected]:not(:checked)) td:not(.sel):not(.actions) { opacity: .5; }
.has-error { border-color: var(--bad) !important; box-shadow: 0 0 0 3px var(--bad-bg); }
.cell-error { color: var(--bad); font-size: .78rem; margin-top: 4px; line-height: 1.35; }
.problem-list { margin: 8px 0 0; padding-left: 18px; display: grid; gap: 3px; }
.problem-list a { font-weight: 600; }
@media (max-width: 720px) {
  .builder-table td[data-cell] { flex-direction: column; align-items: stretch; text-align: left; gap: 4px; min-width: 0 !important; }
  .builder-table td.sel, .builder-table td.idx { display: inline-flex; width: auto; padding: 0 12px 6px 0; }
  .builder-table tr[data-row] { position: relative; }
  .builder-table td.actions { position: absolute; top: 8px; right: 8px; padding: 0; width: auto; }
  .builder-table td.sel::before, .builder-table td.idx::before { margin-right: 8px; }
}

/* ---------- Question Studio: paste your own questions ---------- */
.code-sample { background: var(--surface-2); border: 1px solid var(--line); border-radius: var(--radius-sm); padding: 14px 16px; font-size: .86rem; line-height: 1.6; color: var(--text-2); }
.import-summary { border: 1px solid var(--line); background: var(--surface-2); border-radius: var(--radius-sm); padding: 14px 16px; display: grid; gap: 10px; }
.import-summary .head { display: flex; flex-wrap: wrap; gap: 8px 10px; align-items: center; }
.import-summary .head b { font-size: 1rem; }
.import-summary ul { margin: 0; padding-left: 18px; display: grid; gap: 4px; font-size: .88rem; color: var(--text-2); }
.import-summary .bad-list { color: var(--text); }
.import-summary .types { display: flex; flex-wrap: wrap; gap: 6px; }
.import-summary.is-loading { opacity: .6; }

/* ---------- sign out, account menu and the first-visit tour ---------- */
.btn-block { width: 100%; }
.signout { gap: 6px; flex: none; --fg: var(--text-2); }
.signout:hover { --fg: var(--bad); border-color: var(--bad-line); background: var(--bad-bg); }
/* The credit meter and the person's row stay in view at the bottom of the menu, however short the window is. */
.side-foot { position: sticky; bottom: -14px; z-index: 1; background: var(--surface); padding: 10px 0 14px; margin-bottom: -14px; box-shadow: 0 -10px 12px -10px rgb(16 24 40 / .12); }
.link-btn { background: none; border: 0; font: inherit; color: inherit; padding: 13px 14px; width: 100%; text-align: left; border-radius: 9px; cursor: pointer; }
.link-btn:hover { background: var(--surface-3); }
.pub-links form.only-mobile { margin: 0; }

.acct { position: relative; }
.acct-btn { display: inline-flex; align-items: center; gap: 9px; min-height: 42px; padding: 3px 10px 3px 4px; border-radius: 999px; border: 1px solid var(--line); background: var(--surface); color: var(--text); font: inherit; font-weight: 600; font-size: .9rem; cursor: pointer; transition: border-color .15s, background .15s; }
.acct-btn:hover, .acct-btn[aria-expanded="true"] { border-color: var(--brand-line); background: var(--surface-2); }
.acct-btn .avatar { width: 32px; height: 32px; font-size: .8rem; }
.acct-btn .i { color: var(--muted); }
.acct-menu { position: absolute; right: 0; top: calc(100% + 8px); z-index: 70; width: min(280px, calc(100vw - 24px)); background: var(--surface); border: 1px solid var(--line); border-radius: 16px; box-shadow: var(--shadow-3); padding: 8px; display: grid; gap: 2px; animation: pop .14s ease; }
.acct-menu[hidden] { display: none; }
.acct-head { display: grid; gap: 2px; padding: 10px 12px 12px; line-height: 1.3; justify-items: start; }
.acct-head b { max-width: 100%; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.acct-head span:not(.badge) { color: var(--muted); font-size: .84rem; max-width: 100%; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.acct-head .badge { margin-top: 6px; }
.acct-item { display: flex; align-items: center; gap: 12px; width: 100%; padding: 10px 12px; border: 0; border-radius: 10px; background: none; color: var(--text); font: inherit; font-size: .93rem; font-weight: 560; text-align: left; text-decoration: none; cursor: pointer; }
.acct-item .i { color: var(--muted); }
.acct-item:hover, .acct-item:focus-visible { background: var(--surface-3); text-decoration: none; }
.acct-sep { height: 1px; background: var(--line); margin: 6px 4px; }
.acct-out, .acct-out .i { color: var(--bad); }
.acct-out:hover, .acct-out:focus-visible { background: var(--bad-bg); }
@media (max-width: 720px) { .acct-name { display: none; } .acct-btn { padding-right: 8px; } }
@media (max-width: 860px) { .pub-actions > .pub-signout { display: none; } }

.tour { position: fixed; inset: 0; z-index: 96; }
.tour-hole { position: fixed; border-radius: 14px; pointer-events: none; box-shadow: 0 0 0 9999px rgb(10 14 23 / .64), 0 0 0 3px rgb(var(--brand-rgb) / .95); transition: left .24s ease, top .24s ease, width .24s ease, height .24s ease; }
.tour-hole.is-none { left: 50%; top: 50%; width: 0; height: 0; box-shadow: 0 0 0 9999px rgb(10 14 23 / .64); }
.tour-card { position: fixed; z-index: 1; width: min(360px, calc(100vw - 24px)); box-sizing: border-box; background: var(--surface); color: var(--text); border: 1px solid var(--line); border-radius: 18px; box-shadow: var(--shadow-3); padding: 20px; visibility: hidden; animation: pop .18s ease; }
.tour-body { display: grid; gap: 12px; }
.tour-step { font-size: .76rem; font-weight: 700; letter-spacing: .07em; text-transform: uppercase; color: var(--brand); }
.tour-card h3 { margin: 0; font-size: 1.18rem; letter-spacing: -.01em; }
.tour-card p { margin: 0; color: var(--text-2); line-height: 1.55; }
.tour-dots { display: flex; gap: 6px; align-items: center; }
.tour-dots i { width: 8px; height: 8px; border-radius: 99px; background: var(--line-strong); transition: width .2s, background .2s; }
.tour-dots i.on { width: 22px; background: var(--brand); }
.tour-actions { display: flex; align-items: center; justify-content: space-between; gap: 8px; flex-wrap: wrap; margin-top: 2px; }
.tour-nav { display: inline-flex; gap: 8px; margin-left: auto; }
@media print { .tour, .acct { display: none !important; } }
