:root {
  --bg-canvas: var(--washi, #f5efe3);
  --bg-surface: var(--silk, #fcf9f2);
  --bg-subtle: #ede4d4;
  --bg-hover: #e5d9c4;
  --ink-primary: var(--sumi, #1d1a16);
  --ink-secondary: var(--sumi-soft, #4e473c);
  --ink-muted: var(--ash, #827869);
  --accent-emerald: var(--malachite, #184034);
  --accent-emerald-hover: var(--malachite-deep, #112e25);
  --accent-emerald-soft: var(--malachite-soft, #e7f0eb);
  --accent-emerald-border: var(--malachite-border, #b8cfc4);
  --accent-saffron: var(--kintsugi, #b48a3e);
  --accent-saffron-bg: var(--kintsugi-soft, #f7eedb);
  --accent-saffron-border: var(--kintsugi-border, #dec89b);
  --accent-teal: #1d5952;
  --accent-teal-bg: #e7f2ef;
  --accent-teal-border: #aecfc6;
  --danger: var(--kumkum, #a63a28);
  --danger-bg: var(--kumkum-soft, #faebe7);
  --border: var(--hairline, #e2d7c4);
  --border-subtle: var(--hairline-soft, #ece3d2);
  --radius-sm: 10px;
  --radius-md: 16px;
  --radius-lg: 22px;
  --shadow-xs: 0 2px 8px rgba(29, 26, 22, 0.045);
  --shadow-sm: 0 6px 20px rgba(29, 26, 22, 0.07);
  --shadow-md: 0 14px 36px rgba(29, 26, 22, 0.1);
  --shadow-lg: 0 26px 64px rgba(29, 26, 22, 0.22);
  --font-sans: var(--font-ui, "Plus Jakarta Sans", -apple-system, BlinkMacSystemFont, sans-serif);
  --font-serif: var(--font-display, "Cormorant Garamond", "Iowan Old Style", Georgia, serif);
  --font-indic: var(--font-devanagari, "Noto Serif Devanagari", Georgia, serif);
  --chat-max-w: 770px;
}

* {
  box-sizing: border-box;
}

html, body {
  margin: 0;
  padding: 0;
  height: 100%;
  background: radial-gradient(1200px 640px at 50% -120px, #fbf6ea 0%, var(--bg-canvas) 62%, #eee4d2 100%);
  color: var(--ink-primary);
  font-family: var(--font-sans);
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
}

.sacred-bg-ornament {
  position: fixed;
  top: 50%;
  left: 50%;
  width: 680px;
  height: 680px;
  transform: translate(-50%, -52%);
  color: var(--kintsugi);
  opacity: 0.13;
  pointer-events: none;
  z-index: 0;
}

.app-shell {
  position: relative;
  z-index: 1;
  display: flex;
  flex-direction: column;
  height: 100vh;
  overflow: hidden;
}

/* ------------------------------------------------------------------
   Minimal Single-Row Topbar
------------------------------------------------------------------ */

.hidden {
  display: none !important;
}

.topbar {
  height: 62px;
  flex-shrink: 0;
  display: grid;
  grid-template-columns: 1fr auto 1fr;
  align-items: center;
  gap: 12px;
  padding: 0 24px;
  background: rgba(245, 239, 227, 0.84);
  backdrop-filter: blur(16px);
  border-bottom: 1px solid rgba(180, 138, 62, 0.22);
  z-index: 20;
}

.brand {
  display: flex;
  align-items: center;
  gap: 11px;
}

.brand-emblem {
  width: 34px;
  height: 34px;
  font-size: 1.05rem;
}

.brand-lockup {
  display: flex;
  align-items: baseline;
  gap: 8px;
}

.brand-title {
  margin: 0;
  font-family: var(--font-serif);
  font-size: 1.38rem;
  font-weight: 700;
  letter-spacing: 0.01em;
  color: var(--ink-primary);
  line-height: 1;
}

.brand-script {
  font-family: var(--font-indic);
  font-size: 0.76rem;
  color: var(--kintsugi);
  letter-spacing: 0.04em;
  opacity: 0.88;
}

/* Centered Mode Toggle */
.mode-toggle {
  display: inline-flex;
  background: var(--bg-subtle);
  padding: 3px;
  border-radius: 999px;
  border: 1px solid var(--border);
}

.mode-btn {
  border: none;
  background: transparent;
  padding: 6px 14px;
  border-radius: 999px;
  font-family: inherit;
  font-size: 0.8rem;
  font-weight: 600;
  color: var(--ink-secondary);
  cursor: pointer;
  transition: background 0.16s ease, color 0.16s ease, box-shadow 0.16s ease;
  white-space: nowrap;
}

.mode-btn:hover:not(.active) {
  color: var(--ink-primary);
}

.mode-btn.active {
  background: var(--bg-surface);
  color: var(--accent-emerald);
  box-shadow: var(--shadow-xs);
}

/* Right Header Actions */
.header-actions {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 8px;
}

.btn-ghost,
.btn-drawer-toggle {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  border: 1px solid transparent;
  background: transparent;
  color: var(--ink-secondary);
  padding: 6px 12px;
  border-radius: 999px;
  font-family: inherit;
  font-size: 0.82rem;
  font-weight: 600;
  cursor: pointer;
  transition: background 0.15s ease, color 0.15s ease, border-color 0.15s ease;
}

.btn-ghost:hover,
.btn-drawer-toggle:hover {
  background: var(--bg-subtle);
  color: var(--ink-primary);
}

.btn-drawer-toggle {
  border-color: var(--border);
  background: var(--bg-surface);
}

.btn-icon-header {
  display: inline-grid;
  place-items: center;
  width: 34px;
  height: 34px;
  border-radius: 999px;
  border: 1px solid var(--border);
  background: var(--bg-surface);
  color: var(--ink-secondary);
  font-size: 0.95rem;
  cursor: pointer;
  transition: background 0.14s ease, color 0.14s ease, border-color 0.14s ease;
}

.btn-icon-header:hover {
  background: var(--bg-subtle);
  color: var(--accent-emerald);
}

body:not(.drawer-closed) .btn-drawer-toggle {
  background: var(--accent-emerald-soft);
  border-color: var(--accent-emerald-border);
  color: var(--accent-emerald);
}

.dot {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: #b8b2a5;
  flex-shrink: 0;
}

.dot.live {
  background: #14b86a;
  box-shadow: 0 0 0 3px rgba(20, 184, 106, 0.18);
}

.mini-pill {
  font-size: 0.7rem;
  font-weight: 700;
  padding: 1px 6px;
  border-radius: 999px;
  background: var(--accent-emerald-soft);
  color: var(--accent-emerald);
}

.btn-stop-tts {
  border: 1px solid #f4c6c2;
  background: var(--danger-bg);
  color: var(--danger);
  padding: 5px 11px;
  border-radius: 999px;
  font-family: inherit;
  font-size: 0.78rem;
  font-weight: 700;
  cursor: pointer;
}

/* ------------------------------------------------------------------
   Workspace Layout (Full-Width Centered Chat + Slide-Over Drawer)
------------------------------------------------------------------ */

.workspace {
  position: relative;
  display: flex;
  flex: 1;
  min-height: 0;
  overflow: hidden;
}

.chat-panel {
  flex: 1;
  min-width: 0;
  display: flex;
  flex-direction: column;
  min-height: 0;
}

.messages-list {
  flex: 1;
  overflow-y: auto;
  padding: 28px 20px 18px 20px;
  display: flex;
  flex-direction: column;
  gap: 20px;
}

.messages-list > * {
  width: 100%;
  max-width: var(--chat-max-w);
  margin-left: auto;
  margin-right: auto;
}

/* ------------------------------------------------------------------
   Minimalist Welcome Hero
------------------------------------------------------------------ */

.welcome-hero {
  margin-top: auto;
  margin-bottom: auto;
  padding: 20px 8px 12px 8px;
  text-align: center;
  animation: fadeSlideUp 0.35s ease;
}

.welcome-emblem-ring {
  position: relative;
  width: 74px;
  height: 74px;
  margin: 0 auto 18px auto;
  border-radius: 50%;
  border: 1px solid rgba(180, 138, 62, 0.45);
  display: grid;
  place-items: center;
  background: radial-gradient(circle, rgba(247, 238, 219, 0.9) 0%, rgba(245, 239, 227, 0.2) 70%);
}

.welcome-emblem {
  width: 54px;
  height: 54px;
  border-radius: 50%;
  background: linear-gradient(145deg, var(--malachite), var(--malachite-deep));
  color: #f9efda;
  display: grid;
  place-items: center;
  font-family: var(--font-indic);
  font-size: 1.55rem;
  font-weight: 700;
  box-shadow: 0 10px 26px rgba(24, 64, 52, 0.26), inset 0 0 0 1.5px rgba(216, 181, 108, 0.55);
}

.emblem-hanko-dot {
  position: absolute;
  right: -4px;
  bottom: -2px;
  padding: 2px 5px;
  border-radius: 6px;
  background: linear-gradient(145deg, var(--kumkum), var(--kumkum-deep));
  color: #fdf6e9;
  font-family: var(--font-indic);
  font-size: 0.6rem;
  font-weight: 700;
  letter-spacing: 0.02em;
  box-shadow: 0 3px 8px rgba(166, 58, 40, 0.35), inset 0 0 0 1px rgba(253, 246, 233, 0.4);
}

.welcome-hero h2 {
  margin: 0;
  font-family: var(--font-serif);
  font-size: clamp(1.95rem, 3.3vw, 2.55rem);
  font-weight: 600;
  letter-spacing: -0.01em;
  color: var(--ink-primary);
  line-height: 1.15;
}

.welcome-copy {
  margin: 0 auto 28px auto;
  max-width: 540px;
  font-size: 0.93rem;
  color: var(--ink-secondary);
}

.scenario-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 12px;
  text-align: left;
}

.scenario-chip {
  position: relative;
  appearance: none;
  width: 100%;
  display: grid;
  grid-template-columns: auto 1fr auto;
  align-items: center;
  gap: 14px;
  padding: 15px 16px;
  text-align: left;
  color: var(--ink-primary);
  background: var(--bg-surface);
  border: 1px solid var(--border);
  border-radius: 16px;
  cursor: pointer;
  box-shadow: var(--shadow-xs);
  transition: transform 0.18s ease, border-color 0.18s ease, box-shadow 0.18s ease, background 0.18s ease;
}

.scenario-chip:hover {
  transform: translateY(-2px);
  border-color: var(--kintsugi);
  background: #fffdf8;
  box-shadow: 0 10px 26px rgba(180, 138, 62, 0.13);
}

.scenario-chip:disabled {
  opacity: 0.6;
  cursor: wait;
}

.scenario-chip-research {
  border-color: var(--accent-saffron-border);
  background: linear-gradient(155deg, #fcf8ee 0%, #ffffff 75%);
}

.scenario-icon {
  width: 40px;
  height: 40px;
  display: grid;
  place-items: center;
  border-radius: 12px;
  background: var(--accent-emerald-soft);
  color: var(--malachite);
  border: 1px solid rgba(24, 64, 52, 0.12);
  flex-shrink: 0;
}

.scenario-chip-research .scenario-icon {
  background: var(--kintsugi-soft);
  color: var(--kintsugi);
  border-color: rgba(180, 138, 62, 0.25);
}

.scenario-text strong,
.scenario-text small {
  display: block;
}

.scenario-text strong {
  font-family: var(--font-serif);
  font-size: 1.06rem;
  font-weight: 700;
  color: var(--ink-primary);
  line-height: 1.2;
}

.scenario-text small {
  margin-top: 3px;
  font-size: 0.76rem;
  color: var(--ink-muted);
}

.scenario-arrow {
  color: var(--ink-muted);
  font-weight: 600;
  transition: transform 0.15s ease, color 0.15s ease;
}

.scenario-chip:hover .scenario-arrow {
  transform: translateX(2px);
  color: var(--accent-emerald);
}

/* ------------------------------------------------------------------
   Clean Conversational Message Bubbles
------------------------------------------------------------------ */

@keyframes fadeSlideUp {
  from { opacity: 0; transform: translateY(6px); }
  to { opacity: 1; transform: translateY(0); }
}

.msg-row {
  display: flex;
  flex-direction: column;
  animation: fadeSlideUp 0.24s cubic-bezier(0.22, 1, 0.36, 1);
}

.msg-row-user {
  align-items: flex-end;
}

.msg-row-assistant {
  align-items: flex-start;
}

.msg-card {
  border-radius: var(--radius-md);
  font-size: 0.94rem;
}

.msg-user {
  max-width: 78%;
  padding: 11px 16px;
  background: var(--accent-emerald);
  color: #fff;
  border-bottom-right-radius: 5px;
  box-shadow: var(--shadow-xs);
}

.msg-assistant {
  width: 100%;
  padding: 18px 22px;
  background: var(--bg-surface);
  border: 1px solid var(--border);
  border-left: 3px solid var(--kintsugi);
  box-shadow: var(--shadow-xs);
}

.msg-emergency {
  border: 1.5px solid var(--danger);
  background: var(--danger-bg);
}

.msg-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  margin-bottom: 8px;
}

.msg-header-left {
  display: flex;
  align-items: center;
  gap: 8px;
}

.msg-author {
  font-size: 0.78rem;
  font-weight: 700;
  color: var(--accent-emerald);
  letter-spacing: 0.01em;
}

.msg-emergency .msg-author {
  color: var(--danger);
}

.btn-speak-msg {
  border: none;
  background: transparent;
  color: var(--ink-muted);
  border-radius: 999px;
  padding: 3px 8px;
  font-family: inherit;
  font-size: 0.75rem;
  font-weight: 600;
  cursor: pointer;
  transition: background 0.14s ease, color 0.14s ease;
}

.btn-speak-msg:hover {
  background: var(--bg-subtle);
  color: var(--accent-emerald);
}

.msg-lead {
  font-size: 0.96rem;
  color: var(--ink-primary);
  line-height: 1.65;
  margin: 0;
}

.msg-card-body {
  margin-top: 12px;
  padding-top: 12px;
  border-top: 1px solid var(--border-subtle);
  font-size: 0.91rem;
  color: var(--ink-secondary);
  line-height: 1.62;
}

.msg-card-body h3,
.msg-card-body h4 {
  margin: 12px 0 5px 0;
  font-family: var(--font-serif);
  font-size: 0.98rem;
  color: var(--accent-emerald);
}

.msg-card-body h3:first-child,
.msg-card-body h4:first-child {
  margin-top: 0;
}

.msg-card-body ul {
  margin: 6px 0;
  padding-left: 19px;
}

.msg-card-body li {
  margin-bottom: 4px;
}

.msg-card-body blockquote {
  margin: 10px 0;
  padding: 9px 13px;
  border-left: 3px solid var(--accent-saffron);
  background: var(--accent-saffron-bg);
  border-radius: 0 10px 10px 0;
  font-size: 0.86rem;
}

/* Typing / Thinking Indicator */
.thinking-card {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  padding: 12px 16px;
  background: var(--bg-surface);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-md);
  color: var(--ink-muted);
  font-size: 0.85rem;
  box-shadow: var(--shadow-xs);
}

.thinking-dots {
  display: inline-flex;
  gap: 4px;
}

.thinking-dots span {
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: var(--accent-emerald);
  opacity: 0.35;
  animation: dotPulse 1.2s infinite ease-in-out;
}

.thinking-dots span:nth-child(2) { animation-delay: 0.2s; }
.thinking-dots span:nth-child(3) { animation-delay: 0.4s; }

@keyframes dotPulse {
  0%, 80%, 100% { opacity: 0.25; transform: scale(0.85); }
  40% { opacity: 1; transform: scale(1.1); }
}

/* ------------------------------------------------------------------
   Clickable Option Chips Directly Below Vaidya's Reply
------------------------------------------------------------------ */

.options-container {
  margin-top: 10px;
  display: flex;
  flex-direction: column;
  gap: 10px;
  width: 100%;
}

.options-label {
  font-size: 0.73rem;
  font-weight: 600;
  color: var(--ink-muted);
  letter-spacing: 0.015em;
  padding-left: 2px;
}

.option-group {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.option-group-title {
  font-size: 0.74rem;
  font-weight: 700;
  color: var(--ink-secondary);
  padding-left: 2px;
}

.options-chip-row {
  display: flex;
  flex-wrap: wrap;
  gap: 7px;
}

.options-submit-row {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-top: 2px;
}

.btn-send-options {
  border: none;
  background: var(--accent-emerald);
  color: #fff;
  padding: 8px 16px;
  border-radius: 999px;
  font-family: inherit;
  font-size: 0.82rem;
  font-weight: 600;
  cursor: pointer;
  box-shadow: var(--shadow-xs);
  transition: background 0.14s ease, transform 0.12s ease;
}

.btn-send-options:hover:not(:disabled) {
  background: var(--accent-emerald-hover);
  transform: translateY(-1px);
}

.btn-send-options:disabled {
  opacity: 0.5;
  cursor: default;
}

.option-chip {
  appearance: none;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 8px 14px;
  border-radius: 999px;
  border: 1px solid var(--accent-emerald-border);
  background: var(--bg-surface);
  color: var(--accent-emerald);
  font-family: inherit;
  font-size: 0.83rem;
  font-weight: 600;
  cursor: pointer;
  box-shadow: var(--shadow-xs);
  transition: transform 0.14s ease, background 0.14s ease, border-color 0.14s ease, box-shadow 0.14s ease;
}

.option-chip:hover:not(:disabled) {
  background: var(--accent-emerald-soft);
  border-color: var(--accent-emerald);
  transform: translateY(-1px);
  box-shadow: var(--shadow-sm);
}

.option-chip.option-followup {
  border-color: var(--border);
  color: var(--ink-primary);
}

.option-chip.option-followup:hover:not(:disabled) {
  border-color: var(--accent-emerald-border);
  background: var(--accent-emerald-soft);
  color: var(--accent-emerald);
}

.option-chip.selected {
  background: var(--accent-emerald);
  border-color: var(--accent-emerald);
  color: #fff;
}

.option-chip.selected:hover:not(:disabled) {
  background: var(--accent-emerald-hover);
  border-color: var(--accent-emerald-hover);
  color: #fff;
}

.option-chip:disabled:not(.selected) {
  opacity: 0.45;
  cursor: default;
  transform: none;
  box-shadow: none;
}

.option-chip-icon {
  font-size: 0.8rem;
  opacity: 0.75;
}

/* Badges & Citations */
.badge {
  display: inline-flex;
  align-items: center;
  padding: 2px 8px;
  border-radius: 999px;
  font-weight: 600;
  font-size: 0.7rem;
  background: var(--bg-subtle);
  color: var(--ink-secondary);
}

.badge-verified {
  background: var(--accent-emerald-soft);
  color: var(--accent-emerald);
}

.badge-emergency {
  background: var(--danger);
  color: #fff;
}

.badge-classical {
  background: var(--accent-saffron-bg);
  color: var(--accent-saffron);
  border: 1px solid var(--accent-saffron-border);
}

.badge-modern {
  background: var(--accent-teal-bg);
  color: var(--accent-teal);
  border: 1px solid var(--accent-teal-border);
}

.inline-cite-pill {
  display: inline-flex;
  align-items: center;
  border: 1px solid var(--accent-saffron-border);
  background: var(--accent-saffron-bg);
  color: #7c5012;
  border-radius: 999px;
  padding: 1px 7px;
  font-family: inherit;
  font-size: 0.7rem;
  font-weight: 700;
  cursor: pointer;
  margin: 0 2px;
  vertical-align: baseline;
}

.inline-cite-pill.cite-modern,
.cite-chip.cite-modern {
  color: #066155;
  background: var(--accent-teal-bg);
  border-color: var(--accent-teal-border);
}

.inline-cite-pill:hover {
  filter: brightness(0.96);
}

.citations-row {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin-top: 12px;
  padding-top: 10px;
  border-top: 1px dashed var(--border);
}

.cite-chip {
  border: 1px solid var(--accent-saffron-border);
  background: var(--accent-saffron-bg);
  color: #734c13;
  border-radius: 999px;
  padding: 4px 10px;
  font-family: inherit;
  font-size: 0.72rem;
  font-weight: 600;
  cursor: pointer;
  transition: background 0.14s ease;
}

.cite-chip:hover {
  filter: brightness(0.95);
}

/* ------------------------------------------------------------------
   Unified Minimalist Bottom Composer
------------------------------------------------------------------ */

.composer-shell {
  flex-shrink: 0;
  padding: 6px 20px 18px 20px;
  background: linear-gradient(180deg, rgba(250, 248, 244, 0) 0%, var(--bg-canvas) 24%);
}

.composer-shell > * {
  max-width: var(--chat-max-w);
  margin-left: auto;
  margin-right: auto;
}

.voice-status-bar {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 7px 14px;
  margin-bottom: 8px;
  border-radius: 12px;
  background: var(--accent-saffron-bg);
  border: 1px solid var(--accent-saffron-border);
  font-size: 0.8rem;
  color: #774f13;
}

.voice-waveform {
  background: rgba(255, 255, 255, 0.8);
  border: 1px solid var(--accent-saffron-border);
  border-radius: 6px;
}

.pulse-dot {
  width: 9px;
  height: 9px;
  border-radius: 50%;
  background: #d92d20;
  animation: pulse 1s infinite;
}

@keyframes pulse {
  0%, 100% { opacity: 1; transform: scale(1); }
  50% { opacity: 0.45; transform: scale(1.25); }
}

.safety-meta-strip {
  padding: 8px 14px;
  margin-bottom: 8px;
  border-radius: 12px;
  background: var(--bg-subtle);
  border: 1px solid var(--border);
  border-left: 3px solid var(--accent-saffron);
  font-size: 0.78rem;
  color: var(--ink-secondary);
}

.safety-meta-strip.status-budget {
  background: var(--accent-teal-bg);
  border-left-color: var(--accent-teal);
  color: #065a50;
}

.safety-meta-strip.status-conflict {
  background: var(--accent-saffron-bg);
  color: #6f4a12;
}

.photo-preview-bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 8px;
  padding: 8px 12px;
  margin-bottom: 8px;
  border-radius: 12px;
  background: var(--bg-surface);
  border: 1px solid var(--border);
}

.photo-chips-wrap {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}

.photo-chip {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  background: var(--bg-subtle);
  border: 1px solid var(--border);
  padding: 3px 9px;
  border-radius: 999px;
  font-size: 0.76rem;
}

.photo-thumb {
  width: 18px;
  height: 18px;
  border-radius: 4px;
  object-fit: cover;
}

.photo-kind-wrap {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-size: 0.75rem;
  color: var(--ink-muted);
}

.photo-kind-select,
.compact-select {
  padding: 4px 8px;
  border-radius: 8px;
  border: 1px solid var(--border);
  background: var(--bg-canvas);
  color: var(--ink-primary);
  font-family: inherit;
  font-size: 0.78rem;
  font-weight: 600;
}

.composer-card {
  background: var(--bg-surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 12px 14px 10px 16px;
  box-shadow: var(--shadow-sm);
  transition: border-color 0.16s ease, box-shadow 0.16s ease;
}

.composer-card:focus-within {
  border-color: var(--accent-emerald-border);
  box-shadow: 0 6px 22px rgba(28, 84, 62, 0.1);
}

#draft-input {
  width: 100%;
  border: none;
  outline: none;
  resize: none;
  min-height: 28px;
  max-height: 150px;
  padding: 2px 0 8px 0;
  background: transparent;
  font-family: inherit;
  font-size: 0.95rem;
  line-height: 1.5;
  color: var(--ink-primary);
}

#draft-input::placeholder {
  color: var(--ink-muted);
}

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

.composer-left,
.composer-right {
  display: flex;
  align-items: center;
  gap: 8px;
}

.composer-icon-btn {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  border: none;
  background: transparent;
  color: var(--ink-secondary);
  padding: 6px 10px;
  border-radius: 999px;
  font-family: inherit;
  font-size: 0.8rem;
  font-weight: 600;
  cursor: pointer;
  transition: background 0.14s ease, color 0.14s ease;
}

.composer-icon-btn:hover {
  background: var(--bg-subtle);
  color: var(--ink-primary);
}

.mic-btn {
  border: 1px solid var(--accent-emerald-border);
  background: var(--accent-emerald-soft);
  color: var(--accent-emerald);
  padding: 6px 12px;
  border-radius: 999px;
  font-family: inherit;
  font-size: 0.8rem;
  font-weight: 600;
  cursor: pointer;
  user-select: none;
  transition: background 0.14s ease;
}

.mic-btn:hover {
  background: #d8ece2;
}

.mic-btn.recording {
  background: var(--danger);
  border-color: var(--danger);
  color: #fff;
}

.btn-send {
  border: none;
  background: var(--accent-emerald);
  color: #fff;
  padding: 7px 16px;
  border-radius: 999px;
  font-family: inherit;
  font-size: 0.82rem;
  font-weight: 600;
  cursor: pointer;
  transition: background 0.14s ease;
}

.btn-send:hover {
  background: var(--accent-emerald-hover);
}

/* ------------------------------------------------------------------
   Collapsible Right Drawer (Progressive Disclosure)
------------------------------------------------------------------ */

.side-drawer {
  width: 344px;
  flex-shrink: 0;
  background: var(--bg-surface);
  border-left: 1px solid var(--border);
  display: flex;
  flex-direction: column;
  min-height: 0;
  transition: margin-right 0.22s ease, opacity 0.2s ease;
}

body.drawer-closed .side-drawer {
  margin-right: -344px;
  opacity: 0;
  pointer-events: none;
  border-left-color: transparent;
}

.drawer-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 8px 12px;
  border-bottom: 1px solid var(--border-subtle);
}

.drawer-tabs {
  display: inline-flex;
  gap: 4px;
  background: var(--bg-subtle);
  padding: 3px;
  border-radius: 10px;
}

.drawer-tab {
  border: none;
  background: transparent;
  padding: 5px 11px;
  border-radius: 8px;
  font-family: inherit;
  font-size: 0.78rem;
  font-weight: 600;
  color: var(--ink-secondary);
  cursor: pointer;
}

.drawer-tab.active {
  background: var(--bg-surface);
  color: var(--accent-emerald);
  box-shadow: var(--shadow-xs);
}

.btn-icon-close {
  border: none;
  background: transparent;
  color: var(--ink-muted);
  width: 30px;
  height: 30px;
  border-radius: 8px;
  font-size: 0.95rem;
  cursor: pointer;
}

.btn-icon-close:hover {
  background: var(--bg-subtle);
  color: var(--ink-primary);
}

.drawer-panel {
  display: none;
  flex: 1;
  overflow-y: auto;
  padding: 13px 15px;
}

.drawer-panel.active {
  display: block;
}

.drawer-section {
  margin-bottom: 13px;
  padding-bottom: 11px;
  border-bottom: 1px solid var(--border-subtle);
}

.drawer-section:last-child {
  border-bottom: none;
  margin-bottom: 0;
  padding-bottom: 0;
}

.drawer-section h3 {
  margin: 0 0 8px 0;
  font-family: var(--font-serif);
  font-size: 1.02rem;
  font-weight: 700;
  color: var(--ink-primary);
}

.section-header-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
}

.progress-badge {
  font-size: 0.72rem;
  font-weight: 700;
  padding: 2px 8px;
  border-radius: 999px;
  background: var(--accent-emerald-soft);
  color: var(--accent-emerald);
}

.gates-progress-track {
  height: 5px;
  border-radius: 999px;
  background: var(--bg-subtle);
  overflow: hidden;
  margin-bottom: 10px;
}

.gates-progress-fill {
  height: 100%;
  background: var(--accent-emerald);
  transition: width 0.25s ease;
}

.gates-list {
  list-style: none;
  padding: 0;
  margin: 0;
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.gates-list li {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 0.8rem;
  color: var(--ink-secondary);
  padding: 6px 10px;
  border-radius: 9px;
  background: var(--bg-canvas);
}

.gates-list li.done {
  background: var(--accent-emerald-soft);
  color: var(--accent-emerald);
  font-weight: 600;
}

.gate-dot {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: #c6bfb0;
}

.gates-list li.done .gate-dot {
  background: var(--accent-emerald);
}

.diff-item {
  padding: 9px 10px;
  border-radius: 10px;
  background: var(--bg-canvas);
  margin-bottom: 8px;
  font-size: 0.8rem;
}

.diff-bar {
  height: 4px;
  background: var(--border);
  border-radius: 999px;
  overflow: hidden;
  margin: 6px 0;
}

.diff-bar-fill {
  height: 100%;
  background: var(--accent-emerald);
}

.muted-note {
  font-size: 0.78rem;
  color: var(--ink-muted);
  margin: 4px 0;
}

.privacy-note {
  font-size: 0.76rem;
  color: var(--ink-muted);
  background: var(--bg-canvas);
  padding: 8px 10px;
  border-radius: 10px;
  margin: 8px 0 12px 0;
}

/* Form & Settings Controls */
.memory-form {
  display: flex;
  flex-direction: column;
  gap: 9px;
}

.memory-form label {
  display: flex;
  flex-direction: column;
  gap: 4px;
  font-size: 0.75rem;
  font-weight: 600;
  color: var(--ink-secondary);
}

.memory-form input,
.memory-form select {
  padding: 7px 9px;
  border-radius: 8px;
  border: 1px solid var(--border);
  background: var(--bg-canvas);
  font-family: inherit;
  font-size: 0.82rem;
  color: var(--ink-primary);
}

.form-row-2 {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px;
}

.memory-actions {
  display: flex;
  gap: 8px;
  margin-top: 4px;
}

.btn-primary,
.btn-danger,
.btn-toggle,
.btn-link {
  font-family: inherit;
  font-size: 0.8rem;
  font-weight: 600;
  border-radius: 9px;
  cursor: pointer;
  padding: 7px 12px;
  border: 1px solid transparent;
}

.btn-primary {
  background: var(--accent-emerald);
  color: #fff;
  flex: 1;
}

.btn-danger {
  background: var(--danger-bg);
  color: var(--danger);
  border-color: #f4c6c2;
}

.btn-toggle {
  background: var(--bg-subtle);
  color: var(--ink-secondary);
  border-color: var(--border);
}

.btn-toggle.active {
  background: var(--accent-emerald-soft);
  color: var(--accent-emerald);
  border-color: var(--accent-emerald-border);
}

.btn-link {
  background: transparent;
  color: var(--accent-emerald);
  padding: 2px 6px;
}

.setting-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  padding: 4px 0;
  font-size: 0.78rem;
  color: var(--ink-primary);
}

.setting-row > span:first-child {
  white-space: nowrap;
}

.setting-stack {
  display: flex;
  flex-direction: column;
  gap: 7px;
}

.setting-stack > label {
  display: flex;
  flex-direction: column;
  gap: 4px;
  font-size: 0.75rem;
  font-weight: 600;
  color: var(--ink-secondary);
}

.full-select {
  width: 100%;
  padding: 7px 9px;
  border-radius: 9px;
  border: 1px solid var(--border);
  background: var(--bg-canvas);
  color: var(--ink-primary);
  font-family: inherit;
  font-size: 0.8rem;
  font-weight: 600;
}

.voice-picker-row {
  display: flex;
  align-items: center;
  gap: 6px;
}

.voice-picker-row .full-select {
  flex: 1;
  min-width: 0;
}

.btn-preview {
  flex-shrink: 0;
  border: 1px solid var(--accent-emerald-border);
  background: var(--accent-emerald-soft);
  color: var(--accent-emerald);
  padding: 7px 10px;
  border-radius: 9px;
  font-family: inherit;
  font-size: 0.76rem;
  font-weight: 700;
  cursor: pointer;
}

.btn-preview:hover {
  background: #d7ebe1;
}

.speed-pills {
  display: inline-flex;
  gap: 3px;
  background: var(--bg-subtle);
  padding: 3px;
  border-radius: 9px;
  border: 1px solid var(--border);
}

.speed-pill {
  border: none;
  background: transparent;
  color: var(--ink-secondary);
  padding: 3px 6px;
  border-radius: 6px;
  font-family: inherit;
  font-size: 0.7rem;
  font-weight: 700;
  cursor: pointer;
}

.speed-pill.active {
  background: var(--accent-emerald);
  color: #fff;
}

.health-pill {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-size: 0.78rem;
  font-weight: 600;
  padding: 6px 11px;
  border-radius: 999px;
  background: var(--accent-emerald-soft);
  color: var(--accent-emerald);
  margin-bottom: 10px;
}

.vault-stats-box {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}

.code-preview {
  background: var(--bg-canvas);
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 10px;
  font-size: 0.72rem;
  overflow-x: auto;
  white-space: pre-wrap;
  color: var(--ink-secondary);
}

/* ------------------------------------------------------------------
   Source & Folio Modal
------------------------------------------------------------------ */

.modal-backdrop {
  position: fixed;
  inset: 0;
  background: rgba(20, 30, 25, 0.45);
  backdrop-filter: blur(4px);
  display: grid;
  place-items: center;
  padding: 20px;
  z-index: 100;
}

.modal-card {
  width: min(920px, 100%);
  max-height: 86vh;
  background: var(--bg-surface);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-lg);
  display: flex;
  flex-direction: column;
  overflow: hidden;
}

.modal-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 12px;
  padding: 16px 20px;
  border-bottom: 1px solid var(--border-subtle);
}

.modal-header h2 {
  margin: 0 0 6px 0;
  font-family: var(--font-serif);
  font-size: 1.15rem;
  color: var(--ink-primary);
}

.badge-row {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}

.modal-body {
  display: grid;
  grid-template-columns: 280px minmax(0, 1fr);
  gap: 18px;
  padding: 18px 20px;
  overflow-y: auto;
}

.folio-pane {
  background: var(--bg-canvas);
  border: 1px solid var(--border-subtle);
  border-radius: 12px;
  padding: 12px;
}

.folio-pane img {
  width: 100%;
  border-radius: 8px;
  cursor: zoom-in;
}

.folio-pane img.zoomed {
  transform: scale(1.35);
  cursor: zoom-out;
}

.modern-safety-card {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.modern-safety-field {
  font-size: 0.82rem;
  color: var(--ink-secondary);
}

.modern-safety-field strong {
  display: block;
  font-size: 0.72rem;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  color: var(--accent-teal);
  margin-bottom: 2px;
}

.source-block {
  margin-bottom: 14px;
}

.source-block h4 {
  margin: 0 0 6px 0;
  font-size: 0.82rem;
  color: var(--ink-muted);
  text-transform: uppercase;
  letter-spacing: 0.04em;
}

.sanskrit-box {
  background: var(--bg-canvas);
  border: 1px solid var(--border-subtle);
  border-radius: 12px;
  padding: 12px 14px;
  font-family: var(--font-indic);
  font-size: 0.94rem;
  line-height: 1.65;
  white-space: pre-wrap;
}

/* Elemental Blueprint (Dosha) Header Pill & Profile Card */
.btn-dosha-pill {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  text-decoration: none;
  font-size: 0.78rem;
  font-weight: 600;
  color: #6d4f17;
  background: linear-gradient(135deg, #fbf3df 0%, #f5e6c5 100%);
  border: 1px solid var(--kintsugi-border);
  border-radius: 999px;
  padding: 6px 13px;
  box-shadow: 0 2px 8px rgba(180, 138, 62, 0.16);
  transition: transform 0.15s ease, box-shadow 0.15s ease, border-color 0.15s ease;
  white-space: nowrap;
}

.btn-dosha-pill:hover {
  transform: translateY(-1px);
  border-color: var(--kintsugi);
  box-shadow: 0 6px 16px rgba(180, 138, 62, 0.24);
}

.btn-dosha-pill.has-badge {
  background: linear-gradient(135deg, #17221e 0%, #243630 100%);
  color: #f3d99d;
  border-color: rgba(216, 181, 108, 0.65);
  box-shadow: 0 4px 14px rgba(23, 34, 30, 0.24);
}

.profile-dosha-card {
  border: 1px solid var(--border);
  border-radius: 14px;
  padding: 12px 13px;
  background: linear-gradient(150deg, #faf8f2 0%, #ffffff 100%);
  margin-bottom: 14px;
}

.profile-dosha-card.is-talisman {
  background: radial-gradient(circle at 20% 20%, #253630 0%, #151e1b 75%);
  border-color: rgba(216, 181, 108, 0.55);
  color: #f8f2e4;
  box-shadow: 0 10px 26px rgba(17, 25, 22, 0.22);
}

.profile-talisman-kicker {
  font-size: 0.64rem;
  font-weight: 700;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: #e4c37d;
  margin-bottom: 2px;
}

.profile-dosha-card.is-talisman .profile-dosha-title {
  font-family: var(--font-serif);
  font-size: 1.08rem;
  color: #fcf7ec;
}

.profile-dosha-card.is-talisman .profile-dosha-meta {
  color: rgba(243, 217, 157, 0.76);
}

.profile-dosha-card.is-talisman .dosha-mini-chip {
  background: rgba(255, 255, 255, 0.08);
  color: #f3d99d;
  border: 1px solid rgba(216, 181, 108, 0.26);
}

.profile-dosha-card.is-talisman .btn-dosha-mini {
  background: linear-gradient(135deg, #c99d4a 0%, #e0be74 100%);
  color: #191610;
}

.profile-dosha-empty,
.profile-dosha-filled {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
}

.profile-dosha-title {
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 0.86rem;
  font-weight: 700;
  color: var(--ink-primary);
}

.profile-dosha-meta {
  font-size: 0.74rem;
  color: var(--ink-muted);
  margin-top: 2px;
}

.profile-dosha-pcts {
  display: flex;
  gap: 5px;
  flex-wrap: nowrap;
  margin-top: 7px;
}

.dosha-mini-chip {
  font-size: 0.65rem;
  font-weight: 600;
  padding: 2px 6px;
  border-radius: 999px;
  background: var(--bg-subtle);
  color: var(--ink-secondary);
  white-space: nowrap;
}

.btn-dosha-mini {
  display: inline-flex;
  align-items: center;
  text-decoration: none;
  font-size: 0.74rem;
  font-weight: 600;
  padding: 6px 10px;
  border-radius: 999px;
  background: var(--accent-emerald);
  color: #fff;
  white-space: nowrap;
  flex-shrink: 0;
}

.recent-questions-list {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.recent-question-item {
  font-size: 0.77rem;
  line-height: 1.4;
  color: var(--ink-secondary);
  background: var(--bg-canvas);
  border: 1px solid var(--border-subtle);
  border-radius: 10px;
  padding: 7px 10px;
}

/* Hands-Free Continuous Voice Mode Controls (Main Chat) */
.voice-mode-btn {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  border: 1px solid var(--accent-emerald-border);
  background: var(--accent-emerald-soft);
  color: var(--accent-emerald);
  font-family: inherit;
  font-size: 0.8rem;
  font-weight: 600;
  padding: 7px 13px;
  border-radius: 999px;
  cursor: pointer;
  transition: background 0.16s ease, color 0.16s ease, box-shadow 0.16s ease;
}

.voice-mode-btn:hover {
  background: #dcebe3;
}

.voice-mode-btn.active {
  background: var(--accent-emerald);
  border-color: var(--accent-emerald);
  color: #ffffff;
  box-shadow: 0 4px 14px rgba(28, 84, 62, 0.28);
}

.vm-dot {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: var(--accent-emerald);
  opacity: 0.65;
}

.voice-mode-btn.active .vm-dot {
  background: #7cf0b2;
  opacity: 1;
  box-shadow: 0 0 0 3px rgba(124, 240, 178, 0.28);
  animation: hfPulse 1.5s infinite;
}

@keyframes hfPulse {
  0%, 100% { transform: scale(1); opacity: 1; }
  50% { transform: scale(1.25); opacity: 0.7; }
}

.handsfree-voice-bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  padding: 9px 14px;
  margin-bottom: 8px;
  border-radius: 16px;
  background: #edf5f1;
  border: 1px solid #c6dfd3;
  flex-wrap: wrap;
}

.handsfree-voice-bar.phase-user_speaking {
  background: #fdf2eb;
  border-color: #ebc2a8;
}

.handsfree-voice-bar.phase-ai_speaking {
  background: #f0f2fa;
  border-color: #cdd5ee;
}

.hf-left {
  display: flex;
  align-items: center;
  gap: 9px;
  flex: 1;
  min-width: 0;
}

.hf-live-orb {
  width: 9px;
  height: 9px;
  border-radius: 50%;
  background: #1e6045;
  flex-shrink: 0;
  animation: hfPulse 1.5s infinite;
}

.handsfree-voice-bar.phase-user_speaking .hf-live-orb {
  background: #c6542b;
}

.handsfree-voice-bar.phase-ai_speaking .hf-live-orb {
  background: #5a6ea8;
}

.handsfree-voice-bar.phase-paused .hf-live-orb {
  background: #9aa39e;
  animation: none;
}

.hf-status-text {
  font-size: 0.8rem;
  font-weight: 600;
  color: var(--ink-primary);
}

.hf-actions {
  display: flex;
  align-items: center;
  gap: 6px;
}

.hf-mini-btn {
  border: 1px solid var(--border);
  background: #ffffff;
  color: var(--ink-primary);
  font-family: inherit;
  font-size: 0.74rem;
  font-weight: 600;
  padding: 4px 10px;
  border-radius: 999px;
  cursor: pointer;
}

.hf-end-btn {
  color: #9e3124;
  border-color: #ecc3be;
  background: #fff7f6;
}

/* Responsive */
@media (max-width: 820px) {
  .topbar {
    grid-template-columns: auto 1fr auto;
    padding: 0 12px;
  }
  .mode-btn {
    padding: 5px 10px;
    font-size: 0.74rem;
  }
  .scenario-grid {
    grid-template-columns: 1fr;
  }
  .side-drawer {
    position: absolute;
    top: 0;
    right: 0;
    bottom: 0;
    z-index: 30;
    box-shadow: var(--shadow-lg);
  }
  .modal-body {
    grid-template-columns: 1fr;
  }
}
