/* ═══════════════════════════════════════════════════════════════════════════
   MITRA UI — Design System
   Profundis.ai identity · warm cream + teal · editorial · light + dark
   ═══════════════════════════════════════════════════════════════════════════ */

@import url('https://fonts.googleapis.com/css2?family=Poppins:wght@300;400;500;600;700&family=Playfair+Display:ital,wght@0,400;0,500;0,600;0,700;1,400;1,600&display=swap');

/* ══════════════════════════════════════════════════════════════════════════════
   DESIGN TOKENS — light (default)
══════════════════════════════════════════════════════════════════════════════ */
:root {
  --bg-app:       #FCFAF8;
  --bg-sidebar:   #F5F1EA;
  --bg-surface:   #FFFFFF;
  --bg-hover:     #F0EBE1;
  --bg-active:    #E9E2D5;
  --bg-input:     #FFFFFF;
  --bg-user-msg:  #E9F6F3;
  --bg-elevated:  #FFFFFF;

  --text-primary:   #242422;
  --text-secondary: #55524C;
  --text-muted:     #837D73;
  --text-inverse:   #FFFFFF;

  --border:        #E7E0D3;
  --border-subtle: #F0EBE0;
  --border-input:  #D9D1C2;
  --border-focus:  #14B8A6;

  --accent:        #14B8A6;
  --accent-hover:  #0E9488;
  --accent-soft:   #5EEAD4;
  --accent-subtle: rgba(20, 184, 165, 0.10);
  --accent-line:   rgba(20, 184, 165, 0.28);
  --accent-text:   #0E9488;

  --btn-primary-bg:   #14B8A6;
  --btn-primary-text: #FFFFFF;

  --danger:        #D9534F;
  --danger-bg:     rgba(217, 83, 79, 0.08);
  --danger-border: rgba(217, 83, 79, 0.28);

  --avatar-bot-bg:    #14B8A6;
  --avatar-bot-text:  #FFFFFF;
  --avatar-user-bg:   #242422;
  --avatar-user-text: #FFFFFF;

  --shadow-sm: 0 1px 3px rgba(60, 50, 30, 0.06);
  --shadow-md: 0 8px 26px rgba(60, 50, 30, 0.10);
  --shadow-lg: 0 20px 56px rgba(60, 50, 30, 0.16);

  /* Layout */
  --sidebar-w: 276px;
  --topbar-h:  60px;
  --msg-max-w: 760px;

  /* Typography */
  --font:         'Poppins', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
  --font-display: 'Playfair Display', Georgia, 'Times New Roman', serif;
  --fs-xs:   11.5px;
  --fs-sm:   13px;
  --fs-base: 14.5px;
  --fs-md:   15.5px;
  --lh:      1.7;

  /* Radius */
  --r-xs:  6px;
  --r-sm:  8px;
  --r-md:  12px;
  --r-lg:  18px;
  --r-xl:  26px;
  --r-full:9999px;

  /* Motion */
  --t:      0.16s ease;
  --t-mid:  0.26s cubic-bezier(0.22, 0.8, 0.28, 1);
  --t-slow: 0.4s cubic-bezier(0.22, 0.8, 0.28, 1);

  --agent-accent: var(--accent);
  --agent-glow:   rgba(20, 184, 165, 0.28);
}

/* ── Dark mode — warm charcoal + teal ─────────────────────────────────────── */
[data-theme="dark"] {
  --bg-app:       #14120F;
  --bg-sidebar:   #100E0C;
  --bg-surface:   #1C1815;
  --bg-hover:     #262019;
  --bg-active:    #2F281F;
  --bg-input:     #1A1613;
  --bg-user-msg:  #14312C;
  --bg-elevated:  #201B17;

  --text-primary:   #F3EEE4;
  --text-secondary: #C3BBAC;
  --text-muted:     #8C8577;
  --text-inverse:   #06201D;

  --border:        #322B22;
  --border-subtle: #241F19;
  --border-input:  #3D3529;
  --border-focus:  #2DD4BF;

  --accent:        #2DD4BF;
  --accent-hover:  #5EEAD4;
  --accent-soft:   #134E48;
  --accent-subtle: rgba(45, 212, 191, 0.14);
  --accent-line:   rgba(45, 212, 191, 0.34);
  --accent-text:   #5EEAD4;

  --btn-primary-bg:   #2DD4BF;
  --btn-primary-text: #06201D;

  --danger:        #F0685E;
  --danger-bg:     rgba(240, 104, 94, 0.12);
  --danger-border: rgba(240, 104, 94, 0.32);

  --avatar-bot-bg:    #2DD4BF;
  --avatar-bot-text:  #06201D;
  --avatar-user-bg:   #33291E;
  --avatar-user-text: #F3EEE4;

  --shadow-sm: 0 1px 3px rgba(0, 0, 0, 0.4);
  --shadow-md: 0 10px 30px rgba(0, 0, 0, 0.5);
  --shadow-lg: 0 24px 64px rgba(0, 0, 0, 0.6);

  --agent-glow: rgba(45, 212, 191, 0.3);
}

/* ══════════════════════════════════════════════════════════════════════════════
   RESET & BASE
══════════════════════════════════════════════════════════════════════════════ */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

html, body { height: 100%; }
html { background: var(--bg-app); }

body {
  min-width: 320px;
  font-family: var(--font);
  font-size: var(--fs-base);
  line-height: var(--lh);
  color: var(--text-primary);
  background: var(--bg-app);
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
  overflow: hidden;
}

body[data-fontsize="small"]  { --fs-base: 13.5px; --fs-md: 14.5px; }
body[data-fontsize="large"]  { --fs-base: 16px;   --fs-md: 17px; }

button { font-family: inherit; cursor: pointer; border: none; background: none; color: inherit; }
input, textarea, select { font-family: inherit; }
a { color: var(--accent-text); text-decoration: none; }
a:hover { text-decoration: underline; }

::selection { background: var(--accent-subtle); color: var(--text-primary); }

:focus-visible {
  outline: 2px solid var(--border-focus);
  outline-offset: 2px;
  border-radius: var(--r-xs);
}

.hidden { display: none !important; }
[hidden] { display: none !important; }

/* Scrollbars */
* { scrollbar-width: thin; scrollbar-color: var(--border-input) transparent; }
::-webkit-scrollbar { width: 9px; height: 9px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: var(--border-input); border-radius: var(--r-full); border: 2px solid transparent; background-clip: padding-box; }
::-webkit-scrollbar-thumb:hover { background: var(--text-muted); background-clip: padding-box; }

/* ══════════════════════════════════════════════════════════════════════════════
   APP SHELL
══════════════════════════════════════════════════════════════════════════════ */
.app-shell {
  display: grid;
  grid-template-columns: var(--sidebar-w) minmax(0, 1fr);
  height: 100dvh;
  transition: grid-template-columns var(--t-slow);
}
.app-shell:has(.sidebar.collapsed) { grid-template-columns: 0 minmax(0, 1fr); }

@media (min-width: 1181px) {
  body.context-open .app-shell {
    grid-template-columns: var(--sidebar-w) minmax(0, 1fr) minmax(300px, 340px);
  }
}

/* ══════════════════════════════════════════════════════════════════════════════
   SIDEBAR
══════════════════════════════════════════════════════════════════════════════ */
.sidebar {
  display: flex;
  flex-direction: column;
  min-width: 0;
  height: 100dvh;
  background: var(--bg-sidebar);
  border-right: 1px solid var(--border);
  overflow: hidden;
  transition: transform var(--t-slow);
}
.sidebar.collapsed { transform: translateX(-100%); }

.sidebar-header { padding: 18px 16px 12px; }

.mitra-brand { display: flex; align-items: center; gap: 11px; margin-bottom: 16px; padding: 0 4px; }
.brand-icon {
  width: 38px; height: 38px; flex: 0 0 auto;
  display: grid; place-items: center;
  border-radius: var(--r-md);
  background: var(--accent);
  color: var(--avatar-bot-text);
  font-family: var(--font-display);
  font-weight: 700; font-size: 19px;
  box-shadow: 0 6px 18px var(--agent-glow);
}
.brand-text { display: flex; flex-direction: column; line-height: 1.2; }
.brand-name { font-family: var(--font-display); font-size: 19px; font-weight: 700; color: var(--text-primary); }
.brand-sub  { font-size: var(--fs-xs); color: var(--text-muted); letter-spacing: 0.02em; }

.new-chat-btn {
  width: 100%;
  display: flex; align-items: center; justify-content: center; gap: 8px;
  padding: 11px 14px;
  border-radius: var(--r-md);
  background: var(--accent);
  color: var(--btn-primary-text);
  font-size: var(--fs-sm); font-weight: 600;
  box-shadow: 0 6px 18px var(--agent-glow);
  transition: transform var(--t), background var(--t), box-shadow var(--t);
}
.new-chat-btn:hover { background: var(--accent-hover); transform: translateY(-1px); }
.new-chat-btn:active { transform: translateY(0); }
.new-chat-btn svg { width: 17px; height: 17px; }

.sidebar-search { padding: 4px 16px 12px; }
.sidebar-search input {
  width: 100%;
  padding: 9px 13px;
  border-radius: var(--r-md);
  border: 1px solid var(--border-input);
  background: var(--bg-input);
  color: var(--text-primary);
  font-size: var(--fs-sm);
  transition: border-color var(--t), box-shadow var(--t);
}
.sidebar-search input::placeholder { color: var(--text-muted); }
.sidebar-search input:focus { outline: none; border-color: var(--accent); box-shadow: 0 0 0 3px var(--accent-subtle); }

.sidebar-sessions { flex: 1; overflow-y: auto; padding: 0 10px 10px; }

.session-date-label {
  padding: 14px 8px 6px;
  font-size: var(--fs-xs); font-weight: 600;
  text-transform: uppercase; letter-spacing: 0.06em;
  color: var(--text-muted);
}

.session-item {
  position: relative;
  display: flex; align-items: center; gap: 8px;
  padding: 9px 10px;
  margin-bottom: 2px;
  border-radius: var(--r-md);
  cursor: pointer;
  transition: background var(--t);
}
.session-item:hover { background: var(--bg-hover); }
.session-item.active { background: var(--accent-subtle); box-shadow: inset 0 0 0 1px var(--accent-line); }
.session-item-body { flex: 1; min-width: 0; }
.session-name {
  font-size: var(--fs-sm); font-weight: 500; color: var(--text-primary);
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.session-item.active .session-name { color: var(--accent-text); }
.session-meta { font-size: var(--fs-xs); color: var(--text-muted); margin-top: 1px; }

.session-actions { display: flex; gap: 2px; opacity: 0; transition: opacity var(--t); }
.session-item:hover .session-actions,
.session-item.active .session-actions { opacity: 1; }
.session-rename-btn, .session-delete-btn {
  width: 26px; height: 26px; flex: 0 0 auto;
  display: grid; place-items: center;
  border-radius: var(--r-sm);
  color: var(--text-muted);
  font-size: 14px; line-height: 1;
  transition: background var(--t), color var(--t);
}
.session-rename-btn svg { width: 14px; height: 14px; }
.session-rename-btn:hover { background: var(--bg-active); color: var(--text-primary); }
.session-delete-btn:hover { background: var(--danger-bg); color: var(--danger); }

.session-rename-input {
  flex: 1; min-width: 0;
  padding: 5px 8px;
  border-radius: var(--r-sm);
  border: 1px solid var(--accent);
  background: var(--bg-input);
  color: var(--text-primary);
  font-size: var(--fs-sm);
}
.session-rename-input:focus { outline: none; box-shadow: 0 0 0 3px var(--accent-subtle); }

.no-sessions-hint {
  padding: 32px 16px; text-align: center;
  font-size: var(--fs-sm); color: var(--text-muted); line-height: 1.7;
}

.sidebar-footer {
  display: flex; align-items: center; justify-content: space-between;
  padding: 12px 18px;
  border-top: 1px solid var(--border-subtle);
  font-size: var(--fs-xs); color: var(--text-muted);
}
/* ══════════════════════════════════════════════════════════════════════════════
   MAIN AREA + TOP BAR
══════════════════════════════════════════════════════════════════════════════ */
.main-area {
  display: flex; flex-direction: column;
  min-width: 0; height: 100dvh;
  background: var(--bg-app);
}

.top-bar {
  display: flex; align-items: center; gap: 12px;
  height: var(--topbar-h);
  padding: 0 18px;
  border-bottom: 1px solid var(--border-subtle);
  background: color-mix(in srgb, var(--bg-app) 86%, transparent);
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
}
.session-title {
  flex: 1; min-width: 0;
  font-family: var(--font-display);
  font-size: 17px; font-weight: 600; color: var(--text-primary);
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.top-bar-actions { display: flex; align-items: center; gap: 4px; }

.icon-btn {
  width: 38px; height: 38px; flex: 0 0 auto;
  display: grid; place-items: center;
  border-radius: var(--r-md);
  color: var(--text-secondary);
  transition: background var(--t), color var(--t);
}
.icon-btn:hover { background: var(--bg-hover); color: var(--text-primary); }
.icon-btn svg, .icon-btn i { width: 19px; height: 19px; }
.icon-btn i[data-lucide] { display: inline-flex; }

/* ══════════════════════════════════════════════════════════════════════════════
   AGENT SWITCHER
══════════════════════════════════════════════════════════════════════════════ */
.agent-switcher {
  display: grid; grid-template-columns: minmax(0, 340px);
  gap: 8px; padding: 12px 18px;
  border-bottom: 1px solid var(--border-subtle);
}
.agent-tab {
  display: flex; align-items: center; gap: 11px;
  min-width: 0; padding: 10px 12px;
  border: 1px solid var(--border-subtle);
  border-radius: var(--r-lg);
  background: var(--bg-surface);
  color: var(--text-secondary);
  text-align: left;
  transition: border-color var(--t), background var(--t), color var(--t);
}
.agent-tab:hover, .agent-tab.active {
  border-color: var(--accent-line);
  background: var(--accent-subtle);
  color: var(--text-primary);
}
.agent-mark {
  width: 32px; height: 32px; flex: 0 0 auto;
  display: grid; place-items: center;
  border-radius: var(--r-md);
  color: var(--avatar-bot-text);
  background: var(--agent-accent);
  box-shadow: 0 8px 20px var(--agent-glow);
  font-family: var(--font-display); font-weight: 700; font-size: 14px;
}
.agent-tab strong, .agent-tab small {
  display: block; min-width: 0;
  overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}
.agent-tab strong { font-size: var(--fs-sm); font-weight: 600; }
.agent-tab small  { font-size: var(--fs-xs); color: var(--text-muted); }

/* ══════════════════════════════════════════════════════════════════════════════
   MESSAGES
══════════════════════════════════════════════════════════════════════════════ */
.messages-area {
  flex: 1;
  overflow-y: auto;
  scroll-behavior: smooth;
  padding: 24px 20px 8px;
}

.message-row { animation: msg-in 0.32s cubic-bezier(0.22, 0.8, 0.28, 1); }
@keyframes msg-in { from { opacity: 0; transform: translateY(8px); } to { opacity: 1; transform: none; } }

.message-inner {
  display: flex; gap: 14px;
  max-width: var(--msg-max-w);
  margin: 0 auto 22px;
}
.message-row.user .message-inner { flex-direction: row-reverse; }

.avatar {
  width: 34px; height: 34px; flex: 0 0 auto;
  display: grid; place-items: center;
  border-radius: var(--r-md);
  font-family: var(--font-display);
  font-weight: 700; font-size: 15px;
}
.bot-avatar  { background: var(--avatar-bot-bg);  color: var(--avatar-bot-text); box-shadow: 0 6px 16px var(--agent-glow); }
.user-avatar { background: var(--avatar-user-bg); color: var(--avatar-user-text); }

.message-content { min-width: 0; max-width: calc(100% - 48px); }
.message-row.user .message-content { display: flex; flex-direction: column; align-items: flex-end; }

.bubble {
  padding: 12px 16px;
  border-radius: var(--r-lg);
  font-size: var(--fs-md);
  line-height: 1.72;
  color: var(--text-primary);
  word-wrap: break-word;
  overflow-wrap: anywhere;
}
.message-row.bot .bubble {
  background: var(--bg-surface);
  border: 1px solid var(--border-subtle);
  border-top-left-radius: var(--r-xs);
}
.message-row.user .bubble {
  background: var(--bg-user-msg);
  border: 1px solid var(--accent-line);
  border-top-right-radius: var(--r-xs);
}

/* Markdown inside bubbles */
.bubble p { margin: 0 0 10px; } .bubble p:last-child { margin-bottom: 0; }
.bubble h1, .bubble h2, .bubble h3 { font-family: var(--font-display); margin: 14px 0 8px; line-height: 1.3; }
.bubble h1 { font-size: 1.4em; } .bubble h2 { font-size: 1.25em; } .bubble h3 { font-size: 1.12em; }
.bubble ul, .bubble ol { margin: 0 0 10px; padding-left: 22px; }
.bubble li { margin-bottom: 5px; }
.bubble a { color: var(--accent-text); text-decoration: underline; }
.bubble strong { font-weight: 600; }
.bubble em { font-style: italic; }
.bubble blockquote {
  margin: 10px 0; padding: 4px 14px;
  border-left: 3px solid var(--accent-line);
  color: var(--text-secondary); font-style: italic;
}
.bubble code {
  font-family: 'SFMono-Regular', ui-monospace, Menlo, monospace;
  font-size: 0.88em;
  background: var(--bg-active);
  padding: 2px 6px; border-radius: var(--r-xs);
}
.bubble pre {
  margin: 10px 0; padding: 14px 16px;
  background: var(--bg-active);
  border: 1px solid var(--border-subtle);
  border-radius: var(--r-md);
  overflow-x: auto;
}
.bubble pre code { background: none; padding: 0; }
.bubble hr { border: none; border-top: 1px solid var(--border-subtle); margin: 14px 0; }

.message-time { font-size: var(--fs-xs); color: var(--text-muted); margin: 5px 4px 0; }

.message-actions { display: flex; gap: 2px; margin-top: 4px; opacity: 0; transition: opacity var(--t); }
.message-row:hover .message-actions, .message-row:focus-within .message-actions { opacity: 1; }
.action-btn {
  width: 30px; height: 30px;
  display: grid; place-items: center;
  border-radius: var(--r-sm);
  color: var(--text-muted);
  transition: background var(--t), color var(--t);
}
.action-btn:hover { background: var(--bg-hover); color: var(--text-primary); }
.action-btn svg { width: 15px; height: 15px; }

/* Streaming cursor */
.streaming-cursor {
  display: inline-block; width: 8px; height: 1.05em;
  background: var(--accent); border-radius: 2px;
  vertical-align: text-bottom; margin-left: 2px;
  animation: blink 1s steps(2, start) infinite;
}
@keyframes blink { 50% { opacity: 0; } }

/* Thinking indicator */
.thinking-row { animation: msg-in 0.3s ease; }
.thinking-inner { display: flex; gap: 14px; max-width: var(--msg-max-w); margin: 0 auto 22px; }
.thinking-bubble {
  display: flex; align-items: center; gap: 10px;
  padding: 13px 18px;
  border-radius: var(--r-lg); border-top-left-radius: var(--r-xs);
  background: var(--bg-surface); border: 1px solid var(--border-subtle);
}
.thinking-dots { display: flex; gap: 5px; }
.thinking-dots span {
  width: 7px; height: 7px; border-radius: 50%;
  background: var(--accent);
  animation: think 1.4s ease-in-out infinite;
}
.thinking-dots span:nth-child(2) { animation-delay: 0.2s; }
.thinking-dots span:nth-child(3) { animation-delay: 0.4s; }
@keyframes think { 0%, 60%, 100% { transform: translateY(0); opacity: 0.4; } 30% { transform: translateY(-6px); opacity: 1; } }
.thinking-label { font-size: var(--fs-sm); color: var(--text-secondary); }
.thinking-timer { font-size: var(--fs-xs); color: var(--text-muted); margin-left: auto; font-variant-numeric: tabular-nums; }

/* ══════════════════════════════════════════════════════════════════════════════
   WELCOME STATE + HERO
══════════════════════════════════════════════════════════════════════════════ */
.welcome-state {
  display: flex; flex-direction: column; gap: 18px;
  max-width: 840px; margin: 0 auto; padding: 8px 4px 20px;
}

/* Compact hero — value prop, not a viewport-filling banner */
.welcome-hero {
  position: relative; overflow: hidden;
  border-radius: var(--r-xl);
  padding: 30px 34px;
  background:
    radial-gradient(120% 160% at 100% 0%, var(--accent-subtle), transparent 55%),
    var(--bg-surface);
  border: 1px solid var(--border-subtle);
  box-shadow: var(--shadow-sm);
}
.hero-badge {
  display: inline-block;
  padding: 5px 13px; margin-bottom: 14px;
  border-radius: var(--r-full);
  background: var(--accent-subtle);
  color: var(--accent-text);
  font-size: var(--fs-xs); font-weight: 600;
  letter-spacing: 0.02em;
}
.hero-title {
  font-family: var(--font-display);
  font-size: clamp(26px, 4vw, 38px);
  font-weight: 600; line-height: 1.14;
  color: var(--text-primary); margin-bottom: 10px;
}
.hero-subtitle {
  font-size: var(--fs-md); color: var(--text-secondary);
  line-height: 1.6; max-width: 560px; margin: 0;
}

/* At-a-glance value pillars — always visible */
.welcome-pillars {
  display: grid; gap: 12px;
  grid-template-columns: repeat(3, 1fr);
}
.pillar-card {
  padding: 18px 18px 20px;
  border-radius: var(--r-lg);
  background: var(--bg-surface);
  border: 1px solid var(--border-subtle);
  transition: border-color var(--t), transform var(--t);
}
.pillar-card:hover { border-color: var(--accent-line); transform: translateY(-2px); }
.pillar-ico {
  display: grid; place-items: center;
  width: 38px; height: 38px; margin-bottom: 12px;
  border-radius: var(--r-md);
  background: var(--accent-subtle); color: var(--accent-text);
}
.pillar-ico svg { width: 20px; height: 20px; }
.pillar-card h3 {
  font-family: var(--font-display); font-weight: 600;
  font-size: var(--fs-md); color: var(--text-primary); margin: 0 0 6px;
}
.pillar-card p { font-size: var(--fs-sm); color: var(--text-secondary); line-height: 1.55; margin: 0; }
.pillar-card em { color: var(--accent-text); font-style: italic; }

/* How it works — sequential steps */
.welcome-steps {
  padding: 20px 22px 22px;
  border-radius: var(--r-lg);
  background: var(--bg-sidebar);
  border: 1px solid var(--border-subtle);
}
.welcome-eyebrow {
  font-size: var(--fs-xs); font-weight: 600; letter-spacing: 0.08em;
  text-transform: uppercase; color: var(--text-muted); margin: 0 0 14px;
}
.steps-list {
  list-style: none; margin: 0; padding: 0;
  display: grid; gap: 14px;
  grid-template-columns: repeat(2, 1fr);
}
.steps-list li { display: flex; gap: 12px; align-items: flex-start; }
.step-n {
  flex: 0 0 auto;
  width: 26px; height: 26px;
  display: grid; place-items: center;
  border-radius: var(--r-full);
  background: var(--accent); color: var(--btn-primary-text);
  font-family: var(--font-display); font-weight: 700; font-size: var(--fs-sm);
}
.steps-list p { margin: 0; font-size: var(--fs-sm); color: var(--text-secondary); line-height: 1.55; }
.steps-list strong { color: var(--text-primary); font-weight: 600; }

/* Info accordion (optional depth) */
.info-block {
  border: 1px solid var(--border-subtle);
  border-radius: var(--r-lg);
  background: var(--bg-surface);
  overflow: hidden;
  transition: border-color var(--t);
}
.info-block[open] { border-color: var(--accent-line); }
.info-summary {
  display: flex; align-items: center; gap: 12px;
  padding: 16px 20px;
  font-family: var(--font-display);
  font-size: var(--fs-md); font-weight: 600; color: var(--text-primary);
  cursor: pointer; list-style: none;
}
.info-summary::-webkit-details-marker { display: none; }
.info-icon {
  width: 34px; height: 34px; flex: 0 0 auto;
  display: grid; place-items: center;
  border-radius: var(--r-md);
  background: var(--accent-subtle); color: var(--accent-text);
}
.info-icon svg { width: 17px; height: 17px; }
.info-chevron { width: 18px; height: 18px; margin-left: auto; color: var(--text-muted); transition: transform var(--t-mid); }
.info-block[open] .info-chevron { transform: rotate(180deg); }
.info-body { padding: 0 20px 20px 66px; color: var(--text-secondary); font-size: var(--fs-base); }
.info-body p { margin-bottom: 10px; } .info-body p:last-child { margin-bottom: 0; }
.info-body strong { color: var(--text-primary); font-weight: 600; }

/* ══════════════════════════════════════════════════════════════════════════════
   SUGGESTIONS
══════════════════════════════════════════════════════════════════════════════ */
.suggestions-bar { padding: 0 20px; }
.suggestions-inner {
  display: flex; gap: 9px; flex-wrap: wrap;
  max-width: var(--msg-max-w); margin: 0 auto;
}
.suggestion-chip {
  flex: 0 0 auto;
  padding: 8px 15px;
  border-radius: var(--r-full);
  border: 1px solid var(--border-input);
  background: var(--bg-surface);
  color: var(--text-secondary);
  font-size: var(--fs-sm);
  max-width: 340px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
  transition: all var(--t);
  animation: chip-in 0.3s ease backwards;
}
@keyframes chip-in { from { opacity: 0; transform: translateY(6px); } to { opacity: 1; transform: none; } }
.suggestion-chip:hover {
  border-color: var(--accent); color: var(--accent-text);
  background: var(--accent-subtle); transform: translateY(-1px);
}

/* ══════════════════════════════════════════════════════════════════════════════
   INPUT BAR
══════════════════════════════════════════════════════════════════════════════ */
.input-bar { padding: 12px 20px 16px; }
.char-counter {
  max-width: var(--msg-max-w); margin: 0 auto 6px;
  font-size: var(--fs-xs); text-align: right; color: var(--text-muted);
}
.char-counter.warning { color: #C99A2E; }
.char-counter.danger  { color: var(--danger); }

.input-wrapper {
  display: flex; align-items: flex-end; gap: 8px;
  max-width: var(--msg-max-w); margin: 0 auto;
  padding: 8px 8px 8px 18px;
  border-radius: var(--r-xl);
  border: 1px solid var(--border-input);
  background: var(--bg-input);
  box-shadow: var(--shadow-sm);
  transition: border-color var(--t), box-shadow var(--t);
}
.input-wrapper:focus-within { border-color: var(--accent); box-shadow: 0 0 0 3px var(--accent-subtle); }

.message-input {
  flex: 1;
  max-height: 168px; min-height: 24px;
  padding: 8px 0;
  border: none; background: none; resize: none;
  color: var(--text-primary);
  font-size: var(--fs-md); line-height: 1.5;
}
.message-input:focus { outline: none; }
.message-input::placeholder { color: var(--text-muted); }

.send-btn {
  width: 42px; height: 42px; flex: 0 0 auto;
  display: grid; place-items: center;
  border-radius: var(--r-lg);
  background: var(--accent); color: var(--btn-primary-text);
  transition: background var(--t), transform var(--t), opacity var(--t);
}
.send-btn:hover:not(:disabled) { background: var(--accent-hover); transform: scale(1.05); }
.send-btn:disabled { opacity: 0.45; cursor: not-allowed; }
.send-btn svg { width: 19px; height: 19px; }

/* Stop button (shown during streaming) */
.send-btn.is-stop { background: var(--danger); }
.send-btn.is-stop:hover { background: var(--danger); opacity: 0.9; transform: none; }

.input-hint {
  max-width: var(--msg-max-w); margin: 8px auto 0;
  text-align: center; font-size: var(--fs-xs); color: var(--text-muted);
}
kbd {
  font-family: inherit; font-size: 0.9em;
  padding: 1px 6px; border-radius: var(--r-xs);
  background: var(--bg-active); border: 1px solid var(--border-subtle);
  color: var(--text-secondary);
}

/* ══════════════════════════════════════════════════════════════════════════════
   SETTINGS DRAWER
══════════════════════════════════════════════════════════════════════════════ */
.settings-overlay {
  position: fixed; inset: 0; z-index: 40;
  background: rgba(20, 15, 8, 0.4);
  backdrop-filter: blur(2px);
  animation: fade-in 0.2s ease;
}
@keyframes fade-in { from { opacity: 0; } to { opacity: 1; } }

.settings-drawer {
  position: fixed; top: 0; right: 0; z-index: 50;
  width: min(400px, 90vw); height: 100dvh;
  display: flex; flex-direction: column;
  background: var(--bg-surface);
  border-left: 1px solid var(--border);
  box-shadow: var(--shadow-lg);
  transform: translateX(100%);
  transition: transform var(--t-slow);
}
.settings-drawer.open { transform: translateX(0); }

.settings-header {
  display: flex; align-items: center; justify-content: space-between;
  padding: 20px 22px; border-bottom: 1px solid var(--border-subtle);
}
.settings-header h2 { font-family: var(--font-display); font-size: 21px; font-weight: 600; }
.settings-body { flex: 1; overflow-y: auto; padding: 20px 22px; }

.setting-group { margin-bottom: 26px; }

.account-row { display: flex; align-items: center; gap: 12px; }
.account-avatar {
  width: 42px; height: 42px; flex: 0 0 auto;
  display: grid; place-items: center;
  border-radius: var(--r-md);
  background: var(--avatar-user-bg); color: var(--avatar-user-text);
  font-family: var(--font-display); font-weight: 700; font-size: 17px;
  text-transform: uppercase;
}
.account-info { display: flex; flex-direction: column; min-width: 0; }
.account-info strong { font-size: var(--fs-md); color: var(--text-primary); word-break: break-word; }
.account-info span { font-size: var(--fs-xs); color: var(--text-muted); }
.setting-label {
  display: block; margin-bottom: 10px;
  font-size: var(--fs-xs); font-weight: 600;
  text-transform: uppercase; letter-spacing: 0.06em; color: var(--text-muted);
}
.setting-toggle-row { display: flex; align-items: center; justify-content: space-between; }

.pill-btn {
  padding: 7px 15px; border-radius: var(--r-full);
  border: 1px solid var(--border-input);
  background: var(--bg-surface); color: var(--text-secondary);
  font-size: var(--fs-sm); font-weight: 500;
  transition: all var(--t);
}
.pill-btn:hover { border-color: var(--accent); color: var(--accent-text); }

.btn-group { display: inline-flex; border: 1px solid var(--border-input); border-radius: var(--r-md); overflow: hidden; }
.size-btn {
  padding: 8px 16px; color: var(--text-secondary);
  transition: background var(--t), color var(--t);
  border-right: 1px solid var(--border-input);
}
.size-btn:last-child { border-right: none; }
.size-btn:nth-child(1) { font-size: 12px; } .size-btn:nth-child(2) { font-size: 15px; } .size-btn:nth-child(3) { font-size: 18px; }
.size-btn.active { background: var(--accent); color: var(--btn-primary-text); }

select {
  width: 100%; padding: 10px 13px;
  border-radius: var(--r-md); border: 1px solid var(--border-input);
  background: var(--bg-input); color: var(--text-primary);
  font-size: var(--fs-sm); cursor: pointer;
}
select:focus { outline: none; border-color: var(--accent); box-shadow: 0 0 0 3px var(--accent-subtle); }

.session-id-display {
  padding: 10px 13px; border-radius: var(--r-md);
  background: var(--bg-app); border: 1px solid var(--border-subtle);
  font-family: ui-monospace, monospace; font-size: var(--fs-xs);
  color: var(--text-muted); word-break: break-all;
}

.secondary-btn {
  width: 100%; padding: 11px; border-radius: var(--r-md);
  border: 1px solid var(--border-input);
  background: var(--bg-surface); color: var(--text-primary);
  font-size: var(--fs-sm); font-weight: 500;
  transition: all var(--t);
}
.secondary-btn:hover { border-color: var(--accent); color: var(--accent-text); }

.setting-group--danger { padding-top: 22px; border-top: 1px solid var(--border-subtle); }
.danger-btn {
  width: 100%; padding: 11px; border-radius: var(--r-md);
  border: 1px solid var(--danger-border);
  background: var(--danger-bg); color: var(--danger);
  font-size: var(--fs-sm); font-weight: 500;
  transition: all var(--t);
}
.danger-btn:hover { background: var(--danger); color: #fff; border-color: var(--danger); }

.settings-footer {
  padding: 16px 22px; border-top: 1px solid var(--border-subtle);
  font-size: var(--fs-xs); color: var(--text-muted); text-align: center;
}

/* ══════════════════════════════════════════════════════════════════════════════
   CONTEXT / GROWTH DASH DRAWER
══════════════════════════════════════════════════════════════════════════════ */
.context-drawer {
  display: none; min-width: 0; height: 100dvh;
  flex-direction: column; gap: 16px;
  padding: 22px 20px; overflow-y: auto;
  background: var(--bg-sidebar);
  border-left: 1px solid var(--border);
}
.context-drawer.open { display: flex; }
.context-header { display: flex; align-items: flex-start; justify-content: space-between; }
.context-eyebrow {
  font-size: var(--fs-xs); font-weight: 600; text-transform: uppercase;
  letter-spacing: 0.06em; color: var(--accent-text); margin-bottom: 3px;
}
.context-header h2 { font-family: var(--font-display); font-size: 19px; font-weight: 600; }
.context-copy { font-size: var(--fs-sm); color: var(--text-secondary); line-height: 1.6; }

.growth-card {
  padding: 16px; border-radius: var(--r-lg);
  background: var(--bg-surface); border: 1px solid var(--border-subtle);
}
.growth-chart { width: 100%; height: auto; display: block; }
.growth-ring  { fill: none; stroke: var(--border); stroke-width: 1; }
.growth-axis  { stroke: var(--border-subtle); stroke-width: 1; }
.growth-label { fill: var(--text-muted); font-size: 9px; font-family: var(--font); }
.growth-shape { fill: var(--accent-subtle); stroke: var(--accent); stroke-width: 2; }
.growth-dot   { fill: var(--accent); }

.growth-metrics { display: flex; flex-direction: column; gap: 12px; }
.growth-metric > div { display: flex; justify-content: space-between; font-size: var(--fs-sm); margin-bottom: 5px; }
.growth-metric span { color: var(--text-secondary); }
.growth-metric strong { color: var(--text-primary); font-variant-numeric: tabular-nums; }
.growth-metric i {
  display: block; position: relative;
  height: 6px; width: 100%; border-radius: var(--r-full);
  background: var(--bg-active);
}
.growth-metric i::after {
  content: ''; position: absolute; inset: 0;
  width: var(--metric, 0%);
  background: var(--accent); border-radius: var(--r-full);
  transition: width var(--t-slow);
}

/* ══════════════════════════════════════════════════════════════════════════════
   TOAST
══════════════════════════════════════════════════════════════════════════════ */
.toast {
  position: fixed; bottom: 28px; left: 50%; z-index: 60;
  transform: translateX(-50%);
  padding: 12px 22px; border-radius: var(--r-full);
  background: var(--text-primary); color: var(--bg-app);
  font-size: var(--fs-sm); font-weight: 500;
  box-shadow: var(--shadow-lg);
  animation: toast-in 0.3s cubic-bezier(0.22, 0.8, 0.28, 1);
}
@keyframes toast-in { from { opacity: 0; transform: translate(-50%, 12px); } to { opacity: 1; transform: translate(-50%, 0); } }

/* ══════════════════════════════════════════════════════════════════════════════
   AUTH PAGES (signin.html / signup.html)
══════════════════════════════════════════════════════════════════════════════ */
body.auth-body { overflow: auto; display: grid; place-items: center; min-height: 100dvh; padding: 24px; }
.auth-theme-toggle {
  position: fixed; top: 18px; right: 18px; z-index: 5;
  width: 42px; height: 42px;
  display: grid; place-items: center;
  border-radius: var(--r-full);
  border: 1px solid var(--border);
  background: var(--bg-surface); color: var(--text-secondary);
  box-shadow: var(--shadow-sm);
  transition: color var(--t), border-color var(--t);
}
.auth-theme-toggle:hover { color: var(--accent-text); border-color: var(--accent); }
.auth-theme-toggle svg { width: 19px; height: 19px; }
.auth-page {
  display: grid; grid-template-columns: 1fr; gap: 0;
  width: min(980px, 100%);
  border-radius: var(--r-xl);
  background: var(--bg-surface);
  border: 1px solid var(--border-subtle);
  box-shadow: var(--shadow-lg);
  overflow: hidden;
}
@media (min-width: 860px) { .auth-page { grid-template-columns: 1.05fr 1fr; } }

.auth-aside {
  display: none;
  position: relative;
  padding: 52px 44px;
  color: #fff;
  background:
    radial-gradient(120% 120% at 0% 100%, rgba(20,184,165,0.55), transparent 60%),
    linear-gradient(150deg, #0E3B36 0%, #124b44 55%, #14B8A6 130%);
}
@media (min-width: 860px) { .auth-aside { display: flex; flex-direction: column; } }
.auth-aside .brand-icon { background: rgba(255,255,255,0.16); color: #fff; box-shadow: none; }
.auth-aside-brand { display: flex; align-items: center; gap: 11px; margin-bottom: auto; }
.auth-aside-brand .brand-name { color: #fff; }
.auth-aside-brand .brand-sub { color: rgba(255,255,255,0.7); }
.auth-quote { font-family: var(--font-display); font-size: 28px; line-height: 1.3; margin: 32px 0 14px; }
/* Aside is always dark, so keep this emphasis a fixed bright teal in both themes */
.auth-quote em { color: #5EEAD4; font-style: italic; }
.auth-quote-sub { font-size: var(--fs-sm); color: rgba(255,255,255,0.75); line-height: 1.6; }

.auth-main { padding: 44px 40px; }
@media (max-width: 480px) { .auth-main { padding: 34px 24px; } }
.auth-eyebrow { font-size: var(--fs-xs); font-weight: 600; text-transform: uppercase; letter-spacing: 0.08em; color: var(--accent-text); margin-bottom: 10px; }
.auth-title { font-family: var(--font-display); font-size: 30px; font-weight: 600; margin-bottom: 6px; }
.auth-subtitle { font-size: var(--fs-sm); color: var(--text-secondary); margin-bottom: 28px; }

.auth-form { display: flex; flex-direction: column; gap: 16px; }
.form-group { display: flex; flex-direction: column; gap: 6px; }
.form-group label { font-size: var(--fs-sm); font-weight: 500; color: var(--text-secondary); }
.form-group input {
  padding: 12px 14px; border-radius: var(--r-md);
  border: 1px solid var(--border-input); background: var(--bg-input);
  color: var(--text-primary); font-size: var(--fs-md);
  transition: border-color var(--t), box-shadow var(--t);
}
.form-group input::placeholder { color: var(--text-muted); }
.form-group input:focus { outline: none; border-color: var(--accent); box-shadow: 0 0 0 3px var(--accent-subtle); }
.form-group input.error { border-color: var(--danger); }
.field-error { font-size: var(--fs-xs); color: var(--danger); min-height: 14px; }

.password-wrap { position: relative; display: flex; align-items: center; }
.password-wrap input { flex: 1; padding-right: 44px; }
.password-toggle {
  position: absolute; right: 8px;
  width: 30px; height: 30px; display: grid; place-items: center;
  color: var(--text-muted); border-radius: var(--r-sm);
}
.password-toggle:hover { color: var(--text-primary); background: var(--bg-hover); }
.password-toggle svg { width: 17px; height: 17px; }

.login-error {
  padding: 10px 14px; border-radius: var(--r-md);
  background: var(--danger-bg); border: 1px solid var(--danger-border);
  color: var(--danger); font-size: var(--fs-sm);
}
.login-error.hidden { display: none; }

.login-btn {
  position: relative;
  padding: 13px; margin-top: 4px;
  border-radius: var(--r-md);
  background: var(--accent); color: var(--btn-primary-text);
  font-size: var(--fs-md); font-weight: 600;
  transition: background var(--t), transform var(--t), opacity var(--t);
}
.login-btn:hover:not(:disabled) { background: var(--accent-hover); transform: translateY(-1px); }
.login-btn:disabled { opacity: 0.7; cursor: default; }
.login-btn.is-loading { color: transparent; }
.login-btn.is-loading::after {
  content: ''; position: absolute; inset: 0; margin: auto;
  width: 18px; height: 18px; border-radius: 50%;
  border: 2px solid rgba(255,255,255,0.5); border-top-color: #fff;
  animation: spin 0.7s linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }

.auth-toggle-text { margin-top: 22px; text-align: center; font-size: var(--fs-sm); color: var(--text-secondary); }
.auth-toggle-text a { font-weight: 600; }
/* ══════════════════════════════════════════════════════════════════════════════
   RESPONSIVE
══════════════════════════════════════════════════════════════════════════════ */
.sidebar-backdrop {
  position: fixed; inset: 0; z-index: 25;
  background: rgba(20, 15, 8, 0.4);
}

@media (max-width: 1180px) {
  body.context-open .app-shell { grid-template-columns: var(--sidebar-w) minmax(0, 1fr); }
  .context-drawer {
    position: fixed; top: 0; right: 0; z-index: 45;
    width: min(360px, 90vw); box-shadow: var(--shadow-lg);
  }
}

@media (max-width: 768px) {
  :root { --sidebar-w: 268px; }
  .app-shell,
  .app-shell:has(.sidebar.collapsed) { grid-template-columns: minmax(0, 1fr); }
  .sidebar {
    position: fixed; top: 0; left: 0; width: var(--sidebar-w); z-index: 30;
    transform: translateX(-100%);
    box-shadow: var(--shadow-lg);
  }
  .sidebar.collapsed { transform: translateX(-100%); }
  .sidebar.mobile-open { transform: translateX(0); }
  .welcome-hero { padding: 26px 24px; }
  .welcome-pillars { grid-template-columns: 1fr; }
  .steps-list { grid-template-columns: 1fr; }

  /* Suggestions become a single horizontally-scrollable row */
  .suggestions-bar { padding: 0; }
  .suggestions-inner {
    flex-wrap: nowrap;
    overflow-x: auto;
    padding: 0 16px 4px;
    scroll-padding: 0 16px;
    -webkit-overflow-scrolling: touch;
    scrollbar-width: none;
  }
  .suggestions-inner::-webkit-scrollbar { display: none; }
}

@media (max-width: 560px) {
  .messages-area { padding: 18px 14px 8px; }
  .input-bar { padding: 10px 14px 14px; }
  .message-inner { gap: 10px; margin-bottom: 18px; }
  .avatar { width: 30px; height: 30px; font-size: 13px; }
  .top-bar { padding: 0 12px; }
  .input-hint { display: none; }
  .welcome-hero { padding: 22px 20px; }
  .hero-title { font-size: 26px; }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: 0.01ms !important; transition-duration: 0.01ms !important; scroll-behavior: auto !important; }
}
