/* SeedPath Workspace — test UI.
   Built to the workspace mockup, on the seedpath.ai token set:
   paper/ink palette, hairline rules, DM Sans + IBM Plex Mono eyebrows,
   document-like answers rather than bubble-heavy chat. */

:root {
  --paper: #f2f0ec;
  --white: #faf9f6;
  --ink: #2e3a3f;
  --green: #426957;
  --teal: #4a837e;
  --blue: #b6ccd7;
  --dark: #142126;
  --dark2: #1b2b30;

  --bg: var(--white);
  --bg-side: var(--paper);
  --bg-hover: rgba(74, 131, 126, .09);
  --bg-active: rgba(74, 131, 126, .16);
  --bg-user: rgba(182, 204, 215, .35);
  --bg-card: var(--white);
  --border: rgba(46, 58, 63, .18);
  --line: rgba(46, 58, 63, .28);
  --text: var(--ink);
  --text-dim: #5c6b70;
  --accent: var(--green);
  --accent-dark: var(--dark);
  --on-accent: var(--white);
  --danger: #b3402e;
  /* filled CTAs (buttons, send) + focus borders — kept separate from the
     text accent so dark mode can mute them without dulling labels */
  --cta: var(--green);
  --cta-hover: var(--dark);
  --on-cta: var(--white);
  --trace-bg: var(--dark);
  --trace-text: #d9e7e5;
  --trace-border: #355159;
  --overlay: rgba(20, 33, 38, .4);
  --radius: 12px;
  --shadow: 0 2px 14px rgba(20, 33, 38, .07);
  --shadow-pop: 0 8px 30px rgba(20, 33, 38, .16);
  --mono: "IBM Plex Mono", ui-monospace, SFMono-Regular, Menlo, monospace;
}

/* Dark mode uses the site's dark-page palette (bg/panel/panel2/ink/muted/
   line, mint green #56d6ad, powder blue #91bfff, red #ff8b7b). */
@media (prefers-color-scheme: dark) {
  :root {
    --bg: #090d0d;
    --bg-side: #101616;
    --bg-hover: rgba(86, 214, 173, .07);
    --bg-active: rgba(86, 214, 173, .14);
    --bg-user: rgba(145, 191, 255, .10);
    --bg-card: #131b1a;
    --border: #1f2a27;
    --line: #26322f;
    /* ivory body copy — warmer and softer than the site off-white */
    --text: #e8e3d3;
    --text-dim: #9aa8a2;
    --accent: #56d6ad;
    --accent-dark: #7ce0bf;
    --on-accent: #090d0d;
    --danger: #ff8b7b;
    /* muted CTAs in dark — the full mint reads harsh on big surfaces */
    --cta: #4a837e;
    --cta-hover: #57938d;
    --on-cta: #e8e3d3;
    --trace-bg: #0b1110;
    --trace-text: #d6e3dc;
    --trace-border: #26322f;
    --overlay: rgba(9, 13, 13, .6);
    --blue: #91bfff;
    --shadow: 0 2px 14px rgba(0, 0, 0, .5);
    --shadow-pop: 0 8px 30px rgba(0, 0, 0, .65);
  }
}

* { box-sizing: border-box; }

html, body {
  margin: 0;
  height: 100%;
  font-family: "DM Sans", -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
  font-size: 15px;
  color: var(--text);
  background: var(--bg);
}

.hidden { display: none !important; }

button { font: inherit; color: inherit; cursor: pointer; background: none; border: none; padding: 0; }
textarea, input { font: inherit; color: inherit; }

/* ---------- auth ---------- */

/* Split screen: logo + intro copy on the left, sign-in card on the right. */
.auth-screen {
  height: 100%;
  display: flex;
}

.auth-intro {
  flex: 1.15;
  min-width: 0;
  display: flex;
  flex-direction: column;
  padding: 26px 36px 36px;
  background: var(--bg-side);
  border-right: 1px solid var(--line);
}

.auth-logo { max-width: 230px; }
.auth-logo img { width: 100%; height: auto; display: block; }

/* placeholder intro panel — swap the copy in index.html when ready */
.auth-copy {
  margin: auto 0;
  max-width: 470px;
  padding: 28px 30px;
  border: 1px dashed var(--border);
  border-radius: var(--radius);
  background: var(--bg-card);
}
.auth-copy h1 {
  margin: 14px 0 10px;
  font-size: clamp(24px, 2.6vw, 32px);
  font-weight: 600;
  letter-spacing: -.03em;
  line-height: 1.15;
}
.auth-copy p { margin: 0; font-size: 14.5px; line-height: 1.6; color: var(--text-dim); }

.auth-pane {
  flex: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 16px;
  background: var(--bg);
}

.auth-card {
  width: 100%;
  max-width: 390px;
  background: var(--bg-card);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 32px 32px 26px;
}

.auth-sub {
  margin: 0 0 8px;
  color: var(--accent);
  font-family: var(--mono);
  font-size: 11px;
  font-weight: 500;
  text-transform: uppercase;
  letter-spacing: .07em;
}

.auth-title {
  margin: 0 0 20px;
  font-size: 23px;
  font-weight: 600;
  letter-spacing: -.02em;
}

.auth-card form { display: flex; flex-direction: column; gap: 10px; }

.auth-card input {
  padding: 12px 14px;
  border: 1px solid var(--border);
  border-radius: 8px;
  background: var(--bg);
  outline: none;
}
.auth-card input:focus { border-color: var(--cta); }

.btn-primary {
  padding: 13px;
  border-radius: 8px;
  border: 1px solid var(--cta);
  background: var(--cta);
  color: var(--on-cta);
  font-weight: 600;
  font-size: 14px;
  transition: background .18s ease, border-color .18s ease;
}
.btn-primary:hover { background: var(--cta-hover); border-color: var(--cta-hover); }
.btn-primary:disabled { opacity: .6; cursor: default; }

.auth-error { color: var(--danger); font-size: 13px; margin: 12px 0 0; }
.auth-notice { color: var(--accent); font-size: 13px; margin: 12px 0 0; }
.auth-toggle { margin: 20px 0 0; font-size: 13px; color: var(--text-dim); }
.auth-toggle a { color: var(--accent); text-decoration: none; font-weight: 600; }

/* ---------- shell ---------- */

.app-shell { display: flex; height: 100%; }

.sidebar {
  width: 276px;
  flex-shrink: 0;
  background: var(--bg-side);
  border-right: 1px solid var(--line);
  display: flex;
  flex-direction: column;
  padding: 14px 12px 10px;
  transition: margin-left .2s ease;
}
.app-shell.sidebar-closed .sidebar { margin-left: -276px; }

.sidebar-brand {
  display: flex;
  align-items: center;
  padding: 6px 6px 16px;
}
.sidebar-brand img { width: 100%; height: auto; display: block; }

/* light/dark asset swaps (wordmark images) — !important so element-level
   display rules (e.g. .sidebar-brand img) can't override the hiding */
.dark-only { display: none !important; }
@media (prefers-color-scheme: dark) {
  .light-only { display: none !important; }
  .dark-only { display: block !important; }
}

/* text-only CTA — just the wording, with the site's hover lift */
.new-chat {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 10px 8px;
  color: var(--accent);
  font-weight: 600;
  font-size: 14px;
  transition: color .18s ease, transform .18s ease;
}
.new-chat:hover { color: var(--cta-hover); transform: translateY(-1px); }
.new-chat .icon { font-size: 16px; line-height: 1; }

.search-button {
  display: flex;
  align-items: center;
  gap: 9px;
  margin-top: 8px;
  padding: 10px 12px;
  border-radius: 9px;
  border: 1px solid var(--border);
  background: var(--bg);
  color: var(--text-dim);
  font-size: 13.5px;
}
.search-button:hover { border-color: var(--line); color: var(--text); }
.search-button svg { width: 15px; height: 15px; fill: none; stroke: currentColor; stroke-width: 2; stroke-linecap: round; }
.search-button kbd {
  margin-left: auto;
  font-family: var(--mono);
  font-size: 10.5px;
  border: 1px solid var(--border);
  border-radius: 4px;
  padding: 2px 5px;
  color: var(--text-dim);
}

.sidebar-nav { flex: 1; overflow-y: auto; margin-top: 18px; }

.nav-section + .nav-section { margin-top: 22px; }

.section-heading {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 8px 6px;
  font-family: var(--mono);
  font-size: 10.5px;
  font-weight: 500;
  text-transform: uppercase;
  letter-spacing: .08em;
  color: var(--text-dim);
}
.section-action {
  width: 20px; height: 20px;
  border-radius: 5px;
  display: flex; align-items: center; justify-content: center;
  font-size: 14px;
  color: var(--text-dim);
}
.section-action:hover { background: var(--bg-hover); color: var(--text); }

.nav-item {
  width: 100%;
  display: flex;
  align-items: center;
  gap: 9px;
  padding: 8px 10px;
  border-radius: 8px;
  font-size: 14px;
  color: var(--text);
  cursor: pointer;
  text-align: left;
  user-select: none;
}
.nav-item:hover { background: var(--bg-hover); }
.nav-item.active, .nav-item.selected { background: var(--bg-active); }

.nav-item > span:first-of-type + span,
.nav-item .label {
  flex: 1;
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}

.project-dot {
  width: 8px; height: 8px;
  flex-shrink: 0;
  border-radius: 50%;
  background: var(--green);
}
.project-dot.muted { background: var(--teal); }
.project-dot.soft { background: var(--blue); }
@media (prefers-color-scheme: dark) {
  .project-dot { background: var(--accent); }
  .project-dot.muted { background: var(--teal); }
  .project-dot.soft { background: var(--blue); }
}

.count {
  font-family: var(--mono);
  font-size: 10.5px;
  color: var(--text-dim);
  flex-shrink: 0;
}

.thread-menu {
  opacity: 0;
  flex-shrink: 0;
  color: var(--text-dim);
  font-size: 12px;
  letter-spacing: .1em;
  padding: 1px 4px;
  border-radius: 5px;
}
.nav-item:hover .thread-menu { opacity: 1; }
.thread-menu:hover { background: var(--bg-active); color: var(--text); }

.sidebar-footer { border-top: 1px solid var(--line); padding-top: 10px; margin-top: 10px; }

.org-card {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 6px 8px;
  border-radius: 9px;
}
.org-card:hover { background: var(--bg-hover); }

.avatar {
  width: 30px; height: 30px;
  flex-shrink: 0;
  border-radius: 7px;
  background: var(--teal);
  color: #fff;
  display: flex; align-items: center; justify-content: center;
  font-size: 12px; font-weight: 600;
  text-transform: uppercase;
}

.org-meta { flex: 1; min-width: 0; display: flex; flex-direction: column; }
.org-meta strong { font-size: 13px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.org-meta span { font-size: 11.5px; color: var(--text-dim); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }

.more-button {
  flex-shrink: 0;
  color: var(--text-dim);
  font-size: 12px;
  letter-spacing: .1em;
  padding: 5px 6px;
  border-radius: 6px;
}
.more-button:hover { background: var(--bg-hover); color: var(--text); }
.more-button.large { font-size: 14px; padding: 7px 9px; }

/* ---------- workspace ---------- */

.workspace { flex: 1; display: flex; flex-direction: column; min-width: 0; }

.topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  padding: 11px 18px;
  border-bottom: 1px solid var(--line);
  background: var(--bg);
}

.topbar-left { display: flex; align-items: center; gap: 11px; min-width: 0; }

.mobile-menu {
  display: none;
  padding: 6px;
  border-radius: 7px;
  color: var(--text-dim);
}
.mobile-menu svg { width: 18px; height: 18px; fill: none; stroke: currentColor; stroke-width: 2; stroke-linecap: round; display: block; }
.mobile-menu:hover { background: var(--bg-hover); color: var(--text); }

.topbar-logo {
  width: 26px; height: 26px;
  flex-shrink: 0;
  border-radius: 6px;
  background: var(--green);
  color: var(--white);
  display: flex; align-items: center; justify-content: center;
  font-size: 14px; font-weight: 700;
}
@media (prefers-color-scheme: dark) {
  .topbar-logo { background: var(--cta); color: var(--on-cta); }
}

.conversation-title {
  display: flex;
  align-items: center;
  gap: 8px;
  min-width: 0;
  font-size: 14.5px;
}
.project-name { color: var(--accent); font-weight: 600; white-space: nowrap; }
.conversation-title .divider { color: var(--text-dim); }
.chat-name { font-weight: 600; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }

.content-scroll { flex: 1; overflow-y: auto; }

.chat-column {
  max-width: 780px;
  margin: 0 auto;
  padding: 28px 24px 8px;
  display: flex;
  flex-direction: column;
  gap: 22px;
}

/* ---------- welcome ---------- */

.welcome { margin-top: 7vh; }

.eyebrow {
  font-family: var(--mono);
  font-size: 11px;
  font-weight: 500;
  letter-spacing: .09em;
  color: var(--accent);
}

.welcome h1 {
  margin: 16px 0 12px;
  font-size: clamp(30px, 3.4vw, 40px);
  font-weight: 600;
  letter-spacing: -.04em;
  line-height: 1.05;
}

.welcome .lead {
  margin: 0 0 34px;
  font-size: 16px;
  line-height: 1.55;
  color: var(--text-dim);
  max-width: 520px;
}

.starter-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
}

.starter-card {
  display: flex;
  align-items: flex-start;
  gap: 14px;
  padding: 18px;
  border: 1px solid var(--border);
  border-radius: 10px;
  background: var(--bg-card);
  text-align: left;
  transition: background .15s ease, border-color .15s ease, transform .18s ease;
}
.starter-card:hover {
  background: var(--bg-hover);
  border-color: var(--teal);
  transform: translateY(-1px);
}

.card-icon {
  width: 34px; height: 34px;
  flex-shrink: 0;
  border-radius: 8px;
  background: rgba(74, 131, 126, .12);
  color: var(--teal);
  display: flex; align-items: center; justify-content: center;
  font-size: 16px;
}
@media (prefers-color-scheme: dark) {
  .card-icon { background: rgba(86, 214, 173, .1); color: var(--accent); }
}

.starter-card h2 { margin: 1px 0 5px; font-size: 15px; font-weight: 600; letter-spacing: -.01em; }
.starter-card p { margin: 0; font-size: 13px; line-height: 1.5; color: var(--text-dim); }

.starter-card .arrow {
  margin-left: auto;
  color: var(--text-dim);
  transition: color .15s ease, transform .18s ease;
}
.starter-card:hover .arrow { color: var(--accent); transform: translate(1px, -1px); }

/* ---------- messages (document-like) ---------- */

.message { display: flex; flex-direction: column; }

.message.user-message { align-items: flex-end; }
.message.user-message .bubble {
  background: var(--bg-user);
  border-radius: 10px 10px 3px 10px;
  padding: 10px 16px;
  max-width: 78%;
  white-space: pre-wrap;
  word-wrap: break-word;
  line-height: 1.55;
  font-size: 14.5px;
}

.message.assistant-message { align-items: stretch; }

.response-label {
  font-family: var(--mono);
  font-size: 10px;
  font-weight: 500;
  letter-spacing: .09em;
  text-transform: uppercase;
  color: var(--accent);
  margin-bottom: 9px;
}

.assistant-copy {
  line-height: 1.68;
  word-wrap: break-word;
  font-size: 15px;
}
.assistant-copy > :first-child { margin-top: 0; }
.assistant-copy > :last-child { margin-bottom: 0; }

.assistant-copy pre {
  background: var(--trace-bg);
  color: var(--trace-text);
  border: 1px solid var(--trace-border);
  border-radius: 8px;
  padding: 14px 16px;
  overflow-x: auto;
  font-family: var(--mono);
  font-size: 12.5px;
  line-height: 1.7;
}
.assistant-copy code { font-family: var(--mono); font-size: .9em; }
.assistant-copy :not(pre) > code {
  background: var(--bg-user);
  border-radius: 4px;
  padding: 1px 5px;
}
.assistant-copy a { color: var(--teal); text-decoration-color: rgba(74, 131, 126, .4); }
@media (prefers-color-scheme: dark) {
  .assistant-copy a { color: var(--blue); text-decoration-color: rgba(145, 191, 255, .4); }
}
.assistant-copy table { border-collapse: collapse; display: block; overflow-x: auto; }
.assistant-copy th, .assistant-copy td {
  border-bottom: 1px solid var(--border);
  padding: 9px 12px;
  font-size: 14px;
  text-align: left;
}
.assistant-copy th {
  font-family: var(--mono);
  font-size: 10.5px;
  font-weight: 500;
  text-transform: uppercase;
  letter-spacing: .06em;
  color: var(--text-dim);
}
.assistant-copy blockquote {
  margin: 0;
  padding-left: 13px;
  border-left: 3px solid var(--teal);
  color: var(--text-dim);
}

/* referral nudge — a soft aside card, distinct from a normal answer */
.message.nudge .assistant-copy {
  border: 1px solid var(--border);
  border-left: 3px solid var(--accent);
  border-radius: 10px;
  background: var(--bg-hover);
  padding: 13px 16px;
  font-size: 14.5px;
}

.message.error-message .bubble {
  color: var(--danger);
  background: color-mix(in srgb, var(--danger) 8%, transparent);
  border: 1px solid color-mix(in srgb, var(--danger) 30%, transparent);
  border-radius: 8px;
  padding: 10px 14px;
  font-size: 14px;
}

/* sources */

/* inline citation markers — the full URL lives in "Sources used" below */
sup.cite { line-height: 0; }
sup.cite a {
  font-family: var(--mono);
  font-size: 10px;
  font-weight: 500;
  color: var(--accent);
  background: var(--bg-active);
  border-radius: 4px;
  padding: 1px 4px;
  margin-left: 2px;
  text-decoration: none;
}
sup.cite a:hover { background: var(--bg-hover); }

/* footer row under an answer: sources toggle + share button */
.msg-footer {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-top: 16px;
}

.sources-toggle {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 7px 12px;
  border: 1px solid var(--border);
  border-radius: 8px;
  font-family: var(--mono);
  font-size: 10.5px;
  font-weight: 500;
  text-transform: uppercase;
  letter-spacing: .07em;
  color: var(--text-dim);
  align-self: flex-start;
}
.sources-toggle:hover { border-color: var(--teal); color: var(--text); }
.source-count {
  background: var(--bg-active);
  border-radius: 4px;
  padding: 1px 6px;
  color: var(--accent);
}
.sources-toggle .chevron { transition: transform .15s ease; }
.sources-toggle.open .chevron { transform: rotate(180deg); }

.sources-panel {
  margin-top: 10px;
  border: 1px solid var(--border);
  border-radius: 10px;
  overflow: hidden;
}
.sources-panel a {
  display: flex;
  align-items: center;
  gap: 13px;
  padding: 11px 14px;
  color: var(--text);
  text-decoration: none;
  font-size: 13.5px;
}
.sources-panel a + a { border-top: 1px solid var(--border); }
.sources-panel a:hover { background: var(--bg-hover); }
.source-number {
  font-family: var(--mono);
  font-size: 10.5px;
  color: var(--accent);
  flex-shrink: 0;
}
.sources-panel a > span:nth-child(2) { flex: 1; min-width: 0; display: flex; flex-direction: column; }
.sources-panel strong { font-size: 13px; }
.sources-panel small {
  color: var(--text-dim);
  font-size: 12px;
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.sources-panel .ext { color: var(--text-dim); flex-shrink: 0; }

.share-button {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  padding: 7px 12px;
  border: 1px solid var(--border);
  border-radius: 8px;
  font-family: var(--mono);
  font-size: 10.5px;
  font-weight: 500;
  text-transform: uppercase;
  letter-spacing: .07em;
  color: var(--text-dim);
}
.share-button:hover { border-color: var(--teal); color: var(--text); }
.share-button svg {
  width: 13px; height: 13px;
  fill: none; stroke: currentColor;
  stroke-width: 2; stroke-linecap: round; stroke-linejoin: round;
}

/* waiting indicator */

.status {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  padding: 4px 0;
  color: var(--text-dim);
  font-family: var(--mono);
  font-size: 12.5px;
}
.status-leaf {
  display: inline-block;
  font-size: 18px;
  transform-origin: 50% 90%;
  animation: leaf-sway 1.8s ease-in-out infinite;
}
@keyframes leaf-sway {
  0%, 100% { transform: rotate(-10deg) scale(1); }
  50%      { transform: rotate(12deg) scale(1.12); }
}
.status-text.fade-in { animation: status-fade .35s ease; }
@keyframes status-fade { from { opacity: 0; transform: translateY(2px); } }

/* streaming caret */
.message.assistant-message.streaming .assistant-copy::after {
  content: "";
  display: inline-block;
  width: 8px; height: 15px;
  margin-left: 3px;
  vertical-align: -2px;
  background: var(--accent);
  animation: caret 1s steps(2) infinite;
}
@keyframes caret { 50% { opacity: 0; } }

/* keeps the page tall enough that a fresh turn can pin the user's message
   to the top of the viewport while the response streams in below */
.scroll-spacer { flex-shrink: 0; height: 0; }

/* ---------- composer ---------- */

.composer-area { padding: 10px 24px 12px; }

.composer {
  max-width: 780px;
  margin: 0 auto;
  border: 1px solid var(--line);
  border-radius: 14px;
  background: var(--bg-card);
  box-shadow: var(--shadow);
  padding: 12px 12px 10px 16px;
}
.composer:focus-within { border-color: var(--cta); }

.composer textarea {
  width: 100%;
  border: none;
  outline: none;
  resize: none;
  background: transparent;
  max-height: 220px;
  line-height: 1.5;
  padding: 2px 0 6px;
}

.composer-footer {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
}

.mode-wrap { position: relative; }

.mode-button {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 7px 11px;
  border: 1px solid var(--border);
  border-radius: 8px;
  font-size: 12.5px;
  font-weight: 500;
  color: var(--text-dim);
}
.mode-button:hover { border-color: var(--teal); color: var(--text); }
.mode-dot {
  width: 7px; height: 7px;
  border-radius: 50%;
  background: var(--accent);
}
.mode-button .chevron { font-size: 11px; line-height: 1; }

.mode-menu {
  position: absolute;
  bottom: calc(100% + 8px);
  left: 0;
  min-width: 300px;
  background: var(--bg-card);
  border: 1px solid var(--line);
  border-radius: 10px;
  box-shadow: var(--shadow-pop);
  padding: 5px;
  z-index: 40;
}
.mode-menu button {
  width: 100%;
  display: flex;
  flex-direction: column;
  gap: 2px;
  text-align: left;
  padding: 9px 11px;
  border-radius: 7px;
}
.mode-menu button:hover { background: var(--bg-hover); }
.mode-menu button.current { background: var(--bg-active); }
.mode-menu strong { font-size: 13.5px; font-weight: 600; }
.mode-menu span { font-size: 12px; color: var(--text-dim); }

.send-button {
  width: 36px; height: 36px;
  flex-shrink: 0;
  border-radius: 9px;
  background: var(--cta);
  color: var(--on-cta);
  display: flex; align-items: center; justify-content: center;
  transition: background .18s ease, opacity .15s;
}
.send-button svg { width: 16px; height: 16px; fill: none; stroke: currentColor; stroke-width: 2.5; stroke-linecap: round; stroke-linejoin: round; }
.send-button:hover:not(:disabled) { background: var(--cta-hover); }
.send-button:disabled { opacity: .3; cursor: default; }
.send-button.stop { background: var(--danger); color: #fff; }
.send-button.stop svg { fill: currentColor; stroke: none; }

.composer-note {
  max-width: 780px;
  margin: 9px auto 0;
  text-align: center;
  font-size: 11.5px;
  color: var(--text-dim);
}

/* ---------- popup menu (shared) ---------- */

.popup-menu {
  position: fixed;
  z-index: 50;
  min-width: 180px;
  max-width: 250px;
  background: var(--bg-card);
  border: 1px solid var(--line);
  border-radius: 10px;
  box-shadow: var(--shadow-pop);
  padding: 4px;
  display: flex;
  flex-direction: column;
}
.popup-item {
  text-align: left;
  padding: 8px 11px;
  border-radius: 6px;
  font-size: 13.5px;
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.popup-item:hover { background: var(--bg-hover); }
.popup-danger { color: var(--danger); }

/* ---------- search overlay ---------- */

.search-overlay {
  position: fixed;
  inset: 0;
  z-index: 60;
  background: var(--overlay);
  display: flex;
  align-items: flex-start;
  justify-content: center;
  padding: 14vh 16px 0;
}

.search-modal {
  width: 100%;
  max-width: 540px;
  background: var(--bg-card);
  border: 1px solid var(--line);
  border-radius: 12px;
  box-shadow: var(--shadow-pop);
  overflow: hidden;
}
.search-modal input {
  width: 100%;
  border: none;
  outline: none;
  background: transparent;
  padding: 16px 18px;
  font-size: 15px;
  border-bottom: 1px solid var(--border);
}
.search-results { max-height: 320px; overflow-y: auto; padding: 6px; }
.search-result {
  width: 100%;
  display: flex;
  align-items: center;
  gap: 10px;
  text-align: left;
  padding: 10px 12px;
  border-radius: 8px;
  font-size: 14px;
}
.search-result:hover { background: var(--bg-hover); }
.search-result .in-project {
  margin-left: auto;
  font-family: var(--mono);
  font-size: 10px;
  text-transform: uppercase;
  letter-spacing: .06em;
  color: var(--accent);
  flex-shrink: 0;
}
.search-empty { padding: 18px; text-align: center; color: var(--text-dim); font-size: 13.5px; }

/* ---------- profile overlay ---------- */

.profile-overlay {
  position: fixed;
  inset: 0;
  z-index: 60;
  background: var(--overlay);
  display: flex;
  align-items: flex-start;
  justify-content: center;
  padding: 9vh 16px 24px;
  overflow-y: auto;
}

.profile-modal {
  width: 100%;
  max-width: 440px;
  background: var(--bg-card);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  box-shadow: var(--shadow-pop);
  padding: 26px 26px 20px;
}

.profile-sub { margin: 10px 0 18px; color: var(--text-dim); font-size: 13px; }

#profile-form { display: flex; flex-direction: column; gap: 12px; }
#profile-form label {
  display: flex;
  flex-direction: column;
  gap: 5px;
  font-size: 12.5px;
  font-weight: 600;
  color: var(--text-dim);
}
#profile-form input {
  padding: 10px 12px;
  border: 1px solid var(--border);
  border-radius: 8px;
  background: var(--bg);
  outline: none;
  font-weight: 400;
  color: var(--text);
}
#profile-form input:focus { border-color: var(--cta); }

.persona-block { margin-top: 20px; }
.persona-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  margin-top: 12px;
  font-size: 12.5px;
  font-weight: 600;
  color: var(--text-dim);
}
.persona-reset {
  font-size: 11.5px;
  color: var(--text-dim);
  border: 1px solid var(--border);
  border-radius: 6px;
  padding: 3px 9px;
}
.persona-reset:hover { color: var(--danger); border-color: var(--danger); }
.persona-text {
  margin: 6px 0 0;
  padding: 9px 12px;
  border: 1px dashed var(--border);
  border-radius: 8px;
  background: var(--bg);
  color: var(--text-dim);
  font-size: 12.5px;
  line-height: 1.5;
  white-space: pre-wrap;
}

.profile-actions {
  display: flex;
  justify-content: flex-end;
  gap: 8px;
  margin-top: 20px;
}
.btn-ghost-text {
  padding: 9px 14px;
  border-radius: 8px;
  color: var(--text-dim);
  font-weight: 600;
  font-size: 14px;
}
.btn-ghost-text:hover { background: var(--bg-hover); color: var(--text); }
.btn-modal { padding: 9px 18px; }

/* ---------- responsive ---------- */

@media (max-width: 860px) {
  .starter-grid { grid-template-columns: 1fr; }

  /* auth split screen stacks: logo strip on top, card below */
  .auth-screen { flex-direction: column; overflow-y: auto; }
  .auth-intro {
    flex: none;
    padding: 18px 20px;
    border-right: none;
    border-bottom: 1px solid var(--line);
  }
  .auth-logo { max-width: 190px; }
  .auth-copy { display: none; }
  .auth-pane { flex: 1; align-items: flex-start; padding-top: 40px; }
}

@media (max-width: 720px) {
  .sidebar {
    position: fixed;
    z-index: 30;
    height: 100%;
    box-shadow: var(--shadow-pop);
  }
  .app-shell.sidebar-closed .sidebar { margin-left: -290px; }
  .mobile-menu { display: block; }
  .message.user-message .bubble { max-width: 90%; }
}
