/* ============================================================
   Serabi CRM — Design System
   Friendly & warm SaaS for Indonesian UMKM
   ============================================================ */

:root {
  /* Warm neutrals (paper-like) */
  --bg:          oklch(0.985 0.005 95);
  --bg-2:        oklch(0.968 0.006 95);
  --surface:     oklch(1 0 0);
  --surface-2:   oklch(0.992 0.004 120);
  --border:      oklch(0.915 0.006 130);
  --border-2:    oklch(0.86 0.01 135);
  --ink:         oklch(0.26 0.018 158);
  --ink-2:       oklch(0.46 0.014 155);
  --ink-3:       oklch(0.63 0.012 150);
  --ink-4:       oklch(0.74 0.01 150);

  /* Primary — friendly leaf green (WhatsApp family, original tone) */
  --green:       oklch(0.63 0.135 156);
  --green-600:   oklch(0.56 0.135 156);
  --green-700:   oklch(0.47 0.115 157);
  --green-800:   oklch(0.39 0.09 158);
  --green-soft:  oklch(0.955 0.028 156);
  --green-soft2: oklch(0.925 0.05 156);
  --green-ink:   oklch(0.42 0.1 157);

  /* Amber — AI / credits / warmth */
  --amber:       oklch(0.80 0.125 76);
  --amber-600:   oklch(0.70 0.13 65);
  --amber-700:   oklch(0.55 0.11 62);
  --amber-soft:  oklch(0.96 0.04 80);
  --amber-soft2: oklch(0.93 0.07 80);

  /* Red — escalation / danger */
  --red:         oklch(0.60 0.19 26);
  --red-600:     oklch(0.55 0.2 26);
  --red-soft:    oklch(0.955 0.028 26);
  --red-soft2:   oklch(0.92 0.05 26);

  /* Blue — info / read receipts */
  --blue:        oklch(0.60 0.13 240);
  --blue-soft:   oklch(0.955 0.025 240);

  /* Violet — secondary accent (broadcast) */
  --violet:      oklch(0.58 0.14 295);
  --violet-soft: oklch(0.955 0.025 295);

  --radius:   14px;
  --radius-sm: 10px;
  --radius-lg: 20px;
  --radius-xl: 26px;

  --shadow-xs: 0 1px 2px oklch(0.4 0.02 150 / 0.06);
  --shadow-sm: 0 1px 3px oklch(0.4 0.02 150 / 0.07), 0 1px 2px oklch(0.4 0.02 150 / 0.04);
  --shadow:    0 4px 14px oklch(0.4 0.03 150 / 0.08), 0 1px 3px oklch(0.4 0.02 150 / 0.05);
  --shadow-lg: 0 14px 40px oklch(0.35 0.03 150 / 0.13), 0 4px 12px oklch(0.35 0.02 150 / 0.07);
  --shadow-green: 0 8px 22px oklch(0.63 0.135 156 / 0.28);

  --font: "Plus Jakarta Sans", system-ui, -apple-system, sans-serif;
  --mono: "Space Grotesk", "JetBrains Mono", ui-monospace, monospace;

  --sidebar-w: 248px;
}

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

html, body { height: 100%; }

body {
  font-family: var(--font);
  background: var(--bg);
  color: var(--ink);
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
  font-size: 15px;
  line-height: 1.5;
}

#root { height: 100%; }

button, input, textarea, select { font-family: inherit; font-size: inherit; color: inherit; }
button { cursor: pointer; border: none; background: none; }
a { color: inherit; text-decoration: none; }
::selection { background: var(--green-soft2); }

::-webkit-scrollbar { width: 10px; height: 10px; }
::-webkit-scrollbar-thumb { background: oklch(0.85 0.01 150); border-radius: 99px; border: 3px solid transparent; background-clip: padding-box; }
::-webkit-scrollbar-thumb:hover { background: oklch(0.78 0.012 150); background-clip: padding-box; }
::-webkit-scrollbar-track { background: transparent; }

/* ---------- Typography helpers ---------- */
.h1 { font-size: 28px; font-weight: 800; letter-spacing: -0.02em; line-height: 1.15; }
.h2 { font-size: 21px; font-weight: 750; letter-spacing: -0.015em; line-height: 1.2; }
.h3 { font-size: 16px; font-weight: 700; letter-spacing: -0.01em; }
.eyebrow { font-size: 11.5px; font-weight: 700; letter-spacing: 0.08em; text-transform: uppercase; color: var(--ink-3); }
.muted { color: var(--ink-2); }
.faint { color: var(--ink-3); }
.mono { font-family: var(--mono); font-feature-settings: "tnum"; }
.tnum { font-variant-numeric: tabular-nums; }

/* ---------- Buttons ---------- */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  height: 42px; padding: 0 18px; border-radius: var(--radius-sm);
  font-weight: 650; font-size: 14.5px; letter-spacing: -0.01em;
  transition: transform .12s ease, background .15s ease, box-shadow .15s ease, border-color .15s ease;
  white-space: nowrap; user-select: none;
}
.btn:active { transform: translateY(1px); }
.btn svg { width: 18px; height: 18px; }
.btn-primary { background: var(--green-600); color: white; box-shadow: var(--shadow-green); }
.btn-primary:hover { background: var(--green-700); }
.btn-ghost { background: transparent; color: var(--ink); border: 1.5px solid var(--border-2); }
.btn-ghost:hover { background: var(--bg-2); border-color: var(--ink-4); }
.btn-soft { background: var(--green-soft); color: var(--green-ink); }
.btn-soft:hover { background: var(--green-soft2); }
.btn-amber { background: var(--amber-600); color: white; }
.btn-amber:hover { background: var(--amber-700); }
.btn-danger { background: var(--red); color: white; }
.btn-danger:hover { background: var(--red-600); }
.btn-white { background: var(--surface); color: var(--ink); border: 1.5px solid var(--border-2); box-shadow: var(--shadow-xs); }
.btn-white:hover { background: var(--bg-2); }
.btn-sm { height: 34px; padding: 0 13px; font-size: 13.5px; border-radius: 9px; }
.btn-sm svg { width: 16px; height: 16px; }
.btn-lg { height: 50px; padding: 0 24px; font-size: 16px; border-radius: var(--radius); }
.btn-block { width: 100%; }
.btn:disabled { opacity: .5; cursor: not-allowed; }
.btn-icon { width: 38px; height: 38px; padding: 0; border-radius: 10px; }
.btn-icon.btn-sm { width: 32px; height: 32px; }

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

/* ---------- Badges / pills ---------- */
.badge {
  display: inline-flex; align-items: center; gap: 5px;
  height: 23px; padding: 0 9px; border-radius: 99px;
  font-size: 12px; font-weight: 650; letter-spacing: -0.005em;
}
.badge svg { width: 13px; height: 13px; }
.badge-green { background: var(--green-soft); color: var(--green-ink); }
.badge-amber { background: var(--amber-soft2); color: var(--amber-700); }
.badge-red   { background: var(--red-soft2); color: var(--red-600); }
.badge-blue  { background: var(--blue-soft); color: var(--blue); }
.badge-violet{ background: var(--violet-soft); color: var(--violet); }
.badge-gray  { background: var(--bg-2); color: var(--ink-2); border: 1px solid var(--border); }

.dot { width: 8px; height: 8px; border-radius: 99px; flex: none; }
.dot-green { background: var(--green); box-shadow: 0 0 0 3px var(--green-soft); }
.dot-amber { background: var(--amber-600); box-shadow: 0 0 0 3px var(--amber-soft); }
.dot-red   { background: var(--red); box-shadow: 0 0 0 3px var(--red-soft); }
.dot-gray  { background: var(--ink-4); }

@keyframes pulse-dot { 0%,100%{ opacity:1 } 50%{ opacity:.35 } }
.dot-pulse { animation: pulse-dot 1.6s ease-in-out infinite; }

/* ---------- Inputs ---------- */
.field { display: flex; flex-direction: column; gap: 7px; }
.label { font-size: 13px; font-weight: 650; color: var(--ink-2); letter-spacing: -0.005em; }
.input, .textarea, .select {
  width: 100%; height: 46px; padding: 0 14px;
  background: var(--surface); border: 1.5px solid var(--border-2);
  border-radius: var(--radius-sm); color: var(--ink);
  transition: border-color .15s ease, box-shadow .15s ease; outline: none;
}
.textarea { height: auto; padding: 12px 14px; resize: vertical; line-height: 1.55; }
.input:focus, .textarea:focus, .select:focus {
  border-color: var(--green); box-shadow: 0 0 0 4px var(--green-soft);
}
.input::placeholder, .textarea::placeholder { color: var(--ink-4); }
.input-group { position: relative; }
.input-group .input { padding-left: 44px; }
.input-group .lead-icon { position: absolute; left: 14px; top: 50%; transform: translateY(-50%); color: var(--ink-3); width: 18px; height: 18px; }

/* ---------- Toggle switch ---------- */
.switch { position: relative; width: 44px; height: 26px; border-radius: 99px; background: var(--border-2); transition: background .2s ease; flex: none; }
.switch::after { content: ""; position: absolute; top: 3px; left: 3px; width: 20px; height: 20px; border-radius: 99px; background: white; box-shadow: var(--shadow-sm); transition: transform .2s cubic-bezier(.4,1.3,.5,1); }
.switch.on { background: var(--green); }
.switch.on::after { transform: translateX(18px); }
.switch.sm { width: 36px; height: 21px; }
.switch.sm::after { width: 16px; height: 16px; }
.switch.sm.on::after { transform: translateX(15px); }
.switch.amber.on { background: var(--amber-600); }

/* ---------- Avatar ---------- */
.avatar {
  display: inline-flex; align-items: center; justify-content: center;
  border-radius: 99px; font-weight: 700; color: white; flex: none;
  background: var(--green-600); font-size: 14px; overflow: hidden;
}

/* ---------- Layout primitives ---------- */
.row { display: flex; align-items: center; gap: 10px; }
.col { display: flex; flex-direction: column; }
.between { display: flex; align-items: center; justify-content: space-between; gap: 12px; }
.wrap { flex-wrap: wrap; }
.grow { flex: 1; min-width: 0; }
.center { display: flex; align-items: center; justify-content: center; }

/* ---------- Scrim / modal ---------- */
.scrim { position: fixed; inset: 0; background: oklch(0.25 0.02 150 / 0.42); backdrop-filter: blur(3px); z-index: 80; display: flex; align-items: center; justify-content: center; padding: 24px; animation: fade .18s ease; }
@keyframes fade { from { opacity: 0; } }
@keyframes pop { from { opacity: 0; transform: translateY(10px) scale(.98); } }
.modal { background: var(--surface); border-radius: var(--radius-lg); box-shadow: var(--shadow-lg); width: 100%; max-width: 480px; animation: pop .22s cubic-bezier(.2,.8,.3,1); }

/* ---------- Toast ---------- */
.toast-wrap { position: fixed; bottom: 22px; left: 50%; transform: translateX(-50%); z-index: 120; display: flex; flex-direction: column; gap: 10px; align-items: center; }
.toast { display: flex; align-items: center; gap: 10px; background: var(--ink); color: white; padding: 11px 16px; border-radius: 12px; box-shadow: var(--shadow-lg); font-size: 14px; font-weight: 550; animation: pop .2s ease; }
.toast svg { width: 18px; height: 18px; }
.toast .t-ok { color: oklch(0.8 0.13 156); }

/* ---------- Misc ---------- */
.divider { height: 1px; background: var(--border); }
.kbd { font-family: var(--mono); font-size: 12px; background: var(--bg-2); border: 1px solid var(--border); border-radius: 6px; padding: 1px 6px; color: var(--ink-2); }

.fade-in { animation: riseIn .25s ease; }
.slide-up { animation: riseIn .3s cubic-bezier(.2,.8,.3,1); }
@keyframes riseIn { from { transform: translateY(8px); } to { transform: none; } }

@keyframes spin { to { transform: rotate(360deg); } }
.spin { animation: spin 1s linear infinite; }

/* stripe placeholder for imagery */
.placeholder {
  background:
    repeating-linear-gradient(135deg, oklch(0.93 0.01 150) 0 10px, oklch(0.96 0.008 150) 10px 20px);
  border: 1px dashed var(--border-2);
  border-radius: var(--radius-sm);
  display: flex; align-items: center; justify-content: center;
  color: var(--ink-3); font-family: var(--mono); font-size: 12px; letter-spacing: 0.02em;
}
