/* WhatsApp Campaign CRM — design tokens & shared UI */
/* Dark-first console theme (matches the Namaha Admin reference: near-black
   surfaces, orange primary accent, thin icon-only rail, dense stat cards). */

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

:root {
  --bg: #09090b;
  --bg-alt: #0f0f12;
  --surface: #131316;
  --surface-2: #1b1b20;
  --card: #131316;
  --border: rgba(255,255,255,0.09);
  --border-soft: rgba(255,255,255,0.055);
  --ink: #f4f4f5;
  --ink-dim: #9a9aa3;
  --ink-ghost: #63636b;

  --accent: #f97316;
  --accent-2: #ea670a;
  --accent-dim: #c2560a;
  --accent-soft: rgba(249,115,22,0.14);
  --signal: #eab308;
  --growth: #22c55e;
  --fire: #f43f5e;
  --info: #3b82f6;
  --purple: #a78bfa;

  --rail-bg: #0c0c0e;

  --gradient-accent: linear-gradient(135deg, #fb923c 0%, #ea670a 100%);
  --gradient-hero: radial-gradient(60% 100% at 30% 0%, rgba(249,115,22,.14) 0%, transparent 60%), radial-gradient(50% 80% at 85% 20%, rgba(59,130,246,.08) 0%, transparent 60%);

  --radius-sm: 8px;
  --radius: 14px;
  --radius-lg: 18px;

  --shadow-sm: 0 1px 3px rgba(0,0,0,.4);
  --shadow-md: 0 8px 24px rgba(0,0,0,.35);
  --shadow-lg: 0 20px 48px rgba(0,0,0,.5);
  --shadow-glow: 0 0 0 1px rgba(249,115,22,.25), 0 8px 24px rgba(249,115,22,.18);
}

:root[data-theme="light"] {
  --bg: #f5f6fa;
  --bg-alt: #ffffff;
  --surface: #ffffff;
  --surface-2: #f2f3f7;
  --card: #ffffff;
  --border: rgba(20,22,31,0.14);
  --border-soft: rgba(20,22,31,0.08);
  --ink: #14161f;
  --ink-dim: #5b6072;
  --ink-ghost: #8b8fa3;

  --accent: #ea670a;
  --accent-2: #c2560a;
  --accent-dim: #9c4608;
  --accent-soft: rgba(234,103,10,0.10);
  --signal: #d97706;
  --growth: #16a34a;
  --fire: #dc2626;
  --info: #3b82f6;
  --purple: #7c5cf0;

  --rail-bg: var(--surface);

  --gradient-accent: linear-gradient(135deg, #fb923c 0%, #c2560a 100%);
  --gradient-hero: radial-gradient(60% 100% at 30% 0%, rgba(234,103,10,.12) 0%, transparent 60%), radial-gradient(50% 80% at 85% 20%, rgba(59,130,246,.10) 0%, transparent 60%);

  --shadow-sm: 0 1px 2px rgba(20,22,31,0.06);
  --shadow-md: 0 8px 22px rgba(20,22,31,0.08);
  --shadow-lg: 0 20px 46px rgba(20,22,31,0.14);
  --shadow-glow: 0 0 0 1px rgba(234,103,10,.18), 0 8px 20px rgba(234,103,10,.14);
}

* { box-sizing: border-box; }
html, body { margin: 0; padding: 0; }
html { color-scheme: dark; }
:root[data-theme="light"] { color-scheme: light; }
body {
  background: var(--bg);
  color: var(--ink);
  font-family: 'Inter', -apple-system, BlinkMacSystemFont, sans-serif;
  font-size: 13.5px;
  line-height: 1.55;
  -webkit-font-smoothing: antialiased;
  transition: background-color .2s ease, color .2s ease;
  overflow-x: hidden;
}
code, .mono { font-family: 'JetBrains Mono', ui-monospace, monospace; }
h1, h2, h3, h4 { font-family: 'Inter', -apple-system, BlinkMacSystemFont, sans-serif; font-weight: 700; margin: 0 0 8px; color: var(--ink); letter-spacing: -.01em; }
p { margin: 0 0 8px; color: var(--ink-dim); }
a { color: var(--accent); text-decoration: none; transition: color .15s ease; }
a:hover { color: var(--accent-2); }
::selection { background: var(--accent); color: #fff; }

::-webkit-scrollbar { width: 10px; height: 10px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: var(--border); border-radius: 99px; border: 2px solid var(--bg); }
::-webkit-scrollbar-thumb:hover { background: var(--ink-ghost); }

:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }

/* ─── Layout utilities ──────────────────────────────────────────────────── */
.flex { display: flex; }
.items-center { align-items: center; }
.justify-between { justify-content: space-between; }
.justify-center { justify-content: center; }
.gap-8 { gap: 8px; }
.gap-12 { gap: 12px; }
.gap-16 { gap: 16px; }
.w-full { width: 100%; }
.mb-16 { margin-bottom: 16px; }
.container { max-width: 1120px; margin: 0 auto; padding: 0 24px; }

/* ─── Buttons ───────────────────────────────────────────────────────────── */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 6px;
  padding: 10px 18px; border-radius: var(--radius-sm); border: 1px solid transparent;
  font-size: 14px; font-weight: 600; cursor: pointer; transition: all .15s ease;
  text-decoration: none;
}
.btn-primary { background: var(--accent); color: #fff; box-shadow: var(--shadow-sm); }
.btn-primary:hover { color: #fff; background: var(--accent-dim); box-shadow: var(--shadow-glow); transform: translateY(-1px); }
.btn-signal { background: var(--signal); color: #1c0f04; font-weight: 700; }
.btn-signal:hover { filter: brightness(1.08); transform: translateY(-1px); }
.btn-ghost { background: var(--surface); color: var(--ink); border-color: var(--border); }
.btn-ghost:hover { background: var(--surface-2); border-color: var(--accent); color: var(--ink); }
.btn-danger { background: var(--fire); color: #fff; }
.btn-danger:hover { filter: brightness(1.08); }
.btn-sm { padding: 6px 12px; font-size: 12px; }
.btn-lg { padding: 13px 26px; font-size: 15px; }
.btn:disabled { opacity: .5; cursor: not-allowed; transform: none !important; box-shadow: none !important; }

/* ─── Theme toggle ──────────────────────────────────────────────────────── */
.theme-toggle {
  display: inline-flex; align-items: center; justify-content: center;
  width: 36px; height: 36px; border-radius: 999px; border: 2px solid var(--bg-alt);
  background: var(--gradient-accent); color: #fff; cursor: pointer; transition: all .15s ease;
  flex-shrink: 0;
  box-shadow: 0 4px 12px rgba(249,115,22,0.35);
}
.theme-toggle:hover { transform: translateY(-1px) scale(1.05); box-shadow: 0 6px 16px rgba(249,115,22,0.45); }
.theme-toggle .icon-moon { display: none; }
:root[data-theme="light"] .theme-toggle .icon-sun { display: none; }
:root[data-theme="light"] .theme-toggle .icon-moon { display: block; }
.theme-toggle-fixed {
  position: fixed; bottom: 22px; right: 22px; z-index: 999;
  width: 50px; height: 50px;
}

/* ─── Icon rail (primary nav strip, collapsible to a labeled panel) ─────── */
.icon-rail { width: 56px; flex-shrink: 0; background: var(--rail-bg); border-right: 1px solid var(--border-soft); display: flex; flex-direction: column; align-items: center; padding: 14px 8px; gap: 2px; min-height: 100vh; position: sticky; top: 0; transition: width .16s ease; }
.icon-rail.expanded { width: 202px; align-items: stretch; }
.icon-rail .theme-toggle { border-color: var(--bg-alt); width: 30px; height: 30px; }
.icon-rail.expanded .theme-toggle { align-self: center; }
.rail-logo { width: 32px; height: 32px; border-radius: 9px; background: var(--gradient-accent); display: flex; align-items: center; justify-content: center; color: #fff; font-family: 'Inter', sans-serif; font-weight: 800; font-size: 14px; margin-bottom: 10px; text-decoration: none; flex-shrink: 0; box-shadow: var(--shadow-sm); }
.icon-rail.expanded .rail-logo { align-self: flex-start; }
.rail-expand-btn {
  display: flex; align-items: center; justify-content: center; width: 34px; height: 26px; margin-bottom: 10px;
  border-radius: 7px; border: 1px solid var(--border); background: var(--surface); color: var(--ink-ghost);
  cursor: pointer; transition: all .15s ease; flex-shrink: 0; align-self: flex-start;
}
.rail-expand-btn:hover { color: var(--ink); border-color: var(--ink-ghost); }
.rail-expand-btn svg { transition: transform .16s ease; }
.icon-rail.expanded .rail-expand-btn svg { transform: rotate(180deg); }
.rail-link { position: relative; width: 34px; height: 34px; border-radius: 9px; display: flex; align-items: center; justify-content: center; gap: 10px; color: var(--ink-ghost); margin-bottom: 2px; transition: all .15s ease; text-decoration: none; flex-shrink: 0; overflow: hidden; }
.rail-link:hover { background: var(--surface-2); color: var(--ink); }
.rail-link.active { background: var(--accent-soft); color: var(--accent); }
.rail-link svg { flex-shrink: 0; }
.rail-link-label { display: none; font-size: 13px; font-weight: 600; white-space: nowrap; }
.icon-rail.expanded .rail-link { width: 100%; justify-content: flex-start; padding: 0 8px; }
.icon-rail.expanded .rail-link-label { display: inline; }
.rail-link[title]:hover::after {
  content: attr(title); position: absolute; left: calc(100% + 10px); top: 50%; transform: translateY(-50%);
  background: #000; color: #fff; font-size: 11px; font-weight: 600; padding: 5px 9px; border-radius: 6px;
  white-space: nowrap; z-index: 200; pointer-events: none; box-shadow: var(--shadow-md);
}
.icon-rail.expanded .rail-link[title]:hover::after { display: none; }
.rail-spacer { flex: 1; }
.rail-avatar { width: 28px; height: 28px; border-radius: 50%; background: var(--gradient-accent); color: #fff; display: flex; align-items: center; justify-content: center; font-size: 11px; font-weight: 700; flex-shrink: 0; margin-top: 6px; }
.icon-rail.expanded .rail-avatar { align-self: flex-start; }

/* ─── Forms ─────────────────────────────────────────────────────────────── */
.form-row { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; }
.form-group { margin-bottom: 14px; }
.form-label { display: block; font-size: 12px; font-weight: 600; color: var(--ink-dim); margin-bottom: 6px; text-transform: uppercase; letter-spacing: .03em; }
.form-label.required::after { content: ' *'; color: var(--fire); }
.form-input, .form-select, .form-textarea {
  width: 100%; padding: 10px 12px; border-radius: var(--radius-sm); border: 1px solid var(--border);
  background: var(--surface); color: var(--ink); font-size: 14px; font-family: inherit;
  transition: border-color .15s ease, box-shadow .15s ease;
}
.form-input:focus, .form-select:focus, .form-textarea:focus { outline: none; border-color: var(--accent); box-shadow: 0 0 0 3px var(--accent-soft); }
.form-textarea { resize: vertical; min-height: 90px; }
.form-hint { font-size: 12px; color: var(--ink-ghost); margin-top: 4px; }

/* ─── Alerts / badges ───────────────────────────────────────────────────── */
.alert { padding: 12px 14px; border-radius: var(--radius-sm); margin-bottom: 14px; font-size: 13px; }
.alert-error { background: rgba(220,38,38,.1); color: var(--fire); border: 1px solid rgba(220,38,38,.28); }
.alert-success { background: rgba(22,163,74,.1); color: var(--growth); border: 1px solid rgba(22,163,74,.28); }
.alert-info { background: rgba(59,130,246,.1); color: var(--info); border: 1px solid rgba(59,130,246,.28); }

.badge { display: inline-block; padding: 3px 10px; border-radius: 999px; font-size: 11px; font-weight: 700; text-transform: uppercase; letter-spacing: .04em; }
.badge-accent { background: var(--accent-soft); color: var(--accent); }
.badge-signal { background: rgba(217,119,6,.15); color: var(--signal); }
.badge-growth { background: rgba(22,163,74,.15); color: var(--growth); }
.badge-fire { background: rgba(220,38,38,.15); color: var(--fire); }
.badge-info { background: rgba(59,130,246,.15); color: var(--info); }
.badge-ghost { background: rgba(110,110,123,.15); color: var(--ink-ghost); }
.badge-purple { background: rgba(167,139,250,.15); color: var(--purple); }

/* ─── Auth pages ────────────────────────────────────────────────────────── */
.auth-page { min-height: 100vh; display: flex; align-items: center; justify-content: center; padding: 24px; position: relative; overflow: hidden; background: var(--bg); }
.auth-page::before { content: ''; position: absolute; inset: 0; z-index: 0; pointer-events: none; background: var(--gradient-hero); }
.auth-card { position: relative; z-index: 1; width: 100%; max-width: 420px; background: var(--card); border: 1px solid var(--border); border-radius: var(--radius-lg); padding: 32px; box-shadow: var(--shadow-lg); }
.auth-logo { text-align: center; margin-bottom: 24px; }
.logo-mark { width: 40px; height: 40px; background: var(--gradient-accent); border-radius: var(--radius-sm); display: flex; align-items: center; justify-content: center; font-family: 'Inter', sans-serif; font-weight: 800; font-size: 18px; color: #fff; margin: 0 auto 12px; box-shadow: var(--shadow-sm); }

/* ─── Landing page ──────────────────────────────────────────────────────── */
.landing { position: relative; background: var(--bg); }
.landing-nav {
  display: flex; align-items: center; justify-content: space-between; padding: 18px 24px;
  border-bottom: 1px solid var(--border-soft); position: sticky; top: 0; z-index: 40;
  background: color-mix(in srgb, var(--bg) 80%, transparent); backdrop-filter: blur(14px); -webkit-backdrop-filter: blur(14px);
}
.hero { text-align: center; padding: 96px 24px 40px; max-width: 780px; margin: 0 auto; position: relative; }
.hero-banner { position: relative; z-index: 1; }
.hero::before { content: ''; position: absolute; top: -80px; left: 50%; transform: translateX(-50%); z-index: 0; width: 1000px; max-width: 140vw; height: 560px; pointer-events: none; background: var(--gradient-hero); }
.hero h1 { font-size: 50px; line-height: 1.12; position: relative; }
.hero h1 span { background: var(--gradient-accent); -webkit-background-clip: text; background-clip: text; color: transparent; }
.hero > .hero-banner > p, .hero > p { font-size: 17px; max-width: 620px; margin: 0 auto 8px; position: relative; }
.features-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(260px, 1fr)); gap: 20px; padding: 0 24px; max-width: 1120px; margin: 0 auto; }
.feature-card { background: var(--card); border: 1px solid var(--border); border-radius: var(--radius); padding: 22px; transition: transform .18s ease, border-color .18s ease, box-shadow .18s ease; }
.feature-card:hover { transform: translateY(-3px); border-color: var(--accent); box-shadow: var(--shadow-md); }
.feature-icon { width: 36px; height: 36px; border-radius: var(--radius-sm); background: var(--accent-soft); display: flex; align-items: center; justify-content: center; margin-bottom: 12px; }
.pricing-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(240px, 1fr)); gap: 20px; padding: 0 24px; max-width: 1000px; margin: 0 auto; }
.pricing-card { background: var(--card); border: 1px solid var(--border); border-radius: var(--radius-lg); padding: 26px; text-align: center; position: relative; transition: transform .18s ease, box-shadow .18s ease; }
.pricing-card:hover { transform: translateY(-3px); box-shadow: var(--shadow-md); }
.pricing-card.featured { border-color: var(--accent); box-shadow: var(--shadow-glow); }
.pricing-badge { position: absolute; top: -12px; left: 50%; transform: translateX(-50%); background: var(--gradient-accent); color: #fff; font-size: 11px; font-weight: 700; padding: 4px 14px; border-radius: 999px; box-shadow: var(--shadow-sm); }
.pricing-name { font-family: 'Inter', sans-serif; font-weight: 800; font-size: 20px; }
.pricing-price { font-size: 34px; font-weight: 700; margin: 10px 0; }
.pricing-price span { font-size: 14px; color: var(--ink-ghost); font-weight: 400; }
.pricing-features { text-align: left; margin: 16px 0; }
.pricing-feature { padding: 6px 0; border-bottom: 1px solid var(--border-soft); font-size: 13px; color: var(--ink-dim); }

/* ─── Modal ─────────────────────────────────────────────────────────────── */
.modal-overlay { display: none; position: fixed; inset: 0; background: rgba(15,17,24,.5); backdrop-filter: blur(4px); align-items: center; justify-content: center; z-index: 100; }
:root[data-theme="dark"] .modal-overlay { background: rgba(4,4,6,.7); }
.modal-overlay.open { display: flex; }
.modal { background: var(--card); border: 1px solid var(--border); border-radius: var(--radius-lg); width: 100%; box-shadow: var(--shadow-lg); }
.modal-header { display: flex; align-items: center; justify-content: space-between; padding: 18px 22px; border-bottom: 1px solid var(--border); }
.modal-close { background: none; border: none; color: var(--ink-ghost); cursor: pointer; }
.modal-close:hover { color: var(--ink); }
.modal-body { padding: 22px; }

/* ─── App shell ─────────────────────────────────────────────────────────── */
.app-shell { display: flex; min-height: 100vh; background: var(--bg); }
.sidebar { width: 240px; background: var(--surface); border-right: 1px solid var(--border-soft); padding: 20px 12px; flex-shrink: 0; display: flex; flex-direction: column; }
.sidebar a { display: block; padding: 9px 12px; border-radius: var(--radius-sm); color: var(--ink-dim); font-size: 13px; font-weight: 500; margin-bottom: 2px; position: relative; transition: all .15s ease; }
.sidebar a:hover { background: var(--surface-2); color: var(--ink); }
.sidebar a.active { background: var(--accent-soft); color: var(--accent); font-weight: 600; box-shadow: inset 3px 0 0 var(--accent); }
.sidebar-foot { margin-top: auto; padding-top: 16px; border-top: 1px solid var(--border-soft); }
.main { flex: 1; min-width: 0; padding: 28px 32px; max-width: 1180px; }
.topbar { display: flex; align-items: center; justify-content: space-between; margin-bottom: 24px; }

/* ─── Cards ─────────────────────────────────────────────────────────────── */
.card { background: var(--card); border: 1px solid var(--border); border-radius: var(--radius); padding: 22px; margin-bottom: 18px; min-width: 0; box-shadow: var(--shadow-sm); }

/* ─── Console page header ───────────────────────────────────────────────── */
.page-head { display: flex; align-items: center; justify-content: space-between; margin-bottom: 18px; }
.page-head h1 { font-size: 22px; margin: 0; }
.live-dot { width: 8px; height: 8px; border-radius: 50%; background: var(--growth); display: inline-block; box-shadow: 0 0 0 3px rgba(34,197,94,.18); }

/* ─── Segmented tabs (Overview / All Campaigns style) ──────────────────── */
.seg-tabs { display: inline-flex; gap: 4px; background: var(--surface); border: 1px solid var(--border); padding: 4px; border-radius: 12px; margin-bottom: 18px; }
.seg-tab { display: inline-flex; align-items: center; gap: 7px; background: transparent; border: none; color: var(--ink-dim); font-size: 13px; font-weight: 600; padding: 8px 16px; border-radius: 9px; cursor: pointer; transition: all .15s ease; text-decoration: none; }
.seg-tab:hover { color: var(--ink); }
.seg-tab.active { background: var(--accent-soft); color: var(--accent); }
.seg-tab .count { background: var(--surface-2); color: var(--ink-ghost); font-size: 11px; font-weight: 700; padding: 1px 7px; border-radius: 999px; }
.seg-tab.active .count { background: var(--accent); color: #fff; }

/* ─── Compact metric strip (thin row of plain numbers, no card chrome) ──── */
.metric-strip { display: flex; background: var(--card); border: 1px solid var(--border); border-radius: var(--radius); overflow: hidden; margin-bottom: 18px; }
.metric-strip-item { flex: 1; padding: 16px 18px; text-align: center; border-right: 1px solid var(--border-soft); }
.metric-strip-item:last-child { border-right: none; }
.metric-strip-val { font-size: 24px; font-weight: 800; line-height: 1.1; font-family: 'JetBrains Mono', ui-monospace, monospace; }
.metric-strip-label { font-size: 10.5px; color: var(--ink-ghost); text-transform: uppercase; letter-spacing: .05em; margin-top: 5px; }
@media (max-width: 900px) { .metric-strip { flex-wrap: wrap; } .metric-strip-item { flex: 1 1 33%; border-bottom: 1px solid var(--border-soft); } }

/* ─── Filter pill row ────────────────────────────────────────────────────── */
.filter-row { display: flex; gap: 8px; flex-wrap: wrap; margin-bottom: 18px; }
.filter-pill {
  display: inline-flex; align-items: center; gap: 7px; padding: 8px 14px; border-radius: 999px;
  border: 1px solid var(--border); background: var(--surface); color: var(--ink-dim); font-size: 12.5px;
  font-weight: 600; cursor: pointer; transition: all .15s ease; text-decoration: none; white-space: nowrap;
}
.filter-pill:hover { color: var(--ink); border-color: var(--ink-ghost); }
.filter-pill.active { background: var(--accent); border-color: var(--accent); color: #fff; }
.filter-pill .count { background: rgba(255,255,255,.15); border-radius: 999px; padding: 1px 7px; font-size: 10.5px; }
.filter-pill:not(.active) .count { background: var(--surface-2); color: var(--ink-ghost); }

/* ─── Accent stat cards (colored left border + progress bar) ────────────── */
.stat-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(230px, 1fr)); gap: 14px; margin-bottom: 18px; }
.stat-card {
  background: var(--card); border: 1px solid var(--border); border-left: 3px solid var(--stat-color, var(--accent));
  border-radius: var(--radius); padding: 18px 20px; position: relative;
}
.stat-card-top { display: flex; align-items: flex-start; justify-content: space-between; }
.stat-card-icon { color: var(--stat-color, var(--accent)); opacity: .55; }
.stat-card-val { font-size: 30px; font-weight: 800; line-height: 1; color: var(--stat-color, var(--ink)); font-family: 'JetBrains Mono', ui-monospace, monospace; }
.stat-card-label { font-size: 13px; color: var(--ink); font-weight: 600; margin-top: 8px; }
.stat-card-bar { height: 4px; border-radius: 999px; background: var(--surface-2); margin-top: 12px; overflow: hidden; }
.stat-card-bar-fill { height: 100%; background: var(--stat-color, var(--accent)); border-radius: 999px; }
.stat-card-sub { font-size: 11px; color: var(--ink-ghost); margin-top: 6px; }

/* ─── Avatars & tag pills (contacts/tables) ─────────────────────────────── */
.avatar-circle { width: 34px; height: 34px; border-radius: 50%; display: flex; align-items: center; justify-content: center; font-size: 12px; font-weight: 700; flex-shrink: 0; background: var(--accent-soft); color: var(--accent); border: 1px solid rgba(249,115,22,.25); }
.tag-pill { display: inline-block; padding: 2px 9px; border-radius: 999px; font-size: 10.5px; font-weight: 700; background: rgba(34,197,94,.12); color: var(--growth); border: 1px solid rgba(34,197,94,.25); margin: 1px 3px 1px 0; }

/* ─── Dense dark data table ──────────────────────────────────────────────── */
.data-table-wrap { background: var(--card); border: 1px solid var(--border); border-radius: var(--radius); overflow: hidden; }
.data-table { width: 100%; border-collapse: collapse; font-size: 13px; }
.data-table thead th { text-align: left; padding: 12px 16px; font-size: 10.5px; text-transform: uppercase; letter-spacing: .05em; color: var(--ink-ghost); font-weight: 700; background: var(--surface); border-bottom: 1px solid var(--border); }
.data-table tbody td { padding: 13px 16px; border-bottom: 1px solid var(--border-soft); vertical-align: middle; color: var(--ink-dim); }
.data-table tbody tr:last-child td { border-bottom: none; }
.data-table tbody tr:hover td { background: var(--surface); }
.data-table .primary { color: var(--ink); font-weight: 600; }
.data-table .mono { font-family: 'JetBrains Mono', ui-monospace, monospace; font-size: 12px; }

/* ─── Spinner ───────────────────────────────────────────────────────────── */
.spinner { width: 16px; height: 16px; border: 2px solid rgba(255,255,255,.3); border-top-color: #fff; border-radius: 50%; animation: spin .6s linear infinite; display: inline-block; }
@keyframes spin { to { transform: rotate(360deg); } }

/* ─── Admin analytics dashboard ─────────────────────────────────────────── */
.kpi-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(170px, 1fr)); gap: 14px; margin-bottom: 20px; }
.kpi { background: var(--card); border: 1px solid var(--border); border-left: 3px solid var(--kpi-accent, var(--accent)); border-radius: var(--radius); padding: 16px; min-width: 0; box-shadow: var(--shadow-sm); transition: transform .15s ease; }
.kpi:hover { transform: translateY(-2px); }
.kpi-label { font-size: 11px; color: var(--ink-ghost); text-transform: uppercase; letter-spacing: .03em; margin-bottom: 6px; }
.kpi-val { font-size: 26px; font-weight: 700; color: var(--ink); line-height: 1; }
.kpi-val.sm { font-size: 21px; }
.kpi-sub { margin-top: 8px; font-size: 11px; color: var(--ink-ghost); display: flex; gap: 6px; flex-wrap: wrap; align-items: center; }
.badge-up { color: var(--growth); font-weight: 700; }
.badge-down { color: var(--fire); font-weight: 700; }
.badge-neutral { color: var(--ink-ghost); }

.panel { background: var(--card); border: 1px solid var(--border); border-radius: var(--radius); padding: 18px; margin-bottom: 18px; min-width: 0; box-shadow: var(--shadow-sm); }
.panel-head { display: flex; align-items: center; justify-content: space-between; margin-bottom: 14px; }
.panel-title { font-size: 13px; font-weight: 700; color: var(--ink); text-transform: uppercase; letter-spacing: .03em; }
.panel-badge { font-size: 11px; color: var(--ink-ghost); }
.panel-link { font-size: 12px; color: var(--accent); }
.db-row { display: grid; gap: 18px; }
.db-row-2b { grid-template-columns: 2fr 1fr; }
.db-row-3 { grid-template-columns: repeat(3, 1fr); }
.db-row-equal { grid-template-columns: 1fr 1fr; }

.chart-tabs { display: flex; gap: 3px; background: var(--surface-2); padding: 3px; border-radius: 999px; border: 1px solid var(--border-soft); }
.ctab { background: transparent; border: none; color: var(--ink-dim); font-size: 11px; font-weight: 600; padding: 5px 12px; border-radius: 999px; cursor: pointer; transition: all .15s ease; }
.ctab.active { background: var(--accent); color: #fff; }

.funnel-row { display: flex; align-items: center; gap: 10px; margin-bottom: 10px; }
.funnel-label { width: 100px; font-size: 12px; color: var(--ink-dim); flex-shrink: 0; }
.funnel-track { flex: 1; background: var(--surface-2); border-radius: 6px; overflow: hidden; height: 22px; }
.funnel-fill { height: 100%; display: flex; align-items: center; padding-left: 8px; font-size: 11px; font-weight: 700; color: #fff; border-radius: 6px; }
.funnel-pct { width: 36px; text-align: right; font-size: 11px; color: var(--ink-ghost); }

.plan-legend { margin-top: 12px; }
.pl-row { display: flex; align-items: center; gap: 8px; padding: 4px 0; font-size: 12px; }
.pl-dot { width: 9px; height: 9px; border-radius: 50%; }
.pl-label { flex: 1; color: var(--ink-dim); }
.pl-val { color: var(--ink); font-weight: 600; }

.mini-table { width: 100%; border-collapse: collapse; font-size: 12px; }
.mini-table th { text-align: left; color: var(--ink-ghost); font-weight: 600; padding: 6px 8px; border-bottom: 1px solid var(--border); }
.mini-table td { padding: 8px; border-bottom: 1px solid var(--border-soft); }

.status-dot { width: 7px; height: 7px; border-radius: 50%; display: inline-block; margin-right: 4px; }
.status-dot.sd-active { background: var(--growth); }
.status-dot.sd-trial { background: var(--signal); }
.status-dot.sd-suspended { background: var(--fire); }
.status-dot.sd-cancelled { background: var(--ink-ghost); }

.plan-chip { padding: 2px 8px; border-radius: 999px; font-size: 10px; font-weight: 700; background: var(--accent-soft); color: var(--accent); }

.pay-row { display: flex; align-items: center; gap: 12px; padding: 9px 0; border-bottom: 1px solid var(--border-soft); }
.pay-row:last-child { border-bottom: none; }
.pay-avatar { width: 32px; height: 32px; border-radius: 50%; background: var(--gradient-accent); color: #fff; display: flex; align-items: center; justify-content: center; font-size: 11px; font-weight: 700; flex-shrink: 0; }
.pay-info { flex: 1; min-width: 0; }
.pay-name { font-size: 12px; color: var(--ink); font-weight: 600; }
.pay-email { font-size: 11px; color: var(--ink-ghost); }
.pay-amount { font-size: 13px; font-weight: 700; color: var(--growth); text-align: right; }
.pay-date { font-size: 10px; color: var(--ink-ghost); text-align: right; }

/* ─── WhatsApp inbox (two-pane) ─────────────────────────────────────────── */
.wa-split { display: flex; height: calc(100vh - 140px); min-height: 420px; border: 1px solid var(--border); border-radius: var(--radius); overflow: hidden; background: var(--card); }
.wa-list { width: 300px; flex-shrink: 0; border-right: 1px solid var(--border-soft); overflow-y: auto; }
.wa-list-item { display: block; padding: 12px 14px; border-bottom: 1px solid var(--border-soft); cursor: pointer; text-decoration: none; color: inherit; }
.wa-list-item:hover, .wa-list-item.active { background: var(--surface-2); }
.wa-list-name { font-size: 13px; font-weight: 600; color: var(--ink); display: flex; justify-content: space-between; gap: 6px; }
.wa-list-preview { font-size: 12px; color: var(--ink-ghost); margin-top: 2px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.wa-thread { flex: 1; display: flex; flex-direction: column; min-width: 0; }
.wa-thread-body { flex: 1; overflow-y: auto; padding: 16px; display: flex; flex-direction: column; gap: 8px; }
.wa-bubble { max-width: 70%; padding: 8px 12px; border-radius: 12px; font-size: 13px; line-height: 1.4; }
.wa-bubble.inbound { align-self: flex-start; background: var(--surface-2); color: var(--ink); }
.wa-bubble.outbound { align-self: flex-end; background: var(--accent-soft); color: var(--ink); }
.wa-bubble-meta { font-size: 10px; color: var(--ink-ghost); margin-top: 3px; }
.wa-composer { display: flex; gap: 8px; padding: 12px; border-top: 1px solid var(--border-soft); }
.wa-composer textarea { flex: 1; resize: none; }
.wa-empty { display: flex; align-items: center; justify-content: center; height: 100%; color: var(--ink-ghost); font-size: 13px; }

/* ─── Kanban (Sales Pipeline) ───────────────────────────────────────────── */
.kanban-board { display: flex; gap: 14px; overflow-x: auto; padding-bottom: 8px; }
.kanban-col { flex: 0 0 260px; background: var(--surface-2); border-radius: var(--radius); padding: 10px; min-height: 200px; }
.kanban-col-head { display: flex; align-items: center; justify-content: space-between; padding: 4px 6px 10px; font-size: 12px; font-weight: 700; text-transform: uppercase; letter-spacing: .03em; }
.kanban-dot { width: 8px; height: 8px; border-radius: 50%; display: inline-block; margin-right: 6px; }
.kanban-card { background: var(--card); border: 1px solid var(--border); border-radius: var(--radius-sm); padding: 10px 12px; margin-bottom: 8px; cursor: grab; box-shadow: var(--shadow-sm); }
.kanban-card:hover { border-color: var(--accent); }
.kanban-card.dragging { opacity: .4; }
.kanban-card-name { font-size: 13px; font-weight: 600; color: var(--ink); margin-bottom: 3px; }
.kanban-card-value { font-size: 14px; font-weight: 700; color: var(--growth); }
.kanban-card-contact { font-size: 11px; color: var(--ink-ghost); margin-top: 3px; }
.kanban-col.drop-target { outline: 2px dashed var(--accent); outline-offset: -4px; }

/* ─── Workflow builder canvas (node-based, matches the visual-flow reference) ── */
.wf-toolbar { display: flex; gap: 8px; margin-bottom: 12px; flex-wrap: wrap; }
.wf-canvas-wrap { border: 1px solid var(--border); border-radius: var(--radius); overflow: auto; background: var(--bg); position: relative; height: 620px; }
.wf-canvas {
  position: relative; width: 2200px; height: 1500px; transform-origin: 0 0;
  background-image: radial-gradient(var(--border) 1.2px, transparent 1.2px);
  background-size: 24px 24px;
}
.wf-svg { position: absolute; top: 0; left: 0; width: 100%; height: 100%; pointer-events: none; overflow: visible; }

.wfn { position: absolute; width: 220px; background: var(--card); border: 1px solid var(--border); border-radius: 12px; box-shadow: var(--shadow-md); cursor: grab; user-select: none; }
.wfn:active { cursor: grabbing; }
.wfn-head { display: flex; align-items: center; gap: 8px; padding: 10px 10px 8px; }
.wfn-icon { width: 26px; height: 26px; border-radius: 7px; display: flex; align-items: center; justify-content: center; flex-shrink: 0; background: var(--wfn-color-soft, var(--accent-soft)); color: var(--wfn-color, var(--accent)); }
.wfn-title { font-size: 12.5px; font-weight: 700; color: var(--ink); flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.wfn-badge { font-size: 9px; font-weight: 800; text-transform: uppercase; letter-spacing: .04em; padding: 2px 7px; border-radius: 999px; background: var(--wfn-color-soft, var(--accent-soft)); color: var(--wfn-color, var(--accent)); flex-shrink: 0; }
.wfn-del { background: none; border: none; color: var(--ink-ghost); cursor: pointer; font-size: 14px; line-height: 1; flex-shrink: 0; padding: 0 0 0 2px; }
.wfn-del:hover { color: var(--fire); }
.wfn-body { padding: 0 12px 12px; font-size: 11.5px; color: var(--ink-dim); word-break: break-word; border-top: 1px solid var(--border-soft); margin-top: 2px; padding-top: 8px; min-height: 20px; }
.wfn-body:hover { color: var(--ink); }
.wfn[data-type="trigger"] { --wfn-color: var(--growth); --wfn-color-soft: rgba(34,197,94,.14); }
.wfn[data-type="condition"] { --wfn-color: var(--fire); --wfn-color-soft: rgba(244,63,94,.14); }
.wfn[data-type="wait_for_reply"] { --wfn-color: var(--info); --wfn-color-soft: rgba(59,130,246,.14); }
.wfn[data-action="ai_reply"], .wfn[data-action="ai_lead_score"] { --wfn-color: #2dd4bf; --wfn-color-soft: rgba(45,212,191,.14); }
.wfn[data-action="add_tag"], .wfn[data-action="remove_tag"], .wfn[data-action="enroll_workflow"] { --wfn-color: var(--purple); --wfn-color-soft: rgba(167,139,250,.14); }
.wfn[data-action="webhook"] { --wfn-color: var(--signal); --wfn-color-soft: rgba(234,179,8,.14); }

.wfn-dot { position: absolute; right: -7px; width: 13px; height: 13px; border-radius: 50%; background: var(--wfn-color, var(--accent)); border: 2px solid var(--bg); cursor: crosshair; z-index: 5; }
.wfn-dot:hover { transform: scale(1.25); }
.wfn-dot.connecting { background: var(--fire); box-shadow: 0 0 0 3px rgba(244,63,94,.25); }
.wfn-dot-label { position: absolute; right: 10px; font-size: 8.5px; color: var(--ink-ghost); text-transform: uppercase; letter-spacing: .03em; white-space: nowrap; }

.wf-zoom { position: sticky; bottom: 14px; left: 14px; display: inline-flex; align-items: center; gap: 2px; background: var(--card); border: 1px solid var(--border); border-radius: 999px; padding: 5px; box-shadow: var(--shadow-md); z-index: 20; margin-top: -46px; margin-left: 14px; }
.wf-zoom button { width: 28px; height: 28px; border-radius: 50%; border: none; background: transparent; color: var(--ink-dim); font-size: 15px; font-weight: 700; cursor: pointer; display: flex; align-items: center; justify-content: center; }
.wf-zoom button:hover { background: var(--surface-2); color: var(--ink); }
.wf-zoom-pct { font-size: 11px; color: var(--ink-ghost); font-weight: 700; min-width: 38px; text-align: center; }

@media (max-width: 900px) {
  .db-row-2b, .db-row-3, .db-row-equal { grid-template-columns: 1fr; }
  .wa-split { flex-direction: column; height: auto; }
  .wa-list { width: 100%; max-height: 220px; }
}

@media (max-width: 720px) {
  .form-row { grid-template-columns: 1fr; }
  .app-shell { flex-direction: column; }
  .icon-rail { width: 100%; flex-direction: row; padding: 10px 16px; }
  .rail-logo { margin-bottom: 0; margin-right: 8px; }
  .rail-spacer { display: none; }
  .sidebar { width: 100%; }
}
