/* ============================================================= *
 *  NameSage — "The Counsel × Marquee" light system.             *
 *  Limestone ground · navy ink · brass accent · Fraunces voice. *
 *  Two views in one SPA: #homeView (landing) + #main (chat).    *
 * ============================================================= */

:root {
  /* default design #1 — Oat & Persimmon · Bricolage Grotesque */
  --bg: #F2EDE4;             /* warm oat */
  --bg-2: #EAE2D5;
  --surface: #FBF7F0;
  --surface-2: #FFFFFF;
  --ink: #2E2033;            /* deep plum */
  --ink-soft: #574457;
  --muted: #8A7C83;
  --line: #E6DCCB;
  --line-strong: #D8CBB6;
  --accent: #E0552A;         /* persimmon */
  --accent-hover: #C4471F;
  --accent-soft: #F6DDD0;
  --accent-tint: #FBEAE0;
  --available: #3C6B49;
  --available-bg: rgba(60, 107, 73, .12);
  --muted-bg: rgba(138, 124, 131, .14);
  --danger: #B23A3A;

  --shadow-sm: 0 1px 2px rgba(27, 35, 51, .05), 0 2px 10px rgba(27, 35, 51, .05);
  --shadow-md: 0 12px 30px rgba(27, 35, 51, .10);
  --shadow-lg: 0 24px 60px -20px rgba(27, 35, 51, .28);
  --radius: 16px;
  --maxw: 760px;

  --font-display: "Bricolage Grotesque", system-ui, -apple-system, sans-serif;
  --font-body: "Hanken Grotesk", system-ui, -apple-system, "Segoe UI", sans-serif;
  --font-mono: "JetBrains Mono", "SF Mono", ui-monospace, Menlo, monospace;

  /* consistent corner-radius language (blockish, not pill) */
  --r-chip: 10px;
  --r-btn: 11px;
  --r-input: 13px;
  --r-card: 15px;
}

/* ---- swappable designs (press 1–6): each is a palette + a contemporary type
       pairing. Design 1 = the :root default (Oat & Persimmon · Bricolage). ---- */
:root[data-design="2"] {   /* Graphite & Cobalt · Space Grotesk */
  --bg: #EEF0F3; --bg-2: #E3E7EC; --surface: #F8F9FB;
  --ink: #1A1E26; --ink-soft: #414855; --muted: #71798A; --line: #E0E4EA; --line-strong: #CBD1DB;
  --accent: #2B5CE6; --accent-hover: #1E48C4; --accent-soft: #D8E1FB; --accent-tint: #E9EFFD;
  --available: #2E7D5B; --available-bg: rgba(46, 125, 91, .12); --muted-bg: rgba(113, 121, 138, .14);
  --font-display: "Space Grotesk", system-ui, sans-serif;
  --font-body: "Inter", system-ui, -apple-system, sans-serif;
}
:root[data-design="3"] {   /* Mist & Violet · Sora */
  --bg: #EFEEF4; --bg-2: #E5E3EE; --surface: #F9F8FC;
  --ink: #241E33; --ink-soft: #46405A; --muted: #7A7488; --line: #E4E1EC; --line-strong: #D0CCDD;
  --accent: #6D4AE0; --accent-hover: #5638C4; --accent-soft: #E2DAFA; --accent-tint: #EEE9FB;
  --available: #2E7D5B; --available-bg: rgba(46, 125, 91, .12); --muted-bg: rgba(122, 116, 136, .14);
  --font-display: "Sora", system-ui, sans-serif;
  --font-body: "Inter", system-ui, -apple-system, sans-serif;
}
:root[data-design="4"] {   /* Cloud & Teal · Syne */
  --bg: #E9F1F1; --bg-2: #DDE9E9; --surface: #F5FAFA;
  --ink: #142A2C; --ink-soft: #3A5254; --muted: #6C8385; --line: #D7E6E6; --line-strong: #C2D7D7;
  --accent: #0E8A8F; --accent-hover: #0A6C70; --accent-soft: #CCE9EA; --accent-tint: #E1F2F2;
  --available: #2E7D5B; --available-bg: rgba(46, 125, 91, .12); --muted-bg: rgba(108, 131, 133, .14);
  --font-display: "Syne", system-ui, sans-serif;
  --font-body: "Inter", system-ui, -apple-system, sans-serif;
}
:root[data-design="5"] {   /* Bone & Forest · Big Shoulders Display */
  --bg: #F0EFE8; --bg-2: #E6E4D9; --surface: #FAF9F3;
  --ink: #1E241C; --ink-soft: #414A3E; --muted: #78806F; --line: #E2E1D2; --line-strong: #D0D0BE;
  --accent: #2F6B45; --accent-hover: #245436; --accent-soft: #D3E5D9; --accent-tint: #E6F0E9;
  --available: #2F6B45; --available-bg: rgba(47, 107, 69, .12); --muted-bg: rgba(120, 128, 111, .14);
  --font-display: "Big Shoulders Display", system-ui, sans-serif;
  --font-body: "Hanken Grotesk", system-ui, sans-serif;
}
:root[data-design="6"] {   /* Porcelain & Gold · Fraunces */
  --bg: #F4F3EF; --bg-2: #EAE8E1; --surface: #FBFAF7;
  --ink: #1E1C18; --ink-soft: #48443C; --muted: #837E72; --line: #E5E2D9; --line-strong: #D5D1C4;
  --accent: #B08114; --accent-hover: #916A0F; --accent-soft: #EFE3C6; --accent-tint: #F6EFDD;
  --available: #3C6B49; --available-bg: rgba(60, 107, 73, .12); --muted-bg: rgba(131, 126, 114, .14);
  --font-display: "Fraunces", Georgia, serif;
  --font-body: "Inter", system-ui, -apple-system, sans-serif;
}

* { box-sizing: border-box; }
html, body { margin: 0; height: 100%; background: var(--bg); color: var(--ink); font-family: var(--font-body); -webkit-font-smoothing: antialiased; text-rendering: optimizeLegibility; }

/* ambient background — warm, subtle brass/navy wash */
#atmosphere {
  position: fixed; inset: 0; z-index: 0; pointer-events: none;
  background:
    radial-gradient(50% 42% at 8% 0%, color-mix(in srgb, var(--accent) 11%, transparent), transparent 66%),
    radial-gradient(46% 40% at 96% 100%, color-mix(in srgb, var(--ink) 8%, transparent), transparent 60%),
    linear-gradient(180deg, var(--bg) 0%, var(--bg-2) 100%);
}

#app { position: relative; z-index: 1; display: flex; height: 100vh; height: 100dvh; }

/* off-canvas scrim */
#backdrop { position: fixed; inset: 0; z-index: 35; background: rgba(20, 24, 16, .40); opacity: 0; pointer-events: none; transition: opacity .2s ease; }
html.nav-open #backdrop, html.saved-open #backdrop { opacity: 1; pointer-events: auto; }

.hidden { display: none !important; }

/* view visibility by mode */
html.mode-home #main { display: none; }
html.mode-chat #homeView { display: none; }
html.mode-home .chat-only { display: none !important; }
html.mode-chat .home-only { display: none !important; }

/* --------------------------------------------------------------- */
/* Sidebar                                                          */
/* --------------------------------------------------------------- */
#sidebar {
  position: fixed; left: 0; top: 0; bottom: 0; z-index: 40;
  width: min(86vw, 320px);
  display: flex; flex-direction: column;
  background: var(--surface); border-right: 1px solid var(--line);
  transform: translateX(-100%); transition: transform .24s ease, width .2s ease;
  box-shadow: 14px 0 44px rgba(20, 30, 60, .16);
}
html.nav-open #sidebar { transform: none; }

.sidebar-head { display: flex; align-items: center; justify-content: space-between; gap: 8px; padding: 14px 14px 10px; }
.brand { display: flex; align-items: center; gap: 9px; min-width: 0; border: none; background: none; cursor: pointer; padding: 4px; border-radius: 10px; }
.brand:hover { background: var(--accent-tint); }
.brand-logo { height: 30px; width: auto; display: block; border-radius: 8px; }
.brand-name { font-family: var(--font-display); font-size: 20px; font-weight: 600; letter-spacing: -.01em; color: var(--ink); }

.page-switch { display: flex; gap: 4px; margin: 2px 12px 8px; background: var(--bg-2); border-radius: 11px; padding: 3px; }
.page-switch .seg { flex: 1; text-align: center; padding: 7px 10px; border-radius: 8px; font-size: 13px; font-weight: 600; color: var(--ink-soft); text-decoration: none; transition: all .12s ease; }
.page-switch .seg:hover { color: var(--accent); }
.page-switch .seg.active { background: var(--surface); color: var(--ink); box-shadow: var(--shadow-sm); cursor: default; }

.new-chat-btn { margin: 4px 12px 10px; padding: 11px 14px; border: 1px solid var(--line-strong); background: var(--surface-2); color: var(--ink); border-radius: 12px; font-family: var(--font-body); font-size: 14px; font-weight: 600; cursor: pointer; text-align: left; transition: all .15s ease; }
.new-chat-btn:hover { border-color: var(--accent); color: var(--accent); box-shadow: var(--shadow-sm); }

#historySection { flex: 1; min-height: 0; display: flex; flex-direction: column; overflow: hidden; }
.history-label { padding: 8px 18px 6px; font-size: 11px; font-weight: 700; text-transform: uppercase; letter-spacing: .09em; color: var(--muted); }
#convList { list-style: none; margin: 0; padding: 0 10px 10px; overflow-y: auto; flex: 1; }
#convList li { display: flex; align-items: center; gap: 6px; padding: 9px 11px; border-radius: 10px; cursor: pointer; transition: background .12s ease; }
#convList li:hover { background: var(--bg-2); }
#convList li.active { background: var(--accent-tint); }
#convList .conv-title { flex: 1; min-width: 0; font-size: 13.5px; font-weight: 500; color: var(--ink); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
#convList .conv-actions { display: flex; gap: 2px; opacity: 0; transition: opacity .12s ease; }
#convList li:hover .conv-actions, #convList li.active .conv-actions { opacity: 1; }
.conv-act-btn { border: none; background: transparent; color: var(--muted); cursor: pointer; font-size: 13px; padding: 3px 5px; border-radius: 7px; line-height: 1; }
.conv-act-btn:hover { color: var(--accent); background: var(--accent-tint); }
.conv-act-btn.danger:hover { color: var(--danger); background: rgba(178, 58, 58, .1); }

.signed-out { flex: none; padding: 14px 18px; display: flex; flex-direction: column; gap: 12px; }
.signed-out .muted { font-size: 13.5px; line-height: 1.55; }

.sidebar-foot { border-top: 1px solid var(--line); padding: 12px 14px; display: flex; align-items: center; gap: 10px; min-height: 56px; }
#accountSignedIn { display: flex; align-items: center; gap: 10px; min-width: 0; }
#userEmail { font-size: 12.5px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }

.primary-btn { align-self: flex-start; padding: 10px 18px; border: none; background: var(--ink); color: #F3EFE4; border-radius: 11px; font-family: var(--font-body); font-size: 13.5px; font-weight: 700; cursor: pointer; box-shadow: var(--shadow-sm); transition: all .15s ease; }
.primary-btn:hover { background: #10182a; transform: translateY(-1px); }

/* --------------------------------------------------------------- */
/* Content + topbar                                                 */
/* --------------------------------------------------------------- */
#content { flex: 1; display: flex; flex-direction: column; min-width: 0; }

#topbar { display: flex; align-items: center; gap: 8px; padding: 8px 16px; border-bottom: 1px solid transparent; }
html.mode-chat #topbar { border-color: var(--line); background: rgba(238, 235, 226, .8); backdrop-filter: saturate(140%) blur(10px); }
#topbar .spacer { flex: 1; }
.topbar-brand { display: flex; align-items: center; gap: 8px; border: none; background: none; cursor: pointer; padding: 4px 6px; border-radius: 9px; }
.topbar-brand:hover { background: var(--accent-tint); }
.topbar-logo { height: 24px; width: auto; border-radius: 6px; }
.topbar-title { font-family: var(--font-display); font-weight: 600; font-size: 18px; color: var(--ink); letter-spacing: -.01em; }
.topbar-actions { display: flex; gap: 9px; align-items: center; }

.icon-btn.ghost { background: transparent; border: none; color: var(--ink-soft); font-size: 20px; width: 38px; height: 38px; border-radius: 10px; cursor: pointer; }
.icon-btn.ghost:hover { color: var(--accent); background: var(--accent-tint); }

.ghost-btn { background: var(--surface); border: 1px solid var(--line-strong); color: var(--ink-soft); padding: 8px 14px; border-radius: 11px; cursor: pointer; font-family: var(--font-body); font-size: 13px; font-weight: 600; transition: all .15s ease; }
.ghost-btn:hover { border-color: var(--accent); color: var(--accent); transform: translateY(-1px); box-shadow: var(--shadow-sm); }
.count { display: inline-block; min-width: 19px; padding: 1px 6px; margin-left: 5px; border-radius: 7px; background: var(--accent); color: #fff; font-weight: 700; font-size: 12px; text-align: center; }

/* --------------------------------------------------------------- */
/* HOME / landing                                                   */
/* --------------------------------------------------------------- */
#homeView { flex: 1; overflow-y: auto; display: flex; align-items: flex-start; justify-content: center; }
.home-scroll { margin: 0 auto; width: 100%; max-width: 660px; padding: clamp(28px, 7vh, 82px) 20px 56px; }
.home-hero { text-align: center; }
.home-title { font-family: var(--font-display); font-weight: 600; font-size: clamp(27px, 5.2vw, 40px); line-height: 1.09; letter-spacing: -.02em; margin: 0 0 14px; text-wrap: balance; }
.home-title em { font-style: normal; color: var(--accent); }
.home-sub { font-size: clamp(14.5px, 2.3vw, 16.5px); line-height: 1.55; color: var(--ink-soft); max-width: 48ch; margin: 0 auto 22px; }

.home-composer { display: flex; align-items: flex-end; gap: 10px; background: var(--surface-2); border: 1px solid var(--line-strong); border-radius: var(--r-card); padding: 12px 12px 12px 18px; box-shadow: var(--shadow-md); text-align: left; transition: border-color .15s ease, box-shadow .15s ease; }
.home-composer:focus-within { border-color: var(--accent); box-shadow: 0 0 0 3px var(--accent-tint), var(--shadow-md); }
#homeInput { flex: 1; min-width: 0; border: none; background: transparent; outline: none; resize: none; font-family: var(--font-body); font-size: 16.5px; line-height: 1.5; color: var(--ink); max-height: 200px; padding: 6px 0; }
#homeInput::placeholder { color: var(--muted); }
.home-composer-actions { display: flex; align-items: center; gap: 8px; flex: none; }
.ask-btn { border: none; cursor: pointer; background: var(--ink); color: #F3EFE4; font-family: var(--font-body); font-weight: 700; font-size: 14.5px; padding: 0 20px; height: 46px; border-radius: var(--r-btn); white-space: nowrap; transition: all .15s ease; }
.ask-btn:hover { background: #10182a; transform: translateY(-1px); box-shadow: var(--shadow-sm); }
.ask-btn:disabled { opacity: .5; cursor: not-allowed; transform: none; }

.home-controls { display: flex; flex-wrap: wrap; align-items: center; justify-content: center; gap: 10px 18px; margin-top: 20px; }
.home-example { margin: 20px 0 0; font-size: 13.5px; color: var(--muted); }
.home-example #exampleText { color: var(--ink-soft); font-style: italic; }
.link-btn { border: none; background: none; padding: 0; cursor: pointer; font: inherit; font-weight: 700; color: var(--accent); text-decoration: underline; text-underline-offset: 2px; }

/* Design/copy switcher is hidden for normal visitors; typing the magic word
   "userfeedback" (outside the text box) unlocks it via the .feedback-mode class. */
.switcher { margin: 30px 0 0; display: none; flex-wrap: wrap; align-items: center; justify-content: center; gap: 8px 16px; }
html.feedback-mode .switcher { display: inline-flex; }
.sw-group { display: inline-flex; align-items: center; gap: 5px; }
.sw-lbl { font-size: 10.5px; font-weight: 700; letter-spacing: .1em; text-transform: uppercase; color: var(--muted); margin-right: 3px; }
.sw-key { font-family: var(--font-mono); font-size: 12px; font-weight: 600; cursor: pointer; background: var(--surface); border: 1px solid var(--line-strong); border-bottom-width: 2px; border-radius: 6px; width: 26px; height: 26px; color: var(--ink-soft); transition: all .12s ease; }
.sw-key:hover { border-color: var(--accent); color: var(--accent); transform: translateY(-1px); }
.sw-key.active { background: var(--accent); border-color: var(--accent); color: #fff; }
.sw-note { color: var(--muted); font-size: 11.5px; }
.palette-toast { position: fixed; left: 50%; bottom: 24px; transform: translateX(-50%) translateY(10px); background: var(--ink); color: var(--surface); padding: 9px 16px; border-radius: var(--r-btn); font-size: 13px; font-weight: 600; box-shadow: var(--shadow-md); opacity: 0; pointer-events: none; transition: opacity .2s ease, transform .2s ease; z-index: 60; }
.palette-toast.show { opacity: 1; transform: translateX(-50%) translateY(0); }

/* recents on the logged-in home */
.home-recents { margin: 40px auto 0; max-width: 560px; }
.recents-head { font-size: 12px; font-weight: 700; letter-spacing: .06em; text-transform: uppercase; color: var(--muted); margin-bottom: 10px; padding-left: 2px; }
.recent-list { list-style: none; margin: 0; padding: 0; display: grid; grid-template-columns: 1fr 1fr; gap: 8px; }
.recent-list li { display: flex; align-items: center; gap: 8px; padding: 12px 14px; background: var(--surface); border: 1px solid var(--line); border-radius: 12px; cursor: pointer; transition: all .13s ease; }
.recent-list li:hover { border-color: var(--accent); box-shadow: var(--shadow-sm); transform: translateY(-1px); }
.recent-list .rc-title { flex: 1; min-width: 0; font-size: 13.5px; font-weight: 600; color: var(--ink); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.recent-list .rc-arrow { color: var(--muted); font-size: 15px; }

/* --------------------------------------------------------------- */
/* Chip controls (shared: home style/TLD chips)                     */
/* --------------------------------------------------------------- */
.chip-set { display: flex; flex-wrap: wrap; gap: 6px; align-items: center; }
.chip-set-label { font-size: 10.5px; font-weight: 700; letter-spacing: .1em; text-transform: uppercase; color: var(--muted); margin-right: 3px; }
.chip { cursor: pointer; font-family: var(--font-body); font-size: 13px; font-weight: 600; padding: 7px 12px; border-radius: var(--r-chip); border: 1px solid var(--line-strong); background: var(--surface); color: var(--ink-soft); transition: all .13s ease; }
.chip:hover { border-color: var(--accent); color: var(--accent); }
.chip.active { background: var(--accent); border-color: var(--accent); color: #fff; }
#tldChips .chip { font-family: var(--font-mono); font-size: 12.5px; }

.adv-toggle { border: 1px solid var(--line-strong); background: var(--surface); color: var(--ink-soft); padding: 7px 13px; border-radius: var(--r-chip); font-family: var(--font-body); font-size: 13px; font-weight: 600; cursor: pointer; transition: all .13s ease; }
.adv-toggle::after { content: " ▾"; }
.adv-toggle[aria-expanded="true"]::after { content: " ▴"; }
.adv-toggle:hover { border-color: var(--accent); color: var(--accent); }

.adv-panel { max-width: 460px; margin: 16px auto 0; padding: 16px 18px; text-align: left; background: var(--surface); border: 1px solid var(--line); border-radius: 14px; display: flex; flex-direction: column; gap: 16px; }
.adv-row { display: flex; flex-direction: column; gap: 7px; }
.adv-label-row { display: flex; align-items: baseline; justify-content: space-between; gap: 10px; }
.adv-label { font-size: 13px; font-weight: 700; color: var(--ink); }
.adv-value { font-family: var(--font-mono); font-size: 13px; font-weight: 600; color: var(--accent); background: var(--accent-tint); border: 1px solid var(--accent-soft); border-radius: 8px; padding: 3px 9px; width: 130px; text-align: right; }
.adv-value:focus { outline: none; border-color: var(--accent); box-shadow: 0 0 0 3px var(--accent-tint); }
.adv-help { margin: 0; font-size: 12px; line-height: 1.5; color: var(--muted); }
#budgetRange { -webkit-appearance: none; appearance: none; width: 100%; height: 6px; border-radius: 999px; background: var(--line-strong); cursor: pointer; }
#budgetRange::-webkit-slider-thumb { -webkit-appearance: none; appearance: none; width: 20px; height: 20px; border-radius: 50%; background: var(--accent); border: 3px solid #fff; box-shadow: 0 1px 5px rgba(154, 123, 46, .5); }
#budgetRange::-moz-range-thumb { width: 18px; height: 18px; border-radius: 50%; background: var(--accent); border: 3px solid #fff; }
#providerSelect { border: 1px solid var(--line-strong); background: var(--surface-2); color: var(--ink); border-radius: 11px; padding: 9px 12px; font-family: var(--font-body); font-size: 13.5px; font-weight: 600; cursor: pointer; max-width: 260px; }
#providerSelect:focus { outline: none; border-color: var(--accent); box-shadow: 0 0 0 3px var(--accent-tint); }
#providerSelect:disabled { opacity: .6; cursor: not-allowed; }

/* --------------------------------------------------------------- */
/* CHAT / workspace                                                 */
/* --------------------------------------------------------------- */
#main { flex: 1; display: flex; overflow: hidden; }
#chatPane { flex: 1; display: flex; flex-direction: column; min-width: 0; }
#messages { flex: 1; overflow-y: auto; padding: 28px 16px 8px; }

.row { display: flex; max-width: var(--maxw); margin: 0 auto 20px; }
.row.user { justify-content: flex-end; }
.bubble { padding: 13px 17px; border-radius: var(--radius); line-height: 1.6; font-size: 15px; word-wrap: break-word; }
.row.user .bubble { background: var(--ink); color: #ECEFF6; border-bottom-right-radius: 5px; max-width: 80%; white-space: pre-wrap; box-shadow: var(--shadow-sm); }
.row.agent { flex-direction: column; }
.row.agent .bubble { background: var(--surface-2); border: 1px solid var(--line); border-bottom-left-radius: 5px; max-width: 100%; box-shadow: var(--shadow-sm); }

.bubble.md p { margin: 0 0 10px; }
.bubble.md p:last-child { margin-bottom: 0; }
.bubble.md ul, .bubble.md ol { margin: 6px 0 10px; padding-left: 22px; }
.bubble.md li { margin: 3px 0; }
.bubble.md strong { font-weight: 700; color: var(--ink); }
.bubble.md em { font-style: italic; }
.bubble.md a { color: var(--accent); text-decoration: underline; text-underline-offset: 2px; }
.bubble.md code { font-family: var(--font-mono); font-size: 13px; background: var(--accent-tint); border: 1px solid var(--accent-soft); color: var(--accent-hover); padding: 1px 6px; border-radius: 6px; }

.agent-label { font-family: var(--font-display); font-size: 14px; font-weight: 600; color: var(--accent); margin: 0 auto 7px 2px; max-width: var(--maxw); width: 100%; }

.thinking { max-width: var(--maxw); margin: 0 auto 9px 0; width: 100%; }
.thinking details { border: 1px dashed var(--line-strong); border-radius: 11px; background: rgba(255, 255, 255, .5); }
.thinking summary { cursor: pointer; padding: 8px 13px; color: var(--muted); font-size: 13px; font-weight: 600; user-select: none; }
.thinking .think-body { padding: 0 13px 11px; color: var(--ink-soft); font-size: 13px; white-space: pre-wrap; line-height: 1.55; }

.status, .reconnecting { max-width: var(--maxw); width: 100%; margin: 0 auto 11px 2px; font-size: 13px; font-weight: 600; display: flex; align-items: center; gap: 9px; }
.status { color: var(--accent); }
.reconnecting { color: var(--danger); }
.status .dot, .reconnecting .dot { width: 7px; height: 7px; border-radius: 50%; background: currentColor; animation: pulse 1.1s infinite ease-in-out; }
@keyframes pulse { 0%, 100% { opacity: .3; transform: scale(.85); } 50% { opacity: 1; transform: scale(1); } }

/* candidate table (render.js) */
.candidates { max-width: var(--maxw); width: 100%; margin: 2px auto 16px 0; border: 1px solid var(--line); border-radius: var(--radius); overflow: hidden; background: var(--surface-2); box-shadow: var(--shadow-md); animation: rise .35s ease both; }
@keyframes rise { from { opacity: 0; transform: translateY(8px); } to { opacity: 1; transform: none; } }
.cand-head { display: flex; align-items: center; gap: 8px; padding: 10px 16px; background: var(--available-bg); border-bottom: 1px solid var(--line); font-size: 12px; font-weight: 700; color: var(--available); }
.cand-head-tick { display: grid; place-items: center; width: 17px; height: 17px; border-radius: 50%; background: var(--available); color: #fff; font-size: 11px; }
.cand-head-hint { margin-left: auto; color: var(--muted); font-weight: 600; }
.cand-row { display: flex; align-items: center; gap: 13px; padding: 13px 16px; border-top: 1px solid var(--line); transition: background .12s ease; }
.cand-row:first-of-type { border-top: none; }
.cand-row:hover { background: #F7F5EC; }
.cand-main { flex: 1; min-width: 0; }
.cand-domain { font-family: var(--font-mono); font-size: 15px; font-weight: 600; color: var(--ink); letter-spacing: -.01em; }
.cand-rationale { color: var(--ink-soft); font-size: 13px; margin-top: 3px; line-height: 1.45; }
.cand-meta { display: flex; align-items: center; gap: 10px; flex: none; }
.premium-pill { font-size: 10.5px; font-weight: 700; text-transform: uppercase; letter-spacing: .04em; padding: 3px 8px; border-radius: 7px; white-space: nowrap; background: var(--accent-tint); color: var(--accent-hover); }
.cand-price { color: var(--muted); font-size: 12.5px; font-family: var(--font-mono); min-width: 62px; text-align: right; }
.cand-star { flex: none; width: 30px; height: 30px; display: grid; place-items: center; border: none; background: transparent; cursor: pointer; font-size: 20px; line-height: 1; color: var(--line-strong); border-radius: 8px; transition: color .14s ease, transform .12s ease, background .12s ease; }
.cand-star:hover { color: var(--accent); background: var(--accent-tint); transform: scale(1.08); }
.cand-star[aria-pressed="true"] { color: var(--accent); }

/* coach-mark + CTA */
.star-coach { max-width: var(--maxw); width: 100%; margin: -6px auto 16px 0; display: flex; align-items: center; gap: 11px; padding: 11px 15px; border: 1px dashed var(--accent); border-radius: 13px; background: var(--accent-tint); animation: rise .35s ease both; }
.star-coach-star { color: var(--accent); font-size: 18px; animation: pulse 1.6s infinite ease-in-out; }
.star-coach-text { flex: 1; font-size: 13px; color: var(--ink-soft); }
.star-coach-dismiss, .cta-dismiss { border: none; background: transparent; color: var(--muted); cursor: pointer; font-size: 15px; padding: 3px 7px; border-radius: 8px; }
.star-coach-dismiss:hover, .cta-dismiss:hover { color: var(--ink); background: rgba(20, 30, 60, .06); }
.cta-banner { max-width: var(--maxw); width: 100%; margin: 2px auto 18px 0; display: flex; align-items: center; gap: 14px; padding: 14px 18px; border: 1px solid var(--accent-soft); border-radius: var(--radius); background: linear-gradient(180deg, #FBF6E9 0%, var(--accent-tint) 100%); box-shadow: var(--shadow-sm); animation: rise .35s ease both; }
.cta-banner .cta-text { flex: 1; min-width: 0; }
.cta-banner .cta-text strong { display: block; font-size: 14.5px; color: var(--ink); margin-bottom: 2px; }
.cta-banner .cta-text span { font-size: 13px; color: var(--ink-soft); }

/* chat composer */
#composer { display: flex; align-items: flex-end; gap: 9px; max-width: var(--maxw); width: 100%; margin: 0 auto; padding: 10px 16px 4px; }
#input { flex: 1; resize: none; background: var(--surface-2); border: 1px solid var(--line-strong); color: var(--ink); border-radius: var(--r-input); padding: 13px 15px; font-size: 15px; line-height: 1.45; max-height: 200px; font-family: var(--font-body); box-shadow: var(--shadow-sm); transition: border-color .15s ease, box-shadow .15s ease; }
#input::placeholder { color: var(--muted); }
#input:focus { outline: none; border-color: var(--accent); box-shadow: 0 0 0 3px var(--accent-tint); }
.icon-btn, .send-btn { display: grid; place-items: center; border: 1px solid var(--line-strong); background: var(--surface-2); color: var(--ink-soft); width: 46px; height: 46px; border-radius: var(--r-btn); cursor: pointer; font-size: 17px; flex: none; transition: all .15s ease; }
.icon-btn svg { width: 20px; height: 20px; display: block; }
.icon-btn:hover { border-color: var(--accent); color: var(--accent); transform: translateY(-1px); }
.send-btn { background: var(--ink); color: #F3EFE4; border-color: var(--ink); font-weight: 700; }
.send-btn:hover { background: #10182a; transform: translateY(-1px); }
.send-btn:disabled { opacity: .45; cursor: not-allowed; transform: none; }
.icon-btn.recording { background: var(--danger); border-color: var(--danger); color: #fff; animation: pulse 1s infinite; }
.chat-hint { max-width: var(--maxw); width: 100%; margin: 0 auto; padding: 6px 16px 14px; color: var(--muted); font-size: 12px; text-align: center; }

/* favorites panel */
#savedPanel { width: 320px; flex: none; border-left: 1px solid var(--line); background: var(--surface); display: flex; flex-direction: column; overflow: hidden; transition: transform .22s ease; }
.panel-head { display: flex; align-items: center; justify-content: space-between; padding: 14px 14px 14px 18px; border-bottom: 1px solid var(--line); }
.panel-head h2 { font-family: var(--font-display); font-size: 18px; font-weight: 600; margin: 0; }
#savedList { list-style: none; margin: 0; padding: 10px; overflow-y: auto; flex: 1; }
#savedList li { display: flex; align-items: center; gap: 10px; padding: 10px 11px; border-radius: 11px; transition: background .12s ease; }
#savedList li:hover { background: var(--bg-2); }
#savedList .sv-domain { flex: 1; font-family: var(--font-mono); font-size: 14px; font-weight: 500; word-break: break-all; color: var(--ink); }
.trash-btn { border: none; background: transparent; color: var(--muted); cursor: pointer; font-size: 15px; padding: 5px 7px; border-radius: 9px; transition: all .12s ease; }
.trash-btn:hover { color: var(--danger); background: rgba(178, 58, 58, .1); }
#savedEmpty { padding: 16px 18px; }
.muted { color: var(--muted); font-size: 13px; line-height: 1.5; }

/* --------------------------------------------------------------- */
/* Admin (re-themed)                                                */
/* --------------------------------------------------------------- */
.admin-title { padding: 10px 16px 8px; font-family: var(--font-display); font-size: 15px; font-weight: 600; color: var(--ink); }
.admin-filters { display: flex; gap: 6px; padding: 0 12px 10px; }
.filter-btn { flex: 1; padding: 6px 8px; border: 1px solid var(--line-strong); background: var(--surface); color: var(--ink-soft); border-radius: 9px; font-family: var(--font-body); font-size: 12px; font-weight: 600; cursor: pointer; transition: all .12s ease; }
.filter-btn:hover { border-color: var(--accent); color: var(--accent); }
.filter-btn.active { background: var(--accent); color: #fff; border-color: var(--accent); }
#adminList { list-style: none; margin: 0; padding: 0 10px; overflow-y: auto; flex: 1; }
.session-item { padding: 10px 11px; border-radius: 10px; cursor: pointer; transition: background .12s ease; }
.session-item:hover { background: var(--bg-2); }
.session-item.active { background: var(--accent-tint); }
.session-top { display: flex; align-items: center; gap: 8px; }
.session-top .conv-title { flex: 1; min-width: 0; font-size: 13.5px; font-weight: 600; color: var(--ink); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.owner-badge { font-size: 10px; font-weight: 700; text-transform: uppercase; letter-spacing: .04em; padding: 2px 7px; border-radius: 10px; white-space: nowrap; }
.owner-badge.user { background: var(--available-bg); color: var(--available); }
.owner-badge.anon { background: var(--muted-bg); color: var(--muted); }
.session-meta { font-size: 11.5px; color: var(--muted); margin-top: 3px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
#messages:empty { flex: 0 0 auto; }
.admin-notice { max-width: var(--maxw); margin: auto; padding: 18px 22px; border: 1px dashed var(--line-strong); border-radius: var(--radius); background: rgba(255, 255, 255, .6); color: var(--ink-soft); font-size: 14px; text-align: center; }

/* --------------------------------------------------------------- */
/* Desktop: sidebar + panels live in the layout (chat mode)         */
/* --------------------------------------------------------------- */
@media (min-width: 821px) {
  html.mode-chat #sidebar { position: relative; transform: none; box-shadow: none; }
  html.mode-chat:not(.nav-open) #sidebar { width: 0; border-right: none; overflow: hidden; }
  html.mode-chat:not(.nav-open) #sidebar > * { display: none; }
  html.mode-chat.nav-open #backdrop { display: none; }
  html:not(.saved-open) #savedPanel { display: none; }
  #navClose { display: none; }
}

/* --------------------------------------------------------------- */
/* Mobile: everything off-canvas                                    */
/* --------------------------------------------------------------- */
@media (max-width: 820px) {
  #savedPanel { position: fixed; right: 0; top: 0; bottom: 0; width: min(86vw, 330px); transform: translateX(100%); box-shadow: -14px 0 44px rgba(20, 30, 60, .2); z-index: 40; }
  html.saved-open #savedPanel { transform: none; }
  #topbar { padding: 10px 14px; }
  #messages { padding: 18px 12px 8px; }
  .home-scroll { padding-top: 24px; }
  .recent-list { grid-template-columns: 1fr; }
  .home-composer { flex-direction: column; align-items: stretch; }
  .home-composer-actions { justify-content: space-between; }
  .ask-btn { flex: 1; }
}

@media (prefers-reduced-motion: reduce) {
  * { animation-duration: .001ms !important; transition-duration: .001ms !important; }
}
