:root {
  --ink: #404040;
  --ink-strong: #211d1c;
  --wine: #3e1322;
  --wine-soft: #512b38;
  --muted: #7b666d;
  --stone: #f4f3f1;
  --lavender: #e7e2f3;
  --lavender-light: #f3f2f7;
  --sand: #e9dfd0;
  --peach: #f7c3ae;
  --white: #fff;
  --sage: #577468;
  --line: #dcdCDD;
  --display: Recoleta, "Iowan Old Style", "Palatino Linotype", Georgia, serif;
  --sans: neue-haas-unica, "Helvetica Neue", Arial, sans-serif;
  --shadow: 0 24px 70px rgba(62, 19, 34, .11);
}

* { box-sizing: border-box; }
html, body { margin: 0; min-height: 100%; color: var(--ink); background: var(--stone); font-family: var(--sans); }
button, input, textarea { font: inherit; }
button { cursor: pointer; }
button:focus-visible, input:focus-visible, textarea:focus-visible, a:focus-visible { outline: 3px solid rgba(62, 19, 34, .28); outline-offset: 3px; }
[hidden] { display: none !important; }
.sr-only { position: absolute; width: 1px; height: 1px; padding: 0; overflow: hidden; clip: rect(0,0,0,0); white-space: nowrap; border: 0; }
.eyebrow { margin: 0; color: var(--wine); font-size: .67rem; font-weight: 750; letter-spacing: .16em; text-transform: uppercase; }
.wordmark { color: inherit; text-decoration: none; }
.brand-logo, .brand-logo strong { font: 500 1.35rem/1 var(--display); letter-spacing: .23em; }
.boot-view { min-height: 100vh; display: grid; place-content: center; justify-items: center; gap: 15px; color: var(--muted); background: var(--lavender-light); }
.boot-view .brand-logo { color: var(--wine); font-size: 1.8rem; }

.auth-view { min-height: 100vh; display: grid; grid-template-columns: minmax(420px, 1.14fr) minmax(390px, .86fr); }
.auth-story { position: relative; isolation: isolate; overflow: hidden; padding: clamp(42px, 6.5vw, 96px); display: flex; flex-direction: column; justify-content: space-between; gap: 70px; color: var(--wine); background: var(--lavender); }
.auth-story::before, .auth-story::after { position: absolute; z-index: -1; content: ""; border-radius: 999px; }
.auth-story::before { width: 39vw; height: 39vw; right: -12vw; top: -15vw; border: 1px solid rgba(62,19,34,.2); box-shadow: 0 0 0 55px rgba(255,255,255,.14), 0 0 0 110px rgba(62,19,34,.035); }
.auth-story::after { width: 250px; height: 250px; left: -100px; bottom: -115px; background: var(--peach); opacity: .72; }
.auth-story .brand-logo strong { font-size: clamp(1.45rem, 2.2vw, 2.1rem); }
.auth-story h1 { max-width: 790px; margin: 18px 0 24px; color: var(--wine); font: 400 clamp(3.4rem, 6vw, 7rem)/.93 var(--display); letter-spacing: -.047em; }
.auth-story p:not(.eyebrow) { max-width: 620px; color: var(--wine-soft); font-size: 1.04rem; line-height: 1.7; }
.auth-story small { color: var(--muted); font-size: .7rem; letter-spacing: .04em; }
.source-ribbon { margin-top: 34px; display: flex; flex-wrap: wrap; gap: 8px; }
.source-ribbon span { padding: 8px 13px; border: 1px solid rgba(62,19,34,.22); border-radius: 999px; color: var(--wine); background: rgba(255,255,255,.26); font-size: .64rem; font-weight: 750; letter-spacing: .1em; text-transform: uppercase; }
.auth-panel { position: relative; padding: 34px; display: grid; place-items: center; background: #fbfaf8; }
.auth-panel-brand { display: none; }
.auth-card { width: min(430px, 100%); padding: 42px; border: 1px solid var(--line); border-radius: 2px; background: var(--white); box-shadow: var(--shadow); }
.auth-card h2 { margin: 11px 0 8px; color: var(--ink-strong); font: 400 2.55rem/1.08 var(--display); letter-spacing: -.025em; }
.auth-card > p:not(.eyebrow,.form-status) { color: var(--muted); line-height: 1.55; }
.auth-card label { margin-top: 19px; display: grid; gap: 8px; color: var(--wine); font-size: .71rem; font-weight: 750; letter-spacing: .04em; text-transform: uppercase; }
.auth-card input { width: 100%; padding: 14px; border: 1px solid #cfcfcf; border-radius: 0; color: var(--ink-strong); background: #fff; }
.auth-card input:focus { border-color: var(--wine); outline: 3px solid rgba(62,19,34,.1); }

.primary-button, .quiet-button, .text-button { border: 0; border-radius: 0; font-weight: 750; }
.primary-button { padding: 13px 19px; color: white; background: var(--wine); }
.primary-button:hover { background: var(--ink-strong); }
.auth-card .primary-button { width: 100%; margin-top: 24px; }
.quiet-button { padding: 9px 13px; color: var(--wine); background: var(--lavender-light); }
.quiet-button:hover { background: var(--lavender); }
.text-button { padding: 8px 0; color: var(--wine); background: transparent; }
.auth-card .text-button { width: 100%; margin-top: 8px; }
.form-status { min-height: 20px; margin: 12px 0 0; color: #a12f4a; font-size: .76rem; }
.form-status.success { color: var(--sage); }

.topbar { height: 78px; padding: 0 28px; display: grid; grid-template-columns: 1fr auto 1fr; align-items: center; border-bottom: 1px solid var(--line); background: var(--white); }
.topbar .brand-logo strong { color: var(--ink-strong); font-size: 1.28rem; }
.workspace-title { display: flex; align-items: baseline; gap: 9px; color: var(--wine); }
.workspace-title strong { font: 400 1.6rem var(--display); }
.workspace-title span { color: var(--muted); font-size: .62rem; font-weight: 700; text-transform: uppercase; letter-spacing: .15em; }
.account { justify-self: end; display: flex; align-items: center; gap: 12px; color: var(--muted); font-size: .72rem; }
.account-role { padding: 5px 8px; color: var(--wine); background: var(--lavender-light); font-size: .57rem; font-weight: 800; letter-spacing: .1em; text-transform: uppercase; }
.workspace { min-height: calc(100vh - 78px); display: grid; grid-template-columns: 210px 250px minmax(0, 1fr); }

.sidebar { padding: 28px 15px; border-right: 1px solid var(--line); background: var(--lavender-light); }
.nav-label { margin: 0 9px 10px; color: #8b7a81; font-size: .6rem; font-weight: 800; letter-spacing: .15em; text-transform: uppercase; }
.boards-label { margin-top: 30px; }
.mode-button { width: 100%; padding: 12px; display: grid; gap: 3px; border: 0; border-left: 3px solid transparent; border-radius: 0; color: var(--ink); background: transparent; text-align: left; }
.mode-button strong { font-size: .78rem; }
.mode-button span { color: var(--muted); font-size: .65rem; }
.mode-button:hover, .mode-button.active { border-left-color: var(--wine); color: var(--wine); background: var(--white); }
.nav-empty { padding: 4px 10px; color: var(--muted); font-size: .66rem; line-height: 1.5; }
.boundary-note { margin-top: 32px; padding: 14px 9px; display: flex; align-items: center; gap: 8px; border-top: 1px solid var(--line); color: var(--muted); font-size: .64rem; }
.boundary-note span { width: 7px; height: 7px; border-radius: 50%; background: var(--sage); box-shadow: 0 0 0 3px rgba(87,116,104,.12); }
.boundary-note p { margin: 0; }

.history-panel { min-height: 0; padding: 27px 14px; border-right: 1px solid var(--line); background: #efeeec; }
.history-heading { padding: 0 7px 16px; display: flex; justify-content: space-between; align-items: center; border-bottom: 1px solid var(--line); }
.history-heading h2 { margin: 6px 0 0; color: var(--ink-strong); font-size: .9rem; }
.history-heading > span { min-width: 27px; height: 27px; display: grid; place-items: center; color: var(--wine); background: var(--white); font-size: .7rem; font-weight: 800; }
.new-query { width: 100%; margin: 13px 0 6px; padding: 10px; border: 1px solid #cfcfcf; border-radius: 0; color: var(--wine); background: var(--white); font-size: .7rem; font-weight: 800; }
#historyList { max-height: calc(100vh - 211px); overflow: auto; }
.history-empty { padding: 10px 7px; color: var(--muted); font-size: .69rem; line-height: 1.5; }
.history-item { width: 100%; padding: 11px 8px; display: grid; gap: 3px; border: 0; border-left: 2px solid transparent; color: var(--ink); background: transparent; text-align: left; }
.history-item:hover { border-left-color: var(--wine); background: var(--white); }
.history-item strong { overflow: hidden; font-size: .71rem; text-overflow: ellipsis; white-space: nowrap; }
.history-item small { color: var(--muted); font-size: .6rem; }

.chat-view { min-width: 0; padding: clamp(28px, 4.4vw, 68px); display: grid; align-content: start; background: #fbfaf8; }
.hero-card { position: relative; isolation: isolate; overflow: hidden; max-width: 1020px; padding: clamp(28px, 4vw, 54px); border: 1px solid #d7cdd9; background: var(--lavender); }
.hero-copy { position: relative; z-index: 1; max-width: 760px; }
.hero-card h1 { margin: 14px 0 17px; color: var(--wine); font: 400 clamp(3rem, 5vw, 6rem)/.94 var(--display); letter-spacing: -.047em; }
.hero-card .hero-copy > p:not(.eyebrow) { max-width: 690px; color: var(--wine-soft); font-size: .98rem; line-height: 1.68; }
.hero-flourish { position: absolute; right: -58px; top: -72px; width: 280px; height: 280px; opacity: .72; }
.hero-flourish span { position: absolute; inset: 0; border: 1px solid rgba(62,19,34,.23); border-radius: 50%; }
.hero-flourish span:nth-child(2) { inset: 38px; background: rgba(255,255,255,.28); }
.hero-flourish span:nth-child(3) { inset: 88px; background: var(--peach); border: 0; }
.starter-prompts { position: relative; z-index: 1; margin-top: 34px; display: grid; grid-template-columns: repeat(3, minmax(0,1fr)); gap: 1px; background: rgba(62,19,34,.18); }
.starter-prompts button { min-height: 118px; padding: 18px; display: grid; align-content: end; gap: 6px; border: 0; border-top: 3px solid transparent; color: var(--ink); background: rgba(255,255,255,.88); text-align: left; transition: background .16s ease, border-color .16s ease; }
.starter-prompts button:hover { border-top-color: var(--wine); background: var(--white); }
.starter-prompts strong { color: var(--wine); font: 400 1.08rem var(--display); }
.starter-prompts span { color: var(--muted); font-size: .69rem; }

.conversation { max-width: 940px; margin-top: 28px; display: grid; gap: 16px; }
.message { max-width: 820px; padding: 19px 21px; border-radius: 0; line-height: 1.62; }
.message.user { justify-self: end; color: white; background: var(--wine); }
.message.assistant { border: 1px solid var(--line); border-left: 4px solid var(--lavender); background: white; }
.message h3 { margin: 0 0 7px; color: inherit; font: 400 1.3rem var(--display); }
.message p { margin: 5px 0; }
.message ul { margin: 8px 0; padding-left: 20px; }
.response-subtitle { font-size: .85rem; color: var(--muted); }
.response-metrics { display: grid; grid-template-columns: repeat(auto-fit, minmax(130px, 1fr)); gap: 12px; margin: 16px 0; }
.response-metrics dt { font-size: .8rem; color: var(--muted); }
.response-metrics dd { margin: 0; font-weight: 700; overflow-wrap: anywhere; }
.response-caveats { margin-top: 16px; padding: 12px 14px; border-left: 2px solid var(--lavender); font-size: .85rem; }
.message .open-board { display: inline-block; margin-top: 12px; color: var(--wine); font-weight: 800; }
.message.assistant.thinking-card { width: min(820px, 100%); padding: 0; overflow: hidden; border-left-color: var(--peach); box-shadow: 0 16px 42px rgba(62,19,34,.06); }
.thinking-main { padding: 24px 25px 20px; display: grid; grid-template-columns: 64px minmax(0,1fr); align-items: center; gap: 20px; }
.thinking-orbit { position: relative; width: 58px; height: 58px; border: 1px solid rgba(62,19,34,.16); border-radius: 50%; animation: molly-turn 5s linear infinite; }
.thinking-orbit::before { position: absolute; inset: 10px; content: ""; border: 1px solid rgba(62,19,34,.22); border-radius: 50%; }
.thinking-orbit span { position: absolute; border-radius: 50%; }
.thinking-orbit span:nth-child(1) { width: 14px; height: 14px; right: 1px; top: 7px; background: var(--peach); box-shadow: 0 0 0 6px rgba(247,195,174,.22); }
.thinking-orbit span:nth-child(2) { width: 9px; height: 9px; left: 12px; bottom: 4px; background: var(--wine); }
.thinking-orbit span:nth-child(3) { width: 10px; height: 10px; left: 23px; top: 23px; background: var(--lavender); animation: molly-breathe 1.6s ease-in-out infinite; }
.thinking-copy { min-width: 0; }
.thinking-copy .eyebrow { margin-bottom: 5px; }
.thinking-copy .thinking-stage { margin: 0; color: var(--wine); font: 400 1.55rem/1.2 var(--display); }
.thinking-copy .thinking-detail { margin: 5px 0 0; color: var(--muted); font-size: .78rem; }
.thinking-progress { height: 2px; overflow: hidden; background: var(--lavender-light); }
.thinking-progress span { width: 38%; height: 100%; display: block; background: linear-gradient(90deg, transparent, var(--peach), var(--wine), transparent); animation: molly-sweep 2.4s ease-in-out infinite; }
.thinking-steps { margin: 0; padding: 17px 25px 16px; display: grid; grid-template-columns: repeat(auto-fit, minmax(105px,1fr)); gap: 13px; list-style: none; border-bottom: 1px solid var(--line); }
.thinking-steps li { position: relative; padding: 15px 0 0; color: #a09297; font-size: .61rem; font-weight: 700; line-height: 1.35; }
.thinking-steps li::before { position: absolute; top: 0; left: 0; width: 7px; height: 7px; content: ""; border: 1px solid #b9adb1; border-radius: 50%; background: white; }
.thinking-steps li.active { color: var(--wine); }
.thinking-steps li.active::before { border-color: var(--wine); background: var(--peach); box-shadow: 0 0 0 4px rgba(247,195,174,.22); }
.thinking-steps li.done { color: var(--sage); }
.thinking-steps li.done::before { border-color: var(--sage); background: var(--sage); }
.thinking-footer { padding: 11px 25px; display: flex; justify-content: space-between; gap: 18px; color: var(--muted); background: #fbfaf8; font-size: .61rem; }
.thinking-footer time { flex: 0 0 auto; color: var(--wine); font-weight: 750; }
.thinking-error { border-left-color: #a12f4a !important; }
.thinking-error .thinking-progress span { animation: none; background: #a12f4a; }
.thinking-error .thinking-orbit { animation: none; opacity: .45; }
@keyframes molly-turn { to { transform: rotate(360deg); } }
@keyframes molly-breathe { 50% { transform: scale(1.45); opacity: .5; } }
@keyframes molly-sweep { from { transform: translateX(-110%); } to { transform: translateX(360%); } }
.composer { max-width: 940px; margin-top: 28px; display: grid; grid-template-columns: 1fr auto; gap: 10px; }
.composer textarea { min-height: 66px; max-height: 180px; padding: 16px; resize: vertical; border: 1px solid #cfcfcf; border-radius: 0; color: var(--ink); background: white; }
.composer textarea:focus { border-color: var(--wine); }
.composer > button { padding: 0 22px; border: 0; border-radius: 0; color: white; background: var(--wine); font-weight: 800; }
.composer > button:hover { background: var(--ink-strong); }
.composer > p { grid-column: 1/-1; margin: 0 4px; display: flex; align-items: center; gap: 7px; color: var(--muted); font-size: .64rem; }
.composer > p span { width: 7px; height: 7px; border-radius: 50%; background: var(--sage); }

.workspace.dashboard-mode { grid-template-columns: 210px minmax(0,1fr); }
.workspace.dashboard-mode .history-panel { display: none; }
.dashboard-view { grid-column: 2 / -1; grid-row: 1; min-width: 0; background: var(--white); }
.dashboard-toolbar { min-height: 88px; padding: 12px 30px; display: grid; grid-template-columns: minmax(90px,.3fr) minmax(0,1.7fr) minmax(180px,.45fr); align-items: center; gap: 20px; border-bottom: 1px solid var(--line); background: var(--lavender-light); }
.dashboard-toolbar > div:nth-child(2) { min-width: 0; text-align: center; }
.dashboard-toolbar h1 { margin: 3px 0; color: var(--wine); font: 400 1.5rem var(--display); }
.dashboard-toolbar small { color: var(--muted); }
.dashboard-actions { justify-self: end; display: flex; gap: 8px; }
.compact { padding: 9px 14px; }
.dashboard-status { padding: 40px; color: var(--muted); text-align: center; }
.dashboard-view iframe { width: 100%; height: calc(100vh - 166px); border: 0; background: var(--stone); }

.share-dialog { width: min(560px, calc(100% - 28px)); padding: 0; border: 1px solid var(--line); border-radius: 0; color: var(--ink); background: white; box-shadow: var(--shadow); }
.share-dialog::backdrop { background: rgba(33,29,28,.66); }
.share-dialog form { padding: 28px; }
.share-dialog header, .share-dialog footer { display: flex; justify-content: space-between; align-items: center; gap: 12px; }
.share-dialog h2 { margin: 5px 0; color: var(--wine); font: 400 1.95rem var(--display); }
.share-dialog > form > p { color: var(--muted); font-size: .8rem; line-height: 1.55; }
.dialog-close { border: 0; color: var(--wine); background: transparent; font-size: 1.7rem; }
.workspace-option, .share-user { display: flex; align-items: flex-start; gap: 11px; }
.workspace-option { padding: 14px; border: 1px solid #d7cdd9; border-radius: 0; background: var(--lavender-light); }
.workspace-option span, .share-user span { display: grid; gap: 2px; }
.workspace-option small, .share-user small { color: var(--muted); }
.share-dialog fieldset { margin: 20px 0; padding: 0; border: 0; }
.share-dialog legend { margin-bottom: 8px; font-size: .75rem; font-weight: 800; }
.share-users { max-height: 220px; overflow: auto; border: 1px solid var(--line); border-radius: 0; }
.share-user { padding: 10px 12px; border-bottom: 1px solid var(--line); font-size: .78rem; }
.share-user:last-child { border-bottom: 0; }
.external-note { padding: 12px; background: var(--stone); }

@media (max-width: 1060px) {
  .workspace { grid-template-columns: 185px minmax(0,1fr); }
  .workspace.dashboard-mode { grid-template-columns: 185px minmax(0,1fr); }
  .history-panel { display:none; }
  .dashboard-view { grid-column: 2; }
  .starter-prompts { grid-template-columns: 1fr; }
  .auth-view { grid-template-columns: 1fr; }
  .auth-story { display:none; }
  .auth-panel-brand { position: absolute; top: 38px; left: 50%; display: block; transform: translateX(-50%); color: var(--wine); font-size: 1.2rem; }
}

@media (max-width: 700px) {
  .topbar { height: 68px; padding: 0 16px; grid-template-columns: auto 1fr; }
  .topbar .brand-logo strong { font-size: 1rem; }
  .workspace-title { display:none; }
  .account #userEmail { display:none; }
  .workspace { display:block; min-height: calc(100vh - 68px); }
  .sidebar { padding: 9px 10px; display:flex; gap:8px; overflow:auto; border-right:0; border-bottom:1px solid var(--line); }
  .sidebar .nav-label, .sidebar .boundary-note, .sidebar #pinnedNav, .boards-label { display:none; }
  .mode-button { min-width:145px; border-left: 0; border-bottom: 3px solid transparent; }
  .mode-button:hover, .mode-button.active { border-left-color: transparent; border-bottom-color: var(--wine); }
  .chat-view { padding:24px 16px; }
  .hero-card { padding: 28px 22px; }
  .hero-card h1 { font-size: 3rem; }
  .hero-flourish { right: -130px; top: -110px; }
  .starter-prompts { display:none; }
  .composer { grid-template-columns: 1fr; }
  .composer > button { min-height: 48px; }
  .thinking-main { padding: 21px; grid-template-columns: 50px minmax(0,1fr); gap: 15px; }
  .thinking-orbit { width: 46px; height: 46px; }
  .thinking-orbit span:nth-child(3) { left: 17px; top: 17px; }
  .thinking-steps { padding: 15px 21px; grid-template-columns: 1fr; gap: 7px; }
  .thinking-steps li { padding: 0 0 0 18px; }
  .thinking-steps li::before { top: 3px; }
  .thinking-footer { padding: 10px 21px; }
  .dashboard-view { min-height:calc(100vh - 124px); }
  .dashboard-toolbar { grid-template-columns:auto 1fr; padding:10px 14px; }
  .dashboard-actions { grid-column:1 / -1; justify-self:stretch; display:flex; flex-wrap:wrap; }
  .dashboard-actions button { flex:1 1 auto; }
  .dashboard-toolbar > div:nth-child(2) { text-align:left; }
  .dashboard-view iframe { height:calc(100vh - 212px); }
  .auth-panel { padding: 18px; }
  .auth-card { padding: 30px 24px; }
}

@media (prefers-reduced-motion: reduce) {
  .thinking-orbit, .thinking-orbit span:nth-child(3), .thinking-progress span { animation: none; }
}
