:root {
  --bg: #F4F6FA;
  --sidebar-bg: #0B1220;
  --sidebar-bg-hover: #17223A;
  --sidebar-text: #94A3B8;
  --sidebar-text-active: #FFFFFF;
  --card: #FFFFFF;
  --card-inner: #F1F5F9;
  --text: #0F172A;
  --text-on-dark: #F8FAFC;
  --border: #E2E8F0;
  --accent: #4F46E5;
  --accent-soft: #EEF2FF;
  --accent-hover: #4338CA;
  --success: #16A34A;
  --success-soft: #DCFCE7;
  --warning: #D97706;
  --warning-soft: #FEF3C7;
  --danger: #DC2626;
  --danger-soft: #FEE2E2;
  --info: #0891B2;
  --info-soft: #CFFAFE;
  --muted: #64748B;
  --radius-sm: 8px;
  --radius: 12px;
  --radius-lg: 16px;
  --shadow-sm: 0 1px 2px rgba(15, 23, 42, 0.06);
  --shadow: 0 2px 8px rgba(15, 23, 42, 0.06), 0 1px 2px rgba(15, 23, 42, 0.04);
  --shadow-lg: 0 8px 24px rgba(15, 23, 42, 0.10);
  --sidebar-w: 232px;
  --sidebar-w-collapsed: 68px;
  --topbar-h: 60px;
}

* { box-sizing: border-box; }
body {
  margin: 0;
  font-family: -apple-system, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
  background: var(--bg);
  color: var(--text);
  font-size: 14px;
  -webkit-font-smoothing: antialiased;
}
h1, h2, h3 { font-weight: 700; letter-spacing: -0.01em; }
a { color: inherit; }

/* ---------- App shell: sidebar + topbar ---------- */
.app-shell { display: flex; min-height: 100vh; }

.sidebar {
  width: var(--sidebar-w);
  background: var(--sidebar-bg);
  color: var(--sidebar-text);
  display: flex;
  flex-direction: column;
  flex-shrink: 0;
  position: sticky;
  top: 0;
  height: 100vh;
  transition: width 160ms ease;
  z-index: 20;
}
.app-shell.sidebar-collapsed .sidebar { width: var(--sidebar-w-collapsed); }

.sidebar-head { display: flex; align-items: center; gap: 10px; padding: 18px 16px; min-height: var(--topbar-h); border-bottom: 1px solid rgba(255,255,255,0.06); }
.brand { font-weight: 700; font-size: 16px; color: #fff; display: flex; align-items: center; gap: 10px; white-space: nowrap; overflow: hidden; }
.brand-dot { width: 10px; height: 10px; border-radius: 50%; background: var(--accent); display: inline-block; flex-shrink: 0; box-shadow: 0 0 0 4px rgba(79,70,229,0.25); }
.sidebar-collapsed .brand span.brand-text { display: none; }

.sidebar-toggle { margin-left: auto; background: transparent; border: none; color: var(--sidebar-text); cursor: pointer; padding: 6px; border-radius: 6px; display: flex; }
.sidebar-toggle:hover { background: var(--sidebar-bg-hover); color: #fff; }
.sidebar-collapsed .sidebar-toggle { transform: rotate(180deg); margin-left: 0; }
.sidebar-collapsed .sidebar-head { justify-content: center; }

.sidebar-nav { display: flex; flex-direction: column; gap: 2px; padding: 12px 10px; flex: 1; }
.sidebar-nav a {
  display: flex; align-items: center; gap: 12px; padding: 10px 12px; border-radius: var(--radius-sm);
  text-decoration: none; color: var(--sidebar-text); font-size: 13.5px; font-weight: 500; white-space: nowrap; overflow: hidden;
  transition: background 120ms ease, color 120ms ease;
}
.sidebar-nav a svg { flex-shrink: 0; }
.sidebar-nav a:hover { background: var(--sidebar-bg-hover); color: #fff; }
.sidebar-nav a.active { background: var(--accent); color: #fff; }
.sidebar-collapsed .sidebar-nav a { justify-content: center; padding: 12px; }
.sidebar-collapsed .sidebar-nav a .nav-label { display: none; }

.sidebar-foot { padding: 14px 16px; border-top: 1px solid rgba(255,255,255,0.06); font-size: 12px; color: var(--sidebar-text); }

.main-col { flex: 1; min-width: 0; display: flex; flex-direction: column; }

.topbar {
  background: var(--card);
  border-bottom: 1px solid var(--border);
  color: var(--text);
  display: flex;
  align-items: center;
  gap: 16px;
  padding: 0 24px;
  height: var(--topbar-h);
  position: sticky;
  top: 0;
  z-index: 10;
}
.topbar-mobile-toggle { display: none; background: transparent; border: none; cursor: pointer; padding: 6px; color: var(--text); }

.nav-search { display: flex; align-items: center; background: var(--card-inner); border: 1px solid var(--border); border-radius: var(--radius-sm); padding: 4px 6px; gap: 4px; flex: 1; max-width: 420px; color: var(--muted); }
.nav-search input[type="search"] { background: transparent; border: none; color: var(--text); font-size: 13.5px; padding: 7px 4px; width: 100%; outline: none; }
.nav-search input[type="search"]::placeholder { color: #94A3B8; }
.nav-search button { background: transparent; border: none; cursor: pointer; font-size: 15px; padding: 5px 7px; border-radius: 6px; color: var(--muted); }
.nav-search button:hover { background: #E2E8F0; }
.nav-search button.mic-listening { background: var(--danger); color: #fff; animation: rec-pulse 1s infinite; }

.topbar-spacer { flex: 1; }
.topbar-icon-btn { position: relative; background: transparent; border: none; cursor: pointer; padding: 8px; border-radius: var(--radius-sm); color: var(--muted); display: flex; }
.topbar-icon-btn:hover { background: var(--card-inner); color: var(--text); }
.notif-dot { position: absolute; top: 6px; right: 6px; width: 7px; height: 7px; border-radius: 50%; background: var(--danger); border: 1.5px solid var(--card); }
.notif-wrap { position: relative; }
.notif-panel { position: absolute; top: calc(100% + 8px); right: 0; width: 320px; max-height: 400px; overflow-y: auto; background: var(--card); border: 1px solid var(--border); border-radius: var(--radius); box-shadow: var(--shadow-lg); z-index: 40; }
.notif-panel-head { font-weight: 700; font-size: 13px; padding: 12px 14px; border-bottom: 1px solid var(--border); }
.notif-item { padding: 10px 14px; border-bottom: 1px solid var(--border); display: flex; flex-direction: column; gap: 4px; }
.notif-item:last-child { border-bottom: none; }
.notif-item-title { display: flex; align-items: center; gap: 8px; font-size: 12.5px; }
.notif-item-title a { font-weight: 600; text-decoration: none; color: var(--text); }
.notif-item-detail { font-size: 11.5px; color: var(--muted); overflow-wrap: anywhere; }

.user-chip { display: flex; align-items: center; gap: 10px; font-size: 13.5px; color: var(--text); }
.user-avatar { width: 30px; height: 30px; border-radius: 50%; background: var(--accent-soft); color: var(--accent); display: flex; align-items: center; justify-content: center; font-weight: 700; font-size: 13px; flex-shrink: 0; }
.logout-link { color: var(--muted); text-decoration: none; font-size: 12.5px; }
.logout-link:hover { color: var(--text); }

.content { max-width: 1200px; margin: 0 auto; padding: 24px 28px 60px; width: 100%; }

/* ---------- Basics ---------- */
.page-head { display: flex; align-items: center; justify-content: space-between; margin-bottom: 20px; gap: 12px; flex-wrap: wrap; }
.page-head h1 { margin: 0; font-size: 21px; }
.page-subtitle { color: var(--muted); font-size: 13px; margin-top: 2px; }
h1 { margin: 0 0 4px; }
h2 { font-size: 14.5px; margin: 0 0 12px; }
.muted { color: var(--muted); }
.small { font-size: 12px; }

.btn-primary, .btn-secondary, .btn-danger, .btn-ghost {
  border: none; border-radius: var(--radius-sm); padding: 9px 16px; font-size: 13.5px; font-weight: 600; cursor: pointer;
  text-decoration: none; display: inline-flex; align-items: center; gap: 7px; white-space: nowrap; transition: background 120ms ease, box-shadow 120ms ease;
}
.btn-primary { background: var(--accent); color: #fff; box-shadow: var(--shadow-sm); }
.btn-primary:hover { background: var(--accent-hover); }
.btn-secondary { background: var(--card); color: var(--text); border: 1px solid var(--border); }
.btn-secondary:hover { background: var(--card-inner); }
.btn-danger { background: var(--danger-soft); color: var(--danger); border: 1px solid #FCA5A5; }
.btn-danger:hover { background: #FECACA; }
.btn-ghost { background: transparent; color: var(--muted); padding: 6px 10px; }
.btn-ghost:hover { background: var(--card-inner); color: var(--text); }
.btn-sm { padding: 6px 11px; font-size: 12.5px; }
.btn-block { width: 100%; justify-content: center; }

.panel { background: var(--card); border: 1px solid var(--border); border-radius: var(--radius); padding: 20px; margin-bottom: 16px; box-shadow: var(--shadow-sm); }
.panel.notice { background: var(--accent-soft); border-color: #C7D2FE; font-size: 13.5px; color: #3730A3; }
.panel.tight { padding: 14px 16px; }

/* Quick actions row */
.quick-actions { display: grid; grid-template-columns: repeat(3, 1fr); gap: 12px; margin-bottom: 20px; }
.quick-action-card {
  display: flex; align-items: center; gap: 12px; background: var(--card); border: 1px solid var(--border); border-radius: var(--radius);
  padding: 14px 16px; text-decoration: none; color: var(--text); box-shadow: var(--shadow-sm); transition: box-shadow 120ms ease, transform 120ms ease;
}
.quick-action-card:hover { box-shadow: var(--shadow); transform: translateY(-1px); }
.quick-action-icon { width: 38px; height: 38px; border-radius: 10px; display: flex; align-items: center; justify-content: center; flex-shrink: 0; }
.quick-action-icon.qa-record { background: var(--danger-soft); color: var(--danger); }
.quick-action-icon.qa-upload { background: var(--info-soft); color: var(--info); }
.quick-action-icon.qa-add { background: var(--accent-soft); color: var(--accent); }
.quick-action-title { font-weight: 600; font-size: 13.5px; }
.quick-action-sub { font-size: 12px; color: var(--muted); margin-top: 1px; }

/* KPI cards */
.kpi-row { display: grid; grid-template-columns: repeat(4, 1fr); gap: 14px; margin-bottom: 20px; }
.kpi-card { background: var(--card); border: 1px solid var(--border); border-radius: var(--radius); padding: 16px 18px; box-shadow: var(--shadow-sm); }
.kpi-top { display: flex; align-items: flex-start; justify-content: space-between; }
.kpi-icon { width: 34px; height: 34px; border-radius: 9px; display: flex; align-items: center; justify-content: center; }
.kpi-icon.kpi-blue { background: var(--accent-soft); color: var(--accent); }
.kpi-icon.kpi-green { background: var(--success-soft); color: var(--success); }
.kpi-icon.kpi-amber { background: var(--warning-soft); color: var(--warning); }
.kpi-icon.kpi-red { background: var(--danger-soft); color: var(--danger); }
.kpi-value { font-size: 24px; font-weight: 700; margin-top: 10px; line-height: 1.1; }
.kpi-label { font-size: 12px; color: var(--muted); margin-top: 3px; }
.kpi-trend { display: inline-flex; align-items: center; gap: 4px; font-size: 11.5px; font-weight: 700; padding: 3px 7px; border-radius: 999px; }
.kpi-trend.up { background: var(--success-soft); color: var(--success); }
.kpi-trend.down { background: var(--danger-soft); color: var(--danger); }
.kpi-trend.flat { background: var(--card-inner); color: var(--muted); }

/* Stat tiles (meeting detail) */
.stat-row { display: flex; gap: 12px; margin-bottom: 18px; flex-wrap: wrap; }
.stat-tile { background: var(--card); border: 1px solid var(--border); border-radius: var(--radius); padding: 14px 20px; min-width: 120px; box-shadow: var(--shadow-sm); }
.stat-value { font-size: 22px; font-weight: 700; }
.stat-label { font-size: 11.5px; color: var(--muted); margin-top: 3px; }

/* Section headers */
.section-head { display: flex; align-items: center; justify-content: space-between; margin-bottom: 10px; }
.section-head h2 { margin: 0; }

/* Meeting list / cards */
.meeting-list { list-style: none; margin: 0; padding: 0; }
.meeting-row { display: flex; align-items: center; gap: 12px; padding: 10px 0; border-bottom: 1px solid var(--border); }
.meeting-row:last-child { border-bottom: none; }
.meeting-row a { font-weight: 600; color: var(--text); text-decoration: none; }
.meeting-row a:hover { text-decoration: underline; }

.meeting-card-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(280px, 1fr)); gap: 14px; }
.meeting-card {
  background: var(--card); border: 1px solid var(--border); border-radius: var(--radius); padding: 16px; box-shadow: var(--shadow-sm);
  display: flex; flex-direction: column; gap: 10px; transition: box-shadow 120ms ease, transform 120ms ease;
}
.meeting-card:hover { box-shadow: var(--shadow); transform: translateY(-1px); }
.mc-top { display: flex; align-items: center; gap: 10px; }
.mc-platform-icon { width: 26px; height: 26px; border-radius: 6px; overflow: hidden; flex-shrink: 0; display: flex; }
.mc-title { font-weight: 700; font-size: 13.5px; flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.mc-meta { font-size: 11.5px; color: var(--muted); display: flex; align-items: center; gap: 6px; flex-wrap: wrap; }
.mc-stats { display: flex; gap: 14px; font-size: 12px; color: var(--muted); }
.mc-stats strong { color: var(--text); }
.mc-actions { display: flex; gap: 8px; margin-top: 2px; }

/* Table rows for meetings list */
.table-scroll { overflow-x: auto; }
.data-table { width: 100%; border-collapse: collapse; font-size: 13px; }
.data-table th, .data-table td { text-align: left; padding: 10px 12px; border-bottom: 1px solid var(--border); white-space: nowrap; }
.data-table th { color: var(--muted); font-weight: 600; font-size: 11.5px; text-transform: uppercase; letter-spacing: 0.03em; background: var(--card-inner); }
.data-table tbody tr:hover { background: #FAFBFF; }
.inline-form { display: inline; }

/* Badges */
.badge { font-size: 11px; padding: 3px 10px; border-radius: 999px; font-weight: 700; display: inline-flex; align-items: center; gap: 5px; white-space: nowrap; }
.badge::before { content: ""; width: 6px; height: 6px; border-radius: 50%; background: currentColor; display: inline-block; }
.badge-processing, .badge-recording { background: var(--warning-soft); color: var(--warning); }
.badge-failed { background: var(--danger-soft); color: var(--danger); }
.badge-completed { background: var(--success-soft); color: var(--success); }
.badge-created, .badge-uploading { background: var(--info-soft); color: var(--info); }
.badge-neutral { background: var(--card-inner); color: var(--muted); }

/* Alert banners (failed processing, etc.) */
.alert-banner { display: flex; align-items: center; gap: 12px; background: var(--danger-soft); border: 1px solid #FCA5A5; color: #7F1D1D; border-radius: var(--radius); padding: 12px 16px; margin-bottom: 12px; flex-wrap: wrap; }
.alert-banner .alert-icon { flex-shrink: 0; color: var(--danger); }
.alert-banner .alert-body { flex: 1; min-width: 0; }
.alert-banner .alert-title { font-weight: 700; font-size: 13px; }
.alert-banner .alert-detail { font-size: 12px; color: #991B1B; margin-top: 1px; overflow-wrap: anywhere; word-break: break-word; }
.alert-banner form { flex-shrink: 0; }

.toast { position: fixed; bottom: 20px; right: 20px; background: var(--text); color: #fff; padding: 12px 18px; border-radius: var(--radius-sm); box-shadow: var(--shadow-lg); font-size: 13px; z-index: 100; display: flex; align-items: center; gap: 10px; }
.toast.toast-success { background: #14532D; }
.toast.toast-error { background: #7F1D1D; }

/* Skeleton loading */
.skeleton { background: linear-gradient(90deg, #E9EDF3 25%, #F3F6FA 37%, #E9EDF3 63%); background-size: 400% 100%; animation: skeleton-shimmer 1.4s ease infinite; border-radius: var(--radius-sm); }
@keyframes skeleton-shimmer { 0% { background-position: 100% 50%; } 100% { background-position: 0 50%; } }

/* Tooltip */
[data-tooltip] { position: relative; }
[data-tooltip]:hover::after {
  content: attr(data-tooltip); position: absolute; bottom: 125%; left: 50%; transform: translateX(-50%);
  background: var(--text); color: #fff; font-size: 11px; padding: 5px 9px; border-radius: 6px; white-space: nowrap; z-index: 30; box-shadow: var(--shadow);
}

.stack { display: flex; flex-direction: column; gap: 14px; }
.stack label { display: flex; flex-direction: column; gap: 6px; font-size: 13px; font-weight: 600; color: var(--text); }
input[type=text], input[type=email], input[type=password], input[type=url], input[type=date], select, textarea {
  padding: 10px 12px; border: 1px solid var(--border); border-radius: var(--radius-sm); font-size: 13.5px; font-family: inherit; background: var(--card); color: var(--text);
}
input:focus, select:focus, textarea:focus { outline: 2px solid var(--accent); outline-offset: 1px; }
textarea { resize: vertical; }

.auth-shell { display: flex; justify-content: center; align-items: center; min-height: 100vh; background: var(--sidebar-bg); }
.auth-card { background: var(--card); border: 1px solid var(--border); border-radius: var(--radius-lg); padding: 32px; width: 380px; box-shadow: var(--shadow-lg); }
.auth-logo { font-weight: 700; margin-bottom: 18px; display: flex; align-items: center; gap: 8px; font-size: 16px; }
.alert-error { background: var(--danger-soft); color: #991B1B; padding: 10px 14px; border-radius: var(--radius-sm); margin-bottom: 14px; font-size: 13.5px; }

/* ---------- Recording control panel ---------- */
.record-panel { text-align: center; padding: 32px 20px; }
.record-big-btn {
  width: 96px; height: 96px; border-radius: 50%; border: none; cursor: pointer; margin: 0 auto 18px;
  display: flex; align-items: center; justify-content: center; background: var(--danger); color: #fff; box-shadow: 0 0 0 8px var(--danger-soft);
  transition: transform 120ms ease;
}
.record-big-btn:hover { transform: scale(1.04); }
.record-timer { font-size: 34px; font-weight: 700; font-variant-numeric: tabular-nums; letter-spacing: 0.02em; }
.recorder-status { display: flex; align-items: center; justify-content: center; gap: 10px; font-size: 20px; font-variant-numeric: tabular-nums; }
.rec-dot { width: 10px; height: 10px; border-radius: 50%; background: var(--muted); display: inline-block; }
.rec-dot-active { background: var(--danger); animation: rec-pulse 1.2s infinite; }
@keyframes rec-pulse { 0%, 100% { opacity: 1; } 50% { opacity: 0.35; } }
.mic-state { font-size: 12.5px; color: var(--muted); }
.recorder-controls { display: flex; gap: 10px; margin-top: 14px; flex-wrap: wrap; justify-content: center; }
.device-status-row { display: flex; gap: 10px; justify-content: center; margin: 14px 0; flex-wrap: wrap; }
.device-chip { display: flex; align-items: center; gap: 7px; background: var(--card-inner); border-radius: 999px; padding: 6px 12px; font-size: 12px; color: var(--text); }
.device-chip .dot { width: 7px; height: 7px; border-radius: 50%; background: var(--success); }
.level-row { display: flex; align-items: center; gap: 10px; max-width: 360px; margin: 0 auto; }
.level-row + .level-row { margin-top: 8px; }
.level-meter { width: 100%; height: 8px; border-radius: 4px; background: var(--card-inner); overflow: hidden; }
.level-fill { height: 100%; width: 0%; background: var(--success); transition: width 80ms linear; }
.level-fill.level-loud { background: var(--warning); }

.video-controls { display: flex; align-items: center; gap: 12px; margin-top: 10px; }
.speed-label { display: flex; align-items: center; gap: 6px; font-size: 13px; color: var(--muted); }
.speed-label select { width: auto; }

/* ---------- Wizard (Add Meeting) ---------- */
.wizard-steps { display: flex; align-items: center; gap: 8px; margin-bottom: 20px; }
.wizard-step { display: flex; align-items: center; gap: 8px; color: var(--muted); font-size: 13px; font-weight: 600; }
.wizard-step .step-num { width: 26px; height: 26px; border-radius: 50%; background: var(--card-inner); color: var(--muted); display: flex; align-items: center; justify-content: center; font-size: 12.5px; flex-shrink: 0; }
.wizard-step.active .step-num { background: var(--accent); color: #fff; }
.wizard-step.done .step-num { background: var(--success); color: #fff; }
.wizard-step.active, .wizard-step.done { color: var(--text); }
.wizard-connector { flex: 1; height: 2px; background: var(--border); min-width: 20px; }

.wizard-panel { display: none; }
.wizard-panel.active { display: block; }
.wizard-nav { display: flex; justify-content: space-between; margin-top: 18px; }

.source-choice-row { display: grid; grid-template-columns: repeat(3, 1fr); gap: 12px; }
.source-choice-card {
  border: 2px solid var(--border); border-radius: var(--radius); padding: 16px; cursor: pointer; text-align: center;
  transition: border-color 120ms ease, background 120ms ease;
}
.source-choice-card:hover { background: var(--card-inner); }
.source-choice-card.selected { border-color: var(--accent); background: var(--accent-soft); }
.source-choice-card .sc-icon { color: var(--accent); margin-bottom: 8px; }
.source-choice-card .sc-title { font-weight: 700; font-size: 13.5px; }
.source-choice-card .sc-sub { font-size: 11.5px; color: var(--muted); margin-top: 3px; }

.dropzone {
  border: 2px dashed var(--border); border-radius: var(--radius); padding: 32px 20px; text-align: center; color: var(--muted);
  cursor: pointer; transition: border-color 120ms ease, background 120ms ease;
}
.dropzone:hover, .dropzone.dragover { border-color: var(--accent); background: var(--accent-soft); color: var(--accent); }
.dropzone .dz-icon { margin-bottom: 8px; }
.dropzone .dz-filename { font-weight: 600; color: var(--text); margin-top: 8px; font-size: 12.5px; }

.grid-2 { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; }
.grid-3 { display: grid; grid-template-columns: repeat(3, 1fr); gap: 14px; }
.grid-4 { display: grid; grid-template-columns: repeat(4, 1fr); gap: 14px; }
.source-fieldset { border: 1px dashed var(--border); border-radius: var(--radius); padding: 16px; display: flex; flex-direction: column; gap: 12px; }
.source-fieldset legend { font-weight: 600; font-size: 13px; padding: 0 6px; }
.checkbox-label { display: flex; align-items: center; gap: 8px; font-weight: normal; }
.checkbox-label input[type="checkbox"] { width: auto; }
.or-divider { text-align: center; color: var(--muted); font-size: 12px; }

.tabs { display: flex; gap: 4px; border-bottom: 1px solid var(--border); margin-bottom: 18px; flex-wrap: wrap; }
.tab-btn { background: none; border: none; padding: 10px 14px; font-size: 13.5px; cursor: pointer; color: var(--muted); border-bottom: 2px solid transparent; font-weight: 500; }
.tab-btn.active { color: var(--accent); border-bottom-color: var(--accent); font-weight: 700; }
.tab-panel { display: none; }
.tab-panel.active { display: block; }

.chip-row { display: flex; gap: 8px; flex-wrap: wrap; }
.chip { background: var(--card-inner); border-radius: 999px; padding: 4px 12px; font-size: 12px; }

.download-row { display: flex; gap: 10px; flex-wrap: wrap; }

.transcript-line { display: flex; gap: 10px; padding: 7px 0; border-bottom: 1px solid var(--border); font-size: 13.5px; }
.transcript-line .ts { color: var(--muted); font-variant-numeric: tabular-nums; min-width: 46px; }
.transcript-line .speaker { font-weight: 700; min-width: 100px; }

.decision-list { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 12px; }
.decision-list li { padding-bottom: 10px; border-bottom: 1px solid var(--border); }

.chat-panel { display: flex; flex-direction: column; height: 420px; }
.chat-log { flex: 1; overflow-y: auto; display: flex; flex-direction: column; gap: 10px; margin-bottom: 12px; }
.chat-msg { padding: 10px 14px; border-radius: var(--radius-sm); max-width: 80%; font-size: 13.5px; }
.chat-msg.user { background: var(--accent); color: #fff; align-self: flex-end; }
.chat-msg.ai { background: var(--card-inner); align-self: flex-start; }
.chat-msg .sources { display: block; margin-top: 6px; font-size: 11px; color: var(--muted); }
.chat-form { display: flex; gap: 10px; }
.chat-form input { flex: 1; }

.search-form { display: flex; gap: 10px; }
.search-form input { flex: 1; }
.search-results { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 14px; }
.search-results li { border-bottom: 1px solid var(--border); padding-bottom: 12px; }
.excerpt { margin: 4px 0 0; font-size: 13px; }

/* ---------- Audit log ---------- */
.audit-filters { margin-bottom: 16px; }
.audit-charts { margin-bottom: 16px; align-items: stretch; }

.bar-chart { display: flex; align-items: flex-end; gap: 6px; height: 140px; padding-top: 10px; }
.bar-col { flex: 1; display: flex; flex-direction: column; align-items: center; justify-content: flex-end; height: 100%; gap: 6px; }
.bar { width: 100%; background: var(--accent); border-radius: 4px 4px 0 0; min-height: 2px; transition: height 200ms ease; }
.bar-label { font-size: 10px; color: var(--muted); writing-mode: vertical-rl; transform: rotate(180deg); white-space: nowrap; }

.donut-row { display: flex; align-items: center; gap: 24px; flex-wrap: wrap; }
.donut-center-label { font-size: 20px; font-weight: 700; }
.donut-center-sub { font-size: 10.5px; color: var(--muted); }
.pie-legend { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 8px; font-size: 12.5px; flex: 1; min-width: 160px; }
.pie-legend li { display: flex; align-items: center; justify-content: space-between; gap: 8px; }
.legend-swatch { display: inline-block; width: 9px; height: 9px; border-radius: 2px; margin-right: 8px; flex-shrink: 0; }

/* ---------- Responsive ---------- */
@media (max-width: 900px) {
  .sidebar { position: fixed; left: -100%; height: 100vh; width: 240px; box-shadow: var(--shadow-lg); transition: left 180ms ease; }
  .app-shell.mobile-nav-open .sidebar { left: 0; }
  .topbar-mobile-toggle { display: flex; }
  .sidebar-toggle { display: none; }
  .kpi-row { grid-template-columns: repeat(2, 1fr); }
  .quick-actions { grid-template-columns: 1fr; }
  .grid-2, .grid-3, .grid-4 { grid-template-columns: 1fr; }
  .source-choice-row { grid-template-columns: 1fr; }
  .nav-search { max-width: none; }
  .content { padding: 16px 14px 40px; }
  .donut-row { justify-content: center; }
}
@media (max-width: 560px) {
  .stat-row, .kpi-row { grid-template-columns: 1fr 1fr; }
}
