:root {
  --bg: #faf7f2;
  --bg-soft: #f3eee7;
  --card: #fffdf9;
  --ink: #2b2a28;
  --ink-soft: #5f5b57;
  --ink-faint: #716a63;
  --line: #e9e0d5;
  --line-soft: #f0e8dc;
  --lav: #7c6fae;
  --lav-deep: #5f5489;
  --lav-soft: #efeaf8;
  --lav-mist: #f6f2fc;
  --sage: #6f8f7d;
  --danger: #a44a4a;
  --radius: 20px;
  --radius-sm: 12px;
  --shadow: 0 12px 40px rgba(80, 66, 120, 0.08), 0 1px 0 rgba(255, 255, 255, 0.7) inset;
  --shadow-sm: 0 4px 18px rgba(80, 66, 120, 0.07);
  --font-body: "DM Sans", ui-sans-serif, system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  --font-display: ui-serif, Georgia, "Times New Roman", serif;
}

body[data-theme="night"] {
  --bg: #1d1b24;
  --bg-soft: #272432;
  --card: #282532;
  --ink: #f4f0f7;
  --ink-soft: #d0c9d8;
  --ink-faint: #aaa1b5;
  --line: #40394d;
  --line-soft: #363040;
  --lav-soft: #342e47;
  --lav-mist: #2b263b;
  --lav: #a99be0;
  --lav-deep: #c3b7f1;
  --shadow: 0 12px 40px rgba(0, 0, 0, 0.22), 0 1px 0 rgba(255, 255, 255, 0.03) inset;
  --shadow-sm: 0 4px 18px rgba(0, 0, 0, 0.2);
}

* { box-sizing: border-box; }
[hidden] { display: none !important; }
html { margin: 0; padding: 0; scroll-behavior: smooth; }

.skip-link { position: fixed; top: -100px; left: 16px; z-index: 100; background: var(--ink); color: #fff; padding: 10px 14px; border-radius: 8px; }
.skip-link:focus { top: 10px; }

body {
  margin: 0; padding: 0;
  font-family: var(--font-body);
  background: var(--bg);
  color: var(--ink);
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
}
body > *:not(.ambient):not(.skip-link):not(.site-header) { position: relative; z-index: 1; }
body[data-theme="night"] .site-header { background: rgba(29, 27, 36, 0.88); }
body[data-theme="night"] textarea, body[data-theme="night"] .history-item, body[data-theme="night"] .msg-assistant { background: #302c3b; }
body[data-theme="night"] .thread-empty, body[data-theme="night"] .empty-history, body[data-theme="night"] .history-search { background: var(--bg-soft); }
body[data-theme="night"] .msg-user { background: #51476f; color: #fbfaff; }
body[data-theme="night"] .msg-user .message-action { color: #e1d9ff; }
body[data-theme="night"] .chip { background: #342e47; border-color: #5b4f7e; color: #e1d9ff; }
body[data-theme="night"] .chip:hover { background: #403657; }
body[data-theme="night"] .btn-ghost:hover { background: #302c3b; }
body[data-theme="night"] .btn-primary { background: #f4f1ff; color: #1d1a2b; box-shadow: 0 8px 24px rgba(0, 0, 0, .28); }
body[data-theme="night"] .btn-primary:hover { background: #fff; color: #15121f; }

/* Focus Mode uses a deeper, higher-contrast palette so the timer is easier to read. */
body.focus-mode {
  --bg: #f6f3fb; --bg-soft: #ece8f5; --card: rgba(255, 253, 249, 0.92);
  --ink: #29263a; --ink-soft: #5d586d; --ink-faint: #7e7890;
  --line: #dcd6e9; --line-soft: #e8e2f0; --lav: #7665ad; --lav-deep: #5d4d91;
  --lav-soft: #e9e3f8; --lav-mist: #f5f1fc;
  --shadow: 0 18px 70px rgba(80, 66, 120, 0.14), 0 1px 0 rgba(255, 255, 255, 0.72) inset;
  --shadow-sm: 0 8px 28px rgba(80, 66, 120, 0.1);
}
body.focus-mode[data-theme="night"] {
  --bg: #101522; --bg-soft: #192238; --card: rgba(25, 32, 53, 0.92);
  --ink: #f4f7ff; --ink-soft: #c6d0e7; --ink-faint: #93a1c0;
  --line: #34415f; --line-soft: #28344f; --lav: #9caeff; --lav-deep: #c3ceff;
  --lav-soft: #263454; --lav-mist: #1c2945;
  --shadow: 0 18px 70px rgba(3, 8, 22, 0.38), 0 1px 0 rgba(255, 255, 255, 0.05) inset;
  --shadow-sm: 0 8px 28px rgba(3, 8, 22, 0.28);
}
body.focus-mode .site-header { background: color-mix(in srgb, var(--card) 78%, transparent); border-color: color-mix(in srgb, var(--lav) 18%, var(--line)); }
body.focus-mode .btn-primary { background: #eff3ff; color: #111827; box-shadow: 0 10px 30px rgba(134, 158, 255, 0.24); }
body.focus-mode .btn-primary:hover { background: #fff; }
body.focus-mode .msg-user { background: #e7edff; color: #172033; }
body.focus-mode .msg-user .message-action { color: #53648e; }

/* Cursor-reactive atmosphere: decorative only, with a reduced-motion fallback. */
.ambient { position: fixed; inset: 0; z-index: 0; overflow: clip; contain: layout paint; pointer-events: none; isolation: isolate; }
.ambient-grid { position: absolute; inset: 0; opacity: .34; background-image: linear-gradient(rgba(124,111,174,.07) 1px, transparent 1px), linear-gradient(90deg, rgba(124,111,174,.07) 1px, transparent 1px); background-size: 72px 72px; mask-image: linear-gradient(to bottom, transparent, black 18%, black 78%, transparent); }
.cursor-aura { position: absolute; width: 420px; height: 420px; left: calc(var(--cursor-x, 50) * 1% - 210px); top: calc(var(--cursor-y, 42) * 1% - 210px); border-radius: 50%; background: radial-gradient(circle, rgba(164, 143, 238, .18), rgba(164, 143, 238, 0) 68%); filter: blur(10px); transition: left .35s ease-out, top .35s ease-out; }
.ambient-orb { position: absolute; border-radius: 50%; filter: blur(58px); opacity: .46; will-change: transform; animation: float-orb 18s ease-in-out infinite alternate; }
.ambient-orb-one { width: 440px; height: 440px; background: #d9d0f2; top: -180px; right: -120px; }
.ambient-orb-two { width: 380px; height: 380px; background: #f2dfc6; bottom: -160px; left: -120px; animation-delay: -7s; }
.ambient-orb-three { width: 280px; height: 280px; background: #cfe6df; top: 42%; left: 36%; opacity: .22; animation-delay: -12s; }
.ambient-ring { position: absolute; border: 1px solid rgba(124,111,174,.14); border-radius: 50%; transform: translate3d(calc((var(--cursor-x, 50) - 50) * -0.12px), calc((var(--cursor-y, 42) - 50) * -0.12px), 0); transition: transform .5s ease-out; }
.ambient-ring-one { width: 58vw; height: 58vw; max-width: 880px; max-height: 880px; top: 4%; left: 21%; }
.ambient-ring-two { width: 36vw; height: 36vw; max-width: 520px; max-height: 520px; top: 21%; left: 34%; border-color: rgba(124,111,174,.1); }
@keyframes float-orb { from { transform: translate3d(-12px, 8px, 0) scale(.98); } to { transform: translate3d(18px, -18px, 0) scale(1.04); } }
body.focus-mode .ambient-grid { opacity: .34; background-image: linear-gradient(color-mix(in srgb, var(--lav) 10%, transparent) 1px, transparent 1px), linear-gradient(90deg, color-mix(in srgb, var(--lav) 10%, transparent) 1px, transparent 1px); }
body.focus-mode .cursor-aura { background: radial-gradient(circle, rgba(116, 145, 255, .24), rgba(116, 145, 255, 0) 68%); }
body.focus-mode .ambient-orb-one { background: #c9b9ed; opacity: .26; }
body.focus-mode .ambient-orb-two { background: #b8d9d1; opacity: .18; }
body.focus-mode .ambient-orb-three { background: #d5c5f1; opacity: .2; }
body.focus-mode .ambient-ring { border-color: color-mix(in srgb, var(--lav) 20%, transparent); }
body.focus-mode[data-theme="night"] .ambient-grid { opacity: .5; background-image: linear-gradient(rgba(156,174,255,.08) 1px, transparent 1px), linear-gradient(90deg, rgba(156,174,255,.08) 1px, transparent 1px); }
body.focus-mode[data-theme="night"] .ambient-orb-one { background: #5267c8; opacity: .28; }
body.focus-mode[data-theme="night"] .ambient-orb-two { background: #367b91; opacity: .2; }
body.focus-mode[data-theme="night"] .ambient-orb-three { background: #8f75e8; opacity: .22; }
body.focus-mode[data-theme="night"] .ambient-ring { border-color: rgba(156,174,255,.22); }

.wrap { width: 100%; max-width: none; margin: 0 auto; padding: 0 28px; }

/* header */
.site-header {
  position: sticky; top: 0; margin-block-start: 0; z-index: 20;
  background: rgba(250, 247, 242, 0.85);
  backdrop-filter: blur(12px); -webkit-backdrop-filter: blur(12px);
  border-bottom: 1px solid var(--line-soft);
}
.header-inner { display: flex; align-items: center; justify-content: space-between; padding: 14px 22px; }
.header-brand-actions { display: flex; align-items: center; gap: 18px; flex: 0 0 auto; }
.brand { display: flex; align-items: center; gap: 10px; text-decoration: none; color: inherit; }
.brand-mark {
  width: 28px; height: 28px; border-radius: 50%;
  background: radial-gradient(circle at 35% 35%, #b7a9e0, var(--lav) 65%, var(--lav-deep));
  box-shadow: 0 0 0 6px var(--lav-soft);
}
.brand-text { font-family: var(--font-display); font-weight: 700; font-size: 1.45rem; letter-spacing: -0.01em; }
.header-nav { display: flex; align-items: center; gap: 14px; }
.theme-toggle { width: 42px; min-width: 42px; height: 42px; padding: 0 !important; justify-content: center; }
.theme-toggle .theme-icon { width: 19px; height: 19px; fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; }
#clarityNavBtn {
  position: relative;
  border-color: color-mix(in srgb, var(--lav) 44%, var(--line));
  background: color-mix(in srgb, var(--lav-soft) 78%, var(--card));
  color: var(--lav-deep);
  box-shadow: 0 3px 0 color-mix(in srgb, var(--lav) 20%, var(--line)), 0 0 0 1px color-mix(in srgb, var(--lav) 18%, transparent), 0 7px 18px rgba(95,84,137,.12), 0 1px 0 rgba(255,255,255,.72) inset;
  animation: clarity-nav-highlight 2.8s ease-in-out infinite;
}
#clarityNavBtn .clarity-nav-sparkle { width:16px; height:16px; flex:none; fill:none; stroke:currentColor; stroke-width:1.7; stroke-linecap:round; stroke-linejoin:round; }
#clarityNavBtn:hover { transform: translateY(-2px); animation-play-state: paused; background: var(--lav-soft); border-color: var(--lav); box-shadow: 0 4px 0 color-mix(in srgb, var(--lav) 26%, var(--line)), 0 0 0 3px color-mix(in srgb, var(--lav) 15%, transparent), 0 12px 22px rgba(95,84,137,.18); }
#clarityNavBtn:focus-visible { outline: 2px solid var(--lav-deep); outline-offset: 3px; animation: none; }
@keyframes clarity-nav-highlight {
  0%, 100% { box-shadow: 0 3px 0 color-mix(in srgb, var(--lav) 20%, var(--line)), 0 0 0 1px color-mix(in srgb, var(--lav) 18%, transparent), 0 7px 18px rgba(95,84,137,.12), 0 1px 0 rgba(255,255,255,.72) inset; }
  50% { box-shadow: 0 3px 0 color-mix(in srgb, var(--lav) 24%, var(--line)), 0 0 0 4px color-mix(in srgb, var(--lav) 14%, transparent), 0 9px 24px rgba(95,84,137,.19), 0 1px 0 rgba(255,255,255,.78) inset; }
}
body[data-theme="night"] #clarityNavBtn { background: color-mix(in srgb, var(--lav-soft) 88%, var(--card)); box-shadow: 0 3px 0 rgba(0,0,0,.25), 0 0 0 1px rgba(195,183,241,.18), 0 7px 20px rgba(0,0,0,.24), 0 1px 0 rgba(255,255,255,.08) inset; }
.profile-trigger { display: inline-flex; align-items: center; gap: 8px; white-space: nowrap; }
.profile-avatar { display: inline-grid; place-items: center; width: 22px; height: 22px; border: 1px solid currentColor; border-radius: 50%; }
.profile-avatar svg { width: 15px; height: 15px; fill: none; stroke: currentColor; stroke-width: 1.7; stroke-linecap: round; stroke-linejoin: round; }
.header-note { color: var(--ink-faint); font-size: 0.9rem; white-space: nowrap; }
.account-greeting { color: var(--lav-deep); font-size: .82rem; font-weight: 700; white-space: nowrap; }
body:not(.chat-view):not(.focus-mode) .account-greeting { display: none !important; }
@media (max-width: 560px) { .header-note { display: none; } }
@media (min-width: 561px) and (max-width: 920px) {
  .header-inner { flex-wrap:wrap; gap:10px 18px; }
  .header-brand-actions { flex:1 1 auto; }
  .header-nav { width:100%; justify-content:center; flex-wrap:wrap; gap:6px 10px; }
  .header-nav .btn { padding:7px 11px; }
}
body.focus-mode .home-view, body.focus-mode .layout, body:not(.focus-mode) .focus-screen { display: none; }
body.voice-view .home-view, body.voice-view .layout, body.voice-view .focus-screen { display: none; }
body.focus-mode .clarity-screen, body.voice-view .clarity-screen { display: none; }
body.clarity-view .home-view, body.clarity-view .layout, body.clarity-view .focus-screen, body:not(.clarity-view) .clarity-screen { display: none; }
body.voice-view .voice-view { display: block; }
body.voice-view .voice-view[hidden] { display: block !important; }
body.focus-mode .focus-screen { display: block; padding-top: 44px; padding-bottom: 60px; }
body.focus-mode .focus-screen[hidden] { display: block !important; }
body.focus-mode #focusBtn { border-color: rgba(190, 202, 255, .8); background: rgba(102, 120, 190, .2); }

/* Landing page */
.home-view { min-height: calc(100vh - 100px); display: flex; flex-direction: column; justify-content: center; padding-top: 56px; padding-bottom: 64px; }
.home-hero { width: min(100%, 980px); margin: 0 auto; text-align: center; }
.home-account-greeting { margin: 0 0 18px; color: var(--lav-deep); font-size: .88rem; font-weight: 700; letter-spacing: .02em; }
.home-hero h1 { margin: 12px 0 20px; font-family: var(--font-display); font-size: clamp(2.4rem, 5vw, 4.6rem); font-weight: 700; letter-spacing: -.045em; line-height: 1; }
.home-brand-lockup { display: inline-flex; align-items: center; justify-content: center; gap: 14px; }
.home-brand-lockup .brand-mark { width: 64px; height: 64px; box-shadow: 0 0 0 10px var(--lav-soft); }
.home-title-description { margin: 0 0 22px; font-family: var(--font-display); font-size: clamp(2.7rem, 5.2vw, 4.5rem); font-weight: 500; letter-spacing: -.055em; line-height: 1; }
.home-title-description em { color: var(--lav-deep); font-style: italic; }
.home-lede { max-width: 620px; margin: 0 auto 34px; color: var(--ink-soft); font-size: clamp(1.05rem, 1.5vw, 1.35rem); }
.home-entry { position: relative; width: min(100%, 760px); margin: 0 auto; padding: 0; border: 1px solid var(--line); border-radius: 24px; background: var(--card); box-shadow: var(--shadow-sm); text-align: left; overflow: hidden; transition: border-color .2s ease, box-shadow .2s ease; }
.home-entry::before { content: "START A THOUGHT"; display: block; padding: 17px 28px 0; color: var(--lav-deep); font-size: .66rem; font-weight: 800; letter-spacing: .16em; }
.home-entry:focus-within { border-color: color-mix(in srgb, var(--ink-soft) 35%, var(--line)); box-shadow: var(--shadow); }
.home-entry textarea { min-height: 104px; padding: 12px 28px 20px; border: 0; background: transparent; box-shadow: none; resize: vertical; font-size: 1.08rem; line-height: 1.5; }
.home-entry textarea:focus { box-shadow: none; }
.home-entry-footer { display: flex; align-items: center; justify-content: space-between; gap: 16px; padding: 14px 18px 14px 28px; border-top: 1px solid color-mix(in srgb, var(--line) 70%, transparent); color: var(--ink-faint); font-size: .74rem; letter-spacing: .01em; }
.home-entry-footer .btn { flex-shrink: 0; }
.home-entry-actions { display: flex; align-items: center; gap: 8px; }
.home-mic { display: inline-grid; place-items: center; width: 46px; height: 46px; padding: 0; border: 1px solid var(--line); border-radius: 50%; background: var(--card); color: var(--ink-soft); }
.home-mic svg { width: 22px; height: 22px; fill: none; stroke: var(--ink-soft); stroke-width: 1.9; stroke-linecap: round; stroke-linejoin: round; }
.home-mic.recording { color: var(--danger); border-color: var(--danger); animation: mic-pulse 1.2s ease-in-out infinite; }
#homeVoiceStatus { display: block; min-height: 0; color: var(--danger); font-size: .72rem; }
.home-entry-footer .home-cta {
  position: relative; isolation: isolate; overflow: hidden;
  min-height: 48px; padding: 7px 8px 7px 20px; border: 1px solid color-mix(in srgb, var(--ink) 82%, white);
  border-radius: 16px; background: var(--ink); color: #fff;
  box-shadow: 0 10px 24px rgba(38, 32, 55, .2), 0 1px 0 rgba(255,255,255,.12) inset;
  font-size: .88rem; letter-spacing: .01em; transition: transform .2s ease, box-shadow .2s ease, background .2s ease;
}
.home-entry-footer .home-cta::before { content: ""; position: absolute; z-index: -1; inset: 0; background: linear-gradient(110deg, transparent 15%, rgba(255,255,255,.13) 48%, transparent 78%); transform: translateX(-115%); transition: transform .55s ease; }
.home-entry-footer .home-cta:hover { background: color-mix(in srgb, var(--ink) 88%, var(--lav)); box-shadow: 0 14px 30px rgba(38, 32, 55, .28), 0 1px 0 rgba(255,255,255,.16) inset; transform: translateY(-2px); }
.home-entry-footer .home-cta:hover::before { transform: translateX(115%); }
.home-entry-footer .home-cta:active { transform: translateY(0) scale(.98); }
.home-entry-footer .home-cta .cta-arrow { display: grid; place-items: center; width: 32px; height: 32px; margin-left: 4px; border-radius: 10px; background: rgba(255,255,255,.13); font-size: 1.05rem; line-height: 1; transition: transform .2s ease, background .2s ease; }
.home-entry-footer .home-cta:hover .cta-arrow { transform: translateX(3px); background: rgba(255,255,255,.2); }
.home-prompts { display: flex; flex-wrap: wrap; justify-content: center; gap: 9px; margin-top: 18px; }
.home-prompts .chip { position: relative; padding: 10px 17px; font-size: .8rem; background: linear-gradient(145deg, color-mix(in srgb, var(--lav-soft) 68%, white), color-mix(in srgb, var(--lav-mist) 72%, transparent)); border-color: color-mix(in srgb, var(--lav) 34%, var(--line)); box-shadow: 0 4px 0 color-mix(in srgb, var(--lav-deep) 16%, transparent), 0 8px 16px rgba(63, 48, 104, .08), 0 1px 0 rgba(255,255,255,.7) inset; transition: transform .2s ease, background .2s ease, border-color .2s ease, box-shadow .2s ease; }
.home-prompts .chip::before { content: ""; position: absolute; pointer-events: none; inset: 1px 12px auto; height: 1px; border-radius: 999px; background: rgba(255,255,255,.7); }
.home-prompts .chip:hover { transform: translateY(-4px); background: linear-gradient(145deg, var(--lav-soft), color-mix(in srgb, var(--lav-mist) 76%, white)); border-color: var(--lav); box-shadow: 0 6px 0 color-mix(in srgb, var(--lav-deep) 22%, transparent), 0 14px 22px rgba(63, 48, 104, .16), 0 1px 0 rgba(255,255,255,.8) inset; }
.home-prompts .chip:active { transform: translateY(-1px) scale(.98); }
.home-clarity-actions { width: min(100%, 760px); display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 10px; margin: 14px auto 0; }
.home-mode-action { display: flex; align-items: center; gap: 12px; min-width: 0; min-height: 64px; padding: 10px 14px; border: 1px solid var(--line); border-radius: 15px; background: color-mix(in srgb, var(--card) 90%, var(--lav-mist)); color: var(--ink); text-align: left; cursor: pointer; transition: transform .18s ease, border-color .18s ease, box-shadow .18s ease; }
.home-mode-action:hover { transform: translateY(-2px); border-color: color-mix(in srgb, var(--lav) 46%, var(--line)); box-shadow: var(--shadow-sm); }
.home-mode-action strong,.home-mode-action small { display: block; }
.home-mode-action strong { font-size: .9rem; }
.home-mode-action small { margin-top: 2px; color: var(--ink-faint); font-size: .72rem; }
.home-mode-icon { display: grid; place-items: center; flex: 0 0 32px; width: 32px; height: 32px; border-radius: 10px; background: var(--lav-soft); color: var(--lav-deep); font-size: 1.1rem; }
.home-recent { width: min(100%, 760px); margin: 34px auto 0; }
.home-recent-heading { display: flex; align-items: center; justify-content: space-between; gap: 16px; margin-bottom: 10px; }
.home-recent-heading h2 { margin: 0; font-family: var(--font-display); font-size: 1.2rem; }
.home-recent-list { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 10px; }
.home-recent-item { display: grid; gap: 3px; min-width: 0; padding: 12px 14px; border: 1px solid var(--line); border-radius: 13px; background: var(--card); color: var(--ink); text-align: left; cursor: pointer; }
.home-recent-item strong { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-size: .82rem; }
.home-recent-item span { color: var(--ink-faint); font-size: .7rem; }
.home-principles { width: min(100%, 920px); display: grid; grid-template-columns: repeat(3, 1fr); gap: 1px; margin: 48px auto 0; border: 1px solid color-mix(in srgb, var(--line) 72%, transparent); border-radius: 18px; overflow: hidden; background: color-mix(in srgb, var(--line) 55%, transparent); box-shadow: var(--shadow-sm); }
.home-principles article { min-height: 126px; padding: 20px 22px; background: color-mix(in srgb, var(--card) 86%, transparent); transition: background .2s ease, transform .2s ease; }
.home-principles article:hover { background: color-mix(in srgb, var(--lav-soft) 52%, var(--card)); }
.home-principles span { color: var(--lav-deep); font-size: .68rem; font-weight: 700; letter-spacing: .14em; }
.home-principles h2 { margin: 13px 0 5px; font-family: var(--font-display); font-size: 1.15rem; }
.home-principles p { margin: 0; color: var(--ink-soft); font-size: .82rem; line-height: 1.5; }

/* Clarity is a focused reading and editing space, not another dashboard. */
.clarity-screen { width: min(100%, 1160px); min-height: calc(100vh - 90px); padding: 36px 28px 72px; }
.clarity-header { display: flex; justify-content: space-between; align-items: flex-start; gap: 20px; margin: 8px 0 20px; }
.clarity-header h1 { margin: 4px 0 8px; font: 500 clamp(2rem, 5vw, 3.3rem)/1.05 var(--font-display); letter-spacing: -.035em; }
.clarity-header-actions { display: flex; flex-wrap: wrap; justify-content: flex-end; gap: 8px; }
.clarity-modes { display: flex; width: fit-content; gap: 4px; margin-bottom: 20px; padding: 4px; border: 1px solid var(--line); border-radius: 999px; background: var(--bg-soft); }
.clarity-modes button { min-height: 38px; padding: 0 16px; border: 0; border-radius: 999px; background: transparent; color: var(--ink-soft); font: inherit; font-size: .82rem; font-weight: 700; cursor: pointer; }
.clarity-modes button[aria-pressed="true"] { background: var(--card); color: var(--ink); box-shadow: var(--shadow-sm); }
#clarityStatus { margin: 0 0 14px; padding: 10px 14px; border: 1px solid var(--line); border-radius: 12px; background: var(--card); color: var(--ink-soft); font-size: .86rem; }
#clarityStatus.error { color: var(--danger); border-color: color-mix(in srgb, var(--danger) 35%, var(--line)); }
.clarity-content { display: grid; gap: 28px; }
.clarity-core { display: flex; align-items: center; justify-content: space-between; gap: 20px; border-color: color-mix(in srgb, var(--lav) 30%, var(--line)); }
.clarity-core > div { flex: 1; }
.clarity-core textarea { min-height: 76px; margin: 8px 0 5px; padding: 10px 12px; resize: vertical; font: 500 1.22rem/1.4 var(--font-display); }
.clarity-section { display: grid; gap: 15px; }
.clarity-section-heading { display: flex; align-items: flex-end; justify-content: space-between; gap: 18px; }
.clarity-section-heading h2 { margin: 2px 0 4px; font: 500 1.8rem/1.1 var(--font-display); letter-spacing: -.02em; }
.clarity-section-heading p { margin: 0; font-size: .88rem; }
.thought-legend { display: flex; flex-wrap: wrap; justify-content: flex-end; gap: 6px; }
.thought-legend span,.thought-category,.not-now-kind { padding: 3px 8px; border-radius: 999px; background: var(--lav-soft); color: var(--lav-deep); font-size: .67rem; font-weight: 700; white-space: nowrap; }
.thought-map { display: grid; grid-template-columns: repeat(auto-fit, minmax(220px, 1fr)); gap: 10px; }
.thought-node { min-width: 0; border: 1px solid var(--line); border-radius: 14px; background: var(--card); overflow: hidden; }
.thought-node summary { display: grid; gap: 7px; min-height: 98px; align-content: start; padding: 13px 15px; cursor: pointer; list-style: none; }
.thought-node summary::-webkit-details-marker { display: none; }
.thought-node summary strong { font-size: .9rem; line-height: 1.35; }
.thought-basis { color: var(--ink-faint); font-size: .68rem; }
.thought-node > p { margin: 0; padding: 0 15px 12px; color: var(--ink-soft); font-size: .82rem; }
.thought-node blockquote { margin: 0 12px 13px; padding: 9px 11px; border-left: 2px solid var(--lav); border-radius: 0 8px 8px 0; background: var(--lav-mist); color: var(--ink-soft); font-size: .78rem; }
.thought-node blockquote span { display: block; margin-bottom: 3px; color: var(--lav-deep); font-size: .64rem; font-weight: 700; text-transform: uppercase; letter-spacing: .06em; }
.thought-relationships { padding: 15px; border: 1px solid var(--line); border-radius: 16px; background: color-mix(in srgb, var(--card) 86%, var(--bg-soft)); }
.thought-relationships h3 { margin: 0 0 9px; font: 600 1.1rem var(--font-display); }
.thought-relationships ul { display: grid; gap: 9px; margin: 0; padding: 0; list-style: none; }
.thought-edge { display: grid; grid-template-columns: minmax(100px, 1fr) minmax(12px, .18fr) auto minmax(12px, .18fr) minmax(100px, 1fr); align-items: center; gap: 8px; }
.thought-edge a { color: var(--ink); font-size: .78rem; font-weight: 700; text-decoration-color: color-mix(in srgb, var(--lav) 50%, transparent); }
.edge-line { height: 1px; background: var(--lav); }
.edge-label { color: var(--lav-deep); font-size: .7rem; text-align: center; }
.thought-edge small { grid-column: 1 / -1; padding-left: 2px; color: var(--ink-faint); font-size: .72rem; }
.decision-options { display: grid; grid-template-columns: repeat(auto-fit, minmax(220px, 1fr)); gap: 10px; }
.decision-option { display: grid; align-content: start; gap: 10px; padding: 15px; border: 1px solid var(--line); border-radius: 14px; background: var(--card); }
.decision-option h3 { margin: 0; font: 600 1.1rem var(--font-display); }
.decision-option strong { color: var(--lav-deep); font-size: .72rem; }
.decision-option p { margin: 3px 0 0; color: var(--ink-soft); font-size: .82rem; }
.clarity-task-list,.not-now-list { display: grid; gap: 10px; }
.clarity-task,.not-now-item { display: flex; align-items: flex-start; justify-content: space-between; gap: 14px; padding: 14px; border: 1px solid var(--line); border-radius: 14px; background: var(--card); }
.clarity-task-main { display: flex; flex: 1; gap: 11px; min-width: 0; }
.task-complete { padding-top: 9px; }
.task-complete input { accent-color: var(--lav-deep); width: 17px; height: 17px; }
.clarity-task-fields { display: grid; flex: 1; gap: 7px; min-width: 0; }
.clarity-task-fields > input,.clarity-task-fields textarea { width: 100%; min-height: 38px; padding: 7px 9px; border: 1px solid transparent; border-radius: 8px; background: transparent; color: var(--ink); font: inherit; font-weight: 600; }
.clarity-task-fields textarea { min-height: 44px; resize: vertical; font-size: .8rem; font-weight: 400; }
.clarity-task-fields > input:focus,.clarity-task-fields textarea:focus { border-color: var(--line); outline: 2px solid color-mix(in srgb, var(--lav) 28%, transparent); background: var(--bg); }
.task-meta { display: flex; align-items: center; flex-wrap: wrap; gap: 10px 14px; color: var(--ink-faint); font-size: .7rem; }
.task-meta label { display: flex; align-items: center; gap: 5px; }
.task-meta select,.task-meta input { max-width: 125px; min-height: 30px; padding: 3px 6px; border: 1px solid var(--line); border-radius: 7px; background: var(--bg); color: var(--ink); font: inherit; }
.deadline-source { color: var(--ink-faint); font-size: .7rem; }
.task-actions { display: flex; align-items: center; gap: 9px; flex-wrap: wrap; }
.task-status { color: var(--ink-faint); font-size: .72rem; white-space: nowrap; }
.not-now-item > div { display: grid; gap: 5px; }
.not-now-item strong { margin-top: 3px; font-size: .9rem; }
.not-now-item p { margin: 0; color: var(--ink-soft); font-size: .8rem; }
.not-now-kind { width: fit-content; }
.uncertainty-list { display: grid; gap: 8px; margin: 0; padding: 0; list-style: none; }
.uncertainty-list li { padding: 12px 14px; border-left: 2px solid var(--lav); background: color-mix(in srgb, var(--lav-soft) 52%, var(--card)); font-size: .86rem; }
.uncertainty-list p { margin: 3px 0 0; color: var(--ink-soft); font-size: .8rem; }
.clarity-replan { display: grid; gap: 12px; margin-top: 28px; }
.clarity-replan h2 { font: 500 1.5rem var(--font-display); }
.clarity-replan p { margin: 3px 0 0; }
.clarity-replan textarea { min-height: 62px; resize: vertical; }
.clarity-controls { display: flex; align-items: center; flex-wrap: wrap; gap: 8px; }
.structure-action { display: flex; align-items: center; justify-content: space-between; flex-wrap: wrap; gap: 12px; padding: 12px 14px; border: 1px solid var(--line); border-radius: 13px; background: var(--lav-mist); }
.structure-action > div:first-child { display: grid; }
.structure-action strong { font-size: .84rem; }
.structure-action span { color: var(--ink-faint); font-size: .73rem; }
.structure-mode-actions { display: flex; flex-wrap: wrap; gap: 6px; }
.account-actions { display: flex; flex-wrap: wrap; gap: 8px; }
.account-saved-list { display: grid; gap: 4px; margin: 12px 0 0; padding: 0; list-style: none; }
.account-saved-list:empty { display: none; }
.account-saved-item { display: flex; align-items: center; justify-content: space-between; gap: 8px; min-width: 0; }
.account-saved-item .link-btn:first-child { min-width: 0; max-width: 100%; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; text-align: left; }
.account-saved-item .danger { flex-shrink: 0; font-size: .76rem; }
.account-nudge { display: flex; align-items: center; flex-wrap: wrap; gap: 10px; margin: 12px 0; padding: 12px 14px; border: 1px solid var(--line); border-radius: 12px; background: var(--lav-mist); color: var(--ink-soft); font-size: .88rem; }
.account-nudge .link-btn { color: var(--lav-deep); font-weight: 700; }
.modal-backdrop { position: fixed !important; inset: 0 !important; z-index: 1000 !important; display: grid !important; place-items: center; width: 100vw; height: 100dvh; overflow-y: auto; padding: 24px; background: rgba(18, 15, 28, .62); backdrop-filter: blur(14px); -webkit-backdrop-filter: blur(14px); }
.modal-backdrop[hidden] { display: none !important; }
.auth-modal { width: min(100%, 480px); padding: 34px; border: 1px solid color-mix(in srgb, var(--lav) 38%, var(--line)); background: color-mix(in srgb, var(--card) 94%, var(--lav-mist)); box-shadow: 0 30px 100px rgba(18, 12, 35, .42), 0 1px 0 rgba(255, 255, 255, .08) inset; }
.auth-modal .card-head { align-items: flex-start; margin-bottom: 6px; }
.auth-modal .card-head h2 { margin-top: 8px; font-size: clamp(2rem, 4vw, 2.8rem); line-height: .98; letter-spacing: -.04em; }
.auth-modal form { display: grid; gap: 10px; margin-top: 24px; }
.auth-modal label { margin-top: 4px; font-size: .84rem; font-weight: 700; letter-spacing: .02em; color: var(--ink-soft); }
.auth-modal input { width: 100%; min-height: 48px; margin-bottom: 6px; padding: 12px 14px; border: 1px solid var(--line); border-radius: 10px; background: var(--bg-soft); color: var(--ink); font: inherit; }
.auth-modal input:focus { border-color: var(--lav); outline: 3px solid color-mix(in srgb, var(--lav) 24%, transparent); }
.auth-modal .btn-primary { width: 100%; min-height: 50px; margin-top: 8px; }
.auth-reset { display: block; margin: 14px auto 0; font-size: .82rem; }
.form-success { margin: 8px 0 0; color: var(--lav-deep); font-size: .88rem; }
.profile-modal { width: min(100%, 440px); padding: 30px; border: 1px solid color-mix(in srgb, var(--lav) 38%, var(--line)); background: color-mix(in srgb, var(--card) 94%, var(--lav-mist)); box-shadow: 0 30px 100px rgba(18, 12, 35, .42), 0 1px 0 rgba(255, 255, 255, .08) inset; }
.profile-modal .card-head { align-items: flex-start; margin-bottom: 20px; }
.profile-modal h2 { margin-top: 8px; font-family: var(--font-display); font-size: clamp(2rem, 4vw, 2.7rem); line-height: .98; letter-spacing: -.04em; }
.profile-identity { display: grid; gap: 5px; padding: 14px 16px; border: 1px solid var(--line); border-radius: 12px; background: var(--bg-soft); color: var(--ink-soft); }
.profile-identity strong { color: var(--ink); font-size: 1.08rem; }
.profile-identity span { font-size: .86rem; overflow-wrap: anywhere; }
.profile-modal form { display: grid; gap: 10px; margin-top: 24px; }
.profile-modal form h3 { margin: 0 0 2px; font-size: 1rem; }
.profile-modal label { margin-top: 4px; font-size: .84rem; font-weight: 700; color: var(--ink-soft); }
.profile-modal input { width: 100%; min-height: 48px; padding: 12px 14px; border: 1px solid var(--line); border-radius: 10px; background: var(--bg-soft); color: var(--ink); font: inherit; }
.profile-modal input:focus { border-color: var(--lav); outline: 3px solid color-mix(in srgb, var(--lav) 24%, transparent); }
.profile-modal .btn-primary { width: 100%; min-height: 48px; margin-top: 8px; }
.profile-password-toggle { width: 100%; justify-content: center; margin-top: 18px; }
.profile-logout { width: 100%; justify-content: center; margin-top: 18px; }
body[data-theme="night"] .profile-modal { background: #282532; }
body[data-theme="night"] .profile-identity, body[data-theme="night"] .profile-modal input { background: #302c3b; color: var(--ink); border-color: #514866; }
.privacy-dialog { width: min(100%, 520px); padding: 30px; border: 1px solid color-mix(in srgb, var(--lav) 34%, var(--line)); background: color-mix(in srgb, var(--card) 96%, var(--lav-mist)); box-shadow: 0 30px 100px rgba(18, 12, 35, .4); }
.privacy-dialog .card-head { align-items: flex-start; margin-bottom: 18px; }
.privacy-dialog h2 { margin-top: 8px; font-family: var(--font-display); font-size: clamp(1.8rem, 4vw, 2.5rem); line-height: 1; letter-spacing: -.04em; }
.privacy-list { display: grid; gap: 12px; margin: 0; padding-left: 20px; color: var(--ink-soft); font-size: .92rem; }
.privacy-list li::marker { color: var(--lav); }
body[data-theme="night"] .privacy-dialog { background: #282532; }
.auth-switch { margin-top: 18px; color: var(--lav-deep); font-weight: 700; }
body[data-theme="night"] .auth-modal input { background: #302c3b; color: var(--ink); border-color: #514866; }
body[data-theme="night"] .auth-modal { background: #282532; }
body.chat-view {
  display: flex; flex-direction: column; height: 100vh; height: 100dvh;
  min-height: 0; overflow: hidden; overscroll-behavior: none;
}
body.chat-view .site-header { flex: 0 0 auto; }
body.chat-view #chatView { flex: 1 1 auto; height: auto; min-height: 0; overflow: hidden; padding: 12px 28px; }
body.chat-view .main-column { height: 100%; min-height: 0; gap: 10px; }
body.chat-view .hero { flex: 0 0 auto; padding: 2px 6px 0; }
body.chat-view .chat-history-action-row { display: flex; flex: 0 0 auto; justify-content: flex-end; margin-right: -28px; }
body.chat-view .hero h1 { font-size: clamp(1.65rem, 3vw, 2.4rem); margin-bottom: 4px; }
body.chat-view .hero .lede { font-size: .94rem; }
body.chat-view .chat-card { display: flex; flex: 1 1 auto; flex-direction: column; min-height: 0; overflow: hidden; padding: 12px clamp(14px, 2vw, 22px); gap: 6px; }
body.chat-view .msg p { font-size: .92rem; line-height: 1.45; }
body.chat-view #composer textarea { min-height: 48px; font-size: .95rem; }
/* Keep the active conversation focused; starter prompts remain available on
   the landing screen where they are most useful. */
body.chat-view .chips-row { display: none; }

/* layout */
.layout {
  display: grid; grid-template-columns: minmax(0, 1fr) 380px;
  gap: 28px; align-items: start; padding-top: 32px; padding-bottom: 48px;
}
body.sidebar-collapsed .layout { grid-template-columns: minmax(0, 1fr); justify-content: stretch; }
body.sidebar-collapsed .side-column { display: none; }
body.sidebar-collapsed .main-column { width: 100%; max-width: none; margin: 0 auto; }
@media (max-width: 920px) { .layout { grid-template-columns: 1fr; } }
.main-column { display: flex; flex-direction: column; gap: 24px; min-width: 0; }
.side-column { display: flex; flex-direction: column; gap: 20px; position: sticky; top: 76px; }
.side-column .btn { border-radius: 14px; box-shadow: 0 3px 0 color-mix(in srgb, var(--lav-deep) 12%, transparent), 0 1px 0 rgba(255,255,255,.35) inset; transition: transform .2s ease, box-shadow .2s ease, background .2s ease; }
.side-column .btn:hover { transform: translateY(-2px); box-shadow: 0 5px 0 color-mix(in srgb, var(--lav-deep) 17%, transparent), 0 10px 18px rgba(80,66,120,.1), 0 1px 0 rgba(255,255,255,.45) inset; }
.side-column .btn:active { transform: translateY(1px) scale(.98); }
@media (max-width: 920px) { .side-column { position: static; } }
@media (max-width: 920px) { body.sidebar-collapsed .layout { grid-template-columns: 1fr; } }
@media (max-width: 920px) { .header-note { display: none; } .header-nav { gap: 7px; } }

/* Past chats open as a focused slide-in drawer; the header Chats button stays
   a stable navigation action and never changes its label. */
body.chat-view .layout { position: relative; grid-template-columns: minmax(0, 1fr); }
body.chat-view .main-column { width: 100%; max-width: none; margin: 0 auto; }
body.chat-view .side-column {
  position: fixed; z-index: 41; top: 0; right: 0; bottom: 0;
  display: flex; width: min(400px, calc(100vw - 20px)); max-width: 100%;
  overflow: auto; overscroll-behavior: contain; padding: 18px;
  background: var(--bg); border-left: 1px solid var(--line);
  box-shadow: -18px 0 48px rgba(28, 23, 40, .18);
  transform: translateX(105%); visibility: hidden; pointer-events: none;
  transition: transform .28s cubic-bezier(.2,.75,.25,1), visibility .28s;
}
body.chat-view .side-column > :not(.history) { display: none; }
body.chat-view .side-column .history { width: 100%; align-self: flex-start; }
body.history-drawer-open.chat-view .side-column {
  transform: translateX(0); visibility: visible; pointer-events: auto;
}
.history-drawer-toggle {
  position: static; z-index: 40; display: none;
  min-height: 48px; align-items: center; justify-content: center; gap: 9px;
  padding: 0 12px 0 15px; border: 1px solid color-mix(in srgb, var(--lav-deep) 75%, #211a33);
  border-radius: 999px;
  color: #fff; background: var(--lav-deep);
  box-shadow: 0 5px 16px rgba(48, 34, 82, .28), inset 0 1px 0 rgba(255,255,255,.18);
  font: inherit; font-size: .88rem; font-weight: 700; letter-spacing: .01em;
  white-space: nowrap; cursor: pointer;
  transition: transform .18s ease, background .18s ease, box-shadow .18s ease;
}
body.chat-view .history-drawer-toggle { display: inline-flex; }
.history-drawer-toggle svg { width: 18px; height: 18px; fill: none; stroke: currentColor; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; transform: rotate(180deg); }
.history-drawer-toggle:hover { background: color-mix(in srgb, var(--lav-deep) 82%, #171322); box-shadow: 0 7px 20px rgba(48, 34, 82, .34), inset 0 1px 0 rgba(255,255,255,.2); transform: translateY(-2px); }
.history-drawer-toggle:active { transform: translateY(1px) scale(.98); }
body.history-drawer-open .history-drawer-toggle { visibility: hidden; pointer-events: none; }
.history-drawer-close-slider {
  position: fixed; z-index: 42; top: 34%; right: max(0px, min(400px, calc(100vw - 20px)) - 42px);
  display: none; width: 42px; height: 52px; align-items: center; justify-content: center;
  padding: 0; border: 1px solid color-mix(in srgb, var(--lav-deep) 75%, #211a33);
  border-left: 0; border-radius: 0 14px 14px 0; color: #fff; background: var(--lav-deep);
  box-shadow: 0 5px 16px rgba(48, 34, 82, .28), inset 0 1px 0 rgba(255,255,255,.18);
  cursor: pointer; transform: translateY(-50%);
  transition: background .18s ease, box-shadow .18s ease, transform .18s ease;
}
body.history-drawer-open.chat-view .history-drawer-close-slider { display: flex; }
.history-drawer-close-slider svg { width: 23px; height: 23px; fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; }
.history-drawer-close-slider:hover { background: color-mix(in srgb, var(--lav-deep) 82%, #171322); box-shadow: 0 7px 20px rgba(48, 34, 82, .34), inset 0 1px 0 rgba(255,255,255,.2); transform: translate(2px, -50%); }
.history-drawer-close-slider:active { transform: translateY(-50%) scale(.98); }
.history-drawer-scrim {
  position: fixed; z-index: 39; inset: 0; width: 100%; height: 100%;
  border: 0; background: rgba(24, 21, 31, .34); backdrop-filter: blur(2px); cursor: default;
}
.history-drawer-scrim[hidden] { display: none; }
body[data-theme="night"] .side-column { background: #201d29; box-shadow: -18px 0 50px rgba(0, 0, 0, .38); }
body[data-theme="night"] .history-drawer-scrim { background: rgba(5, 4, 10, .58); }
@media (max-width: 560px) {
  body.chat-view .side-column { padding: 14px; }
  body.chat-view #chatView { padding: 12px 16px; }
  body.chat-view .chat-history-action-row { margin-right: -16px; }
  .history-drawer-toggle { min-height: 44px; gap: 7px; padding: 0 11px 0 13px; border-radius: 999px; font-size: .82rem; }
  .history-drawer-toggle svg { width: 16px; height: 16px; }
  .history-drawer-close-slider { right: max(0px, min(400px, calc(100vw - 20px)) - 38px); width: 38px; height: 48px; }
}

/* hero */
.hero { padding: 10px 6px 2px; }
.eyebrow {
  display: inline-block; font-size: 0.78rem; font-weight: 600; letter-spacing: 0.08em;
  text-transform: uppercase; color: var(--lav-deep);
  background: var(--lav-soft); border: 1px solid #ddd2f0;
  padding: 6px 12px; border-radius: 999px; margin: 0 0 14px;
}
.hero h1 {
  font-family: var(--font-display); font-weight: 500; letter-spacing: -0.02em;
  font-size: clamp(2rem, 4.5vw, 3.1rem); line-height: 1.08; margin: 0 0 12px;
}
.hero h1 em { font-style: italic; color: var(--lav-deep); }
.lede { color: var(--ink-soft); font-size: 1.08rem; max-width: 58ch; margin: 0; }

/* cards */
.card {
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: clamp(20px, 3vw, 30px);
  animation: rise 0.5s ease both;
}
.chat-card, .side-column > .card {
  background: linear-gradient(145deg, color-mix(in srgb, var(--card) 96%, var(--lav-mist)), var(--card));
  border-color: color-mix(in srgb, var(--lav) 18%, var(--line));
  box-shadow: 0 18px 48px rgba(55, 42, 90, .09), 0 2px 0 rgba(255,255,255,.55) inset;
}
body[data-theme="night"] .chat-card, body[data-theme="night"] .side-column > .card {
  background: linear-gradient(145deg, #2d2939, #25222f);
  box-shadow: 0 20px 52px rgba(0,0,0,.22), 0 1px 0 rgba(255,255,255,.06) inset;
}
@keyframes rise { from { opacity: 0; transform: translateY(10px); } to { opacity: 1; transform: none; } }
.card h2 { font-family: var(--font-display); font-weight: 600; letter-spacing: -0.01em; margin: 0; font-size: 1.45rem; line-height: 1.25; }
.card-head { display: flex; justify-content: space-between; align-items: flex-start; gap: 14px; margin-bottom: 14px; }
.step { margin: 0 0 6px; font-size: 0.8rem; font-weight: 600; letter-spacing: 0.07em; text-transform: uppercase; color: var(--lav-deep); }
.muted { color: var(--ink-soft); margin: 6px 0 0; }
.muted.small, .small { font-size: 0.88rem; }
.badge {
  flex-shrink: 0; font-size: 0.75rem; font-weight: 600; color: var(--lav-deep);
  background: var(--lav-mist); border: 1px solid #ddd2f0; padding: 6px 10px; border-radius: 999px;
}
.count-pill {
  font-size: 0.82rem; font-weight: 600; color: var(--ink-soft);
  border: 1px solid var(--line); background: var(--bg);
  padding: 6px 12px; border-radius: 999px; white-space: nowrap;
}

/* textarea */
textarea {
  width: 100%; min-height: 190px; resize: vertical;
  font: inherit; font-size: 1.05rem; line-height: 1.65; color: var(--ink);
  background: #fff; border: 1.5px solid var(--line); border-radius: var(--radius-sm);
  padding: 16px 18px; outline: none; transition: border-color 0.2s, box-shadow 0.2s;
}
textarea::placeholder { color: #716a63; }
textarea:focus { border-color: var(--lav); box-shadow: 0 0 0 4px var(--lav-soft); }
textarea.shake { animation: shake 0.35s ease; border-color: var(--danger); }
@keyframes shake { 25% { transform: translateX(-4px); } 50% { transform: translateX(4px); } 75% { transform: translateX(-3px); } }

/* prompts */
.prompts { margin-top: 16px; }
.prompts-label { font-size: 0.9rem; color: var(--ink-faint); margin: 0 0 8px; }
.chips { display: flex; flex-wrap: wrap; gap: 8px; }
.chip {
  font: inherit; font-size: 0.88rem; color: var(--lav-deep);
  background: var(--lav-mist); border: 1px solid #ddd2f0;
  padding: 8px 14px; border-radius: 999px; cursor: pointer;
  transition: transform 0.15s, background 0.2s, box-shadow 0.2s;
}
.chip:hover { background: var(--lav-soft); transform: translateY(-1px); box-shadow: var(--shadow-sm); }
.chip-random { border-style: dashed; color: var(--ink-soft); }
.prompt-toggle { align-self: center; font-size: 0.8rem; padding: 6px 4px; }

/* buttons */
.actions-row { display: flex; flex-wrap: wrap; align-items: center; gap: 10px; margin-top: 18px; }
.wrap-row { border-top: 1px dashed var(--line); padding-top: 16px; }
.btn {
  font: inherit; font-weight: 600; font-size: 0.98rem;
  border-radius: 999px; padding: 13px 24px; cursor: pointer;
  border: 1px solid transparent; transition: transform 0.18s ease, box-shadow 0.2s ease, background 0.2s, border-color 0.2s;
  box-shadow: 0 3px 0 color-mix(in srgb, var(--line) 82%, transparent), 0 8px 16px rgba(80, 66, 120, .08), 0 1px 0 rgba(255,255,255,.65) inset;
  display: inline-flex; align-items: center; gap: 8px;
}
.btn:hover { transform: translateY(-2px); box-shadow: 0 5px 0 color-mix(in srgb, var(--line) 86%, transparent), 0 13px 22px rgba(80, 66, 120, .13), 0 1px 0 rgba(255,255,255,.75) inset; }
.btn:active { transform: translateY(1px) scale(0.99); box-shadow: 0 1px 0 color-mix(in srgb, var(--line) 82%, transparent), 0 4px 9px rgba(80, 66, 120, .08); }
.btn:disabled { opacity: 0.58; cursor: wait; transform: none; }
.btn-primary { background: var(--ink); color: #fdfbf7; box-shadow: 0 8px 22px rgba(43, 42, 40, 0.22); }
.btn-primary:hover { background: #1d1c1a; transform: translateY(-1px); }
.composer-row #sendBtn {
  width: 46px; min-width: 46px; height: 46px; justify-content: center; padding: 0; border-radius: 14px;
  border-color: color-mix(in srgb, var(--ink) 82%, white);
  box-shadow: 0 8px 0 color-mix(in srgb, var(--ink) 18%, transparent), 0 14px 26px rgba(43,42,40,.18), 0 1px 0 rgba(255,255,255,.18) inset;
  transition: transform .2s ease, box-shadow .2s ease, background .2s ease;
}
.composer-row #sendBtn span { display: grid; place-items: center; width: auto; height: auto; margin: 0; border-radius: 0; background: none; transition: transform .2s ease; }
.composer-row #sendBtn .send-arrow { display: block; width: 22px; height: 22px; fill: none; stroke: currentColor; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; }
.composer-row #sendBtn:hover { box-shadow: 0 11px 0 color-mix(in srgb, var(--ink) 18%, transparent), 0 18px 32px rgba(43,42,40,.24), 0 1px 0 rgba(255,255,255,.2) inset; transform: translateY(-3px); }
.composer-row #sendBtn:hover span { transform: translateX(2px); }
.composer-row #sendBtn:active { transform: translateY(1px) scale(.98); box-shadow: 0 4px 0 color-mix(in srgb, var(--ink) 18%, transparent), 0 8px 16px rgba(43,42,40,.16); }
body[data-theme="night"] .composer-row #sendBtn { box-shadow: 0 8px 0 rgba(0,0,0,.24), 0 14px 28px rgba(0,0,0,.28), 0 1px 0 rgba(255,255,255,.8) inset; }
.btn-ghost { background: transparent; color: var(--ink-soft); border-color: var(--line); }
.btn-ghost:hover { border-color: var(--ink-faint); color: var(--ink); background: #fff; }
.btn-soft { background: var(--lav-soft); color: var(--lav-deep); border-color: #ddd2f0; }
.btn-soft[aria-pressed="true"] { background: #dff0e4; border-color: #bcd8c4; color: #2f5c3f; }
.btn-soft.active { background: #dff0e4; border-color: #bcd8c4; color: #2f5c3f; }
.btn-sm { padding: 9px 18px; font-size: 0.9rem; }
.btn-danger-ghost { background: transparent; color: var(--danger); border: 1px solid #e5c6c6; width: 100%; justify-content: center; }
.btn-danger-ghost:hover { background: #fdf0f0; }
.undo-delete { width: 100%; justify-content: center; margin-top: 8px; }
.btn:focus-visible, .chip:focus-visible, .link-btn:focus-visible, .brand:focus-visible, textarea:focus-visible { outline: 2px solid var(--lav); outline-offset: 2px; }
.home-entry textarea:focus-visible { outline: none; }
.check { display: inline-flex; width: 18px; height: 18px; border-radius: 50%; background: rgba(95, 84, 137, 0.15); align-items: center; justify-content: center; font-size: 0.75rem; }
.btn-soft[aria-pressed="true"] .check { background: #2f5c3f; color: #fff; }

.form-error { color: var(--danger); font-size: 0.92rem; margin: 12px 0 0; }
.storage-warning {
  font-size: 0.88rem; color: #7a5b1e; background: #fdf4dd;
  border: 1px solid #ecd9a0; border-radius: var(--radius-sm); padding: 10px 14px; margin: 12px 0 0;
}
.response-status { color: var(--lav-deep); font-size: 0.88rem; margin: 10px 0 0; }
.response-status.error { color: var(--danger); }
.privacy-row { display: flex; justify-content: flex-end; margin-top: 12px; }
.privacy-row .link-btn { color: var(--ink-faint); font-size: .78rem; }
.privacy-row .link-btn:hover { color: var(--lav-deep); }
.health-ok { color: var(--sage) !important; }
.health-error { color: var(--danger) !important; }
.retry-btn { margin-top: 8px; }
.composer-hint { color: var(--ink-faint); font-size: 0.8rem; margin: 4px 2px 0; }
#draftStatus { color: var(--sage); }
.clear-draft { border: 0; padding: 0; margin-left: 8px; background: transparent; color: var(--danger); font: inherit; font-size: 0.8rem; cursor: pointer; }
.clear-draft:hover { text-decoration: underline; }
.char-count { float: right; font-variant-numeric: tabular-nums; }
.char-count.near-limit { color: var(--danger); font-weight: 700; }

/* conversation */
.chat-card { padding: clamp(16px, 2.5vw, 24px); }
.thread { display: flex; flex-direction: column; gap: 10px; max-height: 480px; overflow-y: auto; padding: 4px 2px 10px; }
body.chat-view .thread { flex: 1 1 auto; min-height: 0; max-height: none; overflow-x: hidden; overflow-y: auto; overscroll-behavior: contain; scrollbar-gutter: stable; gap: 6px; padding: 4px 4px 10px; }
body.chat-view .msg { scroll-margin-bottom: 12px; }
.thread-empty {
  color: var(--ink-faint); font-size: 0.95rem; text-align: center;
  background: var(--bg); border: 1px dashed var(--line);
  border-radius: 16px; padding: 24px 16px; box-shadow: 0 3px 0 color-mix(in srgb, var(--lav-deep) 8%, transparent) inset, 0 1px 0 rgba(255,255,255,.35);
}
.jump-latest { display: block; margin: -2px auto 6px; border: 1px solid #ddd2f0; border-radius: 999px; padding: 6px 12px; background: var(--lav-mist); color: var(--lav-deep); font: inherit; font-size: 0.78rem; cursor: pointer; }
.jump-latest:hover { background: var(--lav-soft); }
.msg { max-width: 85%; }
.msg p { margin: 0; font: 400 0.98rem/1.5 "DM Sans", ui-sans-serif, system-ui, sans-serif; letter-spacing: -0.006em; }
.message-time { display: block; margin-top: 5px; font: 400 0.68rem/1.2 "DM Sans", ui-sans-serif, system-ui, sans-serif; opacity: 0.62; font-variant-numeric: tabular-nums; }
body.hide-timestamps .message-time { display: none; }
.msg-user {
  align-self: flex-end; background: var(--ink); color: #fdfbf7;
  border-radius: 16px 16px 4px 16px; padding: 10px 15px; font-family: "DM Sans", ui-sans-serif, system-ui, sans-serif; font-weight: 500;
}
.msg-assistant {
  align-self: flex-start; background: #fff; color: var(--ink-soft);
  border: 1px solid var(--line-soft); border-radius: 16px 16px 16px 4px;
  padding: 11px 15px; box-shadow: var(--shadow-sm); font-family: "DM Sans", ui-sans-serif, system-ui, sans-serif; font-weight: 400;
}
.msg-assistant .message-time, .msg-assistant .reply-source, .msg-assistant .reply-meta, .msg-assistant .message-action { font-family: "DM Sans", ui-sans-serif, system-ui, sans-serif; }
.msg-assistant.typing { color: var(--ink-faint); letter-spacing: 3px; }
.reply-source { display: block; margin-top: 7px; font-size: 0.75rem; font-weight: 600; color: var(--lav-deep); }
.reply-meta { display: block; margin-top: 5px; font-size: 0.68rem; color: var(--ink-faint); }
.message-actions { display: flex; flex-wrap: wrap; gap: 8px 10px; margin-top: 8px; opacity: 0.72; }
.msg-assistant .message-actions { display: none; }
.message-action { font: inherit; font-size: 0.75rem; color: var(--lav-deep); background: transparent; border: 0; padding: 0; cursor: pointer; }
.message-action:hover { text-decoration: underline; opacity: 1; }
.quick-action { color: var(--ink-soft); }
.message-action.saved { color: var(--sage); font-weight: 700; }
.msg-user .message-action { color: #ddd2f0; }
.takeaway { margin: 10px 2px 4px; padding: 14px 16px; background: var(--lav-mist); border: 1px solid #ddd2f0; border-radius: var(--radius-sm); }
.takeaway-head { display: flex; justify-content: space-between; align-items: center; gap: 12px; }
.takeaway h2 { margin: 0; color: var(--lav-deep); font-size: 0.84rem; text-transform: uppercase; letter-spacing: 0.07em; }
.takeaway p { margin: 7px 0 0; color: var(--ink-soft); font-size: 0.92rem; white-space: pre-wrap; }
.chat-stats { margin: 8px 2px 0; color: var(--ink-faint); font-size: 0.75rem; text-align: right; font-variant-numeric: tabular-nums; }
.chips-row { margin: 12px 0 2px; }
#composer { position: static; z-index: 6; flex: 0 0 auto; padding: 6px 0 4px; background: var(--card); }
#composer textarea { flex: 1 1 auto; width: auto; min-width: 0; height: 48px; min-height: 48px; max-height: 160px; margin: 0; padding: 10px 12px; overflow-y: hidden; resize: none; font-family: "DM Sans", ui-sans-serif, system-ui, sans-serif; border: 0; border-radius: 18px; background: transparent; box-shadow: none; }
#composer textarea:focus { border-color: transparent; box-shadow: none; outline: none; }
#composer textarea:focus-visible { outline: 1px solid color-mix(in srgb, var(--ink-soft) 30%, transparent); outline-offset: 1px; }
.composer-field { display: flex; align-items: flex-end; gap: 8px; min-height: 64px; padding: 8px; border: 1px solid var(--line); border-radius: 24px; background: var(--card); box-shadow: inset 0 1px 3px rgba(43,42,40,.045), 0 2px 0 color-mix(in srgb, var(--line) 76%, transparent); transition: border-color .18s ease, box-shadow .18s ease; }
.composer-field:focus-within { border-color: var(--line); box-shadow: inset 0 1px 3px rgba(43,42,40,.045), 0 2px 0 color-mix(in srgb, var(--line) 76%, transparent); }
.composer-field > .btn { flex: 0 0 auto; width: 46px; height: 46px; min-width: 46px; padding: 0; justify-content: center; border-radius: 50%; }
.composer-row { display: flex; flex: 0 0 auto; align-items: center; gap: 7px; margin: 0; }
.composer-row .btn { width: 46px; height: 46px; min-width: 46px; padding: 0; justify-content: center; border-radius: 50%; }
.composer-mic svg { width: 21px; height: 21px; fill: none; stroke: currentColor; stroke-width: 1.7; stroke-linecap: round; stroke-linejoin: round; }
.composer-row #dictationBtn.recording { border-color: var(--danger); color: var(--danger); background: color-mix(in srgb, var(--danger) 8%, transparent); box-shadow: 0 0 0 3px color-mix(in srgb, var(--danger) 16%, transparent); }

/* Voice chat */
main.voice-view { min-height: calc(100vh - 150px); padding-top: 42px; padding-bottom: 64px; }
.voice-panel { width: min(100%, 760px); margin: 0 auto; text-align: center; }
.voice-header { display: flex; align-items: flex-start; justify-content: space-between; gap: 24px; text-align: left; }
.voice-header h1 { margin: 0; font-family: var(--font-display); font-size: clamp(2.2rem, 5vw, 4rem); line-height: 1; letter-spacing: -.045em; }
.voice-header .muted { max-width: 54ch; margin-top: 12px; }
.voice-orb {
  position: relative; display: grid; place-items: center; width: 150px; height: 150px;
  margin: 54px auto 22px; border: 0; border-radius: 50%;
  background: radial-gradient(circle at 35% 35%, #b7a9e0, var(--lav) 65%, var(--lav-deep));
  box-shadow: 0 16px 40px color-mix(in srgb, var(--lav) 24%, transparent),
    0 2px 0 rgba(255,255,255,.5) inset, 0 -9px 18px rgba(42,34,65,.16) inset;
  animation: voice-orb-idle 5s ease-in-out infinite;
}
.voice-orb::before, .voice-orb::after {
  content: ""; position: absolute; inset: -15px; border: 1px solid color-mix(in srgb, var(--lav) 31%, transparent);
  border-radius: inherit; opacity: .42; pointer-events: none; animation: voice-ring-idle 5s ease-in-out infinite alternate;
}
.voice-orb::after { inset: -29px; opacity: .22; animation-delay: -2.5s; }
.voice-orb span {
  position: absolute; inset: -16px; border: 1px solid color-mix(in srgb, var(--lav) 50%, transparent);
  border-radius: inherit; opacity: 0; pointer-events: none; transform: scale(.84);
}
.voice-orb.active span { animation: voice-wave 2.7s cubic-bezier(.2,.55,.35,1) infinite; }
.voice-orb.active span:nth-child(2) { animation-delay: .9s; }
.voice-orb.active span:nth-child(3) { animation-delay: 1.8s; }
.voice-orb.thinking span { animation-duration: 3.8s; opacity: .08; }
.voice-orb.speaking { animation: voice-orb-speaking 1.25s ease-in-out infinite alternate; }
@keyframes voice-orb-idle {
  0%, 100% { transform: scale(.98); box-shadow: 0 14px 34px color-mix(in srgb, var(--lav) 20%, transparent), 0 2px 0 rgba(255,255,255,.5) inset, 0 -9px 18px rgba(42,34,65,.16) inset; }
  50% { transform: scale(1.015); box-shadow: 0 20px 46px color-mix(in srgb, var(--lav) 30%, transparent), 0 2px 0 rgba(255,255,255,.62) inset, 0 -9px 18px rgba(42,34,65,.12) inset; }
}
@keyframes voice-ring-idle { from { transform: scale(.98); opacity: .18; } to { transform: scale(1.035); opacity: .4; } }
@keyframes voice-wave { 0% { transform: scale(.84); opacity: 0; } 12% { opacity: .38; } 70% { opacity: .14; } 100% { transform: scale(1.62); opacity: 0; } }
@keyframes voice-orb-speaking { from { transform: scale(.99); box-shadow: 0 16px 38px color-mix(in srgb, var(--lav) 34%, transparent), 0 0 20px color-mix(in srgb, var(--lav) 25%, transparent), 0 2px 0 rgba(255,255,255,.62) inset, 0 -9px 18px rgba(42,34,65,.12) inset; } to { transform: scale(1.045); box-shadow: 0 24px 58px color-mix(in srgb, var(--lav) 48%, transparent), 0 0 36px color-mix(in srgb, var(--lav) 42%, transparent), 0 2px 0 rgba(255,255,255,.74) inset, 0 -9px 18px rgba(42,34,65,.1) inset; } }
.voice-status { min-height: 1.5em; margin: 0; color: var(--ink-soft); font-size: .98rem; font-weight: 600; }
.voice-error { max-width: 56ch; margin: 12px auto 0; color: var(--danger); font-size: .88rem; }
.voice-transcript { width: min(100%, 560px); margin: 24px auto 0; padding: 16px 18px; border: 1px solid var(--line); border-radius: 16px; background: color-mix(in srgb, var(--surface) 82%, transparent); text-align: left; }
.voice-transcript p { margin: 0; color: var(--ink-soft); line-height: 1.55; }
.voice-transcript-label { margin-top: 12px !important; color: var(--lav-deep) !important; font-size: .72rem; font-weight: 700; letter-spacing: .08em; text-transform: uppercase; }
.voice-transcript-label:first-child { margin-top: 0 !important; }
.voice-controls { display: flex; flex-wrap: wrap; justify-content: center; gap: 10px; margin-top: 26px; }
.voice-controls .btn { min-width: 130px; justify-content: center; }
.voice-start { min-width: 190px !important; }
.voice-note { margin: 24px auto 0; color: var(--ink-faint); font-size: .8rem; }
body[data-theme="night"] .voice-orb { background: radial-gradient(circle at 35% 35%, #b8a9e7, #7767ae 65%, #453b68); box-shadow: 0 16px 42px rgba(0,0,0,.38), 0 2px 0 rgba(255,255,255,.3) inset, 0 -9px 18px rgba(25,19,42,.28) inset; }
body[data-theme="night"] .voice-orb span { border-color: color-mix(in srgb, var(--lav) 70%, transparent); }

/* history */
.history-header { display: flex; align-items: flex-start; justify-content: space-between; gap: 14px; padding-bottom: 16px; border-bottom: 1px solid var(--line-soft); }
.history-header h2 { margin: 0; }
.history-header .muted { max-width: 22ch; }
.history-header-tools { display: flex; align-items: center; gap: 8px; }
.history-archive-link { padding: 5px 7px; border-radius: 7px; white-space: nowrap; }
.history-archive-link:hover, .history-archive-link[aria-pressed="true"] { background: var(--lav-soft); text-decoration: none; }
.history-filters { display: flex; gap: 6px; margin: 12px 0 14px; padding: 4px; border: 1px solid var(--line-soft); border-radius: 13px; background: color-mix(in srgb, var(--bg) 86%, var(--lav-mist)); box-shadow: 0 3px 0 rgba(60,45,95,.08) inset, 0 1px 0 rgba(255,255,255,.3); }
.history-filters .link-btn { flex: 1; padding: 7px 8px; border-radius: 7px; text-align: center; color: var(--ink-soft); }
.history-filters .link-btn:hover, .history-filters .link-btn[aria-pressed="true"] { background: var(--lav-soft); color: var(--lav-deep); text-decoration: none; }
.history-section-label { margin: 18px 0 8px; color: var(--ink-faint); font-size: .7rem; font-weight: 700; letter-spacing: .1em; text-transform: uppercase; }
.history-tools-label { margin-top: 22px; }
.history-list { list-style: none; margin: 14px 0; padding: 0; display: flex; flex-direction: column; gap: 10px; max-height: 480px; overflow: auto; }
.history-search-row { position: relative; }
.history-search { width: 100%; font: inherit; color: var(--ink); background: color-mix(in srgb, var(--bg) 88%, var(--lav-mist)); border: 1px solid color-mix(in srgb, var(--lav) 18%, var(--line)); border-radius: 14px; padding: 11px 38px 11px 15px; outline: none; box-shadow: 0 2px 0 rgba(60,45,95,.07) inset, 0 1px 0 rgba(255,255,255,.35); }
.history-search:focus { border-color: var(--lav); box-shadow: 0 0 0 3px var(--lav-soft); }
.clear-search { position: absolute; right: 10px; top: 50%; transform: translateY(-50%); border: 0; background: transparent; color: var(--ink-faint); font-size: 1.2rem; line-height: 1; cursor: pointer; }
.clear-search:focus-visible { outline: 2px solid var(--lav); outline-offset: 2px; border-radius: 4px; }
.history-tools { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; margin: 12px 0; }
.history-tools .btn { justify-content: center; padding-left: 10px; padding-right: 10px; }
.history-item {
  border: 1px solid var(--line-soft); border-radius: var(--radius-sm);
  padding: 12px 14px; background: #fff; display: flex; flex-direction: column; gap: 8px;
  box-shadow: 0 3px 0 rgba(60,45,95,.07), 0 1px 0 rgba(255,255,255,.6) inset;
  transition: transform 0.2s, box-shadow 0.2s, border-color 0.2s; min-width: 0; position: relative;
}
.history-item:hover { transform: translateY(-2px); border-color: #d5c9ef; box-shadow: 0 6px 0 rgba(95,84,137,.12), 0 12px 22px rgba(80,66,120,.1), 0 1px 0 rgba(255,255,255,.75) inset; }
.history-item.current { border-color: var(--lav); box-shadow: 0 0 0 3px var(--lav-soft); }
.history-top { display: flex; justify-content: space-between; align-items: center; gap: 8px; }
.history-date { font-size: 0.8rem; color: var(--ink-faint); font-weight: 600; }
.history-preview { margin: 0; font-size: 0.9rem; color: var(--ink-soft); display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
.history-preview { cursor: pointer; }
.history-preview:hover { color: var(--lav-deep); }
.history-menu-toggle { border: 0; background: transparent; color: var(--ink-faint); padding: 2px 4px; border-radius: 6px; font: inherit; font-weight: 700; letter-spacing: .12em; cursor: pointer; }
.history-menu-toggle:hover, .history-menu-toggle[aria-expanded="true"] { background: var(--lav-soft); color: var(--lav-deep); }
.history-actions:not([hidden]) { position: absolute; z-index: 3; top: 42px; right: 10px; display: flex; align-items: center; gap: 10px; padding: 9px 11px; background: var(--card); border: 1px solid var(--line); border-radius: 10px; box-shadow: var(--shadow-sm); }
.history-actions [data-act="open"], .history-actions [data-act="duplicate"], .history-actions [data-act="rename"], .history-actions .history-separator { display: none; }
mark { background: #f7e9a8; color: inherit; border-radius: 3px; padding: 0 2px; }
.history-status { font-size: 0.75rem; font-weight: 700; color: #2f5c3f; background: #e6f2e9; padding: 2px 9px; border-radius: 999px; }
.history-row { display: flex; flex-wrap: wrap; gap: 5px 8px; align-items: center; min-width: 0; }
.history-row .link-btn { white-space: nowrap; font-size: .78rem; }
.history-separator { color: #716a63; }
.link-btn { font: inherit; font-size: 0.85rem; font-weight: 600; background: none; border: none; cursor: pointer; color: var(--lav-deep); padding: 2px 0; }
.link-btn:hover { text-decoration: underline; }
.link-btn.danger { color: var(--danger); }
.empty-history { color: var(--ink-faint); font-size: 0.92rem; background: var(--bg); border: 1px dashed var(--line); border-radius: var(--radius-sm); padding: 14px; }
.history-tools { margin-top: 0; }
.history-tools .btn { min-width: 0; white-space: normal; line-height: 1.25; }
.history > .btn-danger-ghost { margin-top: 14px; }
.about ol { margin: 12px 0; padding-left: 20px; color: var(--ink-soft); display: flex; flex-direction: column; gap: 6px; }
.about h2 { font-size: 1.15rem; }
.text-size-tools { display: flex; align-items: center; gap: 6px; margin-top: 14px; padding-top: 12px; border-top: 1px dashed var(--line); }
.text-size-tools .btn { padding: 6px 10px; }
.private-notes textarea { min-height: 110px; font-size: 0.92rem; padding: 12px 14px; }

/* Clarity Studio */
.studio-header { display:flex; justify-content:space-between; align-items:flex-end; gap:24px; margin-bottom:24px; }
.clarity-header-actions { display:flex; flex-wrap:wrap; justify-content:flex-end; gap:10px; }
.studio-intake { padding:clamp(18px,3vw,30px); margin:0 auto 28px; max-width:1100px; }
.studio-intake-heading label { display:block; font-size:1.12rem; font-weight:750; margin-bottom:5px; }
.studio-intake-heading p { margin:0 0 15px; }
.studio-source-banner { display:flex; align-items:center; justify-content:space-between; gap:16px; padding:12px 14px; margin:0 0 12px; background:color-mix(in srgb,var(--lav-soft) 65%,var(--card)); border:1px solid var(--line); border-radius:14px; }
.studio-source-banner > div { display:grid; gap:4px; min-width:0; }
.studio-source-banner strong { overflow-wrap:anywhere; }
.studio-intake textarea { width:100%; min-height:160px; resize:vertical; }
.studio-intake textarea[readonly] { color:var(--ink-soft); cursor:default; }
.studio-input-footer { display:flex; align-items:center; justify-content:space-between; gap:14px; margin-top:12px; }
.studio-input-actions { display:flex; align-items:center; gap:10px; flex-shrink:0; }
.studio-mic { width:46px; height:46px; padding:10px; }
.studio-mic svg { width:22px; height:22px; fill:none; stroke:currentColor; stroke-width:1.8; stroke-linecap:round; stroke-linejoin:round; }
.studio-entry .studio-intake { max-width:none; margin:0; padding:22px; }
.studio-entry .studio-intake-heading p { margin-bottom:12px; }
.studio-entry .studio-intake textarea { min-height:170px; }
.studio-entry .studio-mode-section { max-width:none; margin:18px 0 0; }
.studio-entry .studio-mode-heading { margin-bottom:10px; }
.studio-entry .studio-mode-heading h2 { font-size:1.08rem; }
.studio-entry .studio-mode-cards { gap:8px; }
.studio-entry .studio-mode-card { min-height:0; padding:10px 11px; gap:4px; border-radius:12px; box-shadow:none; }
.studio-entry .studio-mode-card:hover { transform:translateY(-1px); box-shadow:var(--shadow-sm); }
.studio-entry .studio-mode-card strong { font-family:inherit; font-size:.94rem; }
.studio-entry .studio-mode-card > span:last-child { font-size:.72rem; line-height:1.35; }
.studio-entry .studio-input-footer { margin-top:18px; }
.studio-entry .studio-input-footer { display:grid; grid-template-columns:minmax(0,1fr); align-items:start; gap:12px; }
.studio-entry #studioSourceStatus { max-width:none; line-height:1.45; }
.studio-entry .studio-input-actions { justify-content:flex-end; }
.studio-dictation { min-height:46px; display:inline-flex; align-items:center; justify-content:center; gap:8px; padding:10px 16px; }
.studio-dictation svg { width:19px; height:19px; flex:none; fill:none; stroke:currentColor; stroke-width:1.8; stroke-linecap:round; stroke-linejoin:round; }
.studio-dictation.recording { color:var(--danger); border-color:var(--danger); }
.studio-error { margin:10px 0 0; color:var(--danger); font-size:.92rem; }
.studio-error[hidden] { display:none; }
.studio-mode-section,.studio-recent { max-width:1100px; margin:0 auto 30px; }
.studio-mode-heading,.studio-recent-heading { margin-bottom:14px; }
.studio-mode-heading h2,.studio-recent-heading h2 { margin:0 0 5px; }
.studio-mode-heading p,.studio-recent-heading p { margin:0; }
.studio-mode-cards { display:grid; grid-template-columns:repeat(3,minmax(0,1fr)); gap:14px; }
.studio-mode-card { display:flex; flex-direction:column; align-items:flex-start; gap:10px; min-height:160px; text-align:left; padding:20px; color:var(--ink); background:var(--card); border:1px solid var(--line); border-radius:18px; box-shadow:0 3px 0 rgba(60,45,95,.07); font:inherit; cursor:pointer; transition:transform .18s,border-color .18s,box-shadow .18s,background .18s; }
.studio-mode-card:hover { transform:translateY(-2px); border-color:var(--lav); box-shadow:0 6px 0 rgba(95,84,137,.11),var(--shadow-sm); }
.studio-mode-card[aria-pressed="true"] { border-color:var(--lav); background:color-mix(in srgb,var(--lav-soft) 70%,var(--card)); box-shadow:0 0 0 2px color-mix(in srgb,var(--lav) 20%,transparent),0 4px 0 rgba(95,84,137,.12); }
.studio-mode-card:focus-visible { outline:3px solid var(--lav); outline-offset:3px; }
.studio-mode-card strong { font-family:var(--display-font,Georgia,serif); font-size:1.35rem; }
.studio-mode-card > span:last-child { color:var(--ink-soft); line-height:1.5; }
.studio-mode-kicker { color:var(--lav-deep); font-size:.72rem; font-weight:800; letter-spacing:.09em; }
.studio-recent-list { display:grid; grid-template-columns:repeat(auto-fit,minmax(min(100%,240px),1fr)); gap:10px; }
.studio-recent-item { display:grid; gap:6px; min-width:0; padding:14px 16px; text-align:left; color:var(--ink); background:var(--card); border:1px solid var(--line); border-radius:14px; cursor:pointer; }
.studio-recent-item:hover { border-color:var(--lav); }
.studio-recent-item strong { overflow:hidden; text-overflow:ellipsis; white-space:nowrap; }
.studio-recent-item span { color:var(--ink-faint); font-size:.82rem; }
.studio-mic.recording { color:var(--danger); box-shadow:0 0 0 3px color-mix(in srgb,var(--danger) 18%,transparent); }
.studio-workspace { display:grid; grid-template-columns:minmax(320px,.9fr) minmax(0,1.1fr); align-items:start; gap:18px; }
.studio-entry { min-width:0; max-width:none; margin:0; }
.studio-results { min-width:0; max-width:none; min-height:0; margin:0; padding:18px; }
.studio-intake { height:100%; max-width:none; margin:0; padding:22px; }
.studio-intake textarea { min-height:clamp(190px,30vh,330px); }
.studio-mode-section { margin:26px auto 0; }
.studio-mode-heading { margin-bottom:14px; }
.studio-mode-heading h2 { margin:0 0 5px; font-size:1.35rem; }
.studio-mode-heading p { margin:0; }
.studio-results-top { display:flex; align-items:center; justify-content:space-between; gap:14px; margin-bottom:14px; }
.studio-results-top .eyebrow { margin:0; letter-spacing:.1em; }
.studio-answer { overflow:visible; border:0; border-radius:0; background:transparent; box-shadow:none; }
.studio-answer-heading { display:grid; gap:5px; padding:0 0 10px; border-bottom:1px solid var(--line); background:transparent; }
.studio-answer-mode { width:max-content; padding:3px 7px; border:1px solid var(--line); border-radius:99px; color:var(--ink-soft); font-size:.64rem; font-weight:700; letter-spacing:.06em; text-transform:uppercase; }
.studio-answer-heading h2 { max-width:28ch; margin:2px 0 0; font:clamp(1.35rem,2.4vw,1.8rem)/1.12 var(--display-font,Georgia,serif); letter-spacing:-.025em; }
.studio-answer-heading textarea,.studio-answer-section textarea { display:block; width:100%; min-height:0; height:auto; resize:none; overflow:hidden; color:var(--ink-soft); background:transparent; border:1px solid transparent; border-radius:8px; padding:2px 4px; font:inherit; font-size:.9rem; line-height:1.45; }
.studio-answer-heading textarea:focus,.studio-answer-section textarea:focus,.studio-next-step input:focus,.studio-next-step textarea:focus { border-color:var(--lav); outline:2px solid color-mix(in srgb,var(--lav) 25%,transparent); background:var(--card); }
.studio-answer-sections { display:block; }
.studio-answer-section { min-width:0; padding:9px 0; border-bottom:1px solid var(--line); }
.studio-answer-section:last-child { border-bottom:0; }
.studio-answer-section:nth-child(odd) { border-right:0; }
.studio-answer-section h3 { margin:0 0 3px; font-size:.86rem; }
.studio-answer-bullets { display:grid; gap:4px; margin:0; padding-left:17px; font-size:.86rem; line-height:1.4; }
.studio-answer-bullets li { padding-left:1px; }
.answer-basis,.answer-source { display:block; margin-top:5px; color:var(--ink-soft); font-size:.78rem; }
.answer-source { padding-left:9px; border-left:2px solid var(--lav); font-style:italic; }
.studio-next-step { display:grid; gap:2px; margin-top:8px; padding:10px 12px; border:1px solid color-mix(in srgb,var(--lav) 25%,var(--line)); border-radius:10px; background:color-mix(in srgb,var(--lav-soft) 30%,var(--card)); }
.studio-next-step .eyebrow { width:max-content; margin:0; padding:3px 7px; font-size:.64rem; }
.studio-next-step input,.studio-next-step textarea { width:100%; background:transparent; border-color:transparent; resize:none; overflow:hidden; }
.studio-next-step textarea { min-height:0; height:auto; padding:1px 4px; font-size:.8rem; line-height:1.4; }
.studio-next-step input { padding:1px 4px; font-size:.92rem; font-weight:700; }
.studio-result-actions { display:flex; align-items:center; flex-wrap:wrap; gap:6px; padding:10px 0 0; border-top:1px solid var(--line); }
.studio-result-actions .btn { min-height:32px; padding:5px 10px; font-size:.75rem; }
.studio-advanced { margin:8px 0 12px; padding:0; border:0; }
.studio-advanced summary { width:max-content; cursor:pointer; color:var(--ink-soft); font-size:.78rem; }
.studio-task-list { display:grid; gap:10px; margin-top:14px; }
.studio-task { display:flex; align-items:flex-start; gap:12px; padding:14px; border:1px solid var(--line); border-radius:14px; background:var(--card); }
.studio-task.is-complete { opacity:.68; }
.studio-task-check { display:flex; flex-direction:column; align-items:center; gap:4px; color:var(--ink-soft); font-size:.75rem; }
.studio-task-fields { display:grid; flex:1; min-width:0; gap:8px; }
.studio-task-fields input,.studio-task-fields textarea { width:100%; }
.studio-task-meta { display:flex; flex-wrap:wrap; gap:8px 14px; color:var(--ink-soft); font-size:.78rem; }
.studio-task-meta span { padding:3px 8px; border-radius:99px; background:var(--lav-soft); }
body[data-theme="night"] .studio-answer-heading { background:transparent; }
body[data-theme="night"] .studio-next-step { background:color-mix(in srgb,var(--lav-soft) 25%,var(--card)); }
.clarity-screen .thought-node input[data-item-label] { width:100%; margin-top:10px; }
.clarity-screen .thought-node[open] > p { color:var(--ink-soft); }
.clarity-screen [aria-busy="true"] { opacity:.72; }
.studio-panel-state { min-height:300px; display:flex; flex-direction:column; align-items:center; justify-content:center; gap:10px; padding:28px; text-align:center; color:var(--ink-soft); }
.studio-panel-state h3 { margin:0; color:var(--ink); font:500 1.35rem/1.2 var(--font-display); }
.studio-panel-state p { max-width:34ch; margin:0; line-height:1.55; }
.studio-state-mark { color:var(--lav-deep); font-size:1.65rem; }
.studio-loading { flex-direction:row; justify-content:center; text-align:left; }
.studio-spinner { width:24px; height:24px; flex:none; border:2px solid var(--line); border-top-color:var(--lav-deep); border-radius:50%; animation:studio-spin .8s linear infinite; }
@keyframes studio-spin { to { transform:rotate(360deg); } }
.studio-error-panel { display:flex; align-items:center; justify-content:space-between; gap:14px; padding:14px; border:1px solid color-mix(in srgb,var(--danger) 30%,var(--line)); border-radius:12px; background:color-mix(in srgb,var(--danger) 6%,var(--card)); }
.studio-error-panel[hidden] { display:none; }
.studio-error-panel .studio-error { margin:0; }
.studio-error-panel #clarityStatus { padding:0; border:0; background:transparent; font-size:.92rem; }
.studio-results > [hidden] { display:none !important; }
@media(max-width:860px) { .studio-workspace { grid-template-columns:minmax(0,1fr); } .studio-results { min-height:260px; } }
@media(max-width:720px) {
  .studio-header { align-items:flex-start; flex-direction:column; }
  .clarity-header-actions { justify-content:flex-start; }
  .studio-mode-cards { grid-template-columns:1fr; }
  .studio-mode-card { min-height:0; }
  .studio-results-top { align-items:flex-start; }
  .studio-result-actions .btn { flex:1 1 auto; }
  .studio-input-footer { align-items:flex-start; flex-direction:column; }
  .studio-input-actions { align-self:flex-end; }
  .studio-source-banner { align-items:flex-start; flex-direction:column; }
  .studio-entry .studio-mode-cards { grid-template-columns:repeat(3,minmax(0,1fr)); }
  .studio-entry .studio-input-footer { align-items:stretch; flex-direction:column; }
  .studio-entry .studio-input-actions { align-self:stretch; justify-content:flex-end; }
}

/* focus mode */
.focus-screen { min-height: calc(100vh - 150px); }
.focus-panel { width: min(100%, 720px); margin: 0 auto; padding: clamp(24px, 5vw, 54px); text-align: center; }
body.focus-mode .focus-panel { min-height: min(680px, calc(100vh - 170px)); display: flex; flex-direction: column; justify-content: center; backdrop-filter: blur(18px); -webkit-backdrop-filter: blur(18px); border-color: rgba(156,174,255,.25); }
.focus-head { display: flex; align-items: flex-start; justify-content: space-between; gap: 20px; text-align: left; }
.focus-head h1 { font-family: var(--font-display); font-size: clamp(1.8rem, 4vw, 2.7rem); font-weight: 500; letter-spacing: -0.03em; line-height: 1.1; margin: 0; }
.focus-head .muted { max-width: 48ch; }
.focus-mode-tabs { display: inline-flex; gap: 6px; margin: 30px auto 14px; padding: 5px; border: 1px solid var(--line); border-radius: 999px; background: var(--bg); }
.focus-mode-tabs .btn { border-color: transparent; }
.focus-mode-tabs .btn[aria-selected="true"] { background: var(--lav-soft); color: var(--lav-deep); border-color: #ddd2f0; }
.focus-clock { display: flex; flex-direction: column; align-items: center; margin: 10px 0 22px; color: var(--ink); }
.focus-clock > span:first-child { font-variant-numeric: tabular-nums; font-size: clamp(4.5rem, 15vw, 8rem); font-weight: 500; letter-spacing: -0.06em; line-height: 1; }
.focus-state { margin-top: 10px; color: var(--ink-faint); font-size: .9rem; }
.focus-presets { display: flex; flex-wrap: wrap; justify-content: center; gap: 8px; margin: 0 auto 24px; }
.focus-presets .btn { padding: 8px 14px; }
.focus-intention { display: block; max-width: 480px; margin: 0 auto; color: var(--ink-soft); font-size: .9rem; text-align: left; }
.focus-intention span { color: var(--ink-faint); }
.focus-intention input { display: block; width: 100%; margin-top: 8px; padding: 12px 14px; border: 1px solid var(--line); border-radius: var(--radius-sm); background: var(--bg); color: var(--ink); font: inherit; outline: none; }
.focus-intention input:focus { border-color: var(--lav); box-shadow: 0 0 0 3px var(--lav-soft); }
.focus-controls { display: flex; justify-content: center; gap: 10px; margin-top: 24px; }
.focus-controls .btn { min-width: 120px; justify-content: center; }
.focus-note { color: var(--ink-faint); font-size: .8rem; margin: 20px 0 0; }

.shortcut-overlay { position: fixed; inset: 0; z-index: 80; display: grid; place-items: center; padding: 20px; background: rgba(43, 42, 40, 0.38); }
.shortcut-dialog { width: min(100%, 440px); background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); box-shadow: 0 20px 70px rgba(43, 42, 40, 0.25); padding: 22px; }
.shortcut-list { display: grid; grid-template-columns: auto 1fr; gap: 12px 16px; margin: 4px 0 0; align-items: center; color: var(--ink-soft); }
.shortcut-list dt { margin: 0; white-space: nowrap; }
.shortcut-list dd { margin: 0; }
kbd { display: inline-block; min-width: 24px; padding: 3px 7px; border: 1px solid var(--line); border-bottom-width: 2px; border-radius: 6px; background: var(--bg); color: var(--ink); font: 0.78rem var(--font-body); text-align: center; }
.visually-hidden { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); }

@media (max-width: 560px) {
  .card-head { flex-direction: column; }
  .btn { width: 100%; justify-content: center; }
  .header-inner { flex-direction: column; align-items: stretch; gap: 9px; padding: 10px 14px; }
  .header-brand-actions { width: 100%; justify-content: space-between; gap: 8px; }
  .header-note { display: none; }
  .header-nav { width: 100%; max-width: none; gap: 4px; flex-wrap: wrap; justify-content: space-between; }
  .header-brand-actions .btn { width: auto; padding: 7px 9px; font-size: 0.72rem; gap: 4px; }
  .header-nav .btn { width: auto; min-width: 0; padding: 6px 7px; font-size: 0.68rem; gap: 4px; }
  .profile-trigger { max-width: none; }
  .profile-trigger #headerAccountLabel { overflow: hidden; text-overflow: ellipsis; }
  .history-tools { grid-template-columns: 1fr; }
  .focus-screen { padding-top: 24px !important; }
  .focus-panel { padding: 24px 18px; }
  .focus-head { flex-direction: column; }
  .focus-head .btn { width: auto; }
  .focus-controls .btn { width: auto; }
  .voice-header { flex-direction: column; gap: 18px; }
  .voice-header .btn { width: auto; align-self: flex-start; }
  .voice-panel { padding: 24px 18px; }
  .voice-orb { width: 128px; height: 128px; margin-top: 42px; }
  .voice-controls .btn, .composer-row .btn { width: auto; }
  .composer-field { gap: 5px; padding: 6px; border-radius: 22px; }
  .composer-field > .btn, .composer-row .btn { width: 40px; height: 40px; min-width: 40px; }
  .composer-row { gap: 5px; }
  #composer textarea { padding: 8px 5px; font-size: .92rem; }
  .home-view { padding-top: 54px; padding-bottom: 54px; }
  .home-entry-footer { align-items: stretch; flex-direction: column; padding: 8px; }
  .home-entry-actions { width: 100%; justify-content: flex-end; }
  .home-entry-footer .btn { width: auto; }
  .home-entry-footer .home-mic { width: 46px; flex: 0 0 46px; }
  .home-entry-footer .home-cta { justify-content: space-between; padding-left: 18px; }
  .home-entry-footer .home-cta { flex: 1; }
  .home-principles { grid-template-columns: 1fr; margin-top: 44px; }
  .home-clarity-actions { grid-template-columns: 1fr; gap: 7px; }
  .home-mode-action { min-height: 56px; }
  .home-recent-list { grid-template-columns: 1fr; }
  .clarity-screen { padding: 22px 16px 46px; }
  .clarity-header { flex-direction: column; }
  .clarity-section-heading { align-items: flex-start; flex-direction: column; }
  .thought-legend { justify-content: flex-start; }
  .clarity-core { align-items: stretch; flex-direction: column; }
  .clarity-core > .btn { align-self: flex-end; }
  .clarity-modes { width: 100%; justify-content: space-between; }
  .clarity-modes button { padding-inline: 10px; }
  .thought-map { grid-template-columns: 1fr; }
  .thought-edge { grid-template-columns: 1fr; align-items: start; gap: 3px; padding: 9px 0; border-bottom: 1px solid var(--line); }
  .edge-line { display: none; }
  .edge-label { text-align: left; }
  .thought-edge small { grid-column: 1; }
  .clarity-task,.not-now-item { flex-direction: column; }
  .task-actions { padding-left: 28px; }
  .clarity-task-fields { width: 100%; }
}

/* Large-screen scale: use the available canvas instead of rendering the app at a tablet scale. */
@media (min-width: 1200px) {
  /* Keep the wide desktop layout spacious without scaling every control up
     like a browser zoom. The previous 22px root made the chat feel oversized
     on presentation screens; 16px keeps the same proportions at a calmer,
     roughly 70% visual scale while preserving the responsive layout. */
  html { font-size: 16px; }
  .wrap { max-width: none; padding-left: 44px; padding-right: 44px; }
  .header-inner { padding-top: 18px; padding-bottom: 18px; }
  .header-nav { gap: 18px; }
  .header-note { font-size: 1rem; }
  .brand-mark { width: 34px; height: 34px; }
  .brand-text { font-size: 1.6rem; }
  .home-brand-lockup .brand-mark { width: 88px; height: 88px; box-shadow: 0 0 0 13px var(--lav-soft); }
  .layout { grid-template-columns: minmax(0, 1fr) 420px; gap: 36px; padding-top: 44px; padding-bottom: 64px; }
  body.chat-view #chatView { padding: 12px 44px; }
  body.chat-view .chat-history-action-row { margin-right: -44px; }
  .main-column { gap: 30px; }
  .hero { padding-top: 18px; }
  .hero h1 { font-size: clamp(2.8rem, 4.8vw, 4.3rem); margin-bottom: 18px; }
  .lede { font-size: 1.2rem; }
  .card { padding: 36px; }
  .chat-card { padding: 30px; }
  .thread { max-height: 600px; gap: 8px; }
  .msg { max-width: 82%; }
  .msg p { font-size: 1.18rem; line-height: 1.65; }
  .message-action { font-size: .82rem; }
  #composer textarea { min-height: 48px; font-size: 1.05rem; }
  .chip { font-size: .98rem; padding: 10px 17px; }
  .btn { font-size: 1rem; padding: 14px 26px; }
  .btn-sm { padding: 10px 19px; font-size: .95rem; }
  .history-list { max-height: 600px; }
  .history-preview { font-size: 1rem; }
  .about .small, .private-notes .small { font-size: .96rem; }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation: none !important; transition: none !important; }
  html { scroll-behavior: auto; }
  .cursor-aura, .ambient-ring { display: none; }
}

/* A quiet sky behind the restored cream and lavender interface. */
body[data-theme="night"] .ambient-grid { opacity: .12; }
body[data-theme="night"] .ambient-orb-one { background: #7666bd; opacity: .16; }
body[data-theme="night"] .ambient-orb-two { background: #476c8b; opacity: .12; }
body[data-theme="night"] .ambient-orb-three { background: #6657a3; opacity: .11; }
body[data-theme="night"] .ambient-ring { border-color: rgba(191, 180, 235, .12); }
.ambient::before, .ambient::after { content: ""; position: absolute; inset: 0; pointer-events: none; }
.ambient::before {
  opacity: 0;
  background-image:
    radial-gradient(1px 1px at 8% 17%, #fff 98%, transparent),
    radial-gradient(1.5px 1.5px at 22% 63%, #e4dcff 98%, transparent),
    radial-gradient(1px 1px at 37% 29%, #fff 98%, transparent),
    radial-gradient(1.5px 1.5px at 54% 76%, #d8ccff 98%, transparent),
    radial-gradient(1px 1px at 69% 20%, #fff 98%, transparent),
    radial-gradient(1px 1px at 83% 55%, #e7e1ff 98%, transparent),
    radial-gradient(1.5px 1.5px at 94% 84%, #fff 98%, transparent),
    radial-gradient(1px 1px at 14% 91%, #d8ccff 98%, transparent);
  background-size: 420px 360px;
  transition: opacity .8s ease;
}
.ambient::after {
  opacity: 0;
  background: radial-gradient(ellipse at 78% 18%, rgba(108, 93, 178, .18), transparent 48%),
    radial-gradient(ellipse at 20% 80%, rgba(61, 111, 150, .12), transparent 46%);
  transition: opacity .8s ease;
}
body[data-theme="night"] .ambient::before { opacity: .72; animation: night-sparkle 8s ease-in-out infinite alternate; }
body[data-theme="night"] .ambient::after { opacity: 1; }
body[data-theme="night"] .cursor-aura { background: radial-gradient(circle, rgba(135, 119, 205, .1), transparent 68%); }
@keyframes night-sparkle { from { opacity: .48; } to { opacity: .82; } }
@media (hover: none), (pointer: coarse) {
  .cursor-aura { display: none; }
  .ambient-ring { transform: none; }
}
@media (prefers-reduced-motion: reduce) {
  body[data-theme="night"] .ambient::before { animation: none; }
}
