/* ─── Design Tokens ────────────────────────────────────────────────────────── */
:root {
  --bg-base:      #080e1c;
  --bg-surface:   #0f1829;
  --bg-card:      #162033;
  --bg-input:     #1c2840;
  --bg-hover:     #1e2d47;
  --border:       #243450;
  --border-light: #2c3e5a;

  --accent:       #4f8ef7;
  --accent-dark:  #3a72d8;
  --accent-glow:  rgba(79,142,247,.15);

  --success:      #22d3a0;
  --success-bg:   rgba(34,211,160,.1);
  --warning:      #f5a623;
  --warning-bg:   rgba(245,166,35,.1);
  --danger:       #f25c7a;
  --danger-bg:    rgba(242,92,122,.1);
  --info:         #4f8ef7;
  --info-bg:      rgba(79,142,247,.1);

  --text-primary:   #e8edf5;
  --text-secondary: #7a8fa8;
  --text-muted:     #3e5070;

  --sidebar-w: 240px;
  --topbar-h:  60px;
  --radius:    8px;
  --radius-lg: 12px;
  --shadow:    0 4px 24px rgba(0,0,0,.4);
  --transition: 150ms ease;
}

/* ─── Reset ─────────────────────────────────────────────────────────────────── */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
html { font-size: 14px; }
body {
  font-family: -apple-system, BlinkMacSystemFont, 'Inter', 'Segoe UI', sans-serif;
  background: var(--bg-base);
  color: var(--text-primary);
  line-height: 1.5;
  overflow: hidden;
  height: 100vh;
}
a { color: inherit; text-decoration: none; }
button { cursor: pointer; border: none; background: none; font: inherit; color: inherit; }
input, textarea, select { font: inherit; color: inherit; background: none; border: none; outline: none; }

/* ─── Layout ─────────────────────────────────────────────────────────────────── */
.app-shell {
  display: flex;
  height: 100vh;
  overflow: hidden;
}

/* ─── Sidebar ────────────────────────────────────────────────────────────────── */
.sidebar {
  width: var(--sidebar-w);
  background: var(--bg-surface);
  border-right: 1px solid var(--border);
  display: flex;
  flex-direction: column;
  flex-shrink: 0;
  transition: width var(--transition);
}

.sidebar-header {
  height: var(--topbar-h);
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 16px;
  border-bottom: 1px solid var(--border);
}

.logo {
  display: flex;
  align-items: center;
  gap: 10px;
  color: var(--text-primary);
}

.logo-icon {
  width: 28px;
  height: 28px;
  color: var(--accent);
  flex-shrink: 0;
}

.logo-text {
  font-weight: 700;
  font-size: 1.05rem;
  letter-spacing: -0.01em;
  white-space: nowrap;
}

.sidebar-toggle {
  font-size: 1.1rem;
  color: var(--text-secondary);
  padding: 4px;
  border-radius: 4px;
  display: none;
}

.sidebar-nav {
  flex: 1;
  padding: 12px 8px;
  overflow-y: auto;
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.nav-item {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 9px 12px;
  border-radius: var(--radius);
  color: var(--text-secondary);
  font-weight: 500;
  transition: background var(--transition), color var(--transition);
  position: relative;
}

.nav-item:hover {
  background: var(--bg-hover);
  color: var(--text-primary);
}

.nav-item.active {
  background: var(--accent-glow);
  color: var(--accent);
}

.nav-icon {
  width: 18px;
  height: 18px;
  flex-shrink: 0;
}

.nav-badge {
  margin-left: auto;
  background: var(--accent);
  color: #fff;
  font-size: 0.65rem;
  font-weight: 700;
  padding: 1px 6px;
  border-radius: 20px;
  letter-spacing: 0.03em;
}

.sidebar-footer {
  padding: 12px;
  border-top: 1px solid var(--border);
}

.user-info {
  display: flex;
  align-items: center;
  gap: 10px;
}

.user-avatar {
  width: 34px;
  height: 34px;
  border-radius: 50%;
  background: linear-gradient(135deg, var(--accent), var(--accent-dark));
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 0.75rem;
  font-weight: 700;
  flex-shrink: 0;
}

.user-details { display: flex; flex-direction: column; }
.user-name { font-size: 0.85rem; font-weight: 600; }
.user-role { font-size: 0.75rem; color: var(--text-secondary); }

/* ─── Topbar ─────────────────────────────────────────────────────────────────── */
.topbar {
  height: var(--topbar-h);
  background: var(--bg-surface);
  border-bottom: 1px solid var(--border);
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 24px;
  flex-shrink: 0;
}

.page-title {
  font-size: 1.05rem;
  font-weight: 600;
  letter-spacing: -0.01em;
}

.topbar-right {
  display: flex;
  align-items: center;
  gap: 12px;
}

.search-box {
  display: flex;
  align-items: center;
  gap: 8px;
  background: var(--bg-input);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 6px 12px;
  width: 240px;
}

.search-icon { width: 16px; height: 16px; color: var(--text-muted); flex-shrink: 0; }
.search-input { width: 100%; color: var(--text-primary); }
.search-input::placeholder { color: var(--text-muted); }

.icon-btn {
  width: 36px;
  height: 36px;
  border-radius: var(--radius);
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--text-secondary);
  transition: background var(--transition), color var(--transition);
  position: relative;
}
.icon-btn:hover { background: var(--bg-hover); color: var(--text-primary); }
.icon-btn svg { width: 18px; height: 18px; }

.notif-dot {
  position: absolute;
  top: 7px;
  right: 7px;
  width: 8px;
  height: 8px;
  background: var(--danger);
  border-radius: 50%;
  border: 2px solid var(--bg-surface);
}

.carrier-status {
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 0.8rem;
  color: var(--text-secondary);
}

.status-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  flex-shrink: 0;
}
.status-dot.online { background: var(--success); box-shadow: 0 0 6px var(--success); }
.status-dot.degraded { background: var(--warning); }
.status-dot.offline { background: var(--danger); }

/* ─── Main Content ───────────────────────────────────────────────────────────── */
.main-content {
  flex: 1;
  display: flex;
  flex-direction: column;
  overflow: hidden;
}

.page-content {
  flex: 1;
  overflow-y: auto;
  padding: 24px;
}

.page { display: none; }
.page.active { display: block; }

/* ─── Cards ──────────────────────────────────────────────────────────────────── */
.card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 20px;
}

.card-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 16px;
}

.card-title {
  font-size: 0.9rem;
  font-weight: 600;
  color: var(--text-primary);
}

.card-action {
  font-size: 0.8rem;
  color: var(--accent);
  cursor: pointer;
  padding: 4px 8px;
  border-radius: 4px;
  transition: background var(--transition);
}
.card-action:hover { background: var(--accent-glow); }

/* ─── Stat Cards ─────────────────────────────────────────────────────────────── */
.stats-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 16px;
  margin-bottom: 20px;
}

.stat-card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 18px 20px;
  display: flex;
  flex-direction: column;
  gap: 10px;
  transition: border-color var(--transition);
}

.stat-card:hover { border-color: var(--border-light); }

.stat-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.stat-label {
  font-size: 0.78rem;
  font-weight: 500;
  color: var(--text-secondary);
  text-transform: uppercase;
  letter-spacing: 0.04em;
}

.stat-icon {
  width: 32px;
  height: 32px;
  border-radius: var(--radius);
  display: flex;
  align-items: center;
  justify-content: center;
}

.stat-icon svg { width: 16px; height: 16px; }
.stat-icon.blue { background: var(--info-bg); color: var(--accent); }
.stat-icon.green { background: var(--success-bg); color: var(--success); }
.stat-icon.orange { background: var(--warning-bg); color: var(--warning); }
.stat-icon.red { background: var(--danger-bg); color: var(--danger); }

.stat-value {
  font-size: 1.8rem;
  font-weight: 700;
  letter-spacing: -0.03em;
}

.stat-delta {
  font-size: 0.78rem;
  color: var(--text-secondary);
}

.stat-delta .up { color: var(--success); }
.stat-delta .down { color: var(--danger); }

/* ─── Grid Layouts ───────────────────────────────────────────────────────────── */
.grid-2 { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; }
.grid-3 { display: grid; grid-template-columns: repeat(3, 1fr); gap: 16px; }

/* ─── Tables ─────────────────────────────────────────────────────────────────── */
.table-wrapper { overflow-x: auto; }

table {
  width: 100%;
  border-collapse: collapse;
}

thead th {
  text-align: left;
  font-size: 0.75rem;
  font-weight: 600;
  color: var(--text-secondary);
  text-transform: uppercase;
  letter-spacing: 0.04em;
  padding: 10px 16px;
  border-bottom: 1px solid var(--border);
  white-space: nowrap;
}

tbody td {
  padding: 12px 16px;
  font-size: 0.85rem;
  border-bottom: 1px solid var(--border);
  vertical-align: middle;
}

tbody tr:last-child td { border-bottom: none; }
tbody tr:hover { background: var(--bg-hover); }

.tracking-num {
  font-family: 'SFMono-Regular', Consolas, monospace;
  font-size: 0.8rem;
  color: var(--accent);
}

/* ─── Badges ─────────────────────────────────────────────────────────────────── */
.badge {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 3px 10px;
  border-radius: 20px;
  font-size: 0.72rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  white-space: nowrap;
}

.badge-delivered  { background: var(--success-bg); color: var(--success); }
.badge-transit    { background: var(--info-bg); color: var(--accent); }
.badge-delivery   { background: var(--warning-bg); color: var(--warning); }
.badge-exception  { background: var(--danger-bg); color: var(--danger); }
.badge-pending    { background: rgba(122,143,168,.1); color: var(--text-secondary); }
.badge-label      { background: rgba(122,143,168,.1); color: var(--text-secondary); }

.carrier-badge {
  display: inline-block;
  padding: 2px 8px;
  border-radius: 4px;
  font-size: 0.72rem;
  font-weight: 700;
  letter-spacing: 0.05em;
}
.carrier-fedex { background: #4d148c22; color: #ff6600; border: 1px solid #ff660033; }
.carrier-ups   { background: #35241422; color: #ffb500; border: 1px solid #ffb50033; }
.carrier-dhl   { background: #ffcc0022; color: #ffcc00; border: 1px solid #ffcc0033; }
.carrier-usps  { background: #00498822; color: #6db1e2; border: 1px solid #6db1e233; }

/* ─── Buttons ─────────────────────────────────────────────────────────────────── */
.btn {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 8px 16px;
  border-radius: var(--radius);
  font-size: 0.85rem;
  font-weight: 500;
  transition: all var(--transition);
  cursor: pointer;
}

.btn-primary {
  background: var(--accent);
  color: #fff;
}
.btn-primary:hover { background: var(--accent-dark); }

.btn-ghost {
  background: transparent;
  color: var(--text-secondary);
  border: 1px solid var(--border);
}
.btn-ghost:hover { background: var(--bg-hover); color: var(--text-primary); }

.btn-danger {
  background: var(--danger-bg);
  color: var(--danger);
  border: 1px solid var(--danger-bg);
}
.btn-danger:hover { background: var(--danger); color: #fff; }

.btn svg { width: 15px; height: 15px; }
.btn-sm { padding: 5px 10px; font-size: 0.78rem; }

/* ─── Forms ──────────────────────────────────────────────────────────────────── */
.form-group { margin-bottom: 16px; }

.form-label {
  display: block;
  font-size: 0.8rem;
  font-weight: 500;
  color: var(--text-secondary);
  margin-bottom: 6px;
}

.form-input, .form-select, .form-textarea {
  width: 100%;
  background: var(--bg-input);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 9px 12px;
  color: var(--text-primary);
  font-size: 0.85rem;
  transition: border-color var(--transition);
}

.form-input:focus, .form-select:focus, .form-textarea:focus {
  border-color: var(--accent);
  box-shadow: 0 0 0 3px var(--accent-glow);
}

.form-textarea { resize: vertical; min-height: 90px; }
.form-select option { background: var(--bg-card); }

/* ─── AI Chat ────────────────────────────────────────────────────────────────── */
.chat-container {
  display: flex;
  flex-direction: column;
  height: calc(100vh - var(--topbar-h) - 48px);
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  overflow: hidden;
}

.chat-header {
  padding: 14px 20px;
  border-bottom: 1px solid var(--border);
  display: flex;
  align-items: center;
  gap: 12px;
  background: var(--bg-surface);
}

.chat-avatar {
  width: 36px;
  height: 36px;
  border-radius: 50%;
  background: linear-gradient(135deg, var(--accent), #7c3aed);
  display: flex;
  align-items: center;
  justify-content: center;
}
.chat-avatar svg { width: 18px; height: 18px; color: #fff; }

.chat-info { flex: 1; }
.chat-name { font-size: 0.9rem; font-weight: 600; }
.chat-status { font-size: 0.75rem; color: var(--success); }

.chat-messages {
  flex: 1;
  overflow-y: auto;
  padding: 20px;
  display: flex;
  flex-direction: column;
  gap: 16px;
}

.chat-message {
  display: flex;
  gap: 12px;
  max-width: 85%;
}

.chat-message.user {
  align-self: flex-end;
  flex-direction: row-reverse;
}

.msg-avatar {
  width: 30px;
  height: 30px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 0.7rem;
  font-weight: 700;
  flex-shrink: 0;
  margin-top: 2px;
}

.msg-avatar.ai { background: linear-gradient(135deg, var(--accent), #7c3aed); }
.msg-avatar.user { background: var(--bg-hover); color: var(--text-secondary); }

.msg-content {
  background: var(--bg-input);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 10px 14px;
  font-size: 0.85rem;
  line-height: 1.6;
  white-space: pre-wrap;
}

.chat-message.user .msg-content {
  background: var(--accent-glow);
  border-color: var(--accent-dark);
}

.msg-tools {
  font-size: 0.72rem;
  color: var(--text-muted);
  margin-top: 6px;
  display: flex;
  gap: 6px;
  flex-wrap: wrap;
}

.tool-chip {
  background: var(--bg-hover);
  border: 1px solid var(--border);
  border-radius: 4px;
  padding: 1px 6px;
  display: flex;
  align-items: center;
  gap: 3px;
}

.chat-input-area {
  padding: 16px 20px;
  border-top: 1px solid var(--border);
  background: var(--bg-surface);
}

.chat-input-row {
  display: flex;
  gap: 10px;
  align-items: flex-end;
}

.chat-input {
  flex: 1;
  background: var(--bg-input);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 10px 14px;
  font-size: 0.875rem;
  resize: none;
  max-height: 120px;
  line-height: 1.5;
  transition: border-color var(--transition);
}

.chat-input:focus { border-color: var(--accent); }
.chat-input::placeholder { color: var(--text-muted); }

.chat-send {
  width: 40px;
  height: 40px;
  background: var(--accent);
  border-radius: var(--radius);
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  transition: background var(--transition);
}
.chat-send:hover { background: var(--accent-dark); }
.chat-send svg { width: 18px; height: 18px; color: #fff; }
.chat-send:disabled { opacity: 0.5; cursor: not-allowed; }

.chat-hints {
  margin-top: 8px;
  display: flex;
  gap: 6px;
  flex-wrap: wrap;
}

.chat-hint {
  font-size: 0.75rem;
  color: var(--text-muted);
  background: var(--bg-input);
  border: 1px solid var(--border);
  border-radius: 20px;
  padding: 3px 10px;
  cursor: pointer;
  transition: all var(--transition);
}
.chat-hint:hover { color: var(--accent); border-color: var(--accent-dark); background: var(--accent-glow); }

/* ─── Typing Indicator ───────────────────────────────────────────────────────── */
.typing-indicator {
  display: flex;
  gap: 4px;
  padding: 10px 14px;
  background: var(--bg-input);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  width: fit-content;
}

.typing-dot {
  width: 6px;
  height: 6px;
  background: var(--text-muted);
  border-radius: 50%;
  animation: typing 1.4s infinite;
}

.typing-dot:nth-child(2) { animation-delay: 0.2s; }
.typing-dot:nth-child(3) { animation-delay: 0.4s; }

@keyframes typing {
  0%, 60%, 100% { transform: translateY(0); opacity: 0.4; }
  30% { transform: translateY(-6px); opacity: 1; }
}

/* ─── Timeline ───────────────────────────────────────────────────────────────── */
.timeline { display: flex; flex-direction: column; gap: 0; }

.timeline-item {
  display: flex;
  gap: 16px;
  position: relative;
  padding-bottom: 20px;
}

.timeline-item:last-child { padding-bottom: 0; }

.timeline-spine {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0;
  flex-shrink: 0;
}

.timeline-dot {
  width: 12px;
  height: 12px;
  border-radius: 50%;
  background: var(--border);
  border: 2px solid var(--bg-card);
  flex-shrink: 0;
  z-index: 1;
}

.timeline-dot.active { background: var(--accent); box-shadow: 0 0 8px var(--accent-glow); }
.timeline-dot.delivered { background: var(--success); }
.timeline-dot.exception { background: var(--danger); }

.timeline-line {
  width: 2px;
  flex: 1;
  background: var(--border);
  margin-top: 2px;
}

.timeline-content { padding-top: 0; flex: 1; }
.timeline-time { font-size: 0.72rem; color: var(--text-muted); margin-bottom: 3px; }
.timeline-status { font-size: 0.82rem; font-weight: 600; margin-bottom: 2px; }
.timeline-location { font-size: 0.78rem; color: var(--text-secondary); }
.timeline-desc { font-size: 0.78rem; color: var(--text-muted); margin-top: 2px; }

/* ─── Documents ──────────────────────────────────────────────────────────────── */
.upload-zone {
  border: 2px dashed var(--border);
  border-radius: var(--radius-lg);
  padding: 40px 20px;
  text-align: center;
  cursor: pointer;
  transition: all var(--transition);
}

.upload-zone:hover, .upload-zone.dragging {
  border-color: var(--accent);
  background: var(--accent-glow);
}

.upload-icon { font-size: 2.5rem; margin-bottom: 12px; }
.upload-text { font-size: 0.9rem; color: var(--text-secondary); }
.upload-text strong { color: var(--accent); }
.upload-hint { font-size: 0.75rem; color: var(--text-muted); margin-top: 6px; }

/* ─── Progress Bar ───────────────────────────────────────────────────────────── */
.progress-bar {
  height: 6px;
  background: var(--border);
  border-radius: 3px;
  overflow: hidden;
}

.progress-fill {
  height: 100%;
  background: linear-gradient(90deg, var(--accent), #7c3aed);
  border-radius: 3px;
  transition: width 0.3s ease;
}

/* ─── Analytics Charts ───────────────────────────────────────────────────────── */
.chart-bars {
  display: flex;
  align-items: flex-end;
  gap: 8px;
  height: 120px;
  padding: 0 4px;
}

.chart-bar-wrap {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 4px;
  height: 100%;
  justify-content: flex-end;
}

.chart-bar {
  width: 100%;
  border-radius: 4px 4px 0 0;
  background: var(--accent);
  opacity: 0.7;
  transition: opacity var(--transition);
  min-height: 4px;
}
.chart-bar:hover { opacity: 1; }
.chart-bar.success { background: var(--success); }

.chart-label {
  font-size: 0.65rem;
  color: var(--text-muted);
  text-align: center;
}

/* ─── Prediction Card ────────────────────────────────────────────────────────── */
.prediction-value {
  font-size: 1.6rem;
  font-weight: 700;
  color: var(--success);
  margin-bottom: 4px;
}

.prediction-sub {
  font-size: 0.8rem;
  color: var(--text-secondary);
}

.prediction-meta {
  display: flex;
  gap: 16px;
  margin-top: 16px;
}

.pred-item { display: flex; flex-direction: column; gap: 2px; }
.pred-label { font-size: 0.72rem; color: var(--text-muted); }
.pred-val { font-size: 0.85rem; font-weight: 600; }

/* ─── Empty State ─────────────────────────────────────────────────────────────── */
.empty-state {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 60px 20px;
  color: var(--text-muted);
  text-align: center;
}

.empty-icon { font-size: 2.5rem; margin-bottom: 12px; }
.empty-title { font-size: 0.95rem; color: var(--text-secondary); margin-bottom: 6px; }
.empty-sub { font-size: 0.8rem; }

/* ─── Loading ────────────────────────────────────────────────────────────────── */
.spinner {
  width: 20px;
  height: 20px;
  border: 2px solid var(--border);
  border-top-color: var(--accent);
  border-radius: 50%;
  animation: spin 0.7s linear infinite;
}

@keyframes spin { to { transform: rotate(360deg); } }

.loading-overlay {
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 40px;
  gap: 10px;
  color: var(--text-muted);
  font-size: 0.85rem;
}

/* ─── Toast ──────────────────────────────────────────────────────────────────── */
.toast-container {
  position: fixed;
  bottom: 24px;
  right: 24px;
  display: flex;
  flex-direction: column;
  gap: 8px;
  z-index: 9999;
}

.toast {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 12px 16px;
  display: flex;
  align-items: center;
  gap: 10px;
  min-width: 260px;
  max-width: 360px;
  box-shadow: var(--shadow);
  animation: slideIn 0.2s ease;
  font-size: 0.85rem;
}

.toast.success { border-left: 3px solid var(--success); }
.toast.error   { border-left: 3px solid var(--danger); }
.toast.info    { border-left: 3px solid var(--accent); }
.toast.warning { border-left: 3px solid var(--warning); }

@keyframes slideIn {
  from { transform: translateX(100%); opacity: 0; }
  to   { transform: translateX(0); opacity: 1; }
}

/* ─── Modal ──────────────────────────────────────────────────────────────────── */
.modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,.6);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 1000;
  backdrop-filter: blur(4px);
}

.modal {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  width: 560px;
  max-width: 95vw;
  max-height: 85vh;
  display: flex;
  flex-direction: column;
  box-shadow: var(--shadow);
}

.modal-header {
  padding: 18px 20px;
  border-bottom: 1px solid var(--border);
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.modal-title { font-size: 0.95rem; font-weight: 600; }
.modal-close { color: var(--text-secondary); font-size: 1.3rem; padding: 0 4px; }
.modal-close:hover { color: var(--text-primary); }

.modal-body { padding: 20px; overflow-y: auto; flex: 1; font-size: 0.85rem; }

.modal-footer {
  padding: 14px 20px;
  border-top: 1px solid var(--border);
  display: flex;
  justify-content: flex-end;
  gap: 8px;
}

/* ─── Section Headers ────────────────────────────────────────────────────────── */
.section-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 16px;
}

.section-title {
  font-size: 0.9rem;
  font-weight: 600;
}

/* ─── Tabs ───────────────────────────────────────────────────────────────────── */
.tabs {
  display: flex;
  gap: 0;
  border-bottom: 1px solid var(--border);
  margin-bottom: 20px;
}

.tab {
  padding: 8px 16px;
  font-size: 0.85rem;
  color: var(--text-secondary);
  border-bottom: 2px solid transparent;
  cursor: pointer;
  transition: all var(--transition);
}

.tab.active {
  color: var(--accent);
  border-bottom-color: var(--accent);
}
.tab:hover:not(.active) { color: var(--text-primary); }

/* ─── Filter Bar ─────────────────────────────────────────────────────────────── */
.filter-bar {
  display: flex;
  gap: 10px;
  margin-bottom: 16px;
  flex-wrap: wrap;
}

.filter-chip {
  padding: 4px 12px;
  border-radius: 20px;
  font-size: 0.78rem;
  cursor: pointer;
  border: 1px solid var(--border);
  color: var(--text-secondary);
  transition: all var(--transition);
}

.filter-chip.active {
  background: var(--accent-glow);
  border-color: var(--accent-dark);
  color: var(--accent);
}

.filter-chip:hover:not(.active) { border-color: var(--border-light); color: var(--text-primary); }

/* ─── Streaming Cursor ───────────────────────────────────────────────────────── */
.stream-cursor {
  display: inline-block;
  width: 2px;
  height: 1em;
  background: var(--accent);
  margin-left: 2px;
  vertical-align: text-bottom;
  animation: blink 0.8s step-end infinite;
}

@keyframes blink {
  0%, 100% { opacity: 1; }
  50%       { opacity: 0; }
}

.stream-token-count {
  font-size: 0.7rem;
  color: var(--text-muted);
  margin-top: 4px;
  text-align: right;
}

/* Help page distinct header */
.help-header-banner {
  background: linear-gradient(135deg, rgba(79,142,247,.12) 0%, rgba(124,58,237,.08) 100%);
  border: 1px solid rgba(79,142,247,.2);
  border-radius: var(--radius-lg);
  padding: 20px 24px;
  margin-bottom: 16px;
  display: flex;
  align-items: center;
  gap: 16px;
}

.help-header-icon {
  width: 48px;
  height: 48px;
  background: linear-gradient(135deg, var(--accent), #7c3aed);
  border-radius: var(--radius-lg);
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}

.help-header-icon svg { width: 24px; height: 24px; color: #fff; }

.help-header-text h2 { font-size: 1rem; font-weight: 700; margin-bottom: 3px; }
.help-header-text p  { font-size: 0.8rem; color: var(--text-secondary); }

.sse-indicator {
  margin-left: auto;
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 0.72rem;
  color: var(--success);
  background: var(--success-bg);
  border: 1px solid rgba(34,211,160,.2);
  border-radius: 20px;
  padding: 4px 10px;
  flex-shrink: 0;
}

.sse-dot {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: var(--success);
  animation: pulse 2s ease infinite;
}

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

/* Help quick topics */
.topic-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 10px;
  margin-bottom: 16px;
}

.topic-card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 14px;
  cursor: pointer;
  transition: all var(--transition);
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.topic-card:hover {
  border-color: var(--accent-dark);
  background: var(--bg-hover);
  transform: translateY(-1px);
}

.topic-card-icon { font-size: 1.4rem; }
.topic-card-title { font-size: 0.82rem; font-weight: 600; }
.topic-card-sub   { font-size: 0.75rem; color: var(--text-secondary); }

/* ─── Scrollbars ─────────────────────────────────────────────────────────────── */
::-webkit-scrollbar { width: 6px; height: 6px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: var(--border); border-radius: 3px; }
::-webkit-scrollbar-thumb:hover { background: var(--border-light); }

/* ─── Utilities ──────────────────────────────────────────────────────────────── */
.text-success { color: var(--success); }
.text-warning { color: var(--warning); }
.text-danger  { color: var(--danger); }
.text-accent  { color: var(--accent); }
.text-muted   { color: var(--text-muted); }
.text-secondary { color: var(--text-secondary); }

.mb-0 { margin-bottom: 0; }
.mb-4 { margin-bottom: 4px; }
.mb-8 { margin-bottom: 8px; }
.mb-12 { margin-bottom: 12px; }
.mb-16 { margin-bottom: 16px; }
.mb-20 { margin-bottom: 20px; }

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

.mono {
  font-family: 'SFMono-Regular', Consolas, monospace;
  font-size: 0.8rem;
}

.risk-low    { color: var(--success); }
.risk-medium { color: var(--warning); }
.risk-high   { color: var(--danger); }
