/* CRM Factory — identidad DesHumo: claro, ordenado, sin humo. Sin azul. */
:root {
  --humo: #f5f5f5;
  --white: #ffffff;
  --carbon: #0f0f0f;
  --ink-2: #2b2b2b;
  --gris: #6b6b6b;
  --niebla: #d1d1d1;
  --line: #e4e4e4;
  --grid: #ececec;
  --llama: #ffcd57;
  --llama-soft: #fff4d6;
  --quemado: #c1453f;
  --quemado-soft: #f7e3e1;

  --brand: #ffcd57;
  --brand-strong: #0f0f0f;
  --brand-ink: #0f0f0f;
  --brand-soft: #fff4d6;

  --font: "Archivo", "Helvetica Neue", Helvetica, sans-serif;
  --mono: "JetBrains Mono", ui-monospace, Menlo, monospace;
  --radius: 10px;
  --radius-sm: 6px;
  --shadow: 0 1px 0 rgba(15, 15, 15, 0.04), 0 8px 24px -16px rgba(15, 15, 15, 0.18);
  --gutter: clamp(16px, 3vw, 32px);
  color-scheme: light;
}

* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0;
  background: var(--humo);
  color: var(--carbon);
  font-family: var(--font);
  font-size: 15px;
  line-height: 1.45;
  font-variation-settings: "wdth" 100;
  -webkit-font-smoothing: antialiased;
  overflow-x: hidden;
}
a { color: inherit; }
button, input, select, textarea { font: inherit; color: inherit; }
:focus-visible { outline: 2px solid var(--carbon); outline-offset: 2px; }
::selection { background: var(--llama); color: var(--carbon); }

.display {
  font-variation-settings: "wdth" 125;
  font-weight: 800;
  letter-spacing: -0.02em;
  line-height: 1.02;
}
.mono { font-family: var(--mono); font-size: 0.86em; letter-spacing: 0; }
.muted { color: var(--gris); }
.num { font-variant-numeric: tabular-nums; }
[hidden] { display: none !important; }
.sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }

/* ---------- barra superior ---------- */
.topbar {
  position: sticky; top: 0; z-index: 30;
  display: flex; align-items: center; gap: 24px;
  padding: 0 var(--gutter);
  height: 60px;
  background: rgba(245, 245, 245, 0.92);
  backdrop-filter: blur(8px);
  border-bottom: 1px solid var(--niebla);
}
.topbar::before {
  content: ""; position: absolute; inset: 0 0 auto 0; height: 4px; background: var(--llama);
}
.wordmark { display: flex; align-items: center; gap: 10px; text-decoration: none; }
.wordmark__logo { height: 30px; width: auto; filter: invert(1); display: block; }
.wordmark__mark { position: relative; width: 26px; height: 26px; background: var(--carbon); border-radius: 5px; }
.wordmark__mark i { position: absolute; display: block; }
.wordmark__mark i:first-child { left: 5px; top: 5px; width: 16px; height: 5px; background: var(--llama); }
.wordmark__mark i:last-child { left: 5px; top: 13px; width: 9px; height: 8px; background: var(--humo); }
.wordmark__text { white-space: nowrap; font-weight: 800; font-variation-settings: "wdth" 125; font-size: 17px; letter-spacing: -0.01em; }
.wordmark__by { font-size: 12px; color: var(--gris); padding-left: 10px; border-left: 1px solid var(--niebla); }
.topnav { display: flex; gap: 4px; }
.topnav a {
  white-space: nowrap; text-decoration: none; padding: 7px 12px; border-radius: 999px; font-weight: 600; font-size: 14px; color: var(--ink-2);
}
.topnav a:hover { background: var(--white); }
.topnav a.is-active { background: var(--carbon); color: var(--humo); }
.topbar__right { margin-left: auto; display: flex; align-items: center; gap: 14px; }
.ai-pill {
  font-size: 12px; font-weight: 600; padding: 5px 10px; border-radius: 999px;
  border: 1px solid var(--niebla); background: var(--white); white-space: nowrap;
}
.ai-pill.is-on { background: var(--carbon); color: var(--humo); border-color: var(--carbon); }
.ai-pill.is-on::before { content: ""; display: inline-block; width: 7px; height: 7px; border-radius: 50%; background: var(--llama); margin-right: 7px; }
.clock { font-family: var(--mono); font-size: 12px; color: var(--gris); }

main { padding: 28px var(--gutter) 80px; max-width: 1480px; margin: 0 auto; outline: none; }

/* ---------- botones y formularios ---------- */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  height: 40px; padding: 0 16px; border-radius: 8px; border: 1px solid var(--carbon);
  background: var(--carbon); color: var(--humo); font-weight: 700; font-size: 14px;
  cursor: pointer; text-decoration: none; white-space: nowrap;
  transition: transform 0.12s ease, background 0.15s ease;
}
.btn:hover { transform: translateY(-1px); }
.btn:active { transform: translateY(0); }
.btn[disabled] { opacity: 0.45; cursor: not-allowed; transform: none; }
.btn--accent { background: var(--llama); border-color: var(--llama); color: var(--carbon); }
.btn--ghost { background: transparent; color: var(--carbon); border-color: var(--niebla); }
.btn--ghost:hover { border-color: var(--carbon); background: var(--white); }
.btn--danger { background: var(--white); color: var(--quemado); border-color: var(--quemado); }
.btn--sm { height: 32px; padding: 0 12px; font-size: 13px; border-radius: 7px; }
.btn--block { width: 100%; }

.field { display: grid; gap: 6px; }
.field > span:not(.hint) { font-size: 12px; font-weight: 700; text-transform: uppercase; letter-spacing: 0.06em; color: var(--ink-2); }
.input, .textarea, .select {
  width: 100%; min-height: 42px; padding: 9px 12px; border: 1px solid var(--niebla); border-radius: 8px;
  background: var(--white); outline: none; transition: border-color 0.15s ease, box-shadow 0.15s ease;
}
.textarea { min-height: 110px; resize: vertical; line-height: 1.45; }
.input:focus, .textarea:focus, .select:focus { border-color: var(--carbon); box-shadow: 0 0 0 3px var(--llama-soft); }
.hint { font-size: 12px; color: var(--gris); }
.check { display: flex; gap: 10px; align-items: flex-start; font-size: 14px; cursor: pointer; }
.check input { width: 18px; height: 18px; accent-color: var(--carbon); margin-top: 1px; }

.chips { display: flex; flex-wrap: wrap; gap: 8px; }
.chip {
  border: 1px solid var(--niebla); background: var(--white); border-radius: 999px; padding: 6px 12px;
  font-size: 13px; font-weight: 600; cursor: pointer; transition: all 0.15s ease;
}
.chip:hover { border-color: var(--carbon); }
.chip.is-on { background: var(--carbon); border-color: var(--carbon); color: var(--humo); }

.switch { display: inline-flex; align-items: center; gap: 10px; font-size: 13px; font-weight: 600; cursor: pointer; user-select: none; }
.switch input { position: absolute; opacity: 0; pointer-events: none; }
.switch__track { width: 38px; height: 22px; border-radius: 999px; background: var(--niebla); position: relative; transition: background 0.2s ease; }
.switch__track::after { content: ""; position: absolute; top: 3px; left: 3px; width: 16px; height: 16px; border-radius: 50%; background: var(--white); transition: transform 0.2s ease; box-shadow: 0 1px 2px rgba(0,0,0,.2); }
.switch input:checked + .switch__track { background: var(--carbon); }
.switch input:checked + .switch__track::after { transform: translateX(16px); background: var(--llama); }
.switch input:focus-visible + .switch__track { outline: 2px solid var(--carbon); outline-offset: 2px; }

/* ---------- semáforo DesHumo ---------- */
.status {
  display: inline-flex; align-items: center; gap: 6px; padding: 3px 8px; border-radius: 4px;
  font-size: 11px; font-weight: 800; letter-spacing: 0.06em; text-transform: uppercase; white-space: nowrap;
}
.status--ok { background: var(--llama); color: var(--carbon); }
.status--mejorar { background: var(--niebla); color: var(--carbon); }
.status--critico { background: var(--quemado); color: var(--humo); }

/* ---------- tarjetas ---------- */
.card { background: var(--white); border: 1px solid var(--line); border-radius: var(--radius); box-shadow: var(--shadow); }
.card__head { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 16px 18px 0; }
.card__title { margin: 0; font-size: 14px; font-weight: 800; letter-spacing: 0.01em; }
.card__sub { font-size: 12px; color: var(--gris); }
.card__body { padding: 14px 18px 18px; }
.seg { display: inline-flex; border: 1px solid var(--niebla); border-radius: 7px; overflow: hidden; }
.seg button { border: 0; background: transparent; padding: 4px 10px; font-size: 12px; font-weight: 600; cursor: pointer; color: var(--gris); }
.seg button.is-on { background: var(--carbon); color: var(--humo); }

/* ---------- planta (consola) ---------- */
.hero { display: grid; grid-template-columns: minmax(0, 1.4fr) minmax(0, 1fr); gap: 32px; align-items: end; margin-bottom: 26px; }
.hero h1 { font-size: clamp(38px, 6vw, 76px); margin: 0; }
.hero h1 em { font-style: normal; background: linear-gradient(transparent 62%, var(--llama) 62%, var(--llama) 92%, transparent 92%); padding: 0 4px; }
.hero p { margin: 14px 0 0; font-size: 17px; color: var(--ink-2); max-width: 46ch; }
.stats { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); border-top: 2px solid var(--carbon); }
.stat { padding: 14px 14px 4px 0; }
.stat + .stat { padding-left: 14px; border-left: 1px solid var(--niebla); }
.stat__value { font-size: 34px; font-weight: 800; font-variation-settings: "wdth" 110; line-height: 1; }
.stat__label { font-size: 12px; color: var(--gris); margin-top: 6px; }

.ticker {
  display: flex; align-items: center; gap: 16px; min-height: 48px; padding: 0 18px; margin-bottom: 26px;
  background: var(--carbon); color: var(--humo); border-radius: var(--radius); overflow: hidden;
}
.live { display: inline-flex; align-items: center; gap: 8px; font-size: 11px; font-weight: 800; letter-spacing: 0.12em; white-space: nowrap; }
.live::before { content: ""; width: 8px; height: 8px; border-radius: 50%; background: var(--quemado); box-shadow: 0 0 0 0 rgba(193, 69, 63, 0.7); animation: pulse 1.8s infinite; }
.ticker .live { color: var(--llama); }
.ticker__text { flex: 1; min-width: 0; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; font-size: 14px; }
.ticker__text b { color: var(--llama); font-family: var(--mono); font-weight: 600; margin-right: 8px; font-size: 12px; }
.ticker__rate { font-family: var(--mono); font-size: 12px; color: var(--niebla); white-space: nowrap; }
.slide-in { animation: slideIn 0.45s cubic-bezier(.2,.8,.2,1); }

.units { display: grid; grid-template-columns: repeat(auto-fill, minmax(300px, 1fr)); gap: 18px; }
.unit {
  position: relative; display: flex; flex-direction: column; text-decoration: none; overflow: hidden;
  background: var(--white); border: 1px solid var(--line); border-radius: var(--radius); box-shadow: var(--shadow);
  transition: transform 0.18s ease, box-shadow 0.18s ease, border-color 0.18s ease;
  animation: rise 0.5s cubic-bezier(.2,.8,.2,1) both;
}
.unit:hover { transform: translateY(-3px); border-color: var(--niebla); box-shadow: 0 1px 0 rgba(15,15,15,.04), 0 18px 34px -20px rgba(15,15,15,.35); }
.unit__stripe { height: 6px; background: var(--unit-color, var(--llama)); }
.unit__top { display: flex; align-items: flex-start; justify-content: space-between; gap: 10px; padding: 16px 18px 0; }
.plate { font-family: var(--mono); font-size: 11px; font-weight: 600; padding: 3px 7px; border: 1px solid var(--carbon); border-radius: 4px; letter-spacing: 0.04em; }
.unit__name { margin: 12px 18px 2px; font-size: 19px; font-weight: 800; font-variation-settings: "wdth" 112; line-height: 1.15; }
.unit__vertical { margin: 0 18px; font-size: 13px; color: var(--gris); }
.unit__metrics { display: grid; grid-template-columns: 1fr 1fr; gap: 12px 16px; padding: 16px 18px 6px; }
.unit__metric > span { display: block; font-size: 11px; color: var(--gris); text-transform: uppercase; letter-spacing: 0.05em; font-weight: 700; }
.unit__metric strong { display: block; font-size: 18px; font-weight: 800; margin-top: 2px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.unit__metric--lead strong { font-size: 30px; line-height: 1; }
.unit__spark { padding: 4px 18px 0; height: 46px; color: var(--unit-strong, var(--carbon)); }
.unit__foot { display: flex; align-items: center; justify-content: space-between; gap: 10px; margin-top: auto; padding: 12px 18px; border-top: 1px solid var(--line); font-size: 13px; font-weight: 700; }
.unit__foot .arrow { transition: transform 0.18s ease; }
.unit:hover .arrow { transform: translateX(4px); }
.unit--new {
  align-items: center; justify-content: center; text-align: center; min-height: 320px; gap: 10px;
  background: var(--humo);
  border: 2px dashed var(--niebla); box-shadow: none;
}
.unit--new:hover { border-color: var(--carbon); }
.unit--new .plus { width: 52px; height: 52px; border-radius: 50%; background: var(--llama); display: grid; place-items: center; font-size: 30px; font-weight: 800; }
.src-badge { font-size: 11px; font-weight: 800; padding: 3px 8px; border-radius: 999px; background: var(--carbon); color: var(--humo); white-space: nowrap; }
.src-badge::before { content: ""; display: inline-block; width: 6px; height: 6px; border-radius: 50%; background: var(--llama); margin-right: 6px; vertical-align: 1px; }
.src-badge.is-error { background: var(--quemado); }
.badge-red { background: var(--quemado); color: var(--humo); border-radius: 999px; padding: 2px 8px; font-size: 11px; font-weight: 800; }
.flash { animation: flash 1.2s ease; }

/* ---------- orden de fabricación ---------- */
.order { display: grid; grid-template-columns: minmax(0, 0.9fr) minmax(0, 1.1fr); gap: 24px; align-items: start; }
.order__sheet { position: sticky; top: 84px; }
.order__head { display: flex; justify-content: space-between; align-items: center; gap: 12px; padding: 14px 18px; border-bottom: 2px solid var(--carbon); }
.order__head h1 { font-size: 22px; margin: 0; }
.order__form { display: grid; gap: 18px; padding: 18px; }
.colors { display: flex; gap: 8px; flex-wrap: wrap; align-items: center; }
.swatch { width: 30px; height: 30px; border-radius: 50%; border: 2px solid var(--white); box-shadow: 0 0 0 1px var(--niebla); cursor: pointer; }
.swatch.is-on { box-shadow: 0 0 0 2px var(--carbon); }
.colors input[type="color"] { width: 38px; height: 32px; border: 1px solid var(--niebla); border-radius: 6px; background: var(--white); padding: 2px; cursor: pointer; }
.plan-empty { display: grid; place-items: center; text-align: center; min-height: 420px; padding: 40px; color: var(--gris); }
.plan-empty .display { color: var(--carbon); font-size: 28px; margin-bottom: 8px; }
.plan { display: grid; gap: 16px; }
.plan__section { padding: 16px 18px; }
.plan__section h3 { margin: 0 0 10px; font-size: 12px; text-transform: uppercase; letter-spacing: 0.08em; }
.stages { display: flex; flex-wrap: wrap; gap: 0; counter-reset: st; }
.stage-pill {
  position: relative; display: flex; align-items: center; gap: 6px; padding: 8px 18px 8px 14px; margin: 0 6px 6px 0;
  background: var(--humo); border: 1px solid var(--niebla); border-radius: 6px; font-size: 13px; font-weight: 600;
}
.stage-pill input { border: 0; background: transparent; font-weight: 700; field-sizing: content; min-width: 6ch; max-width: 30ch; outline: none; }
.stage-pill small { color: var(--gris); font-family: var(--mono); font-size: 11px; }
.stage-pill--won { background: var(--llama); border-color: var(--llama); }
.stage-pill--lost { background: var(--white); border-style: dashed; }
.kv { display: grid; grid-template-columns: max-content 1fr; gap: 6px 16px; font-size: 14px; }
.kv dt { color: var(--gris); }
.kv dd { margin: 0; font-weight: 600; }
.source-badge { display: inline-flex; align-items: center; gap: 6px; font-size: 12px; font-weight: 700; padding: 4px 10px; border-radius: 999px; background: var(--humo); border: 1px solid var(--niebla); }
.source-badge.is-ai { background: var(--carbon); color: var(--humo); border-color: var(--carbon); }
.build-steps { list-style: none; margin: 0; padding: 0; display: grid; gap: 10px; }
.build-steps li { display: flex; gap: 10px; align-items: center; font-weight: 600; color: var(--gris); }
.build-steps li::before { content: ""; width: 14px; height: 14px; border-radius: 3px; border: 2px solid var(--niebla); }
.build-steps li.is-done { color: var(--carbon); }
.build-steps li.is-done::before { background: var(--llama); border-color: var(--llama); }

/* ---------- CRM del cliente ---------- */
.crm-head { position: relative; display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: 16px 24px; align-items: end; padding: 22px 24px 0; margin-bottom: 22px; background: var(--white); border: 1px solid var(--line); border-radius: var(--radius); box-shadow: var(--shadow); overflow: hidden; }
.crm-head::before { content: ""; position: absolute; inset: 0 0 auto 0; height: 6px; background: var(--brand); }
.crm-head__meta { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; font-size: 13px; color: var(--gris); }
.crm-head h1 { margin: 8px 0 0; font-size: clamp(26px, 3.6vw, 40px); }
.crm-head__actions { display: flex; align-items: center; gap: 14px; flex-wrap: wrap; justify-content: flex-end; padding-bottom: 6px; }
.sync-pill { display: inline-flex; align-items: center; gap: 8px; font-size: 12px; font-weight: 700; padding: 6px 10px; border-radius: 999px; background: var(--humo); border: 1px solid var(--niebla); white-space: nowrap; max-width: 100%; overflow: hidden; text-overflow: ellipsis; }
.sync-pill::before { content: ""; width: 8px; height: 8px; border-radius: 50%; background: var(--llama); flex: none; }
.sync-pill.is-error { border-color: var(--quemado); color: var(--quemado); }
.sync-pill.is-error::before { background: var(--quemado); }
.updated { font-family: var(--mono); font-size: 11px; color: var(--gris); }
.tabs { grid-column: 1 / -1; display: flex; gap: 2px; margin: 8px -24px 0; padding: 0 16px; border-top: 1px solid var(--line); overflow-x: auto; scrollbar-width: none; }
.tabs::-webkit-scrollbar { display: none; }
.tab { position: relative; border: 0; background: none; padding: 14px 12px; font-weight: 700; font-size: 14px; color: var(--gris); cursor: pointer; white-space: nowrap; }
.tab:hover { color: var(--carbon); }
.tab.is-on { color: var(--carbon); }
.tab.is-on::after { content: ""; position: absolute; left: 10px; right: 10px; bottom: 0; height: 3px; background: var(--brand); border-radius: 3px 3px 0 0; }

.alerts { display: grid; grid-template-columns: repeat(auto-fit, minmax(260px, 1fr)); gap: 12px; margin-bottom: 18px; }
.alert { display: grid; gap: 6px; padding: 12px 14px; background: var(--white); border: 1px solid var(--line); border-left: 4px solid var(--niebla); border-radius: 8px; }
.alert--critico { border-left-color: var(--quemado); }
.alert--ok { border-left-color: var(--llama); }
.alert__title { font-weight: 800; font-size: 14px; display: flex; gap: 8px; align-items: center; flex-wrap: wrap; }
.alert__detail { font-size: 13px; color: var(--ink-2); }

.tiles { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 14px; margin-bottom: 18px; }
.tile { position: relative; padding: 16px 16px 14px; display: flex; flex-direction: column; gap: 4px; min-height: 138px; }
.tile__label { font-size: 12px; font-weight: 700; color: var(--ink-2); display: flex; justify-content: space-between; gap: 8px; align-items: center; }
.tile__value { font-size: clamp(24px, 2.4vw, 34px); font-weight: 800; line-height: 1.1; letter-spacing: -0.01em; margin-top: 4px; transition: background 0.4s ease; border-radius: 4px; align-self: flex-start; }
.tile__value.bump { animation: bump 1.1s ease; }
.tile__sub { font-size: 12px; color: var(--gris); }
.tile__delta { font-size: 12px; font-weight: 700; }
.tile__delta--down { color: var(--quemado); }
.tile__spark { height: 30px; margin-top: auto; color: var(--brand-strong); }

.dash { display: grid; grid-template-columns: minmax(0, 1fr) 340px; gap: 18px; align-items: start; }
.dash__main { display: grid; grid-template-columns: minmax(0, 1fr); gap: 18px; min-width: 0; }
.dash__main > * { min-width: 0; }
.dash__row { display: grid; grid-template-columns: minmax(0, 1.25fr) minmax(0, 1fr); gap: 18px; }
.feed { position: sticky; top: 84px; max-height: calc(100vh - 100px); display: flex; flex-direction: column; }
.feed__list { list-style: none; margin: 0; padding: 4px 0 8px; overflow-y: auto; }
.feed__item { display: grid; grid-template-columns: 28px minmax(0, 1fr); gap: 10px; padding: 9px 18px; font-size: 13px; border-bottom: 1px solid var(--line); }
.feed__item:last-child { border-bottom: 0; }
.feed__item.is-new { animation: newItem 1.6s ease; }
.feed__icon { width: 28px; height: 28px; border-radius: 7px; background: var(--humo); display: grid; place-items: center; }
.feed__icon svg { width: 15px; height: 15px; }
.feed__icon--won { background: var(--llama); }
.feed__icon--lost { background: var(--quemado-soft); color: var(--quemado); }
.feed__icon--ai { background: var(--carbon); color: var(--llama); }
.feed__when { display: block; font-family: var(--mono); font-size: 11px; color: var(--gris); margin-top: 2px; }

/* gráficos */
.chart { position: relative; width: 100%; }
.chart svg { display: block; width: 100%; overflow: visible; }
.chart .axis text, .chart text.axis { font-size: 11px; fill: var(--gris); font-family: var(--font); }
.chart .gridline { stroke: var(--grid); stroke-width: 1; }
.chart .baseline { stroke: var(--niebla); stroke-width: 1; }
.chart .label { font-size: 11px; font-weight: 700; fill: var(--carbon); }
.chart .hit { fill: transparent; cursor: crosshair; }
.chart .crosshair { stroke: var(--carbon); stroke-width: 1; opacity: 0; pointer-events: none; }
.chart .marker { fill: var(--carbon); stroke: var(--white); stroke-width: 2; opacity: 0; pointer-events: none; }
.chart.is-hover .crosshair, .chart.is-hover .marker { opacity: 1; }
.bar-col { fill: var(--brand); }
.bar-col.is-today { fill: var(--brand-strong); }

.hbars { display: grid; gap: 10px; }
.hbar { display: grid; grid-template-columns: minmax(90px, 34%) minmax(0, 1fr) auto; gap: 10px; align-items: center; font-size: 13px; cursor: default; }
.hbar__label { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; font-weight: 600; }
.hbar__track { display: block; height: 12px; background: var(--humo); border-radius: 0 4px 4px 0; }
.hbar__fill { display: block; height: 100%; background: var(--brand); border-radius: 0 4px 4px 0; min-width: 2px; transition: width 0.6s cubic-bezier(.2,.8,.2,1); }
.hbar__value { font-variant-numeric: tabular-nums; font-weight: 700; white-space: nowrap; text-align: right; min-width: 3ch; }
.hbar__value small { color: var(--gris); font-weight: 500; margin-left: 6px; }

.table-wrap { overflow-x: auto; }
table.data { width: 100%; border-collapse: collapse; font-size: 13px; font-variant-numeric: tabular-nums; }
table.data th { text-align: left; font-size: 11px; text-transform: uppercase; letter-spacing: 0.06em; color: var(--humo); background: var(--carbon); padding: 9px 12px; white-space: nowrap; }
table.data th:first-child { border-top-left-radius: 6px; }
table.data th:last-child { border-top-right-radius: 6px; }
table.data td { padding: 10px 12px; border-bottom: 1px solid var(--line); white-space: nowrap; }
table.data tbody tr:nth-child(even) td { background: #fafafa; }
table.data tbody tr.is-click { cursor: pointer; }
table.data tbody tr.is-click:hover td { background: var(--llama-soft); }

/* pipeline */
.board-tools { display: flex; justify-content: space-between; gap: 12px; align-items: center; margin-bottom: 14px; flex-wrap: wrap; }
.board { display: grid; grid-auto-flow: column; grid-auto-columns: minmax(268px, 1fr); gap: 14px; overflow-x: auto; padding-bottom: 12px; align-items: start; }
.col { background: #ececec; border-radius: var(--radius); padding: 10px; min-height: 300px; transition: background 0.15s ease, box-shadow 0.15s ease; }
.col.is-over { background: var(--brand-soft); box-shadow: inset 0 0 0 2px var(--brand); }
.col__head { padding: 4px 4px 10px; }
.col__title { display: flex; justify-content: space-between; gap: 8px; font-weight: 800; font-size: 14px; }
.col__meta { font-size: 12px; color: var(--gris); margin-top: 2px; }
.col--won { background: var(--llama-soft); }
.col--lost { background: #f3f3f3; }
.col__cards { display: grid; gap: 8px; }
.dcard { background: var(--white); border: 1px solid var(--line); border-radius: 8px; padding: 10px 11px; cursor: grab; display: grid; gap: 6px; box-shadow: 0 1px 0 rgba(0,0,0,.03); }
.dcard:active { cursor: grabbing; }
.dcard.is-dragging { opacity: 0.4; }
.dcard.is-fresh { animation: newItem 1.6s ease; }
.dcard__title { font-weight: 700; font-size: 13px; line-height: 1.3; }
.dcard__who { font-size: 12px; color: var(--ink-2); }
.dcard__row { display: flex; justify-content: space-between; align-items: center; gap: 8px; font-size: 12px; }
.dcard__value { font-weight: 800; font-variant-numeric: tabular-nums; }
.dcard__src { color: var(--gris); }
.dcard__ai { font-size: 12px; background: var(--humo); border-radius: 6px; padding: 6px 8px; color: var(--ink-2); }
.score { display: inline-flex; align-items: center; gap: 6px; font-size: 11px; font-weight: 700; color: var(--ink-2); }
.score__bar { width: 38px; height: 5px; border-radius: 3px; background: var(--humo); overflow: hidden; }
.score__bar i { display: block; height: 100%; background: var(--carbon); }
.dcard select { font-size: 12px; border: 1px solid var(--line); border-radius: 6px; padding: 3px 6px; background: var(--white); max-width: 100%; }
.more { text-align: center; font-size: 12px; color: var(--gris); padding: 6px; }

/* contactos */
.toolbar { display: flex; gap: 10px; align-items: center; margin-bottom: 14px; flex-wrap: wrap; }
.toolbar .input { max-width: 360px; }
.drawer-bg { position: fixed; inset: 0; background: rgba(15,15,15,.32); z-index: 40; animation: fade 0.2s ease; }
.drawer { position: fixed; top: 0; right: 0; bottom: 0; width: min(520px, 100%); background: var(--white); z-index: 41; overflow-y: auto; box-shadow: -20px 0 40px -20px rgba(0,0,0,.3); animation: drawerIn 0.28s cubic-bezier(.2,.8,.2,1); }
.drawer__head { position: sticky; top: 0; background: var(--white); padding: 18px 22px; border-bottom: 1px solid var(--line); display: flex; justify-content: space-between; gap: 12px; align-items: start; z-index: 1; }
.drawer__head h2 { margin: 0; font-size: 22px; }
.drawer__body { padding: 18px 22px 40px; display: grid; gap: 20px; }
.drawer h3 { margin: 0 0 8px; font-size: 12px; text-transform: uppercase; letter-spacing: 0.08em; }
.timeline { list-style: none; margin: 0; padding: 0; display: grid; gap: 0; border-left: 2px solid var(--line); }
.timeline li { position: relative; padding: 0 0 14px 16px; font-size: 13px; }
.timeline li::before { content: ""; position: absolute; left: -6px; top: 4px; width: 10px; height: 10px; border-radius: 50%; background: var(--niebla); border: 2px solid var(--white); }
.timeline li.t-in::before { background: var(--carbon); }
.timeline li.t-won::before { background: var(--llama); }
.timeline li.t-lost::before { background: var(--quemado); }
.bubble { margin-top: 4px; padding: 8px 10px; background: var(--humo); border-radius: 0 8px 8px 8px; }
.privacy { display: flex; gap: 8px; flex-wrap: wrap; padding: 14px; background: var(--humo); border-radius: 8px; border-left: 4px solid var(--llama); }
.close-x { border: 0; background: var(--humo); width: 34px; height: 34px; border-radius: 50%; cursor: pointer; font-size: 18px; flex: none; }

/* asistente */
.assistant { display: grid; grid-template-columns: minmax(0, 1fr) 300px; gap: 18px; align-items: start; }
.chat { display: flex; flex-direction: column; min-height: 560px; }
.chat__log { flex: 1; padding: 18px; display: grid; gap: 14px; align-content: start; overflow-y: auto; max-height: 62vh; }
.msg { max-width: 82%; padding: 11px 14px; border-radius: 12px; font-size: 14px; white-space: pre-wrap; line-height: 1.5; }
.msg--user { justify-self: end; background: var(--carbon); color: var(--humo); border-bottom-right-radius: 4px; }
.msg--bot { justify-self: start; background: var(--humo); border-bottom-left-radius: 4px; }
.msg__meta { display: block; margin-top: 8px; font-family: var(--mono); font-size: 11px; color: var(--gris); white-space: normal; }
.msg--typing { color: var(--gris); }
.msg--typing::after { content: "…"; animation: blink 1s infinite; }
.chat__form { display: flex; gap: 10px; padding: 14px; border-top: 1px solid var(--line); }
.chat__form .input { flex: 1; }
.suggest { display: grid; gap: 8px; }
.suggest button { text-align: left; border: 1px solid var(--line); background: var(--white); border-radius: 8px; padding: 10px 12px; cursor: pointer; font-size: 13px; font-weight: 600; transition: border-color .15s ease; }
.suggest button:hover { border-color: var(--carbon); }

/* integraciones */
.integrations { display: grid; grid-template-columns: repeat(auto-fill, minmax(340px, 1fr)); gap: 16px; }
.code { position: relative; font-family: var(--mono); font-size: 12px; background: var(--carbon); color: var(--humo); border-radius: 8px; padding: 12px 14px; overflow-x: auto; white-space: pre; line-height: 1.55; }
.code .k { color: var(--llama); }
.endpoint { display: flex; gap: 8px; align-items: center; font-family: var(--mono); font-size: 12px; background: var(--humo); border: 1px solid var(--line); border-radius: 6px; padding: 8px 10px; overflow-x: auto; white-space: nowrap; }
.endpoint b { background: var(--carbon); color: var(--humo); padding: 1px 6px; border-radius: 4px; font-weight: 600; }
.keybox { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; }
.keybox code { font-family: var(--mono); font-size: 13px; padding: 8px 10px; background: var(--humo); border: 1px solid var(--line); border-radius: 6px; word-break: break-all; }
.stack { display: grid; gap: 12px; align-content: start; }
.stack > *, .integrations > *, .grid-2 > * { min-width: 0; }
.grid-2 { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); gap: 18px; }

/* modal */
.modal-bg { position: fixed; inset: 0; background: rgba(15,15,15,.4); z-index: 50; display: grid; place-items: center; padding: 16px; animation: fade .2s ease; }
.modal { width: min(520px, 100%); max-height: calc(100vh - 32px); overflow-y: auto; background: var(--white); border-radius: 14px; box-shadow: 0 30px 60px -20px rgba(0,0,0,.4); animation: rise .3s cubic-bezier(.2,.8,.2,1); }
.modal__head { padding: 18px 20px; border-bottom: 1px solid var(--line); display: flex; justify-content: space-between; align-items: center; }
.modal__head h2 { margin: 0; font-size: 18px; }
.modal__body { padding: 18px 20px; display: grid; gap: 14px; }
.modal__foot { padding: 14px 20px 18px; display: flex; justify-content: flex-end; gap: 10px; }
.row-2 { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }

/* tooltip y toasts */
.tip { position: fixed; z-index: 60; pointer-events: none; background: var(--carbon); color: var(--humo); font-size: 12px; padding: 7px 9px; border-radius: 6px; max-width: 260px; line-height: 1.4; box-shadow: 0 8px 20px -8px rgba(0,0,0,.5); }
.tip b { color: var(--llama); font-weight: 700; }
.toasts { position: fixed; right: 16px; bottom: 16px; z-index: 70; display: grid; gap: 8px; }
.toast { background: var(--carbon); color: var(--humo); padding: 11px 14px; border-radius: 8px; font-size: 13px; font-weight: 600; max-width: 360px; box-shadow: 0 10px 30px -10px rgba(0,0,0,.5); animation: rise .3s ease; border-left: 4px solid var(--llama); }
.toast--error { border-left-color: var(--quemado); }

.empty { padding: 30px; text-align: center; color: var(--gris); }
.section-title { display: flex; align-items: baseline; justify-content: space-between; gap: 12px; margin: 0 0 14px; }
.section-title h2 { margin: 0; font-size: 22px; }
.loading { padding: 60px; text-align: center; color: var(--gris); font-weight: 600; }

/* ---------- portal del cliente ---------- */
.portal-bar { position: sticky; top: 0; z-index: 30; background: var(--carbon); color: var(--humo); border-bottom: 4px solid var(--llama); }
.portal-bar__inner { max-width: 1480px; margin: 0 auto; padding: 12px var(--gutter); display: flex; align-items: center; justify-content: space-between; gap: 16px; }
.portal-logo { height: 46px; width: auto; display: block; }
.portal-bar__status { display: flex; align-items: center; gap: 14px; }
.portal-bar .live { color: var(--llama); }
.portal-bar .updated { color: var(--niebla); }
.portal-hero { display: flex; justify-content: space-between; align-items: flex-end; gap: 20px; flex-wrap: wrap; margin: 6px 0 22px; }
.portal-hero h1 { margin: 4px 0 0; font-size: clamp(32px, 5vw, 60px); }
.portal-kicker { margin: 0; font-size: 12px; font-weight: 800; letter-spacing: 0.12em; text-transform: uppercase; color: var(--gris); }
.portal-tabs { display: flex; gap: 8px; flex-wrap: wrap; }
.portal-crm { padding-bottom: 4px; }
.portal-empty { max-width: 640px; margin: 60px auto; padding: 40px; }
.portal-foot { max-width: 1480px; margin: 0 auto; padding: 28px var(--gutter) 40px; display: flex; gap: 14px; align-items: center; font-size: 13px; color: var(--ink-2); border-top: 1px solid var(--niebla); }
.portal-foot img { height: 34px; width: auto; filter: invert(1); flex: none; }
.portal-foot .muted { display: block; margin-top: 2px; }
.dash--nofeed { grid-template-columns: minmax(0, 1fr); }

/* ---------- período e inversión ---------- */
.period-bar { display: flex; align-items: center; gap: 12px; flex-wrap: wrap; margin-bottom: 14px; }
.period-bar__label { font-size: 12px; font-weight: 800; letter-spacing: 0.08em; text-transform: uppercase; color: var(--gris); }
.seg--period { background: var(--white); }
.seg--period button { padding: 7px 14px; font-size: 13px; }
.spend-table td:not(:first-child), .spend-table th:not(:first-child) { text-align: right; }
.spend-table .spend-name { max-width: 280px; overflow: hidden; text-overflow: ellipsis; font-weight: 600; }
table.data.spend-table th { white-space: normal; vertical-align: bottom; line-height: 1.3; }
table.data.spend-table th:not(:first-child) { min-width: 76px; }
.spend-table tfoot td { font-weight: 800; border-top: 2px solid var(--carbon); border-bottom: 0; background: var(--white); }

/* ---------- compartir con clientes ---------- */
.share-link { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; }
.share-link code { flex: 1; min-width: 0; font-family: var(--mono); font-size: 12px; padding: 9px 10px; background: var(--humo); border: 1px solid var(--line); border-radius: 6px; overflow-x: auto; white-space: nowrap; }
.portal-list { display: grid; gap: 10px; }
.portal-row { display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: 12px; align-items: center; padding: 14px 16px; }
.portal-row__crms { font-size: 13px; color: var(--gris); margin-top: 2px; }
.check-list { display: grid; gap: 8px; max-height: 260px; overflow-y: auto; padding: 4px; }

@keyframes pulse { 0% { box-shadow: 0 0 0 0 rgba(193,69,63,.6); } 70% { box-shadow: 0 0 0 9px rgba(193,69,63,0); } 100% { box-shadow: 0 0 0 0 rgba(193,69,63,0); } }
@keyframes rise { from { opacity: 0; transform: translateY(14px); } to { opacity: 1; transform: none; } }
@keyframes slideIn { from { opacity: 0; transform: translateY(100%); } to { opacity: 1; transform: none; } }
@keyframes flash { 0% { background: var(--llama-soft); } 100% { background: transparent; } }
@keyframes bump { 0% { background: var(--llama); } 100% { background: transparent; } }
@keyframes newItem { 0% { background: var(--llama-soft); } 100% { background: transparent; } }
@keyframes fade { from { opacity: 0; } to { opacity: 1; } }
@keyframes drawerIn { from { transform: translateX(40px); opacity: 0; } to { transform: none; opacity: 1; } }
@keyframes blink { 50% { opacity: 0.2; } }

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: 0.001ms !important; animation-iteration-count: 1 !important; transition-duration: 0.001ms !important; }
}

@media (max-width: 1180px) {
  .dash { grid-template-columns: minmax(0, 1fr); }
  .feed { position: static; max-height: 460px; }
  .tiles { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}
@media (max-width: 920px) {
  .hero, .order, .assistant, .grid-2, .dash__row { grid-template-columns: minmax(0, 1fr); }
  .order__sheet { position: static; }
  .wordmark__by { display: none; }
}
@media (max-width: 600px) {
  .portal-logo { height: 34px; }
  .portal-bar__status .updated { display: none; }
  .portal-row { grid-template-columns: minmax(0, 1fr); }
  .topbar { gap: 12px; }
  .clock { display: none; }
  .topnav a { padding: 6px 9px; font-size: 13px; }
  .tiles { gap: 10px; }
  .tile { min-height: 120px; padding: 12px; }
  .stats { grid-template-columns: 1fr 1fr 1fr; }
  .stat__value { font-size: 24px; }
  .crm-head { grid-template-columns: minmax(0, 1fr); padding: 18px 16px 0; }
  .crm-head__actions { justify-content: flex-start; }
  .tabs { margin: 8px -16px 0; padding: 0 8px; }
  .row-2 { grid-template-columns: 1fr; }
  .ai-pill { display: none; }
  .wordmark__text { font-size: 15px; }
  .integrations { grid-template-columns: minmax(0, 1fr); }
  .hbar { grid-template-columns: minmax(70px, 30%) minmax(0, 1fr) auto; }
}
