:root {
  --bg: #060911;
  --bg-2: #0b1020;
  --panel: rgba(18, 24, 42, 0.62);
  --panel-strong: rgba(22, 29, 52, 0.85);
  --line: rgba(148, 163, 214, 0.14);
  --line-strong: rgba(148, 163, 214, 0.26);
  --text: #e8ebf5;
  --muted: #8b94ad;
  --faint: #5d6680;
  --cyan: #5ce1e6;
  --violet: #8b5cf6;
  --pink: #f472b6;
  --amber: #fbbf24;
  --green: #34d399;
  --grad: linear-gradient(120deg, var(--cyan), var(--violet) 55%, var(--pink));
  --on-grad: #0b0f1c;
  --radius: 18px;
  --shadow: 0 20px 60px -20px rgba(0, 0, 0, 0.7), 0 0 0 1px var(--line);
  --font: -apple-system, BlinkMacSystemFont, "SF Pro Display", "Inter", "Segoe UI", system-ui, sans-serif;
  --mono: "SF Mono", ui-monospace, "JetBrains Mono", Menlo, monospace;
  --fill: rgba(255, 255, 255, 0.03);
  --fill-2: rgba(255, 255, 255, 0.045);
  --fill-3: rgba(255, 255, 255, 0.09);
  --strong: #ffffff;
  --body: #dfe3f0;
  --sub: #b6bdd2;
  --violet-text: #c4b5fd;
  --cyan-text: #5ce1e6;
  --amber-text: #fbbf24;
  --green-text: #34d399;
  --mark-text: #e6fdff;
  --error-text: #fecaca;
  --error-bg: rgba(127, 29, 29, 0.25);
  --menu-bg: #111830;
  --topbar-bg: rgba(6, 9, 17, 0.55);
  --drawer-bg: rgba(10, 14, 26, 0.92);
  --scrim: rgba(3, 5, 10, 0.55);
  --card: rgba(18, 24, 42, 0.5);
  --card-hover: rgba(22, 30, 52, 0.75);
  --shadow-color: rgba(0, 0, 0, 0.8);
  --grid: rgba(148, 163, 214, 0.05);
  --thumb: #cbd5e1;
  --aurora-opacity: 0.55;
  --aurora-blend: screen;
  --brand-glow: rgba(139, 92, 246, 0.55);
  color-scheme: dark;
}

/* Light theme: chosen explicitly, or following the system when no choice is saved. */
:root[data-theme="light"] {
  --bg: #f5f6fb;
  --bg-2: #eceef7;
  --panel: rgba(255, 255, 255, 0.72);
  --panel-strong: rgba(255, 255, 255, 0.94);
  --line: rgba(30, 41, 82, 0.1);
  --line-strong: rgba(30, 41, 82, 0.18);
  --text: #111629;
  --muted: #5a6380;
  --faint: #8890a6;
  --shadow: 0 18px 50px -26px rgba(30, 41, 82, 0.35), 0 0 0 1px var(--line);
  --fill: rgba(15, 23, 42, 0.03);
  --fill-2: rgba(15, 23, 42, 0.045);
  --fill-3: rgba(15, 23, 42, 0.09);
  --strong: #0a0e1c;
  --body: #2a3149;
  --sub: #4b546f;
  --violet-text: #6d28d9;
  --cyan-text: #0e7490;
  --amber-text: #b45309;
  --green-text: #047857;
  --mark-text: #083344;
  --error-text: #991b1b;
  --error-bg: rgba(254, 226, 226, 0.8);
  --menu-bg: #ffffff;
  --topbar-bg: rgba(245, 246, 251, 0.7);
  --drawer-bg: rgba(250, 251, 255, 0.96);
  --scrim: rgba(15, 23, 42, 0.25);
  --card: rgba(255, 255, 255, 0.7);
  --card-hover: rgba(255, 255, 255, 0.95);
  --shadow-color: rgba(30, 41, 82, 0.28);
  --grid: rgba(30, 41, 82, 0.05);
  --thumb: #ffffff;
  --aurora-opacity: 0.32;
  --aurora-blend: normal;
  --brand-glow: rgba(139, 92, 246, 0.35);
  --grad: linear-gradient(120deg, #0891b2, #7c3aed 55%, #db2777);
  --on-grad: #ffffff;
  color-scheme: light;
}
@media (prefers-color-scheme: light) {
  :root:not([data-theme="dark"]) {
    --bg: #f5f6fb;
    --bg-2: #eceef7;
    --panel: rgba(255, 255, 255, 0.72);
    --panel-strong: rgba(255, 255, 255, 0.94);
    --line: rgba(30, 41, 82, 0.1);
    --line-strong: rgba(30, 41, 82, 0.18);
    --text: #111629;
    --muted: #5a6380;
    --faint: #8890a6;
    --shadow: 0 18px 50px -26px rgba(30, 41, 82, 0.35), 0 0 0 1px var(--line);
    --fill: rgba(15, 23, 42, 0.03);
    --fill-2: rgba(15, 23, 42, 0.045);
    --fill-3: rgba(15, 23, 42, 0.09);
    --strong: #0a0e1c;
    --body: #2a3149;
    --sub: #4b546f;
    --violet-text: #6d28d9;
    --cyan-text: #0e7490;
    --amber-text: #b45309;
    --green-text: #047857;
    --mark-text: #083344;
    --error-text: #991b1b;
    --error-bg: rgba(254, 226, 226, 0.8);
    --menu-bg: #ffffff;
    --topbar-bg: rgba(245, 246, 251, 0.7);
    --drawer-bg: rgba(250, 251, 255, 0.96);
    --scrim: rgba(15, 23, 42, 0.25);
    --card: rgba(255, 255, 255, 0.7);
    --card-hover: rgba(255, 255, 255, 0.95);
    --shadow-color: rgba(30, 41, 82, 0.28);
    --grid: rgba(30, 41, 82, 0.05);
    --thumb: #ffffff;
    --aurora-opacity: 0.32;
    --aurora-blend: normal;
    --brand-glow: rgba(139, 92, 246, 0.35);
    --grad: linear-gradient(120deg, #0891b2, #7c3aed 55%, #db2777);
    --on-grad: #ffffff;
    color-scheme: light;
}
}


* { box-sizing: border-box; }
html, body { margin: 0; background: var(--bg); color: var(--text); font-family: var(--font); -webkit-font-smoothing: antialiased; }
body { min-height: 100vh; overflow-x: hidden; }
a { color: inherit; text-decoration: none; }
[hidden] { display: none !important; }
::selection { background: rgba(139, 92, 246, 0.4); }

/* ---------- Background ---------- */
.aurora { position: fixed; inset: -20%; z-index: 0; pointer-events: none; filter: blur(80px) saturate(140%); opacity: var(--aurora-opacity); }
.aurora span { position: absolute; border-radius: 50%; mix-blend-mode: var(--aurora-blend); animation: drift 28s ease-in-out infinite alternate; }
.aurora span:nth-child(1) { width: 52vw; height: 52vw; left: 8%; top: -6%; background: radial-gradient(circle, rgba(92,225,230,.55), transparent 62%); }
.aurora span:nth-child(2) { width: 46vw; height: 46vw; right: 2%; top: 6%; background: radial-gradient(circle, rgba(139,92,246,.6), transparent 62%); animation-duration: 34s; animation-delay: -8s; }
.aurora span:nth-child(3) { width: 40vw; height: 40vw; left: 30%; bottom: -14%; background: radial-gradient(circle, rgba(244,114,182,.38), transparent 62%); animation-duration: 40s; animation-delay: -16s; }
@keyframes drift {
  0% { transform: translate3d(0,0,0) scale(1); }
  50% { transform: translate3d(4vw,3vh,0) scale(1.12); }
  100% { transform: translate3d(-3vw,-2vh,0) scale(.95); }
}
.grid-overlay {
  position: fixed; inset: 0; z-index: 0; pointer-events: none;
  background-image: linear-gradient(var(--grid) 1px, transparent 1px), linear-gradient(90deg, var(--grid) 1px, transparent 1px);
  background-size: 48px 48px;
  mask-image: radial-gradient(ellipse 80% 60% at 50% 20%, #000 30%, transparent 75%);
}

/* ---------- Top bar ---------- */
.topbar {
  position: sticky; top: 0; z-index: 20; display: flex; align-items: center; gap: 24px;
  padding: 14px 28px; background: var(--topbar-bg); backdrop-filter: blur(18px) saturate(160%);
  border-bottom: 1px solid var(--line);
}
.brand { display: flex; align-items: center; gap: 10px; }
.brand-mark { width: 32px; height: 32px; filter: drop-shadow(0 0 10px var(--brand-glow)); }
.brand-word { font-weight: 800; letter-spacing: .32em; font-size: 15px; background: var(--grad); -webkit-background-clip: text; background-clip: text; color: transparent; }

.tabs { position: relative; display: flex; gap: 4px; padding: 4px; border-radius: 12px; background: var(--fill); border: 1px solid var(--line); }
.tab { position: relative; z-index: 1; padding: 7px 16px; border-radius: 9px; font-size: 14px; font-weight: 550; color: var(--muted); transition: color .2s; }
.tab:hover { color: var(--text); }
.tab.active { color: var(--text); }
.tab-glider { position: absolute; z-index: 0; top: 4px; bottom: 4px; border-radius: 9px; background: linear-gradient(120deg, rgba(92,225,230,.18), rgba(139,92,246,.28)); box-shadow: inset 0 0 0 1px rgba(139,92,246,.45), 0 0 18px -4px rgba(139,92,246,.6); transition: left .35s cubic-bezier(.2,.9,.2,1), width .35s cubic-bezier(.2,.9,.2,1); }

.topbar-right { margin-left: auto; display: flex; align-items: center; gap: 14px; }
.stat-pill { display: flex; align-items: center; gap: 8px; padding: 7px 12px; border-radius: 999px; font-size: 12.5px; color: var(--muted); background: var(--fill); border: 1px solid var(--line); font-variant-numeric: tabular-nums; }
.live-dot { width: 7px; height: 7px; border-radius: 50%; background: var(--green); box-shadow: 0 0 0 0 rgba(52,211,153,.6); animation: pulse 2.4s infinite; }
@keyframes pulse { 0% { box-shadow: 0 0 0 0 rgba(52,211,153,.55); } 70% { box-shadow: 0 0 0 8px rgba(52,211,153,0); } 100% { box-shadow: 0 0 0 0 rgba(52,211,153,0); } }
.viewer { display: flex; align-items: center; gap: 8px; font-size: 12.5px; color: var(--muted); }
.viewer select {
  appearance: none; background: var(--fill-2) url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 12 12'%3E%3Cpath d='M3 4.5l3 3 3-3' fill='none' stroke='%238b94ad' stroke-width='1.5'/%3E%3C/svg%3E") no-repeat right 10px center / 12px;
  color: var(--text); border: 1px solid var(--line-strong); border-radius: 10px; padding: 7px 30px 7px 12px; font: inherit; font-size: 13px; cursor: pointer;
}
.viewer select:focus { outline: none; border-color: var(--violet); }

/* ---------- Layout ---------- */
main { position: relative; z-index: 1; max-width: 920px; margin: 0 auto; padding: 0 24px 120px; }
.view { animation: rise .5s cubic-bezier(.2,.9,.2,1) both; }
@keyframes rise { from { opacity: 0; transform: translateY(14px); } to { opacity: 1; transform: none; } }

.hero { text-align: center; padding: 11vh 0 34px; transition: padding .5s cubic-bezier(.2,.9,.2,1), opacity .4s; }
.hero.compact { padding: 32px 0 18px; }
.hero.compact .lede, .hero.compact .eyebrow { display: none; }
.hero.compact h1 { font-size: 22px; }
.eyebrow { display: inline-flex; align-items: center; gap: 8px; margin: 0 0 18px; padding: 6px 14px; border-radius: 999px; font-size: 12px; letter-spacing: .14em; text-transform: uppercase; color: var(--violet-text); background: rgba(139,92,246,.1); border: 1px solid rgba(139,92,246,.3); }
.spark { width: 6px; height: 6px; border-radius: 50%; background: var(--cyan); box-shadow: 0 0 12px var(--cyan); }
h1 { margin: 0; font-size: clamp(36px, 6vw, 58px); line-height: 1.04; letter-spacing: -.035em; font-weight: 750; transition: font-size .4s; }
.grad { background: var(--grad); -webkit-background-clip: text; background-clip: text; color: transparent; }
.lede { margin: 18px auto 0; max-width: 600px; text-wrap: balance; color: var(--muted); font-size: 17px; line-height: 1.55; }

.section-head { padding: 48px 0 22px; }
.section-head h2 { margin: 0 0 6px; font-size: 30px; letter-spacing: -.02em; }
.muted { color: var(--muted); margin: 0; }

/* ---------- Command bar ---------- */
.command { position: relative; isolation: isolate; display: flex; align-items: center; gap: 12px; padding: 8px 8px 8px 20px; border-radius: 20px; background: transparent; backdrop-filter: blur(20px); box-shadow: var(--shadow); }
.command-glow { position: absolute; inset: -1px; z-index: -2; border-radius: 21px; background: var(--grad); opacity: .35; filter: blur(0); transition: opacity .3s, filter .3s; }
.command:focus-within .command-glow { opacity: .9; filter: blur(10px); }
.command::before { content: ""; position: absolute; inset: 1px; border-radius: 19px; background: var(--panel-strong); z-index: -1; }
.command-icon { width: 22px; height: 22px; color: var(--cyan-text); flex: none; filter: drop-shadow(0 0 6px rgba(92,225,230,.6)); }
.command input { flex: 1; min-width: 0; background: none; border: 0; outline: 0; color: var(--text); font: inherit; font-size: 17px; padding: 12px 0; }
.command input::placeholder { color: var(--faint); }
.command.compact input { font-size: 16px; }
.kbd { font-family: var(--mono); font-size: 12px; color: var(--muted); padding: 3px 8px; border-radius: 6px; border: 1px solid var(--line-strong); background: var(--fill-2); }
.go { flex: none; width: 46px; height: 46px; border-radius: 14px; border: 0; cursor: pointer; color: var(--on-grad); background: var(--grad); display: grid; place-items: center; box-shadow: 0 6px 22px -6px rgba(139,92,246,.8); transition: transform .15s, filter .2s; }
.go svg { width: 20px; height: 20px; }
.go:hover { transform: translateY(-1px); filter: brightness(1.1); }
.go:active { transform: translateY(1px) scale(.97); }
.go:disabled { filter: grayscale(.8) brightness(.7); cursor: progress; }

.suggestions { display: flex; flex-wrap: wrap; justify-content: center; gap: 8px; margin: 18px 0 0; }
.chip { padding: 8px 14px; border-radius: 999px; font-size: 13px; color: var(--muted); background: var(--fill); border: 1px solid var(--line); cursor: pointer; transition: all .2s; }
.chip:hover { color: var(--text); border-color: rgba(139,92,246,.5); background: rgba(139,92,246,.1); transform: translateY(-1px); }

/* ---------- Conversation ---------- */
.conversation { display: flex; flex-direction: column; gap: 28px; margin-top: 30px; }
.turn { animation: rise .45s cubic-bezier(.2,.9,.2,1) both; }
.question { display: flex; align-items: flex-start; gap: 12px; margin-bottom: 14px; }
.avatar { flex: none; width: 30px; height: 30px; border-radius: 10px; display: grid; place-items: center; font-size: 12px; font-weight: 700; color: #0b0f1c; background: linear-gradient(135deg, #e2e8f0, #94a3b8); }
.question-text { font-size: 19px; font-weight: 600; letter-spacing: -.01em; line-height: 1.4; padding-top: 3px; }

.answer-card { position: relative; padding: 22px 24px; border-radius: var(--radius); background: var(--panel); backdrop-filter: blur(20px) saturate(140%); box-shadow: var(--shadow); overflow: hidden; }
.answer-card::before { content: ""; position: absolute; left: 0; top: 0; bottom: 0; width: 3px; background: var(--grad); box-shadow: 0 0 18px rgba(139,92,246,.8); }
.answer-head { display: flex; align-items: center; gap: 10px; margin-bottom: 14px; font-size: 12px; letter-spacing: .12em; text-transform: uppercase; color: var(--muted); }
.answer-head .orb { width: 18px; height: 18px; border-radius: 50%; background: var(--grad); box-shadow: 0 0 16px rgba(139,92,246,.8); }
.answer-head .orb.busy { animation: spin 1.4s linear infinite; background: conic-gradient(var(--cyan), var(--violet), var(--pink), var(--cyan)); -webkit-mask: radial-gradient(circle, transparent 5px, #000 6px); mask: radial-gradient(circle, transparent 5px, #000 6px); }
@keyframes spin { to { transform: rotate(360deg); } }

/* progress timeline */
.steps { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 9px; }
.step { display: flex; align-items: center; gap: 10px; font-size: 14px; color: var(--muted); animation: rise .35s both; }
.step .dot { width: 8px; height: 8px; border-radius: 50%; background: var(--faint); flex: none; }
.step.active .dot { background: var(--cyan); box-shadow: 0 0 10px var(--cyan); animation: blink 1s infinite; }
.step.done .dot { background: var(--green); }
.step code { font-family: var(--mono); font-size: 12.5px; color: var(--violet-text); background: rgba(139,92,246,.12); padding: 2px 7px; border-radius: 6px; }
@keyframes blink { 50% { opacity: .35; } }
.scanline { position: relative; height: 2px; margin-top: 16px; border-radius: 2px; background: var(--fill-2); overflow: hidden; }
.scanline::after { content: ""; position: absolute; inset: 0; width: 35%; background: var(--grad); animation: scan 1.3s ease-in-out infinite; }
@keyframes scan { from { transform: translateX(-100%); } to { transform: translateX(300%); } }
.steps-summary { font-size: 12.5px; color: var(--faint); cursor: pointer; user-select: none; margin-top: 2px; }
.steps-summary:hover { color: var(--muted); }

/* answer body */
.answer-body { font-size: 16px; line-height: 1.7; color: var(--body); }
.answer-body > * { animation: reveal .5s cubic-bezier(.2,.9,.2,1) both; }
@keyframes reveal { from { opacity: 0; transform: translateY(6px); filter: blur(4px); } to { opacity: 1; transform: none; filter: none; } }
.answer-body p { margin: 0 0 12px; }
.answer-body p:last-child { margin-bottom: 0; }
.answer-body ul, .answer-body ol { margin: 0 0 12px; padding-left: 20px; }
.answer-body li { margin: 4px 0; }
.answer-body li::marker { color: var(--violet); }
.answer-body strong { color: var(--strong); font-weight: 650; }
.cite { display: inline-flex; align-items: center; justify-content: center; min-width: 20px; height: 19px; padding: 0 6px; margin: 0 1px; border-radius: 6px; font-size: 11px; font-weight: 700; font-family: var(--mono); vertical-align: 2px; cursor: pointer; color: var(--cyan-text); background: rgba(92,225,230,.1); border: 1px solid rgba(92,225,230,.35); transition: all .15s; }
.cite:hover { background: rgba(92,225,230,.22); box-shadow: 0 0 12px rgba(92,225,230,.5); transform: translateY(-1px); }
.cite.c { color: var(--violet-text); background: rgba(139,92,246,.12); border-color: rgba(139,92,246,.4); }
.cite.n { color: var(--amber-text); background: rgba(251,191,36,.1); border-color: rgba(251,191,36,.38); }

.answer-meta { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 18px; padding-top: 14px; border-top: 1px solid var(--line); }
.meta { font-size: 12px; color: var(--muted); padding: 4px 10px; border-radius: 999px; background: var(--fill); border: 1px solid var(--line); font-variant-numeric: tabular-nums; }
.meta.warn { color: var(--amber-text); border-color: rgba(251,191,36,.35); }

/* sources */
.sources { margin-top: 14px; }
.sources-title { font-size: 12px; letter-spacing: .12em; text-transform: uppercase; color: var(--faint); margin: 0 0 10px 4px; }
.source-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(260px, 1fr)); gap: 10px; }
.source { position: relative; display: block; text-align: left; width: 100%; padding: 13px 14px 13px 46px; border-radius: 14px; background: var(--card); border: 1px solid var(--line); color: inherit; font: inherit; cursor: pointer; transition: all .2s; animation: rise .4s both; }
.source:hover { border-color: rgba(92,225,230,.45); background: var(--card-hover); transform: translateY(-2px); box-shadow: 0 12px 30px -14px rgba(92,225,230,.5); }
.source.flash { animation: flash 1.2s ease; }
@keyframes flash { 0%, 100% { box-shadow: none; } 30% { box-shadow: 0 0 0 2px var(--cyan), 0 0 26px rgba(92,225,230,.6); } }
.source .num { position: absolute; left: 12px; top: 13px; min-width: 24px; height: 22px; border-radius: 7px; display: grid; place-items: center; font: 700 11px var(--mono); color: var(--cyan-text); background: rgba(92,225,230,.1); border: 1px solid rgba(92,225,230,.3); }
.source.c .num { color: var(--violet-text); background: rgba(139,92,246,.12); border-color: rgba(139,92,246,.35); }
.source.n .num { color: var(--amber-text); background: rgba(251,191,36,.1); border-color: rgba(251,191,36,.3); }
.source .s-title { font-size: 13.5px; font-weight: 600; line-height: 1.35; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
.source .s-sub { margin-top: 5px; font-size: 12px; color: var(--muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.source .s-preview { margin-top: 6px; font-size: 12px; color: var(--faint); line-height: 1.45; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
.more-sources { margin-top: 10px; background: none; border: 0; color: var(--muted); font: inherit; font-size: 13px; cursor: pointer; padding: 4px; }
.more-sources:hover { color: var(--text); }

.error-card { padding: 16px 18px; border-radius: 14px; color: var(--error-text); background: var(--error-bg); border: 1px solid rgba(248,113,113,.35); }

/* ---------- Search results ---------- */
.results { display: flex; flex-direction: column; gap: 10px; margin-top: 22px; }
.result { display: block; width: 100%; text-align: left; padding: 16px 18px; border-radius: 16px; background: var(--panel); backdrop-filter: blur(14px); border: 1px solid var(--line); color: inherit; font: inherit; cursor: pointer; transition: all .2s; animation: rise .35s both; }
.result:hover { border-color: rgba(139,92,246,.5); transform: translateY(-1px); box-shadow: 0 14px 34px -18px rgba(139,92,246,.7); }
.r-top { display: flex; align-items: center; gap: 10px; font-size: 12.5px; color: var(--muted); }
.r-top .date { font-variant-numeric: tabular-nums; }
.r-title { margin: 6px 0 6px; font-size: 15.5px; font-weight: 620; }
.r-snippet { font-size: 13.5px; line-height: 1.55; color: var(--sub); }
.r-snippet mark { background: rgba(92,225,230,.18); color: var(--mark-text); border-radius: 4px; padding: 0 3px; }
.badge { font-size: 11px; padding: 2px 8px; border-radius: 999px; border: 1px solid var(--line-strong); color: var(--muted); }
.badge.person { color: var(--green-text); border-color: rgba(52,211,153,.35); }
.badge.automated { color: var(--faint); }
.badge.topic { color: var(--violet-text); border-color: rgba(139,92,246,.35); }
.badge.count { margin-left: auto; }
.empty { text-align: center; padding: 48px 0; color: var(--faint); }

/* skeleton */
.skeleton { height: 92px; border-radius: 16px; background: linear-gradient(100deg, var(--fill) 30%, var(--fill-3) 50%, var(--fill) 70%); background-size: 200% 100%; animation: shimmer 1.3s infinite; border: 1px solid var(--line); }
@keyframes shimmer { to { background-position: -200% 0; } }

/* ---------- Notes ---------- */
.glass { background: var(--panel); backdrop-filter: blur(18px); border: 1px solid var(--line); border-radius: var(--radius); box-shadow: var(--shadow); }
.composer { padding: 16px; }
.composer textarea { width: 100%; resize: vertical; min-height: 56px; background: transparent; border: 0; outline: 0; color: var(--text); font: inherit; font-size: 15.5px; line-height: 1.55; }
.composer textarea::placeholder { color: var(--faint); }
.composer-row { display: flex; align-items: center; gap: 12px; margin-top: 10px; padding-top: 12px; border-top: 1px solid var(--line); }
.about-wrap { position: relative; flex: 1; }
.about-wrap input { width: 100%; background: var(--fill-2); border: 1px solid var(--line-strong); border-radius: 10px; color: var(--text); font: inherit; font-size: 13.5px; padding: 9px 12px; outline: 0; }
.about-wrap input:focus { border-color: var(--violet); }
.about-menu { position: absolute; z-index: 5; left: 0; right: 0; top: calc(100% + 6px); padding: 6px; border-radius: 12px; background: var(--menu-bg); border: 1px solid var(--line-strong); box-shadow: 0 20px 40px -10px var(--shadow-color); }
.about-menu button { display: block; width: 100%; text-align: left; padding: 8px 10px; border: 0; border-radius: 8px; background: none; color: var(--text); font: inherit; font-size: 13px; cursor: pointer; }
.about-menu button:hover, .about-menu button.hi { background: rgba(139,92,246,.18); }
.about-menu small { color: var(--muted); margin-left: 6px; }
.switch { display: flex; align-items: center; gap: 8px; font-size: 13px; color: var(--muted); cursor: pointer; user-select: none; }
.switch input { display: none; }
.switch .track { width: 34px; height: 20px; border-radius: 999px; background: var(--fill-3); position: relative; transition: background .2s; }
.switch .thumb { position: absolute; top: 3px; left: 3px; width: 14px; height: 14px; border-radius: 50%; background: var(--thumb); transition: transform .2s; }
.switch input:checked + .track { background: var(--violet); }
.switch input:checked + .track .thumb { transform: translateX(14px); background: #fff; }
.btn-primary { border: 0; cursor: pointer; padding: 10px 18px; border-radius: 11px; font: inherit; font-size: 14px; font-weight: 650; color: var(--on-grad); background: var(--grad); box-shadow: 0 6px 22px -8px rgba(139,92,246,.9); transition: transform .15s, filter .2s; }
.btn-primary:hover { transform: translateY(-1px); filter: brightness(1.08); }

.notes-list { display: flex; flex-direction: column; gap: 10px; margin-top: 18px; }
.note { position: relative; padding: 16px 18px 14px 20px; border-radius: 16px; background: var(--panel); border: 1px solid var(--line); animation: rise .35s both; }
.note::before { content: ""; position: absolute; left: 0; top: 14px; bottom: 14px; width: 3px; border-radius: 3px; background: var(--amber); box-shadow: 0 0 12px rgba(251,191,36,.6); }
.note-text { font-size: 15px; line-height: 1.6; }
.note-meta { display: flex; align-items: center; gap: 8px; margin-top: 10px; font-size: 12.5px; color: var(--muted); }
.note-meta .about { color: var(--violet-text); }
.note-meta .private { color: var(--amber-text); }
.note-archive { margin-left: auto; background: none; border: 1px solid transparent; border-radius: 8px; color: var(--faint); font: inherit; font-size: 12px; padding: 4px 8px; cursor: pointer; }
.note-archive:hover { color: var(--text); border-color: var(--line-strong); }

/* ---------- Drawer ---------- */
.scrim { position: fixed; inset: 0; z-index: 30; background: var(--scrim); backdrop-filter: blur(3px); animation: fade .25s both; }
@keyframes fade { from { opacity: 0; } }
.drawer { position: fixed; z-index: 31; top: 0; right: 0; bottom: 0; width: min(560px, 100vw); overflow-y: auto; padding: 26px 28px 40px; background: var(--drawer-bg); backdrop-filter: blur(24px) saturate(150%); border-left: 1px solid var(--line-strong); box-shadow: -30px 0 80px -20px var(--shadow-color); transform: translateX(104%); transition: transform .38s cubic-bezier(.2,.9,.2,1); }
.drawer.open { transform: none; }
.drawer-close { position: absolute; top: 18px; right: 18px; width: 34px; height: 34px; border-radius: 10px; border: 1px solid var(--line-strong); background: var(--fill-2); color: var(--muted); font-size: 20px; line-height: 1; cursor: pointer; }
.drawer-close:hover { color: var(--text); }
.d-kicker { font-size: 12px; letter-spacing: .12em; text-transform: uppercase; color: var(--faint); }
.d-title { margin: 8px 40px 14px 0; font-size: 21px; line-height: 1.3; letter-spacing: -.01em; }
.d-people { display: grid; grid-template-columns: auto 1fr; gap: 4px 12px; font-size: 13px; margin-bottom: 16px; }
.d-people dt { color: var(--faint); }
.d-people dd { margin: 0; color: var(--body); word-break: break-word; }
.d-actions { display: flex; gap: 8px; margin-bottom: 18px; }
.btn-ghost { display: inline-flex; align-items: center; gap: 6px; padding: 8px 12px; border-radius: 10px; font-size: 13px; color: var(--text); background: var(--fill-2); border: 1px solid var(--line-strong); cursor: pointer; }
.btn-ghost:hover { border-color: var(--cyan-text); }
.d-body { white-space: pre-wrap; font-size: 14.5px; line-height: 1.65; color: var(--body); padding: 16px 18px; border-radius: 14px; background: var(--fill); border: 1px solid var(--line); }
.d-sig { margin-top: 10px; white-space: pre-wrap; font-size: 12.5px; color: var(--muted); padding: 10px 14px; border-left: 2px solid var(--line-strong); }
.d-thread { margin-top: 24px; }
.d-thread h4 { margin: 0 0 10px; font-size: 12px; letter-spacing: .12em; text-transform: uppercase; color: var(--faint); font-weight: 600; }
.t-item { position: relative; display: block; width: 100%; text-align: left; padding: 8px 10px 8px 26px; border: 0; border-radius: 10px; background: none; color: inherit; font: inherit; cursor: pointer; }
.t-item::before { content: ""; position: absolute; left: 10px; top: 15px; width: 7px; height: 7px; border-radius: 50%; background: var(--faint); }
.t-item::after { content: ""; position: absolute; left: 13px; top: 24px; bottom: -8px; width: 1px; background: var(--line-strong); }
.t-item:last-child::after { display: none; }
.t-item.current::before { background: var(--cyan); box-shadow: 0 0 10px var(--cyan); }
.t-item:hover { background: var(--fill-2); }
.t-item .t-who { font-size: 13px; font-weight: 600; }
.t-item .t-when { font-size: 12px; color: var(--faint); margin-left: 6px; }
.t-item .t-prev { font-size: 12.5px; color: var(--muted); margin-top: 2px; display: -webkit-box; -webkit-line-clamp: 1; -webkit-box-orient: vertical; overflow: hidden; }
.contact-card .d-body { font-size: 13.5px; }
.contact-note { margin: 0 0 12px; padding: 12px 14px; border-radius: 12px; background: rgba(251,191,36,.07); border: 1px solid rgba(251,191,36,.28); font-size: 14px; line-height: 1.55; }

/* ---------- Toast ---------- */
.toast { position: fixed; z-index: 40; left: 50%; bottom: 28px; transform: translate(-50%, 20px); opacity: 0; padding: 11px 18px; border-radius: 12px; font-size: 14px; background: var(--menu-bg); border: 1px solid var(--line-strong); box-shadow: 0 16px 40px -12px var(--shadow-color); transition: all .3s cubic-bezier(.2,.9,.2,1); pointer-events: none; }
.toast.show { opacity: 1; transform: translate(-50%, 0); }

/* ---------- Small screens ---------- */
@media (max-width: 760px) {
  .topbar { flex-wrap: wrap; gap: 10px; padding: 12px 16px; }
  .topbar-right { width: 100%; justify-content: space-between; }
  .stat-pill { display: none; }
  .viewer-label { display: none; }
  main { padding: 0 16px 100px; }
  .hero { padding-top: 7vh; }
  .kbd { display: none; }
  .composer-row { flex-wrap: wrap; }
  .about-wrap { flex-basis: 100%; }
}

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

/* ---------- Theme toggle ---------- */
.theme-toggle { width: 36px; height: 36px; display: grid; place-items: center; border-radius: 10px; border: 1px solid var(--line-strong); background: var(--fill); color: var(--muted); cursor: pointer; transition: color .2s, border-color .2s, transform .15s; }
.theme-toggle:hover { color: var(--text); border-color: var(--violet); }
.theme-toggle:active { transform: scale(.94); }
.theme-toggle svg { width: 18px; height: 18px; }
.theme-toggle [data-icon] { display: none; }
.theme-toggle[data-mode="system"] [data-icon="system"],
.theme-toggle[data-mode="light"] [data-icon="light"],
.theme-toggle[data-mode="dark"] [data-icon="dark"] { display: block; }
/* Smooth the switch between themes. */
html.theme-anim, html.theme-anim * { transition: background-color .35s, color .35s, border-color .35s, box-shadow .35s !important; }

/* ---------- Restricted (heated) emails ---------- */
.lock { display: inline-flex; align-items: center; gap: 5px; font-size: 11px; padding: 2px 8px; border-radius: 999px; color: var(--amber-text); background: rgba(251,191,36,.1); border: 1px solid rgba(251,191,36,.35); }
.lock svg { width: 11px; height: 11px; }
.source .lock { position: absolute; right: 10px; top: 11px; padding: 2px 6px; }
.restricted-banner { display: flex; gap: 12px; align-items: flex-start; margin: 0 0 16px; padding: 13px 15px; border-radius: 14px; font-size: 13.5px; line-height: 1.5; color: var(--body); background: rgba(251,191,36,.08); border: 1px solid rgba(251,191,36,.3); }
.restricted-banner svg { flex: none; width: 18px; height: 18px; margin-top: 1px; color: var(--amber-text); }
.restricted-banner strong { color: var(--strong); }
.restricted-banner.quiet { background: var(--fill); border-color: var(--line-strong); color: var(--muted); }

.review-list { display: flex; flex-direction: column; gap: 10px; }
.review { padding: 16px 18px; border-radius: 16px; background: var(--panel); border: 1px solid var(--line); animation: rise .35s both; }
.review.off { opacity: .72; }
.rv-top { display: flex; flex-wrap: wrap; align-items: center; gap: 8px 10px; font-size: 12.5px; color: var(--muted); }
.rv-title { margin: 7px 0 4px; font-size: 15px; font-weight: 620; cursor: pointer; }
.rv-title:hover { color: var(--cyan-text); }
.rv-neutral { font-size: 13px; color: var(--muted); }
.rv-neutral b { color: var(--sub); font-weight: 600; }
.rv-preview { margin-top: 8px; font-size: 13px; line-height: 1.5; color: var(--sub); display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
.heat { display: inline-flex; align-items: center; gap: 8px; font-variant-numeric: tabular-nums; }
.heat-bar { width: 70px; height: 6px; border-radius: 6px; background: var(--fill-3); overflow: hidden; }
.heat-bar span { display: block; height: 100%; border-radius: 6px; background: linear-gradient(90deg, var(--amber), var(--pink)); }
.rv-actions { margin-left: auto; display: flex; gap: 8px; }
.status-chip { font-size: 11px; padding: 2px 8px; border-radius: 999px; border: 1px solid var(--line-strong); }
.status-chip.on { color: var(--amber-text); border-color: rgba(251,191,36,.4); }
.status-chip.manual { color: var(--violet-text); border-color: rgba(139,92,246,.4); }

/* ---------- Tables in answers ---------- */
.table-wrap { overflow-x: auto; margin: 4px 0 14px; border-radius: 12px; border: 1px solid var(--line); }
.answer-body table { width: 100%; border-collapse: collapse; font-size: 14px; font-variant-numeric: tabular-nums; }
.answer-body th { font-size: 12px; letter-spacing: .04em; text-transform: uppercase; color: var(--muted); font-weight: 600; background: var(--fill); }
.answer-body th, .answer-body td { padding: 8px 12px; border-bottom: 1px solid var(--line); white-space: nowrap; }
.answer-body tr:last-child td { border-bottom: 0; }
.answer-body tbody tr:hover td { background: var(--fill); }

/* ---------- Attachments ---------- */
.d-attach { margin-top: 18px; }
.d-attach h4 { margin: 0 0 10px; font-size: 12px; letter-spacing: .12em; text-transform: uppercase; color: var(--faint); font-weight: 600; }
.attach { display: flex; align-items: center; gap: 10px; padding: 9px 12px; margin-bottom: 6px; border-radius: 11px; background: var(--fill); border: 1px solid var(--line); font-size: 13px; transition: border-color .15s, transform .15s; }
a.attach:hover { border-color: var(--cyan); transform: translateY(-1px); }
.attach .ext { flex: none; min-width: 40px; text-align: center; padding: 3px 6px; border-radius: 6px; font: 700 10.5px var(--mono); color: var(--cyan-text); background: rgba(92,225,230,.1); border: 1px solid rgba(92,225,230,.3); }
.attach.off { opacity: .6; }
.attach.off .ext { color: var(--muted); background: var(--fill-2); border-color: var(--line-strong); }
.attach .aname { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.attach .asize { flex: none; color: var(--muted); font-size: 12px; }
.r-attach { margin: -2px 0 6px; font-size: 12.5px; color: var(--cyan-text); }
.r-attach b { font-weight: 600; }

/* ---------- Sign-in ---------- */
body.signed-out .topbar, body.signed-out main { display: none; }
.auth { position: relative; z-index: 2; min-height: 100vh; display: grid; place-items: center; padding: 24px 16px; }
.auth-card { width: min(420px, 100%); padding: 34px 32px 26px; text-align: center; animation: rise .5s cubic-bezier(.2,.9,.2,1) both; }
.auth-mark { width: 54px; height: 54px; filter: drop-shadow(0 0 16px var(--brand-glow)); }
.auth-title { font-size: 28px; margin: 14px 0 6px; }
.auth-sub { margin-bottom: 22px; font-size: 14.5px; }
.field { display: block; text-align: left; margin-bottom: 14px; }
.field span { display: block; font-size: 12.5px; color: var(--muted); margin: 0 0 6px 2px; }
.field input { width: 100%; padding: 12px 14px; border-radius: 12px; border: 1px solid var(--line-strong); background: var(--fill); color: var(--text); font: inherit; font-size: 15px; outline: 0; transition: border-color .2s, box-shadow .2s; }
.field input:focus { border-color: var(--violet); box-shadow: 0 0 0 4px rgba(139,92,246,.18); }
.auth-hint { font-size: 12.5px; color: var(--muted); text-align: left; margin: -4px 2px 12px; }
.auth-error { font-size: 13.5px; color: var(--error-text); background: var(--error-bg); border-radius: 10px; padding: 9px 12px; margin: 0 0 12px; text-align: left; }
.auth-submit { width: 100%; padding: 12px; font-size: 15px; margin-top: 4px; }
.auth-submit:disabled { filter: grayscale(.6) brightness(.85); cursor: progress; }
.auth-foot { margin-top: 18px; font-size: 12.5px; }

/* ---------- User menu & preview ---------- */
.user-menu { position: relative; }
.user-btn { display: flex; align-items: center; gap: 8px; padding: 5px 10px 5px 5px; border-radius: 12px; border: 1px solid var(--line-strong); background: var(--fill); color: var(--text); font: inherit; font-size: 13px; cursor: pointer; }
.user-btn svg { width: 12px; height: 12px; color: var(--muted); }
.user-btn:hover { border-color: var(--violet); }
.avatar.sm { width: 26px; height: 26px; border-radius: 8px; font-size: 11px; }
.menu { position: absolute; right: 0; top: calc(100% + 8px); z-index: 25; width: 250px; padding: 8px; border-radius: 14px; background: var(--menu-bg); border: 1px solid var(--line-strong); box-shadow: 0 24px 50px -12px var(--shadow-color); animation: rise .2s both; }
.menu-head { padding: 8px 10px 10px; border-bottom: 1px solid var(--line); margin-bottom: 6px; font-size: 14px; font-weight: 600; }
.menu-head .muted { font-size: 12.5px; font-weight: 400; margin-top: 2px; }
.menu-preview { display: block; padding: 8px 10px; font-size: 12.5px; color: var(--muted); }
.menu-preview select { margin-top: 6px; width: 100%; padding: 7px 10px; border-radius: 9px; border: 1px solid var(--line-strong); background: var(--fill); color: var(--text); font: inherit; font-size: 13px; }
.menu-item { display: block; width: 100%; text-align: left; padding: 9px 10px; border: 0; border-radius: 9px; background: none; color: var(--text); font: inherit; font-size: 13.5px; cursor: pointer; }
.menu-item:hover { background: var(--fill-2); }
.preview-pill { display: flex; align-items: center; gap: 8px; padding: 5px 6px 5px 12px; border-radius: 999px; font-size: 12.5px; color: var(--amber-text); background: rgba(251,191,36,.1); border: 1px solid rgba(251,191,36,.4); }
.preview-pill button { border: 0; border-radius: 999px; padding: 4px 10px; font: inherit; font-size: 12px; cursor: pointer; color: var(--on-grad); background: var(--amber); }

/* ---------- People ---------- */
.invite { display: flex; gap: 12px; align-items: center; }
.invite input[type=email] { flex: 1; min-width: 0; background: transparent; border: 0; outline: 0; color: var(--text); font: inherit; font-size: 15px; padding: 6px 4px; }
.link-card { margin-top: 12px; padding: 16px 18px; display: flex; flex-direction: column; gap: 12px; animation: rise .3s both; }
.link-card .muted { font-size: 13px; margin-top: 4px; }
.link-row { display: flex; gap: 10px; }
.link-row input { flex: 1; min-width: 0; padding: 10px 12px; border-radius: 10px; border: 1px solid var(--line-strong); background: var(--fill); color: var(--text); font: 12.5px var(--mono); }
.people-list { display: flex; flex-direction: column; gap: 10px; margin-top: 18px; }
.person { display: flex; align-items: center; gap: 14px; padding: 14px 16px; border-radius: 16px; background: var(--panel); border: 1px solid var(--line); animation: rise .35s both; }
.person.off { opacity: .6; }
.p-main { flex: 1; min-width: 0; }
.p-name { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; font-weight: 600; font-size: 14.5px; }
.p-sub { font-size: 12.5px; color: var(--muted); margin-top: 3px; }
.p-actions { display: flex; flex-wrap: wrap; gap: 8px; justify-content: flex-end; }
.status-chip.ok { color: var(--green-text); border-color: rgba(52,211,153,.4); }
@media (max-width: 760px) {
  .person { flex-wrap: wrap; }
  .p-actions { width: 100%; justify-content: flex-start; }
  .invite { flex-wrap: wrap; }
  .user-name { display: none; }
}

/* ---------- NetSuite sources ---------- */
.cite.s { color: var(--green-text); background: rgba(52,211,153,.1); border-color: rgba(52,211,153,.4); }
.source.s .num { color: var(--green-text); background: rgba(52,211,153,.1); border-color: rgba(52,211,153,.35); }
.ns-body { font: 12.5px/1.6 var(--mono); white-space: pre-wrap; overflow-x: auto; }

/* ---------- Source pills on the home screen ---------- */
.source-pills { display: flex; flex-wrap: wrap; justify-content: center; gap: 8px; margin: 18px auto 0; max-width: 620px; }
.source-pills .pill { display: inline-flex; align-items: center; gap: 7px; padding: 5px 12px; border-radius: 999px; font-size: 12.5px; color: var(--muted); background: var(--fill); border: 1px solid var(--line); }
.source-pills .src-dot { width: 7px; height: 7px; border-radius: 50%; display: inline-block; }
.source-pills .src-mail { background: var(--cyan); box-shadow: 0 0 8px var(--cyan); }
.source-pills .src-meet { background: var(--violet); box-shadow: 0 0 8px var(--violet); }
.source-pills .src-file { background: var(--pink); box-shadow: 0 0 8px var(--pink); }
.source-pills .src-ns { background: var(--green); box-shadow: 0 0 8px var(--green); animation: pulse 2.4s infinite; }
.source-pills .src-note { background: var(--amber); box-shadow: 0 0 8px var(--amber); }
.hero.compact .source-pills { display: none; }
