/* WACRM — Precision Theme */
/* Design direction: Linear × Attio × Folk */
/* Dark depth layers, indigo accent, geometric type */

@import url('https://fonts.googleapis.com/css2?family=Outfit:wght@300..800&family=Fraunces:opsz,wght@9..144,300..700&display=swap');

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

:root {
  /* ── Surfaces (layered depth with blue-purple undertone) ── */
  --bg-deep: #08080d;
  --bg-primary: #0d0d14;
  --bg-elevated: #151520;
  --bg-card: #1a1a28;
  --bg-hover: #21212f;
  --bg-glass: rgba(21, 21, 32, 0.85);
  --border: rgba(255, 255, 255, 0.07);
  --border-accent: rgba(129, 140, 248, 0.2);

  /* ── Text ── */
  --text-primary: #ededf0;
  --text-secondary: #9898a8;
  --text-muted: #5c5c6e;
  --text-bright: #ffffff;

  /* ── Primary accent: Indigo ── */
  --gold: #818cf8;
  --gold-dim: rgba(129, 140, 248, 0.10);
  --gold-glow: rgba(129, 140, 248, 0.22);

  /* ── Status colors ── */
  --sapphire: #60a5fa;
  --sapphire-dim: rgba(96, 165, 250, 0.10);
  --emerald: #4ade80;
  --emerald-dim: rgba(74, 222, 128, 0.10);
  --ruby: #f87171;
  --ruby-dim: rgba(248, 113, 113, 0.10);
  --amber: #fbbf24;
  --amber-dim: rgba(251, 191, 36, 0.10);
  --violet: #c084fc;
  --violet-dim: rgba(192, 132, 252, 0.10);
  --cyan: #22d3ee;
  --cyan-dim: rgba(34, 211, 238, 0.10);

  /* ── Typography ── */
  --font-body: 'Outfit', -apple-system, system-ui, sans-serif;
  --font-display: 'Fraunces', Georgia, serif;

  /* ── Spacing ── */
  --sp-1: 4px; --sp-2: 8px; --sp-3: 12px; --sp-4: 16px;
  --sp-5: 20px; --sp-6: 24px; --sp-8: 32px; --sp-10: 40px;

  /* ── Legacy aliases (used by JS inline styles) ── */
  --accent-green: var(--emerald);
  --accent-blue: var(--sapphire);
  --accent-orange: var(--amber);
  --accent-red: var(--ruby);
  --accent-purple: var(--violet);
  --accent-cyan: var(--cyan);
  --bg-secondary: var(--bg-primary);
  --bg-tertiary: var(--bg-elevated);
  --bg-card: #1a1a28;
  --font: var(--font-body);
  --hot: var(--ruby);
  --med: var(--amber);
  --low: var(--text-muted);

  /* ── Radius ── */
  --r-sm: 8px; --r-md: 12px; --r-lg: 16px; --r-xl: 24px; --r-full: 9999px;

  /* ── Shadows ── */
  --shadow-sm: 0 1px 2px rgba(0,0,0,0.25);
  --shadow-card: 0 2px 8px rgba(0,0,0,0.2), 0 0 0 1px rgba(255,255,255,0.03);
  --shadow-elevated: 0 8px 32px rgba(0,0,0,0.45), 0 0 0 1px rgba(255,255,255,0.04);
  --shadow-glow-gold: 0 0 20px rgba(129, 140, 248, 0.08);

  /* ── Easing ── */
  --ease-out: cubic-bezier(0.16, 1, 0.3, 1);
  --ease-spring: cubic-bezier(0.34, 1.56, 0.64, 1);
}

/* ══════════════════════════════════════════
   BASE
   ══════════════════════════════════════════ */
html, body { height: 100%; }
body {
  font-family: var(--font-body);
  background: var(--bg-deep);
  color: var(--text-primary);
  line-height: 1.55;
  overflow-x: hidden;
  /* Gradient mesh background for depth */
  background-image:
    radial-gradient(ellipse at 15% 5%, rgba(129, 140, 248, 0.04) 0%, transparent 50%),
    radial-gradient(ellipse at 85% 90%, rgba(192, 132, 252, 0.025) 0%, transparent 50%);
}

/* Custom scrollbar */
::-webkit-scrollbar { width: 5px; height: 5px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: rgba(255,255,255,0.07); border-radius: 3px; }
::-webkit-scrollbar-thumb:hover { background: rgba(255,255,255,0.14); }
* { scrollbar-width: thin; scrollbar-color: rgba(255,255,255,0.07) transparent; }

::selection { background: rgba(129, 140, 248, 0.3); color: #fff; }

/* ══════════════════════════════════════════
   LAYOUT
   ══════════════════════════════════════════ */
.app { display: flex; flex-direction: column; height: 100vh; }
.main-layout { display: flex; flex: 1; overflow: hidden; }

/* ══════════════════════════════════════════
   HEADER (merged with mode switcher)
   ══════════════════════════════════════════ */
.header {
  background: var(--bg-primary);
  border-bottom: 1px solid var(--border);
  padding: 0 var(--sp-5);
  height: 52px;
  display: grid;
  grid-template-columns: auto 1fr auto;
  align-items: center;
  gap: var(--sp-4);
  flex-shrink: 0;
  position: sticky;
  top: 0;
  z-index: 100;
  backdrop-filter: blur(16px);
  -webkit-backdrop-filter: blur(16px);
}
.header-logo {
  font-family: var(--font-body);
  font-size: 17px;
  font-weight: 700;
  color: var(--text-bright);
  letter-spacing: -0.3px;
}
.header-logo span {
  color: var(--text-muted);
  font-size: 10px;
  font-weight: 500;
  margin-left: 4px;
  letter-spacing: 0;
}

/* ── Mode Switcher (segmented control) ── */
.mode-bar {
  justify-self: center;
  display: inline-flex;
  align-items: center;
  gap: 2px;
  background: rgba(255,255,255,0.03);
  border-radius: var(--r-full);
  padding: 3px;
  border: 1px solid var(--border);
  height: auto;
}
.mode-btn {
  padding: 6px 22px;
  border-radius: var(--r-full);
  border: none;
  background: transparent;
  color: var(--text-muted);
  font-size: 12px;
  font-weight: 500;
  font-family: var(--font-body);
  cursor: pointer;
  transition: all 0.2s var(--ease-out);
  letter-spacing: 0.2px;
  text-transform: none;
  max-width: none;
  flex: none;
  text-align: center;
}
.mode-btn:hover { color: var(--text-secondary); background: rgba(255,255,255,0.03); }
.mode-btn.active-ind {
  background: rgba(74, 222, 128, 0.1);
  color: var(--emerald);
  box-shadow: var(--shadow-sm);
  font-weight: 600;
}
.mode-btn.active-grp {
  background: rgba(96, 165, 250, 0.1);
  color: var(--sapphire);
  box-shadow: var(--shadow-sm);
  font-weight: 600;
}

/* ── Header Right ── */
.header-right {
  display: flex;
  align-items: center;
  gap: var(--sp-3);
}
.header-sync {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 11px;
  color: var(--text-secondary);
  margin-left: 0;
}
.sync-dot { width: 7px; height: 7px; border-radius: 50%; background: var(--emerald); flex-shrink: 0; animation: pulse 2.5s ease infinite; }
.sync-dot.yellow { background: var(--amber); }
.sync-dot.red { background: var(--ruby); animation: none; }
@keyframes pulse { 0%, 100% { opacity: 1; } 50% { opacity: 0.4; } }

.btn-sync {
  background: rgba(255,255,255,0.04);
  color: var(--text-secondary);
  border: 1px solid var(--border);
  border-radius: var(--r-sm);
  padding: 6px 14px;
  font-size: 11px;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.2s ease;
  font-family: var(--font-body);
  display: flex;
  align-items: center;
  gap: 6px;
}
.btn-sync:hover {
  background: var(--gold-dim);
  color: var(--gold);
  border-color: var(--gold-glow);
}

/* ══════════════════════════════════════════
   SIDEBAR
   ══════════════════════════════════════════ */
.sidebar {
  width: 240px;
  background: var(--bg-primary);
  border-right: 1px solid var(--border);
  padding: var(--sp-3);
  flex-shrink: 0;
  overflow-y: auto;
  scrollbar-width: none;
}
.sidebar::-webkit-scrollbar { display: none; }

.nav-section { margin-bottom: var(--sp-4); }
.nav-label {
  font-size: 10px;
  font-weight: 600;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 1px;
  padding: var(--sp-2) var(--sp-3);
  margin-bottom: 2px;
}
.nav-item {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 8px var(--sp-3);
  color: var(--text-secondary);
  cursor: pointer;
  font-size: 13px;
  font-weight: 450;
  transition: all 0.15s ease;
  border-radius: var(--r-sm);
  border-left: none;
  position: relative;
  margin-bottom: 1px;
}
.nav-item:hover {
  background: rgba(255,255,255,0.04);
  color: var(--text-primary);
}
.nav-item.active {
  background: var(--gold-dim);
  color: var(--gold);
  font-weight: 600;
  border-left: none;
}
/* Lucide icon styling */
.nav-icon {
  width: 16px;
  height: 16px;
  flex-shrink: 0;
  opacity: 0.6;
  stroke-width: 1.75;
}
.nav-item:hover .nav-icon { opacity: 0.85; }
.nav-item.active .nav-icon { opacity: 1; }

.nav-badge {
  margin-left: auto;
  min-width: 20px;
  text-align: center;
  border-radius: var(--r-full);
  padding: 2px 7px;
  font-size: 10px;
  font-weight: 600;
  letter-spacing: 0;
}
.nb-red { background: var(--ruby-dim); color: var(--ruby); }
.nb-green { background: var(--emerald-dim); color: var(--emerald); }
.nb-orange { background: var(--amber-dim); color: var(--amber); }
.nb-blue { background: var(--sapphire-dim); color: var(--sapphire); }
.nb-purple { background: var(--violet-dim); color: var(--violet); }

/* ══════════════════════════════════════════
   CONTENT
   ══════════════════════════════════════════ */
.content {
  flex: 1;
  overflow-y: auto;
  padding: var(--sp-6);
}

/* ══════════════════════════════════════════
   STAT CARDS
   ══════════════════════════════════════════ */
.stats-row {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: var(--sp-3);
  margin-bottom: var(--sp-5);
}
.stat-card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--r-lg);
  padding: var(--sp-5);
  position: relative;
  overflow: hidden;
  transition: transform 0.2s var(--ease-out), box-shadow 0.25s;
  animation: fadeInUp 0.35s var(--ease-out) backwards;
}
.stat-card::before {
  content: '';
  position: absolute;
  top: 0; left: 0; right: 0; bottom: 0;
  background: radial-gradient(ellipse at 20% 20%, rgba(129, 140, 248, 0.03) 0%, transparent 70%);
  pointer-events: none;
}
.stat-card:hover {
  transform: translateY(-2px);
  box-shadow: var(--shadow-card);
}
.stat-value {
  font-family: var(--font-display);
  font-size: 34px;
  font-weight: 600;
  line-height: 1;
  letter-spacing: -0.5px;
  position: relative;
}
.stat-label {
  font-size: 12px;
  color: var(--text-secondary);
  margin-top: 8px;
  font-weight: 450;
}
.stat-sub {
  font-size: 10px;
  color: var(--text-muted);
  margin-top: 2px;
}

@keyframes fadeInUp {
  from { opacity: 0; transform: translateY(8px); }
  to { opacity: 1; transform: translateY(0); }
}
.stat-card:nth-child(1) { animation-delay: 0s; }
.stat-card:nth-child(2) { animation-delay: 0.04s; }
.stat-card:nth-child(3) { animation-delay: 0.08s; }
.stat-card:nth-child(4) { animation-delay: 0.12s; }

/* ══════════════════════════════════════════
   INSIGHT CARDS (AI Boxes — collapsible)
   ══════════════════════════════════════════ */
.insights-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: var(--sp-3);
  margin-bottom: var(--sp-5);
}
.insight-card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--r-lg);
  padding: var(--sp-4);
  position: relative;
  max-height: 160px;
  overflow: hidden;
  cursor: pointer;
  transition: max-height 0.5s var(--ease-out), border-color 0.2s;
  animation: fadeInUp 0.45s var(--ease-out) backwards;
}
.insight-card::after {
  content: '';
  position: absolute;
  bottom: 0; left: 0; right: 0;
  height: 56px;
  background: linear-gradient(to bottom, transparent, var(--bg-card));
  pointer-events: none;
  transition: opacity 0.3s;
  border-radius: 0 0 var(--r-lg) var(--r-lg);
}
/* Expand indicator bar */
.insight-card::before {
  content: '';
  position: absolute;
  bottom: 8px;
  left: 50%;
  transform: translateX(-50%);
  width: 24px;
  height: 3px;
  border-radius: 2px;
  background: rgba(255,255,255,0.12);
  z-index: 2;
  transition: opacity 0.3s;
}
.insight-card:hover { border-color: rgba(255,255,255,0.1); }
.insight-card.expanded {
  max-height: 800px;
  overflow-y: auto;
}
.insight-card.expanded::after { opacity: 0; }
.insight-card.expanded::before { opacity: 0; }

.insight-card.strategic {
  border-color: rgba(192, 132, 252, 0.25);
  border-width: 1px;
  box-shadow: 0 0 16px rgba(192, 132, 252, 0.05);
}
.insight-badge {
  display: inline-block;
  font-size: 9px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.8px;
  padding: 3px 8px;
  border-radius: var(--r-sm);
  margin-bottom: 10px;
}
.ib-exec { background: var(--sapphire-dim); color: var(--sapphire); }
.ib-pers { background: var(--emerald-dim); color: var(--emerald); }
.ib-anal { background: var(--amber-dim); color: var(--amber); }
.ib-strat { background: var(--violet-dim); color: var(--violet); }

.insight-text {
  font-size: 12px;
  line-height: 1.65;
  color: var(--text-secondary);
}
.insight-refresh {
  position: absolute;
  top: 10px; right: 10px;
  background: none;
  border: none;
  color: var(--text-muted);
  cursor: pointer;
  font-size: 14px;
  padding: 4px;
  border-radius: 6px;
  transition: all 0.15s;
  z-index: 3;
}
.insight-refresh:hover { color: var(--gold); background: var(--gold-dim); }
.insight-loading { color: var(--text-muted); font-size: 11px; }
.idots::after { content: ''; animation: dots 1.5s steps(4, end) infinite; }
@keyframes dots { 0%{content:''} 25%{content:'.'} 50%{content:'..'} 75%{content:'...'} }

/* ══════════════════════════════════════════
   DASHBOARD 3-COLUMN
   ══════════════════════════════════════════ */
.dash-cols {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: var(--sp-4);
  margin-bottom: var(--sp-6);
}
.dash-col {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--r-lg);
  overflow: hidden;
  max-height: 520px;
  display: flex;
  flex-direction: column;
  animation: fadeInUp 0.45s var(--ease-out) backwards;
}
.dash-col:nth-child(1) { animation-delay: 0.06s; }
.dash-col:nth-child(2) { animation-delay: 0.1s; }
.dash-col:nth-child(3) { animation-delay: 0.14s; }

.dash-col-header {
  padding: var(--sp-3) var(--sp-4);
  border-bottom: 1px solid var(--border);
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 13px;
  font-weight: 600;
  flex-shrink: 0;
  background: rgba(255,255,255,0.015);
}
.dash-col-header .col-count {
  margin-left: auto;
  font-size: 10px;
  color: var(--text-muted);
  background: rgba(255,255,255,0.05);
  border-radius: var(--r-full);
  padding: 2px 8px;
  font-weight: 600;
}
.dash-col-body {
  overflow-y: auto;
  padding: var(--sp-2);
  flex: 1;
}

.dash-item {
  padding: 10px 12px;
  border-radius: var(--r-sm);
  cursor: pointer;
  transition: all 0.15s ease;
  border-bottom: 1px solid rgba(255,255,255,0.03);
}
.dash-item:last-child { border-bottom: none; }
.dash-item:hover { background: var(--bg-hover); transform: translateX(2px); }
.dash-item-name {
  font-size: 13px;
  font-weight: 600;
  margin-bottom: 3px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.dash-item-preview {
  font-size: 11px;
  color: var(--text-muted);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  line-height: 1.45;
}
.dash-item-meta {
  display: flex;
  gap: 8px;
  margin-top: 5px;
  font-size: 9px;
  color: var(--text-muted);
  align-items: center;
}

/* Status tags */
.dtag {
  padding: 2px 7px;
  border-radius: var(--r-full);
  font-size: 9px;
  font-weight: 600;
  letter-spacing: 0.2px;
  text-transform: uppercase;
}
.dtag-red { background: var(--ruby-dim); color: var(--ruby); }
.dtag-green { background: var(--emerald-dim); color: var(--emerald); }
.dtag-orange { background: var(--amber-dim); color: var(--amber); }
.dtag-blue { background: var(--sapphire-dim); color: var(--sapphire); }
.dtag-purple { background: var(--violet-dim); color: var(--violet); }

/* ══════════════════════════════════════════
   SECTION HEADERS
   ══════════════════════════════════════════ */
.section-header {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-bottom: var(--sp-4);
}
.section-title {
  font-family: var(--font-display);
  font-size: 22px;
  font-weight: 500;
  color: var(--text-bright);
  letter-spacing: -0.3px;
}
.section-count {
  font-size: 10px;
  color: var(--text-muted);
  background: rgba(255,255,255,0.05);
  border-radius: var(--r-full);
  padding: 3px 10px;
  font-weight: 600;
}

/* ══════════════════════════════════════════
   SEARCH & FILTERS
   ══════════════════════════════════════════ */
.search-box {
  background: var(--bg-elevated);
  border: 1px solid var(--border);
  border-radius: var(--r-md);
  padding: 10px 16px;
  color: var(--text-primary);
  font-size: 13px;
  font-family: var(--font-body);
  width: 100%;
  margin-bottom: var(--sp-3);
  outline: none;
  transition: border-color 0.2s, box-shadow 0.2s;
}
.search-box:focus {
  border-color: var(--gold);
  box-shadow: 0 0 0 3px var(--gold-dim);
}
.search-box::placeholder { color: var(--text-muted); }

.filter-row { display: flex; gap: 6px; margin-bottom: var(--sp-3); flex-wrap: wrap; }
.filter-btn {
  padding: 5px 13px;
  border-radius: var(--r-full);
  border: 1px solid var(--border);
  background: transparent;
  color: var(--text-secondary);
  font-size: 11px;
  font-family: var(--font-body);
  cursor: pointer;
  transition: all 0.15s;
  font-weight: 450;
}
.filter-btn:hover { border-color: rgba(255,255,255,0.14); color: var(--text-primary); }
.filter-btn.active {
  background: var(--gold-dim);
  border-color: var(--gold-glow);
  color: var(--gold);
  font-weight: 600;
}

/* IA Search box */
.search-ia-box {
  background: var(--bg-elevated);
  border: 1px solid var(--border);
  border-radius: var(--r-md);
  padding: 12px 16px;
  color: var(--text-primary);
  font-size: 14px;
  font-family: var(--font-body);
  width: 100%;
  margin-bottom: var(--sp-4);
  outline: none;
}
.search-ia-box:focus { border-color: var(--violet); box-shadow: 0 0 0 3px var(--violet-dim); }

/* ══════════════════════════════════════════
   CONTACT CARDS
   ══════════════════════════════════════════ */
.contacts-grid { display: flex; flex-direction: column; gap: 4px; }
.contact-card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--r-md);
  padding: var(--sp-3) var(--sp-4);
  display: flex;
  align-items: center;
  gap: var(--sp-3);
  cursor: pointer;
  transition: all 0.2s var(--ease-out);
  animation: fadeInUp 0.25s var(--ease-out) backwards;
}
.contact-card:hover {
  border-color: rgba(255,255,255,0.1);
  background: var(--bg-hover);
  transform: translateY(-1px);
  box-shadow: 0 4px 12px rgba(0,0,0,0.15);
}
.contact-avatar {
  width: 38px;
  height: 38px;
  border-radius: 10px;
  background: linear-gradient(135deg, rgba(129,140,248,0.08), rgba(192,132,252,0.06));
  border: 1px solid rgba(255,255,255,0.06);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 13px;
  font-weight: 700;
  color: var(--gold);
  flex-shrink: 0;
  transition: border-color 0.2s;
}
.contact-card:hover .contact-avatar { border-color: var(--gold-glow); }
.contact-avatar.grp { color: var(--sapphire); border-radius: 10px; }
.contact-info { flex: 1; min-width: 0; }
.contact-name {
  font-size: 13px;
  font-weight: 600;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.contact-preview {
  font-size: 11px;
  color: var(--text-secondary);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  margin-top: 2px;
  line-height: 1.45;
}
.contact-meta {
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  gap: 3px;
  flex-shrink: 0;
}
.contact-time { font-size: 10px; color: var(--text-muted); }
.contact-msgs { font-size: 10px; color: var(--text-muted); }

/* ══════════════════════════════════════════
   GROUP CARDS
   ══════════════════════════════════════════ */
.groups-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
  gap: 10px;
}
.group-card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--r-md);
  padding: var(--sp-4);
  cursor: pointer;
  transition: all 0.2s var(--ease-out);
}
.group-card:hover {
  border-color: rgba(96, 165, 250, 0.25);
  transform: translateY(-1px);
  box-shadow: var(--shadow-card);
}
.group-card-name { font-size: 14px; font-weight: 600; margin-bottom: 6px; }
.group-stats { display: flex; gap: 14px; font-size: 11px; color: var(--text-muted); }
.group-stats strong { color: var(--text-secondary); font-weight: 600; }

/* ══════════════════════════════════════════
   ALERT CARDS (Groups)
   ══════════════════════════════════════════ */
.alert-card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--r-md);
  padding: var(--sp-4);
  cursor: pointer;
  transition: all 0.2s var(--ease-out);
  margin-bottom: 8px;
}
.alert-card:hover { border-color: rgba(248, 113, 113, 0.2); transform: translateY(-1px); }
.alert-header { display: flex; align-items: center; gap: 8px; margin-bottom: 4px; flex-wrap: wrap; }
.alert-group-name { font-size: 14px; font-weight: 600; flex: 1; min-width: 0; }
.alert-time { font-size: 10px; color: var(--text-muted); flex-shrink: 0; }
.alert-reason { font-size: 11px; color: var(--text-secondary); margin-bottom: 4px; line-height: 1.45; }
.alert-msg {
  font-size: 12px;
  color: var(--text-primary);
  background: var(--bg-elevated);
  padding: 10px 12px;
  border-radius: var(--r-sm);
  margin-top: 6px;
  line-height: 1.5;
  border-left: 2px solid var(--gold);
}

/* ══════════════════════════════════════════
   KANBAN
   ══════════════════════════════════════════ */
.kanban-board {
  display: flex;
  gap: 12px;
  overflow-x: auto;
  padding-bottom: 8px;
  min-height: 400px;
}
.kanban-col {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--r-lg);
  min-width: 210px;
  max-width: 210px;
  flex-shrink: 0;
  display: flex;
  flex-direction: column;
  max-height: 560px;
}
.kanban-col-header {
  padding: 10px 12px;
  font-size: 12px;
  font-weight: 600;
  border-bottom: 1px solid var(--border);
  display: flex;
  align-items: center;
  gap: 6px;
  flex-shrink: 0;
  background: rgba(255,255,255,0.015);
}
.kanban-col-dot { width: 8px; height: 8px; border-radius: 50%; flex-shrink: 0; }
.kanban-col-count {
  margin-left: auto;
  font-size: 10px;
  color: var(--text-muted);
  background: rgba(255,255,255,0.05);
  border-radius: var(--r-full);
  padding: 2px 7px;
  font-weight: 600;
}
.kanban-cards {
  padding: 8px;
  display: flex;
  flex-direction: column;
  gap: 5px;
  overflow-y: auto;
  flex: 1;
}
.kanban-card {
  background: var(--bg-elevated);
  border: 1px solid var(--border);
  border-radius: var(--r-sm);
  padding: 9px 11px;
  cursor: pointer;
  transition: all 0.15s;
}
.kanban-card:hover {
  border-color: rgba(255,255,255,0.1);
  transform: translateY(-1px);
  box-shadow: var(--shadow-sm);
}
.kanban-card-name { font-size: 12px; font-weight: 500; margin-bottom: 4px; }
.kanban-card-meta { font-size: 10px; color: var(--text-muted); }

/* ══════════════════════════════════════════
   ANALYTICS
   ══════════════════════════════════════════ */
.analytics-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: var(--sp-4);
}
.analytics-card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--r-lg);
  padding: var(--sp-5);
}
.analytics-card-title {
  font-size: 12px;
  font-weight: 600;
  margin-bottom: 14px;
  color: var(--text-secondary);
  text-transform: uppercase;
  letter-spacing: 0.5px;
}
.bar-chart { display: flex; flex-direction: column; gap: 6px; }
.bar-row { display: flex; align-items: center; gap: 8px; font-size: 11px; }
.bar-label {
  width: 120px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  color: var(--text-secondary);
  flex-shrink: 0;
}
.bar-track {
  flex: 1;
  height: 18px;
  background: rgba(255,255,255,0.04);
  border-radius: 5px;
  overflow: hidden;
}
.bar-fill {
  height: 100%;
  border-radius: 5px;
  transition: width 0.6s var(--ease-out);
}
.bar-value {
  width: 40px;
  text-align: right;
  color: var(--text-muted);
  flex-shrink: 0;
  font-weight: 600;
}

.chart-row { display: flex; align-items: flex-end; gap: 2px; height: 110px; }
.chart-bar {
  background: var(--gold);
  border-radius: 4px 4px 0 0;
  flex: 1;
  min-width: 4px;
  transition: height 0.4s var(--ease-out), background 0.2s, opacity 0.2s;
  opacity: 0.5;
}
.chart-bar:hover { opacity: 1; background: var(--emerald); }

.metric-big {
  font-family: var(--font-display);
  font-size: 34px;
  font-weight: 500;
  margin-bottom: 4px;
  color: var(--text-bright);
  letter-spacing: -0.5px;
}
.metric-label { font-size: 11px; color: var(--text-muted); font-weight: 450; }
.metrics-row { display: flex; gap: var(--sp-5); margin-bottom: var(--sp-5); }
.metric-item { flex: 1; }

/* ══════════════════════════════════════════
   DETAIL PANEL (slide-out)
   ══════════════════════════════════════════ */
.detail-overlay {
  position: fixed;
  top: 0; left: 0; right: 0; bottom: 0;
  background: rgba(0, 0, 0, 0.55);
  backdrop-filter: blur(6px);
  -webkit-backdrop-filter: blur(6px);
  z-index: 200;
  display: none;
  align-items: flex-start;
  justify-content: flex-end;
}
.detail-overlay.open { display: flex; }
.detail-panel {
  width: 540px;
  height: 100vh;
  background: var(--bg-primary);
  border-left: 1px solid var(--border);
  overflow-y: auto;
  padding: var(--sp-6);
  animation: slideIn 0.3s var(--ease-out);
}
@keyframes slideIn { from { transform: translateX(100%); } to { transform: translateX(0); } }

.detail-close {
  position: sticky;
  top: 0;
  float: right;
  background: rgba(255,255,255,0.05);
  border: 1px solid rgba(255,255,255,0.08);
  color: var(--text-secondary);
  width: 32px;
  height: 32px;
  border-radius: var(--r-sm);
  cursor: pointer;
  font-size: 13px;
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 10;
  transition: all 0.15s;
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
}
.detail-close:hover {
  background: var(--ruby-dim);
  color: var(--ruby);
  border-color: rgba(248, 113, 113, 0.2);
}
.detail-name {
  font-family: var(--font-display);
  font-size: 24px;
  font-weight: 500;
  margin-bottom: 6px;
  padding-right: 44px;
  color: var(--text-bright);
  letter-spacing: -0.3px;
}
.detail-type {
  font-size: 11px;
  color: var(--text-muted);
  margin-bottom: var(--sp-5);
}
.detail-section { margin-bottom: var(--sp-5); }
.detail-section-title {
  font-size: 10px;
  font-weight: 700;
  color: var(--gold);
  text-transform: uppercase;
  letter-spacing: 1px;
  margin-bottom: 10px;
}
.detail-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 8px 0;
  font-size: 12px;
  border-bottom: 1px solid rgba(255,255,255,0.04);
}
.detail-row:last-child { border-bottom: none; }
.detail-row-label { color: var(--text-secondary); }
.detail-row-value { color: var(--text-primary); font-weight: 600; }
.tags-list { display: flex; flex-wrap: wrap; gap: 5px; }
.tag {
  background: rgba(255,255,255,0.05);
  border: 1px solid rgba(255,255,255,0.06);
  color: var(--text-secondary);
  font-size: 11px;
  padding: 3px 10px;
  border-radius: var(--r-full);
  transition: all 0.15s;
  font-weight: 450;
}
.tag:hover { border-color: var(--gold-glow); color: var(--gold); }

/* ══════════════════════════════════════════
   MESSAGES
   ══════════════════════════════════════════ */
.messages-list {
  display: flex;
  flex-direction: column;
  gap: 6px;
  max-height: 480px;
  overflow-y: auto;
  padding: 4px;
}
.message-bubble {
  max-width: 85%;
  padding: 10px 14px;
  border-radius: 14px;
  font-size: 12px;
  line-height: 1.55;
  animation: fadeInUp 0.15s var(--ease-out) backwards;
}
.message-bubble.from-me {
  background: rgba(129, 140, 248, 0.08);
  border: 1px solid rgba(129, 140, 248, 0.12);
  align-self: flex-end;
  margin-left: auto;
  border-bottom-right-radius: 5px;
}
.message-bubble.from-them {
  background: var(--bg-elevated);
  border: 1px solid var(--border);
  align-self: flex-start;
  border-bottom-left-radius: 5px;
}
.message-bubble.highlighted {
  border-color: var(--gold);
  background: var(--gold-dim);
}
.message-sender {
  font-size: 10px;
  font-weight: 600;
  color: var(--sapphire);
  margin-bottom: 3px;
}
.message-time {
  font-size: 9px;
  color: var(--text-muted);
  margin-top: 4px;
  text-align: right;
}
.message-text { color: var(--text-primary); word-break: break-word; }

/* ══════════════════════════════════════════
   TOAST
   ══════════════════════════════════════════ */
.toast {
  position: fixed;
  bottom: 24px;
  left: 50%;
  transform: translateX(-50%);
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--r-full);
  padding: 10px 22px;
  font-size: 13px;
  display: none;
  z-index: 1000;
  max-width: 400px;
  box-shadow: var(--shadow-elevated);
  color: var(--text-primary);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  white-space: nowrap;
}
.toast.show { display: block; animation: toastIn 0.35s var(--ease-out); }
@keyframes toastIn {
  from { opacity: 0; transform: translateX(-50%) translateY(12px) scale(0.95); }
  to { opacity: 1; transform: translateX(-50%) translateY(0) scale(1); }
}

.empty-state {
  text-align: center;
  padding: 40px 20px;
  color: var(--text-muted);
  font-size: 13px;
}

/* ══════════════════════════════════════════
   AGENDA (Premium Redesign)
   ══════════════════════════════════════════ */

/* ── Focused Layout ── */
.agenda-focused {
  max-width: 840px;
  margin: 0 auto;
}

/* ── Hero Greeting ── */
.agenda-hero {
  margin-bottom: var(--sp-5);
  padding: var(--sp-2) 0;
}
.agenda-hero-greeting {
  font-family: var(--font-display);
  font-size: 28px;
  font-weight: 400;
  color: var(--text-primary);
  letter-spacing: -0.3px;
  line-height: 1.2;
}
.agenda-hero-name {
  background: linear-gradient(135deg, var(--gold), var(--violet));
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
  font-weight: 500;
}
.agenda-hero-date {
  font-size: 14px;
  color: var(--text-muted);
  margin-top: 4px;
  font-weight: 400;
}
.agenda-hero-summary {
  font-size: 13px;
  color: var(--text-secondary);
  margin-top: 10px;
  line-height: 1.5;
}
.agenda-hero-progress {
  margin-top: 10px;
  height: 4px;
  background: rgba(255,255,255,0.06);
  border-radius: var(--r-full);
  overflow: hidden;
}
.agenda-hero-progress-bar {
  height: 100%;
  background: linear-gradient(90deg, var(--emerald), var(--gold));
  border-radius: var(--r-full);
  transition: width 0.6s var(--ease-out);
  box-shadow: 0 0 8px rgba(74, 222, 128, 0.2);
}
.agenda-hero-progress-label {
  font-size: 11px;
  color: var(--text-muted);
  margin-top: 4px;
}

/* ── Tabs ── */
.agenda-tabs {
  display: flex;
  gap: 4px;
  margin-bottom: var(--sp-4);
  background: rgba(255,255,255,0.03);
  border-radius: var(--r-full);
  padding: 3px;
  border: 1px solid var(--border);
  width: fit-content;
}
.agenda-tab {
  padding: 7px 20px;
  border-radius: var(--r-full);
  border: none;
  background: transparent;
  color: var(--text-muted);
  font-size: 12px;
  font-weight: 500;
  font-family: var(--font-body);
  cursor: pointer;
  transition: all 0.2s;
}
.agenda-tab.active {
  background: var(--gold-dim);
  color: var(--gold);
  font-weight: 600;
}
.agenda-tab:hover:not(.active) { color: var(--text-secondary); }

/* ── Day Pills (minimal, transparent) ── */
.agenda-day-scroll {
  display: flex;
  gap: 8px;
  overflow-x: auto;
  padding-bottom: 4px;
  margin-bottom: var(--sp-4);
  scrollbar-width: none;
}
.agenda-day-scroll::-webkit-scrollbar { display: none; }

.agenda-day-pill {
  flex-shrink: 0;
  width: 56px;
  padding: 10px 4px;
  border-radius: var(--r-md);
  background: transparent;
  border: none;
  text-align: center;
  cursor: pointer;
  transition: all 0.25s var(--ease-spring);
  position: relative;
}
.agenda-day-pill:hover { background: rgba(255,255,255,0.04); }
.agenda-day-pill.selected {
  background: var(--gold);
  box-shadow: 0 0 20px rgba(129,140,248,0.2);
  transform: scale(1.05);
}
.adp-weekday { font-size: 10px; color: var(--text-muted); text-transform: uppercase; letter-spacing: 0.5px; }
.agenda-day-pill.selected .adp-weekday { color: var(--bg-deep); }
.adp-num { font-family: var(--font-display); font-size: 20px; font-weight: 600; margin: 2px 0; color: var(--text-primary); }
.agenda-day-pill.selected .adp-num { color: var(--bg-deep); }
.adp-msgs { font-size: 9px; color: var(--text-muted); }
.agenda-day-pill.selected .adp-msgs { color: rgba(8,8,13,0.6); }

/* Today indicator dot (always visible) */
.agenda-day-pill.today::after {
  content: '';
  display: block;
  width: 3px; height: 3px;
  border-radius: 50%;
  background: var(--gold);
  margin: 4px auto 0;
}
.agenda-day-pill.today.selected::after { background: var(--bg-deep); }

/* ── Stat Strip (filter chips) ── */
.agenda-stat-strip {
  display: flex;
  gap: 8px;
  overflow-x: auto;
  margin-bottom: var(--sp-4);
  padding: 2px 0;
  scrollbar-width: none;
  -webkit-tap-highlight-color: transparent;
}
.agenda-stat-strip::-webkit-scrollbar { display: none; }

.agenda-stat-chip {
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 8px 14px;
  border-radius: var(--r-full);
  background: var(--bg-card);
  border: 1px solid var(--border);
  font-size: 12px;
  font-weight: 500;
  font-family: var(--font-body);
  color: var(--text-secondary);
  cursor: pointer;
  transition: all 0.2s var(--ease-out);
  flex-shrink: 0;
  white-space: nowrap;
}
.agenda-stat-chip:hover { border-color: rgba(255,255,255,0.12); }
.agenda-stat-chip:active { transform: scale(0.95); }
.agenda-stat-chip.active {
  background: var(--gold-dim);
  border-color: var(--gold-glow);
  color: var(--gold);
  font-weight: 600;
}
.agenda-stat-chip.zero { opacity: 0.4; }
.asc-dot {
  width: 6px; height: 6px;
  border-radius: 50%;
  flex-shrink: 0;
}
.asc-count {
  font-weight: 700;
}

/* ── Agenda Contact Cards (premium) ── */
.agenda-cards {
  display: flex;
  flex-direction: column;
  gap: 8px;
}
.agenda-card {
  display: flex;
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--r-lg);
  cursor: pointer;
  transition: all 0.25s var(--ease-out);
  animation: fadeInUp 0.3s var(--ease-out) backwards;
  animation-delay: calc(var(--i, 0) * 0.04s);
  overflow: hidden;
}
.agenda-card:hover {
  box-shadow: 0 8px 24px rgba(0,0,0,0.2), 0 0 0 1px rgba(255,255,255,0.06);
  transform: translateY(-2px);
}
.agenda-card:hover .agenda-card-accent { filter: brightness(1.3); }

/* Accent bar (left, colored by classification) */
.agenda-card-accent {
  width: 3px;
  flex-shrink: 0;
  transition: filter 0.2s;
}
.agenda-card-accent.pulse {
  animation: accentPulse 2s ease-in-out infinite;
}
@keyframes accentPulse {
  0%, 100% { opacity: 1; }
  50% { opacity: 0.4; }
}

/* Urgency card variants */
.agenda-card-urgent {
  background: linear-gradient(90deg, rgba(248,113,113,0.03) 0%, var(--bg-card) 30%);
}
.agenda-card-pend {
  background: linear-gradient(90deg, rgba(251,191,36,0.02) 0%, var(--bg-card) 30%);
}
.agenda-card-opp {
  background: linear-gradient(90deg, rgba(74,222,128,0.02) 0%, var(--bg-card) 30%);
}

/* Overdue shake */
.agenda-card-overdue {
  animation: fadeInUp 0.3s var(--ease-out) backwards, urgentShake 0.5s ease 0.5s;
}
@keyframes urgentShake {
  0%, 100% { transform: translateX(0); }
  25% { transform: translateX(-2px); }
  75% { transform: translateX(2px); }
}

.agenda-card-content {
  flex: 1;
  min-width: 0;
  padding: var(--sp-3) var(--sp-4);
}
.agenda-card-header {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-bottom: 6px;
}
.agenda-card-avatar {
  width: 36px; height: 36px;
  border-radius: 10px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 12px;
  font-weight: 700;
  flex-shrink: 0;
  border: 1px solid rgba(255,255,255,0.06);
}
.agenda-card-identity {
  flex: 1;
  min-width: 0;
}
.agenda-card-name {
  font-size: 14px;
  font-weight: 700;
  color: var(--text-bright);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.agenda-card-ctx {
  font-size: 11px;
  color: var(--text-muted);
  font-weight: 400;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.agenda-card-tags { display: flex; gap: 4px; flex-wrap: wrap; flex-shrink: 0; }
.agenda-card-body { margin-bottom: 6px; }
.agenda-card-reason {
  font-size: 13px;
  color: var(--text-primary);
  line-height: 1.45;
  font-weight: 600;
  margin-bottom: 2px;
}
.agenda-card-summary {
  font-size: 12px;
  color: var(--text-secondary);
  line-height: 1.45;
}

/* Suggested reply with copy */
.agenda-card-action {
  display: flex;
  align-items: center;
  gap: 8px;
  background: var(--emerald-dim);
  padding: 6px 10px;
  border-radius: var(--r-sm);
  margin-bottom: 6px;
}
.agenda-card-reply-text {
  flex: 1;
  font-size: 11px;
  color: var(--emerald);
  line-height: 1.45;
  min-width: 0;
}
.agenda-card-copy {
  flex-shrink: 0;
  padding: 3px 8px;
  border-radius: var(--r-sm);
  border: 1px solid rgba(74,222,128,0.2);
  background: transparent;
  color: var(--emerald);
  font-size: 10px;
  font-weight: 600;
  font-family: var(--font-body);
  cursor: pointer;
  transition: all 0.15s;
}
.agenda-card-copy:hover { background: rgba(74,222,128,0.1); }
.agenda-card-copy:active { transform: scale(0.95); }

.agenda-card-footer {
  display: flex;
  gap: 12px;
  font-size: 10px;
  color: var(--text-muted);
}

/* ── Content transition ── */
.agenda-content-enter {
  animation: contentEnter 0.3s var(--ease-out);
}
@keyframes contentEnter {
  from { opacity: 0; transform: translateY(8px); }
  to { opacity: 1; transform: translateY(0); }
}

/* ── Insight cards in agenda context ── */
.agenda-focused .insights-grid {
  grid-template-columns: repeat(2, 1fr);
}
.agenda-focused .insight-card {
  max-height: 200px;
}
.agenda-focused .insight-card.expanded {
  max-height: 800px;
  overflow-y: auto;
}

/* Insight card colored top borders */
.insight-card:nth-child(1) { border-top: 2px solid var(--sapphire); }
.insight-card:nth-child(2) { border-top: 2px solid var(--emerald); }
.insight-card:nth-child(3) { border-top: 2px solid var(--amber); }
.insight-card:nth-child(4) { border-top: 2px solid var(--violet); }

/* ── Collapsible Insights Section ── */
.agenda-insights-section {
  margin-top: var(--sp-6);
  border-top: 1px solid var(--border);
  padding-top: var(--sp-4);
}
.agenda-insights-toggle {
  display: flex;
  align-items: center;
  justify-content: space-between;
  cursor: pointer;
  padding: var(--sp-2) 0;
  margin-bottom: var(--sp-3);
  color: var(--text-secondary);
  font-size: 13px;
  font-weight: 600;
  transition: color 0.15s;
  -webkit-tap-highlight-color: transparent;
}
.agenda-insights-toggle:hover { color: var(--text-primary); }
.agenda-insights-arrow {
  font-size: 10px;
  transition: transform 0.3s var(--ease-out);
}
.agenda-insights-body {
  transition: max-height 0.4s var(--ease-out), opacity 0.3s;
  overflow: hidden;
}
.agenda-insights-body.collapsed {
  max-height: 0;
  opacity: 0;
}
.agenda-insights-body:not(.collapsed) {
  max-height: 2000px;
  opacity: 1;
}

/* Shimmer loading */
@keyframes shimmer {
  0% { background-position: -200% 0; }
  100% { background-position: 200% 0; }
}
.insight-loading {
  display: inline-block;
  background: linear-gradient(90deg, var(--bg-elevated) 25%, rgba(255,255,255,0.05) 50%, var(--bg-elevated) 75%);
  background-size: 200% 100%;
  animation: shimmer 1.5s ease-in-out infinite;
  color: var(--text-muted);
  font-size: 11px;
}

/* ══════════════════════════════════════════
   PENDENCY AGING
   ══════════════════════════════════════════ */
.dtag-red { background: var(--ruby-dim); color: var(--ruby); }
.dtag-orange { background: var(--amber-dim); color: var(--amber); }
.dtag-blue { background: var(--sapphire-dim); color: var(--sapphire); }

/* ══════════════════════════════════════════
   RESPONSIVE
   ══════════════════════════════════════════ */
@media (max-width: 1200px) {
  .insights-grid { grid-template-columns: repeat(2, 1fr); }
}
@media (max-width: 1024px) {
  .stats-row { grid-template-columns: repeat(2, 1fr); }
  .dash-cols { grid-template-columns: 1fr; }
  .analytics-grid { grid-template-columns: 1fr; }
  .detail-panel { width: 100%; }
}
/* ══════════════════════════════════════════
   PIN GATE
   ══════════════════════════════════════════ */
#pinGate {
  position: fixed;
  inset: 0;
  background: var(--bg-deep);
  background-image:
    radial-gradient(ellipse at 30% 20%, rgba(129, 140, 248, 0.06) 0%, transparent 50%),
    radial-gradient(ellipse at 70% 80%, rgba(192, 132, 252, 0.04) 0%, transparent 50%);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 9999;
}
.pin-card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--r-xl);
  padding: 48px 40px 36px;
  text-align: center;
  box-shadow: var(--shadow-elevated);
  max-width: 320px;
  width: 88%;
}
.pin-logo {
  font-family: var(--font-body);
  font-size: 28px;
  font-weight: 800;
  color: var(--text-bright);
  letter-spacing: -0.5px;
  margin-bottom: 4px;
}
.pin-subtitle {
  font-size: 12px;
  color: var(--text-muted);
  margin-bottom: 32px;
  font-weight: 400;
}
.pin-input {
  display: block;
  width: 100%;
  background: var(--bg-elevated);
  border: 1px solid var(--border);
  border-radius: var(--r-md);
  padding: 14px;
  color: var(--text-bright);
  font-size: 24px;
  font-family: var(--font-body);
  text-align: center;
  letter-spacing: 12px;
  outline: none;
  margin-bottom: 16px;
  transition: border-color 0.2s, box-shadow 0.2s;
}
.pin-input:focus {
  border-color: var(--gold);
  box-shadow: 0 0 0 3px var(--gold-dim);
}
.pin-btn {
  display: block;
  width: 100%;
  background: var(--gold);
  color: var(--bg-deep);
  border: none;
  border-radius: var(--r-md);
  padding: 14px;
  font-size: 15px;
  font-weight: 700;
  font-family: var(--font-body);
  cursor: pointer;
  transition: opacity 0.15s, transform 0.15s;
}
.pin-btn:active { transform: scale(0.97); }
.pin-btn:hover { opacity: 0.9; }
.pin-error {
  font-size: 12px;
  color: var(--ruby);
  margin-top: 12px;
  opacity: 0;
  transition: opacity 0.2s;
}
.pin-error.show { opacity: 1; }
@keyframes pinShake {
  0%, 100% { transform: translateX(0); }
  20%, 60% { transform: translateX(-8px); }
  40%, 80% { transform: translateX(8px); }
}
.pin-shake { animation: pinShake 0.4s ease; }

/* ══════════════════════════════════════════
   MOBILE APP EXPERIENCE
   ══════════════════════════════════════════ */

/* ── Mobile Bottom Nav ── */
.mobile-nav {
  display: none;
  position: fixed;
  bottom: 0;
  left: 0;
  right: 0;
  background: var(--bg-primary);
  border-top: 1px solid var(--border);
  box-shadow: 0 -4px 20px rgba(0,0,0,0.3);
  z-index: 150;
  padding: 8px 4px calc(8px + env(safe-area-inset-bottom, 0px));
  justify-content: space-around;
  align-items: center;
  backdrop-filter: blur(20px);
  -webkit-backdrop-filter: blur(20px);
}
.mobile-nav-btn {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 3px;
  background: none;
  border: none;
  color: var(--text-muted);
  font-size: 10px;
  font-family: var(--font-body);
  font-weight: 500;
  cursor: pointer;
  padding: 6px 10px;
  border-radius: var(--r-sm);
  transition: color 0.15s, transform 0.1s;
  min-width: 60px;
  -webkit-tap-highlight-color: transparent;
}
.mobile-nav-btn svg, .mobile-nav-btn i { width: 22px; height: 22px; stroke-width: 1.75; }
.mobile-nav-btn.active { color: var(--gold); }
.mobile-nav-btn:active { color: var(--gold); transform: scale(0.9); }

/* Mobile Menu Overlay */
.mobile-menu-overlay {
  display: none;
  position: fixed;
  top: 0; left: 0; right: 0; bottom: 0;
  background: rgba(0, 0, 0, 0.55);
  backdrop-filter: blur(4px);
  -webkit-backdrop-filter: blur(4px);
  z-index: 300;
  align-items: flex-end;
  justify-content: center;
}
.mobile-menu-overlay.open { display: flex; }
.mobile-menu {
  width: 100%;
  max-height: 70vh;
  background: var(--bg-primary);
  border-top: 1px solid var(--border);
  border-radius: var(--r-xl) var(--r-xl) 0 0;
  padding: var(--sp-4) var(--sp-3) calc(var(--sp-6) + env(safe-area-inset-bottom, 0px));
  overflow-y: auto;
  animation: slideUp 0.3s var(--ease-out);
}
@keyframes slideUp { from { transform: translateY(100%); } to { transform: translateY(0); } }

.mobile-menu-section {
  margin-bottom: var(--sp-3);
}
.mobile-menu-label {
  font-size: 10px;
  font-weight: 600;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 1px;
  padding: var(--sp-2) var(--sp-3);
}
.mobile-menu-item {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 12px var(--sp-3);
  color: var(--text-secondary);
  font-size: 14px;
  font-weight: 450;
  border-radius: var(--r-sm);
  cursor: pointer;
  transition: all 0.15s;
}
.mobile-menu-item:active { background: rgba(255,255,255,0.04); }
.mobile-menu-item svg { width: 18px; height: 18px; stroke-width: 1.75; flex-shrink: 0; }
.mobile-menu-item .nav-badge { margin-left: auto; }
.mobile-menu-mode {
  display: flex;
  gap: 8px;
  padding: var(--sp-2) var(--sp-3);
  margin-bottom: var(--sp-2);
}
.mobile-mode-btn {
  flex: 1;
  padding: 10px;
  border-radius: var(--r-md);
  border: 1px solid var(--border);
  background: transparent;
  color: var(--text-secondary);
  font-size: 13px;
  font-weight: 500;
  font-family: var(--font-body);
  cursor: pointer;
  transition: all 0.15s;
  text-align: center;
}
.mobile-mode-btn.active-mode { background: var(--gold-dim); color: var(--gold); border-color: var(--gold-glow); font-weight: 600; }

@media (max-width: 768px) {
  /* ── Hide desktop nav ── */
  .sidebar { display: none; }
  .mode-bar { display: none; }
  .mobile-nav { display: flex; }

  /* ── App-like header ── */
  .header {
    grid-template-columns: auto 1fr auto;
    height: 48px;
    padding: 0 var(--sp-3);
    gap: var(--sp-2);
  }
  .header-logo { font-size: 15px; }
  #syncLabel { display: none; }
  .header-right .btn-sync { padding: 6px 10px; font-size: 10px; }

  /* ── Content area with bottom nav clearance ── */
  .content {
    padding: var(--sp-3);
    padding-bottom: calc(80px + env(safe-area-inset-bottom, 0px));
  }

  /* ── Full-width stat cards ── */
  .stats-row { grid-template-columns: 1fr 1fr; gap: var(--sp-2); }
  .stat-card { padding: var(--sp-4); }
  .stat-value { font-size: 26px; }

  /* ── Insight cards stacked ── */
  .insights-grid { grid-template-columns: 1fr; }

  /* ── Dashboard columns stacked ── */
  .dash-cols { grid-template-columns: 1fr; gap: var(--sp-3); }
  .dash-col { max-height: 400px; }
  .dash-item { padding: 14px 12px; }
  .dash-item-name { font-size: 14px; }

  /* ── Contact cards — large touch targets ── */
  .contact-card {
    padding: var(--sp-4);
    gap: var(--sp-4);
    border-radius: var(--r-lg);
  }
  .contact-avatar { width: 44px; height: 44px; font-size: 15px; border-radius: 12px; }
  .contact-name { font-size: 15px; }
  .contact-preview { font-size: 12px; margin-top: 3px; }

  /* ── Group cards full-width ── */
  .groups-grid { grid-template-columns: 1fr; }
  .group-card { padding: var(--sp-5); }
  .group-card-name { font-size: 16px; }

  /* ── Alert cards ── */
  .alert-card { padding: var(--sp-5); }

  /* ── Analytics stacked ── */
  .analytics-grid { grid-template-columns: 1fr; }

  /* ── Kanban horizontal scroll ── */
  .kanban-col { min-width: 240px; max-width: 240px; }

  /* ── Detail panel — slide up from bottom ── */
  .detail-overlay {
    align-items: flex-end;
    justify-content: center;
  }
  .detail-panel {
    width: 100%;
    height: 92vh;
    max-height: 92vh;
    border-left: none;
    border-radius: var(--r-xl) var(--r-xl) 0 0;
    border-top: 1px solid rgba(255,255,255,0.1);
    animation: slideUp 0.3s var(--ease-out);
    padding: var(--sp-4);
    padding-bottom: calc(var(--sp-6) + env(safe-area-inset-bottom, 0px));
  }
  .detail-panel::before {
    content: '';
    display: block;
    width: 36px;
    height: 4px;
    background: rgba(255,255,255,0.15);
    border-radius: 2px;
    margin: 0 auto 12px;
    flex-shrink: 0;
  }
  .detail-close { position: absolute; top: 12px; right: 12px; }
  .detail-name { font-size: 20px; padding-right: 44px; }
  .messages-list { max-height: 350px; }

  /* ── Toast above bottom nav ── */
  .toast { bottom: calc(80px + env(safe-area-inset-bottom, 0px)); }

  /* ── Mobile menu polish ── */
  .mobile-menu {
    padding-bottom: calc(80px + env(safe-area-inset-bottom, 0px));
  }
  .mobile-menu-item {
    padding: 14px var(--sp-4);
    font-size: 15px;
    min-height: 48px;
  }
  .mobile-mode-btn {
    padding: 12px;
    font-size: 14px;
  }

  /* ── Section titles ── */
  .section-title { font-size: 18px; }
  .search-box { font-size: 14px; padding: 12px 16px; }
  .filter-btn { padding: 7px 14px; font-size: 12px; }

  /* ── Agenda mobile ── */
  .agenda-hero-greeting { font-size: 24px; }
  .agenda-hero-date { font-size: 13px; }
  .agenda-day-pill { width: 50px; padding: 8px 2px; }
  .adp-num { font-size: 18px; }
  .agenda-stat-strip { padding: 2px var(--sp-1); }
  .agenda-focused .insights-grid { grid-template-columns: 1fr; }
  .agenda-card-avatar { width: 32px; height: 32px; font-size: 11px; }
  .agenda-card-header { gap: 8px; }
  .agenda-card-name { font-size: 13px; }
  .agenda-card-reason { font-size: 12px; }
  .agenda-card-action { flex-direction: column; align-items: stretch; }
  .agenda-card-copy { width: 100%; text-align: center; padding: 6px; }
  .agenda-card-footer { flex-wrap: wrap; gap: 8px; }

  /* ── Tap highlight ── */
  .agenda-day-pill,
  .agenda-stat-chip,
  .agenda-card,
  .mobile-nav-btn,
  .mobile-menu-item { -webkit-tap-highlight-color: transparent; }
}

@media (max-width: 480px) {
  .stats-row { grid-template-columns: 1fr; }
  .header-logo { font-size: 14px; }
  .stat-value { font-size: 24px; }
}
