/* ── Reset & Base ─────────────────────────────────────────────────────────── */
@import url('https://fonts.googleapis.com/css2?family=Inter:wght@400;500;600;700&display=swap');

*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

:root {
  --bg:          #f4f6fb;
  --surface:     #ffffff;
  --surface2:    #f0f2f8;
  --surface3:    #e6eaf4;
  --border:      #e3e7f2;
  --border2:     #c9d0e8;
  --text:        #1a1f36;
  --text-muted:  #6b748f;
  --text-dim:    #9fa8c0;
  --accent:      #5b5cf6;
  --accent-hover:#4a4be0;
  --accent-dim:  rgba(91,92,246,0.09);
  --success:     #16a34a;
  --warning:     #d97706;
  --error:       #dc2626;
  --info:        #2563eb;
  --shadow-sm:   0 1px 3px rgba(26,31,54,0.07), 0 1px 2px rgba(26,31,54,0.04);
  --shadow-md:   0 4px 12px rgba(26,31,54,0.09), 0 2px 4px rgba(26,31,54,0.05);
  --shadow-lg:   0 16px 40px rgba(26,31,54,0.13), 0 4px 12px rgba(26,31,54,0.07);
  --radius:      12px;
  --font:        'Inter', system-ui, -apple-system, sans-serif;
  --font-mono:   'JetBrains Mono', 'Fira Code', 'Cascadia Code', monospace;
}

body {
  background: var(--bg);
  color: var(--text);
  font-family: var(--font);
  font-size: 14px;
  line-height: 1.55;
  height: 100vh;
  overflow: hidden;
  -webkit-font-smoothing: antialiased;
}

/* ── Layout ───────────────────────────────────────────────────────────────── */
#app { display: block; height: 100vh; overflow: hidden; }

.sidebar {
  position: fixed;
  top: 0;
  left: 0;
  width: 228px;
  height: 100vh;
  background: var(--surface);
  border-right: 1px solid var(--border);
  display: flex;
  flex-direction: column;
  padding: 1.5rem 0.875rem 1rem;
  box-shadow: 2px 0 12px rgba(26,31,54,0.04);
  z-index: 50;
  transition: transform 0.22s ease;
}

.logo {
  display: flex;
  align-items: center;
  gap: 0.6rem;
  padding: 0 0.625rem;
  margin-bottom: 1.75rem;
}
.logo-icon { font-size: 1.55rem; }
.logo-text {
  font-size: 1.05rem;
  font-weight: 800;
  background: linear-gradient(135deg, var(--accent) 0%, #818cf8 100%);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
  letter-spacing: -0.02em;
}

nav { display: flex; flex-direction: column; gap: 0.2rem; flex: 1; }

.nav-item {
  display: flex;
  align-items: center;
  gap: 0.6rem;
  padding: 0.6rem 0.75rem;
  border-radius: 9px;
  color: var(--text-muted);
  text-decoration: none;
  font-weight: 500;
  font-size: 0.875rem;
  transition: background 0.13s, color 0.13s;
  letter-spacing: -0.01em;
}
.nav-item:hover { background: var(--surface2); color: var(--text); }
.nav-item.active {
  background: var(--accent-dim);
  color: var(--accent);
  font-weight: 600;
}
.nav-icon { font-size: 1rem; }

.sidebar-footer {
  padding: 0.75rem 0.625rem 0;
  border-top: 1px solid var(--border);
  margin-top: 0.5rem;
}

/* ── WebSocket indicator ───────────────────────────────────────────────────── */
.ws-indicator {
  display: flex;
  align-items: center;
  gap: 0.45rem;
  font-size: 0.73rem;
  color: var(--text-dim);
  font-weight: 500;
}
.ws-dot {
  width: 7px; height: 7px;
  border-radius: 50%;
  background: var(--text-dim);
  flex-shrink: 0;
}
.ws-indicator.connected .ws-dot    { background: var(--success); }
.ws-indicator.disconnected .ws-dot { background: var(--text-dim); }
.ws-indicator.connected .ws-label  { color: var(--success); }

/* ── Main ─────────────────────────────────────────────────────────────────── */
.main { margin-left: 228px; height: 100vh; overflow-y: auto; padding: 2rem 2.5rem; }

/* ── Pages ────────────────────────────────────────────────────────────────── */
.page { display: none; }
.page.active { display: block; }

.page-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  margin-bottom: 1.5rem;
  gap: 1rem;
}

h1 { font-size: 1.45rem; font-weight: 700; letter-spacing: -0.02em; color: var(--text); }
h3 { font-size: 0.95rem; font-weight: 600; color: var(--text); }
.subtitle { color: var(--text-muted); margin-top: 0.25rem; font-size: 0.85rem; }

/* ── Cards ────────────────────────────────────────────────────────────────── */
.card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 1.25rem;
  box-shadow: var(--shadow-sm);
}

.card-toolbar {
  display: flex;
  gap: 0.75rem;
  margin-bottom: 1rem;
  align-items: center;
  flex-wrap: wrap;
}

/* ── Stats ────────────────────────────────────────────────────────────────── */
.stats-bar {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 1rem;
  margin-bottom: 1.5rem;
}

.stat-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 1.1rem 1.25rem;
  text-align: center;
  box-shadow: var(--shadow-sm);
  transition: box-shadow 0.15s, border-color 0.15s, transform 0.15s;
}
.stat-card:hover {
  border-color: var(--accent);
  box-shadow: 0 4px 16px rgba(91,92,246,0.12);
  transform: translateY(-1px);
}
.stat-value { font-size: 1.8rem; font-weight: 800; color: var(--accent); letter-spacing: -0.03em; line-height: 1.1; }
.stat-label { font-size: 0.7rem; color: var(--text-muted); margin-top: 0.3rem; text-transform: uppercase; letter-spacing: 0.07em; font-weight: 600; }

/* ── Filter buttons ───────────────────────────────────────────────────────── */
.filter-group { display: flex; gap: 0.3rem; flex-wrap: wrap; }

.filter-btn {
  padding: 0.3rem 0.8rem;
  border-radius: 7px;
  border: 1px solid var(--border);
  background: var(--surface);
  color: var(--text-muted);
  font-size: 0.8rem;
  font-weight: 500;
  cursor: pointer;
  transition: all 0.13s;
  box-shadow: var(--shadow-sm);
}
.filter-btn:hover { border-color: var(--border2); color: var(--text); background: var(--surface2); }
.filter-btn.active { background: var(--accent); border-color: var(--accent); color: #fff; box-shadow: 0 2px 8px rgba(91,92,246,0.28); }

/* ── Reports list ─────────────────────────────────────────────────────────── */
.bot-list { display: flex; flex-direction: column; gap: 0; }

.report-card {
  padding: 1rem 1.25rem;
  border-bottom: 1px solid var(--border);
  cursor: pointer;
  transition: background 0.12s;
}
.report-card:first-child  { border-radius: 8px 8px 0 0; }
.report-card:last-child   { border-bottom: none; border-radius: 0 0 8px 8px; }
.report-card:only-child   { border-radius: 8px; border-bottom: none; }
.report-card:hover { background: #f7f8fd; }

.report-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.75rem;
  margin-bottom: 0.3rem;
}
.report-platform { display: flex; align-items: center; gap: 0.4rem; }
.report-platform-icon { font-size: 1rem; }
.report-platform-name {
  font-size: 0.7rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--text-muted);
}
.report-header-right {
  display: flex;
  align-items: center;
  gap: 0.4rem;
  flex-shrink: 0;
}
.report-url {
  font-family: var(--font-mono);
  font-size: 0.77rem;
  color: var(--text-muted);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  margin-bottom: 0.35rem;
}
.report-stats {
  font-size: 0.74rem;
  color: var(--text-dim);
  margin-bottom: 0.35rem;
}
.report-summary {
  font-size: 0.82rem;
  color: var(--text-muted);
  line-height: 1.45;
  padding: 0.4rem 0.65rem;
  background: var(--surface2);
  border-left: 2px solid var(--accent);
  border-radius: 0 6px 6px 0;
  margin-top: 0.35rem;
}
.report-error {
  font-size: 0.78rem;
  color: var(--error);
  background: rgba(220,38,38,0.06);
  border-radius: 6px;
  padding: 0.25rem 0.6rem;
  margin-top: 0.3rem;
  border: 1px solid rgba(220,38,38,0.12);
}

/* ── Transcript toolbar ───────────────────────────────────────────────────── */
.transcript-toolbar {
  display: flex;
  gap: 0.5rem;
  align-items: center;
  padding: 0.5rem 0 0.75rem;
  flex-wrap: wrap;
}

/* ── Status badges ────────────────────────────────────────────────────────── */
.badge {
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
  padding: 0.22rem 0.65rem;
  border-radius: 999px;
  font-size: 0.7rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  white-space: nowrap;
}
.badge::before {
  content: '';
  width: 5px; height: 5px;
  border-radius: 50%;
  background: currentColor;
  flex-shrink: 0;
}

.badge-ready      { background: rgba(100,116,139,0.1);  color: #64748b; }
.badge-joining    { background: rgba(37,99,235,0.1);   color: var(--info); }
.badge-in_call    { background: rgba(22,163,74,0.12);  color: var(--success); }
.badge-call_ended { background: rgba(217,119,6,0.12);  color: var(--warning); }
.badge-done       { background: rgba(22,163,74,0.1);   color: var(--success); }
.badge-error      { background: rgba(220,38,38,0.1);   color: var(--error); }
.badge-demo       { background: rgba(217,119,6,0.1);   color: var(--warning); }
.badge-scheduled  { background: rgba(91,92,246,0.1);   color: var(--accent); }
.badge-cancelled  { background: rgba(100,116,139,0.1); color: #64748b; }

.badge-joining::before,
.badge-in_call::before { animation: blink 1.5s ease-in-out infinite; }
@keyframes blink { 0%,100%{opacity:1} 50%{opacity:0.3} }

/* ── Lifecycle progress ────────────────────────────────────────────────────── */
.lifecycle-card { margin-bottom: 1.25rem; padding: 1.1rem 1.5rem; }

.lifecycle-steps {
  display: flex;
  align-items: center;
  position: relative;
}

.lifecycle-step {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0.4rem;
  flex: 1;
  position: relative;
}
.lifecycle-step::before {
  content: '';
  position: absolute;
  top: 14px;
  left: -50%; right: 50%;
  height: 2px;
  background: var(--border);
  z-index: 0;
}
.lifecycle-step:first-child::before { display: none; }
.lifecycle-step.done::before   { background: var(--success); }
.lifecycle-step.active::before { background: linear-gradient(to right, var(--success), var(--accent)); }

.step-dot {
  width: 28px; height: 28px;
  border-radius: 50%;
  border: 2px solid var(--border);
  background: var(--surface2);
  display: flex; align-items: center; justify-content: center;
  font-size: 0.7rem; font-weight: 700;
  position: relative; z-index: 1;
  transition: all 0.3s;
  color: var(--text-muted);
}
.lifecycle-step.done .step-dot {
  border-color: var(--success);
  background: rgba(22,163,74,0.1);
  color: var(--success);
}
.lifecycle-step.active .step-dot {
  border-color: var(--accent);
  background: var(--accent-dim);
  color: var(--accent);
  animation: pulse-ring 1.6s ease-in-out infinite;
}
.lifecycle-step.error .step-dot {
  border-color: var(--error);
  background: rgba(220,38,38,0.08);
  color: var(--error);
}
@keyframes pulse-ring {
  0%,100% { box-shadow: 0 0 0 0 rgba(91,92,246,0.3); }
  50%      { box-shadow: 0 0 0 6px rgba(91,92,246,0); }
}

.step-label {
  font-size: 0.68rem; color: var(--text-muted);
  text-align: center; white-space: nowrap; font-weight: 600;
  text-transform: uppercase; letter-spacing: 0.04em;
}
.lifecycle-step.done .step-label   { color: var(--success); }
.lifecycle-step.active .step-label { color: var(--accent); }
.lifecycle-step.error .step-label  { color: var(--error); }

/* ── Buttons ──────────────────────────────────────────────────────────────── */
.btn {
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
  padding: 0.52rem 1rem;
  border-radius: 9px;
  font-size: 0.875rem;
  font-weight: 600;
  cursor: pointer;
  border: none;
  transition: background 0.13s, box-shadow 0.13s, transform 0.1s, opacity 0.13s;
  white-space: nowrap;
  letter-spacing: -0.01em;
  font-family: inherit;
}
.btn:disabled { opacity: 0.45; cursor: not-allowed; pointer-events: none; }
.btn:active:not(:disabled) { transform: scale(0.98); }

.btn-primary {
  background: var(--accent);
  color: #fff;
  box-shadow: 0 2px 8px rgba(91,92,246,0.28);
}
.btn-primary:hover:not(:disabled) {
  background: var(--accent-hover);
  box-shadow: 0 4px 14px rgba(91,92,246,0.35);
}

.btn-ghost {
  background: var(--surface);
  color: var(--text-muted);
  border: 1px solid var(--border);
  box-shadow: var(--shadow-sm);
}
.btn-ghost:hover:not(:disabled) {
  background: var(--surface2);
  color: var(--text);
  border-color: var(--border2);
}

.btn-danger {
  background: transparent;
  color: var(--error);
  border: 1px solid rgba(220,38,38,0.2);
  font-size: 0.8rem;
  padding: 0.3rem 0.65rem;
}
.btn-danger:hover:not(:disabled) {
  background: rgba(220,38,38,0.07);
  border-color: rgba(220,38,38,0.35);
}
.btn-end-meeting {
  background: var(--error, #dc2626);
  color: #fff;
  border: 1px solid var(--error, #dc2626);
  font-size: 0.8rem;
  padding: 0.3rem 0.75rem;
  font-weight: 600;
}
.btn-end-meeting:hover:not(:disabled) {
  background: #b91c1c;
  border-color: #b91c1c;
}

.btn-icon {
  background: var(--surface);
  border: 1px solid var(--border);
  color: var(--text-muted);
  padding: 0.3rem 0.5rem;
  font-size: 0.85rem;
  border-radius: 7px;
  box-shadow: var(--shadow-sm);
}
.btn-icon:hover { color: var(--text); border-color: var(--border2); background: var(--surface2); }

.btn-sm { padding: 0.3rem 0.7rem; font-size: 0.8rem; }

/* ── Inputs ───────────────────────────────────────────────────────────────── */
.input {
  width: 100%;
  padding: 0.55rem 0.8rem;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 9px;
  color: var(--text);
  font-size: 0.875rem;
  outline: none;
  transition: border-color 0.15s, box-shadow 0.15s;
  font-family: inherit;
  box-shadow: var(--shadow-sm);
}
.input:focus {
  border-color: var(--accent);
  box-shadow: 0 0 0 3px rgba(91,92,246,0.12);
}
.input::placeholder { color: var(--text-dim); }
.input.error { border-color: var(--error); box-shadow: 0 0 0 3px rgba(220,38,38,0.1); }

select.input { cursor: pointer; }

label {
  display: flex;
  flex-direction: column;
  gap: 0.4rem;
  font-size: 0.875rem;
  font-weight: 600;
  margin-bottom: 1rem;
  color: var(--text);
}
.required { color: var(--error); }
.optional { color: var(--text-muted); font-size: 0.78rem; font-weight: 400; }
.hint { font-size: 0.78rem; color: var(--text-muted); font-weight: 400; line-height: 1.55; }
.field-error { font-size: 0.78rem; color: var(--error); font-weight: 500; }
.field-error.hidden { display: none; }

code {
  font-family: var(--font-mono);
  font-size: 0.85em;
  background: var(--surface2);
  padding: 0.1em 0.4em;
  border-radius: 4px;
  color: var(--accent);
  border: 1px solid var(--border);
}

/* ── Event checkboxes ─────────────────────────────────────────────────────── */
.event-fieldset {
  border: 1px solid var(--border);
  border-radius: 9px;
  padding: 0.75rem 1rem 0.5rem;
  margin-bottom: 0;
  background: var(--surface2);
}
.event-fieldset legend {
  padding: 0 0.4rem;
  font-size: 0.8rem;
  color: var(--text-muted);
  font-weight: 600;
}
.checkbox-row {
  display: flex; align-items: center; gap: 0.5rem;
  margin-bottom: 0.4rem; font-weight: 400;
  cursor: pointer; user-select: none; font-size: 0.875rem;
}
.checkbox-row input[type="checkbox"] { accent-color: var(--accent); width: 15px; height: 15px; }
.event-checkbox-list { margin-top: 0.5rem; padding-left: 0.25rem; }
.event-checkbox-list.disabled { opacity: 0.4; pointer-events: none; }

/* ── Modals ───────────────────────────────────────────────────────────────── */
.modal-backdrop {
  position: fixed; inset: 0;
  background: rgba(26,31,54,0.35);
  backdrop-filter: blur(4px);
  display: flex; align-items: center; justify-content: center;
  z-index: 100; padding: 1rem;
}
.modal-backdrop.hidden { display: none; }

.modal {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 16px;
  width: 100%; max-width: 500px;
  box-shadow: var(--shadow-lg);
  max-height: 90vh;
  overflow-y: auto;
}

.modal-header {
  display: flex; align-items: center; justify-content: space-between;
  padding: 1.25rem 1.5rem;
  border-bottom: 1px solid var(--border);
  position: sticky; top: 0;
  background: var(--surface);
  z-index: 1;
  border-radius: 16px 16px 0 0;
}
.modal-header h2 { font-size: 1.05rem; font-weight: 700; }

.modal-close {
  background: var(--surface2); border: 1px solid var(--border);
  color: var(--text-muted); font-size: 0.9rem; cursor: pointer;
  padding: 0.3rem 0.5rem; border-radius: 6px;
  transition: background 0.13s, color 0.13s;
}
.modal-close:hover { background: var(--surface3); color: var(--text); }

.modal-body { padding: 1.5rem; }
.modal-footer {
  display: flex; justify-content: flex-end; gap: 0.75rem;
  padding: 1rem 1.5rem;
  border-top: 1px solid var(--border);
  background: var(--surface2);
  border-radius: 0 0 16px 16px;
}

/* ── Bot Detail ───────────────────────────────────────────────────────────── */
.detail-meta {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 0.75rem;
  margin-bottom: 1.25rem;
}
.meta-item {
  background: var(--surface2);
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 0.75rem 1rem;
}
.meta-label {
  font-size: 0.67rem; color: var(--text-muted);
  text-transform: uppercase; letter-spacing: 0.07em;
  margin-bottom: 0.3rem; font-weight: 700;
}
.meta-value { font-weight: 600; font-size: 0.88rem; }

.section-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 1.25rem;
  margin-bottom: 1.25rem;
  box-shadow: var(--shadow-sm);
}
.section-header {
  display: flex; align-items: center; justify-content: space-between;
  margin-bottom: 1rem;
}

/* ── Modal wide + title group ───────────────────────────────────────────── */
.modal-wide { max-width: 580px; }
.modal-title-group { display: flex; flex-direction: column; gap: 0.15rem; }
.modal-subtitle { font-size: 0.82rem; color: var(--text-muted); font-weight: 400; }

/* ── Form sections ──────────────────────────────────────────────────────── */
.form-section { margin-bottom: 1.4rem; }
.form-section:last-child { margin-bottom: 0; }
.form-section-label {
  font-size: 0.68rem;
  font-weight: 800;
  text-transform: uppercase;
  letter-spacing: 0.09em;
  color: var(--text-dim);
  margin-bottom: 0.75rem;
  padding-bottom: 0.4rem;
  border-bottom: 1px solid var(--border);
}
.form-row {
  display: flex;
  gap: 0.75rem;
  flex-wrap: wrap;
}
.form-row label { flex: 1; min-width: 180px; }

/* ── Analysis mode picker ───────────────────────────────────────────────── */
.mode-picker {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 0.65rem;
}

.mode-card {
  display: flex;
  flex-direction: row;  /* override label { flex-direction: column } */
  align-items: flex-start;
  gap: 0.75rem;
  padding: 0.9rem 1rem;
  border: 1.5px solid var(--border);
  border-radius: 11px;
  cursor: pointer;
  background: var(--surface);
  transition: border-color 0.15s, background 0.15s, box-shadow 0.15s;
  user-select: none;
  position: relative;
  margin-bottom: 0;  /* override label { margin-bottom: 1rem } */
}
.mode-card:hover {
  border-color: var(--border2);
  background: var(--surface2);
}
.mode-card-active {
  border-color: var(--accent);
  background: var(--accent-dim);
  box-shadow: 0 0 0 3px rgba(91,92,246,0.1);
}

.mode-card-icon {
  font-size: 1.25rem;
  flex-shrink: 0;
  margin-top: 1px;
}
.mode-card-body { flex: 1; }
.mode-card-title {
  font-weight: 700;
  font-size: 0.875rem;
  color: var(--text);
  margin-bottom: 0.2rem;
}
.mode-card-active .mode-card-title { color: var(--accent); }
.mode-card-desc {
  font-size: 0.78rem;
  color: var(--text-muted);
  line-height: 1.5;
  font-weight: 400;
}

.mode-card-check {
  width: 18px; height: 18px;
  border-radius: 50%;
  border: 1.5px solid var(--border2);
  background: var(--surface);
  flex-shrink: 0;
  display: flex; align-items: center; justify-content: center;
  font-size: 0.6rem;
  color: transparent;
  transition: all 0.15s;
  margin-top: 1px;
}
.mode-card-active .mode-card-check {
  background: var(--accent);
  border-color: var(--accent);
  color: #fff;
}

/* AI options section collapse */
#ai-options-section {
  transition: opacity 0.2s;
}
#ai-options-section.hidden {
  display: none;
}

/* ── Toggle switch ──────────────────────────────────────────────────────── */
.toggle-row {
  display: flex;
  align-items: center;
  gap: 1rem;
  cursor: pointer;
  user-select: none;
  padding: 0.75rem 1rem;
  border: 1px solid var(--border);
  border-radius: 10px;
  background: var(--surface);
  transition: background 0.13s, border-color 0.13s;
  margin-bottom: 0;
}
.toggle-row:hover { background: var(--surface2); border-color: var(--border2); }

.toggle-row-body { flex: 1; }
.toggle-label { font-weight: 600; font-size: 0.875rem; color: var(--text); margin-bottom: 0.15rem; }
.toggle-desc { font-size: 0.78rem; color: var(--text-muted); line-height: 1.5; font-weight: 400; }

.toggle-track { flex-shrink: 0; position: relative; }
.toggle-input { position: absolute; opacity: 0; width: 0; height: 0; }
.toggle-switch {
  display: block;
  width: 40px; height: 22px;
  border-radius: 11px;
  background: var(--border2);
  position: relative;
  transition: background 0.2s;
  cursor: pointer;
}
.toggle-switch::after {
  content: '';
  position: absolute;
  top: 3px; left: 3px;
  width: 16px; height: 16px;
  border-radius: 50%;
  background: #fff;
  box-shadow: 0 1px 3px rgba(0,0,0,0.2);
  transition: transform 0.2s, box-shadow 0.2s;
}
.toggle-input:checked ~ .toggle-switch {
  background: var(--accent);
}
.toggle-input:checked ~ .toggle-switch::after {
  transform: translateX(18px);
  box-shadow: 0 1px 4px rgba(91,92,246,0.35);
}

/* ── Response-mode pill row (text / voice / both) ──────────────────────── */
.response-mode-row {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  padding: 0.6rem 1rem 0.6rem 1.25rem;
  border: 1px solid var(--border);
  border-top: none;
  border-radius: 0 0 10px 10px;
  background: var(--surface);
  margin-top: -10px;  /* visually attach to toggle row above */
}
.response-mode-label {
  font-size: 0.78rem;
  color: var(--text-muted);
  white-space: nowrap;
  min-width: 4.5rem;
}
.response-mode-options {
  display: flex;
  gap: 0.4rem;
  flex-wrap: wrap;
}
.mode-pill {
  display: inline-flex;
  flex-direction: row;  /* override label { flex-direction: column } */
  align-items: center;
  gap: 0.3rem;
  padding: 0.3rem 0.75rem;
  border-radius: 999px;
  border: 1px solid var(--border2);
  background: var(--surface2);
  font-size: 0.78rem;
  font-weight: 500;
  color: var(--text-muted);
  cursor: pointer;
  transition: border-color 0.15s, background 0.15s, color 0.15s;
  user-select: none;
  margin-bottom: 0;  /* override label { margin-bottom: 1rem } */
}
.mode-pill:hover { border-color: var(--accent); color: var(--text); }
.mode-pill-active {
  border-color: var(--accent);
  background: rgba(91,92,246,0.12);
  color: var(--accent);
}

/* ── Transcript ────────────────────────────────────────────────────────────── */
.transcript-list {
  display: flex; flex-direction: column; gap: 0.25rem;
  max-height: 400px; overflow-y: auto; padding-right: 0.25rem;
}

.transcript-entry {
  display: grid;
  grid-template-columns: 120px 52px 1fr;
  gap: 0.75rem;
  align-items: baseline;
  padding: 0.45rem 0.6rem;
  border-radius: 8px;
  transition: background 0.1s;
}
.transcript-entry:hover { background: var(--surface2); }

.t-speaker { font-weight: 700; color: var(--accent); font-size: 0.81rem; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.t-ts { font-size: 0.71rem; color: var(--text-dim); font-family: var(--font-mono); }
.t-text { font-size: 0.875rem; color: var(--text); }

/* ── Analysis ─────────────────────────────────────────────────────────────── */
.analysis-summary {
  background: linear-gradient(135deg, #f5f4ff 0%, #eef2ff 100%);
  border: 1px solid rgba(91,92,246,0.15);
  border-radius: 10px;
  padding: 1rem 1.125rem;
  line-height: 1.7;
  margin-bottom: 1rem;
  font-size: 0.9rem;
  color: var(--text);
}

.analysis-section { margin-top: 1.25rem; }
.analysis-section-title {
  font-size: 0.68rem;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--text-muted);
  font-weight: 700;
  margin-bottom: 0.6rem;
}

.pill-list { display: flex; flex-wrap: wrap; gap: 0.4rem; }
.pill {
  background: var(--accent-dim);
  border: 1px solid rgba(91,92,246,0.2);
  color: var(--accent);
  padding: 0.22rem 0.65rem;
  border-radius: 999px;
  font-size: 0.78rem;
  font-weight: 600;
}

.bullet-list {
  display: flex; flex-direction: column; gap: 0.45rem;
  padding-left: 0; list-style: none;
}
.bullet-list li {
  display: flex; gap: 0.5rem;
  font-size: 0.875rem; line-height: 1.5;
}
.bullet-list li::before {
  content: '·';
  color: var(--accent);
  font-weight: 900;
  flex-shrink: 0;
}

.action-row {
  display: flex; align-items: flex-start; gap: 0.75rem;
  padding: 0.6rem 0.75rem;
  background: var(--surface2);
  border: 1px solid var(--border);
  border-radius: 9px;
  margin-bottom: 0.45rem;
}
.action-task { flex: 1; font-size: 0.875rem; line-height: 1.5; }
.action-assignee { font-size: 0.77rem; color: var(--accent); font-weight: 700; white-space: nowrap; }

.sentiment-badge {
  display: inline-flex; align-items: center; gap: 0.35rem;
  padding: 0.22rem 0.65rem; border-radius: 999px;
  font-size: 0.76rem; font-weight: 700;
}
.sentiment-positive { background: rgba(22,163,74,0.1);  color: var(--success); border: 1px solid rgba(22,163,74,0.2); }
.sentiment-neutral  { background: rgba(217,119,6,0.1); color: var(--warning); border: 1px solid rgba(217,119,6,0.2); }
.sentiment-negative { background: rgba(220,38,38,0.1); color: var(--error);   border: 1px solid rgba(220,38,38,0.2); }

/* ── Webhooks ─────────────────────────────────────────────────────────────── */
.webhook-row {
  display: flex; align-items: center; gap: 1rem;
  padding: 0.875rem 1rem;
  background: var(--surface2);
  border: 1px solid var(--border);
  border-radius: 10px;
  margin-bottom: 0.6rem;
}
.webhook-url {
  flex: 1; font-family: var(--font-mono); font-size: 0.82rem;
  color: var(--text); overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}
.webhook-events { display: flex; flex-wrap: wrap; gap: 0.3rem; }

/* ── Chips ────────────────────────────────────────────────────────────────── */
.event-chips { display: flex; flex-wrap: wrap; gap: 0.4rem; }
.chip { padding: 0.25rem 0.6rem; border-radius: 6px; font-size: 0.77rem; font-weight: 600; }
.chip-code {
  font-family: var(--font-mono);
  background: var(--surface2);
  border: 1px solid var(--border);
  color: var(--text-muted);
}
.chip-sm { font-size: 0.7rem; padding: 0.15rem 0.45rem; }

/* ── Toast ────────────────────────────────────────────────────────────────── */
#toast-container {
  position: fixed; bottom: 1.5rem; right: 1.5rem;
  display: flex; flex-direction: column; gap: 0.5rem;
  z-index: 200; pointer-events: none;
}
.toast {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 0.75rem 1rem;
  font-size: 0.875rem;
  box-shadow: var(--shadow-lg);
  max-width: 340px;
  animation: toast-in 0.2s ease;
  pointer-events: auto;
  display: flex; align-items: flex-start; gap: 0.6rem;
}
.toast.success { border-left: 3px solid var(--success); }
.toast.error   { border-left: 3px solid var(--error); }
.toast.info    { border-left: 3px solid var(--info); }
.toast-icon { flex-shrink: 0; font-size: 1rem; }
.toast-text { flex: 1; color: var(--text); }
.toast-out  { animation: toast-out 0.2s ease forwards; }
@keyframes toast-in  { from{transform:translateX(12px);opacity:0} to{transform:none;opacity:1} }
@keyframes toast-out { from{opacity:1} to{opacity:0;transform:translateX(12px)} }

/* ── Pagination ───────────────────────────────────────────────────────────── */
.pagination { display:flex; align-items:center; gap:0.75rem; justify-content:center; padding:0.75rem 0 0.25rem; }
.pagination-info { font-size:0.8rem; color:var(--text-muted); }

/* ── Loading / Empty ──────────────────────────────────────────────────────── */
.loading { color: var(--text-muted); text-align: center; padding: 3rem; font-size: 0.9rem; }
.empty   { color: var(--text-muted); text-align: center; padding: 2.5rem; font-size: 0.9rem; }
.empty-action { margin-top: 0.75rem; }
.empty-state { color: var(--text-muted); text-align: center; padding: 2rem; font-size: 0.9rem; }

/* ── Error banner ─────────────────────────────────────────────────────────── */
.error-banner {
  background: rgba(220,38,38,0.06);
  border: 1px solid rgba(220,38,38,0.2);
  border-radius: 9px;
  padding: 0.75rem 1rem;
  color: var(--error);
  font-size: 0.875rem;
  margin-bottom: 1.25rem;
  display: flex; gap: 0.5rem; align-items: flex-start;
}

/* ── Scrollbar ────────────────────────────────────────────────────────────── */
::-webkit-scrollbar { width: 5px; height: 5px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: var(--border2); border-radius: 4px; }
::-webkit-scrollbar-thumb:hover { background: var(--text-dim); }

/* ── Debug / Screenshots ──────────────────────────────────────────────────── */
.debug-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(260px, 1fr));
  gap: 1rem; padding: 1rem;
}
.debug-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 10px;
  overflow: hidden;
  display: flex; flex-direction: column;
  box-shadow: var(--shadow-sm);
}
.debug-thumb {
  width: 100%; height: 160px;
  object-fit: cover; object-position: top;
  display: block;
  border-bottom: 1px solid var(--border);
  background: var(--surface2);
}
.debug-html-link {
  display: flex; align-items: center; justify-content: center;
  height: 160px; font-size: 0.9rem; color: var(--accent);
  border-bottom: 1px solid var(--border);
  background: var(--surface2); text-decoration: none;
}
.debug-html-link:hover { background: var(--surface3); }
.debug-card-info { padding: 0.75rem; display: flex; flex-direction: column; gap: 0.35rem; }
.debug-card-name {
  font-size: 0.78rem; font-family: var(--font-mono);
  color: var(--text); white-space: nowrap;
  overflow: hidden; text-overflow: ellipsis;
}
.debug-card-meta { font-size: 0.72rem; color: var(--text-muted); }

/* ── Speaker Stats ──────────────────────────────────────────────────────── */
.speaker-stats { margin-top: 0.75rem; display: flex; flex-direction: column; gap: 0.45rem; }
.speaker-stat-row {
  display: grid;
  grid-template-columns: 1fr 3fr 3rem 4rem;
  align-items: center; gap: 0.5rem;
}
.speaker-stat-name { font-size: 0.84rem; color: var(--text); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; font-weight: 500; }
.speaker-stat-bar-wrap { background: var(--surface3); border-radius: 4px; height: 8px; overflow: hidden; }
.speaker-stat-bar { height: 100%; background: linear-gradient(90deg, var(--accent) 0%, #818cf8 100%); border-radius: 4px; transition: width 0.5s cubic-bezier(0.4,0,0.2,1); }
.speaker-stat-pct { font-size: 0.77rem; color: var(--accent); text-align: right; font-weight: 700; }
.speaker-stat-time { font-size: 0.74rem; color: var(--text-muted); text-align: right; }

/* ── Smart Chapters ─────────────────────────────────────────────────────── */
.chapters-list { display: flex; flex-direction: column; }
.chapter-item {
  display: flex; gap: 1rem; align-items: flex-start;
  padding: 0.75rem 0.5rem;
  border-bottom: 1px solid var(--border);
  cursor: pointer; border-radius: 8px;
  transition: background 0.13s;
}
.chapter-item:last-child { border-bottom: none; }
.chapter-item:hover { background: var(--surface2); }
.chapter-num {
  width: 1.7rem; height: 1.7rem;
  background: linear-gradient(135deg, var(--accent) 0%, #818cf8 100%);
  color: white; border-radius: 50%;
  display: flex; align-items: center; justify-content: center;
  font-size: 0.72rem; font-weight: 800; flex-shrink: 0; margin-top: 1px;
  box-shadow: 0 2px 6px rgba(91,92,246,0.28);
}
.chapter-title { font-weight: 600; font-size: 0.9rem; color: var(--text); margin-bottom: 0.2rem; }
.chapter-meta { font-size: 0.77rem; color: var(--text-muted); }

/* ── Ask Anything ───────────────────────────────────────────────────────── */
.ask-row { display: flex; gap: 0.5rem; margin-bottom: 0.75rem; }
.ask-answer {
  background: linear-gradient(135deg, #f5f4ff 0%, #eef2ff 100%);
  border: 1px solid rgba(91,92,246,0.18);
  border-radius: 10px;
  padding: 0.9rem 1rem;
  font-size: 0.9rem; line-height: 1.65; white-space: pre-wrap;
  color: var(--text);
}
.ask-answer.hidden { display: none; }

/* ── Highlights ─────────────────────────────────────────────────────────── */
.hl-btn {
  font-size: 0.8rem; padding: 0 0.3rem;
  opacity: 0; transition: opacity 0.15s; margin-left: auto;
}
.transcript-entry:hover .hl-btn { opacity: 1; }
.highlight-row {
  display: flex; gap: 0.75rem; align-items: flex-start;
  padding: 0.65rem 0; border-bottom: 1px solid var(--border);
}
.highlight-row:last-child { border-bottom: none; }
.highlight-ts { font-size: 0.74rem; color: var(--accent); font-family: var(--font-mono); padding-top: 2px; white-space: nowrap; font-weight: 600; }
.highlight-speaker { font-weight: 700; font-size: 0.82rem; margin-bottom: 0.15rem; }
.highlight-text { font-size: 0.84rem; color: var(--text-muted); }
.highlight-comment { font-size: 0.81rem; color: var(--accent); margin-top: 0.2rem; font-style: italic; }
.highlight-body { flex: 1; }

/* ── Search page ────────────────────────────────────────────────────────── */
.search-count { font-size: 0.84rem; color: var(--text-muted); margin-bottom: 0.75rem; font-weight: 500; }
.search-result-card {
  border: 1px solid var(--border); border-radius: 11px;
  padding: 0.9rem 1rem; margin-bottom: 0.75rem;
  cursor: pointer; transition: border-color 0.15s, box-shadow 0.15s, transform 0.1s;
  background: var(--surface); box-shadow: var(--shadow-sm);
}
.search-result-card:hover {
  border-color: var(--accent);
  box-shadow: 0 4px 16px rgba(91,92,246,0.12);
  transform: translateY(-1px);
}
.search-result-header { display: flex; align-items: center; gap: 0.5rem; margin-bottom: 0.3rem; flex-wrap: wrap; }
.search-result-date { color: var(--text-muted); font-size: 0.77rem; margin-left: auto; }
.search-result-count {
  background: var(--accent); color: white;
  border-radius: 999px; padding: 0 0.55rem;
  font-size: 0.7rem; font-weight: 700;
}
.search-result-url { font-size: 0.74rem; color: var(--text-muted); font-family: var(--font-mono); margin-bottom: 0.5rem; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.search-snippets { display: flex; flex-direction: column; gap: 0.3rem; }
.search-snippet { display: flex; gap: 0.5rem; align-items: baseline; font-size: 0.83rem; }
.search-snippet mark { background: rgba(91,92,246,0.15); color: var(--accent); border-radius: 3px; padding: 0 3px; font-weight: 600; }

/* ── Analytics ──────────────────────────────────────────────────────────── */
.analytics-cards { display: grid; grid-template-columns: repeat(auto-fit, minmax(140px, 1fr)); gap: 1rem; margin-bottom: 1.5rem; }
.analytics-cards .stat-card.positive .stat-value { color: var(--success); }
.analytics-cards .stat-card.negative .stat-value { color: var(--error); }
.analytics-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(320px, 1fr)); gap: 1.5rem; }
.analytics-topic-row { display: flex; align-items: center; gap: 0.5rem; margin-bottom: 0.5rem; }
.analytics-topic-label { font-size: 0.84rem; min-width: 7rem; color: var(--text); font-weight: 500; }
.analytics-topic-count { font-size: 0.77rem; color: var(--text-muted); min-width: 2rem; text-align: right; }
.analytics-chart-card { padding: 1rem; }

/* ── Bar chart ──────────────────────────────────────────────────────────── */
.bar-chart {
  display: flex; align-items: flex-end; gap: 4px;
  height: 120px; overflow-x: auto; padding: 0.5rem 0 0;
}
.bar-chart-col { display: flex; flex-direction: column; align-items: center; min-width: 28px; flex: 1; }
.bar-chart-bar {
  width: 100%;
  background: linear-gradient(to top, var(--accent) 0%, #818cf8 100%);
  border-radius: 4px 4px 0 0;
  position: relative; min-height: 4px; transition: height 0.4s;
}
.bar-chart-val {
  position: absolute; top: -1.2rem; left: 50%; transform: translateX(-50%);
  font-size: 0.63rem; color: var(--text-muted); white-space: nowrap;
}
.bar-chart-label { font-size: 0.59rem; color: var(--text-muted); margin-top: 4px; text-align: center; }

/* ── Action Items ──────────────────────────────────────────────────────── */
.ai-table { width: 100%; border-collapse: collapse; }
.ai-table thead th {
  text-align: left; padding: 0.55rem 0.75rem;
  font-size: 0.68rem; color: var(--text-muted);
  text-transform: uppercase; letter-spacing: 0.07em; font-weight: 700;
  border-bottom: 1px solid var(--border);
  background: var(--surface2);
}
.ai-table thead th:first-child { border-radius: 8px 0 0 0; }
.ai-table thead th:last-child  { border-radius: 0 8px 0 0; }
.ai-table tbody td { padding: 0.65rem 0.75rem; border-bottom: 1px solid var(--border); vertical-align: middle; }
.ai-row:hover { background: #f7f8fd; }
.ai-row.ai-done .ai-task { text-decoration: line-through; color: var(--text-muted); }
.ai-row.ai-done { opacity: 0.65; }
.ai-checkbox { width: 16px; height: 16px; cursor: pointer; accent-color: var(--accent); }
.ai-task { max-width: 320px; font-weight: 500; }
.ai-assignee { font-size: 0.81rem; color: var(--text-muted); }

/* ── Templates ─────────────────────────────────────────────────────────── */
.templates-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
  gap: 1rem;
}
.template-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 1.1rem 1.2rem;
  box-shadow: var(--shadow-sm);
  transition: box-shadow 0.15s, border-color 0.15s, transform 0.1s;
}
.template-card:hover {
  border-color: var(--accent);
  box-shadow: 0 4px 16px rgba(91,92,246,0.1);
  transform: translateY(-1px);
}
.template-seed { border-top: 3px solid var(--accent); }
.template-header { display: flex; justify-content: space-between; align-items: center; margin-bottom: 0.5rem; }
.template-name { font-weight: 700; font-size: 0.95rem; }
.template-desc { font-size: 0.82rem; color: var(--text-muted); margin-bottom: 0.6rem; line-height: 1.5; }
.template-prompt {
  font-size: 0.74rem; font-family: var(--font-mono);
  background: var(--surface2); border: 1px solid var(--border);
  border-radius: 7px; padding: 0.55rem 0.65rem;
  color: var(--text-muted); white-space: pre-wrap;
  overflow: hidden; max-height: 100px;
}

/* ── Live timer ─────────────────────────────────────────────────────────── */
.live-timer { color: var(--error); font-weight: 700; animation: blink 1.2s ease-in-out infinite; }


.tts-hint { font-size: 0.75rem; color: var(--text-muted); margin-top: 2px; }

/* ── Mobile Header (hidden on desktop) ─────────────────────────────────────── */
.mobile-header { display: none; }

.hamburger-btn {
  background: none;
  border: none;
  cursor: pointer;
  padding: 0.4rem 0.5rem;
  color: var(--text);
  font-size: 1.4rem;
  line-height: 1;
  border-radius: 6px;
  transition: background 0.13s;
  display: flex;
  align-items: center;
}
.hamburger-btn:hover { background: var(--surface2); }

/* ── Sidebar overlay (mobile only) ─────────────────────────────────────────── */
.sidebar-overlay {
  display: none;
  position: fixed;
  inset: 0;
  background: rgba(26,31,54,0.5);
  z-index: 49;
}

/* ── Slide-in animation for sidebar drawer ──────────────────────────────────── */
@keyframes sidebar-slide-in {
  from { transform: translateX(-100%); }
  to   { transform: translateX(0); }
}

/* ── Mobile responsive (≤ 900px) ───────────────────────────────────────────── */
@media (max-width: 900px) {

  /* ---- Body & app layout ---- */
  body {
    overflow: auto;
    height: auto;
  }

  #app {
    height: auto;
    min-height: 100vh;
    overflow: visible;
  }

  /* ---- Mobile top bar ---- */
  .mobile-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0.75rem 1rem;
    background: var(--surface);
    border-bottom: 1px solid var(--border);
    position: sticky;
    top: 0;
    z-index: 48;
    box-shadow: var(--shadow-sm);
  }
  .mobile-header .logo { margin-bottom: 0; padding: 0; }

  /* ---- Sidebar: slide off-screen to the left (CSS transition handles animation) ---- */
  .sidebar {
    transform: translateX(-100%);
    width: min(280px, 85vw);
    overflow-y: auto;
    box-shadow: 4px 0 24px rgba(26,31,54,0.15);
  }

  /* Open state: slide in from left */
  #app.sidebar-open .sidebar {
    transform: translateX(0);
  }

  #app.sidebar-open .sidebar-overlay { display: block; }

  /* Prevent body scrolling while sidebar is open */
  body.sidebar-open { overflow: hidden; }

  /* ---- Main content: full width ---- */
  .main {
    margin-left: 0;
    height: auto;
    overflow-y: visible;
    padding: 1.25rem 1rem;
  }

  /* ---- Stats bar: 2×2 grid ---- */
  .stats-bar { grid-template-columns: repeat(2, 1fr); }

  /* ---- Page header: wrap ---- */
  .page-header { flex-wrap: wrap; gap: 0.75rem; }

  /* ---- Form rows: stack ---- */
  .form-row { flex-direction: column; }
  .form-row label { min-width: unset; }

  /* ---- Bot detail meta: 2 cols ---- */
  .detail-meta { grid-template-columns: repeat(2, 1fr); }

  /* ---- Transcript: tighter ---- */
  .transcript-entry { grid-template-columns: 90px 40px 1fr; gap: 0.4rem; }

  /* ---- Mode picker: single column ---- */
  .mode-picker { grid-template-columns: 1fr; }

  /* ---- Analytics: single column ---- */
  .analytics-grid { grid-template-columns: 1fr; }
  .analytics-cards { grid-template-columns: repeat(2, 1fr); }

  /* ---- Modals: bottom sheet ---- */
  .modal-backdrop { align-items: flex-end !important; padding: 0 !important; }
  .modal {
    max-width: 100% !important;
    width: 100% !important;
    border-radius: 16px 16px 0 0 !important;
    max-height: 92vh !important;
    margin: 0 !important;
  }
  .modal-header { border-radius: 16px 16px 0 0 !important; }
  .modal-footer { border-radius: 0 !important; }

  /* ---- Toast ---- */
  #toast-container { left: 0.75rem; right: 0.75rem; bottom: 1rem; }
  .toast { max-width: 100%; }

  /* ---- Card toolbar ---- */
  .card-toolbar { flex-wrap: wrap; }
  #bot-search { width: 100% !important; }

  /* ---- Webhook row ---- */
  .webhook-row { flex-direction: column; align-items: flex-start; }
  .webhook-url { white-space: normal; word-break: break-all; }

  /* ---- Speaker stats ---- */
  .speaker-stat-row { grid-template-columns: 5.5rem 1fr 2.5rem; }
  .speaker-stat-time { display: none; }

  /* ---- Response mode row ---- */
  .response-mode-row { flex-direction: column; align-items: flex-start; gap: 0.4rem; }

  /* ---- Misc layout ---- */
  .section-header { flex-wrap: wrap; gap: 0.5rem; }
  .templates-grid { grid-template-columns: 1fr; }
  .debug-grid { grid-template-columns: 1fr; }

  /* ---- Action items filter bar ---- */
  #page-action-items .page-header { align-items: flex-start; }
  #page-action-items .page-header > div { flex-wrap: wrap; width: 100%; }
  #ai-filter-done, #ai-filter-assignee { flex: 1; width: auto !important; }

  /* ---- Lifecycle steps ---- */
  .step-dot { width: 22px; height: 22px; font-size: 0.58rem; }
  .step-label { font-size: 0.58rem; }
  .lifecycle-card { padding: 0.875rem 0.875rem; }
}

/* ── Extra small phones (≤ 480px) ───────────────────────────────────────────── */
@media (max-width: 480px) {
  .main { padding: 1rem 0.75rem; }
  h1 { font-size: 1.2rem; }
  .stat-value { font-size: 1.5rem; }

  /* Hide transcript timestamp */
  .transcript-entry { grid-template-columns: 80px 1fr; }
  .t-ts { display: none; }

  .filter-btn { padding: 0.28rem 0.55rem; font-size: 0.75rem; }

  .modal-body { padding: 1rem; }
  .modal-footer { padding: 0.75rem 1rem; }
}

/* ── Dark Mode ─────────────────────────────────────────────────────────────── */
[data-theme="dark"] {
  --bg:          #0f1117;
  --surface:     #1a1d2e;
  --surface2:    #232738;
  --surface3:    #2c3044;
  --border:      #2e3348;
  --border2:     #3d4260;
  --text:        #e4e6f0;
  --text-muted:  #8b90a8;
  --text-dim:    #5e6380;
  --accent:      #7c7df8;
  --accent-hover:#6b6cf0;
  --accent-dim:  rgba(124,125,248,0.12);
  --success:     #34d399;
  --warning:     #fbbf24;
  --error:       #f87171;
  --info:        #60a5fa;
  --shadow-sm:   0 1px 3px rgba(0,0,0,0.25), 0 1px 2px rgba(0,0,0,0.15);
  --shadow-md:   0 4px 12px rgba(0,0,0,0.3), 0 2px 4px rgba(0,0,0,0.2);
  --shadow-lg:   0 16px 40px rgba(0,0,0,0.4), 0 4px 12px rgba(0,0,0,0.25);
}

[data-theme="dark"] .report-card:hover { background: var(--surface2); }
[data-theme="dark"] .ai-row:hover { background: var(--surface2); }
[data-theme="dark"] .analysis-summary {
  background: linear-gradient(135deg, rgba(124,125,248,0.08) 0%, rgba(96,165,250,0.06) 100%);
  border-color: rgba(124,125,248,0.2);
}
[data-theme="dark"] .ask-answer {
  background: linear-gradient(135deg, rgba(124,125,248,0.08) 0%, rgba(96,165,250,0.06) 100%);
  border-color: rgba(124,125,248,0.2);
}
[data-theme="dark"] .modal-backdrop { background: rgba(0,0,0,0.55); }
[data-theme="dark"] .sidebar-overlay { background: rgba(0,0,0,0.6); }
[data-theme="dark"] .toggle-switch::after { background: #d1d5db; }

/* ── Theme toggle button ──────────────────────────────────────────────────── */
.theme-toggle {
  display: flex;
  align-items: center;
  gap: 0.45rem;
  padding: 0.45rem 0.625rem;
  border: none;
  background: var(--surface2);
  border-radius: 8px;
  cursor: pointer;
  font-size: 0.78rem;
  color: var(--text-muted);
  transition: background 0.13s, color 0.13s;
  width: 100%;
  margin-top: 0.5rem;
  font-family: inherit;
  font-weight: 500;
}
.theme-toggle:hover { background: var(--surface3); color: var(--text); }
.theme-toggle-icon { font-size: 1rem; }

/* ── Keyboard shortcut hints ──────────────────────────────────────────────── */
.kbd-hint {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 1.4rem;
  height: 1.2rem;
  padding: 0 0.3rem;
  font-size: 0.6rem;
  font-family: var(--font-mono);
  font-weight: 600;
  color: var(--text-dim);
  background: var(--surface2);
  border: 1px solid var(--border);
  border-radius: 4px;
  margin-left: auto;
  flex-shrink: 0;
}

/* ── Command palette ──────────────────────────────────────────────────────── */
.cmd-palette-backdrop {
  position: fixed;
  inset: 0;
  background: rgba(26,31,54,0.35);
  backdrop-filter: blur(4px);
  z-index: 300;
  display: flex;
  align-items: flex-start;
  justify-content: center;
  padding-top: 20vh;
}
[data-theme="dark"] .cmd-palette-backdrop { background: rgba(0,0,0,0.55); }
.cmd-palette-backdrop.hidden { display: none; }

.cmd-palette {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 14px;
  width: 100%;
  max-width: 480px;
  box-shadow: var(--shadow-lg);
  overflow: hidden;
}
.cmd-palette-input {
  width: 100%;
  padding: 0.85rem 1.1rem;
  font-size: 0.95rem;
  border: none;
  background: transparent;
  color: var(--text);
  outline: none;
  font-family: inherit;
  border-bottom: 1px solid var(--border);
}
.cmd-palette-input::placeholder { color: var(--text-dim); }
.cmd-palette-list {
  max-height: 280px;
  overflow-y: auto;
  padding: 0.4rem;
}
.cmd-palette-item {
  display: flex;
  align-items: center;
  gap: 0.65rem;
  padding: 0.55rem 0.75rem;
  border-radius: 8px;
  cursor: pointer;
  font-size: 0.875rem;
  color: var(--text);
  transition: background 0.1s;
}
.cmd-palette-item:hover,
.cmd-palette-item.active { background: var(--accent-dim); color: var(--accent); }
.cmd-palette-item-icon { font-size: 1rem; width: 1.4rem; text-align: center; flex-shrink: 0; }
.cmd-palette-item-label { flex: 1; font-weight: 500; }
.cmd-palette-item-hint { font-size: 0.7rem; color: var(--text-dim); font-family: var(--font-mono); }
.cmd-palette-footer {
  padding: 0.45rem 0.75rem;
  border-top: 1px solid var(--border);
  display: flex;
  gap: 1rem;
  font-size: 0.68rem;
  color: var(--text-dim);
}

/* ── Skeleton loading animations ──────────────────────────────────────────── */
@keyframes shimmer {
  0%   { background-position: -400px 0; }
  100% { background-position: 400px 0; }
}
.skeleton {
  background: linear-gradient(90deg, var(--surface2) 25%, var(--surface3) 50%, var(--surface2) 75%);
  background-size: 800px 100%;
  animation: shimmer 1.5s infinite linear;
  border-radius: 8px;
}
.skeleton-card {
  padding: 1rem 1.25rem;
  border-bottom: 1px solid var(--border);
}
.skeleton-line {
  height: 0.75rem;
  margin-bottom: 0.5rem;
  border-radius: 4px;
}
.skeleton-line:last-child { margin-bottom: 0; }
.skeleton-line-short { width: 40%; }
.skeleton-line-medium { width: 65%; }
.skeleton-line-long { width: 90%; }
.skeleton-stat {
  height: 2.5rem;
  border-radius: var(--radius);
}

/* ── Notification bell ────────────────────────────────────────────────────── */
.notif-bell {
  position: relative;
  display: flex;
  align-items: center;
  gap: 0.4rem;
  padding: 0.45rem 0.625rem;
  border: none;
  background: var(--surface2);
  border-radius: 8px;
  cursor: pointer;
  font-size: 0.78rem;
  color: var(--text-muted);
  transition: background 0.13s, color 0.13s;
  width: 100%;
  margin-top: 0.35rem;
  font-family: inherit;
  font-weight: 500;
}
.notif-bell:hover { background: var(--surface3); color: var(--text); }
.notif-bell-icon { font-size: 1rem; }
.notif-bell-dot {
  width: 6px; height: 6px;
  border-radius: 50%;
  background: var(--error);
  position: absolute;
  top: 6px; left: 22px;
  display: none;
}
.notif-bell-dot.active { display: block; }
