/* ============================================
   ProspectFlow — CSS Design System
   Base: Reset, Variables, Typography
   ============================================ */

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

:root {
  --brand:        #6366f1;
  --brand-dark:   #4f46e5;
  --brand-light:  #e0e7ff;
  --success:      #22c55e;
  --warning:      #f59e0b;
  --danger:       #ef4444;
  --info:         #0ea5e9;

  --bg:           #f8fafc;
  --surface:      #ffffff;
  --surface-2:    #f1f5f9;
  --border:       #e2e8f0;
  --border-dark:  #cbd5e1;

  --text:         #0f172a;
  --text-2:       #475569;
  --text-3:       #94a3b8;

  --radius:       10px;
  --radius-lg:    16px;
  --shadow-sm:    0 1px 3px rgba(0,0,0,.08);
  --shadow:       0 4px 16px rgba(0,0,0,.10);
  --shadow-lg:    0 8px 32px rgba(0,0,0,.14);

  --nav-w:        240px;
  --topbar-h:     60px;
  --font:         'Inter', system-ui, -apple-system, sans-serif;
}

html { font-size: 16px; }
body {
  font-family: var(--font);
  background: var(--bg);
  color: var(--text);
  line-height: 1.6;
  min-height: 100vh;
}

a { color: var(--brand); text-decoration: none; }
a:hover { color: var(--brand-dark); }
img { max-width: 100%; display: block; }
button, input, select, textarea { font-family: inherit; font-size: inherit; }

/* ============================================
   Layout — Sidebar + Main
   ============================================ */

.app-layout {
  display: flex;
  min-height: 100vh;
}

.sidebar {
  width: var(--nav-w);
  background: var(--text);
  color: #e2e8f0;
  display: flex;
  flex-direction: column;
  position: fixed;
  top: 0; left: 0; bottom: 0;
  z-index: 100;
  transition: transform .25s ease;
}

.sidebar-logo {
  padding: 20px 20px 16px;
  border-bottom: 1px solid rgba(255,255,255,.08);
}
.sidebar-logo .logo-text {
  font-size: 1.25rem;
  font-weight: 700;
  color: #fff;
  letter-spacing: -.5px;
}
.sidebar-logo .logo-sub {
  font-size: .7rem;
  color: var(--text-3);
  text-transform: uppercase;
  letter-spacing: 1px;
}

.sidebar-nav {
  flex: 1;
  overflow-y: auto;
  padding: 12px 0;
}
.nav-section-label {
  font-size: .65rem;
  text-transform: uppercase;
  letter-spacing: 1.2px;
  color: var(--text-3);
  padding: 16px 20px 4px;
}
.nav-item {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 9px 20px;
  color: #cbd5e1;
  font-size: .875rem;
  font-weight: 500;
  border-radius: 0;
  transition: background .15s, color .15s;
  cursor: pointer;
  border: none;
  background: none;
  width: 100%;
  text-align: left;
  text-decoration: none;
}
.nav-item:hover { background: rgba(255,255,255,.07); color: #fff; }
.nav-item.active { background: var(--brand); color: #fff; }
.nav-item .nav-icon { font-size: 1rem; width: 20px; text-align: center; flex-shrink: 0; }
.nav-badge {
  margin-left: auto;
  background: var(--danger);
  color: #fff;
  font-size: .65rem;
  font-weight: 700;
  padding: 1px 6px;
  border-radius: 99px;
  min-width: 18px;
  text-align: center;
}

.sidebar-footer {
  padding: 16px 20px;
  border-top: 1px solid rgba(255,255,255,.08);
  font-size: .8rem;
  color: var(--text-3);
}
.sidebar-footer .user-name { color: #e2e8f0; font-weight: 600; }
.sidebar-footer .user-role { font-size: .7rem; text-transform: capitalize; }

.main-wrap {
  margin-left: var(--nav-w);
  flex: 1;
  display: flex;
  flex-direction: column;
  min-height: 100vh;
}

.topbar {
  height: var(--topbar-h);
  background: var(--surface);
  border-bottom: 1px solid var(--border);
  display: flex;
  align-items: center;
  padding: 0 24px;
  gap: 16px;
  position: sticky;
  top: 0;
  z-index: 50;
}
.topbar-title {
  font-size: 1.05rem;
  font-weight: 600;
  color: var(--text);
  flex: 1;
}
.topbar-actions { display: flex; align-items: center; gap: 10px; }

.page-content {
  padding: 28px 28px;
  flex: 1;
}

/* Mobile sidebar toggle */
.sidebar-toggle {
  display: none;
  background: none;
  border: none;
  font-size: 1.4rem;
  cursor: pointer;
  color: var(--text);
  padding: 4px;
}

/* ============================================
   Components — Buttons
   ============================================ */

.btn {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 8px 16px;
  border-radius: var(--radius);
  font-size: .875rem;
  font-weight: 600;
  border: none;
  cursor: pointer;
  transition: background .15s, box-shadow .15s, transform .1s;
  text-decoration: none;
  white-space: nowrap;
}
.btn:active { transform: scale(.97); }
.btn-primary   { background: var(--brand); color: #fff; }
.btn-primary:hover { background: var(--brand-dark); color: #fff; }
.btn-success   { background: var(--success); color: #fff; }
.btn-success:hover { background: #16a34a; color: #fff; }
.btn-danger    { background: var(--danger); color: #fff; }
.btn-danger:hover  { background: #dc2626; color: #fff; }
.btn-warning   { background: var(--warning); color: #fff; }
.btn-warning:hover { background: #d97706; color: #fff; }
.btn-ghost {
  background: transparent;
  color: var(--text-2);
  border: 1px solid var(--border-dark);
}
.btn-ghost:hover { background: var(--surface-2); color: var(--text); }
.btn-sm { padding: 5px 11px; font-size: .8rem; }
.btn-lg { padding: 11px 22px; font-size: 1rem; }
.btn-icon { padding: 7px; border-radius: var(--radius); }
.btn:disabled { opacity: .5; cursor: not-allowed; }

/* ============================================
   Components — Cards
   ============================================ */

.card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-sm);
}
.card-header {
  padding: 18px 20px 14px;
  border-bottom: 1px solid var(--border);
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}
.card-title {
  font-size: .95rem;
  font-weight: 700;
  color: var(--text);
}
.card-body { padding: 20px; }
.card-footer {
  padding: 14px 20px;
  border-top: 1px solid var(--border);
  background: var(--surface-2);
  border-radius: 0 0 var(--radius-lg) var(--radius-lg);
}

/* ============================================
   Components — Forms
   ============================================ */

.form-group { margin-bottom: 18px; }
.form-label {
  display: block;
  font-size: .8rem;
  font-weight: 600;
  color: var(--text-2);
  margin-bottom: 5px;
  text-transform: uppercase;
  letter-spacing: .4px;
}
.form-control {
  width: 100%;
  padding: 9px 12px;
  border: 1px solid var(--border-dark);
  border-radius: var(--radius);
  background: var(--surface);
  color: var(--text);
  font-size: .9rem;
  transition: border-color .15s, box-shadow .15s;
}
.form-control:focus {
  outline: none;
  border-color: var(--brand);
  box-shadow: 0 0 0 3px rgba(99,102,241,.15);
}
.form-control::placeholder { color: var(--text-3); }
select.form-control { cursor: pointer; }
textarea.form-control { resize: vertical; min-height: 90px; }
.form-hint { font-size: .75rem; color: var(--text-3); margin-top: 4px; }
.form-error { font-size: .75rem; color: var(--danger); margin-top: 4px; }
.form-row { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; }

/* ============================================
   Components — Badges, Tags, Pills
   ============================================ */

.badge {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 2px 9px;
  border-radius: 99px;
  font-size: .72rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: .4px;
}
.badge-brand   { background: var(--brand-light); color: var(--brand-dark); }
.badge-success { background: #dcfce7; color: #15803d; }
.badge-warning { background: #fef3c7; color: #92400e; }
.badge-danger  { background: #fee2e2; color: #991b1b; }
.badge-info    { background: #e0f2fe; color: #0369a1; }
.badge-neutral { background: var(--surface-2); color: var(--text-2); }

/* Sentiment badges */
.sentiment-hot     { background: #fef2f2; color: #dc2626; }
.sentiment-warm    { background: #fff7ed; color: #c2410c; }
.sentiment-neutral { background: var(--surface-2); color: var(--text-2); }
.sentiment-cooling { background: #eff6ff; color: #1d4ed8; }
.sentiment-cold    { background: #f0f9ff; color: #0369a1; }

/* Channel badges */
.channel-call_in   { background: #dcfce7; color: #15803d; }
.channel-call_out  { background: #f0fdf4; color: #166534; }
.channel-email_in  { background: #eff6ff; color: #1d4ed8; }
.channel-email_out { background: #eef2ff; color: #3730a3; }
.channel-sms_in    { background: #fdf4ff; color: #7e22ce; }
.channel-sms_out   { background: #faf5ff; color: #6b21a8; }
.channel-meeting   { background: #fff7ed; color: #c2410c; }
.channel-note      { background: var(--surface-2); color: var(--text-2); }

/* ============================================
   Components — Tables
   ============================================ */

.table-wrap { overflow-x: auto; }
table { width: 100%; border-collapse: collapse; font-size: .875rem; }
thead th {
  text-align: left;
  padding: 10px 14px;
  font-size: .72rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: .5px;
  color: var(--text-2);
  background: var(--surface-2);
  border-bottom: 1px solid var(--border);
}
tbody td {
  padding: 12px 14px;
  border-bottom: 1px solid var(--border);
  color: var(--text);
  vertical-align: middle;
}
tbody tr:last-child td { border-bottom: none; }
tbody tr:hover { background: var(--surface-2); }
.table-link { color: var(--brand); font-weight: 600; }
.table-link:hover { text-decoration: underline; }

/* ============================================
   Components — Modal
   ============================================ */

.modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(15,23,42,.5);
  backdrop-filter: blur(2px);
  z-index: 200;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 20px;
  opacity: 0;
  pointer-events: none;
  transition: opacity .2s;
}
.modal-overlay.open { opacity: 1; pointer-events: all; }
.modal {
  background: var(--surface);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-lg);
  width: 100%;
  max-width: 560px;
  max-height: 90vh;
  overflow-y: auto;
  transform: translateY(16px);
  transition: transform .2s;
}
.modal-overlay.open .modal { transform: translateY(0); }
.modal-header {
  padding: 20px 24px 16px;
  border-bottom: 1px solid var(--border);
  display: flex;
  align-items: center;
  justify-content: space-between;
}
.modal-title { font-size: 1rem; font-weight: 700; }
.modal-close {
  background: none;
  border: none;
  font-size: 1.3rem;
  cursor: pointer;
  color: var(--text-3);
  padding: 2px 6px;
  border-radius: 6px;
}
.modal-close:hover { background: var(--surface-2); color: var(--text); }
.modal-body { padding: 24px; }
.modal-footer {
  padding: 16px 24px;
  border-top: 1px solid var(--border);
  display: flex;
  justify-content: flex-end;
  gap: 10px;
}
.modal-lg { max-width: 760px; }

/* ============================================
   Components — Heat Score, Stats, Alerts
   ============================================ */

.heat-score {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  font-weight: 700;
  font-size: .9rem;
}
.heat-score.hot    { color: #dc2626; }
.heat-score.warm   { color: #ea580c; }
.heat-score.neutral{ color: var(--text-2); }
.heat-score.cooling{ color: #2563eb; }
.heat-score.cold   { color: #0284c7; }

.stat-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(160px, 1fr));
  gap: 16px;
  margin-bottom: 28px;
}
.stat-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 20px;
  box-shadow: var(--shadow-sm);
}
.stat-label { font-size: .75rem; font-weight: 600; color: var(--text-2); text-transform: uppercase; letter-spacing: .5px; }
.stat-value { font-size: 2rem; font-weight: 800; color: var(--text); line-height: 1.1; margin: 4px 0 2px; }
.stat-sub   { font-size: .78rem; color: var(--text-3); }
.stat-card.accent-brand  { border-left: 4px solid var(--brand); }
.stat-card.accent-success{ border-left: 4px solid var(--success); }
.stat-card.accent-warning{ border-left: 4px solid var(--warning); }
.stat-card.accent-danger { border-left: 4px solid var(--danger); }

.alert {
  padding: 12px 16px;
  border-radius: var(--radius);
  font-size: .875rem;
  display: flex;
  align-items: flex-start;
  gap: 10px;
  margin-bottom: 16px;
}
.alert-info    { background: #e0f2fe; color: #0369a1; border: 1px solid #bae6fd; }
.alert-success { background: #dcfce7; color: #15803d; border: 1px solid #bbf7d0; }
.alert-warning { background: #fef3c7; color: #92400e; border: 1px solid #fde68a; }
.alert-danger  { background: #fee2e2; color: #991b1b; border: 1px solid #fecaca; }

/* ============================================
   Components — Tooltips
   ============================================ */

[data-tooltip] { position: relative; cursor: help; }
[data-tooltip]::after {
  content: attr(data-tooltip);
  position: absolute;
  bottom: calc(100% + 6px);
  left: 50%;
  transform: translateX(-50%);
  background: var(--text);
  color: #fff;
  font-size: .72rem;
  font-weight: 500;
  padding: 5px 9px;
  border-radius: 6px;
  white-space: nowrap;
  pointer-events: none;
  opacity: 0;
  transition: opacity .15s;
  z-index: 999;
  max-width: 220px;
  white-space: normal;
  text-align: center;
  line-height: 1.4;
}
[data-tooltip]:hover::after { opacity: 1; }

/* ============================================
   Components — Notification Bell
   ============================================ */

.notif-btn {
  position: relative;
  background: none;
  border: none;
  font-size: 1.2rem;
  cursor: pointer;
  padding: 6px;
  border-radius: var(--radius);
  color: var(--text-2);
  transition: background .15s;
}
.notif-btn:hover { background: var(--surface-2); }
.notif-dot {
  position: absolute;
  top: 4px; right: 4px;
  width: 8px; height: 8px;
  background: var(--danger);
  border-radius: 50%;
  border: 2px solid var(--surface);
}

/* ============================================
   Components — Empty State
   ============================================ */

.empty-state {
  text-align: center;
  padding: 60px 20px;
  color: var(--text-3);
}
.empty-state .empty-icon { font-size: 3rem; margin-bottom: 12px; }
.empty-state h3 { font-size: 1rem; color: var(--text-2); margin-bottom: 6px; }
.empty-state p  { font-size: .875rem; }

/* ============================================
   Page-specific — Login
   ============================================ */

.login-page {
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  background: linear-gradient(135deg, #1e1b4b 0%, #312e81 50%, #1e40af 100%);
  padding: 20px;
}
.login-card {
  background: var(--surface);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-lg);
  padding: 40px;
  width: 100%;
  max-width: 400px;
}
.login-logo { text-align: center; margin-bottom: 28px; }
.login-logo .logo-mark {
  font-size: 2.5rem;
  display: block;
  margin-bottom: 6px;
}
.login-logo h1 { font-size: 1.5rem; font-weight: 800; color: var(--text); }
.login-logo p  { font-size: .8rem; color: var(--text-3); margin-top: 2px; }

/* ============================================
   Page-specific — Pipeline / Kanban
   ============================================ */

.pipeline-board {
  display: flex;
  gap: 16px;
  overflow-x: auto;
  padding-bottom: 20px;
  align-items: flex-start;
}
.pipeline-col {
  flex: 0 0 260px;
  background: var(--surface-2);
  border-radius: var(--radius-lg);
  border: 1px solid var(--border);
}
.pipeline-col-header {
  padding: 14px 16px 10px;
  border-bottom: 1px solid var(--border);
  display: flex;
  align-items: center;
  justify-content: space-between;
}
.pipeline-col-name {
  font-size: .85rem;
  font-weight: 700;
  display: flex;
  align-items: center;
  gap: 8px;
}
.stage-dot {
  width: 10px; height: 10px;
  border-radius: 50%;
  flex-shrink: 0;
}
.pipeline-col-count {
  font-size: .75rem;
  background: var(--border);
  color: var(--text-2);
  padding: 1px 7px;
  border-radius: 99px;
  font-weight: 700;
}
.pipeline-cards {
  padding: 10px;
  min-height: 80px;
  display: flex;
  flex-direction: column;
  gap: 8px;
}
.pipeline-cards.drag-over { background: var(--brand-light); border-radius: var(--radius); }

.prospect-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 12px 14px;
  cursor: grab;
  box-shadow: var(--shadow-sm);
  transition: box-shadow .15s, transform .15s;
}
.prospect-card:hover { box-shadow: var(--shadow); transform: translateY(-1px); }
.prospect-card.dragging { opacity: .5; transform: rotate(2deg); }
.prospect-card-name { font-size: .875rem; font-weight: 700; color: var(--text); margin-bottom: 2px; }
.prospect-card-company { font-size: .75rem; color: var(--text-2); margin-bottom: 8px; }
.prospect-card-meta {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 6px;
}
.velocity-bar {
  height: 3px;
  border-radius: 99px;
  margin-top: 8px;
  background: var(--border);
}
.velocity-bar .fill { height: 100%; border-radius: 99px; }
.velocity-green  .fill { background: var(--success); }
.velocity-amber  .fill { background: var(--warning); }
.velocity-red    .fill { background: var(--danger); }

/* ============================================
   Page-specific — Timeline
   ============================================ */

.timeline { display: flex; flex-direction: column; gap: 0; }
.timeline-item {
  display: flex;
  gap: 14px;
  padding: 16px 0;
  border-bottom: 1px solid var(--border);
  position: relative;
}
.timeline-item:last-child { border-bottom: none; }
.timeline-icon {
  width: 36px; height: 36px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: .9rem;
  flex-shrink: 0;
  margin-top: 2px;
}
.timeline-body { flex: 1; min-width: 0; }
.timeline-header {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 8px;
  margin-bottom: 4px;
}
.timeline-channel { font-weight: 700; font-size: .85rem; }
.timeline-time { font-size: .75rem; color: var(--text-3); margin-left: auto; }
.timeline-text { font-size: .875rem; color: var(--text-2); line-height: 1.5; }
.timeline-meta { display: flex; gap: 8px; flex-wrap: wrap; margin-top: 6px; }

/* ============================================
   Page-specific — Commitment / Promise Ledger
   ============================================ */

.commitment-item {
  display: flex;
  align-items: flex-start;
  gap: 12px;
  padding: 12px 0;
  border-bottom: 1px solid var(--border);
}
.commitment-item:last-child { border-bottom: none; }
.commitment-check {
  width: 20px; height: 20px;
  border-radius: 50%;
  border: 2px solid var(--border-dark);
  cursor: pointer;
  flex-shrink: 0;
  margin-top: 2px;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: background .15s, border-color .15s;
}
.commitment-check.done { background: var(--success); border-color: var(--success); color: #fff; }
.commitment-check.overdue { border-color: var(--danger); }
.commitment-desc { font-size: .875rem; font-weight: 600; color: var(--text); }
.commitment-due  { font-size: .75rem; color: var(--text-3); }
.commitment-due.overdue { color: var(--danger); font-weight: 700; }
.commitment-due.soon    { color: var(--warning); font-weight: 700; }
.commitment-maker { font-size: .72rem; }

/* ============================================
   Page-specific — Dashboard Briefing
   ============================================ */

.briefing-card {
  background: linear-gradient(135deg, var(--brand) 0%, var(--brand-dark) 100%);
  color: #fff;
  border-radius: var(--radius-lg);
  padding: 24px 28px;
  margin-bottom: 24px;
  box-shadow: var(--shadow);
}
.briefing-card h2 { font-size: 1.1rem; font-weight: 700; margin-bottom: 6px; opacity: .9; }
.briefing-card p  { font-size: .95rem; line-height: 1.6; opacity: .95; }

.task-item {
  display: flex;
  align-items: flex-start;
  gap: 12px;
  padding: 14px 0;
  border-bottom: 1px solid var(--border);
}
.task-item:last-child { border-bottom: none; }
.task-icon {
  width: 34px; height: 34px;
  border-radius: var(--radius);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: .9rem;
  flex-shrink: 0;
}
.task-body { flex: 1; min-width: 0; }
.task-prospect { font-weight: 700; font-size: .875rem; color: var(--text); }
.task-reason   { font-size: .8rem; color: var(--text-2); margin-top: 1px; }
.task-due      { font-size: .72rem; color: var(--text-3); margin-top: 2px; }
.task-due.overdue { color: var(--danger); font-weight: 700; }
.task-actions  { display: flex; gap: 6px; align-items: center; flex-shrink: 0; }

.section-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 16px;
  gap: 12px;
}
.section-title {
  font-size: .95rem;
  font-weight: 700;
  color: var(--text);
  display: flex;
  align-items: center;
  gap: 8px;
}
.section-title .count {
  background: var(--brand-light);
  color: var(--brand-dark);
  font-size: .7rem;
  padding: 1px 7px;
  border-radius: 99px;
  font-weight: 700;
}

/* ============================================
   Page-specific — Inbox
   ============================================ */

.inbox-layout {
  display: grid;
  grid-template-columns: 300px 1fr;
  gap: 0;
  height: calc(100vh - var(--topbar-h) - 56px);
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  overflow: hidden;
}
.inbox-list {
  border-right: 1px solid var(--border);
  overflow-y: auto;
}
.inbox-list-header {
  padding: 14px 16px;
  border-bottom: 1px solid var(--border);
  font-weight: 700;
  font-size: .875rem;
  background: var(--surface-2);
  display: flex;
  align-items: center;
  justify-content: space-between;
}
.inbox-item {
  padding: 14px 16px;
  border-bottom: 1px solid var(--border);
  cursor: pointer;
  transition: background .12s;
}
.inbox-item:hover { background: var(--surface-2); }
.inbox-item.active { background: var(--brand-light); }
.inbox-item.unread .inbox-item-name { font-weight: 700; }
.inbox-item-name { font-size: .875rem; color: var(--text); }
.inbox-item-preview { font-size: .78rem; color: var(--text-3); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; margin-top: 2px; }
.inbox-item-meta { display: flex; justify-content: space-between; align-items: center; margin-bottom: 3px; }
.inbox-item-time { font-size: .7rem; color: var(--text-3); }

.inbox-thread {
  display: flex;
  flex-direction: column;
  overflow: hidden;
}
.inbox-thread-header {
  padding: 16px 20px;
  border-bottom: 1px solid var(--border);
  background: var(--surface-2);
}
.inbox-thread-name { font-weight: 700; font-size: 1rem; }
.inbox-thread-sub  { font-size: .8rem; color: var(--text-2); }
.inbox-messages {
  flex: 1;
  overflow-y: auto;
  padding: 20px;
  display: flex;
  flex-direction: column;
  gap: 16px;
}
.inbox-msg {
  max-width: 80%;
  padding: 12px 16px;
  border-radius: var(--radius-lg);
  font-size: .875rem;
  line-height: 1.5;
}
.inbox-msg.inbound  { background: var(--surface-2); border: 1px solid var(--border); align-self: flex-start; }
.inbox-msg.outbound { background: var(--brand); color: #fff; align-self: flex-end; }
.inbox-msg-meta { font-size: .7rem; opacity: .7; margin-top: 4px; }
.inbox-compose {
  padding: 16px 20px;
  border-top: 1px solid var(--border);
  display: flex;
  gap: 10px;
  align-items: flex-end;
}
.inbox-compose textarea {
  flex: 1;
  min-height: 60px;
  max-height: 120px;
  resize: none;
}

/* ============================================
   Page-specific — Reports
   ============================================ */

.report-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
  gap: 20px;
}
.chart-wrap {
  position: relative;
  height: 220px;
  display: flex;
  align-items: flex-end;
  gap: 8px;
  padding: 10px 0 0;
}
.chart-bar-group {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 4px;
}
.chart-bar {
  width: 100%;
  border-radius: 4px 4px 0 0;
  background: var(--brand);
  transition: height .4s ease;
  min-height: 4px;
}
.chart-bar:hover { background: var(--brand-dark); }
.chart-label { font-size: .65rem; color: var(--text-3); text-align: center; }
.chart-value { font-size: .7rem; font-weight: 700; color: var(--text-2); }

/* ============================================
   Page-specific — Admin
   ============================================ */

.admin-tabs {
  display: flex;
  gap: 4px;
  border-bottom: 2px solid var(--border);
  margin-bottom: 24px;
}
.admin-tab {
  padding: 10px 18px;
  font-size: .875rem;
  font-weight: 600;
  color: var(--text-2);
  cursor: pointer;
  border: none;
  background: none;
  border-bottom: 2px solid transparent;
  margin-bottom: -2px;
  transition: color .15s, border-color .15s;
}
.admin-tab.active { color: var(--brand); border-bottom-color: var(--brand); }
.admin-tab:hover  { color: var(--text); }

/* ============================================
   Page-specific — Tutorial
   ============================================ */

.tutorial-hero {
  background: linear-gradient(135deg, #1e1b4b 0%, #312e81 100%);
  color: #fff;
  border-radius: var(--radius-lg);
  padding: 40px;
  margin-bottom: 32px;
  text-align: center;
}
.tutorial-hero h1 { font-size: 2rem; font-weight: 800; margin-bottom: 10px; }
.tutorial-hero p  { font-size: 1rem; opacity: .85; max-width: 560px; margin: 0 auto; }

.tutorial-steps { counter-reset: step; }
.tutorial-step {
  display: flex;
  gap: 20px;
  padding: 24px 0;
  border-bottom: 1px solid var(--border);
}
.tutorial-step:last-child { border-bottom: none; }
.step-num {
  counter-increment: step;
  width: 40px; height: 40px;
  border-radius: 50%;
  background: var(--brand);
  color: #fff;
  font-weight: 800;
  font-size: 1rem;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}
.step-num::before { content: counter(step); }
.step-body h3 { font-size: .95rem; font-weight: 700; margin-bottom: 6px; }
.step-body p  { font-size: .875rem; color: var(--text-2); line-height: 1.6; }
.step-tip {
  background: var(--brand-light);
  color: var(--brand-dark);
  border-radius: var(--radius);
  padding: 10px 14px;
  font-size: .8rem;
  margin-top: 10px;
  display: flex;
  gap: 8px;
  align-items: flex-start;
}

/* ============================================
   Utilities
   ============================================ */

.flex         { display: flex; }
.flex-col     { flex-direction: column; }
.items-center { align-items: center; }
.justify-between { justify-content: space-between; }
.gap-2  { gap: 8px; }
.gap-3  { gap: 12px; }
.gap-4  { gap: 16px; }
.mt-1   { margin-top: 4px; }
.mt-2   { margin-top: 8px; }
.mt-3   { margin-top: 12px; }
.mt-4   { margin-top: 16px; }
.mb-4   { margin-bottom: 16px; }
.mb-6   { margin-bottom: 24px; }
.text-sm   { font-size: .875rem; }
.text-xs   { font-size: .75rem; }
.text-muted{ color: var(--text-3); }
.text-2    { color: var(--text-2); }
.font-bold { font-weight: 700; }
.truncate  { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.w-full    { width: 100%; }
.hidden    { display: none !important; }
.spinner {
  width: 20px; height: 20px;
  border: 2px solid var(--border);
  border-top-color: var(--brand);
  border-radius: 50%;
  animation: spin .6s linear infinite;
  display: inline-block;
}
@keyframes spin { to { transform: rotate(360deg); } }

/* ============================================
   Responsive — Mobile
   ============================================ */

@media (max-width: 768px) {
  :root { --nav-w: 0px; }

  .sidebar {
    transform: translateX(-240px);
    width: 240px;
  }
  .sidebar.open { transform: translateX(0); }

  .main-wrap { margin-left: 0; }

  .sidebar-toggle { display: block; }

  .page-content { padding: 16px; }

  .form-row { grid-template-columns: 1fr; }

  .stat-grid { grid-template-columns: 1fr 1fr; }

  .pipeline-board { flex-direction: column; }
  .pipeline-col   { flex: none; width: 100%; }

  .inbox-layout { grid-template-columns: 1fr; height: auto; }
  .inbox-list   { border-right: none; border-bottom: 1px solid var(--border); max-height: 300px; }

  .report-grid { grid-template-columns: 1fr; }

  .modal { max-width: 100%; margin: 0; border-radius: var(--radius-lg) var(--radius-lg) 0 0; }
  .modal-overlay { align-items: flex-end; padding: 0; }

  .topbar { padding: 0 16px; }

  .tutorial-hero { padding: 24px 20px; }
  .tutorial-hero h1 { font-size: 1.4rem; }

  .admin-tabs { overflow-x: auto; }
}

@media (max-width: 480px) {
  .stat-grid { grid-template-columns: 1fr; }
  .briefing-card { padding: 18px; }
}

/* Sidebar overlay for mobile */
.sidebar-overlay {
  display: none;
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,.4);
  z-index: 99;
}
.sidebar-overlay.open { display: block; }
