/* =============================================================
   Proxall Whisper — Design Tokens
   Dark-mode native. Compact. Linear meets Notion meets Stripe.
============================================================= */

:root {
  /* —— Color: Brand —— */
  --brand-500: #7c5cfc;   /* primary accent */
  --brand-400: #a78bfa;   /* secondary */
  --brand-300: #c4b5fd;
  --brand-600: #6d4ef0;
  --brand-700: #5b3fd8;
  --brand-bg:  rgba(124, 92, 252, 0.10);
  --brand-bg-strong: rgba(124, 92, 252, 0.18);
  --brand-border: rgba(124, 92, 252, 0.30);

  /* —— Color: Opportunity / cross-sell —— */
  --fuchsia-500: #ec4899;
  --violet-400:  #c084fc;
  --opp-bg: rgba(236, 72, 153, 0.10);

  /* —— Color: Status semantic —— */
  --success-500: #4ade80;
  --success-bg:  rgba(74, 222, 128, 0.10);
  --success-border: rgba(74, 222, 128, 0.28);

  --danger-500:  #f87171;
  --danger-bg:   rgba(248, 113, 113, 0.10);
  --danger-border: rgba(248, 113, 113, 0.28);

  --warning-500: #fbbf24;
  --warning-bg:  rgba(251, 191, 36, 0.10);
  --warning-border: rgba(251, 191, 36, 0.28);

  --info-500:    #60a5fa;
  --info-bg:     rgba(96, 165, 250, 0.10);
  --info-border: rgba(96, 165, 250, 0.28);

  --muted-500:   #9d9bb8;
  --muted-bg:    rgba(157, 155, 184, 0.10);

  /* —— Color: Surface / structure —— */
  --bg:           #0a0a12;
  --bg-2:         #13131c;
  --bg-3:         #181822;
  --card:         #1a1a26;
  --card-hover:   #20202e;
  --card-elev:    #22222f;
  --overlay:      rgba(10, 10, 18, 0.72);

  --border:       rgba(255, 255, 255, 0.06);
  --border-strong: rgba(255, 255, 255, 0.10);
  --border-focus:  rgba(124, 92, 252, 0.55);

  /* —— Color: Text —— */
  --text:         #f0eeff;
  --text-2:       #c9c7e0;
  --text-muted:   #9d9bb8;
  --text-dim:     #6f6e87;

  /* —— Typography —— */
  --font-sans: "Inter", ui-sans-serif, system-ui, -apple-system, "Segoe UI", Helvetica, Arial, sans-serif;
  --font-mono: "JetBrains Mono", ui-monospace, "SFMono-Regular", Menlo, Consolas, monospace;

  /* Modular scale 1.2 (clamped at human-readable steps) */
  --fs-9:  9px;
  --fs-10: 10px;
  --fs-11: 11px;
  --fs-12: 12px;
  --fs-13: 13px;   /* base body */
  --fs-14: 14px;
  --fs-16: 16px;
  --fs-19: 19px;
  --fs-23: 23px;
  --fs-28: 28px;
  --fs-32: 32px;

  --lh-tight:  1.15;
  --lh-snug:   1.30;
  --lh-normal: 1.45;
  --lh-relaxed: 1.55;

  --fw-regular: 400;
  --fw-medium:  500;
  --fw-semibold: 600;
  --fw-bold:    700;

  /* —— Spacing 4–8–12–16–24–32 —— */
  --sp-1: 4px;
  --sp-2: 8px;
  --sp-3: 12px;
  --sp-4: 16px;
  --sp-5: 20px;
  --sp-6: 24px;
  --sp-7: 32px;
  --sp-8: 40px;
  --sp-9: 48px;
  --sp-10: 64px;

  /* —— Radii —— */
  --r-1: 4px;
  --r-2: 6px;
  --r-3: 8px;
  --r-4: 10px;
  --r-5: 14px;
  --r-pill: 999px;

  /* —— Elevation —— */
  --shadow-1: 0 1px 0 0 rgba(0,0,0,0.4);
  --shadow-2: 0 4px 12px -2px rgba(0,0,0,0.45), 0 0 0 1px var(--border);
  --shadow-3: 0 20px 40px -12px rgba(0,0,0,0.6), 0 0 0 1px var(--border-strong);
  --shadow-focus: 0 0 0 2px var(--bg), 0 0 0 4px var(--border-focus);

  /* —— Motion (subtle, fast) —— */
  --t-fast: 80ms;
  --t-base: 140ms;
  --t-slow: 200ms;
  --ease: cubic-bezier(0.2, 0.0, 0.0, 1);
}

/* =============================================================
   Light theme overrides — applied via [data-theme="light"]
============================================================= */
[data-theme="light"] {
  /* Brand stays — but backgrounds lighten */
  --brand-bg:        rgba(124, 92, 252, 0.08);
  --brand-bg-strong: rgba(124, 92, 252, 0.14);
  --brand-border:    rgba(124, 92, 252, 0.32);

  --opp-bg: rgba(236, 72, 153, 0.08);

  --success-bg:     rgba(22, 163, 74, 0.08);
  --success-border: rgba(22, 163, 74, 0.30);
  --success-500:    #16a34a;

  --danger-bg:      rgba(220, 38, 38, 0.07);
  --danger-border:  rgba(220, 38, 38, 0.28);
  --danger-500:     #dc2626;

  --warning-bg:     rgba(202, 138, 4, 0.08);
  --warning-border: rgba(202, 138, 4, 0.30);
  --warning-500:    #ca8a04;

  --info-bg:        rgba(37, 99, 235, 0.07);
  --info-border:    rgba(37, 99, 235, 0.28);
  --info-500:       #2563eb;

  --muted-bg:       rgba(100, 96, 130, 0.06);
  --muted-500:      #64607f;

  --fuchsia-500:    #db2777;

  /* Surface */
  --bg:          #fbfbfd;
  --bg-2:        #f4f4f8;
  --bg-3:        #ececf2;
  --card:        #ffffff;
  --card-hover:  #f7f6fb;
  --card-elev:   #ffffff;
  --overlay:     rgba(20, 18, 35, 0.45);

  --border:        rgba(20, 18, 35, 0.07);
  --border-strong: rgba(20, 18, 35, 0.12);
  --border-focus:  rgba(124, 92, 252, 0.55);

  /* Text */
  --text:        #14122a;
  --text-2:      #3b3858;
  --text-muted:  #6f6c8a;
  --text-dim:    #9b98b3;

  --shadow-1: 0 1px 0 0 rgba(20,18,35,0.04);
  --shadow-2: 0 4px 14px -4px rgba(20,18,35,0.10), 0 0 0 1px var(--border);
  --shadow-3: 0 20px 40px -12px rgba(20,18,35,0.22), 0 0 0 1px var(--border-strong);
}

/* Primary button text stays white in both themes; success button text needs to
   adapt — green-on-white is white, green-on-dark is dark. */
[data-theme="light"] .btn.btn-success { color: #fff; }
[data-theme="light"] .btn.btn-success:hover { background: #15803d; }
[data-theme="light"] .lang-pill { background: rgba(20,18,35,0.04); }

/* Customer-hero gradient swap for light mode */
[data-theme="light"] .cust-hero-bg {
  background:
    radial-gradient(800px 400px at 0% 0%,    rgba(124,92,252,0.12), transparent 60%),
    radial-gradient(800px 400px at 100% 50%, rgba(236, 72,153,0.06), transparent 60%),
    linear-gradient(180deg, #f7f4ff 0%, #fdfbff 100%);
}

/* =============================================================
   Base reset
============================================================= */
*, *::before, *::after { box-sizing: border-box; }
html, body { margin: 0; padding: 0; }
body {
  font-family: var(--font-sans);
  font-size: var(--fs-13);
  line-height: var(--lh-normal);
  color: var(--text);
  background: var(--bg);
  font-feature-settings: "cv11", "ss01", "ss03";
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

button { font: inherit; color: inherit; background: none; border: 0; cursor: pointer; padding: 0; }
input, textarea, select { font: inherit; color: inherit; }

::selection { background: var(--brand-bg-strong); color: var(--text); }

/* Mono — number / phone display */
.mono, .num { font-family: var(--font-mono); font-variant-numeric: tabular-nums; letter-spacing: -0.01em; }
.tnum { font-variant-numeric: tabular-nums; }

/* Focus ring */
:where(button, a, input, textarea, select, [role="button"], [tabindex]):focus-visible {
  outline: 0;
  box-shadow: var(--shadow-focus);
  border-radius: var(--r-2);
}

/* =============================================================
   Scrollbars — slim, dark
============================================================= */
.scroll, .scroll * { scrollbar-width: thin; scrollbar-color: rgba(255,255,255,0.10) transparent; }
.scroll::-webkit-scrollbar, .scroll *::-webkit-scrollbar { width: 8px; height: 8px; }
.scroll::-webkit-scrollbar-thumb, .scroll *::-webkit-scrollbar-thumb {
  background: rgba(255,255,255,0.08); border-radius: 8px;
}
.scroll::-webkit-scrollbar-thumb:hover, .scroll *::-webkit-scrollbar-thumb:hover {
  background: rgba(255,255,255,0.16);
}

/* =============================================================
   Components — reusable primitives
============================================================= */

/* Button */
.btn {
  display: inline-flex; align-items: center; gap: var(--sp-2);
  padding: 6px 12px;
  font-size: var(--fs-12); font-weight: var(--fw-medium);
  background: var(--card); color: var(--text);
  border-radius: var(--r-2);
  box-shadow: inset 0 0 0 1px var(--border-strong);
  white-space: nowrap;
  transition: background var(--t-fast) var(--ease), box-shadow var(--t-fast) var(--ease);
}
.btn:hover { background: var(--card-hover); }
.btn .ico { width: 14px; height: 14px; flex: none; }

.btn.btn-primary {
  background: var(--brand-500); color: white;
  box-shadow: inset 0 0 0 1px rgba(255,255,255,0.10), 0 1px 0 rgba(0,0,0,0.35);
}
.btn.btn-primary:hover { background: var(--brand-600); }

.btn.btn-success { background: var(--success-500); color: #0e2a14; box-shadow: none; font-weight: 600; }
.btn.btn-success:hover { background: #65e495; }
.btn.btn-danger  { background: transparent; color: var(--danger-500); box-shadow: inset 0 0 0 1px var(--danger-border); }
.btn.btn-danger:hover { background: var(--danger-bg); }

.btn.btn-ghost { background: transparent; box-shadow: none; color: var(--text-muted); }
.btn.btn-ghost:hover { background: var(--card); color: var(--text); }

.btn.btn-sm { padding: 4px 8px; font-size: var(--fs-11); }
.btn.btn-lg { padding: 9px 16px; font-size: var(--fs-13); }
.btn.btn-icon { padding: 6px; }
.btn.btn-icon .ico { width: 16px; height: 16px; }

/* Badge */
.badge {
  display: inline-flex; align-items: center; gap: 4px;
  padding: 2px 7px;
  font-size: var(--fs-11); font-weight: var(--fw-medium);
  border-radius: var(--r-2);
  background: var(--muted-bg); color: var(--text-2);
  box-shadow: inset 0 0 0 1px var(--border);
  white-space: nowrap;
  letter-spacing: 0.005em;
  line-height: 1.4;
  vertical-align: middle;
  position: relative;
  isolation: isolate;
}
.badge.dot::before {
  content: ""; width: 6px; height: 6px; border-radius: 50%;
  background: currentColor; opacity: 0.9;
  display: inline-block;
  flex: none;
  align-self: center;
  position: static;
  transform: none;
}
.badge.badge-success { background: var(--success-bg); color: var(--success-500); box-shadow: inset 0 0 0 1px var(--success-border); }
.badge.badge-danger  { background: var(--danger-bg);  color: var(--danger-500);  box-shadow: inset 0 0 0 1px var(--danger-border); }
.badge.badge-warning { background: var(--warning-bg); color: var(--warning-500); box-shadow: inset 0 0 0 1px var(--warning-border); }
.badge.badge-info    { background: var(--info-bg);    color: var(--info-500);    box-shadow: inset 0 0 0 1px var(--info-border); }
.badge.badge-brand   { background: var(--brand-bg);   color: var(--brand-400);   box-shadow: inset 0 0 0 1px var(--brand-border); }
.badge.badge-opp     { background: var(--opp-bg);     color: var(--fuchsia-500); box-shadow: inset 0 0 0 1px rgba(236,72,153,0.28); }
.badge.solid { box-shadow: none; }
.badge.lg { font-size: var(--fs-12); padding: 3px 9px; }

/* Counter chip — number badge next to nav label */
.count {
  display: inline-flex; align-items: center; justify-content: center;
  min-width: 18px; height: 18px; padding: 0 5px;
  font-family: var(--font-mono); font-variant-numeric: tabular-nums;
  font-size: var(--fs-10); font-weight: var(--fw-medium);
  background: rgba(255,255,255,0.06); color: var(--text-2);
  border-radius: var(--r-pill);
}
.count.warning { background: var(--warning-bg); color: var(--warning-500); }
.count.danger  { background: var(--danger-bg);  color: var(--danger-500);  }
.count.success { background: var(--success-bg); color: var(--success-500); }
.count.info    { background: var(--info-bg);    color: var(--info-500);    }
.count.brand   { background: var(--brand-bg);   color: var(--brand-400);   }

/* Card */
.card {
  background: var(--card);
  border-radius: var(--r-3);
  box-shadow: inset 0 0 0 1px var(--border);
  overflow: hidden;
}
.card.hover:hover { background: var(--card-hover); }
.card.accent {
  background: linear-gradient(180deg, var(--card) 0%, var(--card) 100%);
  position: relative;
}
.card.accent::before {
  content:""; position:absolute; left:0; top:0; bottom:0; width:3px;
  background: var(--brand-500); border-top-left-radius: var(--r-3); border-bottom-left-radius: var(--r-3);
}
.card.accent-success::before { background: var(--success-500); }
.card.accent-danger::before  { background: var(--danger-500); }
.card.accent-warning::before { background: var(--warning-500); }
.card.accent-info::before    { background: var(--info-500); }

/* KPI */
.kpi {
  padding: 14px 16px;
  display: flex; flex-direction: column; gap: 6px;
  background: var(--card);
  border-radius: var(--r-3);
  box-shadow: inset 0 0 0 1px var(--border);
  position: relative;
}
.kpi .kpi-label { font-size: var(--fs-11); color: var(--text-muted); text-transform: uppercase; letter-spacing: 0.06em; font-weight: 500; display: flex; align-items: center; gap: 6px; }
.kpi .kpi-label .ico { width: 12px; height: 12px; }
.kpi .kpi-value { font-family: var(--font-mono); font-variant-numeric: tabular-nums; font-size: 28px; line-height: 1.1; font-weight: 600; letter-spacing: -0.02em; color: var(--text); }
.kpi .kpi-meta  { font-size: var(--fs-11); color: var(--text-muted); display: flex; align-items: center; gap: 6px; }
.kpi .kpi-delta { font-family: var(--font-mono); font-size: var(--fs-11); }
.kpi .kpi-delta.up   { color: var(--success-500); }
.kpi .kpi-delta.down { color: var(--danger-500); }

.kpi.kpi-danger  .kpi-value { color: var(--danger-500); }
.kpi.kpi-warning .kpi-value { color: var(--warning-500); }
.kpi.kpi-success .kpi-value { color: var(--success-500); }
.kpi.kpi-info    .kpi-value { color: var(--info-500); }

/* Input */
.input, .select, .textarea {
  background: var(--bg-2);
  color: var(--text);
  border-radius: var(--r-2);
  box-shadow: inset 0 0 0 1px var(--border-strong);
  padding: 7px 10px;
  font-size: var(--fs-13);
  width: 100%;
  transition: box-shadow var(--t-fast) var(--ease);
}
.input::placeholder, .textarea::placeholder { color: var(--text-dim); }
.input:focus, .select:focus, .textarea:focus { box-shadow: inset 0 0 0 1px var(--border-focus), 0 0 0 3px rgba(124,92,252,0.18); outline: none; }
.input.error, .select.error { box-shadow: inset 0 0 0 1px var(--danger-border); }

/* Checkbox */
.checkbox {
  width: 16px; height: 16px;
  border-radius: 4px;
  background: var(--bg-2);
  box-shadow: inset 0 0 0 1px var(--border-strong);
  display: inline-flex; align-items: center; justify-content: center;
  flex: none;
  cursor: pointer;
  transition: background var(--t-fast), box-shadow var(--t-fast);
}
.checkbox.checked { background: var(--brand-500); box-shadow: inset 0 0 0 1px var(--brand-500); }
.checkbox.checked::after {
  content:""; width: 8px; height: 5px; border-left: 1.6px solid #fff; border-bottom: 1.6px solid #fff;
  transform: rotate(-45deg) translateY(-1px);
}

/* Chip / filter chip */
.chip {
  display: inline-flex; align-items: center; gap: 6px;
  padding: 3px 8px 3px 9px;
  font-size: var(--fs-12);
  background: var(--card); color: var(--text-2);
  border-radius: var(--r-pill);
  box-shadow: inset 0 0 0 1px var(--border-strong);
}
.chip .x { width: 12px; height: 12px; color: var(--text-dim); cursor: pointer; }
.chip:hover { background: var(--card-hover); }
.chip.active { background: var(--brand-bg); color: var(--brand-400); box-shadow: inset 0 0 0 1px var(--brand-border); }

/* Tabs */
.tabs { display: inline-flex; gap: 2px; background: var(--bg-2); padding: 3px; border-radius: var(--r-3); box-shadow: inset 0 0 0 1px var(--border); }
.tab {
  padding: 5px 11px; font-size: var(--fs-12); font-weight: 500;
  color: var(--text-muted); border-radius: var(--r-2);
  display: inline-flex; align-items: center; gap: 6px;
}
.tab:hover { color: var(--text); }
.tab.active { background: var(--card-elev); color: var(--text); box-shadow: 0 1px 0 rgba(0,0,0,0.4); }

/* Section header */
.section-header {
  display: flex; align-items: center; justify-content: space-between;
  padding: 0 2px 10px;
  position: sticky; top: 0; background: var(--bg);
}
.section-title {
  display: flex; align-items: center; gap: 10px;
  font-size: var(--fs-12); font-weight: 600;
  text-transform: uppercase; letter-spacing: 0.08em;
  color: var(--text-2);
}
.section-title .count { background: var(--card); color: var(--text); }

/* Banner */
.banner {
  display: flex; align-items: center; gap: 10px;
  padding: 10px 14px;
  border-radius: var(--r-3);
  font-size: var(--fs-12);
}
.banner.success { background: var(--success-bg); color: var(--success-500); box-shadow: inset 0 0 0 1px var(--success-border); }
.banner.warning { background: var(--warning-bg); color: var(--warning-500); box-shadow: inset 0 0 0 1px var(--warning-border); }
.banner.info    { background: var(--info-bg);    color: var(--info-500);    box-shadow: inset 0 0 0 1px var(--info-border); }
.banner .ico { width: 16px; height: 16px; flex: none; }
.banner .b-text { color: var(--text); }

/* Avatar */
.avatar {
  display: inline-flex; align-items: center; justify-content: center;
  width: 24px; height: 24px; border-radius: var(--r-pill);
  font-size: var(--fs-11); font-weight: 600; color: #fff;
  background: var(--brand-500);
  flex: none;
}
.avatar.lg { width: 32px; height: 32px; font-size: var(--fs-12); }
.avatar.sm { width: 20px; height: 20px; font-size: var(--fs-10); }

/* Utility */
.hstack { display: flex; align-items: center; gap: var(--sp-2); }
.vstack { display: flex; flex-direction: column; gap: var(--sp-2); }
.spacer { flex: 1; }
.muted  { color: var(--text-muted); }
.dim    { color: var(--text-dim); }
.divider { height: 1px; background: var(--border); }
.vdivider { width: 1px; background: var(--border); align-self: stretch; }

/* Icon sizing */
.ico { width: 14px; height: 14px; vertical-align: middle; flex: none; stroke-width: 1.6; }
.ico-sm { width: 12px; height: 12px; }
.ico-lg { width: 18px; height: 18px; }
.ico-xl { width: 22px; height: 22px; }

/* Tooltip-like soft hover label (CSS only) */
[data-tip] { position: relative; }
[data-tip]:hover::after {
  content: attr(data-tip);
  position: absolute; bottom: calc(100% + 6px); left: 50%; transform: translateX(-50%);
  background: #000; color: #fff; padding: 4px 8px; font-size: var(--fs-11);
  border-radius: 4px; white-space: nowrap; pointer-events: none; z-index: 100;
}

/* Empty state */
.empty {
  display: flex; flex-direction: column; align-items: center; justify-content: center;
  padding: 36px 16px; gap: 8px; color: var(--text-muted); text-align: center;
}
.empty .ico { width: 28px; height: 28px; opacity: 0.6; margin-bottom: 4px; }
.empty .title { color: var(--text-2); font-weight: 500; font-size: var(--fs-13); }
.empty .sub { font-size: var(--fs-12); }

/* Skeleton */
.skel {
  background: linear-gradient(90deg, var(--card) 0%, var(--card-hover) 50%, var(--card) 100%);
  background-size: 200% 100%;
  animation: shimmer 1.4s linear infinite;
  border-radius: var(--r-2);
}
@keyframes shimmer { 0% { background-position: 200% 0; } 100% { background-position: -200% 0; } }

/* =============================================================
   Data Table — design system primitive (08 · Components)
============================================================= */
.table-card { background: var(--card); border-radius: 8px; box-shadow: inset 0 0 0 1px var(--border); overflow: hidden; }
.data-table { width: 100%; border-collapse: collapse; font-size: var(--fs-12); font-family: var(--font-sans); }
.data-table th, .data-table td {
  padding: 9px 12px; text-align: left;
  box-shadow: inset 0 -1px 0 var(--border);
  vertical-align: middle;
}
.data-table th {
  font-size: var(--fs-11); font-weight: 600; color: var(--text-muted);
  text-transform: uppercase; letter-spacing: 0.06em;
  background: var(--bg-2);
  position: sticky; top: 0;
  white-space: nowrap;
}
.data-table tr:last-child td { box-shadow: none; }
.data-table tbody tr { transition: background .08s; cursor: pointer; }
.data-table tbody tr:hover { background: var(--card-hover); }
.data-table td.num, .data-table th.num { text-align: right; font-variant-numeric: tabular-nums; }
.data-table a.phone { color: var(--text); text-decoration: none; font-family: var(--font-mono); }
.data-table a.phone:hover { color: var(--brand-400); }
.data-table td .ico { vertical-align: middle; }
