/* ═══════════════════════════════════════════════════════
   BLAX Agency CRM — Design System v2
   Aesthetic: Vercel + Linear + Stripe + Notion polish
   ═══════════════════════════════════════════════════════ */

:root {
  /* Fonts */
  --font-display: 'Syne', sans-serif;
  --font-body: 'Inter', sans-serif;
  --font-mono: 'DM Mono', monospace;

  /* Backgrounds */
  --bg-body: #F7F5F0;
  --bg-card: #FFFFFF;
  --bg-surface: #FAFAF8;
  --bg-elevated: #FFFFFF;
  --bg-input: #F2F0EB;
  --bg-sidebar: #16162A;
  --bg-sidebar-item: rgba(255,255,255,0.05);
  --bg-sidebar-active: rgba(200,164,78,0.12);

  /* Borders */
  --border: #EAE6DF;
  --border-light: #F0ECE6;
  --border-mid: #D6D1C8;
  --border-strong: #C4BFB5;

  /* Text */
  --text-primary: #1A1A2E;
  --text-secondary: #6B6B7B;
  --text-muted: #9B9BA8;
  --text-placeholder: #B8B4AC;

  /* Sidebar text */
  --sidebar-text: #C8CEDF;
  --sidebar-muted: #5A5A7A;
  --sidebar-active: #D4B45A;

  /* Brand / Accent */
  --gold: #C8A44E;
  --gold-bright: #D4B45A;
  --gold-deep: #A8843E;
  --gold-soft: rgba(200,164,78,0.10);
  --gold-glow: rgba(200,164,78,0.20);
  --gold-light: rgba(200,164,78,0.12);
  --gold-hover: rgba(200,164,78,0.03);

  /* Semantic */
  --green: #22C07A;
  --green-soft: rgba(34,192,122,0.10);
  --green-border: rgba(34,192,122,0.25);
  --amber: #E09830;
  --amber-soft: rgba(224,152,48,0.10);
  --amber-border: rgba(224,152,48,0.25);
  --red: #E04848;
  --red-soft: rgba(224,72,72,0.10);
  --red-border: rgba(224,72,72,0.25);
  --blue: #4A7AE8;
  --blue-soft: rgba(74,122,232,0.10);
  --blue-border: rgba(74,122,232,0.25);

  /* Model colors */
  --ava: #4A7AE8;
  --mary: #22C07A;
  --makayla: #E09830;

  /* Shadows — warm-toned */
  --shadow-xs: 0 1px 2px rgba(26,26,46,0.04);
  --shadow-sm: 0 1px 4px rgba(26,26,46,0.06), 0 1px 2px rgba(26,26,46,0.04);
  --shadow-md: 0 4px 16px rgba(26,26,46,0.08), 0 2px 6px rgba(26,26,46,0.05);
  --shadow-lg: 0 8px 32px rgba(26,26,46,0.10), 0 4px 12px rgba(26,26,46,0.06);
  --shadow-gold: 0 4px 16px rgba(200,164,78,0.20);
  /* Legacy aliases */
  --shadow: var(--shadow-sm);
  --shadow-hover: var(--shadow-md);

  /* Radius */
  --r-xs: 4px;
  --r-sm: 8px;
  --r-md: 12px;
  --r-lg: 16px;
  --r-xl: 20px;
  --r-full: 9999px;
  /* Legacy aliases */
  --radius: var(--r-lg);
  --radius-sm: var(--r-sm);

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

  /* Transitions */
  --t-fast: 0.12s ease;
  --t-base: 0.20s ease;
  --t-slow: 0.35s ease;

  /* Sidebar */
  --sidebar-w: 244px;

  /* Legacy color aliases used in inline JS styles */
  --bg: #F7F5F0;
  --card-bg: #FFFFFF;
  --card-border: #EAE6DF;
  --surface: #FAFAF8;
  --surface-alt: #F2F0EB;
  --text: #1A1A2E;
  --text-sec: #6B6B7B;
  --sidebar-bg: #16162A;
}

/* ═══ RESET ═══ */
*, *::before, *::after { margin: 0; padding: 0; box-sizing: border-box; }
body {
  font-family: var(--font-body);
  background: var(--bg-body);
  color: var(--text-primary);
  font-size: 13px;
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}
h1, h2, h3, h4 { font-family: var(--font-display); font-weight: 700; letter-spacing: -0.3px; color: var(--text-primary); }
.mono { font-family: var(--font-mono); }

/* ═══ SELECTION & FOCUS ═══ */
::selection { background: rgba(200,164,78,0.15); color: var(--text-primary); }
:focus-visible { outline: 2px solid rgba(200,164,78,0.5); outline-offset: 2px; }

/* ═══ SCROLLBAR ═══ */
::-webkit-scrollbar { width: 5px; height: 5px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: var(--border-mid); border-radius: 3px; }
::-webkit-scrollbar-thumb:hover { background: var(--text-muted); }

/* ═══ ANIMATIONS ═══ */
@keyframes spin { to { transform: rotate(360deg); } }
@keyframes pulse {
  0%, 100% { opacity: 1; transform: scale(1); }
  50% { opacity: 0.5; transform: scale(1.3); }
}
@keyframes fadeIn {
  from { opacity: 0; transform: translateY(6px); }
  to { opacity: 1; transform: translateY(0); }
}
@keyframes slideInRight {
  from { opacity: 0; transform: translateX(8px); }
  to { opacity: 1; transform: translateX(0); }
}
@keyframes scaleIn {
  from { opacity: 0; transform: scale(0.96); }
  to { opacity: 1; transform: scale(1); }
}
@keyframes toastIn {
  from { opacity: 0; transform: translateY(8px) scale(0.97); }
  to { opacity: 1; transform: translateY(0) scale(1); }
}
@keyframes toastOut {
  from { opacity: 1; transform: translateY(0); }
  to { opacity: 0; transform: translateY(4px); }
}

/* Page transition */
.page-enter { animation: fadeIn 0.18s ease both; }

/* ═══ SIDEBAR ═══ */
.sidebar {
  position: fixed; left: 0; top: 0; bottom: 0;
  width: var(--sidebar-w);
  background: var(--bg-sidebar);
  color: var(--sidebar-text);
  display: flex; flex-direction: column;
  z-index: 100;
  transition: transform 0.25s ease;
  overflow-y: auto;
  overflow-x: hidden;
}
.sidebar-brand {
  padding: 32px 24px 28px;
  font-family: var(--font-display);
  font-weight: 800;
  font-size: 26px;
  letter-spacing: -1px;
  color: #FFFFFF;
}
.sidebar-section {
  padding: 20px 20px 6px;
  font-size: 9px;
  font-weight: 500;
  letter-spacing: 2px;
  text-transform: uppercase;
  color: #3D3D5C;
  font-family: var(--font-mono);
  border: none;
}
.sidebar-item {
  display: flex; align-items: center; gap: 10px;
  padding: 0 14px;
  height: 38px;
  cursor: pointer;
  border-radius: var(--r-sm);
  margin: 1px 8px;
  font-size: 13px;
  font-weight: 500;
  font-family: var(--font-body);
  color: var(--sidebar-text);
  transition: background 0.15s, color 0.15s;
  position: relative;
  white-space: nowrap;
}
.sidebar-item:hover {
  background: rgba(255,255,255,0.06);
  color: #FFFFFF;
}
.sidebar-item.active {
  background: rgba(200,164,78,0.12);
  color: #D4B45A;
}
.sidebar-item.active::before {
  content: '';
  position: absolute;
  left: 0; top: 50%;
  transform: translateY(-50%);
  width: 3px; height: 20px;
  background: var(--gold);
  border-radius: 0 3px 3px 0;
}
.sidebar-item .badge-count {
  position: absolute; right: 10px;
  background: #E04848; color: #fff;
  font-size: 10px; font-family: var(--font-mono); font-weight: 600;
  min-width: 18px; height: 18px;
  border-radius: 9px;
  display: flex; align-items: center; justify-content: center;
  padding: 0 5px;
}
.sidebar-role {
  margin-top: auto;
  padding: 16px 16px 20px;
  border-top: 1px solid rgba(255,255,255,0.06);
}
.sidebar-role label {
  font-size: 9px;
  font-family: var(--font-mono);
  font-weight: 400;
  letter-spacing: 1.5px;
  text-transform: uppercase;
  color: #3D3D5C;
  display: block;
  margin-bottom: 8px;
}
.sidebar-role select {
  width: 100%;
  background: #1E1E38;
  border: 1px solid rgba(255,255,255,0.10);
  color: #C8CEDF;
  padding: 9px 12px;
  border-radius: var(--r-sm);
  font-size: 12px;
  font-family: var(--font-body);
  font-weight: 500;
  transition: border-color 0.15s;
  cursor: pointer;
}
.sidebar-role select:focus {
  border-color: rgba(200,164,78,0.4);
  outline: none;
}
.sidebar-role select option { background: var(--bg-sidebar); color: #fff; }

/* ═══ HAMBURGER & OVERLAY ═══ */
.hamburger {
  display: none;
  position: fixed; top: 12px; left: 12px; z-index: 200;
  background: var(--bg-sidebar); color: #fff; border: none;
  border-radius: var(--r-sm);
  width: 40px; height: 40px;
  cursor: pointer; font-size: 18px;
  align-items: center; justify-content: center;
}
.overlay {
  display: none;
  position: fixed; inset: 0;
  background: rgba(22,22,42,0.55);
  backdrop-filter: blur(6px);
  z-index: 99;
}

/* ═══ MAIN CONTENT ═══ */
.main {
  margin-left: var(--sidebar-w);
  padding: 28px 32px;
  min-height: 100vh;
  background: var(--bg-body);
  overflow-y: auto;
  scroll-behavior: smooth;
}

/* ═══ CARDS ═══ */
.card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--r-lg);
  padding: 24px;
  box-shadow: var(--shadow-sm);
  transition: box-shadow var(--t-base), transform var(--t-base);
}
.card-title {
  font-family: var(--font-display);
  font-size: 15px;
  font-weight: 700;
  letter-spacing: -0.2px;
  color: var(--text-primary);
  margin-bottom: 20px;
  display: flex; align-items: center; gap: 8px;
}

/* ═══ METRIC CARDS ═══ */
.metric-card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--r-md);
  padding: 20px 22px;
  box-shadow: var(--shadow-sm);
  transition: transform 0.2s ease, box-shadow 0.2s ease;
  cursor: default;
}
.metric-card:hover {
  transform: translateY(-2px);
  box-shadow: var(--shadow-md);
}
.metric-card .label {
  font-size: 10px;
  font-family: var(--font-mono);
  font-weight: 400;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 1px;
  margin-bottom: 12px;
}
.metric-card .value {
  font-family: var(--font-mono);
  font-weight: 500;
  font-size: 28px;
  letter-spacing: -1px;
  line-height: 1;
  color: var(--text-primary);
}
.metric-card .sub {
  font-size: 10px;
  font-family: var(--font-mono);
  color: var(--text-muted);
  margin-top: 8px;
}

/* ═══ 5% ENGINE CARD ═══ */
.engine-card {
  background: linear-gradient(135deg, #FDFBF6 0%, #FFF9EE 100%);
  border: 1px solid rgba(200,164,78,0.25);
  border-left: 3px solid var(--gold);
  border-radius: var(--r-md);
  padding: 16px 20px;
  box-shadow: 0 2px 8px rgba(200,164,78,0.08);
  margin-bottom: 24px;
}
.engine-card .engine-title {
  font-family: var(--font-display);
  font-weight: 700;
  font-size: 14px;
  color: var(--gold);
  margin-bottom: 6px;
  letter-spacing: -0.2px;
}
.engine-card .engine-body {
  font-family: var(--font-body);
  font-size: 13px;
  font-weight: 500;
  color: var(--text-secondary);
  line-height: 1.5;
}

/* ═══ GRIDS ═══ */
.grid-2 { display: grid; grid-template-columns: 1fr 1fr; gap: 20px; }
.grid-3 { display: grid; grid-template-columns: 1fr 1fr 1fr; gap: 20px; }
.grid-4 { display: grid; grid-template-columns: repeat(4, 1fr); gap: 20px; }
.grid-5 { display: grid; grid-template-columns: repeat(5, 1fr); gap: 20px; }
.mb-20 { margin-bottom: 20px; }
.mb-12 { margin-bottom: 12px; }

/* ═══ BADGES / PILLS ═══ */
.badge {
  display: inline-flex; align-items: center;
  padding: 3px 10px;
  border-radius: var(--r-full);
  font-size: 10px;
  font-family: var(--font-mono);
  font-weight: 600;
  letter-spacing: 0.3px;
  white-space: nowrap;
  border: 1px solid transparent;
}
.badge-green  { background: rgba(34,192,122,0.10);  color: #18A066; border-color: rgba(34,192,122,0.20); }
.badge-red    { background: rgba(224,72,72,0.10);   color: #C03030; border-color: rgba(224,72,72,0.20); }
.badge-amber  { background: rgba(224,152,48,0.10);  color: #C07828; border-color: rgba(224,152,48,0.20); }
.badge-blue   { background: rgba(74,122,232,0.10);  color: #3A6AD0; border-color: rgba(74,122,232,0.20); }
.badge-gray   { background: rgba(155,155,168,0.10); color: #7A7A8A; border-color: rgba(155,155,168,0.18); }
.badge-gold   { background: rgba(200,164,78,0.10);  color: #A8843E; border-color: rgba(200,164,78,0.20); }
.badge-ava    { background: rgba(74,122,232,0.10);  color: #3A6AD0; border-color: rgba(74,122,232,0.20); }
.badge-mary   { background: rgba(34,192,122,0.10);  color: #18A066; border-color: rgba(34,192,122,0.20); }
.badge-makayla{ background: rgba(224,152,48,0.10);  color: #C07828; border-color: rgba(224,152,48,0.20); }

/* ═══ BUTTONS ═══ */
.btn {
  display: inline-flex; align-items: center; gap: 6px;
  padding: 9px 18px;
  border-radius: var(--r-sm);
  font-size: 12px;
  font-weight: 600;
  font-family: var(--font-body);
  letter-spacing: 0.2px;
  cursor: pointer;
  border: 1px solid transparent;
  transition: all 0.15s ease;
}
.btn-gold, .btn-primary {
  background: var(--gold);
  color: #FFFFFF;
  border-color: var(--gold);
  box-shadow: 0 1px 3px rgba(200,164,78,0.25), 0 1px 2px rgba(200,164,78,0.15);
}
.btn-gold:hover, .btn-primary:hover {
  background: var(--gold-bright);
  box-shadow: 0 4px 12px rgba(200,164,78,0.30);
  transform: translateY(-1px);
}
.btn-gold:active, .btn-primary:active {
  transform: translateY(0);
  box-shadow: var(--shadow-xs);
}
.btn-ghost {
  background: transparent;
  color: var(--text-secondary);
  border: 1px solid var(--border-mid);
}
.btn-ghost:hover {
  background: var(--bg-surface);
  color: var(--text-primary);
  border-color: var(--border-strong);
}
.btn-red, .btn-danger {
  background: var(--red-soft);
  color: var(--red);
  border: 1px solid rgba(224,72,72,0.20);
}
.btn-red:hover, .btn-danger:hover {
  background: rgba(224,72,72,0.15);
}
.btn-green {
  background: var(--green-soft);
  color: #18A066;
  border: 1px solid rgba(34,192,122,0.20);
}
.btn-green:hover {
  background: rgba(34,192,122,0.15);
}
.btn-sm { padding: 6px 12px; font-size: 11px; }

/* ═══ TABLES ═══ */
.table-wrap {
  overflow-x: auto;
  border-radius: var(--r-md);
  border: 1px solid var(--border);
  background: var(--bg-card);
  box-shadow: var(--shadow-xs);
}
.tbl { width: 100%; border-collapse: collapse; font-size: 13px; }
.tbl thead th {
  position: sticky; top: 0; z-index: 1;
  background: var(--bg-surface);
  padding: 11px 16px;
  text-align: left;
  font-size: 10px;
  font-family: var(--font-mono);
  font-weight: 500;
  text-transform: uppercase;
  letter-spacing: 1px;
  color: var(--text-muted);
  border-bottom: 1px solid var(--border);
  white-space: nowrap;
}
.tbl tbody tr { border-bottom: 1px solid var(--border-light); }
.tbl tbody tr:last-child { border-bottom: none; }
.tbl tbody tr:hover { background: rgba(200,164,78,0.03); transition: background 0.12s; }
.tbl td {
  padding: 12px 16px;
  vertical-align: middle;
  font-family: var(--font-body);
  font-size: 13px;
  color: var(--text-primary);
}
.tbl .done-row { opacity: 0.35; text-decoration: line-through; }

/* ═══ FORMS ═══ */
.form-group { margin-bottom: 14px; }
.form-group label {
  display: block;
  font-size: 10px;
  font-weight: 500;
  font-family: var(--font-mono);
  text-transform: uppercase;
  letter-spacing: 1px;
  color: var(--text-muted);
  margin-bottom: 6px;
}
.form-group input,
.form-group select,
.form-group textarea {
  width: 100%;
  padding: 10px 13px;
  border: 1px solid var(--border);
  border-radius: var(--r-sm);
  font-size: 13px;
  font-family: var(--font-body);
  background: var(--bg-input);
  color: var(--text-primary);
  transition: border-color 0.15s, box-shadow 0.15s, background 0.15s;
}
.form-group input::placeholder,
.form-group textarea::placeholder { color: var(--text-placeholder); }
.form-group input:focus,
.form-group select:focus,
.form-group textarea:focus {
  outline: none;
  background: #FFFFFF;
  border-color: var(--gold);
  box-shadow: 0 0 0 3px rgba(200,164,78,0.15);
}
.form-group textarea { resize: vertical; min-height: 80px; line-height: 1.6; }
.form-group .error { color: var(--red); font-size: 11px; margin-top: 3px; display: none; }
.form-group.has-error input,
.form-group.has-error select,
.form-group.has-error textarea { border-color: var(--red); }
.form-group.has-error .error { display: block; }
.form-row { display: flex; gap: 16px; }
.form-row .form-group { flex: 1; }

/* ═══ MODALS ═══ */
.modal-overlay {
  display: none;
  position: fixed; inset: 0;
  background: rgba(22,22,42,0.55);
  backdrop-filter: blur(6px);
  z-index: 1000;
  align-items: center; justify-content: center;
  transition: opacity 0.25s ease;
}
.modal-overlay.show { display: flex; }
.modal {
  background: #FFFFFF;
  border: 1px solid var(--border);
  border-radius: var(--r-xl);
  padding: 32px;
  max-width: 620px;
  width: min(620px, 92vw);
  max-height: 88vh;
  overflow-y: auto;
  box-shadow: var(--shadow-lg);
  animation: scaleIn 0.22s cubic-bezier(0.34, 1.2, 0.64, 1);
}
.modal-lg { max-width: 700px; width: min(700px, 92vw); }
.modal-header {
  display: flex; align-items: center; justify-content: space-between;
  margin-bottom: 24px;
}
.modal-header h3 {
  font-family: var(--font-display);
  font-size: 20px;
  font-weight: 700;
  letter-spacing: -0.5px;
  color: var(--text-primary);
}
.modal-close {
  background: none; border: none;
  font-size: 22px; cursor: pointer;
  color: var(--text-muted); padding: 4px;
  border-radius: var(--r-xs);
  transition: color 0.15s, background 0.15s;
}
.modal-close:hover { color: var(--text-primary); background: var(--bg-surface); }

/* ═══ TABS ═══ */
.tabs {
  display: flex; gap: 2px;
  background: var(--bg-input);
  border-radius: var(--r-sm);
  padding: 3px;
  border: 1px solid var(--border);
  margin-bottom: 20px;
  overflow-x: auto;
}
.tab {
  padding: 8px 16px;
  border-radius: 6px;
  font-family: var(--font-body);
  font-size: 12px;
  font-weight: 500;
  cursor: pointer;
  color: var(--text-muted);
  white-space: nowrap;
  transition: all 0.15s;
  border: 1px solid transparent;
}
.tab:hover { color: var(--text-primary); }
.tab.active {
  background: #FFFFFF;
  color: var(--text-primary);
  font-weight: 600;
  box-shadow: var(--shadow-xs);
  border-color: var(--border);
}

/* ═══ RATE BARS ═══ */
.rate-bar {
  height: 5px;
  border-radius: 3px;
  background: var(--bg-input);
  overflow: hidden;
  margin-top: 6px;
}
.rate-bar .fill {
  height: 100%;
  border-radius: 3px;
  transition: width 0.4s ease;
}

/* ═══ SCORE RINGS ═══ */
.score-ring {
  width: 48px; height: 48px;
  border-radius: 50%;
  display: flex; align-items: center; justify-content: center;
  font-family: var(--font-display);
  font-weight: 800;
  font-size: 15px;
  letter-spacing: -0.5px;
  color: #fff;
  flex-shrink: 0;
  box-shadow: inset 0 0 0 2px rgba(255,255,255,0.25);
}
.score-ring-sm { width: 36px; height: 36px; font-size: 13px; }
.score-ring-lg { width: 64px; height: 64px; font-size: 18px; }

/* ═══ SCORE DOTS ═══ */
.score-dots { display: flex; gap: 4px; }
.score-dots .dot { width: 8px; height: 8px; border-radius: 50%; background: var(--bg-input); }

/* ═══ FLAG CARDS ═══ */
.flag-card {
  background: rgba(224,72,72,0.03);
  border: 1px solid rgba(224,72,72,0.15);
  border-left: 3px solid var(--red);
  border-radius: var(--r-sm);
  padding: 14px 16px;
  box-shadow: none;
  margin-bottom: 10px;
  display: flex; align-items: center; justify-content: space-between; gap: 12px;
}
.flag-card .flag-text { font-size: 13px; flex: 1; }

/* ═══ PAGE HEADER ═══ */
.page-header {
  display: flex; align-items: center; justify-content: space-between;
  margin-bottom: 24px;
}
.page-header h2 {
  font-family: var(--font-display);
  font-size: 22px;
  font-weight: 700;
  letter-spacing: -0.5px;
  color: var(--text-primary);
}

/* ═══ PROFILE ═══ */
.profile-header { display: flex; gap: 24px; align-items: flex-start; flex-wrap: wrap; }
.profile-info { flex: 1; min-width: 200px; }
.profile-kpis { display: flex; gap: 14px; flex-wrap: wrap; }

/* ═══ AVATAR ═══ */
.avatar {
  display: flex; align-items: center; justify-content: center;
  border-radius: 50%;
  font-family: var(--font-display);
  font-weight: 700;
  color: #fff;
  flex-shrink: 0;
}
.avatar-sm { width: 32px; height: 32px; font-size: 12px; }
.avatar-md { width: 48px; height: 48px; font-size: 16px; }
.avatar-lg { width: 72px; height: 72px; font-size: 24px; }

/* ═══ EMPTY STATES ═══ */
.empty {
  text-align: center;
  padding: 48px 20px;
  color: var(--text-muted);
  font-family: var(--font-body);
  font-size: 13px;
  font-style: normal;
}

/* ═══ SLIDERS ═══ */
.slider-group { margin-bottom: 14px; }
.slider-group label {
  display: flex; justify-content: space-between;
  font-size: 12px; font-weight: 600; color: var(--text-secondary);
  margin-bottom: 4px;
}
.slider-group input[type=range] { width: 100%; accent-color: var(--gold); }
.slider-group .hint { font-size: 11px; color: var(--text-muted); font-style: italic; }

/* ═══ MODEL INSIGHT CARD ═══ */
.model-insight {
  border-radius: var(--r-lg);
  padding: 20px;
  background: var(--bg-card);
  border: 1px solid var(--border);
  box-shadow: var(--shadow-sm);
  transition: box-shadow var(--t-base), transform var(--t-base);
}
.model-insight:hover {
  box-shadow: var(--shadow-md);
  transform: translateY(-1px);
}
.model-insight-header {
  display: flex; align-items: center; gap: 10px;
  margin-bottom: 14px;
}
.model-insight-header .dot { width: 12px; height: 12px; border-radius: 50%; }
.model-insight-header h3 { font-size: 16px; letter-spacing: -0.3px; }
.model-insight .kpi-row { display: flex; gap: 12px; margin-bottom: 12px; flex-wrap: wrap; }
.model-insight .kpi-item {
  flex: 1; min-width: 70px;
  background: var(--bg-surface);
  border-radius: var(--r-sm);
  padding: 10px;
  text-align: center;
  border: 1px solid var(--border-light);
}
.model-insight .kpi-item .kpi-val {
  font-family: var(--font-mono);
  font-size: 17px;
  font-weight: 500;
  color: var(--text-primary);
}
.model-insight .kpi-item .kpi-label {
  font-size: 10px;
  font-family: var(--font-mono);
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.5px;
  margin-top: 2px;
}
.insight-list { list-style: none; padding: 0; margin: 0; }
.insight-list li {
  padding: 6px 0;
  border-bottom: 1px solid var(--border-light);
  font-size: 13px;
  display: flex; align-items: flex-start; gap: 8px;
  color: var(--text-primary);
}
.insight-list li:last-child { border-bottom: none; }
.insight-bullet { width: 6px; height: 6px; border-radius: 50%; margin-top: 6px; flex-shrink: 0; }

/* ═══ DAY GRID (Performance) ═══ */
.day-grid {
  display: grid;
  grid-template-columns: repeat(7, 1fr);
  gap: 6px;
  margin-bottom: 12px;
}
.day-cell {
  text-align: center;
  padding: 10px 4px;
  border-radius: var(--r-sm);
  background: var(--bg-surface);
  border: 1px solid var(--border-light);
  transition: border-color 0.15s;
}
.day-cell .day-label {
  font-family: var(--font-mono);
  font-size: 10px;
  color: var(--text-muted);
  margin-bottom: 4px;
  text-transform: uppercase;
  letter-spacing: 0.5px;
}
.day-cell .day-val {
  font-family: var(--font-mono);
  font-weight: 500;
  font-size: 13px;
  color: var(--text-primary);
}
.day-cell.low {
  background: rgba(224,72,72,0.05);
  border: 1px solid rgba(224,72,72,0.20);
}
.day-cell.low .day-val { color: var(--red); }
.day-cell.good {
  background: rgba(34,192,122,0.05);
  border: 1px solid rgba(34,192,122,0.20);
}
.day-cell.good .day-val { color: #18A066; }

/* ═══ ACTION ITEMS ═══ */
.action-item {
  display: flex; align-items: center; gap: 8px;
  padding: 10px 14px;
  background: var(--bg-surface);
  border-radius: var(--r-sm);
  margin-bottom: 6px;
  font-size: 13px;
  border: 1px solid var(--border-light);
  transition: border-color 0.15s;
}
.action-item:hover { border-color: var(--border); }
.action-item .action-priority { width: 8px; height: 8px; border-radius: 50%; flex-shrink: 0; }

/* ═══ TOAST NOTIFICATIONS ═══ */
.toast-container {
  position: fixed; bottom: 24px; right: 24px; z-index: 9999;
  display: flex; flex-direction: column; gap: 8px;
  align-items: flex-end;
}
.toast {
  background: #FFFFFF;
  border: 1px solid var(--border);
  border-radius: var(--r-md);
  padding: 12px 16px;
  box-shadow: var(--shadow-md);
  font-family: var(--font-body);
  font-size: 13px;
  font-weight: 500;
  color: var(--text-primary);
  display: flex; align-items: center; gap: 10px;
  max-width: 320px;
  animation: toastIn 0.2s ease;
}
.toast::before {
  content: '';
  width: 8px; height: 8px;
  border-radius: 50%;
  background: var(--green);
  flex-shrink: 0;
}
.toast-exit {
  animation: toastOut 0.2s ease forwards;
}

/* ═══ LOADING SCREEN ═══ */
.loading-screen {
  position: fixed; inset: 0;
  background: var(--bg-body);
  z-index: 10000;
  display: flex; flex-direction: column;
  align-items: center; justify-content: center;
  gap: 20px;
  transition: opacity 0.4s ease;
}
.loading-screen .spinner {
  width: 40px; height: 40px;
  border: 3px solid var(--border);
  border-top-color: var(--gold);
  border-radius: 50%;
  animation: spin 0.75s linear infinite;
}
.loading-screen .brand {
  font-family: var(--font-display);
  font-weight: 800;
  font-size: 28px;
  letter-spacing: -1px;
  color: var(--text-primary);
}

/* ═══ RESPONSIVE: 1024px ═══ */
@media (max-width: 1024px) {
  .grid-5 { grid-template-columns: repeat(3, 1fr); }
  .grid-4 { grid-template-columns: repeat(2, 1fr); }
}

/* ═══ RESPONSIVE: 768px ═══ */
@media (max-width: 768px) {
  .sidebar { transform: translateX(-100%); }
  .sidebar.open { transform: translateX(0); }
  .hamburger { display: flex; align-items: center; justify-content: center; }
  .overlay.show { display: block; }
  .main { margin-left: 0; padding: 16px 16px; padding-top: 60px; }
  .grid-2, .grid-3, .grid-4, .grid-5 { grid-template-columns: 1fr; }
  .form-row { flex-direction: column; gap: 0; }
  .profile-header { flex-direction: column; }
  .day-grid { grid-template-columns: repeat(4, 1fr); }
  .modal { width: 95vw; padding: 20px; border-radius: var(--r-lg); }
}

/* ═══ AUTH ═══ */
.auth-screen {
  position: fixed; inset: 0; z-index: 9999;
  background: var(--bg-body);
  display: flex; align-items: center; justify-content: center;
}
.auth-card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--r-lg);
  box-shadow: var(--shadow-lg);
  padding: 48px 40px;
  max-width: 400px;
  width: 90%;
  text-align: center;
}
.auth-logo {
  font-family: var(--font-display);
  font-weight: 800;
  font-size: 40px;
  color: var(--text-primary);
  margin-bottom: 4px;
}
.auth-subtitle {
  font-family: var(--font-mono);
  font-size: 12px;
  color: var(--text-muted);
  margin-bottom: 32px;
  letter-spacing: 1px;
}
.auth-input {
  width: 100%;
  padding: 14px 16px;
  font-family: var(--font-body);
  font-size: 14px;
  background: var(--bg-body);
  border: 1px solid var(--border);
  border-radius: var(--r-sm);
  outline: none;
  margin-bottom: 12px;
  transition: border-color var(--t-fast), box-shadow var(--t-fast);
  color: var(--text-primary);
}
.auth-input:focus {
  border-color: var(--gold);
  box-shadow: 0 0 0 3px rgba(200,164,78,0.12);
}
.auth-input::placeholder { color: var(--text-muted); }
.auth-btn { width: 100%; height: 48px; font-size: 15px; margin-top: 4px; }
.auth-error {
  font-size: 12px;
  color: #E04848;
  min-height: 20px;
  margin-bottom: 4px;
}
.auth-switch {
  font-size: 12px;
  color: var(--text-muted);
  margin-top: 16px;
}
.auth-switch a {
  color: var(--gold);
  text-decoration: none;
  font-weight: 600;
}
.auth-switch a:hover { text-decoration: underline; }
.auth-input.shake {
  animation: authShake 0.4s ease;
}
@keyframes authShake {
  0%,100% { transform:translateX(0); }
  20%,60% { transform:translateX(-6px); }
  40%,80% { transform:translateX(6px); }
}

/* WELCOME SCREEN */
.welcome-screen {
  position: fixed; inset: 0; z-index: 9998;
  background: var(--bg-body);
  display: flex; align-items: center; justify-content: center;
}
.welcome-card {
  text-align: center;
  max-width: 520px;
  width: 90%;
  animation: welcomeFadeIn 0.6s ease both;
}
.welcome-avatar {
  width: 80px; height: 80px; border-radius: 50%;
  display: flex; align-items: center; justify-content: center;
  font-family: var(--font-display); font-weight: 800; font-size: 28px;
  color: #fff; margin: 0 auto 20px;
}
.welcome-greeting {
  font-family: var(--font-display);
  font-weight: 800;
  font-size: 28px;
  color: var(--text-primary);
  margin-bottom: 8px;
  line-height: 1.3;
}
.welcome-role {
  font-family: var(--font-mono);
  font-size: 13px;
  color: var(--gold);
  letter-spacing: 1px;
  text-transform: uppercase;
  margin-bottom: 16px;
}
.welcome-tagline {
  font-size: 15px;
  color: var(--text-secondary);
  line-height: 1.6;
  margin-bottom: 28px;
}
.welcome-enter {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 14px 32px;
  font-family: var(--font-display);
  font-weight: 700;
  font-size: 15px;
  border-radius: var(--r-sm);
  cursor: pointer;
  transition: all var(--t-fast);
}
@keyframes welcomeFadeIn {
  from { opacity: 0; transform: translateY(20px); }
  to { opacity: 1; transform: translateY(0); }
}

/* ═══ LIVE OPS ═══ */
.live-pulse-dot {
  width: 8px; height: 8px; border-radius: 50%; background: #22C07A;
  display: inline-block; margin-left: auto;
  animation: pulse 2s infinite;
}
.live-status-dot {
  width: 10px; height: 10px; border-radius: 50%; display: inline-block; flex-shrink: 0;
}
.live-status-dot.online { background: #22C07A; animation: pulse 2s infinite; }
.live-status-dot.idle { background: #E09830; animation: pulse 2s infinite; }
.live-status-dot.offline { background: #6B7280; }
.live-alert-card {
  border: 1px solid #E04848; border-radius: var(--r-md); padding: 12px 16px;
  background: rgba(224,72,72,0.04); margin-bottom: 12px;
}
.live-alert-card .alert-title { color: #E04848; font-weight: 600; font-size: 13px; margin-bottom: 4px; }
.live-alert-card .alert-desc { font-size: 12px; color: var(--text-sec); }
.lb-full-row { display: flex; align-items: center; gap: 12px; padding: 10px 12px; border-bottom: 1px solid var(--border); }
.lb-full-row.rank-1 { background: rgba(200,164,78,0.08); }
.lb-full-row.rank-2 { background: rgba(192,192,192,0.06); }
.lb-full-row.rank-3 { background: rgba(205,127,50,0.06); }
.lb-full-rank { font-family: var(--font-mono); font-weight: 600; width: 32px; text-align: center; }
.lb-full-name { font-weight: 600; flex: 1; }
.lb-full-amount { font-family: var(--font-mono); font-weight: 600; color: var(--gold); }
.token-reveal {
  font-family: var(--font-mono); font-size: 14px; letter-spacing: 2px;
  background: var(--bg-body); padding: 6px 12px; border-radius: 6px; border: 1px solid var(--border);
}
.chatter-hub-card {
  border: 1px solid var(--border); border-radius: var(--r-md); padding: 16px;
  background: var(--bg-card); transition: box-shadow var(--t-fast);
}
.chatter-hub-card:hover { box-shadow: var(--shadow-md); }

/* ═══ AI CHIEF OF STAFF ═══ */
.ai-item { color: #C8B4FF !important; }
.ai-item:hover { background: rgba(139,92,246,0.10) !important; color: #D8C8FF !important; }
.ai-item.active { background: rgba(139,92,246,0.15) !important; color: #C8B4FF !important; }
.ai-item.active::before { background: #8B5CF6 !important; }

.ai-layout { display: flex; gap: 20px; }
.ai-main { flex: 1; min-width: 0; }
.ai-sidebar { width: 280px; flex-shrink: 0; display: flex; flex-direction: column; gap: 16px; }

.ai-msg { margin-bottom: 16px; display: flex; }
.ai-msg-user { justify-content: flex-end; }
.ai-msg-ai { justify-content: flex-start; }
.ai-bubble-user {
  background: rgba(200,164,78,0.10); border: 1px solid rgba(200,164,78,0.20);
  border-radius: 12px 12px 2px 12px; padding: 12px 16px; max-width: 75%;
  font-size: 13px; line-height: 1.6;
}
.ai-bubble-ai {
  background: var(--bg-card); border: 1px solid var(--border);
  border-radius: 2px 12px 12px 12px; padding: 16px 18px; max-width: 85%;
  font-size: 13px; line-height: 1.7; box-shadow: var(--shadow-xs);
}
.ai-bubble-ai p { margin-bottom: 8px; }
.ai-bubble-ai p:last-child { margin-bottom: 0; }
.ai-bubble-ai ul { padding-left: 18px; margin: 6px 0; }
.ai-bubble-ai li { margin-bottom: 4px; }
.ai-bubble-error {
  background: rgba(224,72,72,0.05); border: 1px solid rgba(224,72,72,0.20);
  color: var(--red);
}
.ai-label { font-family: var(--font-mono); font-size: 10px; color: #8B5CF6; margin-bottom: 6px; }
.ai-ts { font-family: var(--font-mono); font-size: 10px; color: var(--text-muted); margin-top: 6px; }

.ai-confirm-task {
  background: #fff; border: 1px solid var(--border); border-radius: var(--r-sm);
  padding: 10px 14px; margin-bottom: 8px; border-left: 3px solid var(--blue);
}
.ai-confirm-task.priority-urgent { border-left-color: var(--red); }
.ai-confirm-task.priority-high { border-left-color: var(--amber); }

.typing-indicator { display: flex; gap: 4px; padding: 12px 16px; }
.typing-indicator span {
  width: 8px; height: 8px; border-radius: 50%; background: var(--text-muted);
  animation: bounce 1.2s infinite;
}
.typing-indicator span:nth-child(2) { animation-delay: 0.2s; }
.typing-indicator span:nth-child(3) { animation-delay: 0.4s; }
@keyframes bounce { 0%,60%,100%{transform:translateY(0)} 30%{transform:translateY(-6px)} }

.ai-drop-zone {
  border: 2px dashed var(--border-mid); border-radius: var(--r-md);
  padding: 32px; text-align: center; cursor: pointer;
  transition: border-color 0.15s, background 0.15s;
  color: var(--text-muted); font-size: 13px;
}
.ai-drop-zone:hover, .ai-drop-zone.dragover {
  border-color: var(--gold); background: rgba(200,164,78,0.03);
}

.ai-quick-cmd {
  padding: 8px 12px; border-radius: var(--r-sm); cursor: pointer;
  font-size: 12px; font-weight: 500; transition: background 0.12s;
  border-bottom: 1px solid var(--border-light);
}
.ai-quick-cmd:last-child { border-bottom: none; }
.ai-quick-cmd:hover { background: rgba(200,164,78,0.06); }

/* ═══ RESPONSIVE: 480px ═══ */
@media (max-width: 480px) {
  .grid-2, .grid-3, .grid-4, .grid-5 { grid-template-columns: 1fr; }
  .form-row { flex-direction: column; gap: 0; }
  .day-grid { grid-template-columns: repeat(4, 1fr); }
}
@media (max-width: 768px) {
  .ai-layout { flex-direction: column; }
  .ai-sidebar { width: 100%; }
}

/* ─── KPI Projects ─── */
.proj-card { transition: transform 0.15s, box-shadow 0.15s; }
.proj-card:hover { transform: translateY(-2px); box-shadow: 0 8px 24px rgba(0,0,0,0.12); }
