/* =========================================================================
   Disruptivas · Design System
   Editorial · Latin warmth · Magazine grid · WONK serif accents
   ========================================================================= */

:root {
  /* Color */
  --aubergine: #2D1B3D;
  --aubergine-deep: #1A0F26;
  --magenta: #B83280;
  --magenta-deep: #7C2257;
  --terracotta: #D85A30;
  --gold: #D4A24C;
  --cream: #FFF8F1;
  --cream-warm: #FAEDDF;
  --cream-soft: #F7EFE3;
  --rose: #F4D8DC;
  --ink: #1A0F1F;
  --body: #4A3F4F;
  --muted: #8A7E92;
  --rule: #E5DAD3;
  --rule-soft: #EFE4D8;
  --green: #4A8559;
  --red: #B5443B;
  --info: #426A8C;

  /* Type */
  --serif: "Fraunces", "Hoefler Text", Georgia, serif;
  --sans: "Manrope", -apple-system, BlinkMacSystemFont, sans-serif;
  --mono: "JetBrains Mono", "SF Mono", Menlo, Consolas, monospace;
  --display-soft: "WONK" 0, "SOFT" 30, "opsz" 144;
  --display-wonk: "WONK" 1, "SOFT" 50, "opsz" 144;

  /* Spacing scale */
  --r-xs: 4px; --r-sm: 8px; --r-md: 12px; --r-lg: 18px; --r-xl: 24px; --r-2xl: 999px;
  --shadow-sm: 0 1px 2px rgba(26, 15, 31, 0.04), 0 0 0 1px rgba(229, 218, 211, 0.6);
  --shadow-md: 0 4px 12px rgba(26, 15, 31, 0.06), 0 0 0 1px rgba(229, 218, 211, 0.5);
  --shadow-lg: 0 16px 48px rgba(26, 15, 31, 0.10), 0 0 0 1px rgba(229, 218, 211, 0.4);
}

*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
html { scroll-behavior: smooth; }
body {
  background: var(--cream);
  color: var(--ink);
  font-family: var(--sans);
  font-size: 15px;
  line-height: 1.55;
  font-weight: 400;
  -webkit-font-smoothing: antialiased;
  overflow-x: hidden;
  position: relative;
  min-height: 100vh;
}

/* Editorial fractal-noise overlay (signature texture) */
body::before {
  content: "";
  position: fixed; inset: 0;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='200' height='200'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.85' numOctaves='3'/%3E%3CfeColorMatrix values='0 0 0 0 0.18, 0 0 0 0 0.06, 0 0 0 0 0.12, 0 0 0 0.04 0'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23n)'/%3E%3C/svg%3E");
  pointer-events: none;
  z-index: 1;
  opacity: 0.45;
  mix-blend-mode: multiply;
}
body.app::before { opacity: 0.25; } /* lighter texture for admin views */

a { color: inherit; text-decoration: none; }
button { font: inherit; color: inherit; background: none; border: 0; cursor: pointer; }
input, select, textarea { font: inherit; color: inherit; }

/* ---------- Type primitives ---------- */
.eyebrow {
  font-family: var(--sans); font-size: 11px; font-weight: 600;
  text-transform: uppercase; letter-spacing: 0.22em; color: var(--magenta);
}
.eyebrow.muted { color: var(--muted); }
.display      { font-family: var(--serif); font-weight: 400; line-height: 0.98; letter-spacing: -0.025em; font-variation-settings: var(--display-soft); }
.display-wonk { font-family: var(--serif); font-weight: 400; line-height: 0.98; letter-spacing: -0.025em; font-variation-settings: var(--display-wonk); }
.serif        { font-family: var(--serif); font-variation-settings: var(--display-soft); }
em { font-style: italic; font-variation-settings: var(--display-wonk); }
.num-tab { font-variant-numeric: tabular-nums lining-nums; }

/* ---------- Layout primitives ---------- */
.wrap { max-width: 1280px; margin: 0 auto; padding: 0 32px; position: relative; z-index: 2; }
.wrap-narrow { max-width: 920px; margin: 0 auto; padding: 0 32px; position: relative; z-index: 2; }
.stack > * + * { margin-top: var(--space, 16px); }
.row { display: flex; align-items: center; gap: 12px; }
.row.between { justify-content: space-between; }
.row.end { justify-content: flex-end; }
.spacer { flex: 1; }
.grid { display: grid; gap: 24px; }
.grid-2 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.grid-3 { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.grid-4 { grid-template-columns: repeat(4, minmax(0, 1fr)); }
@media (max-width: 920px) {
  .grid-2, .grid-3, .grid-4 { grid-template-columns: 1fr; }
}

/* ---------- Buttons ---------- */
.btn {
  display: inline-flex; align-items: center; gap: 8px;
  padding: 10px 18px; border-radius: var(--r-2xl);
  font-size: 13px; font-weight: 600; letter-spacing: 0.01em;
  transition: transform 0.15s, background 0.15s, box-shadow 0.15s, color 0.15s;
  white-space: nowrap;
}
.btn-primary {
  background: var(--ink); color: var(--cream);
}
.btn-primary:hover { background: var(--magenta); transform: translateY(-1px); }
.btn-magenta { background: var(--magenta); color: var(--cream); }
.btn-magenta:hover { background: var(--magenta-deep); transform: translateY(-1px); }
.btn-ghost { background: transparent; color: var(--ink); border: 1px solid var(--rule); }
.btn-ghost:hover { background: var(--cream-warm); border-color: var(--ink); }
.btn-soft { background: var(--cream-warm); color: var(--ink); }
.btn-soft:hover { background: var(--rose); }
.btn-lg { padding: 14px 26px; font-size: 14px; }
.btn-sm { padding: 6px 12px; font-size: 12px; }
.btn .arrow { font-family: var(--serif); font-weight: 400; }
.btn:disabled { opacity: 0.5; cursor: not-allowed; }

/* ---------- Tags / chips / status ---------- */
.tag {
  display: inline-flex; align-items: center; gap: 6px;
  padding: 3px 10px; border-radius: var(--r-2xl);
  font-size: 11px; font-weight: 600; letter-spacing: 0.04em;
  background: var(--cream-warm); color: var(--ink);
  border: 1px solid var(--rule-soft);
}
.tag.magenta { background: rgba(184, 50, 128, 0.10); color: var(--magenta-deep); border-color: rgba(184, 50, 128, 0.20); }
.tag.terracotta { background: rgba(216, 90, 48, 0.10); color: #94381b; border-color: rgba(216, 90, 48, 0.20); }
.tag.aubergine { background: rgba(45, 27, 61, 0.08); color: var(--aubergine); border-color: rgba(45, 27, 61, 0.15); }
.tag.gold { background: rgba(212, 162, 76, 0.14); color: #6f4e1f; border-color: rgba(212, 162, 76, 0.30); }
.tag.green { background: rgba(74, 133, 89, 0.10); color: var(--green); border-color: rgba(74, 133, 89, 0.20); }
.tag.red { background: rgba(181, 68, 59, 0.10); color: var(--red); border-color: rgba(181, 68, 59, 0.22); }
.tag.ghost { background: transparent; }
.tag .dot { width: 6px; height: 6px; border-radius: 50%; background: currentColor; opacity: 0.7; }

/* ---------- Cards / panels ---------- */
.card {
  background: var(--cream);
  border: 1px solid var(--rule);
  border-radius: var(--r-lg);
  padding: 24px;
  position: relative;
}
.card.warm { background: var(--cream-warm); }
.card.dark { background: var(--aubergine); color: var(--cream); border-color: var(--aubergine-deep); }
.card.dark .muted { color: rgba(255, 248, 241, 0.65); }
.card-head {
  display: flex; align-items: baseline; justify-content: space-between;
  gap: 16px; margin-bottom: 18px;
}
.card-title {
  font-family: var(--serif); font-size: 22px; font-weight: 400;
  letter-spacing: -0.015em; line-height: 1.1;
  font-variation-settings: var(--display-soft);
}
.card-sub { color: var(--muted); font-size: 13px; }

/* ---------- Tables ---------- */
.table { width: 100%; border-collapse: collapse; font-size: 13px; }
.table th {
  text-align: left; padding: 10px 14px;
  font-size: 11px; font-weight: 600; letter-spacing: 0.14em;
  text-transform: uppercase; color: var(--muted);
  border-bottom: 1px solid var(--rule);
  background: var(--cream-warm);
}
.table td {
  padding: 14px; border-bottom: 1px solid var(--rule-soft);
  vertical-align: middle;
}
.table tr:hover td { background: rgba(250, 237, 223, 0.4); }
.table tr.selected td { background: rgba(184, 50, 128, 0.06); }
.table .name {
  display: flex; align-items: center; gap: 12px;
  font-weight: 500; color: var(--ink);
}
.table .name small { display: block; color: var(--muted); font-weight: 400; font-size: 12px; }
.table-compact th, .table-compact td { padding: 8px 12px; }

/* ---------- Avatars ---------- */
.avatar {
  width: 36px; height: 36px; border-radius: 50%;
  display: inline-flex; align-items: center; justify-content: center;
  font-family: var(--serif); font-size: 14px; font-weight: 500;
  letter-spacing: -0.02em; color: var(--cream);
  background: linear-gradient(135deg, var(--magenta), var(--terracotta));
  flex-shrink: 0;
  font-variation-settings: var(--display-wonk);
}
.avatar.lg { width: 56px; height: 56px; font-size: 20px; }
.avatar.sm { width: 28px; height: 28px; font-size: 11px; }
.avatar.xs { width: 22px; height: 22px; font-size: 10px; }
.avatar.aubergine { background: linear-gradient(135deg, var(--aubergine), var(--magenta-deep)); }
.avatar.gold { background: linear-gradient(135deg, var(--gold), var(--terracotta)); }
.avatar.cream { background: linear-gradient(135deg, var(--cream-warm), var(--rose)); color: var(--magenta-deep); }
.avatar-stack { display: inline-flex; }
.avatar-stack .avatar { margin-left: -10px; border: 2px solid var(--cream); }
.avatar-stack .avatar:first-child { margin-left: 0; }

/* ---------- Form ---------- */
.field { display: block; }
.field label {
  display: block; font-size: 11px; font-weight: 600;
  text-transform: uppercase; letter-spacing: 0.14em;
  color: var(--muted); margin-bottom: 6px;
}
.input, .select, .textarea {
  width: 100%;
  padding: 11px 14px;
  background: var(--cream);
  border: 1px solid var(--rule);
  border-radius: var(--r-sm);
  font-size: 14px;
  color: var(--ink);
  transition: border-color 0.15s, box-shadow 0.15s;
}
.input:focus, .select:focus, .textarea:focus {
  outline: 0;
  border-color: var(--magenta);
  box-shadow: 0 0 0 3px rgba(184, 50, 128, 0.12);
}
.textarea { font-family: var(--sans); resize: vertical; min-height: 96px; }
.search {
  display: flex; align-items: center; gap: 8px;
  padding: 9px 14px; background: var(--cream);
  border: 1px solid var(--rule); border-radius: var(--r-2xl);
}
.search input { border: 0; background: none; flex: 1; font-size: 13px; outline: 0; }
.search svg { color: var(--muted); flex-shrink: 0; }

/* ---------- Stats / KPIs ---------- */
.kpi {
  display: flex; flex-direction: column; gap: 10px;
}
.kpi-label {
  font-size: 11px; font-weight: 600; letter-spacing: 0.18em;
  text-transform: uppercase; color: var(--muted);
}
.kpi-num {
  font-family: var(--serif); font-size: 44px; line-height: 1;
  letter-spacing: -0.025em; font-variation-settings: var(--display-soft);
}
.kpi-num em { color: var(--magenta); font-size: 32px; vertical-align: super; }
.kpi-delta {
  font-size: 12px; color: var(--green); font-weight: 600;
  display: inline-flex; align-items: center; gap: 4px;
}
.kpi-delta.down { color: var(--red); }

/* ---------- Sparklines / charts ---------- */
.spark { width: 100%; height: 48px; display: block; }
.spark path { fill: none; stroke: var(--magenta); stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; }
.spark .area { fill: rgba(184, 50, 128, 0.12); stroke: none; }
.bar-chart { display: flex; align-items: flex-end; gap: 6px; height: 96px; }
.bar-chart .bar {
  flex: 1; background: linear-gradient(to top, var(--magenta), var(--terracotta));
  border-radius: 3px 3px 0 0; min-height: 4px;
}
.bar-chart .bar.muted { background: var(--rule); }

/* ---------- Reveal animation ---------- */
.reveal { opacity: 0; transform: translateY(28px); transition: opacity 1s ease, transform 1s cubic-bezier(0.2, 0.7, 0, 1); }
.reveal.in { opacity: 1; transform: translateY(0); }
.reveal.d1 { transition-delay: 0.08s; }
.reveal.d2 { transition-delay: 0.16s; }
.reveal.d3 { transition-delay: 0.24s; }
.reveal.d4 { transition-delay: 0.32s; }

/* =========================================================================
   ADMIN APP CHROME (sidebar + topbar layout)
   ========================================================================= */

body.app { background: var(--cream); }
.app-shell { display: grid; grid-template-columns: 252px 1fr; min-height: 100vh; position: relative; z-index: 2; }
@media (max-width: 960px) {
  .app-shell { grid-template-columns: 1fr; }
  .sidebar { display: none; }
}

.sidebar {
  background: var(--aubergine);
  color: var(--cream);
  padding: 22px 18px 28px;
  position: sticky; top: 0; height: 100vh;
  display: flex; flex-direction: column;
  border-right: 1px solid var(--aubergine-deep);
}
.sidebar .brand {
  display: flex; align-items: baseline; gap: 6px;
  padding: 4px 8px 22px;
  border-bottom: 1px solid rgba(255, 248, 241, 0.10);
  margin-bottom: 18px;
}
.sidebar .brand-mark {
  font-family: var(--serif); font-size: 24px; font-weight: 500;
  color: var(--cream); letter-spacing: -0.02em;
}
.sidebar .brand-dot { width: 6px; height: 6px; border-radius: 50%; background: var(--magenta); transform: translateY(-3px); }
.sidebar .brand small { font-size: 10px; letter-spacing: 0.18em; color: rgba(255, 248, 241, 0.55); text-transform: uppercase; margin-left: 8px; }

.nav-group { margin-bottom: 18px; }
.nav-group-label {
  font-size: 10px; font-weight: 600;
  letter-spacing: 0.22em; text-transform: uppercase;
  color: rgba(255, 248, 241, 0.45);
  padding: 0 10px 8px;
}
.nav-item {
  display: flex; align-items: center; gap: 10px;
  padding: 9px 12px; border-radius: var(--r-sm);
  color: rgba(255, 248, 241, 0.80);
  font-size: 13px; font-weight: 500;
  transition: background 0.15s, color 0.15s;
}
.nav-item:hover { background: rgba(255, 248, 241, 0.06); color: var(--cream); }
.nav-item.active { background: var(--magenta); color: var(--cream); }
.nav-item.active .nav-icon { color: var(--cream); }
.nav-item .nav-icon { width: 16px; height: 16px; flex-shrink: 0; opacity: 0.85; }
.nav-item .nav-badge {
  margin-left: auto; font-size: 10px; padding: 2px 7px;
  background: rgba(255, 248, 241, 0.12); border-radius: var(--r-2xl);
}
.nav-item.active .nav-badge { background: rgba(0, 0, 0, 0.18); }

.sidebar-footer {
  margin-top: auto; padding-top: 16px;
  border-top: 1px solid rgba(255, 248, 241, 0.10);
  display: flex; align-items: center; gap: 10px;
}
.sidebar-footer .name { font-size: 13px; color: var(--cream); font-weight: 500; }
.sidebar-footer .role { font-size: 11px; color: rgba(255, 248, 241, 0.55); }

/* Main content */
.app-main { display: flex; flex-direction: column; min-width: 0; }
.app-topbar {
  display: flex; align-items: center; gap: 16px;
  padding: 18px 32px;
  background: rgba(255, 248, 241, 0.85);
  border-bottom: 1px solid var(--rule);
  backdrop-filter: blur(12px);
  position: sticky; top: 0; z-index: 20;
}
.app-topbar h1 {
  font-family: var(--serif); font-size: 22px; font-weight: 400;
  letter-spacing: -0.015em; line-height: 1;
  font-variation-settings: var(--display-soft);
}
.app-topbar .crumb { font-size: 12px; color: var(--muted); margin-bottom: 4px; }
.app-topbar .crumb a:hover { color: var(--magenta); }
.app-topbar .icon-btn {
  width: 36px; height: 36px; border-radius: 50%;
  display: inline-flex; align-items: center; justify-content: center;
  border: 1px solid var(--rule); background: var(--cream); color: var(--body);
  transition: background 0.15s, border-color 0.15s;
}
.app-topbar .icon-btn:hover { background: var(--cream-warm); border-color: var(--ink); }

.app-content { padding: 32px; flex: 1; }
.section-head {
  display: flex; align-items: end; justify-content: space-between;
  gap: 24px; margin-bottom: 24px;
}
.section-head h2 {
  font-family: var(--serif); font-size: 32px; font-weight: 400;
  letter-spacing: -0.025em; line-height: 1.05;
  font-variation-settings: var(--display-soft);
}
.section-head .lede { color: var(--muted); font-size: 14px; max-width: 520px; }

/* ---------- Banner / inline alert ---------- */
.banner {
  display: flex; align-items: flex-start; gap: 14px;
  padding: 14px 18px; border-radius: var(--r-md);
  background: var(--cream-warm); border: 1px solid var(--rule);
  font-size: 13px;
}
.banner.magenta { background: rgba(184, 50, 128, 0.06); border-color: rgba(184, 50, 128, 0.20); }
.banner.gold { background: rgba(212, 162, 76, 0.10); border-color: rgba(212, 162, 76, 0.28); }
.banner-icon {
  width: 32px; height: 32px; border-radius: var(--r-sm);
  background: var(--cream); display: inline-flex; align-items: center; justify-content: center;
  flex-shrink: 0;
}
.banner strong { display: block; font-weight: 600; color: var(--ink); margin-bottom: 2px; font-size: 13px; }
.banner span { color: var(--body); }

/* ---------- Pill nav (tabs) ---------- */
.tabs {
  display: inline-flex; padding: 4px;
  background: var(--cream-warm); border-radius: var(--r-2xl);
  border: 1px solid var(--rule);
}
.tabs a {
  padding: 7px 16px; font-size: 12px; font-weight: 600;
  letter-spacing: 0.04em; color: var(--body); border-radius: var(--r-2xl);
  transition: background 0.15s, color 0.15s;
}
.tabs a.active { background: var(--ink); color: var(--cream); }
.tabs a:hover:not(.active) { color: var(--ink); }

/* ---------- Drawer / aside panel ---------- */
.drawer {
  background: var(--cream); border: 1px solid var(--rule);
  border-radius: var(--r-lg); padding: 24px;
}
.drawer-head {
  padding-bottom: 18px; margin-bottom: 18px;
  border-bottom: 1px solid var(--rule);
}

/* Misc utilities */
.muted { color: var(--muted); }
.ink { color: var(--ink); }
.center { text-align: center; }
.right { text-align: right; }
.hidden-sm { display: initial; }
@media (max-width: 640px) { .hidden-sm { display: none; } }
.hr { height: 1px; background: var(--rule); border: 0; margin: 18px 0; }
.dot-sep { display: inline-block; width: 3px; height: 3px; background: currentColor; border-radius: 50%; opacity: 0.5; margin: 0 8px; vertical-align: middle; }
.checklist { list-style: none; }
.checklist li { display: flex; gap: 10px; padding: 6px 0; font-size: 14px; color: var(--body); }
.checklist li::before {
  content: "→"; font-family: var(--serif); font-style: italic; color: var(--magenta); flex-shrink: 0;
  font-variation-settings: var(--display-wonk);
}

/* WhatsApp / chat */
.chat-bubble {
  padding: 10px 14px; border-radius: 14px;
  background: var(--cream-warm); max-width: 78%;
  font-size: 13px; line-height: 1.45;
  position: relative;
}
.chat-bubble.out {
  background: rgba(74, 133, 89, 0.18); margin-left: auto;
  border-bottom-right-radius: 4px;
}
.chat-bubble.in { border-bottom-left-radius: 4px; background: var(--cream); border: 1px solid var(--rule); }
.chat-bubble small { display: block; font-size: 10px; color: var(--muted); margin-top: 4px; text-align: right; }
