/* === Reset & Foundations === */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

:root {
  /* Warm charcoal + amber palette */
  --sidebar-bg: #1c1f26;
  --sidebar-hover: #282c35;
  --sidebar-active: #33373f;
  --sidebar-text: #a8adb8;
  --sidebar-text-bright: #e4e6eb;
  --sidebar-border: rgba(255,255,255,.06);

  --accent: #e8a838;
  --accent-dim: rgba(232,168,56,.15);
  --accent-text: #f5c563;

  --bg: #f5f3ef;
  --surface: #ffffff;
  --surface-raised: #ffffff;
  --text: #1a1c20;
  --text-secondary: #6b7280;
  --text-tertiary: #9ca3af;
  --border: #e5e2dd;
  --border-light: #eeebe6;

  --user-bubble: #1a1c20;
  --assistant-bg: #f9f7f4;
  --danger: #dc4a3d;
  --success: #2d8a4e;

  --radius-sm: 6px;
  --radius-md: 10px;
  --radius-lg: 16px;
  --radius-xl: 20px;

  --sidebar-width: 272px;
  --font-body: 'DM Sans', system-ui, -apple-system, sans-serif;
  --font-mono: 'JetBrains Mono', 'Menlo', monospace;
}

body {
  font-family: var(--font-body);
  background: var(--bg);
  color: var(--text);
  height: 100vh;
  overflow: hidden;
  -webkit-font-smoothing: antialiased;
  font-feature-settings: 'ss01', 'ss02';
}

.screen { display: none; height: 100vh; }
.screen.active { display: flex; }
.hidden { display: none !important; }

/* === Login === */
.login-bg {
  position: fixed;
  inset: 0;
  background:
    radial-gradient(ellipse 80% 60% at 50% 40%, rgba(232,168,56,.08), transparent),
    linear-gradient(160deg, #f5f3ef 0%, #ebe7e0 100%);
  z-index: 0;
}

.login-container {
  position: relative;
  z-index: 1;
  margin: auto;
  text-align: center;
  padding: 40px 32px;
  animation: fadeUp .6s ease-out;
}

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

.login-brand { margin-bottom: 40px; }
.brand-icon {
  display: inline-flex;
  margin-bottom: 16px;
  filter: drop-shadow(0 4px 12px rgba(232,168,56,.25));
}
.login-container h1 {
  font-size: 26px;
  font-weight: 700;
  letter-spacing: -.02em;
  color: var(--text);
}
.login-subtitle {
  font-size: 14px;
  color: var(--text-secondary);
  margin-top: 4px;
  letter-spacing: .02em;
  text-transform: uppercase;
  font-weight: 500;
}
.login-hint {
  margin-top: 24px;
  font-size: 13px;
  color: var(--text-tertiary);
}

/* Gate form (password) */
.gate-form {
  display: flex;
  gap: 8px;
  max-width: 320px;
  margin: 0 auto 24px;
}
.gate-form input {
  flex: 1;
  padding: 10px 14px;
  border: 1.5px solid var(--border);
  border-radius: var(--radius-md);
  font-size: 15px;
  font-family: var(--font-body);
  background: var(--surface);
  color: var(--text);
  outline: none;
  transition: border-color .15s;
}
.gate-form input:focus { border-color: var(--accent); }
.gate-form .btn-primary {
  flex-shrink: 0;
  padding: 10px 20px;
}
.gate-error {
  text-align: center;
  font-size: 13px;
  color: var(--danger);
  min-height: 18px;
  margin-top: -12px;
}
.gate-error:empty { display: none; }

/* Login screen (name-based — visually distinct from gate) */
.login-screen-bg {
  background: var(--sidebar-bg);
}
.login-screen-bg .login-container {
  animation: fadeUp .4s ease-out;
}
.login-panel {
  background: var(--surface);
  border-radius: var(--radius-xl);
  padding: 32px 36px 28px;
  max-width: 420px;
  margin: 0 auto;
  box-shadow: 0 12px 40px rgba(0,0,0,.15);
}
.login-panel-header {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 13px;
  font-weight: 600;
  color: var(--text-tertiary);
  margin-bottom: 20px;
  letter-spacing: -.01em;
}
.login-panel-title {
  font-size: 22px;
  font-weight: 700;
  color: var(--text);
  letter-spacing: -.02em;
  margin-bottom: 4px;
}
.login-panel-hint {
  font-size: 14px;
  color: var(--text-secondary);
  margin-bottom: 20px;
}
.name-form {
  display: flex;
  gap: 8px;
}
.name-form input {
  flex: 1;
  padding: 11px 14px;
  border: 1.5px solid var(--border);
  border-radius: var(--radius-md);
  font-size: 15px;
  font-family: var(--font-body);
  background: var(--bg);
  color: var(--text);
  outline: none;
  transition: border-color .15s;
}
.name-form input:focus { border-color: var(--accent); }
.name-form .btn-primary {
  flex-shrink: 0;
  padding: 11px 22px;
}

/* Divider between name input and account cards */
.existing-divider {
  display: flex;
  align-items: center;
  gap: 12px;
  margin: 20px 0 16px;
}
.existing-divider::before,
.existing-divider::after {
  content: '';
  flex: 1;
  height: 1px;
  background: var(--border-light);
}
.existing-divider span {
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: .06em;
  color: var(--text-tertiary);
  font-weight: 500;
  white-space: nowrap;
}

/* Account cards (flexible width) */
.accounts-grid {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  justify-content: center;
}

.account-card {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 16px 10px 10px;
  background: var(--bg);
  border: 1.5px solid var(--border-light);
  border-radius: var(--radius-md);
  cursor: pointer;
  transition: all .15s ease;
  white-space: nowrap;
}
.account-card:hover {
  border-color: var(--accent);
  background: var(--accent-dim);
}
.account-card .avatar {
  width: 32px;
  height: 32px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 600;
  font-size: 14px;
  color: #fff;
  flex-shrink: 0;
}
.account-card .card-name {
  font-size: 14px;
  font-weight: 500;
  color: var(--text);
}

/* === Sidebar === */
.sidebar {
  width: var(--sidebar-width);
  background: var(--sidebar-bg);
  display: flex;
  flex-direction: column;
  flex-shrink: 0;
}

.sidebar-header {
  padding: 16px 16px 12px;
  border-bottom: 1px solid var(--sidebar-border);
}
.sidebar-brand {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 14px;
  font-weight: 600;
  color: var(--sidebar-text-bright);
  letter-spacing: -.01em;
}
.user-chip {
  margin-top: 8px;
  font-size: 12px;
  color: var(--accent-text);
  background: var(--accent-dim);
  padding: 3px 10px;
  border-radius: 20px;
  display: inline-block;
  font-weight: 500;
}

.sidebar-body {
  flex: 1;
  overflow-y: auto;
  padding: 8px 0;
}
.sidebar-body::-webkit-scrollbar { width: 4px; }
.sidebar-body::-webkit-scrollbar-thumb { background: rgba(255,255,255,.1); border-radius: 4px; }

.sidebar-section { padding: 4px 12px; }
.section-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 8px 4px;
}
.section-label {
  font-size: 11px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: .06em;
  color: var(--sidebar-text);
}
.sidebar-action {
  background: none;
  border: 1px solid var(--sidebar-border);
  border-radius: var(--radius-sm);
  color: var(--sidebar-text);
  cursor: pointer;
  padding: 3px 6px;
  display: flex;
  align-items: center;
  transition: all .15s;
}
.sidebar-action:hover {
  color: var(--accent-text);
  border-color: var(--accent);
  background: var(--accent-dim);
}

.sidebar-divider {
  height: 1px;
  background: var(--sidebar-border);
  margin: 4px 16px;
}

.sidebar-list {
  display: flex;
  flex-direction: column;
  gap: 1px;
}
.sidebar-item {
  padding: 7px 10px;
  border-radius: var(--radius-sm);
  cursor: pointer;
  font-size: 13px;
  color: var(--sidebar-text);
  display: flex;
  align-items: center;
  gap: 8px;
  transition: all .12s;
  position: relative;
}
.sidebar-item:hover { background: var(--sidebar-hover); color: var(--sidebar-text-bright); }
.sidebar-item.active { background: var(--sidebar-active); color: var(--sidebar-text-bright); }
.sidebar-item .item-icon {
  width: 18px;
  height: 18px;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  opacity: .5;
}
.sidebar-item.active .item-icon { opacity: .8; }
.sidebar-item .item-text {
  flex: 1;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.sidebar-item .item-badge {
  font-size: 10px;
  padding: 1px 6px;
  border-radius: 10px;
  background: var(--accent-dim);
  color: var(--accent-text);
  font-weight: 500;
  flex-shrink: 0;
}
.sidebar-item .delete-btn {
  opacity: 0;
  background: none;
  border: none;
  cursor: pointer;
  color: var(--sidebar-text);
  font-size: 14px;
  padding: 2px 4px;
  border-radius: 4px;
  flex-shrink: 0;
  transition: opacity .1s;
}
.sidebar-item:hover .delete-btn { opacity: .4; }
.sidebar-item .delete-btn:hover { opacity: 1; color: var(--danger); }
.sidebar-empty {
  padding: 8px 10px;
  font-size: 12px;
  color: var(--sidebar-text);
  opacity: .5;
  font-style: italic;
}

/* Sidebar footer */
.sidebar-footer {
  border-top: 1px solid var(--sidebar-border);
  padding: 8px 12px 12px;
}
.sidebar-footer-btn {
  background: none;
  border: none;
  cursor: pointer;
  display: flex;
  align-items: center;
  gap: 8px;
  width: 100%;
  padding: 7px 8px;
  font-size: 13px;
  color: var(--sidebar-text);
  border-radius: var(--radius-sm);
  font-family: var(--font-body);
  transition: all .12s;
}
.sidebar-footer-btn:hover { background: var(--sidebar-hover); color: var(--sidebar-text-bright); }
.sidebar-footer-btn svg { opacity: .6; }
.sidebar-models { padding-bottom: 4px; }
.sidebar-select-field {
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 3px 4px;
}
.sidebar-select-label {
  font-size: 11px;
  color: var(--sidebar-text);
  min-width: 68px;
  flex-shrink: 0;
}
.sidebar-select {
  flex: 1;
  min-width: 0;
  padding: 4px 6px;
  background: var(--sidebar-hover);
  color: var(--sidebar-text-bright);
  border: 1px solid var(--sidebar-border);
  border-radius: var(--radius-sm);
  font-size: 12px;
  font-family: var(--font-body);
  outline: none;
  cursor: pointer;
}
.sidebar-select:focus { border-color: var(--accent); }
.sidebar-select option { background: var(--sidebar-bg); color: var(--sidebar-text-bright); }

.sidebar-stats {
  font-size: 11px;
  color: var(--sidebar-text);
  opacity: .5;
  text-align: center;
  padding: 6px 0 0;
  font-family: var(--font-mono);
  letter-spacing: .01em;
}

/* === Content area === */
.content {
  flex: 1;
  display: flex;
  flex-direction: column;
  overflow: hidden;
  background: var(--bg);
}
.panel {
  display: none;
  flex: 1;
  flex-direction: column;
  overflow: hidden;
}
.panel.active {
  display: flex;
  animation: panelIn .25s ease-out;
}
@keyframes panelIn {
  from { opacity: 0; }
  to { opacity: 1; }
}

/* === Welcome === */
.welcome-container {
  margin: auto;
  text-align: center;
  padding: 40px;
  max-width: 440px;
}
.welcome-icon {
  margin-bottom: 20px;
  opacity: .8;
}
.welcome-container h2 {
  font-size: 22px;
  font-weight: 600;
  letter-spacing: -.02em;
  margin-bottom: 24px;
  color: var(--text);
}
.welcome-steps {
  display: flex;
  flex-direction: column;
  gap: 10px;
  text-align: left;
}
.welcome-step {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 12px 16px;
  background: var(--surface);
  border-radius: var(--radius-md);
  border: 1px solid var(--border-light);
  font-size: 14px;
  color: var(--text-secondary);
}
.step-num {
  width: 26px;
  height: 26px;
  display: flex;
  align-items: center;
  justify-content: center;
  background: var(--accent-dim);
  color: var(--accent);
  border-radius: 50%;
  font-size: 13px;
  font-weight: 600;
  flex-shrink: 0;
}

/* === Chat === */
.chat-header {
  padding: 12px 20px;
  border-bottom: 1px solid var(--border-light);
  display: flex;
  justify-content: space-between;
  align-items: center;
  background: var(--surface);
}
.chat-title {
  font-size: 15px;
  font-weight: 600;
  color: var(--text);
  letter-spacing: -.01em;
}
.chat-meta {
  font-size: 12px;
  color: var(--text-tertiary);
  font-family: var(--font-mono);
}

.messages-area {
  flex: 1;
  overflow-y: auto;
  padding: 20px 24px;
  display: flex;
  flex-direction: column;
  gap: 10px;
}
.messages-area::-webkit-scrollbar { width: 6px; }
.messages-area::-webkit-scrollbar-thumb { background: rgba(0,0,0,.1); border-radius: 6px; }

.message {
  max-width: 72%;
  padding: 10px 14px;
  font-size: 14px;
  line-height: 1.6;
  white-space: pre-wrap;
  word-wrap: break-word;
  animation: msgIn .2s ease-out;
}
@keyframes msgIn {
  from { opacity: 0; transform: translateY(6px); }
  to { opacity: 1; transform: translateY(0); }
}

.message.user {
  align-self: flex-end;
  background: var(--user-bubble);
  color: #fff;
  border-radius: var(--radius-lg) var(--radius-lg) 4px var(--radius-lg);
}
.message.assistant {
  align-self: flex-start;
  background: var(--assistant-bg);
  border: 1px solid var(--border-light);
  border-radius: var(--radius-lg) var(--radius-lg) var(--radius-lg) 4px;
  color: var(--text);
}
.message .msg-meta {
  font-size: 11px;
  margin-top: 6px;
  font-family: var(--font-mono);
  letter-spacing: .01em;
}
.message.user .msg-meta { color: rgba(255,255,255,.45); }
.message.assistant .msg-meta { color: var(--text-tertiary); }

.chat-status {
  padding: 8px 20px;
  font-size: 13px;
  color: var(--accent);
  background: var(--accent-dim);
  text-align: center;
  font-weight: 500;
  border-top: 1px solid rgba(232,168,56,.1);
}
.chat-status.error { color: var(--danger); background: #fef2f1; }

.chat-input-area {
  padding: 12px 20px 16px;
  background: var(--surface);
  border-top: 1px solid var(--border-light);
}
.chat-input-wrap {
  display: flex;
  align-items: flex-end;
  gap: 8px;
  background: var(--bg);
  border: 1.5px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 4px 4px 4px 14px;
  transition: border-color .15s;
}
.chat-input-wrap:focus-within { border-color: var(--accent); }

.chat-input-wrap textarea {
  flex: 1;
  border: none;
  background: transparent;
  padding: 8px 0;
  font-size: 14px;
  font-family: var(--font-body);
  resize: none;
  max-height: 120px;
  outline: none;
  color: var(--text);
  line-height: 1.5;
}
.chat-input-wrap textarea::placeholder { color: var(--text-tertiary); }

.btn-send {
  width: 36px;
  height: 36px;
  display: flex;
  align-items: center;
  justify-content: center;
  background: var(--accent);
  color: #fff;
  border: none;
  border-radius: var(--radius-md);
  cursor: pointer;
  flex-shrink: 0;
  transition: all .15s;
}
.btn-send:hover { background: #d4952e; }
.btn-send:disabled { opacity: .3; cursor: not-allowed; }

/* Empty chat state */
.chat-empty {
  margin: auto;
  text-align: center;
  padding: 40px;
}
.chat-empty p {
  font-size: 14px;
  color: var(--text-tertiary);
  margin-bottom: 20px;
}
.quick-questions {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  justify-content: center;
  max-width: 500px;
}
.quick-btn {
  padding: 8px 14px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 20px;
  font-size: 13px;
  color: var(--text-secondary);
  cursor: pointer;
  font-family: var(--font-body);
  transition: all .15s;
}
.quick-btn:hover {
  border-color: var(--accent);
  color: var(--text);
  background: var(--accent-dim);
}

/* === Instruction card (collapsible) === */
.instruction-card {
  background: var(--surface);
  border: 1px solid var(--border-light);
  border-radius: var(--radius-lg);
  margin-bottom: 16px;
}
.instruction-toggle {
  padding: 14px 20px;
  font-size: 14px;
  font-weight: 600;
  color: var(--accent);
  cursor: pointer;
  list-style: none;
  display: flex;
  align-items: center;
  gap: 8px;
}
.instruction-toggle::-webkit-details-marker { display: none; }
.instruction-toggle::before {
  content: '\25B6';
  font-size: 10px;
  transition: transform .15s;
}
details[open] > .instruction-toggle::before {
  transform: rotate(90deg);
}
.instruction-body {
  padding: 0 20px 20px;
  display: flex;
  flex-direction: column;
  gap: 14px;
}
.instruction-step {
  display: flex;
  gap: 12px;
  font-size: 13px;
  line-height: 1.6;
  color: var(--text-secondary);
}
.instruction-step a {
  color: var(--accent);
  text-decoration: none;
}
.instruction-step a:hover { text-decoration: underline; }
.instruction-step code {
  background: var(--bg);
  padding: 1px 5px;
  border-radius: 4px;
  font-family: var(--font-mono);
  font-size: 12px;
  color: var(--text);
}
.instruction-step strong { color: var(--text); }
.instruction-img-wrap {
  margin-top: 8px;
}
.instruction-img {
  max-width: 320px;
  border-radius: var(--radius-md);
  border: 1px solid var(--border);
  box-shadow: 0 2px 8px rgba(0,0,0,.08);
}
.instruction-code {
  display: block;
  margin-top: 8px;
  padding: 10px 14px;
  background: var(--sidebar-bg);
  color: var(--sidebar-text-bright);
  border-radius: var(--radius-sm);
  font-family: var(--font-mono);
  font-size: 12px;
  line-height: 1.5;
  overflow-x: auto;
  white-space: pre;
}
.instruction-note {
  display: block;
  margin-top: 6px;
  font-size: 12px;
  color: var(--accent);
  font-weight: 500;
}

/* === Form pages (Settings, Import) === */
.form-page {
  flex: 1;
  overflow-y: auto;
  padding: 32px 40px;
  max-width: 640px;
}
.form-page-header {
  margin-bottom: 24px;
}
.form-page-header h2 {
  font-size: 20px;
  font-weight: 600;
  letter-spacing: -.02em;
  margin-bottom: 4px;
}
.form-page-header p {
  font-size: 14px;
  color: var(--text-secondary);
}

.form-card {
  background: var(--surface);
  border: 1px solid var(--border-light);
  border-radius: var(--radius-lg);
  padding: 24px;
}

.form-field {
  display: block;
  margin-bottom: 20px;
}
.form-field:last-of-type { margin-bottom: 0; }
.form-label {
  display: block;
  font-size: 14px;
  font-weight: 500;
  color: var(--text);
  margin-bottom: 2px;
}
.form-hint {
  display: block;
  font-size: 12px;
  color: var(--text-tertiary);
  margin-bottom: 8px;
}

.form-field select,
.form-field input[type="text"] {
  display: block;
  width: 100%;
  padding: 9px 12px;
  border: 1.5px solid var(--border);
  border-radius: var(--radius-sm);
  font-size: 14px;
  font-family: var(--font-body);
  background: var(--bg);
  color: var(--text);
  outline: none;
  transition: border-color .15s;
}
.form-field select:focus,
.form-field input[type="text"]:focus { border-color: var(--accent); }

.form-field textarea {
  display: block;
  width: 100%;
  padding: 10px 12px;
  border: 1.5px solid var(--border);
  border-radius: var(--radius-sm);
  font-size: 13px;
  font-family: var(--font-mono);
  background: var(--bg);
  color: var(--text);
  outline: none;
  resize: vertical;
  line-height: 1.5;
  transition: border-color .15s;
}
.form-field textarea:focus { border-color: var(--accent); }

.checkbox-field {
  display: flex !important;
  align-items: flex-start;
  gap: 10px;
  cursor: pointer;
}
.checkbox-field input[type="checkbox"] {
  width: 18px;
  height: 18px;
  margin-top: 2px;
  accent-color: var(--accent);
  cursor: pointer;
  flex-shrink: 0;
}
.checkbox-field .form-label { margin-bottom: 0; }
.checkbox-field .form-hint { margin-bottom: 0; margin-top: 1px; }

.form-actions {
  margin-top: 20px;
  padding-top: 16px;
  border-top: 1px solid var(--border-light);
}

.btn-primary {
  background: var(--accent);
  color: #fff;
  border: none;
  padding: 10px 24px;
  border-radius: var(--radius-sm);
  font-size: 14px;
  font-weight: 500;
  cursor: pointer;
  font-family: var(--font-body);
  transition: all .15s;
}
.btn-primary:hover { background: #d4952e; }
.btn-primary:disabled { opacity: .45; cursor: not-allowed; }

.import-status {
  padding: 14px 16px;
  border-radius: var(--radius-sm);
  margin-top: 16px;
  font-size: 13px;
  line-height: 1.5;
}
.import-status.success { background: #edf7f0; color: var(--success); border: 1px solid #c6e9d0; }
.import-status.error { background: #fef2f1; color: var(--danger); border: 1px solid #fbd5d2; }
.import-status:empty { display: none; }
.import-status input[type="text"] {
  padding: 6px 10px;
  border: 1px solid #c6e9d0;
  border-radius: var(--radius-sm);
  font-size: 13px;
  font-family: var(--font-body);
}

/* === Modal === */
.modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,.45);
  backdrop-filter: blur(4px);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 100;
  animation: overlayIn .15s ease-out;
}
@keyframes overlayIn { from { opacity: 0; } to { opacity: 1; } }

.modal {
  background: var(--surface);
  border-radius: var(--radius-lg);
  width: 90%;
  max-width: 500px;
  max-height: 80vh;
  overflow-y: auto;
  box-shadow: 0 20px 60px rgba(0,0,0,.2);
  animation: modalIn .2s ease-out;
}
@keyframes modalIn {
  from { opacity: 0; transform: scale(.96) translateY(8px); }
  to { opacity: 1; transform: scale(1) translateY(0); }
}

.modal-header {
  padding: 16px 20px;
  border-bottom: 1px solid var(--border-light);
  display: flex;
  justify-content: space-between;
  align-items: center;
}
.modal-header h3 { font-size: 16px; font-weight: 600; }
.modal-close-btn {
  background: none;
  border: none;
  font-size: 22px;
  cursor: pointer;
  color: var(--text-tertiary);
  padding: 0 4px;
  line-height: 1;
}
.modal-close-btn:hover { color: var(--text); }
.modal-body { padding: 20px; font-size: 14px; line-height: 1.6; }

/* === Streaming indicator === */
@keyframes pulse {
  0%, 100% { opacity: .3; }
  50% { opacity: 1; }
}
/* Response comparison groups */
.response-group {
  display: flex;
  gap: 10px;
  align-self: flex-start;
  max-width: 90%;
  align-items: flex-start;
}
.response-group .response-variant {
  flex: 1;
  min-width: 0;
  max-width: none;
  position: relative;
}
.response-group .response-variant.older {
  opacity: .55;
}
.response-group .response-variant.older:hover {
  opacity: .85;
}
.response-group .response-variant::before {
  content: attr(data-variant-label);
  display: block;
  font-size: 10px;
  text-transform: uppercase;
  letter-spacing: .04em;
  color: var(--text-tertiary);
  margin-bottom: 4px;
  font-weight: 500;
}
/* When too narrow, stack vertically with tabs */
@media (max-width: 900px) {
  .response-group {
    flex-direction: column;
    max-width: 75%;
  }
  .response-group .response-variant {
    max-width: 100%;
  }
}

/* Message actions & modules */
.msg-actions {
  display: flex;
  align-items: flex-end;
  gap: 8px;
  margin-top: 6px;
  justify-content: space-between;
}
.msg-actions-left {
  display: flex;
  flex-direction: column;
  gap: 4px;
  min-width: 0;
}
.msg-modules {
  display: flex;
  flex-wrap: wrap;
  gap: 3px;
}
.module-tag {
  font-size: 10px;
  padding: 1px 7px;
  border-radius: 10px;
  font-weight: 500;
  letter-spacing: .01em;
  white-space: nowrap;
  background: rgba(0,0,0,.03);
  color: var(--text-tertiary);
  opacity: .4;
}
.module-tag.active {
  background: rgba(232,168,56,.12);
  color: var(--accent);
  opacity: 1;
}
.module-auto {
  font-size: 8px;
  margin-left: 3px;
  opacity: .55;
  text-transform: uppercase;
  letter-spacing: .03em;
  vertical-align: 1px;
}
.regen-btn {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 3px 8px;
  background: none;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  font-size: 11px;
  color: var(--text-tertiary);
  cursor: pointer;
  font-family: var(--font-body);
  transition: all .15s;
}
.regen-btn:hover { border-color: var(--accent); color: var(--accent); }
.regen-btn svg { width: 12px; height: 12px; }
.regen-btn { margin-left: auto; }

.regen-menu {
  position: absolute;
  bottom: 100%;
  left: 0;
  margin-bottom: 4px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  box-shadow: 0 8px 24px rgba(0,0,0,.12);
  z-index: 50;
  min-width: 180px;
  max-height: 280px;
  overflow-y: auto;
  padding: 4px;
  animation: menuIn .12s ease-out;
}
@keyframes menuIn {
  from { opacity: 0; transform: translateY(4px); }
  to { opacity: 1; transform: translateY(0); }
}
.regen-menu-title {
  padding: 6px 10px 4px;
  font-size: 11px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: .04em;
  color: var(--text-tertiary);
}
.regen-menu-item {
  display: block;
  width: 100%;
  padding: 7px 10px;
  background: none;
  border: none;
  border-radius: var(--radius-sm);
  font-size: 13px;
  font-family: var(--font-body);
  color: var(--text);
  cursor: pointer;
  text-align: left;
  transition: background .1s;
}
.regen-menu-item:hover { background: var(--accent-dim); color: var(--accent); }
.regen-menu-item.current { color: var(--accent); font-weight: 500; }

/* Child picker buttons */
.child-picker {
  display: flex;
  gap: 8px;
  margin-top: 10px;
  flex-wrap: wrap;
}
.child-btn {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 2px;
  padding: 10px 18px;
  background: var(--surface);
  border: 1.5px solid var(--border);
  border-radius: var(--radius-md);
  cursor: pointer;
  font-family: var(--font-body);
  transition: all .15s;
}
.child-btn:hover {
  border-color: var(--accent);
  background: var(--accent-dim);
  transform: translateY(-1px);
}
.child-btn-name {
  font-size: 14px;
  font-weight: 600;
  color: var(--text);
}
.child-btn-info {
  font-size: 11px;
  color: var(--text-tertiary);
}
.child-btn-all {
  border-style: dashed;
}

/* Streaming indicator */
.streaming-dot {
  display: inline-block;
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: var(--accent);
  margin: 0 2px;
  animation: pulse 1.2s ease-in-out infinite;
}
.streaming-dot:nth-child(2) { animation-delay: .2s; }
.streaming-dot:nth-child(3) { animation-delay: .4s; }
