/* ============================================================
   CRM — Design System
   Modern, clean SaaS · cool neutral · single sober indigo accent
   ============================================================ */

@import url('https://fonts.googleapis.com/css2?family=Hanken+Grotesk:wght@400;500;600;700;800&family=JetBrains+Mono:wght@400;500;600&display=swap');

:root {
  /* Neutrals (cool, low chroma) */
  --bg:           oklch(0.985 0.003 255);
  --bg-2:         oklch(0.972 0.004 255);
  --surface:      #ffffff;
  --surface-2:    oklch(0.985 0.003 255);
  --border:       oklch(0.918 0.005 255);
  --border-strong:oklch(0.86 0.008 255);
  --text:         oklch(0.255 0.012 262);
  --text-2:       oklch(0.46 0.012 262);
  --muted:        oklch(0.60 0.012 262);
  --faint:        oklch(0.74 0.01 262);

  /* Accent — sober indigo */
  --accent:       oklch(0.50 0.13 262);
  --accent-hover: oklch(0.44 0.135 262);
  --accent-soft:  oklch(0.955 0.025 262);
  --accent-softer:oklch(0.978 0.013 262);
  --accent-ring:  oklch(0.50 0.13 262 / 0.18);
  --on-accent:    #ffffff;

  /* Semantic */
  --success:      oklch(0.56 0.12 155);
  --success-soft: oklch(0.955 0.035 155);
  --danger:       oklch(0.56 0.16 25);
  --danger-soft:  oklch(0.96 0.03 25);
  --warning:      oklch(0.70 0.13 75);
  --warning-soft: oklch(0.96 0.05 80);
  --info:         oklch(0.62 0.10 235);
  --info-soft:    oklch(0.96 0.03 235);

  /* Radii */
  --r-xs: 5px;
  --r-sm: 7px;
  --r-md: 10px;
  --r-lg: 14px;
  --r-xl: 20px;

  /* Shadows — soft, modern */
  --sh-sm: 0 1px 2px oklch(0.4 0.02 262 / 0.05), 0 1px 1px oklch(0.4 0.02 262 / 0.04);
  --sh-md: 0 2px 4px oklch(0.4 0.02 262 / 0.05), 0 4px 12px oklch(0.4 0.02 262 / 0.06);
  --sh-lg: 0 8px 24px oklch(0.35 0.02 262 / 0.10), 0 2px 6px oklch(0.35 0.02 262 / 0.06);
  --sh-xl: 0 18px 48px oklch(0.3 0.02 262 / 0.16), 0 4px 12px oklch(0.3 0.02 262 / 0.08);

  --font: 'Hanken Grotesk', system-ui, -apple-system, sans-serif;
  --mono: 'JetBrains Mono', ui-monospace, monospace;

  --sidebar-w: 252px;
  --topbar-h: 60px;
}

* { box-sizing: border-box; }

html, body {
  margin: 0;
  padding: 0;
  height: 100%;
  font-family: var(--font);
  color: var(--text);
  background: var(--bg);
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}

#root { height: 100%; }

button { font-family: inherit; cursor: pointer; }
input, select, textarea { font-family: inherit; }

::selection { background: var(--accent-soft); }

/* Scrollbars */
*::-webkit-scrollbar { width: 10px; height: 10px; }
*::-webkit-scrollbar-thumb { background: oklch(0.86 0.01 262); border-radius: 99px; border: 3px solid transparent; background-clip: content-box; }
*::-webkit-scrollbar-thumb:hover { background: oklch(0.78 0.01 262); background-clip: content-box; }
*::-webkit-scrollbar-track { background: transparent; }

/* ---------- Typography helpers ---------- */
.num { font-family: var(--mono); font-feature-settings: "tnum" 1; letter-spacing: -0.01em; }
.h-display { font-size: 30px; font-weight: 800; letter-spacing: -0.02em; line-height: 1.08; }
.h-1 { font-size: 21px; font-weight: 700; letter-spacing: -0.015em; line-height: 1.25; }
.h-2 { font-size: 16px; font-weight: 700; letter-spacing: -0.01em; line-height: 1.3; }
.eyebrow { font-size: 11px; font-weight: 700; letter-spacing: 0.08em; text-transform: uppercase; color: var(--muted); }
.muted { color: var(--muted); }
.text-2 { color: var(--text-2); }

/* ---------- Buttons ---------- */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 7px;
  height: 38px; padding: 0 15px; border-radius: var(--r-sm);
  font-size: 13.5px; font-weight: 600; letter-spacing: -0.005em;
  border: 1px solid transparent; background: transparent; color: var(--text);
  transition: background .14s, border-color .14s, box-shadow .14s, transform .06s;
  white-space: nowrap; user-select: none;
}
.btn:active { transform: translateY(0.5px); }
.btn:disabled, .btn[disabled] { opacity: 0.45; cursor: not-allowed; }
.btn:disabled:hover, .btn[disabled]:hover { background: var(--accent); }
.btn svg { width: 16px; height: 16px; }
.btn-primary { background: var(--accent); color: var(--on-accent); box-shadow: var(--sh-sm); }
.btn-primary:hover { background: var(--accent-hover); }
.btn-ghost { color: var(--text-2); }
.btn-ghost:hover { background: var(--bg-2); color: var(--text); }
.btn-outline { border-color: var(--border-strong); background: var(--surface); color: var(--text); }
.btn-outline:hover { background: var(--bg-2); border-color: var(--muted); }
.btn-danger { background: var(--danger); color: #fff; }
.btn-danger:hover { filter: brightness(0.94); }
.btn-success { background: var(--success); color: #fff; }
.btn-success:hover { filter: brightness(0.94); }
.btn-sm { height: 31px; padding: 0 11px; font-size: 12.5px; border-radius: var(--r-xs); }
.btn-sm svg { width: 14px; height: 14px; }
.btn-icon { width: 38px; padding: 0; }
.btn-icon.btn-sm { width: 31px; }

/* ---------- Cards ---------- */
.card {
  background: var(--surface); border: 1px solid var(--border);
  border-radius: var(--r-lg); box-shadow: var(--sh-sm);
}
.card-pad { padding: 20px; }

/* ---------- Badges / chips ---------- */
.badge {
  display: inline-flex; align-items: center; gap: 5px;
  height: 22px; padding: 0 9px; border-radius: 99px;
  font-size: 11.5px; font-weight: 600; letter-spacing: -0.005em;
  background: var(--bg-2); color: var(--text-2); border: 1px solid var(--border);
}
.badge .dot { width: 6px; height: 6px; border-radius: 99px; background: currentColor; }
.badge-accent  { background: var(--accent-soft); color: var(--accent); border-color: transparent; }
.badge-success { background: var(--success-soft); color: var(--success); border-color: transparent; }
.badge-danger  { background: var(--danger-soft); color: var(--danger); border-color: transparent; }
.badge-warning { background: var(--warning-soft); color: oklch(0.5 0.12 70); border-color: transparent; }
.badge-info    { background: var(--info-soft); color: var(--info); border-color: transparent; }

/* ---------- Inputs ---------- */
.field { display: flex; flex-direction: column; gap: 6px; }
.field > label { font-size: 12px; font-weight: 600; color: var(--text-2); }
.input, .select, .textarea {
  height: 38px; padding: 0 12px; border-radius: var(--r-sm);
  border: 1px solid var(--border-strong); background: var(--surface); color: var(--text);
  font-size: 13.5px; transition: border-color .14s, box-shadow .14s; width: 100%;
}
.textarea { height: auto; padding: 10px 12px; resize: vertical; line-height: 1.5; }
.input:focus, .select:focus, .textarea:focus {
  outline: none; border-color: var(--accent); box-shadow: 0 0 0 3px var(--accent-ring);
}
.input::placeholder, .textarea::placeholder { color: var(--faint); }
.select { appearance: none; background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='16' height='16' viewBox='0 0 24 24' fill='none' stroke='%2371717a' stroke-width='2.2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpolyline points='6 9 12 15 18 9'/%3E%3C/svg%3E"); background-repeat: no-repeat; background-position: right 10px center; padding-right: 32px; }

/* ---------- Tables ---------- */
.table { width: 100%; border-collapse: collapse; }
.table th {
  text-align: left; font-size: 11px; font-weight: 700; letter-spacing: 0.05em;
  text-transform: uppercase; color: var(--muted); padding: 11px 14px;
  border-bottom: 1px solid var(--border); white-space: nowrap;
}
.table td { padding: 13px 14px; border-bottom: 1px solid var(--border); font-size: 13.5px; vertical-align: middle; }
.table tbody tr { transition: background .12s; }
.table tbody tr:hover { background: var(--accent-softer); }
.table tbody tr.clickable { cursor: pointer; }
.table tbody tr:last-child td { border-bottom: none; }

/* ---------- Avatar ---------- */
.avatar {
  display: inline-flex; align-items: center; justify-content: center;
  border-radius: 99px; background: var(--accent-soft); color: var(--accent);
  font-weight: 700; font-size: 12px; flex-shrink: 0; letter-spacing: -0.01em;
  width: 32px; height: 32px;
}

/* ---------- Progress ---------- */
.bar { height: 7px; border-radius: 99px; background: var(--bg-2); overflow: hidden; }
.bar > i { display: block; height: 100%; border-radius: 99px; background: var(--accent); transition: width .5s cubic-bezier(.4,0,.2,1); }

/* ---------- Utility ---------- */
.row { display: flex; align-items: center; }
.col { display: flex; flex-direction: column; }
.gap-2 { gap: 8px; } .gap-3 { gap: 12px; } .gap-4 { gap: 16px; } .gap-6 { gap: 24px; }
.between { justify-content: space-between; }
.wrap { flex-wrap: wrap; }
.grow { flex: 1; }
.divider { height: 1px; background: var(--border); border: none; margin: 0; }
.tnum { font-variant-numeric: tabular-nums; }

/* ---------- Animations ---------- */
@keyframes fadeUp { from { transform: translateY(7px); } to { transform: none; } }
@keyframes fadeIn { from { opacity: 0.4; } to { opacity: 1; } }
@keyframes pop { from { opacity: 0; transform: scale(0.97); } to { opacity: 1; transform: none; } }
.anim-up { animation: fadeUp .32s cubic-bezier(.4,0,.2,1) both; }
.anim-in { animation: fadeIn .25s ease both; }
.anim-pop { animation: pop .2s cubic-bezier(.4,0,.2,1) both; }

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: .001ms !important; transition-duration: .001ms !important; }
}
