/* Huerto Marketing · estética SingularStays (coral sobre slate, Inter, labels micro en mayúsculas) */
:root {
  --primary: #ff5c35;
  --primary-hover: #ff451a;
  --primary-5: rgba(255, 92, 53, .05);
  --primary-10: rgba(255, 92, 53, .10);
  --primary-20: rgba(255, 92, 53, .20);
  --primary-30: rgba(255, 92, 53, .30);
  --primary-grad-end: #ea580c;

  --bg-app: #f4f6f8;
  --surface: #ffffff;
  --inset: #f8fafc;
  --muted-bg: #f1f5f9;
  --dark: #0f172a;
  --dark-2: #1e293b;

  --text-main: #0f172a;
  --text-strong: #1e293b;
  --text-body: #334155;
  --text-body-2: #475569;
  --text-secondary: #64748b;
  --text-muted: #94a3b8;
  --text-faint: #cbd5e1;

  --border: #e2e8f0;
  --border-shell: rgba(226, 232, 240, .6);
  --border-soft: #f1f5f9;
  --border-strong: #cbd5e1;

  --success: #10b981; --success-600: #059669; --success-chip: #d1fae5; --success-text: #047857; --success-soft: #ecfdf5; --success-border: #a7f3d0;
  --warning: #f59e0b; --warning-chip: #fef3c7; --warning-text: #b45309; --warning-soft: #fffbeb; --warning-border: #fde68a;
  --danger: #f43f5e; --danger-600: #e11d48; --danger-chip: #ffe4e6; --danger-text: #be123c; --danger-soft: #fff1f2; --danger-border: #fecdd3;
  --info: #6366f1; --info-chip: #e0e7ff; --info-text: #4338ca; --info-soft: #eef2ff; --info-border: #c7d2fe;
  --red-500: #ef4444; --red-600: #dc2626;
  --wa: #16a34a;

  --grad-brand: linear-gradient(to bottom right, #ff5c35, #ea580c);
  --grad-emerald: linear-gradient(to bottom right, #10b981, #0d9488);
  --grad-blue: linear-gradient(to bottom right, #3b82f6, #4f46e5);
  --grad-amber: linear-gradient(to bottom right, #f59e0b, #ea580c);
  --grad-violet: linear-gradient(to bottom right, #8b5cf6, #9333ea);
  --grad-cyan: linear-gradient(to bottom right, #06b6d4, #2563eb);
  --grad-rose: linear-gradient(to bottom right, #fb7185, #e11d48);

  /* series de gráficos (validadas CVD): enviados / aperturas / clics */
  --series-1: #ff5c35;
  --series-2: #6366f1;
  --series-3: #10b981;

  --font-sans: "Inter", system-ui, -apple-system, "Segoe UI", sans-serif;
  --font-mono: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, "Liberation Mono", monospace;

  --radius-lg: 8px;
  --radius-xl: 12px;
  --radius-2xl: 16px;
  --radius-3xl: 24px;
  --radius-card-lg: 28px;
  --radius-card-xl: 32px;

  --shadow-subtle: 0 1px 2px rgba(0, 0, 0, .03);
  --shadow-card: 0 4px 6px -1px rgba(0, 0, 0, .02), 0 2px 4px -1px rgba(0, 0, 0, .02);
  --shadow-float: 0 20px 25px -5px rgba(0, 0, 0, .05), 0 10px 10px -5px rgba(0, 0, 0, .01);
  --shadow-sm: 0 1px 2px 0 rgba(0, 0, 0, .05);
  --shadow-md: 0 4px 6px -1px rgba(0, 0, 0, .1), 0 2px 4px -2px rgba(0, 0, 0, .1);
  --shadow-lg: 0 10px 15px -3px rgba(0, 0, 0, .1), 0 4px 6px -4px rgba(0, 0, 0, .1);
  --shadow-xl: 0 20px 25px -5px rgba(0, 0, 0, .1), 0 8px 10px -6px rgba(0, 0, 0, .1);
  --shadow-2xl: 0 25px 50px -12px rgba(0, 0, 0, .25);
  --shadow-primary-lg: 0 10px 15px -3px rgba(255, 92, 53, .2), 0 4px 6px -4px rgba(255, 92, 53, .2);
  --shadow-primary-md: 0 4px 6px -1px rgba(255, 92, 53, .2), 0 2px 4px -2px rgba(255, 92, 53, .2);
  --ring-focus: 0 0 0 2px rgba(255, 92, 53, .2);

  --ease: cubic-bezier(.4, 0, .2, 1);
  --header-h: 48px;
  --rail-w: 56px;
}

@keyframes fadeIn { from { opacity: 0 } to { opacity: 1 } }
@keyframes slideUp { from { transform: translateY(10px); opacity: 0 } to { transform: none; opacity: 1 } }
@keyframes scaleIn { from { transform: scale(.98); opacity: 0 } to { transform: none; opacity: 1 } }
@keyframes pulseSoft { 0%, 100% { opacity: 1 } 50% { opacity: .6 } }
@keyframes spin { to { transform: rotate(360deg) } }

*, *::before, *::after { box-sizing: border-box; }
[hidden] { display: none !important; }
html, body { height: 100%; margin: 0; }
body {
  font-family: var(--font-sans);
  font-size: 14px;
  line-height: 1.5;
  color: var(--text-main);
  background-color: #f8fafc;
  background-image: radial-gradient(#e2e8f0 1px, transparent 1px);
  background-size: 32px 32px;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  overflow: hidden;
}
::selection { background: var(--primary-20); color: var(--primary); }
::-webkit-scrollbar { width: 5px; height: 5px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: #cbd5e1; border-radius: 10px; }
::-webkit-scrollbar-thumb:hover { background: #94a3b8; }
a { color: inherit; text-decoration: none; }
h1, h2, h3, h4, p { margin: 0; }
button { font-family: inherit; }
.ms { font-family: 'Material Symbols Outlined'; font-weight: normal; font-style: normal; line-height: 1; letter-spacing: normal; text-transform: none; display: inline-block; white-space: nowrap; direction: ltr; -webkit-font-smoothing: antialiased; font-variation-settings: 'FILL' 0, 'wght' 400, 'GRAD' 0, 'opsz' 24; font-size: 20px; user-select: none; }
.ms.fill { font-variation-settings: 'FILL' 1, 'wght' 400, 'GRAD' 0, 'opsz' 24; }
.ms.sm { font-size: 16px; } .ms.xs { font-size: 14px; } .ms.lg { font-size: 24px; }

/* ---------- Shell ---------- */
.shell { height: 100dvh; display: flex; flex-direction: column; background: var(--bg-app); }
.header {
  height: var(--header-h); flex: 0 0 auto; display: flex; align-items: center; justify-content: space-between;
  padding: 0 16px; background: rgba(255, 255, 255, .9); backdrop-filter: blur(12px); -webkit-backdrop-filter: blur(12px);
  border-bottom: 1px solid var(--border-shell); position: sticky; top: 0; z-index: 40; gap: 12px;
}
.brand { display: flex; align-items: center; gap: 10px; cursor: pointer; }
.logo-tile { width: 28px; height: 28px; border-radius: 8px; background: var(--grad-brand); box-shadow: var(--shadow-primary-md); display: grid; place-items: center; color: #fff; transition: transform .15s var(--ease); }
.logo-tile .ms { font-size: 16px; }
.brand:hover .logo-tile { transform: scale(1.05); }
.wordmark { font-size: 14px; letter-spacing: -.01em; white-space: nowrap; }
.wordmark .a { font-weight: 700; background: linear-gradient(to right, #1e293b, #475569); -webkit-background-clip: text; background-clip: text; color: transparent; }
.wordmark .b { font-weight: 800; color: var(--primary); }
.health-dot { width: 6px; height: 6px; border-radius: 50%; background: #22c55e; }
.header-center { position: absolute; left: 50%; transform: translateX(-50%); display: flex; gap: 8px; }
.alert-pill { display: inline-flex; align-items: center; gap: 6px; padding: 4px 10px; border-radius: var(--radius-lg); font-size: 10px; font-weight: 900; text-transform: uppercase; letter-spacing: .08em; white-space: nowrap; }
.alert-pill.warn { background: var(--warning-soft); border: 1px solid var(--warning-border); color: var(--warning-text); animation: pulseSoft 3s infinite ease-in-out; }
.alert-pill .ms { font-size: 14px; }
.header-right { display: flex; align-items: center; gap: 8px; }
.icon-btn { width: 32px; height: 32px; display: inline-flex; align-items: center; justify-content: center; border-radius: var(--radius-lg); border: 0; background: transparent; color: var(--text-secondary); cursor: pointer; transition: background .15s var(--ease), color .15s var(--ease); }
.icon-btn:hover { background: var(--muted-bg); color: var(--text-body); }
.icon-btn .ms { font-size: 18px; }
.kbd { font-family: var(--font-mono); font-size: 9px; font-weight: 700; color: var(--text-muted); border: 1px solid var(--border); border-radius: 4px; padding: 1px 4px; background: #fff; }
.search-trigger { display: inline-flex; align-items: center; gap: 8px; height: 32px; padding: 0 8px 0 10px; border-radius: var(--radius-lg); border: 1px solid var(--border); background: var(--inset); color: var(--text-muted); font-size: 12px; font-weight: 500; cursor: pointer; min-width: 200px; }
.search-trigger:hover { border-color: var(--border-strong); }
.search-trigger .grow { flex: 1; text-align: left; }
.user-block { display: flex; align-items: center; gap: 8px; margin-left: 8px; padding-left: 10px; border-left: 1px solid var(--border); }
.user-block .online { font-size: 8px; font-weight: 900; text-transform: uppercase; color: var(--primary); letter-spacing: .08em; line-height: 1; }
.user-block .name { font-size: 10px; font-weight: 800; color: var(--text-strong); line-height: 1.3; }
.avatar { width: 28px; height: 28px; border-radius: var(--radius-lg); background: var(--grad-brand); color: #fff; font-size: 10px; font-weight: 900; display: grid; place-items: center; box-shadow: var(--shadow-sm); flex: 0 0 auto; }

.body { flex: 1; display: flex; min-height: 0; }
.rail { width: var(--rail-w); flex: 0 0 auto; background: #fff; border-right: 1px solid var(--border-shell); padding: 12px 4px; display: flex; flex-direction: column; align-items: center; gap: 4px; z-index: 30; }
.rail a { width: 40px; height: 40px; border-radius: var(--radius-xl); display: flex; align-items: center; justify-content: center; color: var(--text-muted); position: relative; border: 1px solid transparent; transition: all .15s var(--ease); }
.rail a:hover { background: var(--inset); color: var(--text-body-2); }
.rail a.active { background: var(--primary-10); color: var(--primary); border-color: var(--primary-20); box-shadow: var(--shadow-sm); }
.rail a .tip { position: absolute; left: 100%; margin-left: 8px; padding: 4px 8px; background: var(--dark-2); color: #fff; font-size: 10px; font-weight: 700; border-radius: 6px; box-shadow: var(--shadow-lg); white-space: nowrap; opacity: 0; pointer-events: none; transition: opacity .15s var(--ease); z-index: 60; }
.rail a:hover .tip { opacity: 1; }
.rail .sep { width: 24px; height: 1px; background: var(--border-soft); margin: 4px 0; }
.rail .spacer { flex: 1; }
.rail .label-mobile { display: none; }

.main { flex: 1; min-width: 0; position: relative; overflow-y: auto; background: rgba(248, 250, 252, .3); }
.page { max-width: 1600px; margin: 0 auto; padding: 24px; animation: fadeIn .25s ease-out; }
.page.narrow { max-width: 1280px; }
@media (min-width: 1024px) { .page { padding: 32px; } }

/* ---------- Tipografía ---------- */
.page-head { display: flex; align-items: flex-end; justify-content: space-between; gap: 16px; margin-bottom: 24px; flex-wrap: wrap; }
.page-head .titles { display: flex; align-items: center; gap: 14px; min-width: 0; }
.page-icon { width: 44px; height: 44px; border-radius: var(--radius-xl); background: #fff; border: 1px solid var(--border-soft); display: grid; place-items: center; color: var(--primary); box-shadow: var(--shadow-subtle); flex: 0 0 auto; }
.page-icon .ms { font-size: 24px; }
.eyebrow { font-size: 11px; font-weight: 700; color: var(--text-muted); text-transform: uppercase; letter-spacing: .1em; }
.page-title { font-size: 24px; line-height: 32px; font-weight: 900; color: var(--text-main); letter-spacing: -.025em; }
.page-actions { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; }
.section-title { display: flex; align-items: center; gap: 8px; font-size: 11px; font-weight: 900; text-transform: uppercase; letter-spacing: .1em; color: var(--text-secondary); }
.section-title .ms { font-size: 18px; color: var(--text-muted); }
.micro { font-size: 9px; font-weight: 900; text-transform: uppercase; letter-spacing: .1em; color: var(--text-faint); }
.label { display: block; font-size: 10px; font-weight: 900; color: var(--text-secondary); text-transform: uppercase; letter-spacing: .05em; margin-bottom: 6px; }
.muted { color: var(--text-muted); }
.secondary { color: var(--text-secondary); }
.small { font-size: 12px; }
.xsmall { font-size: 11px; }
.mono { font-family: var(--font-mono); }
.num { font-variant-numeric: tabular-nums; }
.strong { font-weight: 700; color: var(--text-strong); }
.black { font-weight: 900; }
.truncate { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.link { color: var(--primary); font-weight: 700; cursor: pointer; }
.link:hover { color: var(--primary-hover); text-decoration: underline; }

/* ---------- Layout helpers ---------- */
.row { display: flex; align-items: center; gap: 8px; }
.row.wrap { flex-wrap: wrap; }
.row.between { justify-content: space-between; }
.row.top { align-items: flex-start; }
.stack { display: flex; flex-direction: column; gap: 16px; }
.stack.sm { gap: 8px; } .stack.lg { gap: 24px; }
.grow { flex: 1; min-width: 0; }
.grid { display: grid; gap: 16px; }
.grid.g24 { 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)); }
.grid-5 { grid-template-columns: repeat(5, minmax(0, 1fr)); }
.split-main { grid-template-columns: minmax(0, 2fr) minmax(0, 1fr); }
.split-side { grid-template-columns: 340px minmax(0, 1fr); }
.mt8 { margin-top: 8px; } .mt16 { margin-top: 16px; } .mt24 { margin-top: 24px; } .mb8 { margin-bottom: 8px; } .mb16 { margin-bottom: 16px; }
@media (max-width: 1279px) { .grid-5 { grid-template-columns: repeat(3, minmax(0, 1fr)); } .grid-4 { grid-template-columns: repeat(2, minmax(0, 1fr)); } .split-main, .split-side { grid-template-columns: minmax(0, 1fr); } }
@media (max-width: 767px) { .grid-2, .grid-3, .grid-4, .grid-5 { grid-template-columns: minmax(0, 1fr); } }

/* ---------- Tarjetas ---------- */
.card { background: #fff; border: 1px solid var(--border); border-radius: var(--radius-3xl); box-shadow: var(--shadow-card); padding: 24px; min-width: 0; }
.card.sm { border-radius: var(--radius-2xl); padding: 20px; box-shadow: var(--shadow-subtle); }
.card.xl { border-radius: var(--radius-card-xl); padding: 32px; }
.card.flush { padding: 0; overflow: hidden; }
.card-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin-bottom: 18px; }
.tile { background: var(--inset); border: 1px solid var(--border-soft); border-radius: var(--radius-2xl); padding: 16px; }
.hover-lift { transition: box-shadow .3s var(--ease), transform .3s var(--ease); }
.hover-lift:hover { box-shadow: var(--shadow-float); transform: translateY(-2px); }

.kpi { background: #fff; border: 1px solid var(--border); border-radius: var(--radius-3xl); box-shadow: var(--shadow-card); padding: 20px; transition: box-shadow .3s var(--ease), transform .3s var(--ease); min-width: 0; }
.kpi:hover { box-shadow: var(--shadow-float); transform: translateY(-2px); }
.kpi .top { display: flex; justify-content: space-between; align-items: flex-start; margin-bottom: 16px; gap: 8px; }
.icon-tile { width: 40px; height: 40px; border-radius: var(--radius-xl); display: grid; place-items: center; color: #fff; flex: 0 0 auto; }
.icon-tile .ms { font-size: 18px; }
.icon-tile.brand { background: var(--grad-brand); box-shadow: 0 10px 15px -3px rgba(255, 92, 53, .2), 0 4px 6px -4px rgba(255, 92, 53, .2); }
.icon-tile.emerald { background: var(--grad-emerald); box-shadow: 0 10px 15px -3px rgba(16, 185, 129, .2), 0 4px 6px -4px rgba(16, 185, 129, .2); }
.icon-tile.blue { background: var(--grad-blue); box-shadow: 0 10px 15px -3px rgba(59, 130, 246, .2), 0 4px 6px -4px rgba(59, 130, 246, .2); }
.icon-tile.amber { background: var(--grad-amber); box-shadow: 0 10px 15px -3px rgba(245, 158, 11, .2), 0 4px 6px -4px rgba(245, 158, 11, .2); }
.icon-tile.violet { background: var(--grad-violet); box-shadow: 0 10px 15px -3px rgba(139, 92, 246, .2), 0 4px 6px -4px rgba(139, 92, 246, .2); }
.icon-tile.cyan { background: var(--grad-cyan); box-shadow: 0 10px 15px -3px rgba(6, 182, 212, .2), 0 4px 6px -4px rgba(6, 182, 212, .2); }
.icon-tile.rose { background: var(--grad-rose); box-shadow: 0 10px 15px -3px rgba(244, 63, 94, .2), 0 4px 6px -4px rgba(244, 63, 94, .2); }
.icon-tile.slate { background: var(--muted-bg); color: var(--text-secondary); }
.icon-tile.sm { width: 32px; height: 32px; border-radius: 10px; }
.icon-tile.sm .ms { font-size: 16px; }
.kpi .kpi-label { font-size: 9px; font-weight: 900; text-transform: uppercase; letter-spacing: .1em; color: var(--text-faint); text-align: right; line-height: 1.4; }
.kpi .kpi-value, .kpi-value { font-size: 24px; line-height: 32px; font-weight: 900; color: var(--text-main); letter-spacing: -.025em; }
.kpi .kpi-sub { font-size: 10px; color: var(--text-muted); font-weight: 500; margin-top: 4px; display: flex; gap: 6px; align-items: center; flex-wrap: wrap; }
.delta { font-size: 10px; font-weight: 800; display: inline-flex; align-items: center; gap: 1px; }
.delta.up { color: var(--success-600); } .delta.down { color: var(--danger-600); } .delta.flat { color: var(--text-muted); }
.delta .ms { font-size: 14px; }

.hero-dark { background: var(--dark); border-radius: var(--radius-card-xl); padding: 28px 32px; color: #fff; position: relative; overflow: hidden; box-shadow: var(--shadow-2xl); }
.hero-dark::after { content: ""; position: absolute; top: -40px; right: -40px; width: 256px; height: 256px; background: var(--primary-20); filter: blur(100px); pointer-events: none; }
.hero-dark > * { position: relative; z-index: 1; }
.hero-dark .hero-label { font-size: 10px; font-weight: 900; text-transform: uppercase; letter-spacing: .2em; color: var(--primary); }
.hero-dark .hero-value { font-size: 48px; line-height: 1; font-weight: 900; letter-spacing: -.03em; margin-top: 8px; }
.hero-dark .hero-sub { font-size: 12px; color: #94a3b8; margin-top: 8px; }
.hero-dark .glass { background: rgba(255, 255, 255, .05); border: 1px solid rgba(255, 255, 255, .1); border-radius: var(--radius-2xl); padding: 16px; transition: background .15s; }
.hero-dark .glass:hover { background: rgba(255, 255, 255, .1); }
.hero-dark .glass .v { font-size: 22px; font-weight: 900; letter-spacing: -.02em; }
.hero-dark .glass .l { font-size: 9px; font-weight: 900; text-transform: uppercase; letter-spacing: .12em; color: #94a3b8; }
.progress-dark { height: 6px; background: rgba(255, 255, 255, .1); border-radius: 999px; overflow: hidden; margin-top: 14px; }
.progress-dark > span { display: block; height: 100%; background: var(--primary); border-radius: 999px; transition: width .7s var(--ease); }

/* ---------- Botones ---------- */
.btn { display: inline-flex; align-items: center; justify-content: center; gap: 8px; padding: 9px 16px; border-radius: var(--radius-xl); border: 1px solid transparent; font-size: 13px; font-weight: 700; line-height: 20px; cursor: pointer; transition: all .15s var(--ease); white-space: nowrap; background: transparent; color: var(--text-body-2); }
.btn:active { transform: scale(.97); }
.btn:disabled { opacity: .45; cursor: not-allowed; transform: none; }
.btn .ms { font-size: 18px; }
.btn-primary { background: var(--primary); color: #fff; box-shadow: var(--shadow-primary-lg); }
.btn-primary:hover:not(:disabled) { background: var(--primary-hover); }
.btn-dark { background: var(--dark); color: #fff; border-color: #334155; box-shadow: var(--shadow-sm); }
.btn-dark:hover:not(:disabled) { background: #334155; }
.btn-secondary { background: var(--muted-bg); color: var(--text-body-2); }
.btn-secondary:hover:not(:disabled) { background: var(--border); }
.btn-outline { background: #fff; border-color: var(--border); color: var(--text-body-2); }
.btn-outline:hover:not(:disabled) { background: var(--inset); color: var(--text-strong); }
.btn-ghost:hover:not(:disabled) { background: var(--muted-bg); }
.btn-danger { background: var(--red-500); color: #fff; }
.btn-danger:hover:not(:disabled) { background: var(--red-600); }
.btn-danger-ghost { color: var(--red-500); }
.btn-danger-ghost:hover:not(:disabled) { background: #fef2f2; }
.btn-sm { padding: 6px 10px; border-radius: var(--radius-lg); font-size: 10px; font-weight: 900; text-transform: uppercase; letter-spacing: .04em; line-height: 16px; gap: 6px; }
.btn-sm .ms { font-size: 15px; }
.btn-icon { width: 36px; height: 36px; padding: 0; border-radius: var(--radius-xl); }
.btn-icon.sm { width: 28px; height: 28px; border-radius: var(--radius-lg); }
.btn-icon.sm .ms { font-size: 16px; }

/* ---------- Formularios ---------- */
.input, .select, .textarea {
  width: 100%; background: var(--inset); border: 1px solid var(--border); border-radius: var(--radius-xl);
  padding: 9px 14px; font: inherit; font-size: 13px; font-weight: 500; color: var(--text-body); line-height: 20px;
  transition: border-color .15s var(--ease), box-shadow .15s var(--ease), background .15s var(--ease);
}
.input::placeholder, .textarea::placeholder { color: var(--text-muted); }
.input:focus, .select:focus, .textarea:focus { outline: none; border-color: var(--primary); box-shadow: var(--ring-focus); background: #fff; }
.select { appearance: none; -webkit-appearance: none; cursor: pointer; padding-right: 34px; 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='%2394a3b8' stroke-width='2.5' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='m6 9 6 6 6-6'/%3E%3C/svg%3E"); background-repeat: no-repeat; background-position: right 12px center; }
.textarea { resize: vertical; min-height: 84px; }
.input.sm, .select.sm { padding: 6px 10px; font-size: 12px; border-radius: var(--radius-lg); }
.select.sm { padding-right: 28px; background-position: right 8px center; }
.input-icon { position: relative; }
.input-icon > .ms { position: absolute; left: 12px; top: 50%; transform: translateY(-50%); color: var(--text-muted); font-size: 18px; pointer-events: none; }
.input-icon .input { padding-left: 38px; }
.field { display: flex; flex-direction: column; min-width: 0; }
.hint { font-size: 11px; color: var(--text-muted); line-height: 1.4; }
.field .hint { margin-top: 5px; }
.input.invalid, .select.invalid, .textarea.invalid { border-color: var(--danger); background: var(--danger-soft); }
.input.invalid:focus { border-color: var(--danger); box-shadow: 0 0 0 3px var(--danger-chip); }
.field-error { margin-top: 5px; font-size: 11px; font-weight: 600; line-height: 1.4; color: var(--danger-text); }
.form-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 14px 16px; }
.form-grid .full { grid-column: 1 / -1; }
@media (max-width: 640px) { .form-grid { grid-template-columns: minmax(0, 1fr); } }
.check { display: flex; align-items: flex-start; gap: 10px; font-size: 13px; color: var(--text-body-2); cursor: pointer; line-height: 1.4; }
.check input { width: 16px; height: 16px; margin: 1px 0 0; accent-color: var(--primary); flex: 0 0 auto; cursor: pointer; }
.switch { position: relative; width: 40px; height: 22px; border-radius: 999px; background: var(--border-strong); border: 0; cursor: pointer; transition: background .15s var(--ease); flex: 0 0 auto; padding: 0; }
.switch::after { content: ""; position: absolute; top: 2px; left: 2px; width: 18px; height: 18px; border-radius: 50%; background: #fff; box-shadow: var(--shadow-sm); transition: transform .15s var(--ease); }
.switch.on { background: var(--success); }
.switch.on::after { transform: translateX(18px); }
.color-input { width: 42px; height: 40px; padding: 3px; border: 1px solid var(--border); border-radius: var(--radius-xl); background: var(--inset); cursor: pointer; }

/* ---------- Tabs / segmentados ---------- */
.tabs { display: inline-flex; align-items: center; gap: 4px; background: #fff; border: 1px solid var(--border); border-radius: var(--radius-2xl); padding: 5px; box-shadow: var(--shadow-subtle); flex-wrap: wrap; max-width: 100%; }
.tab { display: inline-flex; align-items: center; gap: 6px; padding: 7px 16px; border-radius: var(--radius-xl); font-size: 11px; font-weight: 900; color: var(--text-muted); border: 0; background: transparent; cursor: pointer; transition: all .15s var(--ease); white-space: nowrap; }
.tab:hover { color: var(--text-body-2); }
.tab.active { background: var(--dark); color: #fff; box-shadow: var(--shadow-md); }
.tab .ms { font-size: 15px; }
.tab .count { background: rgba(148, 163, 184, .18); color: inherit; }
.tab .tab-alert { width: 7px; height: 7px; border-radius: 50%; background: var(--warning); box-shadow: 0 0 0 2px #fff; }
.tab .tab-alert.danger { background: var(--danger); }
.seg { display: inline-flex; gap: 2px; background: var(--muted-bg); border-radius: var(--radius-lg); padding: 2px; }
.seg button { padding: 4px 12px; border-radius: 6px; font-size: 10px; font-weight: 900; color: var(--text-muted); background: transparent; border: 0; cursor: pointer; text-transform: uppercase; letter-spacing: .04em; }
.seg button.active { background: #fff; color: var(--primary); box-shadow: var(--shadow-sm); }
.chip-filter { padding: 7px 14px; border-radius: var(--radius-xl); font-size: 11px; font-weight: 700; text-transform: uppercase; letter-spacing: .05em; border: 1px solid var(--border); background: #fff; color: var(--text-secondary); cursor: pointer; }
.chip-filter.active { background: var(--dark); color: #fff; border-color: var(--dark); box-shadow: 0 10px 15px -3px rgba(15, 23, 42, .2); }

/* ---------- Chips / etiquetas ---------- */
.chip { display: inline-flex; align-items: center; gap: 6px; border-radius: 999px; padding: 3px 9px; font-size: 10px; font-weight: 900; text-transform: uppercase; letter-spacing: .03em; white-space: nowrap; line-height: 14px; }
.chip .dot { width: 6px; height: 6px; border-radius: 50%; background: currentColor; flex: 0 0 auto; }
.chip.success { background: var(--success-chip); color: var(--success-text); } .chip.success .dot { background: var(--success); }
.chip.warning { background: var(--warning-chip); color: var(--warning-text); } .chip.warning .dot { background: var(--warning); }
.chip.danger { background: var(--danger-chip); color: var(--danger-text); } .chip.danger .dot { background: var(--danger); }
.chip.info { background: var(--info-chip); color: var(--info-text); } .chip.info .dot { background: var(--info); }
.chip.neutral { background: var(--muted-bg); color: var(--text-body-2); } .chip.neutral .dot { background: var(--text-muted); }
.chip.primary { background: var(--primary-10); color: #c2410c; } .chip.primary .dot { background: var(--primary); }
.chip.dark { background: var(--dark); color: #fff; }
.chip.pulse .dot { animation: pulseSoft 1.6s infinite ease-in-out; }
.tag { display: inline-flex; align-items: center; gap: 4px; background: var(--muted-bg); color: var(--text-body-2); border-radius: 6px; padding: 2px 8px; font-size: 10px; font-weight: 700; white-space: nowrap; line-height: 16px; }
.tag button { border: 0; background: none; padding: 0; margin: 0 -2px 0 0; color: var(--text-muted); cursor: pointer; display: inline-flex; }
.tag button:hover { color: var(--danger-600); }
.tag button .ms { font-size: 13px; }
.tag.outline { background: #fff; border: 1px solid var(--border); }
.count { display: inline-flex; align-items: center; font-size: 10px; font-weight: 700; color: var(--text-muted); background: var(--muted-bg); border-radius: 999px; padding: 1px 8px; line-height: 16px; }
.channel { display: inline-flex; align-items: center; gap: 4px; font-size: 10px; font-weight: 900; text-transform: uppercase; letter-spacing: .04em; }
.channel.email { color: #2563eb; } .channel.whatsapp { color: var(--wa); }
.channel .ms { font-size: 15px; }
.score { display: inline-flex; align-items: center; gap: 3px; font-size: 11px; font-weight: 900; color: var(--text-strong); font-variant-numeric: tabular-nums; }
.score .ms { font-size: 14px; color: var(--primary); }

/* ---------- Tablas ---------- */
.table-wrap { background: #fff; border: 1px solid var(--border); border-radius: var(--radius-3xl); box-shadow: var(--shadow-card); overflow-x: auto; }
.table-wrap.plain { border: 0; box-shadow: none; border-radius: 0; }
table.tbl { width: 100%; border-collapse: collapse; font-size: 13px; }
.tbl thead th { background: var(--inset); border-bottom: 1px solid var(--border); padding: 13px 16px; text-align: left; font-size: 10px; font-weight: 900; color: var(--text-secondary); text-transform: uppercase; letter-spacing: .05em; white-space: nowrap; }
.tbl thead th.r, .tbl td.r { text-align: right; }
.tbl thead th.c, .tbl td.c { text-align: center; }
.tbl tbody tr { transition: background .15s var(--ease); }
.tbl tbody tr + tr td { border-top: 1px solid var(--border-soft); }
.tbl tbody tr:hover { background: rgba(248, 250, 252, .8); }
.tbl tbody tr.clickable { cursor: pointer; }
.tbl td { padding: 12px 16px; vertical-align: middle; color: var(--text-body); }
.tbl td.w1, .tbl th.w1 { width: 1%; white-space: nowrap; }
.tbl .cell-title { font-weight: 700; color: var(--text-strong); }
.tbl .cell-sub { font-size: 11px; color: var(--text-muted); margin-top: 1px; }
.tbl input[type=checkbox] { accent-color: var(--primary); width: 15px; height: 15px; cursor: pointer; }
.tbl.compact td { padding: 9px 16px; }
.table-foot { display: flex; align-items: center; justify-content: space-between; padding: 12px 16px; border-top: 1px solid var(--border-soft); font-size: 11px; color: var(--text-muted); gap: 12px; flex-wrap: wrap; }
.rate { display: flex; align-items: center; gap: 8px; min-width: 110px; }
.rate .track { flex: 1; height: 6px; background: var(--muted-bg); border-radius: 999px; overflow: hidden; }
.rate .track > span { display: block; height: 100%; border-radius: 999px; background: var(--primary); }
.rate b { font-size: 11px; font-weight: 900; color: var(--text-body); min-width: 38px; text-align: right; font-variant-numeric: tabular-nums; }

.toolbar { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; margin-bottom: 16px; }
.toolbar .input-icon { min-width: 260px; flex: 1; max-width: 420px; }
.toolbar .select { width: auto; min-width: 150px; }
.bulk-bar { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; padding: 10px 14px; margin-bottom: 12px; border-radius: var(--radius-2xl); background: var(--dark); color: #fff; box-shadow: var(--shadow-lg); animation: slideUp .2s ease-out; }
.bulk-bar .n { font-size: 11px; font-weight: 900; text-transform: uppercase; letter-spacing: .08em; margin-right: 8px; }
.bulk-bar .btn-sm { background: rgba(255, 255, 255, .08); color: #fff; border: 1px solid rgba(255, 255, 255, .12); }
.bulk-bar .btn-sm:hover { background: rgba(255, 255, 255, .16); }

/* ---------- Modales ---------- */
.overlay { position: fixed; inset: 0; z-index: 50; display: flex; align-items: center; justify-content: center; padding: 16px; background: rgba(0, 0, 0, .4); backdrop-filter: blur(4px); -webkit-backdrop-filter: blur(4px); animation: fadeIn .15s ease-out; }
.overlay.top { align-items: flex-start; padding-top: 80px; background: rgba(15, 23, 42, .5); }
.modal { background: #fff; border-radius: var(--radius-2xl); box-shadow: var(--shadow-2xl); width: 100%; max-width: 512px; max-height: 90vh; display: flex; flex-direction: column; overflow: hidden; animation: scaleIn .15s ease-out; }
.modal.lg { max-width: 672px; border-radius: var(--radius-3xl); }
.modal.xl { max-width: 960px; border-radius: var(--radius-3xl); }
.modal.full { max-width: 1200px; height: 90vh; border-radius: var(--radius-3xl); }
.modal-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 16px 24px; border-bottom: 1px solid var(--border-soft); }
.modal-head h3 { font-size: 17px; font-weight: 600; color: var(--text-strong); display: flex; align-items: center; gap: 10px; }
.modal-head h3 .ms { color: var(--primary); }
.modal-close { width: 34px; height: 34px; border-radius: var(--radius-xl); background: var(--muted-bg); border: 0; display: grid; place-items: center; cursor: pointer; color: var(--text-secondary); }
.modal-close:hover { background: var(--border); }
.modal-body { padding: 20px 24px; overflow-y: auto; flex: 1; }
.modal-foot { display: flex; justify-content: flex-end; align-items: center; gap: 8px; padding: 14px 24px; border-top: 1px solid var(--border-soft); background: #fff; }
.modal-foot .left { margin-right: auto; }

.palette { background: #fff; border-radius: var(--radius-xl); box-shadow: var(--shadow-2xl); width: 100%; max-width: 672px; overflow: hidden; animation: scaleIn .15s ease-out; }
.palette .p-input { display: flex; align-items: center; gap: 10px; padding: 14px 18px; border-bottom: 1px solid var(--border-soft); }
.palette .p-input input { flex: 1; border: 0; outline: none; font: inherit; font-size: 15px; color: var(--text-main); }
.palette .p-results { max-height: 420px; overflow-y: auto; padding: 8px; }
.palette .p-group { font-size: 9px; font-weight: 900; text-transform: uppercase; letter-spacing: .1em; color: var(--text-muted); padding: 10px 10px 4px; }
.palette .p-item { display: flex; align-items: center; gap: 10px; padding: 8px 10px; border-radius: var(--radius-lg); cursor: pointer; font-size: 13px; color: var(--text-body); }
.palette .p-item:hover, .palette .p-item.sel { background: var(--primary-5); color: var(--text-main); }
.palette .p-item .ms { font-size: 18px; color: var(--text-muted); }

/* ---------- Toasts ---------- */
.toasts { position: fixed; bottom: 16px; right: 16px; z-index: 100; display: flex; flex-direction: column; gap: 8px; }
.toast { min-width: 300px; max-width: 448px; padding: 14px 16px; border-radius: 4px; background: #fff; border: 1px solid #e5e7eb; border-left: 4px solid #22c55e; box-shadow: var(--shadow-lg); display: flex; align-items: flex-start; gap: 12px; animation: fadeIn .25s ease-out; }
.toast .ms { font-size: 20px; color: #22c55e; }
.toast.error { border-left-color: var(--red-500); } .toast.error .ms { color: var(--red-500); }
.toast.warning { border-left-color: var(--warning); } .toast.warning .ms { color: var(--warning); }
.toast .t-title { font-weight: 700; font-size: 13px; color: var(--text-strong); }
.toast .t-msg { font-size: 13px; color: var(--text-body-2); margin-top: 2px; }

/* ---------- Vacíos / carga ---------- */
.empty { display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 6px; padding: 48px 16px; text-align: center; }
.empty .ms { font-size: 40px; color: var(--text-faint); }
.empty .e-title { font-size: 14px; font-weight: 700; color: var(--text-secondary); }
.empty .e-hint { font-size: 11px; color: var(--text-muted); max-width: 340px; }
.empty .btn { margin-top: 10px; }
.spinner { width: 28px; height: 28px; border: 3px solid var(--primary-20); border-top-color: var(--primary); border-radius: 50%; animation: spin .8s linear infinite; }
.loading { display: grid; place-items: center; padding: 80px 0; }
.is-refetching { opacity: .55; transition: opacity .2s; }

/* ---------- Gráficos (CSS/SVG, sin librería) ---------- */
.hbar { display: flex; align-items: center; gap: 12px; }
.hbar + .hbar { margin-top: 10px; }
.hbar .hb-label { width: 150px; flex: 0 0 auto; font-size: 11px; font-weight: 700; color: var(--text-body-2); }
.hbar .hb-track { flex: 1; height: 18px; position: relative; }
.hbar .hb-fill { height: 100%; background: var(--primary); border-radius: 0 4px 4px 0; min-width: 2px; transition: width .7s var(--ease); }
.hbar .hb-value { width: 92px; flex: 0 0 auto; text-align: right; font-size: 11px; font-weight: 900; color: var(--text-body); font-variant-numeric: tabular-nums; }
.hbar .hb-value small { display: block; font-size: 10px; font-weight: 600; color: var(--text-muted); }
.chart { position: relative; }
.chart svg { display: block; width: 100%; overflow: visible; }
.chart .axis text { font-size: 10px; fill: var(--text-muted); font-family: var(--font-sans); font-variant-numeric: tabular-nums; }
.chart .grid-line { stroke: var(--border-soft); stroke-width: 1; }
.chart .baseline { stroke: var(--border); stroke-width: 1; }
.chart .hit { fill: transparent; cursor: crosshair; }
.chart .crosshair { stroke: var(--text-faint); stroke-width: 1; }
.chart-tip { position: absolute; pointer-events: none; background: #fff; border: 1px solid var(--border); border-radius: var(--radius-xl); box-shadow: var(--shadow-lg); padding: 10px 12px; font-size: 11px; z-index: 5; min-width: 150px; opacity: 0; transition: opacity .1s; }
.chart-tip.show { opacity: 1; }
.chart-tip .tt-date { font-size: 9px; font-weight: 900; text-transform: uppercase; letter-spacing: .1em; color: var(--text-muted); margin-bottom: 6px; }
.chart-tip .tt-row { display: flex; align-items: center; gap: 8px; margin-top: 3px; }
.chart-tip .tt-key { width: 12px; height: 2px; border-radius: 2px; flex: 0 0 auto; }
.chart-tip .tt-val { font-weight: 900; color: var(--text-main); font-variant-numeric: tabular-nums; min-width: 28px; }
.chart-tip .tt-name { color: var(--text-secondary); }
.legend { display: flex; gap: 14px; flex-wrap: wrap; font-size: 11px; font-weight: 700; color: var(--text-secondary); }
.legend span { display: inline-flex; align-items: center; gap: 6px; }
.legend i { width: 14px; height: 2px; border-radius: 2px; display: inline-block; }
.legend i.rect { width: 10px; height: 10px; border-radius: 3px; }
.chart-table { margin-top: 12px; max-height: 260px; overflow: auto; border: 1px solid var(--border-soft); border-radius: var(--radius-xl); }
.chart-table table { width: 100%; border-collapse: collapse; font-size: 11px; }
.chart-table th { position: sticky; top: 0; background: var(--inset); text-align: right; padding: 6px 10px; font-size: 9px; font-weight: 900; text-transform: uppercase; letter-spacing: .08em; color: var(--text-secondary); }
.chart-table th:first-child, .chart-table td:first-child { text-align: left; }
.chart-table td { padding: 5px 10px; text-align: right; border-top: 1px solid var(--border-soft); font-variant-numeric: tabular-nums; color: var(--text-body); }
.funnel .step { display: grid; grid-template-columns: 130px 1fr 110px; align-items: center; gap: 12px; }
.funnel .step + .step { margin-top: 12px; }
.funnel .f-label { font-size: 11px; font-weight: 900; text-transform: uppercase; letter-spacing: .06em; color: var(--text-secondary); }
.funnel .f-track { height: 28px; background: var(--muted-bg); border-radius: 8px; overflow: hidden; }
.funnel .f-fill { height: 100%; background: var(--primary); border-radius: 0 4px 4px 0; transition: width .8s var(--ease); }
.funnel .f-val { text-align: right; font-size: 13px; font-weight: 900; color: var(--text-main); font-variant-numeric: tabular-nums; }
.funnel .f-val small { font-size: 10px; color: var(--text-muted); font-weight: 700; margin-left: 4px; }

/* ---------- Timeline (ficha de contacto) ---------- */
.timeline { position: relative; }
.tl-item { display: flex; gap: 12px; position: relative; padding-bottom: 16px; }
.tl-item::before { content: ""; position: absolute; left: 15px; top: 34px; bottom: 0; width: 1px; background: var(--border-soft); }
.tl-item:last-child::before { display: none; }
.tl-icon { width: 30px; height: 30px; border-radius: 10px; display: grid; place-items: center; flex: 0 0 auto; background: var(--muted-bg); color: var(--text-secondary); }
.tl-icon .ms { font-size: 16px; }
.tl-icon.primary { background: var(--primary-10); color: var(--primary); }
.tl-icon.success { background: var(--success-chip); color: var(--success-600); }
.tl-icon.info { background: var(--info-chip); color: var(--info); }
.tl-icon.warning { background: var(--warning-chip); color: var(--warning-text); }
.tl-icon.danger { background: var(--danger-chip); color: var(--danger-600); }
.tl-body { flex: 1; min-width: 0; padding-top: 4px; }
.tl-title { font-size: 13px; color: var(--text-body); line-height: 1.45; }
.tl-title b { color: var(--text-strong); font-weight: 700; }
.tl-meta { font-size: 10px; color: var(--text-muted); margin-top: 2px; font-weight: 600; }
.tl-note { margin-top: 6px; padding: 10px 12px; border-radius: var(--radius-xl); background: var(--warning-soft); border: 1px solid var(--warning-border); font-size: 13px; color: var(--text-body); white-space: pre-wrap; }

.profile-head { display: flex; align-items: center; gap: 16px; }
.avatar-lg { width: 56px; height: 56px; border-radius: var(--radius-2xl); background: var(--grad-brand); color: #fff; font-size: 20px; font-weight: 900; display: grid; place-items: center; box-shadow: var(--shadow-primary-lg); flex: 0 0 auto; }
.kv { display: grid; grid-template-columns: 120px minmax(0, 1fr); gap: 8px 12px; font-size: 13px; }
.kv dt { font-size: 10px; font-weight: 900; text-transform: uppercase; letter-spacing: .05em; color: var(--text-muted); padding-top: 2px; }
.kv dd { margin: 0; color: var(--text-body); word-break: break-word; }
.side-list .item { display: flex; align-items: center; gap: 10px; padding: 10px 0; }
.side-list .item + .item { border-top: 1px solid var(--border-soft); }

/* ---------- Kanban ---------- */
.kanban { display: flex; gap: 16px; overflow-x: auto; padding-bottom: 12px; align-items: flex-start; }
.k-col { width: 280px; flex: 0 0 auto; display: flex; flex-direction: column; }
.k-head { display: flex; align-items: center; gap: 8px; padding: 10px 12px; border-radius: 12px 12px 0 0; background: linear-gradient(to bottom, var(--k-soft, rgba(255, 92, 53, .1)), transparent); border-bottom: 2px solid var(--k-color, var(--primary)); }
.k-head .k-name { font-size: 11px; font-weight: 900; text-transform: uppercase; letter-spacing: .03em; color: var(--text-body); }
.k-head .k-count { margin-left: auto; font-size: 11px; font-weight: 900; color: var(--text-muted); background: #fff; border: 1px solid var(--border); border-radius: 999px; padding: 0 8px; }
.k-sum { font-size: 10px; font-weight: 700; color: var(--text-muted); padding: 6px 12px 0; font-variant-numeric: tabular-nums; }
.k-body { display: flex; flex-direction: column; gap: 8px; padding: 8px; border-radius: 0 0 12px 12px; min-height: 140px; max-height: calc(100dvh - 300px); overflow-y: auto; background: rgba(248, 250, 252, .7); transition: background .15s, box-shadow .15s; }
.k-body.drop { background: var(--primary-10); box-shadow: inset 0 0 0 2px rgba(255, 92, 53, .4); }
.k-card { background: #fff; border: 1px solid var(--border); border-radius: var(--radius-xl); padding: 12px; cursor: grab; transition: border-color .15s, box-shadow .15s; }
.k-card:hover { border-color: var(--border-strong); box-shadow: var(--shadow-card); }
.k-card.dragging { opacity: .5; }
.k-card .k-title { font-size: 13px; font-weight: 700; color: var(--text-strong); line-height: 1.35; }
.k-card .k-contact { font-size: 11px; color: var(--text-muted); margin-top: 2px; }
.k-card .k-meta { display: flex; align-items: center; justify-content: space-between; margin-top: 10px; gap: 8px; }
.k-card .k-value { font-size: 13px; font-weight: 900; color: var(--text-main); font-variant-numeric: tabular-nums; }
.k-card .k-date { display: inline-flex; align-items: center; gap: 4px; font-size: 10px; font-weight: 700; color: var(--text-secondary); }
.k-card .k-date .ms { font-size: 14px; }
.k-card .k-date.soon { color: var(--warning-text); }
.k-head .k-name { min-width: 0; }
/* Pipeline de SAP en solo lectura: las tarjetas abren la ficha, no se arrastran */
.kanban.readonly .k-card { cursor: pointer; }
.kanban.readonly .k-card:focus-visible { outline: none; border-color: var(--primary); box-shadow: var(--ring-focus); }

/* ---------- Base legal y orígenes (ficha de contacto, ajustes) ---------- */
.source-list .item .icon-tile.sm { width: 28px; height: 28px; border-radius: 8px; }
.basis-grid { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 12px; }
.basis-grid .tile { display: flex; flex-direction: column; gap: 8px; }
.basis-grid .tile p { font-size: 12px; line-height: 1.55; color: var(--text-body-2); }
.basis-grid .tile > a { margin-top: auto; display: inline-flex; align-items: center; gap: 2px; }
@media (max-width: 1023px) { .basis-grid { grid-template-columns: minmax(0, 1fr); } }
/* Almacenamiento: barra apilada marketing / resto de la base respecto al límite del plan */
.storage-meter { display: flex; gap: 2px; height: 10px; border-radius: 999px; background: var(--muted-bg); overflow: hidden; }
.storage-meter > span { display: block; height: 100%; min-width: 0; }
.storage-meter .s-mkt { background: var(--primary); }
.storage-meter .s-other { background: var(--text-muted); }
.storage-legend { display: flex; flex-wrap: wrap; gap: 6px 18px; font-size: 12px; color: var(--text-body-2); }
.storage-legend span { display: inline-flex; align-items: center; gap: 6px; }
.storage-legend b { color: var(--text-strong); font-variant-numeric: tabular-nums; }
.storage-legend i { width: 10px; height: 10px; border-radius: 3px; flex: 0 0 auto; }
.storage-legend i.s-mkt { background: var(--primary); }
.storage-legend i.s-other { background: var(--text-muted); }
.storage-legend i.s-free { background: var(--muted-bg); box-shadow: inset 0 0 0 1px var(--border); }
.stat-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: 8px; }
.stat-grid .tile { padding: 12px 14px; }
.stat-grid .v { font-size: 20px; font-weight: 900; color: var(--text-main); letter-spacing: -.02em; font-variant-numeric: tabular-nums; }
.stat-grid .l { font-size: 9px; font-weight: 900; text-transform: uppercase; letter-spacing: .08em; color: var(--text-muted); margin-top: 2px; }
.excluded-list { list-style: none; margin: 10px 0 0; padding: 0; display: flex; flex-direction: column; gap: 4px; font-size: 12px; color: var(--text-body-2); }
.excluded-list li { display: flex; align-items: center; gap: 6px; }
.excluded-list li .ms { font-size: 15px; color: var(--text-muted); }
.excluded-list b { font-variant-numeric: tabular-nums; color: var(--text-strong); }
.node.unavailable { border-style: dashed; border-color: var(--danger-border); background: var(--danger-soft); }
.node.unavailable .n-sub { color: var(--danger-text); }

/* ---------- Constructor de automatizaciones ---------- */
.flow-wrap { background: #fff; border: 1px solid var(--border); border-radius: var(--radius-3xl); box-shadow: var(--shadow-card); overflow: auto; min-height: 60vh; background-image: radial-gradient(#e2e8f0 1px, transparent 1px); background-size: 24px 24px; background-color: #fcfcfc; }
.flow { display: flex; flex-direction: column; align-items: center; padding: 32px 24px 48px; min-width: max-content; margin: 0 auto; }
.flow-branch { display: flex; flex-direction: column; align-items: center; }
.node { width: 300px; background: #fff; border: 1px solid var(--border); border-radius: var(--radius-2xl); box-shadow: var(--shadow-card); padding: 12px 14px; display: flex; gap: 12px; align-items: flex-start; cursor: pointer; transition: border-color .15s, box-shadow .15s, transform .15s; position: relative; }
.node:hover { border-color: var(--primary-30); box-shadow: var(--shadow-float); }
.node.trigger { border: 1px dashed var(--primary); background: linear-gradient(#fff, #fff7f4); }
.node .n-body { flex: 1; min-width: 0; }
.node .n-kind { font-size: 9px; font-weight: 900; text-transform: uppercase; letter-spacing: .1em; color: var(--text-muted); }
.node .n-title { font-size: 13px; font-weight: 700; color: var(--text-strong); line-height: 1.35; margin-top: 1px; }
.node .n-sub { font-size: 11px; color: var(--text-secondary); margin-top: 3px; line-height: 1.4; word-break: break-word; }
.node .n-stats { display: flex; gap: 6px; margin-top: 8px; flex-wrap: wrap; }
.node .n-actions { position: absolute; top: 6px; right: 6px; display: none; gap: 2px; background: #fff; border-radius: 8px; }
.node:hover .n-actions { display: flex; }
.node .n-actions button { width: 24px; height: 24px; border-radius: 6px; border: 0; background: transparent; color: var(--text-muted); cursor: pointer; display: grid; place-items: center; }
.node .n-actions button:hover { background: var(--muted-bg); color: var(--text-strong); }
.node .n-actions button.del:hover { background: var(--danger-chip); color: var(--danger-600); }
.node .n-actions .ms { font-size: 15px; }
.node.end { width: auto; padding: 8px 18px; border-radius: 999px; background: var(--dark); color: #fff; border-color: var(--dark); cursor: default; align-items: center; }
.node.end .n-title { color: #fff; font-size: 11px; text-transform: uppercase; letter-spacing: .1em; font-weight: 900; }
.connector { width: 2px; height: 18px; background: var(--border-strong); }
.add-step { width: 26px; height: 26px; border-radius: 50%; border: 1px solid var(--border-strong); background: #fff; color: var(--text-muted); display: grid; place-items: center; cursor: pointer; transition: all .15s; box-shadow: var(--shadow-sm); }
.add-step:hover { background: var(--primary); border-color: var(--primary); color: #fff; transform: scale(1.1); }
.add-step .ms { font-size: 16px; }
.split { display: flex; gap: 32px; align-items: flex-start; position: relative; padding-top: 18px; }
.split::before { content: ""; position: absolute; top: 0; left: var(--split-l, 25%); right: var(--split-r, 25%); height: 2px; background: var(--border-strong); }
.split > .flow-branch { position: relative; }
.split > .flow-branch::before { content: ""; position: absolute; top: -18px; left: 50%; width: 2px; height: 18px; background: var(--border-strong); }
.branch-label { font-size: 9px; font-weight: 900; text-transform: uppercase; letter-spacing: .1em; padding: 2px 10px; border-radius: 999px; margin-bottom: 0; }
.branch-label.yes { background: var(--success-chip); color: var(--success-text); }
.branch-label.no { background: var(--danger-chip); color: var(--danger-text); }
.branch-label.a { background: var(--info-chip); color: var(--info-text); }
.merge { width: 100%; height: 2px; background: var(--border-strong); }
.step-picker { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 8px; }
.step-picker .sp-group { grid-column: 1 / -1; font-size: 9px; font-weight: 900; text-transform: uppercase; letter-spacing: .1em; color: var(--text-muted); margin-top: 8px; }
.step-picker button { display: flex; align-items: center; gap: 10px; padding: 10px 12px; border-radius: var(--radius-xl); border: 1px solid var(--border-soft); background: #fff; cursor: pointer; text-align: left; transition: all .15s; }
.step-picker button:hover { border-color: var(--primary-30); background: var(--primary-5); }
.step-picker .sp-name { font-size: 12px; font-weight: 700; color: var(--text-strong); }
.step-picker .sp-desc { font-size: 10px; color: var(--text-muted); line-height: 1.3; }

/* ---------- Constructor de reglas ---------- */
.rules { display: flex; flex-direction: column; gap: 8px; }
.rules .r-head { display: flex; align-items: center; gap: 8px; font-size: 12px; color: var(--text-secondary); font-weight: 600; flex-wrap: wrap; }
.rules .r-group { border: 1px dashed var(--border-strong); border-radius: var(--radius-xl); padding: 10px; background: var(--inset); }
.rules .r-row { display: flex; gap: 6px; align-items: center; flex-wrap: wrap; background: #fff; border: 1px solid var(--border-soft); border-radius: var(--radius-xl); padding: 8px; }
.rules .r-row .select, .rules .r-row .input { width: auto; min-width: 120px; flex: 1 1 140px; }
.rules .r-row .input.num-in { flex: 0 0 90px; min-width: 70px; }
.rules .r-join { font-size: 9px; font-weight: 900; text-transform: uppercase; letter-spacing: .1em; color: var(--text-muted); padding-left: 10px; }

/* ---------- Editor de email ---------- */
.email-editor { display: grid; grid-template-columns: minmax(340px, 440px) minmax(0, 1fr); gap: 16px; min-height: 0; }
@media (max-width: 1023px) { .email-editor { grid-template-columns: minmax(0, 1fr); } }
.ee-blocks { display: flex; flex-direction: column; gap: 8px; }
.ee-block { background: #fff; border: 1px solid var(--border); border-radius: var(--radius-xl); overflow: hidden; }
.ee-block.open { border-color: var(--primary-30); box-shadow: var(--shadow-card); }
.ee-bhead { display: flex; align-items: center; gap: 8px; padding: 8px 10px; cursor: pointer; }
.ee-bhead .ms { font-size: 18px; color: var(--text-muted); }
.ee-bhead .ee-name { font-size: 11px; font-weight: 900; text-transform: uppercase; letter-spacing: .05em; color: var(--text-secondary); }
.ee-bhead .ee-sum { flex: 1; min-width: 0; font-size: 12px; color: var(--text-muted); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.ee-bbody { padding: 4px 12px 12px; display: flex; flex-direction: column; gap: 10px; border-top: 1px solid var(--border-soft); padding-top: 12px; }
.ee-add { display: flex; flex-wrap: wrap; gap: 6px; padding: 10px; border: 1px dashed var(--border-strong); border-radius: var(--radius-xl); }
.ee-preview { background: var(--muted-bg); border: 1px solid var(--border); border-radius: var(--radius-3xl); overflow: hidden; display: flex; flex-direction: column; min-height: 560px; position: sticky; top: 0; }
.ee-preview .pv-bar { display: flex; align-items: center; gap: 8px; padding: 10px 14px; background: #fff; border-bottom: 1px solid var(--border-soft); }
.ee-preview .pv-subject { font-size: 13px; font-weight: 700; color: var(--text-strong); }
.ee-preview .pv-pre { font-size: 11px; color: var(--text-muted); }
.ee-preview iframe { flex: 1; width: 100%; border: 0; background: #f1f4ef; min-height: 560px; }
.ee-preview.mobile iframe { width: 390px; margin: 16px auto; border-radius: 24px; box-shadow: var(--shadow-xl); flex: 0 0 auto; height: 700px; }
.text-toolbar { display: flex; gap: 2px; margin-bottom: 4px; flex-wrap: wrap; }
.text-toolbar button { height: 26px; min-width: 26px; padding: 0 6px; border-radius: 6px; border: 1px solid var(--border-soft); background: #fff; cursor: pointer; font-size: 11px; font-weight: 800; color: var(--text-secondary); }
.text-toolbar button:hover { background: var(--muted-bg); color: var(--text-strong); }

/* ---------- Asistente de campaña ---------- */
.stepper { display: flex; gap: 8px; flex-wrap: wrap; margin-bottom: 20px; }
.stepper button { display: flex; align-items: center; gap: 8px; padding: 8px 14px 8px 8px; border-radius: 999px; border: 1px solid var(--border); background: #fff; cursor: pointer; font-size: 12px; font-weight: 700; color: var(--text-secondary); }
.stepper button .n { width: 22px; height: 22px; border-radius: 50%; background: var(--muted-bg); display: grid; place-items: center; font-size: 11px; font-weight: 900; }
.stepper button.active { border-color: var(--primary); color: var(--text-strong); box-shadow: var(--ring-focus); }
.stepper button.active .n { background: var(--primary); color: #fff; }
.stepper button.done .n { background: var(--success-chip); color: var(--success-600); }
.pick-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(220px, 1fr)); gap: 8px; }
.pick { display: flex; align-items: center; gap: 10px; padding: 12px; border-radius: var(--radius-xl); border: 1px solid var(--border); background: #fff; cursor: pointer; transition: all .15s; }
.pick:hover { border-color: var(--border-strong); }
.pick.on { border-color: var(--primary); background: var(--primary-5); box-shadow: var(--ring-focus); }
.pick input { accent-color: var(--primary); width: 16px; height: 16px; }
.pick .pk-name { display: block; font-size: 13px; font-weight: 700; color: var(--text-strong); }
.pick .pk-sub { display: block; font-size: 11px; color: var(--text-muted); margin-top: 1px; }
.big-choice { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 12px; }
.big-choice button { text-align: left; padding: 20px; border-radius: var(--radius-3xl); border: 1px solid var(--border); background: #fff; cursor: pointer; transition: all .15s; }
.big-choice button:hover { border-color: var(--primary-30); box-shadow: var(--shadow-float); transform: translateY(-2px); }
.big-choice .bc-title { font-size: 15px; font-weight: 900; color: var(--text-main); margin-top: 12px; }
.big-choice .bc-desc { font-size: 12px; color: var(--text-secondary); margin-top: 4px; line-height: 1.45; }
.recipe { display: flex; flex-direction: column; gap: 10px; padding: 18px; border-radius: var(--radius-3xl); border: 1px solid var(--border); background: #fff; cursor: pointer; transition: all .2s var(--ease); text-align: left; }
.recipe:hover { border-color: var(--primary-30); box-shadow: var(--shadow-float); transform: translateY(-2px); }
.recipe .rc-title { font-size: 14px; font-weight: 900; color: var(--text-main); letter-spacing: -.01em; }
.recipe .rc-desc { font-size: 12px; color: var(--text-secondary); line-height: 1.5; }
.callout { display: flex; gap: 10px; padding: 12px 14px; border-radius: var(--radius-xl); font-size: 12px; line-height: 1.5; }
.callout .ms { font-size: 18px; flex: 0 0 auto; }
.callout.warn { background: var(--warning-soft); border: 1px solid var(--warning-border); color: var(--warning-text); }
.callout.info { background: var(--info-soft); border: 1px solid var(--info-border); color: var(--info-text); }
.callout.ok { background: var(--success-soft); border: 1px solid var(--success-border); color: var(--success-text); }
.callout.danger { background: var(--danger-soft); border: 1px solid var(--danger-border); color: var(--danger-text); }
.code { font-family: var(--font-mono); font-size: 11.5px; background: var(--dark); color: #e2e8f0; border-radius: var(--radius-xl); padding: 12px 14px; white-space: pre-wrap; word-break: break-all; line-height: 1.55; position: relative; }
.code-inline { font-family: var(--font-mono); font-size: 11px; background: var(--muted-bg); border-radius: 4px; padding: 1px 5px; color: var(--text-body); }
.var-chips { display: flex; flex-wrap: wrap; gap: 4px; }
.var-chips button { font-family: var(--font-mono); font-size: 10px; border: 1px solid var(--border); background: #fff; color: var(--text-secondary); border-radius: 6px; padding: 2px 6px; cursor: pointer; }
.var-chips button:hover { border-color: var(--primary); color: var(--primary); }
.pager { display: flex; gap: 4px; align-items: center; }
.login-wrap { position: fixed; inset: 0; z-index: 90; display: grid; place-items: center; padding: 16px; background-color: #f8fafc; background-image: radial-gradient(#e2e8f0 1px, transparent 1px); background-size: 32px 32px; }
.login-card { width: 100%; max-width: 420px; background: #fff; border: 1px solid var(--border); border-radius: var(--radius-card-xl); box-shadow: var(--shadow-float); padding: 40px; }
.login-card .input { padding: 16px 18px 16px 46px; border-radius: var(--radius-2xl); border-width: 2px; border-color: transparent; font-size: 14px; }
.login-card .input:focus { border-color: var(--primary-20); box-shadow: 0 0 0 4px var(--primary-5); }

/* ---------- Móvil ---------- */
.menu-btn { display: none; }
@media (max-width: 767px) {
  .menu-btn { display: inline-flex; }
  .rail { position: fixed; top: var(--header-h); bottom: 0; left: 0; width: 220px; align-items: stretch; transform: translateX(-100%); transition: transform .2s var(--ease); box-shadow: var(--shadow-xl); padding: 12px; }
  .rail.open { transform: none; }
  .rail a { width: 100%; justify-content: flex-start; gap: 12px; padding: 0 12px; }
  .rail a .tip { display: none; }
  .rail .label-mobile { display: inline; font-size: 13px; font-weight: 700; }
  .rail .sep { width: 100%; }
  .search-trigger { min-width: 0; } .search-trigger .grow, .search-trigger .kbd { display: none; }
  .header-center, .user-block .who { display: none; }
  .wordmark .b { display: none; }
  .page { padding: 16px; }
  .page-title { font-size: 20px; line-height: 28px; }
  .toolbar .input-icon { min-width: 0; max-width: none; width: 100%; }
  .hbar .hb-label { width: 96px; }
  .funnel .step { grid-template-columns: 90px 1fr 80px; }
  .big-choice { grid-template-columns: minmax(0, 1fr); }
  .toasts { left: 16px; } .toast { min-width: 0; }
}
