/* Traffic Pro CRM — Design System */

:root {
  /* Brand */
  --tp-blue: #131FF2;
  --tp-blue-600: #0e18c4;
  --tp-blue-700: #0a128f;
  --tp-blue-50: #eef0ff;
  --tp-blue-100: #dde0ff;
  --tp-blue-200: #b8bfff;
  --tp-yellow: #FABC00;
  --tp-yellow-soft: #fff4d1;
  --tp-black: #0a0a0f;
  --tp-white: #ffffff;

  /* Neutrals (cool, slightly blue-tinted) */
  --n-0: #ffffff;
  --n-25: #fafbff;
  --n-50: #f5f6fb;
  --n-100: #eceef5;
  --n-200: #dde0eb;
  --n-300: #c2c7d6;
  --n-400: #9aa0b4;
  --n-500: #6f7591;
  --n-600: #4d5370;
  --n-700: #353a52;
  --n-800: #1f2238;
  --n-900: #0e1024;

  /* Semantic */
  --success: #16a34a;
  --warn: #f59e0b;
  --danger: #ef4444;

  /* Surfaces (LIGHT) */
  --bg-app: var(--n-50);
  --bg-panel: var(--n-0);
  --bg-rail: #f7f8fc;
  --bg-chat: #f0f2f9;
  --bg-bubble-in: #ffffff;
  --bg-bubble-out: #dde0ff;
  --border: var(--n-200);
  --border-strong: var(--n-300);
  --text: var(--n-900);
  --text-muted: var(--n-500);
  --text-subtle: var(--n-400);

  /* Type */
  --font-display: 'Montserrat', system-ui, sans-serif;
  --font-body: 'Open Sans', system-ui, sans-serif;
  --font-slab: 'Roboto Slab', Georgia, serif;

  /* Radii */
  --r-xs: 6px;
  --r-sm: 8px;
  --r-md: 12px;
  --r-lg: 16px;
  --r-xl: 22px;
  --r-pill: 999px;

  /* Shadows */
  --sh-1: 0 1px 2px rgba(15, 18, 50, 0.06);
  --sh-2: 0 4px 14px rgba(15, 18, 50, 0.08);
  --sh-3: 0 10px 40px rgba(15, 18, 50, 0.12);
  --sh-pop: 0 16px 48px rgba(19, 31, 242, 0.18);

  /* Spacing scale */
  --s-1: 4px;
  --s-2: 8px;
  --s-3: 12px;
  --s-4: 16px;
  --s-5: 20px;
  --s-6: 24px;
  --s-8: 32px;
}

[data-theme="dark"] {
  --bg-app: #07081a;
  --bg-panel: #0e1130;
  --bg-rail: #0a0c24;
  --bg-chat: #060716;
  --bg-bubble-in: #161a3d;
  --bg-bubble-out: #1f2bff;
  --border: #1a1e44;
  --border-strong: #262c5a;
  --text: #f1f3ff;
  --text-muted: #8b91b8;
  --text-subtle: #5a6088;
  --tp-blue-50: #161a3d;
  --tp-blue-100: #1c2256;
}

* { box-sizing: border-box; }
html, body { margin: 0; padding: 0; }
body {
  font-family: var(--font-body);
  color: var(--text);
  background: var(--bg-app);
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}

/* Typography */
.font-display { font-family: var(--font-display); }
.font-slab { font-family: var(--font-slab); }

/* Brand chip */
.tp-mark {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  font-family: var(--font-display);
  font-weight: 800;
  letter-spacing: -0.01em;
}
.tp-mark img { width: 28px; height: 28px; object-fit: contain; }

/* Buttons */
.btn {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 10px 16px;
  border-radius: var(--r-md);
  border: 1px solid transparent;
  font-family: var(--font-display);
  font-weight: 600;
  font-size: 14px;
  cursor: pointer;
  transition: transform .08s ease, background .15s ease, box-shadow .15s ease;
}
.btn:active { transform: translateY(1px); }
.btn-primary { background: var(--tp-blue); color: white; }
.btn-primary:hover { background: var(--tp-blue-600); box-shadow: var(--sh-pop); }
.btn-ghost { background: transparent; color: var(--text); }
.btn-ghost:hover { background: var(--n-100); }
[data-theme="dark"] .btn-ghost:hover { background: var(--bg-rail); }
.btn-yellow { background: var(--tp-yellow); color: var(--tp-black); }

/* Badge */
.badge {
  display: inline-flex; align-items: center; justify-content: center;
  padding: 2px 8px; border-radius: var(--r-pill);
  font-family: var(--font-display);
  font-weight: 700; font-size: 11px; line-height: 1.4;
}
.badge-yellow { background: var(--tp-yellow); color: var(--tp-black); }
.badge-blue { background: var(--tp-blue); color: white; }
.badge-soft { background: var(--tp-blue-50); color: var(--tp-blue); }
.badge-dot { width: 9px; height: 9px; border-radius: 50%; padding: 0; }

/* Avatar */
.avatar {
  display: inline-flex; align-items: center; justify-content: center;
  width: 44px; height: 44px; border-radius: 50%;
  background: var(--tp-blue-50);
  color: var(--tp-blue);
  font-family: var(--font-display);
  font-weight: 700;
  font-size: 14px;
  flex-shrink: 0;
  position: relative;
  overflow: hidden;
}
.avatar.sm { width: 32px; height: 32px; font-size: 12px; }
.avatar.lg { width: 64px; height: 64px; font-size: 22px; }
.avatar.xl { width: 96px; height: 96px; font-size: 32px; }
.avatar-presence {
  position: absolute; bottom: 0; right: 0;
  width: 12px; height: 12px; border-radius: 50%;
  background: var(--success);
  border: 2px solid var(--bg-panel);
}

/* Scrollbars */
.scroll { overflow-y: auto; scrollbar-width: thin; scrollbar-color: var(--n-300) transparent; }
.scroll::-webkit-scrollbar { width: 6px; }
.scroll::-webkit-scrollbar-thumb { background: var(--n-300); border-radius: 3px; }
[data-theme="dark"] .scroll { scrollbar-color: #2a2f5e transparent; }
[data-theme="dark"] .scroll::-webkit-scrollbar-thumb { background: #2a2f5e; }

/* Inputs */
.input {
  width: 100%;
  padding: 10px 14px;
  border-radius: var(--r-pill);
  border: 1px solid var(--border);
  background: var(--bg-rail);
  color: var(--text);
  font-family: var(--font-body);
  font-size: 14px;
  outline: none;
}
.input:focus { border-color: var(--tp-blue); background: var(--bg-panel); }

/* Stripe placeholder */
.stripe-ph {
  background: repeating-linear-gradient(135deg, var(--n-100) 0 12px, var(--n-50) 12px 24px);
  color: var(--text-muted);
  font-family: ui-monospace, Menlo, monospace;
  font-size: 11px;
  display: flex; align-items: center; justify-content: center;
  border-radius: var(--r-md);
}

/* Pipeline pill colors */
.pipe-cold { background: #e5e9f6; color: #4d5370; }
.pipe-warm { background: #fff4d1; color: #8a6300; }
.pipe-hot  { background: #ffe1cc; color: #c44a00; }
.pipe-won  { background: #d6f4e0; color: #14753a; }
.pipe-lost { background: #ffd8d8; color: #a32020; }

[data-theme="dark"] .pipe-cold { background: #1a2040; color: #b8bfff; }
[data-theme="dark"] .pipe-warm { background: #3a2c08; color: #fabc00; }
[data-theme="dark"] .pipe-hot  { background: #3a1a08; color: #ff9c5a; }
[data-theme="dark"] .pipe-won  { background: #0d3320; color: #5fe39a; }
[data-theme="dark"] .pipe-lost { background: #3a1010; color: #ff8a8a; }

/* Density */
[data-density="cozy"] { --row-pad: 14px 16px; }
[data-density="compact"] { --row-pad: 8px 12px; }
