:root {
  color-scheme: dark;
  --bg: #10100d;
  --sidebar: #171713;
  --surface: #1d1d18;
  --surface-2: #24231d;
  --surface-3: #2b2a23;
  --line: rgba(255, 255, 255, 0.09);
  --line-strong: rgba(237, 207, 132, 0.30);
  --text: #f3f0e8;
  --muted: #aaa79d;
  --faint: #747169;
  --gold: #e1c471;
  --gold-soft: #f3d990;
  --gold-ink: #282114;
  --success: #8cc5a0;
  --danger: #e99a95;
  --sidebar-width: 280px;
  --sidebar-collapsed: 76px;
  --topbar-height: 64px;
  --content-width: 850px;
  --drawer-width: 390px;
  --shadow: 0 22px 72px rgba(0, 0, 0, 0.36);
}

* { box-sizing: border-box; }
html, body { height: 100%; }
body {
  margin: 0;
  overflow: hidden;
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  color: var(--text);
  background: var(--bg);
  -webkit-font-smoothing: antialiased;
}
button, textarea { font: inherit; }
button { color: inherit; }
button:focus-visible, textarea:focus-visible { outline: 2px solid var(--gold); outline-offset: 2px; }

.app-shell { height: 100dvh; display: grid; grid-template-columns: var(--sidebar-width) minmax(0, 1fr); background: var(--bg); }
.app-shell.sidebar-collapsed { grid-template-columns: var(--sidebar-collapsed) minmax(0, 1fr); }

.sidebar {
  min-width: 0;
  height: 100dvh;
  padding: 12px;
  border-right: 1px solid var(--line);
  background: var(--sidebar);
  display: flex;
  flex-direction: column;
  gap: 12px;
  overflow: hidden;
  z-index: 20;
  transition: width .22s ease, transform .22s ease;
}
.sidebar-head { min-height: 70px; display: flex; align-items: center; justify-content: space-between; gap: 8px; }
.brand { min-width: 0; flex: 1 1 auto; display: flex; align-items: center; color: var(--text); text-decoration: none; overflow: hidden; }
.brand-panel-image { display: block; width: 100%; max-width: 210px; height: auto; border-radius: 14px; object-fit: contain; object-position: left center; }
.brand-logo-image { display: none; width: 44px; height: 44px; flex: 0 0 auto; border-radius: 13px; object-fit: cover; box-shadow: 0 0 0 1px rgba(237,207,132,.20); }
.icon-button { width: 36px; height: 36px; flex: 0 0 auto; border: 0; border-radius: 10px; background: transparent; color: var(--muted); cursor: pointer; display: grid; place-items: center; font-size: 17px; transition: background .16s ease, color .16s ease; }
.icon-button:hover { background: rgba(255,255,255,.07); color: var(--text); }

.new-chat-button { width: 100%; min-height: 44px; border: 1px solid var(--line); border-radius: 12px; background: rgba(255,255,255,.045); color: var(--text); cursor: pointer; display: flex; align-items: center; gap: 10px; padding: 0 12px; font-weight: 720; text-align: left; transition: background .16s ease, border .16s ease; }
.new-chat-button:hover { background: rgba(255,255,255,.075); border-color: var(--line-strong); }
.button-icon { font-size: 20px; color: var(--gold); }
.sidebar-section { min-width: 0; }
.sidebar-label { margin: 8px 10px 7px; color: var(--faint); font-size: 11px; font-weight: 750; text-transform: uppercase; letter-spacing: .10em; }
.discipline-nav, .recent-threads { display: grid; gap: 3px; }
.discipline-item, .recent-item { width: 100%; min-width: 0; border: 0; border-radius: 10px; background: transparent; color: var(--muted); cursor: pointer; display: grid; grid-template-columns: 28px minmax(0,1fr); align-items: center; gap: 8px; padding: 9px 10px; text-align: left; transition: background .16s ease, color .16s ease; }
.discipline-item:hover, .recent-item:hover { background: rgba(255,255,255,.055); color: var(--text); }
.discipline-item.active { background: rgba(225,196,113,.11); color: var(--gold-soft); }
.discipline-icon { width: 26px; height: 26px; display: grid; place-items: center; font-size: 15px; }
.discipline-copy, .recent-copy { min-width: 0; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; font-size: 14px; }
.recent-item { grid-template-columns: 1fr; padding-left: 10px; }
.recent-copy { color: inherit; }
.empty-recent { padding: 8px 10px; color: var(--faint); font-size: 12px; line-height: 1.45; }
.sidebar-spacer { flex: 1; min-height: 12px; }
.profile-summary { width: 100%; min-width: 0; border: 1px solid transparent; border-radius: 12px; background: transparent; padding: 8px; cursor: pointer; display: grid; grid-template-columns: 34px minmax(0,1fr) 18px; gap: 9px; align-items: center; text-align: left; }
.profile-summary:hover { background: rgba(255,255,255,.055); border-color: var(--line); }
.profile-avatar { width: 34px; height: 34px; border-radius: 50%; display: grid; place-items: center; background: var(--surface-3); color: var(--gold-soft); font-weight: 800; }
.profile-summary-copy { min-width: 0; display: grid; }
.profile-summary-copy strong, .profile-summary-copy small { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.profile-summary-copy strong { font-size: 13px; }
.profile-summary-copy small { margin-top: 3px; color: var(--muted); font-size: 11px; }
.profile-chevron { color: var(--faint); }
.sidebar-version { padding: 0 10px 2px; color: var(--faint); font-size: 10px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }

.sidebar-collapsed .brand-panel-image,
.sidebar-collapsed .nav-copy,
.sidebar-collapsed .sidebar-label,
.sidebar-collapsed .recent-section { display: none; }
.sidebar-collapsed .brand-logo-image { display: block; }
.sidebar-collapsed .brand { flex: 0 0 44px; justify-content: center; overflow: visible; }
.sidebar-collapsed .sidebar-head { min-height: 52px; justify-content: center; }
.sidebar-collapsed .sidebar-collapse { position: absolute; left: 58px; top: 16px; width: 28px; height: 28px; background: var(--surface-2); border: 1px solid var(--line); transform: rotate(180deg); }
.sidebar-collapsed .new-chat-button { justify-content: center; padding: 0; }
.sidebar-collapsed .discipline-item { grid-template-columns: 1fr; padding: 8px; }
.sidebar-collapsed .discipline-icon { margin: auto; }
.sidebar-collapsed .discipline-copy { display: none; }
.sidebar-collapsed .profile-summary { grid-template-columns: 1fr; padding: 7px; }
.sidebar-collapsed .profile-avatar { margin: auto; }

.main-panel { min-width: 0; height: 100dvh; display: grid; grid-template-rows: var(--topbar-height) minmax(0,1fr); }
.topbar { min-width: 0; padding: 0 18px; border-bottom: 1px solid var(--line); display: flex; align-items: center; justify-content: space-between; gap: 14px; background: rgba(16,16,13,.92); backdrop-filter: blur(16px); z-index: 10; }
.topbar-left, .topbar-actions { min-width: 0; display: flex; align-items: center; gap: 8px; }
.mobile-menu-button { display: none; }
.active-heading { min-width: 0; }
.active-title-row { display: flex; align-items: center; gap: 8px; }
.active-heading h1 { margin: 0; max-width: 54vw; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-size: 16px; letter-spacing: -.01em; }
.active-heading p { margin: 3px 0 0; max-width: 60vw; color: var(--muted); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-size: 11.5px; }
.live-dot { width: 7px; height: 7px; border-radius: 50%; background: var(--success); box-shadow: 0 0 0 4px rgba(140,197,160,.10); }
.compact-button { min-height: 36px; border: 1px solid var(--line); border-radius: 999px; background: var(--surface); padding: 0 12px; cursor: pointer; color: var(--text); display: flex; align-items: center; gap: 7px; font-size: 12px; font-weight: 720; }
.compact-button:hover { border-color: var(--line-strong); background: var(--surface-2); }
.mode-menu-wrap { position: relative; }
.mode-menu { position: absolute; right: 0; top: calc(100% + 8px); width: 250px; padding: 7px; border: 1px solid var(--line); border-radius: 14px; background: var(--surface); box-shadow: var(--shadow); z-index: 50; }
.mode-menu[hidden] { display: none; }
.mode-option { width: 100%; border: 0; border-radius: 10px; background: transparent; color: var(--text); cursor: pointer; padding: 10px; text-align: left; }
.mode-option:hover, .mode-option.active { background: rgba(225,196,113,.10); }
.mode-option strong { display: block; font-size: 13px; }
.mode-option small { display: block; margin-top: 3px; color: var(--muted); font-size: 11px; line-height: 1.35; }

.chat-stage { min-height: 0; position: relative; display: grid; grid-template-rows: minmax(0,1fr) auto; }
.message-scroll { min-height: 0; overflow-y: auto; overscroll-behavior: contain; scrollbar-gutter: stable; padding: 30px max(24px, calc((100% - var(--content-width)) / 2)); scroll-behavior: smooth; }
.welcome { min-height: 100%; display: grid; place-items: center; }
.welcome-card { width: min(680px, 100%); padding: 32px 0 90px; }
.welcome-mark { width: 48px; height: 48px; display: grid; place-items: center; border-radius: 15px; background: linear-gradient(145deg, var(--gold-soft), var(--gold)); color: var(--gold-ink); font-size: 24px; font-weight: 900; }
.welcome-card h2 { margin: 18px 0 7px; font-size: clamp(25px, 4vw, 36px); letter-spacing: -.035em; }
.welcome-card > p { margin: 0; color: var(--muted); line-height: 1.6; }
.prompt-chips { margin-top: 24px; display: grid; grid-template-columns: repeat(2,minmax(0,1fr)); gap: 10px; }
.prompt-chip { min-height: 66px; border: 1px solid var(--line); border-radius: 14px; background: rgba(255,255,255,.025); color: var(--text); cursor: pointer; padding: 12px 14px; text-align: left; line-height: 1.4; }
.prompt-chip:hover { background: rgba(255,255,255,.055); border-color: var(--line-strong); }

.message-row { width: min(var(--content-width), 100%); margin: 0 auto 24px; display: grid; grid-template-columns: 34px minmax(0,1fr); gap: 12px; align-items: start; }
.message-row.user { display: flex; justify-content: flex-end; }
.message-row.system { display: flex; justify-content: center; }
.message-avatar { width: 30px; height: 30px; border-radius: 50%; display: grid; place-items: center; background: rgba(225,196,113,.12); color: var(--gold-soft); font-size: 11px; font-weight: 850; }
.message-body { min-width: 0; }
.message-meta { margin: 1px 0 7px; color: var(--muted); font-size: 11.5px; }
.message-content { color: var(--text); font-size: 15px; line-height: 1.72; overflow-wrap: anywhere; }
.message-content p { margin: 0 0 13px; }
.message-content p:last-child { margin-bottom: 0; }
.message-content h2, .message-content h3, .message-content h4 { margin: 20px 0 9px; line-height: 1.35; }
.message-content h2 { font-size: 19px; }
.message-content h3 { font-size: 17px; }
.message-content h4 { font-size: 15px; }
.message-content ul, .message-content ol { margin: 10px 0 17px; padding-left: 24px; }
.message-content li { padding-left: 2px; }
.message-content li + li { margin-top: 10px; }
.message-content p + ul, .message-content p + ol,
.message-content h2 + ul, .message-content h3 + ul, .message-content h4 + ul,
.message-content h2 + ol, .message-content h3 + ol, .message-content h4 + ol { margin-top: 9px; }
.message-content ul + p, .message-content ol + p { margin-top: 16px; }
.message-content br { content: ""; display: block; margin-top: 5px; }
.message-content blockquote { margin: 12px 0; padding: 9px 13px; border-left: 3px solid var(--gold); color: var(--muted); background: rgba(225,196,113,.05); }
.message-content strong { color: #fff; }
.message-content pre { overflow-x: auto; padding: 12px; border-radius: 10px; background: #0b0b09; border: 1px solid var(--line); }
.message-row.user .message-body { max-width: min(74%, 680px); padding: 11px 15px; border-radius: 18px 18px 4px 18px; background: var(--surface-3); }
.message-row.user .message-meta { display: none; }
.message-row.user .message-content { font-size: 14.5px; line-height: 1.58; white-space: pre-wrap; }
.message-row.system .message-body { max-width: 680px; padding: 9px 12px; border-radius: 999px; background: rgba(255,255,255,.045); color: var(--muted); text-align: center; }
.message-row.system .message-meta, .message-row.system .message-avatar { display: none; }
.message-row.system .message-content { color: var(--muted); font-size: 12.5px; }
.message-actions { margin-top: 10px; display: flex; gap: 8px; flex-wrap: wrap; }
.message-action { border: 1px solid var(--line); border-radius: 999px; background: transparent; color: var(--muted); cursor: pointer; padding: 6px 10px; font-size: 11.5px; }
.message-action:hover { color: var(--gold-soft); border-color: var(--line-strong); }
.typing .message-content { color: var(--muted); font-style: italic; }
.streaming .message-content::after { content: "▌"; margin-left: 2px; color: var(--gold); animation: caret .9s steps(1,end) infinite; }
@keyframes caret { 50% { opacity: 0; } }
.jump-latest { position: absolute; right: max(22px, calc((100% - var(--content-width)) / 2)); bottom: 128px; z-index: 6; border: 1px solid var(--line-strong); border-radius: 999px; background: var(--surface-2); color: var(--gold-soft); padding: 8px 12px; cursor: pointer; box-shadow: var(--shadow); }
.jump-latest[hidden] { display: none; }

.composer-area { padding: 10px max(16px, calc((100% - var(--content-width)) / 2)) max(12px, env(safe-area-inset-bottom)); background: linear-gradient(180deg, rgba(16,16,13,0), var(--bg) 22%); }
.composer { width: 100%; }
.composer-context { min-height: 27px; padding: 0 8px 6px; display: flex; gap: 7px; align-items: center; }
.context-chip { border: 0; border-radius: 999px; background: transparent; color: var(--gold-soft); cursor: pointer; padding: 4px 7px; display: flex; align-items: center; gap: 6px; font-size: 11px; }
.context-chip:hover { background: rgba(255,255,255,.045); }
.context-chip.subtle { color: var(--muted); }
.context-chip-dot { width: 6px; height: 6px; border-radius: 50%; background: var(--gold); }
.composer-box { min-height: 58px; border: 1px solid var(--line); border-radius: 20px; background: var(--surface); padding: 10px 10px 10px 16px; display: flex; align-items: flex-end; gap: 10px; box-shadow: 0 12px 34px rgba(0,0,0,.22); }
.composer-box:focus-within { border-color: var(--line-strong); box-shadow: 0 0 0 3px rgba(225,196,113,.06), 0 12px 34px rgba(0,0,0,.22); }
textarea { min-width: 0; flex: 1; min-height: 28px; max-height: 180px; resize: none; overflow-y: auto; border: 0; outline: 0; background: transparent; color: var(--text); padding: 4px 0; line-height: 1.5; }
textarea::placeholder { color: #77746b; }
.send-button { width: 38px; height: 38px; flex: 0 0 auto; border: 0; border-radius: 12px; background: var(--gold-soft); color: var(--gold-ink); cursor: pointer; display: grid; place-items: center; font-size: 21px; font-weight: 900; }
.send-button:hover { filter: brightness(1.04); }
.send-button:disabled { opacity: .42; cursor: not-allowed; }
.composer-note { margin: 7px 0 0; color: var(--faint); text-align: center; font-size: 10.5px; }

.sidebar-backdrop, .drawer-backdrop { position: fixed; inset: 0; background: rgba(0,0,0,.52); z-index: 70; backdrop-filter: blur(2px); }
.sidebar-backdrop[hidden], .drawer-backdrop[hidden] { display: none; }
.context-drawer { position: fixed; top: 0; right: 0; bottom: 0; width: min(var(--drawer-width), 94vw); z-index: 80; border-left: 1px solid var(--line); background: var(--sidebar); box-shadow: var(--shadow); display: grid; grid-template-rows: auto auto minmax(0,1fr); transform: translateX(105%); transition: transform .23s ease; }
.context-drawer.open { transform: translateX(0); }
.drawer-header { min-height: 72px; padding: 15px 17px; border-bottom: 1px solid var(--line); display: flex; align-items: center; justify-content: space-between; }
.drawer-header h2 { margin: 3px 0 0; font-size: 19px; }
.drawer-eyebrow, .muted-label { color: var(--muted); font-size: 11px; }
.drawer-tabs { padding: 10px 14px 0; display: grid; grid-template-columns: 1fr 1fr; gap: 6px; }
.drawer-tab { border: 0; border-radius: 10px; background: transparent; color: var(--muted); cursor: pointer; padding: 9px 10px; font-weight: 700; }
.drawer-tab.active { background: var(--surface-2); color: var(--text); }
.drawer-body { min-height: 0; overflow-y: auto; padding: 14px; }
.drawer-panel { display: none; }
.drawer-panel.active { display: block; }
.profile-progress-card, .context-section { border: 1px solid var(--line); border-radius: 14px; background: rgba(255,255,255,.025); padding: 14px; }
.context-section { margin-top: 10px; }
.profile-progress-head { display: flex; justify-content: space-between; gap: 12px; align-items: flex-start; }
.profile-progress-head strong { display: block; margin-top: 2px; font-size: 25px; }
.readiness-badge { border-radius: 999px; padding: 6px 9px; background: rgba(233,154,149,.10); color: var(--danger); font-size: 10.5px; }
.readiness-badge.ready { background: rgba(140,197,160,.10); color: var(--success); }
.progress-track { height: 6px; margin-top: 12px; border-radius: 999px; background: rgba(255,255,255,.07); overflow: hidden; }
.progress-track span { display: block; width: 0; height: 100%; background: linear-gradient(90deg,var(--gold),var(--gold-soft)); transition: width .25s ease; }
.profile-progress-card p { margin: 10px 0 0; color: var(--faint); font-size: 11px; line-height: 1.45; }
.context-section-title { margin-bottom: 10px; color: var(--muted); font-size: 11px; font-weight: 750; text-transform: uppercase; letter-spacing: .08em; }
.profile-fields { margin: 0; display: grid; }
.profile-field { min-width: 0; padding: 8px 0; border-bottom: 1px solid rgba(255,255,255,.055); display: grid; grid-template-columns: 115px minmax(0,1fr); gap: 10px; }
.profile-field:last-child { border-bottom: 0; }
.profile-field dt { color: var(--muted); font-size: 12px; }
.profile-field dd { margin: 0; text-align: right; overflow-wrap: anywhere; font-size: 12.5px; }
.profile-field.missing dd { color: var(--faint); }
.context-copy { margin: 0; color: var(--text); font-size: 13px; line-height: 1.55; }
.scope-card { display: grid; gap: 7px; }
.scope-card span { color: var(--gold-soft); font-size: 12px; }
.scope-card strong { font-size: 13px; line-height: 1.55; }
.tag-list { display: flex; flex-wrap: wrap; gap: 7px; }
.tag { border: 1px solid var(--line); border-radius: 999px; padding: 6px 9px; color: var(--muted); background: var(--surface); font-size: 11px; }
.tag.missing { border-color: rgba(233,154,149,.22); color: #eab2ae; }
.drawer-primary-button { width: 100%; min-height: 44px; margin-top: 12px; border: 0; border-radius: 12px; background: var(--gold-soft); color: var(--gold-ink); cursor: pointer; font-weight: 800; }
.guide-hero { display: flex; align-items: center; gap: 12px; padding: 8px 2px 14px; }
.guide-icon { width: 44px; height: 44px; border-radius: 13px; display: grid; place-items: center; background: rgba(225,196,113,.12); color: var(--gold-soft); font-weight: 850; }
.guide-hero h3 { margin: 3px 0 0; font-size: 18px; }
.guide-intro { margin: 0 2px 12px; color: var(--muted); line-height: 1.62; font-size: 13px; }
.guide-list { margin: 0; padding-left: 19px; color: var(--text); font-size: 13px; line-height: 1.55; }
.guide-list li + li { margin-top: 7px; }
.sample-question { margin: 0; padding-left: 12px; border-left: 3px solid var(--gold); color: var(--muted); font-size: 13px; line-height: 1.55; }

@media (max-width: 900px) {
  .app-shell, .app-shell.sidebar-collapsed { grid-template-columns: minmax(0,1fr); }
  .sidebar { position: fixed; inset: 0 auto 0 0; width: min(320px, 88vw); transform: translateX(-105%); box-shadow: var(--shadow); z-index: 75; }
  .sidebar.mobile-open { transform: translateX(0); }
  .sidebar .brand-panel-image { display: block; }
  .sidebar .nav-copy, .sidebar .sidebar-label, .sidebar .recent-section { display: initial; }
  .sidebar .brand-logo-image { display: none; }
  .sidebar .brand { flex: 1 1 auto; justify-content: flex-start; overflow: hidden; }
  .sidebar .sidebar-head { min-height: 70px; justify-content: space-between; }
  .sidebar .sidebar-collapse { display: none; }
  .sidebar .discipline-item { grid-template-columns: 28px minmax(0,1fr); padding: 9px 10px; }
  .sidebar .discipline-copy { display: block; }
  .sidebar .profile-summary { grid-template-columns: 34px minmax(0,1fr) 18px; }
  .mobile-menu-button { display: grid; }
  .active-heading p { display: none; }
  .active-heading h1 { max-width: 42vw; }
  .message-scroll { padding-inline: 18px; }
  .composer-area { padding-inline: 12px; }
  .jump-latest { right: 15px; }
}

@media (max-width: 640px) {
  :root { --topbar-height: 58px; }
  .topbar { padding: 0 9px; }
  .topbar-actions { gap: 2px; }
  .topbar-actions .icon-button { width: 32px; height: 32px; }
  .mode-trigger { min-height: 32px; padding: 0 9px; }
  .active-heading h1 { max-width: 40vw; font-size: 14px; }
  .live-dot { display: none; }
  .message-scroll { padding: 22px 14px 18px; }
  .message-row { margin-bottom: 20px; grid-template-columns: 28px minmax(0,1fr); gap: 9px; }
  .message-avatar { width: 26px; height: 26px; }
  .message-content { font-size: 14.5px; line-height: 1.68; }
  .message-row.user .message-body { max-width: 88%; }
  .welcome-card { padding: 24px 3px 74px; }
  .prompt-chips { grid-template-columns: 1fr; }
  .composer-area { padding: 8px 8px max(8px, env(safe-area-inset-bottom)); }
  .composer-context { padding-inline: 5px; overflow-x: auto; white-space: nowrap; }
  .composer-box { min-height: 54px; border-radius: 17px; padding-left: 13px; }
  .composer-note { display: none; }
  .context-drawer { top: auto; left: 0; right: 0; bottom: 0; width: 100%; height: min(84dvh, 760px); border-left: 0; border-top: 1px solid var(--line); border-radius: 20px 20px 0 0; transform: translateY(105%); }
  .context-drawer.open { transform: translateY(0); }
  .drawer-header { min-height: 64px; }
  .mode-menu { position: fixed; top: 62px; right: 8px; }
}

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

/* =====================================================
   v6.5 · Account, onboarding and persistent conversations
   ===================================================== */
.account-button { border: 1px solid var(--line); background: var(--surface); font-size: 11px; font-weight: 800; color: var(--gold-soft); }
.history-head { margin: 8px 6px 6px 10px; display: flex; align-items: center; justify-content: space-between; gap: 8px; }
.history-head .sidebar-label { margin: 0; }
.history-refresh, .history-delete { border: 0; background: transparent; color: var(--faint); cursor: pointer; border-radius: 8px; }
.history-refresh { width: 26px; height: 26px; }
.history-refresh:hover, .history-delete:hover { color: var(--text); background: rgba(255,255,255,.06); }
.recent-section { min-height: 0; flex: 1 1 240px; display: grid; grid-template-rows: auto minmax(0,1fr); }
.recent-threads { min-height: 0; overflow-y: auto; overscroll-behavior: contain; padding-right: 2px; align-content: start; }
.history-group { margin: 12px 9px 4px; color: var(--faint); font-size: 10px; font-weight: 750; text-transform: uppercase; letter-spacing: .08em; }
.history-row { min-width: 0; display: grid; grid-template-columns: minmax(0,1fr) 26px; align-items: center; border-radius: 10px; }
.history-row:hover, .history-row.active { background: rgba(255,255,255,.055); }
.history-row.active { box-shadow: inset 2px 0 0 var(--gold); }
.history-link { min-width: 0; padding: 8px 5px 8px 9px; color: var(--muted); text-decoration: none; display: grid; grid-template-columns: 18px minmax(0,1fr); gap: 6px; align-items: center; }
.history-row.active .history-link { color: var(--text); }
.history-icon { color: var(--faint); font-size: 11px; }
.history-title { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-size: 12.5px; }
.history-delete { width: 24px; height: 24px; font-size: 16px; }
.history-empty { margin: 8px 10px; color: var(--faint); font-size: 11.5px; line-height: 1.45; }

.drawer-tabs { grid-template-columns: repeat(3, minmax(0,1fr)); }
.context-footnote { margin: 8px 0 0; color: var(--faint); font-size: 11.5px; line-height: 1.45; }
.account-card { border: 1px solid var(--line); border-radius: 15px; background: rgba(255,255,255,.025); padding: 15px; display: flex; align-items: center; gap: 12px; }
.account-large-avatar { width: 48px; height: 48px; flex: 0 0 auto; display: grid; place-items: center; border-radius: 50%; background: var(--surface-3); color: var(--gold-soft); font-weight: 850; }
.account-card strong { display: block; font-size: 15px; }
.account-card p { margin: 4px 0 0; color: var(--muted); font-size: 12px; overflow-wrap: anywhere; }
.drawer-secondary-button, .drawer-danger-button { width: 100%; min-height: 42px; margin-top: 9px; border: 1px solid var(--line); border-radius: 12px; background: transparent; color: var(--text); cursor: pointer; font-weight: 720; }
.drawer-secondary-button:hover { background: rgba(255,255,255,.05); border-color: var(--line-strong); }
.drawer-danger-button { color: var(--danger); border-color: rgba(233,154,149,.23); }
.drawer-danger-button:hover { background: rgba(233,154,149,.08); }
.account-policy { margin: 14px 0 0; text-align: center; font-size: 11.5px; }
.account-policy a, .auth-note a { color: var(--gold-soft); }

.onboarding-overlay { position: fixed; inset: 0; z-index: 120; padding: max(18px, env(safe-area-inset-top)) 16px max(18px, env(safe-area-inset-bottom)); background: rgba(8,8,7,.82); backdrop-filter: blur(14px); display: grid; place-items: center; overflow-y: auto; }
.onboarding-overlay[hidden] { display: none; }
.onboarding-card { position: relative; width: min(680px, 100%); max-height: min(920px, calc(100dvh - 32px)); overflow-y: auto; border: 1px solid var(--line); border-radius: 24px; background: #191914; box-shadow: var(--shadow); padding: 24px; }
.auth-close-button { position: absolute; top: 15px; right: 15px; width: 36px; height: 36px; border: 0; border-radius: 10px; background: transparent; color: var(--muted); cursor: pointer; font-size: 22px; line-height: 1; }
.auth-close-button:hover { background: rgba(255,255,255,.055); color: var(--text); }
.auth-method-placeholder { width: min(420px, 100%); min-height: 44px; margin: 0 auto; display: block; border: 1px solid var(--line); border-radius: 999px; background: rgba(255,255,255,.025); color: var(--faint); font-weight: 760; }
.auth-method-placeholder[hidden] { display: none; }
.auth-availability { width: min(420px, 100%); margin: 13px auto 0; border: 1px solid var(--line); border-radius: 11px; background: rgba(255,255,255,.025); color: var(--muted); padding: 10px 12px; font-size: 11.5px; line-height: 1.5; }
.auth-availability.ready { border-color: rgba(140,197,160,.22); color: var(--success); }
.auth-availability.warning { border-color: rgba(225,196,113,.22); color: var(--gold-soft); }
.auth-form input:disabled, .auth-form button:disabled { opacity: .48; cursor: not-allowed; }
.onboarding-brand { width: min(500px, calc(100% - 44px)); margin: 0 auto 24px; display: grid; justify-items: center; gap: 8px; }
.onboarding-brand-panel { display: block; width: 100%; height: auto; border-radius: 18px; object-fit: contain; }
.onboarding-brand-note { margin: 0; color: var(--muted); font-size: 11px; letter-spacing: .02em; text-align: center; }
.onboarding-view[hidden], .wizard-step:not(.active), [hidden] { display: none !important; }
.onboarding-copy { text-align: center; }
.eyebrow { color: var(--gold); font-size: 10.5px; font-weight: 800; text-transform: uppercase; letter-spacing: .11em; }
.onboarding-copy h2, .wizard-head h2 { margin: 7px 0 8px; font-size: clamp(24px, 4vw, 32px); letter-spacing: -.03em; }
.onboarding-copy p { max-width: 480px; margin: 0 auto 22px; color: var(--muted); line-height: 1.6; font-size: 13.5px; }
.google-button-wrap { display: flex; justify-content: center; min-height: 44px; }
.auth-divider { margin: 18px 0; display: flex; align-items: center; gap: 12px; color: var(--faint); font-size: 11px; }
.auth-divider::before, .auth-divider::after { content: ""; flex: 1; height: 1px; background: var(--line); }
.auth-form { max-width: 420px; margin: 0 auto; display: grid; gap: 12px; }
.onboarding-card label, .onboarding-card fieldset { color: var(--muted); font-size: 12px; }
.onboarding-card label { display: grid; gap: 7px; }
.onboarding-card input, .onboarding-card select { min-width: 0; width: 100%; min-height: 44px; border: 1px solid var(--line); border-radius: 11px; background: var(--surface); color: var(--text); padding: 10px 12px; outline: 0; }
.onboarding-card input:focus, .onboarding-card select:focus { border-color: var(--line-strong); box-shadow: 0 0 0 3px rgba(225,196,113,.06); }
.onboarding-primary, .onboarding-secondary, .text-button { border-radius: 12px; cursor: pointer; font-weight: 780; }
.onboarding-primary { min-height: 46px; border: 0; background: var(--gold-soft); color: var(--gold-ink); padding: 0 18px; }
.onboarding-secondary { min-height: 44px; border: 1px solid var(--line); background: transparent; color: var(--text); padding: 0 18px; }
#guestContinueBtn { width: min(420px, 100%); margin: 12px auto 0; display: block; }
.text-button { border: 0; background: transparent; color: var(--gold-soft); padding: 7px 8px; }
.auth-note, .form-hint { color: var(--faint); font-size: 11.5px; line-height: 1.5; text-align: center; }
.wizard-head { display: flex; align-items: flex-start; justify-content: space-between; gap: 16px; }
.wizard-head h2 { font-size: 25px; }
.wizard-progress { height: 5px; margin: 12px 0 24px; border-radius: 999px; background: rgba(255,255,255,.06); overflow: hidden; }
.wizard-progress span { display: block; width: 33.333%; height: 100%; background: linear-gradient(90deg,var(--gold),var(--gold-soft)); transition: width .2s ease; }
.wizard-step { display: grid; gap: 15px; }
.wizard-lead { margin: 0; color: var(--muted); font-size: 13px; line-height: 1.55; }
.onboarding-card fieldset { margin: 0; border: 1px solid var(--line); border-radius: 14px; padding: 13px; }
.onboarding-card legend { color: var(--text); padding: 0 7px; font-weight: 730; }
.date-grid { display: grid; grid-template-columns: repeat(3,minmax(0,1fr)); gap: 8px; }
.segmented { margin-top: 10px; display: grid; grid-template-columns: 1fr 1fr; gap: 7px; }
.segmented label, .choice-card { cursor: pointer; }
.segmented input, .choice-card input { position: absolute; opacity: 0; pointer-events: none; }
.segmented span { min-height: 40px; border: 1px solid var(--line); border-radius: 10px; display: grid; place-items: center; color: var(--muted); }
.segmented input:checked + span { border-color: var(--line-strong); background: rgba(225,196,113,.10); color: var(--gold-soft); }
.check-row { display: flex !important; grid-template-columns: auto 1fr; align-items: flex-start; gap: 9px !important; line-height: 1.45; }
.check-row input { width: 17px; height: 17px; min-height: 0; margin: 1px 0 0; accent-color: var(--gold); }
.field-help { margin: -4px 0 0; color: var(--faint); font-size: 11.5px; line-height: 1.5; }
.two-col { display: grid; grid-template-columns: repeat(2,minmax(0,1fr)); gap: 12px; }
.time-choice-grid, .focus-grid { display: grid; grid-template-columns: repeat(3,minmax(0,1fr)); gap: 9px; }
.focus-grid { grid-template-columns: repeat(2,minmax(0,1fr)); }
.choice-card > span { min-height: 92px; border: 1px solid var(--line); border-radius: 13px; padding: 13px; display: grid; align-content: center; gap: 5px; background: rgba(255,255,255,.02); }
.choice-card input:checked + span { border-color: var(--line-strong); background: rgba(225,196,113,.09); box-shadow: inset 0 0 0 1px rgba(225,196,113,.08); }
.choice-card strong { color: var(--text); font-size: 13px; }
.choice-card small { color: var(--faint); font-size: 11px; line-height: 1.35; }
.optional { color: var(--faint); font-size: 10.5px; }
.consent-row { border: 1px solid var(--line); border-radius: 12px; padding: 12px; color: var(--muted) !important; }
.wizard-actions { margin-top: 23px; display: flex; justify-content: flex-end; gap: 9px; }
.wizard-actions .onboarding-secondary { margin-right: auto; }
.toast { position: fixed; right: 18px; bottom: 18px; z-index: 150; max-width: min(420px, calc(100vw - 36px)); border: 1px solid var(--line-strong); border-radius: 13px; background: var(--surface-2); color: var(--text); padding: 12px 14px; box-shadow: var(--shadow); font-size: 12.5px; line-height: 1.45; }
.toast.error { border-color: rgba(233,154,149,.35); color: #f0b8b4; }

@media (max-width: 900px) {
  .recent-section { flex-basis: 180px; }
}

@media (max-width: 640px) {
  .onboarding-overlay { padding: 0; display: block; background: #191914; }
  .onboarding-card { width: 100%; min-height: 100dvh; max-height: none; border: 0; border-radius: 0; padding: max(18px, env(safe-area-inset-top)) 17px max(18px, env(safe-area-inset-bottom)); }
  .time-choice-grid { grid-template-columns: 1fr; }
  .focus-grid, .two-col { grid-template-columns: 1fr; }
  .choice-card > span { min-height: 70px; }
  .date-grid { gap: 6px; }
  .wizard-actions { position: sticky; bottom: 0; padding-top: 12px; background: linear-gradient(180deg, rgba(25,25,20,0), #191914 24%); }
  .toast { left: 10px; right: 10px; bottom: max(10px, env(safe-area-inset-bottom)); max-width: none; }
}
.load-older-wrap { display: flex; justify-content: center; margin: -10px 0 22px; }
.load-older-button { border: 1px solid var(--line); border-radius: 999px; background: var(--surface); color: var(--muted); padding: 8px 13px; cursor: pointer; font-size: 11.5px; }
.load-older-button:hover { color: var(--gold-soft); border-color: var(--line-strong); }
.load-older-button:disabled { opacity: .55; cursor: wait; }

/* v6.5.3 · Vietnamese civil-date input */
.input-hint { display: block; color: var(--faint); font-size: 10.8px; line-height: 1.45; }
#documentBirthDate[aria-invalid="true"] { border-color: rgba(233,154,149,.55); box-shadow: 0 0 0 3px rgba(233,154,149,.08); }
