:root {
  color-scheme: light;
  --bg: #f7f8f7; --surface: #ffffff; --surface-2: #f1f4f2; --sidebar: #ffffff;
  --border: #e2e7e4; --border-strong: #cbd3ce;
  --text: #0f1512; --text-2: #34403a; --muted: #5f6b65;
  --accent: #047857; --accent-hover: #065f46; --accent-soft: #e3f6ee; --accent-ink: #ffffff;
  --grad: linear-gradient(135deg, #059669 0%, #10b981 100%);
  --hl-bg: #a7f3d0; --hl-ink: #053d2c; --accent-rgb: 4, 120, 87;
  --ok: #157f4a; --ok-soft: #e5f5ec; --warn: #9a5b00; --warn-soft: #fdf1dc; --danger: #c22a3b; --danger-soft: #fdebed;
  --info-soft: #e8f1fd; --info: #1f5fae;
  --radius: 12px; --radius-sm: 8px;
  --shadow: 0 1px 2px rgba(16, 24, 40, .04), 0 1px 3px rgba(16, 24, 40, .06);
  --shadow-lg: 0 12px 32px rgba(16, 24, 40, .14);
  --font: "Inter", ui-sans-serif, system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
}
html[data-theme=dark] {
  color-scheme: dark;
  --bg: #09090b; --surface: #111113; --surface-2: #18181b; --sidebar: rgba(9, 9, 11, .86);
  --border: #232327; --border-strong: #34343b;
  --text: #f4f4f5; --text-2: #d4d4d8; --muted: #9b9ba5;
  --accent: #34d399; --accent-hover: #6ee7b7; --accent-soft: rgba(var(--accent-rgb), .12); --accent-ink: #03140d;
  --grad: linear-gradient(135deg, #10b981 0%, #34d399 100%);
  --hl-bg: #34d399; --hl-ink: #03140d; --accent-rgb: 52, 211, 153;
  --ok: #4ade9a; --ok-soft: rgba(74, 222, 154, .12); --warn: #fbbf5a; --warn-soft: rgba(251, 191, 90, .12); --danger: #ff8a98; --danger-soft: rgba(255, 138, 152, .12);
  --info-soft: rgba(96, 165, 250, .13); --info: #93c5fd;
  --shadow: 0 1px 0 rgba(255, 255, 255, .03) inset, 0 1px 2px rgba(0, 0, 0, .4);
  --shadow-lg: 0 20px 48px rgba(0, 0, 0, .6), 0 0 0 1px rgba(var(--accent-rgb), .14);
}
html[data-theme=dark] body {
  background:
    radial-gradient(1000px 520px at 50% -18%, rgba(var(--accent-rgb), .13), transparent 60%),
    radial-gradient(900px 520px at -15% 110%, rgba(59, 91, 219, .10), transparent 60%),
    var(--bg);
  background-attachment: fixed;
}
html[data-theme=dark] aside#sidebar, html[data-theme=dark] .mobile-bar { backdrop-filter: blur(14px); -webkit-backdrop-filter: blur(14px); }
html[data-theme=dark] .btn.primary, html[data-theme=dark] .seg.on { background: var(--grad); border-color: transparent; color: var(--accent-ink); font-weight: 700; }
html[data-theme=dark] .btn.primary:hover { filter: brightness(1.1); background: var(--grad); }
html[data-theme=dark] .mark { background: var(--grad); color: var(--accent-ink); box-shadow: 0 6px 20px rgba(var(--accent-rgb), .35); }
html[data-theme=dark] .card, html[data-theme=dark] .stat, html[data-theme=dark] .iv-card, html[data-theme=dark] .welcome { background: linear-gradient(180deg, rgba(255, 255, 255, .025), transparent 40%), var(--surface); }
html[data-theme=dark] .focus-card { background: radial-gradient(640px 240px at 0% 0%, rgba(var(--accent-rgb), .18), transparent 70%), var(--surface); border-color: rgba(var(--accent-rgb), .28); }
html[data-theme=dark] .nav-link.active { box-shadow: inset 2px 0 0 var(--accent); }
html[data-theme=dark] progress::-webkit-progress-value { background: var(--grad); }
html[data-theme=dark] progress::-moz-progress-bar { background: var(--grad); }
html[data-theme=dark] .big-number, html[data-theme=dark] .stat strong { background: linear-gradient(135deg, #fff, color-mix(in srgb, var(--accent) 60%, #fff)); -webkit-background-clip: text; background-clip: text; color: transparent; }

/* ---------- header theme toggle ---------- */
.topbar { display: flex; justify-content: space-between; align-items: center; gap: 12px; margin: -12px 0 20px; min-height: 40px; }
.topbar-title { font-size: 13px; font-weight: 600; color: var(--muted); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.theme-toggle { display: inline-grid; place-items: center; width: 40px; height: 40px; flex: none; border-radius: 999px; border: 1px solid var(--border-strong); background: var(--surface); color: var(--text); cursor: pointer; transition: transform .2s, border-color .15s, box-shadow .15s; }
.theme-toggle:hover { border-color: var(--accent); box-shadow: 0 0 0 4px var(--accent-soft); }
.theme-toggle:active { transform: scale(.94); }
.theme-toggle svg { width: 18px; height: 18px; fill: none; stroke: currentColor; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; }
.theme-toggle .i-sun { display: none; }
html[data-theme=dark] .theme-toggle .i-sun { display: block; color: #fcd34d; }
html[data-theme=dark] .theme-toggle .i-moon { display: none; }
.mobile-bar .theme-toggle { margin-left: auto; width: 36px; height: 36px; }
* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0; background: var(--bg); color: var(--text); font: 15px/1.55 var(--font);
  display: grid; grid-template-columns: 264px minmax(0, 1fr); min-height: 100vh; -webkit-font-smoothing: antialiased;
}
@media (prefers-reduced-motion: reduce) { * { transition: none !important; animation: none !important; scroll-behavior: auto !important; } }
h1, h2, h3 { color: var(--text); margin: 0; letter-spacing: -.01em; }
h2 { font-size: 17px; font-weight: 650; }
h3 { font-size: 15px; font-weight: 650; }
p { margin: 0; }
a { color: var(--accent); }
[hidden] { display: none !important; }
.skip-link { position: absolute; left: -999px; top: 8px; z-index: 50; background: var(--accent); color: var(--accent-ink); padding: 8px 14px; border-radius: 8px; }
.skip-link:focus { left: 8px; }
:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }

/* ---------- sidebar ---------- */
aside#sidebar {
  position: sticky; top: 0; height: 100vh; overflow-y: auto; background: var(--sidebar);
  border-right: 1px solid var(--border); padding: 20px 14px; display: flex; flex-direction: column; gap: 20px;
}
.brand { display: flex; align-items: center; gap: 10px; text-decoration: none; color: var(--text); padding: 2px 8px; }
.brand-text { display: flex; flex-direction: column; font-size: 15px; line-height: 1.15; font-weight: 500; }
.brand-text b { font-weight: 700; }
.mark { display: grid; place-items: center; width: 36px; height: 36px; border-radius: 10px; background: var(--accent); color: var(--accent-ink); font-weight: 800; font-size: 13px; flex: none; }
.nav-group { display: flex; flex-direction: column; gap: 2px; }
.nav-caption { display: flex; justify-content: space-between; align-items: center; font-size: 12px; font-weight: 600; color: var(--muted); padding: 0 10px 6px; min-height: 28px; }
.nav-caption span { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.nav-link {
  display: flex; align-items: center; gap: 10px; padding: 8px 10px; border-radius: var(--radius-sm); color: var(--text-2);
  text-decoration: none; font-size: 14px; font-weight: 500; cursor: pointer; border: 0; background: none; width: 100%; text-align: left; font-family: inherit;
}
.nav-link svg { width: 18px; height: 18px; flex: none; fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; opacity: .8; }
.nav-link:hover { background: var(--surface-2); color: var(--text); }
.nav-link.active { background: var(--accent-soft); color: var(--accent); font-weight: 600; }
.nav-link.active svg { opacity: 1; }
.interview-list { display: flex; flex-direction: column; gap: 2px; }
.interview-list a { display: flex; flex-direction: column; padding: 8px 10px; border-radius: var(--radius-sm); text-decoration: none; color: var(--text-2); border-left: 3px solid transparent; }
.interview-list a:hover { background: var(--surface-2); }
.interview-list a.active { background: var(--surface-2); border-left-color: var(--accent); }
.iv-name { font-weight: 600; font-size: 14px; color: var(--text); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.iv-role { font-size: 12px; color: var(--muted); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.nav-empty { font-size: 13px; color: var(--muted); padding: 6px 10px; }
.nav-bottom { margin-top: auto; border-top: 1px solid var(--border); padding-top: 12px; }
.mobile-bar, .scrim { display: none; }

/* ---------- main ---------- */
main { padding: 32px clamp(16px, 4vw, 48px) 64px; max-width: 1280px; width: 100%; min-width: 0; margin: 0 auto; outline: none; }
main:focus, main:focus-visible { outline: none; }
.setting-row { display: flex; justify-content: space-between; align-items: center; gap: 16px; flex-wrap: wrap; }
.settings-note { padding: 0 4px; }
.page { display: flex; flex-direction: column; gap: 20px; }
.page-head { display: flex; justify-content: space-between; align-items: flex-end; gap: 16px; flex-wrap: wrap; }
.eyebrow { font-size: 13px; font-weight: 600; color: var(--muted); margin-bottom: 4px; }
.eyebrow.accent { color: var(--accent); }
.page-title { font-size: clamp(26px, 3vw, 32px); font-weight: 700; letter-spacing: -.02em; line-height: 1.2; overflow-wrap: anywhere; }
.lead { color: var(--text-2); font-size: 15px; max-width: 680px; margin-top: 6px; }
.muted { color: var(--muted); font-size: 13px; }
.small-text { font-size: 12px; }
.mono { font-variant-numeric: tabular-nums; }
.body-text { color: var(--text-2); white-space: pre-wrap; overflow-wrap: anywhere; }
.row { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
.row.space { justify-content: space-between; }
.section-intro { display: flex; justify-content: space-between; align-items: center; gap: 16px; flex-wrap: wrap; }
.section-intro .lead { margin: 0; }

.interview-header { display: flex; justify-content: space-between; align-items: flex-start; gap: 16px; flex-wrap: wrap; margin-bottom: 24px; padding-bottom: 20px; border-bottom: 1px solid var(--border); }
.meta-row { display: flex; align-items: center; gap: 8px 14px; flex-wrap: wrap; margin-top: 8px; color: var(--text-2); font-size: 14px; }
.meta + .meta:not(:empty)::before { content: "·"; margin-right: 14px; color: var(--muted); }
.meta:empty { display: none; }
.pill { display: inline-flex; align-items: center; padding: 3px 10px; border-radius: 999px; font-size: 12px; font-weight: 600; background: var(--accent-soft); color: var(--accent); white-space: nowrap; }
.pill:empty { display: none; }
.pill-wrap { display: inline-flex; }
.pill-action { border: 1px dashed var(--accent); cursor: pointer; font-family: inherit; }
.pill-action:hover { background: var(--accent); color: var(--accent-ink); }

/* ---------- buttons & inputs ---------- */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 6px; font: 600 14px/1 var(--font);
  padding: 10px 16px; min-height: 40px; border-radius: var(--radius-sm); border: 1px solid var(--border-strong);
  background: var(--surface); color: var(--text); cursor: pointer; text-decoration: none; white-space: nowrap; transition: background .15s, border-color .15s;
}
.btn:hover { background: var(--surface-2); }
.btn.primary { background: var(--accent); border-color: var(--accent); color: var(--accent-ink); }
.btn.primary:hover { background: var(--accent-hover); border-color: var(--accent-hover); }
.btn.ghost { border-color: transparent; background: transparent; color: var(--accent); }
.btn.ghost:hover { background: var(--accent-soft); }
.btn.danger { color: var(--danger); border-color: var(--danger); background: transparent; }
.btn.danger:hover { background: var(--danger-soft); }
.btn.small { min-height: 32px; padding: 6px 12px; font-size: 13px; }
.btn.large { min-height: 46px; padding: 12px 22px; font-size: 15px; }
.btn:disabled { opacity: .5; cursor: not-allowed; }
.icon-btn { display: inline-grid; place-items: center; width: 36px; height: 36px; border-radius: var(--radius-sm); border: 1px solid var(--border); background: var(--surface); color: var(--text); cursor: pointer; font-size: 20px; line-height: 1; }
.icon-btn:hover { background: var(--surface-2); }
.icon-btn.small { width: 26px; height: 26px; font-size: 16px; }
input, textarea, select {
  font: 14px/1.4 var(--font); color: var(--text); background: var(--surface); border: 1px solid var(--border-strong);
  border-radius: var(--radius-sm); padding: 9px 12px; min-height: 40px; max-width: 100%;
}
input:focus, textarea:focus, select:focus { outline: none; border-color: var(--accent); box-shadow: 0 0 0 3px var(--accent-soft); }
textarea { width: 100%; min-height: 110px; resize: vertical; line-height: 1.55; }
.field { display: flex; flex-direction: column; gap: 6px; margin-bottom: 16px; }
.field-name, .field-label { font-size: 13px; font-weight: 600; color: var(--text-2); }
.field-label { display: block; margin: 18px 0 8px; }
.field-hint { font-size: 12px; color: var(--muted); }
.form-row { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 12px; margin: 18px 0 8px; }
.form-error { color: var(--danger); background: var(--danger-soft); padding: 10px 12px; border-radius: var(--radius-sm); font-size: 13px; margin-top: 10px; }

/* ---------- cards ---------- */
.card { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); padding: 22px; box-shadow: var(--shadow); min-width: 0; }
.card > h2 + p, .card > h2 + .muted { margin-top: 4px; }
.card > h2 { margin-bottom: 4px; }
.card.flush { padding: 0; overflow: hidden; }
.card-head { display: flex; justify-content: space-between; align-items: flex-start; gap: 12px; margin-bottom: 16px; flex-wrap: wrap; }
.card-head p { margin-top: 4px; }
.badge { display: inline-flex; align-items: center; padding: 2px 8px; border-radius: 6px; font-size: 12px; font-weight: 600; background: var(--surface-2); color: var(--text-2); white-space: nowrap; }
.badge.official, .badge.ok, .badge.level-3 { background: var(--ok-soft); color: var(--ok); }
.badge.reported, .badge.level-2 { background: var(--info-soft); color: var(--info); }
.badge.unverified, .badge.warn, .badge.level-1 { background: var(--warn-soft); color: var(--warn); }
.badge.topic { background: var(--accent-soft); color: var(--accent); }
.link-chip { display: inline-flex; align-items: center; gap: 4px; font-size: 13px; font-weight: 600; text-decoration: none; color: var(--accent); padding: 6px 12px; border: 1px solid var(--border); border-radius: 999px; background: var(--surface); }
.link-chip:hover { border-color: var(--accent); background: var(--accent-soft); }
.chip-row { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 14px; }
.empty { text-align: center; padding: 28px 16px; display: flex; flex-direction: column; align-items: center; gap: 8px; }
.empty p { color: var(--muted); max-width: 420px; font-size: 14px; margin-bottom: 6px; }
.plain-list { margin: 8px 0 0; padding-left: 20px; color: var(--text-2); }
.plain-list li { margin: 4px 0; }

/* ---------- dashboard ---------- */
.card-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(300px, 1fr)); gap: 16px; }
.iv-card { display: flex; flex-direction: column; gap: 6px; text-decoration: none; color: var(--text); background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); padding: 20px; box-shadow: var(--shadow); transition: border-color .15s, box-shadow .15s; }
.iv-card:hover { border-color: var(--accent); box-shadow: var(--shadow-lg); }
.iv-card-top { display: flex; justify-content: space-between; align-items: flex-start; gap: 8px; }
.iv-card h2 { font-size: 19px; overflow-wrap: anywhere; }
.iv-card-role { color: var(--text-2); }
.iv-card-date { color: var(--muted); font-size: 13px; margin-bottom: 10px; }
.iv-card-foot { display: flex; justify-content: space-between; font-size: 13px; color: var(--muted); margin-top: 6px; }
.iv-open { color: var(--accent); font-weight: 600; }
.welcome { background: var(--surface); border: 1px solid var(--border); border-radius: 16px; padding: clamp(24px, 5vw, 48px); box-shadow: var(--shadow); display: flex; flex-direction: column; align-items: flex-start; gap: 14px; }
.welcome h2 { font-size: clamp(20px, 2.4vw, 26px); max-width: 640px; }
.welcome > p { color: var(--text-2); max-width: 620px; }
.steps { list-style: none; padding: 0; margin: 18px 0 0; display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 16px; width: 100%; }
.steps li { display: flex; gap: 12px; align-items: flex-start; }
.steps li > span { display: grid; place-items: center; width: 28px; height: 28px; border-radius: 50%; background: var(--accent-soft); color: var(--accent); font-weight: 700; font-size: 13px; flex: none; }
.steps p { color: var(--muted); font-size: 13px; margin-top: 2px; }

/* ---------- overview ---------- */
.focus-card { display: grid; grid-template-columns: minmax(0, 1fr) 260px; gap: 24px; background: linear-gradient(135deg, var(--accent-soft), var(--surface) 70%); border: 1px solid var(--border); border-radius: var(--radius); padding: 24px; box-shadow: var(--shadow); }
.focus-main h2 { font-size: 22px; margin-bottom: 6px; }
.focus-main p { color: var(--text-2); margin-bottom: 16px; }
.focus-side { border-left: 1px solid var(--border); padding-left: 24px; display: flex; flex-direction: column; justify-content: center; }
.big-number { font-size: 30px; font-weight: 700; letter-spacing: -.02em; font-variant-numeric: tabular-nums; margin-bottom: 8px; }
progress { width: 100%; height: 6px; border: 0; border-radius: 999px; background: var(--surface-2); overflow: hidden; appearance: none; -webkit-appearance: none; }
progress::-webkit-progress-bar { background: var(--surface-2); border-radius: 999px; }
progress::-webkit-progress-value { background: var(--accent); border-radius: 999px; }
progress::-moz-progress-bar { background: var(--accent); border-radius: 999px; }
.stats { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 16px; }
.stat { display: flex; flex-direction: column; gap: 2px; background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); padding: 18px 20px; text-decoration: none; color: var(--text); box-shadow: var(--shadow); }
.stat:hover { border-color: var(--accent); }
.stat-label { font-size: 13px; color: var(--muted); font-weight: 600; }
.stat strong { font-size: 28px; font-weight: 700; font-variant-numeric: tabular-nums; }
.stat-sub { font-size: 12px; color: var(--muted); }
.overview-grid { display: grid; grid-template-columns: minmax(0, 1fr) 340px; gap: 20px; align-items: start; }
.roadmap { display: flex; flex-direction: column; }
.road-row { display: grid; grid-template-columns: 28px minmax(0, 1fr) 150px auto; gap: 14px; align-items: center; padding: 14px 0; border-top: 1px solid var(--border); }
.road-num { display: grid; place-items: center; width: 26px; height: 26px; border-radius: 50%; background: var(--surface-2); font-size: 12px; font-weight: 700; color: var(--text-2); }
.road-info strong { display: block; font-size: 15px; }
.reason-row { display: flex; flex-wrap: wrap; gap: 4px 6px; margin-top: 4px; }
.reason { font-size: 12px; color: var(--text-2); background: var(--surface-2); padding: 1px 8px; border-radius: 999px; }
.road-progress { display: flex; flex-direction: column; gap: 6px; font-size: 12px; color: var(--muted); }
.checklist { display: flex; flex-direction: column; margin-top: 12px; }
.check-step { display: grid; grid-template-columns: 22px 1fr auto; gap: 10px; align-items: center; text-align: left; background: none; border: 0; border-top: 1px solid var(--border); padding: 12px 2px; font: 500 14px var(--font); color: var(--text); cursor: pointer; }
.check-step:hover { color: var(--accent); }
.check { width: 20px; height: 20px; border-radius: 50%; border: 2px solid var(--border-strong); display: grid; place-items: center; font-size: 12px; font-weight: 800; }
.check-step.done .check { background: var(--ok); border-color: var(--ok); color: #fff; }
.check-step.done > span:nth-child(2) { color: var(--muted); text-decoration: line-through; }

/* ---------- research & role ---------- */
.legend { display: flex; flex-wrap: wrap; gap: 6px; margin: 8px 0 14px; }
.source-list { display: flex; flex-direction: column; }
.source { padding: 16px 0; border-top: 1px solid var(--border); display: flex; flex-direction: column; align-items: flex-start; gap: 8px; }
.briefing h3 { margin-top: 16px; }
.two-col { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 20px; }
.long-text { color: var(--text-2); white-space: pre-wrap; overflow-wrap: anywhere; max-height: 420px; overflow: auto; margin-top: 10px; font-size: 14px; }
.long-text.is-empty { max-height: none; }
.gap-list { display: flex; flex-direction: column; margin-top: 10px; }
.gap-row { display: flex; justify-content: space-between; align-items: center; gap: 12px; padding: 10px 0; border-top: 1px solid var(--border); flex-wrap: wrap; }
#jobform { margin-top: 14px; }
#jobform input { flex: 1; min-width: 220px; }
.preview { margin-top: 16px; padding: 16px; border: 1px solid var(--border); border-radius: var(--radius-sm); background: var(--surface-2); display: flex; flex-direction: column; align-items: flex-start; gap: 10px; }
.details { display: grid; grid-template-columns: 140px 1fr; gap: 10px 16px; margin: 16px 0 20px; }
.details dt { color: var(--muted); font-size: 14px; }
.details dd { margin: 0; overflow-wrap: anywhere; }
.danger-zone { border-color: color-mix(in srgb, var(--danger) 35%, var(--border)); }
.danger-zone p { margin: 4px 0 16px; }

/* ---------- study ---------- */
.filters { display: flex; gap: 10px; flex-wrap: wrap; }
.filters input { flex: 1; min-width: 200px; }
.study-layout { display: grid; grid-template-columns: 360px minmax(0, 1fr); gap: 20px; align-items: start; }
.study-index { position: sticky; top: 20px; max-height: calc(100vh - 40px); display: flex; flex-direction: column; }
.study-index-head { padding: 12px 16px; font-size: 13px; font-weight: 600; color: var(--muted); border-bottom: 1px solid var(--border); }
#questions { overflow-y: auto; }
.question-row { display: flex; flex-direction: column; gap: 4px; width: 100%; text-align: left; padding: 12px 16px; background: none; border: 0; border-bottom: 1px solid var(--border); border-left: 3px solid transparent; cursor: pointer; font-family: inherit; color: var(--text); }
.question-row:hover { background: var(--surface-2); }
.question-row.active { background: var(--accent-soft); border-left-color: var(--accent); }
.q-meta { display: flex; justify-content: space-between; align-items: center; gap: 8px; font-size: 12px; color: var(--muted); }
.q-text { font-size: 14px; font-weight: 500; line-height: 1.4; }
.study-top { display: flex; justify-content: space-between; align-items: center; gap: 10px; flex-wrap: wrap; margin-bottom: 14px; }
.q-title { font-size: 20px; line-height: 1.35; margin-bottom: 18px; }
.answer-block { background: var(--surface-2); border-radius: var(--radius-sm); padding: 14px 16px; display: flex; flex-direction: column; gap: 10px; }
.answer-block summary { font-weight: 650; cursor: pointer; font-size: 14px; }
.answer-block[open] summary { margin-bottom: 8px; }
.answer-block .link-chip { margin-top: 10px; align-self: flex-start; }
.hint { font-size: 13px; color: var(--muted); border-left: 3px solid var(--accent); padding: 2px 0 2px 12px; margin: 18px 0 0; }
.segmented { display: inline-flex; flex-wrap: wrap; border: 1px solid var(--border-strong); border-radius: var(--radius-sm); overflow: hidden; }
.seg { font: 500 13px var(--font); padding: 9px 14px; border: 0; border-right: 1px solid var(--border-strong); background: var(--surface); color: var(--text-2); cursor: pointer; }
.seg:last-child { border-right: 0; }
.seg:hover { background: var(--surface-2); }
.seg.on { background: var(--accent); color: var(--accent-ink); font-weight: 600; }
.study-nav { display: flex; justify-content: space-between; margin-top: 20px; padding-top: 14px; border-top: 1px solid var(--border); }

/* ---------- rehearsal ---------- */
.rehearsal-layout { display: grid; grid-template-columns: minmax(0, 1fr) 300px; gap: 20px; align-items: start; }
#practicecard > h2 { font-size: 20px; margin-bottom: 4px; }
#practicecard > progress { margin: 4px 0 18px; }
#practicecard textarea { min-height: 160px; margin-bottom: 14px; }
.timer { font: 700 18px var(--font); font-variant-numeric: tabular-nums; color: var(--accent); background: var(--accent-soft); padding: 4px 12px; border-radius: 8px; }
.practice-answer { background: var(--surface-2); padding: 16px; border-radius: var(--radius-sm); white-space: pre-wrap; color: var(--text-2); margin: 4px 0 10px; }
.tips ol { padding-left: 20px; color: var(--text-2); margin: 10px 0 14px; }
.tips li { margin: 6px 0; }
.summary { display: flex; flex-direction: column; margin: 16px 0 20px; }
.summary-row { display: grid; grid-template-columns: 28px minmax(0, 1fr) auto auto; gap: 12px; align-items: center; padding: 10px 0; border-top: 1px solid var(--border); font-size: 14px; }

/* ---------- toast & dialog ---------- */
dialog { border: 1px solid var(--border); border-radius: 16px; padding: 0; width: min(620px, calc(100vw - 24px)); max-height: calc(100vh - 32px); background: var(--surface); color: var(--text); box-shadow: var(--shadow-lg); }
dialog::backdrop { background: rgba(10, 14, 22, .55); }
dialog form { padding: 24px; }
.dialog-head { display: flex; justify-content: space-between; align-items: center; margin-bottom: 18px; }
.dialog-head h2 { font-size: 20px; }
.dialog-actions { display: flex; justify-content: flex-end; gap: 10px; margin-top: 20px; padding-top: 16px; border-top: 1px solid var(--border); }
#fields input, #fields textarea, #fields select { width: 100%; }

/* ---------- responsive ---------- */
@media (max-width: 1100px) {
  .overview-grid, .rehearsal-layout { grid-template-columns: 1fr; }
  .study-layout { grid-template-columns: 300px minmax(0, 1fr); }
}
@media (max-width: 900px) {
  body { display: block; }
  .mobile-bar { display: flex; align-items: center; gap: 12px; position: sticky; top: 0; z-index: 20; background: var(--sidebar); border-bottom: 1px solid var(--border); padding: 10px 16px; }
  .brand-compact { padding: 0; font-weight: 650; font-size: 15px; }
  .brand-compact .mark { width: 30px; height: 30px; border-radius: 8px; font-size: 11px; }
  aside#sidebar { position: fixed; left: 0; top: 0; bottom: 0; width: 280px; z-index: 30; transform: translateX(-100%); transition: transform .2s ease; box-shadow: var(--shadow-lg); }
  body.nav-open aside#sidebar { transform: none; }
  .scrim { display: block; position: fixed; inset: 0; z-index: 25; background: rgba(10, 14, 22, .45); }
  .scrim[hidden] { display: none !important; }
  main { padding: 20px 16px 48px; }
  .topbar { display: none; }
  .study-layout { grid-template-columns: 1fr; }
  .study-index { position: static; max-height: 320px; }
  .two-col { grid-template-columns: 1fr; }
}
@media (max-width: 640px) {
  .stats { grid-template-columns: 1fr 1fr; }
  .stats .stat:last-child { grid-column: span 2; }
  .focus-card { grid-template-columns: 1fr; padding: 20px; }
  .focus-side { border-left: 0; padding-left: 0; border-top: 1px solid var(--border); padding-top: 16px; }
  .road-row { grid-template-columns: 26px minmax(0, 1fr) auto; }
  .road-progress { grid-column: 2 / 4; grid-row: 2; }
  .steps { grid-template-columns: 1fr; }
  .form-row { grid-template-columns: 1fr; }
  .details { grid-template-columns: 1fr; gap: 2px; }
  .details dd { margin-bottom: 10px; }
  .summary-row { grid-template-columns: 24px minmax(0, 1fr) auto; }
  .summary-row .mono { display: none; }
  .section-intro .row, .section-intro > .btn { width: 100%; }
  .card { padding: 18px; }
  .interview-header .head-actions { width: 100%; }
  .seg { padding: 9px 10px; }
}

/* ---------- AI ---------- */
.ai-feedback-wrap { margin: 14px 0 4px; }
.ai-feedback { border: 1px solid var(--accent); background: var(--accent-soft); border-radius: var(--radius-sm); padding: 16px; display: flex; flex-direction: column; gap: 6px; }
.ai-feedback h3 { margin-top: 8px; font-size: 14px; }
@media (min-width: 901px) { #ih-page { display: none; } }

/* ---------- account & sign in ---------- */
.account { display: flex; align-items: center; gap: 10px; padding: 10px; margin-top: 6px; border-top: 1px solid var(--border); }
.avatar { display: grid; place-items: center; width: 30px; height: 30px; border-radius: 50%; background: var(--accent-soft); color: var(--accent); font-weight: 700; font-size: 13px; flex: none; text-transform: uppercase; }
html[data-theme=dark] .avatar { background: var(--grad); color: var(--accent-ink); }
.account-text { display: flex; flex-direction: column; min-width: 0; }
.account-email { font-size: 13px; font-weight: 600; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.account-mode { font-size: 12px; color: var(--muted); }
.auth-wrap { min-height: calc(100vh - 160px); display: grid; place-items: center; }
.auth-card { width: min(920px, 100%); padding: 0; display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); overflow: hidden; }
.auth-intro { padding: 40px; display: flex; flex-direction: column; gap: 12px; justify-content: center; border-right: 1px solid var(--border); background: radial-gradient(520px 260px at 0% 0%, var(--accent-soft), transparent 70%); }
.auth-form { padding: 40px; display: flex; flex-direction: column; gap: 12px; justify-content: center; }
.auth-lead { color: var(--text-2); font-size: 16px; line-height: 1.65; }
.auth-points { list-style: none; padding: 0; margin: 6px 0 0; display: flex; flex-direction: column; gap: 10px; }
.auth-points li { display: flex; gap: 10px; align-items: flex-start; color: var(--text-2); font-size: 15px; line-height: 1.5; }
.auth-points li::before { content: "✓"; flex: none; display: grid; place-items: center; width: 20px; height: 20px; margin-top: 1px; border-radius: 50%; background: var(--accent-soft); color: var(--accent); font-size: 12px; font-weight: 800; }
.guest-wrap { display: flex; flex-direction: column; gap: 10px; }
.auth-form .oauth-buttons { margin-top: 0; }
@media (max-width: 760px) {
  .auth-card { grid-template-columns: 1fr; }
  .auth-intro { border-right: 0; border-bottom: 1px solid var(--border); padding: 28px 24px; }
  .auth-form { padding: 24px; }
  .auth-points { display: none; }
}
.auth-card .page-title { font-size: clamp(28px, 3.2vw, 38px); }
.auth-mark { width: 44px; height: 44px; border-radius: 12px; }
.auth-card form { display: flex; flex-direction: column; margin-top: 8px; }
.auth-card form .field { margin-bottom: 12px; }
.auth-card form .btn { width: 100%; margin-top: 4px; }
.auth-sent { background: var(--accent-soft); border-radius: var(--radius-sm); padding: 16px; display: flex; flex-direction: column; gap: 8px; align-items: flex-start; }
.auth-divider { display: flex; align-items: center; gap: 10px; color: var(--muted); font-size: 12px; margin: 6px 0; }
.auth-divider::before, .auth-divider::after { content: ""; flex: 1; height: 1px; background: var(--border); }
#guest { width: 100%; }
.banner { display: flex; justify-content: space-between; align-items: center; gap: 16px; flex-wrap: wrap; padding: 16px 20px; border: 1px solid var(--accent); background: var(--accent-soft); border-radius: var(--radius); }
.banner p { margin-top: 2px; }
body.auth-page { grid-template-columns: minmax(0, 1fr); }
body.auth-page aside#sidebar, body.auth-page #menu, body.auth-page .scrim { display: none !important; }
.oauth-buttons { display: flex; flex-direction: column; gap: 10px; margin-top: 8px; }
.oauth-buttons:not(:has(.oauth:not([hidden]))) { display: none; }
.btn.oauth { width: 100%; min-height: 46px; gap: 10px; font-size: 15px; background: var(--surface); }
.btn.oauth:hover { border-color: var(--accent); }
html[data-theme=dark] .btn.oauth { background: var(--surface-2); }

/* ---------- legal pages ---------- */
body.legal { display: block; min-height: 100vh; }
.legal-top { display: flex; justify-content: space-between; align-items: center; gap: 12px; max-width: 860px; margin: 0 auto; padding: 20px 16px; }
.legal-main { max-width: 860px; margin: 0 auto; padding: 8px 16px 40px; }
.legal-doc { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); padding: clamp(20px, 4vw, 44px); box-shadow: var(--shadow); }
.legal-doc h1 { margin-bottom: 6px; }
.legal-doc h2 { font-size: 18px; margin: 30px 0 8px; }
.legal-doc h3 { font-size: 15px; margin: 18px 0 6px; }
.legal-doc p, .legal-doc li { color: var(--text-2); line-height: 1.7; }
.legal-doc p { margin: 8px 0; }
.legal-doc ul { padding-left: 22px; margin: 8px 0; }
.legal-doc li { margin: 4px 0; }
.legal-doc strong { color: var(--text); }
.legal-footer { display: flex; justify-content: center; gap: 10px; padding: 0 16px 32px; font-size: 13px; color: var(--muted); }
.legal-footer a, .nav-legal a, .auth-legal a { color: var(--muted); }
.legal-footer a:hover, .nav-legal a:hover, .auth-legal a:hover { color: var(--accent); }
.nav-legal { display: flex; gap: 8px; padding: 6px 10px 0; font-size: 12px; color: var(--muted); }
.auth-legal { text-align: center; }

/* ---------- AI mock interview ---------- */
.mock-root { display: flex; flex-direction: column; gap: 20px; }
.mock-setup { display: flex; flex-direction: column; gap: 6px; align-items: flex-start; }
.mock-setup > .btn { margin-top: 10px; }
.mock-field .field-label { margin: 12px 0 8px; }
.mock-options { display: flex; flex-wrap: wrap; gap: 4px 24px; }
.chip { font: 500 13px var(--font); padding: 6px 12px; border-radius: 999px; border: 1px solid var(--border-strong); background: var(--surface); color: var(--text-2); cursor: pointer; }
.chip:hover { border-color: var(--accent); }
.chip.on { background: var(--accent-soft); border-color: var(--accent); color: var(--accent); font-weight: 600; }
.mock-chips { margin-top: 0; }
.check-label { display: flex; gap: 10px; align-items: flex-start; margin-top: 14px; font-size: 14px; color: var(--text-2); cursor: pointer; }
.check-label input { min-height: auto; margin-top: 3px; accent-color: var(--accent); }
.mock-history { display: flex; flex-direction: column; margin-top: 10px; }
.mock-history-row { display: grid; grid-template-columns: minmax(0, 1fr) auto auto; gap: 12px; align-items: center; padding: 12px 0; border-top: 1px solid var(--border); }
.mock-history-row > div:first-child { display: flex; flex-direction: column; gap: 2px; min-width: 0; }
.mock-live { display: flex; flex-direction: column; gap: 14px; }
.mock-head { display: flex; justify-content: space-between; align-items: flex-start; gap: 12px; flex-wrap: wrap; }
.mock-chat { display: flex; flex-direction: column; gap: 10px; }
.bubble { max-width: 88%; padding: 12px 16px; border-radius: 14px; border: 1px solid var(--border); }
.bubble-who { display: block; font-size: 12px; font-weight: 600; color: var(--muted); margin-bottom: 4px; }
.bubble.interviewer { align-self: flex-start; background: var(--surface-2); border-top-left-radius: 4px; }
.bubble.interviewer .body-text { color: var(--text); font-weight: 500; }
.bubble.followup { border-left: 3px solid var(--accent); }
.bubble.followup .bubble-who { color: var(--accent); }
.bubble.candidate { align-self: flex-end; background: var(--accent-soft); border-color: transparent; border-top-right-radius: 4px; }
.mock-eval { align-self: stretch; border: 1px dashed var(--border-strong); border-radius: var(--radius-sm); padding: 10px 14px; }
.mock-eval summary { cursor: pointer; font-weight: 600; font-size: 13px; color: var(--accent); }
.mock-eval[open] summary { margin-bottom: 10px; }
.mock-eval h3 { font-size: 13px; margin-top: 10px; }
.score-row { display: flex; flex-wrap: wrap; gap: 6px; margin-bottom: 8px; }
.score-pill { font-size: 12px; padding: 2px 8px; border-radius: 6px; background: var(--surface-2); color: var(--text-2); }
.score-pill.s1 { background: var(--danger-soft); color: var(--danger); }
.score-pill.s2 { background: var(--warn-soft); color: var(--warn); }
.score-pill.s3 { background: var(--info-soft); color: var(--info); }
.score-pill.s4 { background: var(--ok-soft); color: var(--ok); }
.thinking { display: flex; align-items: center; gap: 10px; color: var(--muted); font-size: 14px; padding: 6px 2px; }
.thinking::before { content: ""; width: 14px; height: 14px; border-radius: 50%; border: 2px solid var(--accent); border-right-color: transparent; animation: spin .8s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }
.mock-error { display: flex; justify-content: space-between; align-items: center; gap: 10px; flex-wrap: wrap; }
.mock-live textarea { min-height: 150px; }
.dim-row { display: grid; grid-template-columns: minmax(0, 1fr) 120px 64px; gap: 12px; align-items: center; padding: 10px 0; border-top: 1px solid var(--border); }
.dim-row > div { display: flex; flex-direction: column; }
.dim-val { text-align: right; font-size: 13px; }
@media (max-width: 640px) {
  .bubble { max-width: 100%; }
  .mock-history-row { grid-template-columns: 1fr auto; }
  .mock-history-row .row { grid-column: 1 / -1; }
  .dim-row { grid-template-columns: minmax(0, 1fr) 70px 54px; }
}

/* ---------- readability & emphasis layer ---------- */
body { font-size: 16px; line-height: 1.65; }
::selection { background: var(--hl-bg); color: var(--hl-ink); }
.hl { background: var(--hl-bg); color: var(--hl-ink); padding: 0 .18em; border-radius: .18em; -webkit-box-decoration-break: clone; box-decoration-break: clone; }
.page-title { font-size: clamp(28px, 3.4vw, 40px); font-weight: 800; letter-spacing: -.035em; line-height: 1.12; }
.display { font-size: clamp(34px, 4.6vw, 56px); font-weight: 800; letter-spacing: -.04em; line-height: 1.06; }
h2 { font-size: 19px; font-weight: 700; letter-spacing: -.015em; }
h3 { font-size: 16px; font-weight: 700; }
.lead { font-size: 17px; line-height: 1.7; max-width: 70ch; }
.eyebrow { font-size: 12px; letter-spacing: .08em; text-transform: uppercase; font-weight: 700; }
.muted { font-size: 14px; }
.small-text { font-size: 12.5px; }
.body-text { line-height: 1.75; max-width: 78ch; }
.long-text { font-size: 15.5px; line-height: 1.8; }
.card > p, .card li { line-height: 1.7; }
.q-title { font-size: clamp(20px, 2vw, 25px); font-weight: 750; letter-spacing: -.02em; line-height: 1.3; }
.q-text { font-size: 15px; line-height: 1.45; }
.answer-block { padding: 18px 20px; border-left: 3px solid var(--accent); }
.answer-block .body-text { color: var(--text); font-size: 16.5px; line-height: 1.8; }
.practice-answer { font-size: 16px; line-height: 1.8; color: var(--text); border-left: 3px solid var(--accent); }
.hint { font-size: 14.5px; line-height: 1.6; }
.bubble .body-text { font-size: 15.5px; line-height: 1.7; }
.plain-list li { margin: 6px 0; }
.road-info strong { font-size: 16px; }
.welcome h2.display { font-size: clamp(30px, 3.8vw, 48px); max-width: 22ch; line-height: 1.1; }
.page-head .display + .lead { margin-top: 14px; }
.welcome > p { font-size: 17px; line-height: 1.7; }
.card, .stat, .iv-card { transition: border-color .15s, box-shadow .15s, transform .15s; }
.iv-card:hover, .stat:hover { transform: translateY(-2px); }
html[data-theme=dark] .card:hover { border-color: #2c2c32; }
html[data-theme=dark] .iv-card:hover, html[data-theme=dark] .stat:hover { border-color: rgba(var(--accent-rgb), .55); box-shadow: 0 0 0 1px rgba(var(--accent-rgb), .18), 0 18px 40px rgba(0, 0, 0, .5); }
html[data-theme=dark] .eyebrow.accent, html[data-theme=dark] .accent { color: var(--accent); }
html[data-theme=dark] .chip.on, html[data-theme=dark] .badge.topic { color: var(--accent); }
html[data-theme=dark] .nav-link.active { background: rgba(var(--accent-rgb), .10); }
html[data-theme=dark] .road-num, html[data-theme=dark] .steps li > span { background: rgba(var(--accent-rgb), .14); color: var(--accent); }
.legal-doc p, .legal-doc li { font-size: 16px; }
@media (max-width: 640px) { body { font-size: 15.5px; } .lead { font-size: 16px; } }

/* ---------- toasts ---------- */
.toasts { position: fixed; right: 20px; bottom: 20px; z-index: 60; display: flex; flex-direction: column; gap: 10px; width: min(380px, calc(100vw - 32px)); pointer-events: none; }
.toast-item { pointer-events: auto; position: relative; overflow: hidden; display: grid; grid-template-columns: 28px minmax(0, 1fr) 24px; gap: 12px; align-items: start; padding: 14px 14px 16px; border-radius: 12px; background: var(--surface); border: 1px solid var(--border-strong); box-shadow: var(--shadow-lg); animation: toast-in .22s ease-out; }
.toast-item.leaving { animation: toast-out .2s ease-in forwards; }
.toast-icon { display: grid; place-items: center; width: 28px; height: 28px; border-radius: 50%; font-weight: 800; font-size: 14px; }
.toast-item.success .toast-icon { background: var(--ok-soft); color: var(--ok); }
.toast-item.error .toast-icon { background: var(--danger-soft); color: var(--danger); }
.toast-item.info .toast-icon { background: var(--info-soft); color: var(--info); }
.toast-item.error { border-color: color-mix(in srgb, var(--danger) 45%, var(--border-strong)); }
.toast-body { display: flex; flex-direction: column; gap: 2px; padding-top: 3px; }
.toast-title { font-size: 14px; }
.toast-text { font-size: 14px; line-height: 1.5; color: var(--text-2); }
.toast-close { background: none; border: 0; color: var(--muted); font-size: 20px; line-height: 1; cursor: pointer; padding: 2px; border-radius: 6px; }
.toast-close:hover { color: var(--text); background: var(--surface-2); }
.toast-bar { position: absolute; left: 0; bottom: 0; height: 3px; width: 100%; transform-origin: left; animation: toast-bar linear forwards; }
.toast-item.success .toast-bar { background: var(--ok); }
.toast-item.error .toast-bar { background: var(--danger); }
.toast-item.info .toast-bar { background: var(--info); }
@keyframes toast-in { from { opacity: 0; transform: translateY(10px) scale(.98); } to { opacity: 1; transform: none; } }
@keyframes toast-out { to { opacity: 0; transform: translateX(16px); } }
@keyframes toast-bar { from { transform: scaleX(1); } to { transform: scaleX(0); } }
@media (max-width: 640px) { .toasts { left: 16px; right: 16px; bottom: 16px; width: auto; } }

/* ---------- confirm dialog ---------- */
.confirm-dialog { width: min(480px, calc(100vw - 24px)); padding: 24px; border-radius: 16px; }
.confirm-dialog[open] { animation: dialog-in .18s ease-out; }
.confirm-dialog::backdrop { background: rgba(5, 6, 8, .66); backdrop-filter: blur(3px); }
@keyframes dialog-in { from { opacity: 0; transform: translateY(8px) scale(.98); } to { opacity: 1; transform: none; } }
.confirm-head { display: flex; align-items: center; gap: 12px; margin-bottom: 10px; }
.confirm-head h2 { font-size: 19px; }
.confirm-icon { display: grid; place-items: center; width: 36px; height: 36px; flex: none; border-radius: 10px; background: var(--accent-soft); color: var(--accent); font-weight: 800; font-size: 16px; }
.confirm-dialog[data-tone=danger] .confirm-icon { background: var(--danger-soft); color: var(--danger); }
.confirm-message { color: var(--text-2); font-size: 15px; line-height: 1.65; }
.confirm-details { margin: 12px 0 0; padding: 12px 14px 12px 32px; background: var(--surface-2); border-radius: var(--radius-sm); color: var(--text-2); font-size: 14px; line-height: 1.55; }
.confirm-details li { margin: 4px 0; }
.confirm-note { margin-top: 12px; font-size: 13px; color: var(--muted); }
.confirm-input { margin: 16px 0 0; }
.confirm-dialog .dialog-actions { margin-top: 20px; }
.btn.danger.solid { background: #dc2626; border-color: #dc2626; color: #fff; font-weight: 700; }
.btn.danger.solid:hover { background: #b91c1c; border-color: #b91c1c; }
.btn.danger.solid:disabled { background: #7f1d1d; border-color: #7f1d1d; color: #fecaca; }
@media (prefers-reduced-motion: reduce) { .toast-item, .confirm-dialog[open] { animation: none; } .toast-bar { display: none; } }

/* ---------- form dialog ---------- */
dialog#dialog { width: min(760px, calc(100vw - 24px)); }
dialog#dialog[open] { animation: dialog-in .18s ease-out; }
dialog#dialog::backdrop { background: rgba(5, 6, 8, .66); backdrop-filter: blur(3px); }
.dialog-title { display: flex; gap: 14px; align-items: flex-start; }
.dialog-subtitle { color: var(--muted); font-size: 14px; margin-top: 2px; }
#fields { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 0 16px; }
#fields .field.full, #fields .form-section { grid-column: 1 / -1; }
.form-section { display: flex; align-items: center; flex-wrap: wrap; gap: 4px 10px; margin: 8px 0 12px; padding-top: 14px; border-top: 1px solid var(--border); }
.form-section:first-child { border-top: 0; padding-top: 0; margin-top: 0; }
.form-section strong { font-size: 15px; }
.form-section .field-hint { flex-basis: 100%; padding-left: 34px; }
.form-step { display: grid; place-items: center; width: 24px; height: 24px; border-radius: 50%; background: var(--accent-soft); color: var(--accent); font-size: 12px; font-weight: 800; }
.field-name .opt { font-style: normal; font-weight: 500; color: var(--muted); font-size: 12px; }
.field-name .req { font-style: normal; color: var(--accent); }
.field-foot { display: flex; justify-content: space-between; gap: 10px; }
.char-count { font-size: 12px; color: var(--muted); margin-left: auto; font-variant-numeric: tabular-nums; }
@media (max-width: 640px) { #fields { grid-template-columns: 1fr; } }

/* ---------- mock interview: voice & engagement ---------- */
.mock-steps { list-style: none; display: flex; gap: 6px; padding: 0; margin: 10px 0 0; flex-wrap: wrap; }
.step-dot span { display: grid; place-items: center; width: 26px; height: 26px; border-radius: 50%; font-size: 12px; font-weight: 700; border: 2px solid var(--border-strong); color: var(--muted); }
.step-dot.done span { background: var(--accent); border-color: var(--accent); color: var(--accent-ink); }
.step-dot.current span { border-color: var(--accent); color: var(--accent); box-shadow: 0 0 0 4px var(--accent-soft); animation: pulse-ring 1.8s ease-in-out infinite; }
@keyframes pulse-ring { 50% { box-shadow: 0 0 0 7px transparent; } }
.mock-tools { align-items: center; }
.speak-toggle.on { color: var(--accent); }
.bubble-row { display: flex; gap: 10px; align-items: flex-start; }
.bubble-row.from-you { flex-direction: row-reverse; }
.bubble-row .bubble { max-width: min(88%, 760px); }
.avatar-sm { display: grid; place-items: center; width: 32px; height: 32px; flex: none; border-radius: 50%; font-size: 11px; font-weight: 800; }
.avatar-sm.ai { background: var(--grad); color: var(--accent-ink); }
.avatar-sm.you { background: var(--surface-2); color: var(--text-2); border: 1px solid var(--border-strong); }
.bubble.current { border-color: var(--accent); box-shadow: 0 0 0 1px var(--accent-soft); }
.bubble.current .body-text { font-size: 17px; }
.listen-btn { margin-top: 8px; font: 600 12px var(--font); color: var(--accent); background: var(--accent-soft); border: 0; border-radius: 999px; padding: 4px 10px; cursor: pointer; }
.typing-row { display: flex; gap: 10px; align-items: center; }
.typing-bubble { display: flex; align-items: center; gap: 10px; padding: 12px 16px; border-radius: 14px; border-top-left-radius: 4px; background: var(--surface-2); border: 1px solid var(--border); color: var(--muted); font-size: 14px; }
.typing-dots { display: inline-flex; gap: 4px; }
.typing-dots i { width: 6px; height: 6px; border-radius: 50%; background: var(--accent); animation: dot-bounce 1.2s infinite ease-in-out; }
.typing-dots i:nth-child(2) { animation-delay: .15s; } .typing-dots i:nth-child(3) { animation-delay: .3s; }
@keyframes dot-bounce { 0%, 80%, 100% { transform: translateY(0); opacity: .45; } 40% { transform: translateY(-5px); opacity: 1; } }
.answer-box { display: flex; flex-direction: column; gap: 10px; padding: 16px; border: 1px solid var(--border); border-radius: var(--radius); background: var(--surface-2); }
.answer-box textarea { background: var(--surface); }
.answer-tip { font-size: 14px; color: var(--text-2); }
.answer-tools { display: flex; align-items: center; gap: 12px; flex-wrap: wrap; }
.mic-btn { gap: 8px; }
.mic-icon { width: 10px; height: 10px; border-radius: 50%; background: var(--danger); box-shadow: 0 0 0 3px var(--danger-soft); }
.mic-btn.on { border-color: var(--danger); color: var(--danger); background: var(--danger-soft); }
.mic-btn.on .mic-icon { border-radius: 2px; animation: rec-pulse 1s infinite; }
@keyframes rec-pulse { 50% { opacity: .35; } }
.rec-status { display: inline-flex; align-items: center; gap: 8px; font-size: 13px; color: var(--danger); }
.rec-status i { width: 8px; height: 8px; border-radius: 50%; background: var(--danger); animation: rec-pulse 1s infinite; }
.answer-meta { font-size: 13px; color: var(--muted); font-variant-numeric: tabular-nums; }
.not-answered { padding-left: 42px; }
@media (max-width: 640px) { .kbd-hint { display: none; } .bubble-row .bubble { max-width: 100%; } .avatar-sm { width: 26px; height: 26px; font-size: 10px; } }
@media (prefers-reduced-motion: reduce) { .step-dot.current span, .typing-dots i, .mic-btn.on .mic-icon, .rec-status i { animation: none; } }

/* ---------- AI writing assistant ---------- */
.ai-write-bar { position: relative; display: flex; justify-content: flex-end; margin-top: 6px; }
.ai-write-btn { display: inline-flex; align-items: center; gap: 6px; font: 600 12px var(--font); padding: 4px 10px; border-radius: 999px; border: 1px solid var(--border-strong); background: var(--surface); color: var(--text-2); cursor: pointer; transition: border-color .15s, color .15s, background .15s; }
.ai-write-btn:hover, .ai-write-btn[aria-expanded=true] { border-color: var(--accent); color: var(--accent); background: var(--accent-soft); }
.ai-spark { color: var(--accent); }
.ai-pop { position: absolute; right: 0; top: calc(100% + 6px); z-index: 35; width: min(440px, calc(100vw - 40px)); display: flex; flex-direction: column; gap: 10px; padding: 14px; border-radius: 12px; border: 1px solid var(--border-strong); background: var(--surface); box-shadow: var(--shadow-lg); animation: dialog-in .14s ease-out; text-align: left; }
.ai-pop-head { display: flex; flex-direction: column; gap: 2px; }
.ai-pop-head strong { font-size: 14px; color: var(--accent); }
.ai-pop-actions { display: grid; grid-template-columns: 1fr 1fr; gap: 6px; }
.ai-action { display: flex; flex-direction: column; align-items: flex-start; gap: 2px; padding: 9px 11px; border-radius: 9px; border: 1px solid var(--border); background: var(--surface-2); color: var(--text); cursor: pointer; text-align: left; font-family: inherit; }
.ai-action:hover, .ai-action:focus-visible { border-color: var(--accent); }
.ai-action-name { font-size: 13px; font-weight: 650; }
.ai-action-desc { font-size: 12px; color: var(--muted); }
.ai-custom { display: flex; gap: 6px; }
.ai-custom input { flex: 1; min-height: 34px; font-size: 13px; }
.ai-pop-loading { display: flex; align-items: center; gap: 10px; color: var(--muted); font-size: 14px; padding: 6px 2px; }
.ai-preview { min-height: 0; font-size: 14px; line-height: 1.6; background: var(--surface-2); }
.ai-result-actions { gap: 6px; }
.ai-pop-note { margin: 0; }
.ai-undo { align-self: flex-start; }
@media (max-width: 640px) { .ai-pop-actions { grid-template-columns: 1fr; } }

/* ---------- custom dropdowns (cselect.js) ---------- */
.cs-native { position: absolute !important; width: 1px !important; height: 1px !important; min-height: 0 !important; padding: 0 !important; margin: -1px !important; overflow: hidden; clip: rect(0 0 0 0); border: 0 !important; opacity: 0; pointer-events: none; }
.cselect { position: relative; display: inline-flex; min-width: 160px; max-width: 100%; vertical-align: middle; }
.field .cselect, .form-row .cselect { display: flex; width: 100%; }
.cs-button { display: flex; align-items: center; justify-content: space-between; gap: 10px; width: 100%; min-height: 40px; padding: 9px 12px; border-radius: var(--radius-sm); border: 1px solid var(--border-strong); background: var(--surface); color: var(--text); font: 500 14px/1.3 var(--font); text-align: left; cursor: pointer; transition: border-color .15s, box-shadow .15s; }
.cs-button:hover { border-color: color-mix(in srgb, var(--accent) 55%, var(--border-strong)); }
.cs-button:focus-visible, .cselect.open .cs-button { outline: none; border-color: var(--accent); box-shadow: 0 0 0 3px var(--accent-soft); }
.cs-button:disabled { opacity: .55; cursor: not-allowed; }
.cs-text { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.cs-chevron { flex: none; width: 8px; height: 8px; margin-top: -4px; border-right: 2px solid var(--muted); border-bottom: 2px solid var(--muted); transform: rotate(45deg); transition: transform .15s, margin .15s; }
.cselect.open .cs-chevron { transform: rotate(-135deg); margin-top: 4px; border-color: var(--accent); }
.cs-list { position: absolute; left: 0; right: 0; top: calc(100% + 6px); z-index: 45; margin: 0; padding: 6px; list-style: none; min-width: 100%; width: max-content; max-width: min(420px, calc(100vw - 32px)); max-height: 280px; overflow-y: auto; border-radius: 12px; border: 1px solid var(--border-strong); background: var(--surface); box-shadow: var(--shadow-lg); outline: none; animation: cs-in .12s ease-out; }
.field .cs-list, .form-row .cs-list { width: 100%; max-width: none; }
.cselect.up .cs-list { top: auto; bottom: calc(100% + 6px); }
@keyframes cs-in { from { opacity: 0; transform: translateY(-4px); } to { opacity: 1; transform: none; } }
.cs-option { display: flex; align-items: center; gap: 8px; padding: 9px 10px; border-radius: 8px; font-size: 14px; color: var(--text-2); cursor: pointer; user-select: none; }
.cs-option.active { background: var(--surface-2); color: var(--text); }
.cs-option[aria-selected=true] { color: var(--accent); font-weight: 600; }
.cs-option[aria-selected=true].active { background: var(--accent-soft); }
.cs-option[aria-disabled=true] { opacity: .45; cursor: not-allowed; }
.cs-check { width: 14px; flex: none; text-align: center; font-weight: 800; color: var(--accent); }
html[data-theme=dark] .cs-list { background: #141417; }
@media (prefers-reduced-motion: reduce) { .cs-list { animation: none; } .cs-chevron { transition: none; } }

/* ---------- accent colours (data-accent on <html>; emerald is the default) ---------- */
html[data-accent=blue] { --accent: #1d4ed8; --accent-hover: #1e40af; --accent-soft: #e7eefd; --accent-ink: #ffffff; --grad: linear-gradient(135deg, #2563eb 0%, #3b82f6 100%); --hl-bg: #bfdbfe; --hl-ink: #0b2a5b; --accent-rgb: 29, 78, 216; }
html[data-accent=violet] { --accent: #4f46e5; --accent-hover: #4338ca; --accent-soft: #eceafd; --accent-ink: #ffffff; --grad: linear-gradient(135deg, #4f46e5 0%, #6366f1 100%); --hl-bg: #c7c4fd; --hl-ink: #1e1b4b; --accent-rgb: 79, 70, 229; }
html[data-accent=coral] { --accent: #c2410c; --accent-hover: #9a3412; --accent-soft: #fdede6; --accent-ink: #ffffff; --grad: linear-gradient(135deg, #c2410c 0%, #ea580c 100%); --hl-bg: #fed2bf; --hl-ink: #5a1a06; --accent-rgb: 194, 65, 12; }
html[data-theme=dark][data-accent=blue] { --accent: #60a5fa; --accent-hover: #93c5fd; --accent-soft: rgba(96, 165, 250, .14); --accent-ink: #04122b; --grad: linear-gradient(135deg, #3b82f6 0%, #60a5fa 100%); --hl-bg: #60a5fa; --hl-ink: #04122b; --accent-rgb: 96, 165, 250; }
html[data-theme=dark][data-accent=violet] { --accent: #8f90ff; --accent-hover: #adaeff; --accent-soft: rgba(143, 144, 255, .15); --accent-ink: #0d0b2e; --grad: linear-gradient(135deg, #6f72ff 0%, #8f90ff 100%); --hl-bg: #8f90ff; --hl-ink: #0d0b2e; --accent-rgb: 143, 144, 255; }
html[data-theme=dark][data-accent=coral] { --accent: #f0846a; --accent-hover: #f5a48f; --accent-soft: rgba(240, 132, 106, .14); --accent-ink: #2a0d05; --grad: linear-gradient(135deg, #e8684a 0%, #f0846a 100%); --hl-bg: #f0846a; --hl-ink: #2a0d05; --accent-rgb: 240, 132, 106; }

/* ---------- appearance panel ---------- */
.appearance-pop { position: fixed; z-index: 70; width: 248px; padding: 14px; border-radius: 14px; border: 1px solid var(--border-strong); background: var(--surface); box-shadow: var(--shadow-lg); display: flex; flex-direction: column; gap: 12px; animation: cs-in .12s ease-out; }
html[data-theme=dark] .appearance-pop { background: #141417; }
.appearance-title { font-size: 13px; font-weight: 700; color: var(--text); }
.appearance-label { font-size: 12px; font-weight: 600; color: var(--muted); text-transform: uppercase; letter-spacing: .06em; margin-bottom: 8px; }
.mode-switch { display: grid; grid-template-columns: 1fr 1fr; gap: 6px; }
.mode-switch button { display: flex; align-items: center; justify-content: center; gap: 6px; padding: 8px; border-radius: 9px; border: 1px solid var(--border-strong); background: var(--surface-2); color: var(--text-2); font: 600 13px var(--font); cursor: pointer; }
.mode-switch button[aria-checked=true] { border-color: var(--accent); color: var(--accent); background: var(--accent-soft); }
.swatches { display: flex; gap: 12px; padding: 4px 2px; }
.swatch { width: 34px; height: 34px; border-radius: 50%; border: 0; cursor: pointer; background: var(--sw); box-shadow: 0 0 0 0 transparent; transition: transform .12s, box-shadow .12s; }
.swatch:hover { transform: scale(1.08); }
.swatch[aria-checked=true] { box-shadow: 0 0 0 3px var(--surface), 0 0 0 5px var(--text); }
.swatch:focus-visible { outline: 2px solid var(--text); outline-offset: 3px; }
.appearance-card .swatches { margin-top: 2px; }
.appearance-card .mode-switch { max-width: 280px; }
.appearance-row { display: flex; flex-wrap: wrap; gap: 20px 40px; margin-top: 12px; }
.appearance-pop .appearance-controls { display: flex; flex-direction: column; gap: 14px; }
.appearance-row .appearance-controls { display: flex; flex-wrap: wrap; gap: 20px 48px; }

/* ---------- scrolling polish ---------- */
/* Thin, themed scrollbars instead of chunky system ones. */
* { scrollbar-width: thin; scrollbar-color: var(--border-strong) transparent; }
::-webkit-scrollbar { width: 10px; height: 10px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: var(--border-strong); border-radius: 999px; border: 3px solid transparent; background-clip: padding-box; }
::-webkit-scrollbar-thumb:hover { background-color: var(--muted); }
::-webkit-scrollbar-corner { background: transparent; }
/* Lock the page behind an open dialog so only one thing scrolls. */
html:has(dialog[open]) { overflow: hidden; }
/* Dialogs: fixed header and actions; only the body scrolls, and only when needed. */
dialog#dialog { overflow: hidden; max-height: calc(100vh - 32px); }
dialog#dialog form { display: flex; flex-direction: column; max-height: calc(100vh - 32px); padding: 22px 24px 18px; }
dialog#dialog .dialog-head { flex: none; margin-bottom: 14px; }
dialog#dialog #fields { flex: 1 1 auto; min-height: 0; overflow-y: auto; overscroll-behavior: contain; margin: 0 -24px; padding: 2px 24px 4px; }
dialog#dialog .dialog-actions { flex: none; margin-top: 14px; padding-top: 14px; }
dialog#dialog .form-error { flex: none; }
#fields .field { margin-bottom: 12px; }
#fields .form-section { margin: 4px 0 10px; padding-top: 12px; }
#fields .form-section:first-child { padding-top: 0; }
textarea.autogrow { resize: none; overflow-y: auto; min-height: 76px; }
.confirm-dialog { max-height: calc(100vh - 32px); overflow-y: auto; }
/* Settings: two columns on wide screens so it fits without scrolling. */
.settings-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 20px; align-items: start; }
.settings-grid > .danger-zone { grid-column: 1 / -1; }
@media (max-width: 1100px) { .settings-grid { grid-template-columns: 1fr; } }
@media (max-height: 820px) {
  dialog#dialog form { padding: 16px 22px 14px; }
  dialog#dialog .dialog-head { margin-bottom: 8px; }
  dialog#dialog .dialog-subtitle, #fields .form-section .field-hint { display: none; }
  #fields .form-section { margin: 0 0 6px; padding-top: 8px; }
  #fields .field { margin-bottom: 8px; gap: 4px; }
  #fields .field-hint { font-size: 11.5px; }
  textarea.autogrow { min-height: 58px; }
  dialog#dialog .dialog-actions { margin-top: 10px; padding-top: 10px; }
}
