/* Brand: navy, gold and white, from the Citebook logo (navy #2E3F73 → #161E38, gold #F5B23E).
   Gold is never used for text on white (1.9:1); it is a fill with navy text on it. */
:root {
  --bg: #ffffff;
  --surface: #ffffff;
  --surface-2: #f4f6fb;
  --border: #e2e6f0;
  --text: #141a2e;
  --muted: #5b6478;
  --navy: #2E3F73;
  --navy-deep: #161E38;
  --gold: #F5B23E;
  --gold-soft: #fdf3dc;
  --accent: #2E3F73;          /* primary buttons */
  --on-accent: #ffffff;
  --accent-soft: #eef1f9;
  --accent-text: #2E3F73;
  --link: #2350b8;
  --ok: #15803d; --ok-soft: #e9f7ee;
  --warn: #b45309; --warn-soft: #fef5e4;
  --bad: #b91c1c; --bad-soft: #fdecec;
  --shadow: 0 1px 2px rgba(22, 30, 56, .06), 0 4px 16px rgba(22, 30, 56, .06);
  --radius: 14px;
  --serif: "Source Serif 4", Georgia, serif;
  --sans: Inter, system-ui, -apple-system, "Segoe UI", sans-serif;
  color-scheme: light;
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --bg: #0f1428; --surface: #161E38; --surface-2: #1e2847; --border: #2b375e;
    --text: #f3f5fb; --muted: #a7b0c8; --accent: #F5B23E; --on-accent: #161E38; --accent-soft: #232c4d;
    --accent-text: #F5B23E; --gold-soft: #2c2a26; --link: #8fb0ff; --ok: #4ade80; --ok-soft: #173322;
    --warn: #fbbf24; --warn-soft: #382c12; --bad: #f87171; --bad-soft: #3b1a1a; --shadow: 0 1px 2px rgba(0,0,0,.4); color-scheme: dark;
  }
}
:root[data-theme="dark"] {
  --bg: #0f1428; --surface: #161E38; --surface-2: #1e2847; --border: #2b375e;
  --text: #f3f5fb; --muted: #a7b0c8; --accent: #F5B23E; --on-accent: #161E38; --accent-soft: #232c4d;
  --accent-text: #F5B23E; --gold-soft: #2c2a26; --link: #8fb0ff; --ok: #4ade80; --ok-soft: #173322;
  --warn: #fbbf24; --warn-soft: #382c12; --bad: #f87171; --bad-soft: #3b1a1a; --shadow: 0 1px 2px rgba(0,0,0,.4); color-scheme: dark;
}

* { box-sizing: border-box; }
html, body { margin: 0; }
body { background: var(--bg); color: var(--text); font: 15px/1.6 var(--sans); min-height: 100vh; }
a { color: var(--link); }
button { font: inherit; color: inherit; cursor: pointer; }
[hidden] { display: none !important; }

.credit-bar {
  display: flex; flex-wrap: wrap; gap: 4px 16px; justify-content: space-between;
  padding: 8px 20px; background: var(--navy-deep); color: #ffffff; font-size: 13px;
}
.credit-bar a { color: var(--gold); }
.credit-bar__aside { opacity: .8; }

.topbar {
  position: sticky; top: 0; z-index: 20; display: flex; align-items: center; gap: 12px;
  padding: 12px 20px; background: color-mix(in srgb, var(--bg) 92%, transparent);
  backdrop-filter: blur(8px); border-bottom: 1px solid var(--border);
}
.brand { display: flex; align-items: center; gap: 10px; text-decoration: none; color: var(--text); }
.brand__mark { width: 36px; height: 36px; flex: none; display: block; }
/* Logo: navy note on light backgrounds, white note on dark. */
.brand__mark--dark { display: none; }
@media (prefers-color-scheme: dark) { :root:not([data-theme="light"]) .brand__mark--light { display: none; } :root:not([data-theme="light"]) .brand__mark--dark { display: block; } }
:root[data-theme="dark"] .brand__mark--light { display: none; }
:root[data-theme="dark"] .brand__mark--dark { display: block; }
.brand__text { display: flex; flex-direction: column; line-height: 1.1; }
.brand__name { font: 800 20px/1 var(--sans); letter-spacing: -.02em; }
.brand__sub { font-size: 12px; color: var(--muted); }
.topbar__nav { margin-left: auto; display: flex; gap: 8px; }
.pill-btn {
  border: 1px solid var(--border); background: var(--surface); padding: 6px 14px; border-radius: 999px; font-size: 14px;
}
.pill-btn--primary { background: var(--accent); color: var(--on-accent); border-color: var(--accent); }
.count { display: inline-block; min-width: 20px; padding: 0 6px; margin-left: 4px; border-radius: 999px; background: var(--gold); color: var(--navy-deep); font-weight: 600; font-size: 12px; }
.icon-btn { border: 0; background: transparent; font-size: 18px; padding: 4px 8px; border-radius: 8px; }
.icon-btn:hover { background: var(--surface-2); }
.link-btn { border: 0; background: none; color: var(--accent-text); font-size: 13px; padding: 0; }

.layout { display: grid; grid-template-columns: 250px minmax(0, 1fr); max-width: 1280px; margin: 0 auto; }
.layout.with-drawer { padding-right: 360px; max-width: calc(1280px + 360px); }

.sidebar { padding: 20px 16px 140px; border-right: 1px solid var(--border); position: sticky; top: 62px; height: calc(100vh - 62px); overflow-y: auto; }
.sidebar section + section { margin-top: 28px; }
.sidebar__head { display: flex; justify-content: space-between; align-items: baseline; margin-bottom: 8px; }
.sidebar h2 { font-size: 12px; letter-spacing: .06em; text-transform: uppercase; color: var(--muted); margin: 0; font-weight: 600; }
.nb-list, .topic-list { list-style: none; padding: 0; margin: 0; }
.nb-list button, .topic-list button {
  width: 100%; text-align: left; border: 0; background: none; padding: 7px 10px; border-radius: 8px;
  display: flex; justify-content: space-between; gap: 8px; font-size: 14px;
}
.nb-list button:hover, .topic-list button:hover { background: var(--surface-2); }
.nb-list button.active { background: var(--accent-soft); color: var(--accent-text); font-weight: 500; }
.topic-list small, .nb-list small { color: var(--muted); }
.empty-note { color: var(--muted); font-size: 13px; padding: 4px 10px; }

.main { padding: 32px 32px 180px; min-width: 0; }

.hero { max-width: 720px; margin: 24px auto 0; }
.eyebrow { color: var(--accent-text); font-weight: 600; font-size: 13px; letter-spacing: .04em; text-transform: uppercase; margin: 0 0 8px; }
.hero h1 { font: 600 clamp(32px, 5vw, 46px)/1.1 var(--serif); margin: 0 0 14px; letter-spacing: -.01em; }
.hero__lede { font-size: 17px; color: var(--muted); margin: 0 0 24px; }
.hero__lede strong { color: var(--text); }
.steps { display: grid; grid-template-columns: repeat(3, 1fr); gap: 10px; margin-bottom: 24px; }
.step { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); padding: 12px 14px; font-size: 14px; }
.step span { display: inline-grid; place-items: center; width: 22px; height: 22px; border-radius: 50%; background: var(--accent-soft); color: var(--accent-text); font-weight: 600; font-size: 12px; margin-right: 6px; }
.hero__note { font-size: 13px; color: var(--muted); margin: 22px 0 0; }
.hero-ask { display: flex; align-items: center; gap: 10px; background: var(--surface); border: 1px solid var(--border); border-radius: 16px; padding: 8px 8px 8px 16px; box-shadow: 0 6px 24px rgba(22, 30, 56, .08); margin: 0 0 14px; }
.hero-ask:focus-within { border-color: var(--accent); }
.hero-ask__icon { color: var(--muted); font-size: 18px; }
.hero-ask input { flex: 1; min-width: 0; border: 0; outline: 0; background: none; font: inherit; font-size: 16.5px; color: var(--text); padding: 8px 0; }
.hero-ask button { flex: none; width: 44px; height: 44px; border-radius: 12px; border: 0; background: var(--accent); color: var(--on-accent); font-size: 20px; cursor: pointer; }
.hero__label { font-size: 13.5px; color: var(--muted); margin: 18px 0 8px; font-weight: 500; }
.hero__topics { margin-top: 6px; }
.sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
/* On the home screen the hero has its own search box; the bottom composer returns once a chat starts. */
body:has(#hero:not([hidden])) .composer { display: none; }
.starters { display: flex; flex-wrap: wrap; gap: 8px; }
.chip {
  border: 1px solid var(--border); background: var(--surface); padding: 7px 13px; border-radius: 999px;
  font-size: 14px; text-align: left; box-shadow: var(--shadow);
}
.chip:hover { border-color: var(--accent); }
.chip--topic { background: var(--accent-soft); color: var(--accent-text); border-color: transparent; box-shadow: none; }

.thread { max-width: 760px; margin: 0 auto; }
.q { font: 600 22px/1.3 var(--serif); margin: 36px 0 12px; }
.card { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); box-shadow: var(--shadow); padding: 18px 20px; }
.answer-head { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; margin-bottom: 10px; }
.conf { font-size: 12px; font-weight: 600; padding: 3px 10px; border-radius: 999px; }
.conf--high { background: var(--ok-soft); color: var(--ok); }
.conf--medium { background: var(--warn-soft); color: var(--warn); }
.conf--low { background: var(--bad-soft); color: var(--bad); }
.tag { font-size: 12px; color: var(--muted); }
.answer { font-size: 15.5px; }
.answer p { margin: 0 0 10px; }
.answer ul { margin: 0 0 10px; padding-left: 20px; }
.cite {
  display: inline-grid; place-items: center; min-width: 20px; height: 18px; padding: 0 5px; margin: 0 1px;
  border-radius: 5px; background: var(--gold-soft); color: var(--accent-text); font-size: 11px; font-weight: 600;
  border: 0; vertical-align: 2px;
}
.cite:hover { background: var(--gold); color: var(--navy-deep); }
.cursor::after { content: "▍"; animation: blink 1s steps(2) infinite; color: var(--accent); }
@keyframes blink { 50% { opacity: 0; } }
.notice { border-radius: 10px; padding: 10px 12px; font-size: 14px; margin: 10px 0; }
.notice--warn { background: var(--warn-soft); color: var(--warn); }
.notice--info { background: var(--surface-2); color: var(--muted); }
.notice button { border: 0; background: none; color: var(--link); text-decoration: underline; padding: 0; }

.sources-title { font-size: 12px; letter-spacing: .06em; text-transform: uppercase; color: var(--muted); font-weight: 600; margin: 18px 0 8px; }
.sources { display: grid; gap: 8px; }
.src { border: 1px solid var(--border); border-radius: 12px; padding: 12px 14px; background: var(--bg); }
.src.flash { outline: 2px solid var(--accent); }
.src__top { display: flex; gap: 8px; align-items: flex-start; }
.src__n { flex: none; width: 22px; height: 22px; border-radius: 6px; background: var(--surface-2); display: grid; place-items: center; font-size: 12px; font-weight: 600; }
.src__title { font-weight: 600; font-size: 14px; line-height: 1.35; }
.src__meta { font-size: 12.5px; color: var(--muted); }
.src__kind { font-size: 11px; font-weight: 600; text-transform: uppercase; letter-spacing: .05em; color: var(--accent-text); }
.src__text { font-size: 14px; color: var(--muted); margin: 8px 0 8px 30px; display: -webkit-box; -webkit-line-clamp: 3; -webkit-box-orient: vertical; overflow: hidden; }
.src__text.open { -webkit-line-clamp: unset; }
.src__actions { display: flex; flex-wrap: wrap; gap: 6px 14px; margin-left: 30px; font-size: 13px; }
.src__actions a, .src__actions button { border: 0; background: none; padding: 0; color: var(--link); text-decoration: none; font-size: 13px; }
.src__actions a:hover, .src__actions button:hover { text-decoration: underline; }

.followup { margin-top: 14px; display: grid; gap: 10px; }
.followup .card { padding: 14px 16px; }
.followup h4 { margin: 0 0 8px; font-size: 14px; }
.followup .chips { display: flex; flex-wrap: wrap; gap: 6px; }
.followup .chip { box-shadow: none; font-size: 13.5px; }
.save-row { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; }
.btn { border: 1px solid var(--border); background: var(--surface); padding: 7px 14px; border-radius: 10px; font-size: 14px; }
.btn:hover { border-color: var(--muted); }
.btn--primary { background: var(--accent); border-color: var(--accent); color: var(--on-accent); }
.btn--primary:hover { filter: brightness(1.05); border-color: var(--accent); }
.btn--ghost { border-color: transparent; background: none; color: var(--muted); }
.more-list { margin: 6px 0 0; padding: 0; list-style: none; font-size: 14px; }
.more-list li { padding: 3px 0; }

.topic-view { max-width: 760px; margin: 0 auto; }
.topic-view h1 { font: 600 34px/1.15 var(--serif); margin: 8px 0 6px; }
.topic-view .desc { color: var(--muted); margin: 0 0 16px; }
.topic-actions { display: flex; flex-wrap: wrap; gap: 8px; margin-bottom: 20px; }
.persp { margin: 0 0 12px; }
.persp p { margin: 0 0 4px; }

.drawer {
  border-left: 1px solid var(--border); background: var(--surface); position: fixed; right: 0; top: 0; bottom: 0;
  width: 360px; z-index: 40; display: flex; flex-direction: column; padding: 16px; box-shadow: -8px 0 24px rgba(22, 30, 56, .08);
}
.drawer__head { display: flex; gap: 6px; align-items: center; }
.drawer__title { flex: 1; font: 600 18px var(--serif); border: 1px solid transparent; background: none; padding: 4px 6px; border-radius: 8px; color: var(--text); min-width: 0; }
.drawer__title:hover, .drawer__title:focus { border-color: var(--border); outline: none; }
.drawer__meta { font-size: 12.5px; color: var(--muted); margin: 2px 6px 10px; }
.drawer__entries { flex: 1; overflow-y: auto; display: grid; gap: 10px; align-content: start; padding-bottom: 12px; }
.entry { border: 1px solid var(--border); border-radius: 12px; padding: 10px 12px; background: var(--bg); font-size: 13.5px; }
.entry__kind { font-size: 11px; text-transform: uppercase; letter-spacing: .05em; color: var(--accent-text); font-weight: 600; }
.entry__title { font-weight: 600; margin: 2px 0 4px; }
.entry__body { color: var(--muted); display: -webkit-box; -webkit-line-clamp: 4; -webkit-box-orient: vertical; overflow: hidden; }
.entry textarea { width: 100%; margin-top: 6px; border: 1px solid var(--border); border-radius: 8px; padding: 6px 8px; font: inherit; font-size: 13px; background: var(--surface); color: var(--text); resize: vertical; }
.entry__actions { display: flex; justify-content: flex-end; }
.entry--new { border-color: var(--gold); background: var(--gold-soft); }
.entry__why { font-size: 12px; color: var(--muted); margin-bottom: 2px; }
.auto-toggle { display: flex; gap: 8px; align-items: flex-start; font-size: 12.5px; color: var(--muted); padding: 2px 4px 6px; }
.auto-toggle input { margin-top: 3px; accent-color: var(--navy); }
.new-dot { color: var(--accent-text); font-size: 12px; font-weight: 600; }
.entry__actions button { border: 0; background: none; color: var(--muted); font-size: 12px; }
.drawer__foot { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; padding-top: 10px; border-top: 1px solid var(--border); }
.drawer__hint { font-size: 12px; color: var(--muted); margin: 8px 2px 0; }
.drawer__empty { color: var(--muted); font-size: 14px; padding: 18px 6px; text-align: center; }

.composer { position: fixed; left: 0; right: 0; bottom: 0; padding: 12px 16px 14px; background: linear-gradient(to top, var(--bg) 70%, transparent); z-index: 15; }
.composer__inner {
  max-width: 760px; margin: 0 auto; display: flex; gap: 8px; align-items: flex-end;
  background: var(--surface); border: 1px solid var(--border); border-radius: 18px; padding: 8px 8px 8px 16px; box-shadow: var(--shadow);
}
.composer textarea { flex: 1; border: 0; outline: 0; resize: none; font: inherit; font-size: 15.5px; background: none; color: var(--text); padding: 6px 0; max-height: 160px; }
.send { width: 40px; height: 40px; border-radius: 12px; border: 0; background: var(--gold); color: var(--navy-deep); font-weight: 700; font-size: 18px; flex: none; }
.send:disabled { opacity: .5; cursor: default; }
body.drawer-open .composer { right: 360px; }
.composer__note { max-width: 760px; margin: 6px auto 0; text-align: center; font-size: 12px; color: var(--muted); }

.dialog { border: 1px solid var(--border); border-radius: var(--radius); background: var(--surface); color: var(--text); padding: 20px; width: min(420px, calc(100vw - 32px)); box-shadow: var(--shadow); }
.dialog::backdrop { background: rgba(20, 15, 10, .35); }
.dialog h3 { margin: 0 0 12px; font: 600 20px var(--serif); }
.save-choices { display: grid; gap: 6px; margin-bottom: 12px; max-height: 240px; overflow-y: auto; }
.save-choices label { display: flex; gap: 8px; align-items: center; padding: 8px 10px; border: 1px solid var(--border); border-radius: 10px; font-size: 14px; }
.field { display: grid; gap: 4px; font-size: 13px; color: var(--muted); }
.field select { border: 1px solid var(--border); border-radius: 10px; padding: 8px 10px; font: inherit; font-size: 14px; background: var(--bg); color: var(--text); }
#saveToDialog .field { margin-bottom: 12px; }
#saveToDialog .field[hidden] { display: none; }
.field input { border: 1px solid var(--border); border-radius: 10px; padding: 8px 10px; font: inherit; font-size: 14px; background: var(--bg); color: var(--text); }
.dialog menu { display: flex; justify-content: flex-end; gap: 8px; padding: 0; margin: 16px 0 0; }

.toast { position: fixed; bottom: 96px; left: 50%; transform: translateX(-50%); background: var(--text); color: var(--bg); padding: 9px 16px; border-radius: 999px; font-size: 14px; z-index: 50; }
.spinner { display: inline-block; width: 14px; height: 14px; border: 2px solid var(--border); border-top-color: var(--accent); border-radius: 50%; animation: spin .8s linear infinite; vertical-align: -2px; margin-right: 6px; }
@keyframes spin { to { transform: rotate(360deg); } }

.only-mobile { display: none; }
@media (max-width: 1100px) {
  body.drawer-open .composer { right: 0; }
  .drawer__foot { padding-bottom: 4px; }
  .layout.with-drawer { padding-right: 0; }
  .drawer { top: 0; width: min(380px, 100vw); z-index: 40; box-shadow: -8px 0 24px rgba(0,0,0,.12); }
}
@media (max-width: 760px) {
  .only-mobile { display: inline-block; }
  .layout { grid-template-columns: minmax(0, 1fr); }
  .sidebar { display: none; position: fixed; inset: 0 auto 0 0; width: 280px; z-index: 45; background: var(--surface); top: 0; height: 100vh; box-shadow: 8px 0 24px rgba(0,0,0,.12); }
  .sidebar.open { display: block; }
  .main { padding: 20px 16px 170px; }
  .steps { grid-template-columns: 1fr; }
  .brand__sub { font-size: 10.5px; line-height: 1.25; max-width: 170px; }
  .credit-bar { padding: 6px 16px; font-size: 12px; }
  .credit-bar__more { display: none; }
  .credit-bar__aside::before { content: ""; }
  .brand__mark { width: 32px; height: 32px; }
  .topbar { padding: 10px 16px; }
  .src__text, .src__actions { margin-left: 0; }
}

/* Accounts, limits, prompts */
.drawer__foot { grid-template-columns: 1fr 1fr; }
.drawer__wide { grid-column: 1 / -1; }
.err-text { color: var(--bad); font-size: 13px; min-height: 1em; margin: 6px 0 0; }
.composer__note #usage:not(:empty)::after { content: " ·"; }
.prompt-card { position: fixed; left: 50%; transform: translateX(-50%); bottom: 104px; z-index: 45; width: min(520px, calc(100vw - 32px));
  background: var(--surface); border: 1px solid var(--gold); border-radius: var(--radius); box-shadow: var(--shadow); padding: 14px 16px; }
.prompt-card p { margin: 0 0 10px; font-size: 14px; }
.limit-actions { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 8px; }
.chat-item small { white-space: nowrap; }
.teaser { font-size: 12.5px; background: var(--gold-soft); color: var(--accent-text); border-radius: 10px; padding: 8px 10px; }
body.drawer-open .topbar__nav { margin-right: 360px; }
@media (max-width: 1100px) { body.drawer-open .topbar__nav { margin-right: 0; } }

.support-list { margin: 0 0 10px; padding-left: 20px; font-size: 14px; }
.preview { border: 1px solid var(--gold); background: var(--gold-soft); border-radius: 12px; padding: 10px 12px; display: grid; gap: 8px; }
.preview h4 { margin: 0; font-size: 13px; color: var(--accent-text); }
.preview__item { background: var(--surface); border: 1px solid var(--border); border-radius: 10px; padding: 8px 10px; font-size: 13px; }
.preview__item .t { font-weight: 600; }
.preview__item .m { color: var(--muted); font-size: 12px; }
.preview__actions { display: flex; flex-wrap: wrap; gap: 6px 12px; margin-top: 4px; }
.preview__actions a, .preview__actions button { font-size: 12.5px; border: 0; background: none; padding: 0; color: var(--link); cursor: pointer; text-decoration: none; }
.preview__actions button { font-weight: 600; }

/* Sectioned answers (notebook-page layout) */
.answer .answer__h { font: 600 12px/1.3 var(--sans); letter-spacing: .06em; text-transform: uppercase; color: var(--accent-text); margin: 16px 0 6px; }
.answer .answer__h:first-child { margin-top: 2px; }
.answer ol { margin: 0 0 10px; padding-left: 22px; }
.answer li { margin: 0 0 4px; }

/* Notebook sections */
.purpose { display: grid; gap: 6px; padding: 2px 2px 4px; }
.chip--small { font-size: 12.5px; padding: 5px 10px; box-shadow: none; }
.chip--on { background: var(--accent); color: var(--on-accent); border-color: var(--accent); }
.nb-section { display: grid; gap: 8px; }
.nb-section__h { font: 600 12px/1.3 var(--sans); letter-spacing: .06em; text-transform: uppercase; color: var(--accent-text); margin: 10px 2px 0; border-top: 1px solid var(--border); padding-top: 12px; }
.brief { border: 1px solid var(--border); border-radius: 12px; padding: 10px 12px; background: var(--surface); display: grid; gap: 6px; }
.brief .answer { font-size: 14px; }
.nb-takeaways, .nb-notes, .nb-sources { margin: 0; padding-left: 18px; display: grid; gap: 6px; font-size: 13.5px; }
.nb-guest { font-weight: 600; font-size: 13px; margin: 4px 2px 0; }
.nb-moments { display: flex; flex-wrap: wrap; gap: 4px 10px; font-size: 12.5px; }
.nb-moments a { color: var(--link); text-decoration: none; }

.badge-new { flex: none; padding: 1px 8px; border-radius: 999px; background: var(--gold); color: var(--navy-deep); font-size: 11px; font-weight: 700; letter-spacing: .02em; align-self: center; }

/* Notebook tabs and search */
.nb-tools { display: grid; gap: 8px; margin: 0 2px 10px; }
.nb-search { font: inherit; font-size: 14px; padding: 8px 12px; border: 1px solid var(--border); border-radius: 10px; background: var(--surface); color: var(--text); min-height: 40px; }
.nb-search:focus { outline: 2px solid var(--accent); outline-offset: -1px; }
.nb-tabs { display: flex; gap: 4px 14px; flex-wrap: wrap; border-bottom: 1px solid var(--border); }
.nb-tab { border: 0; background: none; font: inherit; font-size: 13.5px; color: var(--muted); padding: 6px 1px; border-bottom: 2px solid transparent; cursor: pointer; min-height: 36px; }
.nb-tab:hover { color: var(--text); }
.nb-tab--on { color: var(--accent-text); border-bottom-color: var(--accent); font-weight: 600; }

/* Topics page: cards */
.topic-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(210px, 1fr)); gap: 12px; margin-top: 8px; }
.topic-card { display: flex; flex-direction: column; gap: 4px; text-align: left; font: inherit; color: var(--text); background: var(--surface); border: 1px solid var(--border); border-radius: 14px; padding: 16px; cursor: pointer; }
.topic-card:hover { border-color: var(--accent); }
.topic-card__top { display: flex; justify-content: space-between; align-items: center; margin-bottom: 6px; }
.topic-card__icon { width: 34px; height: 34px; border-radius: 10px; background: var(--accent-soft); color: var(--accent-text); display: grid; place-items: center; font-weight: 700; }
.topic-card__name { font-weight: 600; font-size: 15.5px; }
.topic-card__count { font-size: 12.5px; color: var(--accent-text); }
.topic-card__desc { font-size: 13.5px; color: var(--muted); line-height: 1.45; }
.badge-mine { flex: none; padding: 1px 8px; border-radius: 999px; background: var(--accent-soft); color: var(--accent-text); font-size: 11px; font-weight: 600; align-self: center; }
.pro-badge { display: inline-block; margin: 0 0 6px; padding: 2px 10px; border-radius: 999px; background: var(--gold); color: var(--navy-deep); font-size: 12px; font-weight: 800; letter-spacing: .04em; }
.pro-price { margin: 10px 0 2px; color: var(--muted); }
.pro-price strong { font-size: 28px; color: var(--text); }
.btn--gold { background: var(--gold); color: var(--navy-deep); border-color: var(--gold); font-weight: 700; }

/* Suggestions: new matches waiting for review (dotted until added) */
.suggest { border: 1.5px dashed var(--gold); background: var(--gold-soft); border-radius: 12px; padding: 10px 12px; display: grid; gap: 8px; }
.suggest__h { font-size: 12px; font-weight: 700; letter-spacing: .04em; text-transform: uppercase; color: var(--accent-text); }
.suggest__item { border: 1.5px dashed var(--gold); background: var(--surface); border-radius: 10px; padding: 10px 12px; display: grid; gap: 4px; }
.suggest__kind { font-size: 12px; color: var(--muted); }
.suggest__actions { display: flex; flex-wrap: wrap; align-items: center; gap: 8px 12px; margin-top: 4px; }
.suggest__actions a { font-size: 13px; color: var(--link); text-decoration: none; }
.badge-new { display: inline-block; padding: 0 7px; border-radius: 999px; background: var(--gold); color: #161E38; font-size: 11px; font-weight: 700; }
.btn--small { padding: 4px 10px; font-size: 13px; min-height: 0; }
.suggest .tag { margin: 0; }

/* AI disclaimer: a pill at the top of each answer, a note above its sources */
.ai-pill { display: inline-flex; align-items: center; gap: 4px; font-size: 12px; color: var(--muted); }
.ai-note { font-size: 13.5px; font-weight: 500; color: var(--text); margin: 12px 0 6px; padding: 8px 12px; border-radius: 10px; background: var(--gold-soft); border: 1px solid var(--gold); }

/* Privacy and terms links */
.legal-links { font-size: 12.5px; color: var(--muted); }
.legal-links a, .legal-note a, .danger-zone a { color: var(--muted); }
.sidebar .legal-links { padding: 16px 10px 4px; margin: 0; }
.link-btn--danger { color: #b42318; }
.danger-zone { margin-top: 14px; padding-top: 10px; border-top: 1px solid var(--border); }

.hero .starters { margin-top: 4px; }
.sidebar__new { width: 100%; margin-bottom: 20px; }
.my-topics { display: flex; flex-wrap: wrap; gap: 8px; margin: 0 0 18px; }
.my-topics .badge-mine { margin-left: 6px; }
.new-dot-badge { display: inline-block; width: 7px; height: 7px; border-radius: 50%; background: var(--gold); margin-left: 6px; vertical-align: middle; }
.new-dot-badge[hidden] { display: none; }
.empty-note .link-btn { display: inline; width: auto; padding: 0; font-size: inherit; }
.topbar__nav .pill-btn { white-space: nowrap; }
@media (max-width: 760px) {
  .topbar__nav { gap: 6px; }
  .topbar__nav .pill-btn { padding-left: 11px; padding-right: 11px; }
  .brand__text { display: none; }
}
.nb-more { display: block; width: auto; padding: 7px 10px; font-size: 13.5px; }
.nb-btn { display: inline-flex; align-items: center; max-width: 240px; }
.nb-btn__name { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; min-width: 0; }
.nb-btn__short { display: none; }
/* Phones: no room for the name, so the button keeps the plain label and count. */
@media (max-width: 480px) { .nb-btn__name { display: none; } .nb-btn__short { display: inline; } }
.nb-btn .count[hidden] { display: none; }
.saved-notice { position: fixed; bottom: 104px; left: 50%; transform: translateX(-50%); z-index: 50; display: flex; align-items: center; gap: 14px;
  background: var(--navy-deep, #151a2e); color: #fff; padding: 10px 12px 10px 16px; border-radius: 12px; font-size: 14px; box-shadow: 0 10px 30px rgba(0,0,0,.25); max-width: calc(100vw - 32px); }
.saved-notice[hidden] { display: none; }
@media (max-width: 640px) { .saved-notice, .prompt-card { bottom: 132px; } }
.saved-notice--nudge { flex-wrap: wrap; row-gap: 8px; width: min(460px, calc(100vw - 32px)); }
.saved-notice--nudge .saved-notice__text { flex: 1; }
.saved-notice__nudge { flex-basis: 100%; display: flex; align-items: center; justify-content: space-between; gap: 12px; padding-top: 8px; border-top: 1px solid rgba(255,255,255,.18); font-size: 13px; line-height: 1.4; }
.saved-notice .saved-notice__signin { flex: none; background: var(--gold); color: var(--navy-deep, #151a2e); border-radius: 999px; padding: 6px 14px; }
.signin-sample { border: 1px solid var(--border); border-radius: 10px; padding: 10px 12px; margin: 10px 0 12px; font-size: 13px; background: var(--gold-soft); }
.signin-sample__h { font-size: 12px; opacity: .75; margin-bottom: 6px; }
.signin-sample__title { margin-top: 4px; font-weight: 600; }
.signin-sample__actions { margin-top: 4px; color: var(--muted, #667); }
.saved-notice__text { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; min-width: 0; }
.saved-notice button { background: none; border: 0; color: var(--gold); font: inherit; font-weight: 600; cursor: pointer; padding: 2px 0; }
.saved-notice .saved-notice__x { color: #fff; opacity: .65; font-weight: 400; padding: 2px 4px; }
.btn.is-saved, .src__actions button.is-saved { opacity: .7; cursor: default; }
.first-nb__tips { margin: 4px 0 8px; padding-left: 18px; font-size: 13.5px; line-height: 1.7; }
.entry__actions { display: flex; justify-content: flex-end; gap: 12px; }
.hero__browse { display: inline-block; margin-top: 14px; padding: 4px 0; border: 0; background: none; font: inherit; font-size: 15px; font-weight: 500; color: var(--accent-text); cursor: pointer; }
.hero__browse:hover { text-decoration: underline; }
.hero__more { display: flex; align-items: baseline; gap: 20px; flex-wrap: wrap; margin-top: 14px; }
.hero__more .hero__browse { margin-top: 0; }
.dialog.how { width: min(720px, calc(100vw - 24px)); max-width: none; }
.how__head { display: flex; justify-content: space-between; align-items: center; margin-bottom: 12px; }
.how__head h3 { margin: 0; }
.how__video { display: block; width: 100%; aspect-ratio: 1000 / 620; border-radius: 12px; border: 1px solid var(--border); background: var(--surface-2); }
.how__steps { margin: 14px 0 6px; padding-left: 22px; font-size: 14.5px; line-height: 1.5; color: var(--muted); }
.how__steps li { padding: 3px 0; }
.how__steps li.is-on { color: var(--text); }
.how__steps li.is-on::marker { color: var(--gold); font-weight: 700; }
.link-top { border: 0; background: none; font: inherit; font-size: 14px; color: var(--muted); padding: 6px 8px; cursor: pointer; white-space: nowrap; }
.link-top:hover { color: var(--accent-text); text-decoration: underline; }
@media (max-width: 480px) { .link-top { display: none; } }

/* Notebook: "Notebooks" heading opens the all-notebooks page */
.sidebar__h-link { border: 0; background: none; padding: 0; font: inherit; color: inherit; letter-spacing: inherit; text-transform: inherit; cursor: pointer; }
.sidebar__h-link:hover { color: var(--accent-text); text-decoration: underline; }

/* Notebook panel: expand to a full-screen reading view */
.drawer__expand { font-size: 13px; white-space: nowrap; padding: 4px 6px; }
body.drawer-wide .drawer { left: 0; width: auto; top: var(--topbar-h, 61px); z-index: 30; border-left: 0; border-top: 1px solid var(--border); padding-left: max(24px, calc((100vw - 880px) / 2)); padding-right: max(24px, calc((100vw - 880px) / 2)); box-shadow: none; }
body.drawer-wide .drawer__title { font-size: 24px; }
body.drawer-wide .entry { font-size: 14.5px; padding: 14px 16px; }
body.drawer-wide .entry__body { -webkit-line-clamp: 8; }
body.drawer-wide .drawer__foot { grid-template-columns: repeat(3, 1fr); }
body.drawer-wide .drawer__foot .drawer__wide { grid-column: auto; }
@media (max-width: 480px) { .drawer__expand { display: none; } }
.drawer__back { align-self: flex-start; font-size: 13px; padding: 0 6px 6px; }
body.drawer-wide .topbar__nav { margin-right: 0; }

/* Pre-written answers: short answer and takeaways first, the rest behind "Go deeper". */
.deeper { margin: 14px 0 6px; }
.deeper__btn { font-weight: 600; }

/* Small print: at the end of the page (not pinned to the screen, so it never covers an answer),
   kept to the right with the text left-aligned. */
.fineprint { margin: 40px 0 0 auto; max-width: 250px; text-align: left; font-size: 12px; line-height: 1.45; color: var(--muted); }
.fineprint p { margin: 0 0 4px; }
.fineprint .legal-links { font-size: 12px; }
.fineprint a { color: var(--muted); }

/* Feedback */
.rate { display: flex; align-items: center; flex-wrap: wrap; gap: 8px; padding: 10px 14px; }
.rate__q { font-size: 14px; font-weight: 600; margin-right: 4px; }
.rate__form { display: flex; gap: 8px; align-items: flex-end; width: 100%; }
.rate__form textarea { flex: 1; min-height: 54px; font: inherit; padding: 8px 10px; border: 1px solid var(--border); border-radius: 10px; background: var(--surface); color: var(--text); resize: vertical; }
#feedbackDialog textarea { width: 100%; box-sizing: border-box; font: inherit; padding: 8px 10px; border: 1px solid var(--border); border-radius: 10px; background: var(--surface); color: var(--text); resize: vertical; }

.empty-note .link-btn { text-decoration: underline; }
