:root {
  --primary: #cc2a2a;
  --primary-dark: #a81f1f;
  --secondary: #8b1f1f;
  --text-main: #1f2937;
  --text-muted: #64748b;
  --surface: #ffffff;
  --surface-soft: #f8fafc;
  --border: #e2e8f0;
}

body {
  margin: 0;
  font-family: "Cairo", "Segoe UI", Tahoma, Arial, sans-serif;
  background:
    radial-gradient(circle at 10% 10%, rgba(204, 42, 42, 0.12), transparent 28%),
    radial-gradient(circle at 90% 0%, rgba(139, 31, 31, 0.14), transparent 30%),
    linear-gradient(180deg, #f8fafc 0%, #f1f5f9 100%);
  color: var(--text-main);
  min-height: 100vh;
  overflow-x: hidden;
}

.container {
  width: 100%;
  max-width: 1240px;
  margin: 0 auto;
  box-sizing: border-box;
  padding: 0 22px 32px;
}

.top-header {
  width: 100%;
  margin: 0 0 14px;
  background: var(--surface);
  border-bottom: 1px solid var(--border);
  border-radius: 0;
  box-sizing: border-box;
  box-shadow: 0 10px 26px rgba(15, 23, 42, 0.07);
}

.top-header-inner {
  max-width: 1240px;
  margin: 0 auto;
  padding: 12px 22px;
  box-sizing: border-box;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
}

.brand {
  display: flex;
  align-items: center;
  gap: 10px;
  min-width: 0;
}

.logo {
  width: 120px;
  height: 120px;
  border-radius: 16px;
  object-fit: contain;
  background: #fff;
  border: 1px solid #f1f5f9;
  padding: 5px;
}

h1,
h2 {
  margin: 0 0 8px;
}

.brand-text h1 {
  margin: 0;
  font-size: 22px;
  line-height: 1.2;
  color: #111827;
}

.brand-text p {
  margin: 0;
  font-size: 13px;
  color: var(--text-muted);
}

.tabs {
  display: flex;
  gap: 6px;
  padding: 7px;
  border-radius: 14px;
  background: var(--surface-soft);
  border: 1px solid var(--border);
  flex-wrap: wrap;
  align-items: stretch;
}

a.tab-btn.tab-link {
  text-decoration: none;
  color: #334155;
  align-items: center;
  display: inline-flex;
}

.tab-btn {
  margin: 0;
  margin-top: 0;
  background: transparent;
  color: #334155;
  border: 1px solid transparent;
  border-radius: 11px;
  padding: 10px 14px;
  font-family: "Cairo", "Segoe UI", Tahoma, Arial, sans-serif;
  font-size: 13px;
  font-weight: 600;
  letter-spacing: 0.02em;
  line-height: 1.45;
  white-space: nowrap;
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
  cursor: pointer;
  transition:
    background 0.18s ease,
    color 0.18s ease,
    border-color 0.18s ease,
    box-shadow 0.18s ease,
    transform 0.15s ease;
}

.tab-btn:hover {
  background: #eef2f7;
  color: #0f172a;
}

.tab-btn:focus-visible {
  outline: none;
  box-shadow: 0 0 0 3px rgba(204, 42, 42, 0.28);
}

.tab-btn.active {
  font-weight: 800;
  letter-spacing: 0.025em;
  background: linear-gradient(125deg, var(--primary), var(--secondary));
  color: #ffffff;
  border-color: rgba(107, 21, 21, 0.35);
  box-shadow:
    0 6px 16px rgba(139, 31, 31, 0.26),
    inset 0 1px 0 rgba(255, 255, 255, 0.15);
}

.tab-panel {
  display: none;
  max-width: 1100px;
  margin: 0 auto;
}

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

.ingest-lead {
  font-size: 14px;
  color: #475569;
  line-height: 1.75;
  margin: 0 0 14px;
}

.ingest-lead code {
  font-size: 12px;
  background: #f1f5f9;
  padding: 2px 6px;
  border-radius: 6px;
}

.ingest-mode-badge {
  font-size: 11px;
  font-weight: 800;
  color: var(--primary-dark);
  background: rgba(204, 42, 42, 0.1);
  border: 1px solid rgba(204, 42, 42, 0.25);
  padding: 4px 10px;
  border-radius: 999px;
}

.ingest-body-label {
  display: block;
  font-size: 14px;
  font-weight: 700;
  color: #334155;
  margin-top: 12px;
  margin-bottom: 4px;
}

.ingest-body-label:first-of-type {
  margin-top: 0;
}

.ingest-title-input {
  margin-bottom: 4px;
}

.ingest-actions {
  margin-top: 14px;
}

.ingest-actions button {
  margin-top: 8px;
}

.csv-import-hint {
  margin: 6px 0 10px;
}

.chat-card,
.ingest-card,
.data-card,
.answer-card,
.sources-card,
.resources-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 14px;
  padding: 18px;
  margin-bottom: 14px;
  box-shadow: 0 8px 24px rgba(15, 23, 42, 0.06);
}

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

.hint {
  font-size: 12px;
  color: var(--text-muted);
}

textarea,
input[type="url"],
input[type="password"],
input[type="text"] {
  width: 100%;
  margin-top: 8px;
  margin-bottom: 10px;
  border: 1px solid #d1d5db;
  border-radius: 10px;
  padding: 11px 12px;
  font-size: 15px;
  box-sizing: border-box;
  transition: border-color 0.2s ease, box-shadow 0.2s ease;
  font-family: inherit;
}

textarea {
  resize: vertical;
}

textarea:focus,
input[type="url"]:focus,
input[type="password"]:focus,
input[type="text"]:focus {
  outline: none;
  border-color: var(--primary);
  box-shadow: 0 0 0 3px rgba(204, 42, 42, 0.12);
}

.action-row {
  display: flex;
  justify-content: flex-start;
}

.inline-actions {
  display: flex;
  gap: 8px;
  align-items: center;
}

button {
  margin-top: 10px;
  background: linear-gradient(120deg, var(--primary), var(--secondary));
  color: #fff;
  border: 0;
  border-radius: 10px;
  padding: 10px 18px;
  cursor: pointer;
  font-size: 15px;
  font-weight: 700;
  transition: transform 0.12s ease, box-shadow 0.12s ease, filter 0.12s ease;
}

button:hover:not(:disabled) {
  filter: brightness(0.98);
  box-shadow: 0 10px 22px rgba(139, 31, 31, 0.28);
  transform: translateY(-1px);
}

.danger-btn {
  background: linear-gradient(120deg, #dc2626, #b91c1c);
}

.danger-btn:hover:not(:disabled) {
  box-shadow: 0 10px 22px rgba(185, 28, 28, 0.28);
}

button:disabled {
  opacity: 0.7;
  cursor: wait;
}

#answer {
  white-space: pre-wrap;
  line-height: 1.9;
  min-height: 80px;
}

.answer-audio-row {
  margin-top: 12px;
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
}

.audio-control-card {
  margin-top: 14px;
  padding: 12px;
  border: 1px solid #e2e8f0;
  border-radius: 12px;
  background: #f8fafc;
}

/* TTS tab — إعدادات الصوت */
.tts-settings-card {
  margin-top: 16px;
  padding: 18px 20px 20px;
  border-radius: 16px;
  border: 1px solid #e2e8f0;
  background: linear-gradient(165deg, #ffffff 0%, #f8fafc 55%, #f1f5f9 100%);
  box-shadow:
    0 1px 0 rgba(255, 255, 255, 0.9) inset,
    0 8px 28px rgba(15, 23, 42, 0.07);
}

.tts-settings-card .audio-card-header {
  padding-bottom: 14px;
  margin-bottom: 2px;
  border-bottom: 1px solid #e8ecf1;
}

.tts-settings-card .audio-card-header h3 {
  margin: 0;
  font-size: 17px;
  font-weight: 800;
  letter-spacing: -0.02em;
  color: #0f172a;
}

.tts-settings-card .voice-choice-row {
  margin-top: 16px;
  padding: 12px 14px;
  display: flex;
  align-items: center;
  gap: 12px;
  flex-wrap: wrap;
  background: #fff;
  border: 1px solid #e8ecf1;
  border-radius: 12px;
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.75);
}

.tts-settings-card .voice-choice-row label {
  font-size: 13px;
  font-weight: 700;
  color: #475569;
  flex-shrink: 0;
}

.tts-settings-card .voice-choice-row select {
  flex: 1;
  min-width: min(100%, 200px);
  border: 1px solid #cbd5e1;
  border-radius: 10px;
  padding: 10px 12px;
  font-size: 14px;
  font-family: inherit;
  background: #fafbfc;
  color: #0f172a;
  transition:
    border-color 0.15s ease,
    box-shadow 0.15s ease;
}

.tts-settings-card .voice-choice-row select:focus {
  outline: none;
  border-color: #94a3b8;
  background: #fff;
  box-shadow: 0 0 0 3px rgba(148, 163, 184, 0.28);
}

.tts-play-row {
  margin-top: 16px;
}

.tts-play-btn {
  margin-top: 0;
  font-weight: 700;
  padding: 10px 18px;
  border-radius: 10px;
  border: none;
  background: linear-gradient(135deg, #0f766e, #0d9488);
  color: #fff;
  box-shadow: 0 4px 14px rgba(13, 148, 136, 0.35);
  cursor: pointer;
  transition:
    transform 0.12s ease,
    box-shadow 0.12s ease;
}

.tts-play-btn:hover:not(:disabled) {
  filter: none;
  transform: translateY(-1px);
  box-shadow: 0 6px 18px rgba(13, 148, 136, 0.4);
}

.tts-play-btn:active:not(:disabled) {
  transform: translateY(0);
}

.tts-pause-btn {
  margin-top: 0;
  font-weight: 700;
  padding: 10px 18px;
  border-radius: 10px;
  border: 1px solid #cbd5e1;
  background: #fff;
  color: #334155;
  box-shadow: 0 1px 3px rgba(15, 23, 42, 0.08);
  cursor: pointer;
  transition:
    transform 0.12s ease,
    background 0.12s ease,
    border-color 0.12s ease;
}

.tts-pause-btn:hover:not(:disabled) {
  background: #f1f5f9;
  border-color: #94a3b8;
}

.tts-pause-btn:active:not(:disabled) {
  transform: translateY(1px);
}

.tts-status-pill {
  min-height: 32px;
  min-width: 12px;
  display: inline-flex;
  align-items: center;
}

.audio-card-header {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 8px;
}

.audio-card-header h3 {
  margin: 0;
  font-size: 16px;
}

.voice-choice-row {
  margin-top: 14px;
  display: flex;
  align-items: center;
  gap: 8px;
}

.voice-choice-row label {
  font-size: 14px;
  color: #334155;
}

.voice-choice-row select {
  border: 1px solid #d1d5db;
  border-radius: 10px;
  padding: 8px 10px;
  font-size: 14px;
  font-family: inherit;
  background: #fff;
}

.audio-status {
  font-size: 13px;
  border: 1px solid transparent;
  border-radius: 999px;
  padding: 5px 10px;
}

.audio-neutral {
  color: #475569;
  background: #f1f5f9;
  border-color: #e2e8f0;
}

.audio-loading {
  color: #9a3412;
  background: #fff7ed;
  border-color: #fed7aa;
}

.audio-success {
  color: #166534;
  background: #f0fdf4;
  border-color: #bbf7d0;
}

.audio-error {
  color: #991b1b;
  background: #fef2f2;
  border-color: #fecaca;
}

#answerAudio {
  margin-top: 8px;
  width: 100%;
}

#ttsAudio {
  margin-top: 8px;
  width: 100%;
}

.tts-history-wrap {
  margin-top: 20px;
  padding-top: 16px;
  border-top: 1px solid #e2e8f0;
}

.tts-history-toolbar {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  margin-bottom: 6px;
}

.tts-history-title {
  margin: 0;
  font-size: 1.05rem;
  font-weight: 700;
  color: var(--text, #0f172a);
}

.tts-history-clear-btn {
  margin-top: 0;
  padding: 8px 14px;
  font-size: 13px;
  font-weight: 700;
  background: #f1f5f9;
  color: #475569;
  border: 1px solid #e2e8f0;
  box-shadow: none;
}

.tts-history-clear-btn:hover:not(:disabled) {
  background: #e2e8f0;
}

.tts-history-hint {
  margin-top: 0;
  margin-bottom: 12px;
  font-size: 0.88rem;
}

.tts-history-row {
  display: flex;
  flex-wrap: wrap;
  align-items: flex-start;
  justify-content: space-between;
  gap: 12px;
  padding: 12px 14px;
  border: 1px solid var(--border, #e2e8f0);
  border-radius: 12px;
  background: #fff;
}

.tts-history-row-main {
  flex: 1;
  min-width: 0;
}

.tts-history-meta {
  font-size: 12px;
  font-weight: 600;
  color: var(--text-muted, #64748b);
  margin-bottom: 6px;
}

.tts-history-text {
  margin: 0;
  font-size: 14px;
  line-height: 1.55;
  color: #0f172a;
  word-break: break-word;
  white-space: pre-wrap;
}

.tts-history-actions {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px;
  flex-shrink: 0;
}

#clonePreviewAudio {
  margin-top: 8px;
  width: 100%;
}

.clone-preview-hint {
  margin-top: 10px;
  margin-bottom: 0;
}

.transcribe-card {
  margin-top: 14px;
}

.transcribe-card .transcribe-result {
  width: 100%;
  box-sizing: border-box;
  min-height: 9rem;
  margin-top: 6px;
  font-size: 0.95rem;
}

.transcribe-dual-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 14px 18px;
  margin-top: 4px;
}

@media (max-width: 768px) {
  .transcribe-dual-grid {
    grid-template-columns: 1fr;
  }
}

.transcribe-dual-cell label {
  font-weight: 600;
  font-size: 0.9rem;
}

.transcribe-result--refined {
  background: var(--surface-alt, #f8fafc);
}

.clone-voices-card {
  margin-top: 14px;
}

.fanar-preview-text {
  margin-top: 8px;
  margin-bottom: 8px;
}

#fanarVoicesPreviewAudio {
  margin-top: 6px;
  width: 100%;
}

.fanar-voices-list {
  margin: 12px 0 0;
  padding: 0;
  list-style: none;
}

.fanar-voices-list li.fanar-voice-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  margin-bottom: 8px;
  padding: 8px 10px;
  border: 1px solid var(--border);
  border-radius: 10px;
  background: #fff;
}

.fanar-voice-name {
  font-size: 15px;
  line-height: 1.5;
  word-break: break-word;
  flex: 1;
  min-width: 0;
}

.fanar-voice-actions {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px;
  flex-shrink: 0;
}

button.voice-delete-btn {
  padding: 8px 12px;
  font-size: 13px;
}

button.voice-play-btn {
  margin-top: 0;
  flex-shrink: 0;
  padding: 8px 12px;
  font-size: 13px;
  background: linear-gradient(120deg, #334155, #1e293b);
  box-shadow: none;
}

button.voice-play-btn:hover:not(:disabled) {
  box-shadow: 0 6px 14px rgba(30, 41, 59, 0.25);
}

#sources {
  margin: 0;
  padding-right: 18px;
}

#sources li {
  margin-bottom: 8px;
}

#sources a {
  color: var(--primary-dark);
  text-decoration: none;
}

.source-snippets {
  margin-top: 6px;
  display: grid;
  gap: 4px;
}

.source-snippet {
  font-size: 13px;
  color: #475569;
  line-height: 1.6;
  background: #f8fafc;
  border: 1px solid #e2e8f0;
  border-radius: 8px;
  padding: 6px 8px;
}

.retrieval-resources-root {
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.retrieval-resource-card {
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 12px 14px;
  background: rgba(255, 255, 255, 0.55);
}

.retrieval-resource-meta {
  font-size: 13px;
  color: var(--text-muted);
  margin-bottom: 8px;
  line-height: 1.6;
}

.retrieval-resource-meta strong {
  color: var(--text);
  font-weight: 600;
}

.retrieval-resource-meta a {
  color: #2563eb;
  word-break: break-all;
}

.retrieval-resource-preview {
  margin: 0;
  padding: 10px 12px;
  background: #f8fafc;
  border-radius: 8px;
  font-size: 13px;
  line-height: 1.65;
  white-space: pre-wrap;
  max-height: 280px;
  overflow: auto;
  border: 1px solid #e2e8f0;
}

#ingestStatus {
  margin-top: 10px;
  font-size: 14px;
  padding: 10px 12px;
  border-radius: 10px;
}

.status-neutral {
  color: #334155;
  background: #f8fafc;
  border: 1px solid #e2e8f0;
}

.status-loading {
  color: #7f1d1d;
  background: #fff7ed;
  border: 1px solid #fed7aa;
}

.status-success {
  color: #166534;
  background: #f0fdf4;
  border: 1px solid #bbf7d0;
}

.status-error {
  color: #991b1b;
  background: #fef2f2;
  border: 1px solid #fecaca;
}

.stored-data-list {
  margin-top: 14px;
  display: grid;
  gap: 12px;
}

/* Article cards — stored data tab */
.stored-card {
  border: 1px solid var(--border);
  border-radius: 14px;
  background: linear-gradient(145deg, #ffffff 0%, #fafbfc 100%);
  box-shadow: 0 4px 14px rgba(15, 23, 42, 0.06);
  overflow: hidden;
  transition: box-shadow 0.2s ease, border-color 0.2s ease;
}

.stored-card:hover {
  border-color: #cbd5e1;
  box-shadow: 0 8px 22px rgba(15, 23, 42, 0.09);
}

.stored-card[open] {
  border-color: rgba(204, 42, 42, 0.35);
  box-shadow: 0 10px 28px rgba(139, 31, 31, 0.12);
}

.stored-summary {
  list-style: none;
  cursor: pointer;
  padding: 14px 16px;
  display: flex;
  align-items: flex-start;
  gap: 12px;
  flex-wrap: wrap;
}

.stored-summary::-webkit-details-marker {
  display: none;
}

.stored-summary::before {
  content: "";
  width: 9px;
  height: 9px;
  margin-top: 8px;
  border-inline-end: 2px solid #64748b;
  border-block-end: 2px solid #64748b;
  transform: rotate(-45deg);
  flex-shrink: 0;
  transition: transform 0.22s ease;
}

.stored-card[open] .stored-summary::before {
  transform: rotate(45deg);
  margin-top: 6px;
}

.stored-chunk-badge {
  flex-shrink: 0;
  font-size: 12px;
  font-weight: 700;
  color: var(--primary-dark);
  background: linear-gradient(135deg, rgba(204, 42, 42, 0.12), rgba(139, 31, 31, 0.08));
  border: 1px solid rgba(204, 42, 42, 0.25);
  padding: 5px 10px;
  border-radius: 999px;
  white-space: nowrap;
}

.stored-summary-text {
  flex: 1;
  min-width: 0;
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.stored-title {
  font-weight: 800;
  font-size: 16px;
  line-height: 1.45;
  color: #0f172a;
  word-break: break-word;
}

.stored-subtitle {
  font-size: 13px;
  color: var(--text-muted);
  font-weight: 600;
  line-height: 1.5;
  word-break: break-word;
}

.stored-issue-line {
  font-size: 13px;
  font-weight: 700;
  color: #0f172a;
  margin-top: 2px;
  line-height: 1.5;
  word-break: break-word;
}

.stored-link-block {
  margin-bottom: 12px;
  padding: 12px 14px;
  background: #ffffff;
  border: 1px solid #e8ecf1;
  border-radius: 10px;
  font-size: 13px;
}

.stored-link-block-label {
  display: block;
  font-size: 12px;
  font-weight: 700;
  color: var(--text-muted);
  margin-bottom: 6px;
}

.stored-link-block a {
  font-weight: 600;
  color: var(--primary-dark);
  word-break: break-all;
}

.stored-id-text {
  font-family: ui-monospace, monospace;
  font-size: 12px;
  color: #475569;
  word-break: break-all;
}

.stored-panel {
  padding: 0 16px 16px;
  border-top: 1px solid #eef2f7;
  background: rgba(248, 250, 252, 0.65);
}

.stored-meta-grid {
  display: grid;
  grid-template-columns: auto 1fr;
  gap: 6px 14px;
  margin: 0 0 12px;
  padding: 12px 14px;
  background: #ffffff;
  border: 1px solid #e8ecf1;
  border-radius: 10px;
  font-size: 13px;
}

.stored-meta-grid dt {
  margin: 0;
  color: var(--text-muted);
  font-weight: 600;
}

.stored-meta-grid dd {
  margin: 0;
  color: #1e293b;
  font-weight: 600;
  word-break: break-word;
}

.stored-body {
  color: #334155;
  font-size: 14px;
  line-height: 1.85;
  white-space: pre-wrap;
  margin-bottom: 12px;
  padding: 14px 16px;
  background: #ffffff;
  border: 1px solid #e8ecf1;
  border-radius: 10px;
  max-height: 320px;
  overflow-y: auto;
}

.stored-source-row {
  display: flex;
  flex-wrap: wrap;
  align-items: baseline;
  gap: 8px 12px;
  padding-top: 4px;
}

.stored-source-label {
  font-size: 12px;
  font-weight: 700;
  color: var(--text-muted);
}

.stored-source-link {
  font-size: 13px;
  font-weight: 600;
  color: var(--primary-dark);
  text-decoration: none;
  word-break: break-all;
  padding: 4px 0;
  border-bottom: 1px dashed rgba(168, 31, 31, 0.35);
  transition: color 0.15s ease, border-color 0.15s ease;
}

.stored-source-link:hover {
  color: var(--primary);
  border-bottom-color: var(--primary);
}

.stored-empty {
  text-align: center;
  padding: 28px 18px;
  border: 1px dashed #cbd5e1;
  border-radius: 14px;
  background: linear-gradient(180deg, #f8fafc 0%, #f1f5f9 100%);
}

.stored-empty-title {
  margin: 0 0 8px;
  font-size: 16px;
  font-weight: 800;
  color: #334155;
}

.stored-empty-hint {
  margin: 0;
  font-size: 13px;
  color: var(--text-muted);
  line-height: 1.6;
}

.stored-empty-error {
  border-color: #fecaca;
  background: linear-gradient(180deg, #fef2f2 0%, #fff1f2 100%);
}

.stored-empty-error .stored-empty-title {
  color: #991b1b;
}

/* Legacy class — keep for any inline HTML still using it */
.stored-item {
  border: 1px solid #e2e8f0;
  border-radius: 10px;
  padding: 10px 12px;
  background: #ffffff;
}

.json-result {
  margin-top: 12px;
  background: #0f172a;
  color: #e2e8f0;
  border-radius: 10px;
  padding: 10px 12px;
  font-size: 12px;
  line-height: 1.5;
  overflow-x: auto;
  white-space: pre-wrap;
  word-break: break-word;
}

/* Header/layout breakpoints: see responsive.css */

@media (max-width: 720px) {
  .stored-summary {
    padding: 12px 14px;
  }

  .stored-chunk-badge {
    font-size: 11px;
    padding: 4px 8px;
  }

  .stored-title {
    font-size: 15px;
  }

  .stored-body {
    max-height: 180px;
    font-size: 13px;
  }

  .section-title-row {
    flex-direction: column;
    align-items: flex-start;
  }

  .stored-meta-grid {
    grid-template-columns: 1fr;
  }

  .stored-link-block a {
    word-break: break-all;
  }
}

/* History tab cards (shared eval-* layout classes) */
.eval-card {
  background: #ffffff;
  border: 1px solid #e2e8f0;
  border-radius: 14px;
  padding: 20px 22px;
  margin-bottom: 18px;
}

.eval-card h2 {
  margin: 0 0 10px;
  font-size: 20px;
}

.eval-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  align-items: center;
  margin-bottom: 14px;
}

.eval-results-list {
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.eval-result-card {
  border: 1px solid #e2e8f0;
  border-radius: 12px;
  overflow: hidden;
  background: #fafafa;
}

.eval-result-card summary {
  cursor: pointer;
  list-style: none;
  padding: 12px 14px;
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  align-items: center;
  font-weight: 700;
  background: #fff;
  border-bottom: 1px solid #f1f5f9;
}

.eval-result-card summary::-webkit-details-marker {
  display: none;
}

.eval-result-q {
  flex: 1;
  min-width: 200px;
  font-size: 14px;
}

.history-meta {
  font-size: 12px;
  font-weight: 600;
  color: var(--text-muted);
  white-space: nowrap;
}

.history-answer-tag {
  font-size: 11px;
  font-weight: 800;
  padding: 4px 10px;
  border-radius: 999px;
  white-space: nowrap;
}

.history-answer-tag--answered {
  background: #dcfce7;
  color: #166534;
}

.history-answer-tag--no_info {
  background: #fef3c7;
  color: #92400e;
}

.history-answer-tag--empty {
  background: #e2e8f0;
  color: #475569;
}

.history-channel-tag {
  font-size: 11px;
  font-weight: 800;
  padding: 4px 10px;
  border-radius: 999px;
  white-space: nowrap;
}

.history-channel-tag--text {
  background: #e0e7ff;
  color: #3730a3;
}

.history-channel-tag--voice {
  background: #fce7f3;
  color: #9d174d;
}

.history-entry-card--voice {
  border-inline-start: 4px solid #db2777;
}

.history-entry-card--text {
  border-inline-start: 4px solid #4f46e5;
}

.history-stt-raw {
  margin: 0 0 10px;
  padding: 8px 10px;
  font-size: 13px;
  line-height: 1.5;
  color: #64748b;
  background: #f8fafc;
  border-radius: 8px;
  border: 1px solid #e2e8f0;
}

.history-answer-text {
  margin: 0;
  white-space: pre-wrap;
}

.history-delete-btn {
  margin-inline-start: auto;
  flex-shrink: 0;
  font-size: 12px;
  font-weight: 700;
  padding: 6px 12px;
  border-radius: 8px;
  border: 1px solid #fecaca;
  background: #fff;
  color: #b91c1c;
  cursor: pointer;
}

.history-delete-btn:hover:not(:disabled) {
  background: #fef2f2;
}

.history-delete-btn:disabled {
  opacity: 0.6;
  cursor: not-allowed;
}

.history-sources-label {
  font-weight: 700;
  margin-bottom: 4px;
  color: #475569;
}

.eval-result-body {
  padding: 12px 14px 14px;
  font-size: 13px;
  line-height: 1.75;
  color: #334155;
  white-space: pre-wrap;
  word-break: break-word;
  max-height: 320px;
  overflow-y: auto;
}

.eval-result-sources {
  margin-top: 10px;
  font-size: 12px;
  color: var(--text-muted);
}

.eval-result-sources ul {
  margin: 6px 0 0;
  padding-inline-start: 18px;
}
