/* Vitrina — sistema de diseño (Dark OLED / slate, Plus Jakarta Sans).
   Generado con ui-ux-pro-max. Single-file, sin build. */

:root {
  /* Color — monocromo editorial (inspirado en quarkia.cl): tinta sobre papel.
     Acento = tinta (negro). El azul queda solo como color funcional sutil en links/foco. */
  --bg: #fafafa;            /* papel, casi-blanco levemente frío */
  --panel: #ffffff;
  --panel-2: #fafafa;
  --raised: #f2f2f3;        /* hover / superficies elevadas */
  --line: #e8e8ea;          /* hairline */
  --line-strong: #d8d8db;
  --text: #18181b;          /* tinta (no #000) */
  --muted: #6a6a70;
  --dim: #73737a;   /* contraste >=4.5:1 sobre el papel para micro-etiquetas legibles */
  --accent: #18181b;        /* acento = tinta: botón primario y nav activo */
  --accent-strong: #000000;
  --accent-weak: rgba(24, 24, 27, .055);  /* fondo del nav activo, gris muy tenue */
  --link: #3a6ea5;          /* azul sutil, SOLO links/foco */
  --success: #2f8f57;
  --success-weak: rgba(47, 143, 87, .12);
  --info: #4a5568;
  --warn: #8a5a1c;
  --danger: #c0392b;
  --purple: #6b5b8a;

  /* Tipografía */
  /* Inter Tight: grotesque apretada (la misma que usa quarkia.cl). Inter como fallback. */
  --font: "Inter Tight", "Inter", system-ui, -apple-system, BlinkMacSystemFont, "Helvetica Neue", Arial, sans-serif;
  --mono: "JetBrains Mono", ui-monospace, "Cascadia Code", Consolas, monospace;
  --fs-xs: 12px; --fs-sm: 14px; --fs-base: 17px; --fs-lg: 21px; --fs-xl: 26px; --fs-2xl: 34px;

  /* Espaciado / radios / sombras */
  --sp-2: 8px; --sp-3: 12px; --sp-4: 16px; --sp-5: 20px; --sp-6: 24px; --sp-8: 32px; --sp-10: 44px;
  --r-sm: 9px; --r: 14px; --r-lg: 16px; --r-pill: 980px;
  /* Profundidad plana: bordes hairline en vez de sombras pesadas. */
  --shadow: 0 1px 2px rgba(24,24,27,.05);
  --ring: 0 0 0 3px rgba(58,110,165,.28);
  --z-nav: 30;
}

* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; scroll-behavior: smooth; }
body {
  margin: 0; background: var(--bg); color: var(--text);
  font-family: var(--font); font-size: var(--fs-base); line-height: 1.47; letter-spacing: -.016em;
  -webkit-font-smoothing: antialiased; text-rendering: optimizeLegibility;
}
a { color: inherit; text-decoration: none; }
h1, h2, h3 { margin: 0; font-weight: 600; letter-spacing: -.022em; line-height: 1.08; }
.topbar h1 { font-size: var(--fs-2xl); font-weight: 700; letter-spacing: -.03em; }
.muted { color: var(--muted); }
.small { font-size: var(--fs-sm); }
.sr-only { position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px; overflow: hidden;
  clip: rect(0,0,0,0); white-space: nowrap; border: 0; }
.mono { font-family: var(--mono); font-size: var(--fs-sm); color: var(--text); }
code { font-family: var(--mono); font-size: .88em; background: var(--raised);
  padding: 1px 6px; border-radius: 6px; color: var(--text); }

:focus-visible { outline: none; box-shadow: var(--ring); border-radius: var(--r-sm); }

.brand { font-weight: 800; font-size: var(--fs-lg); letter-spacing: -.02em;
  display: flex; align-items: center; gap: 9px; color: var(--text); }
.dot { width: 13px; height: 13px; border-radius: 4px; border: 1.7px solid var(--text); background: transparent; }
.icon { width: 18px; height: 18px; flex: none; stroke: currentColor; fill: none;
  stroke-width: 1.7; stroke-linecap: round; stroke-linejoin: round; }

/* ---------- Login ---------- */
.login-wrap { min-height: 100vh; display: grid; place-items: center; padding: var(--sp-6); background: var(--bg); }
.login-card { background: var(--panel); border: 1px solid var(--line); border-radius: var(--r-lg);
  padding: var(--sp-8); width: 370px; max-width: 100%; display: flex; flex-direction: column;
  gap: 6px; box-shadow: var(--shadow); }
.login-card .muted { margin: 2px 0 14px; }
.login-card label { font-size: var(--fs-sm); color: var(--muted); margin-top: var(--sp-3); font-weight: 500; }
.login-card input { background: var(--bg); border: 1px solid var(--line); color: var(--text);
  padding: 11px 13px; border-radius: var(--r-sm); font-size: var(--fs-md, 16px); font-family: inherit;
  transition: border-color .15s ease, box-shadow .15s ease; }
.login-card input:focus { border-color: var(--accent); box-shadow: var(--ring); outline: none; }
.login-card button { margin-top: var(--sp-5); }
/* Botón "Continuar con Google": hairline, monocromo, coherente con .btn-ghost. */
.btn-google { display: flex; align-items: center; justify-content: center; gap: 8px;
  width: 100%; margin-top: var(--sp-5); padding: 10px 14px; border-radius: var(--r-sm);
  background: var(--panel); color: var(--text); border: 1px solid var(--line-strong);
  font-weight: 600; font-size: var(--fs-sm); text-decoration: none; cursor: pointer; }
.btn-google:hover { background: var(--raised); border-color: var(--muted); }
.btn-google .g { display: inline-flex; align-items: center; justify-content: center;
  width: 18px; height: 18px; border-radius: 50%; border: 1px solid var(--line-strong);
  font-weight: 700; font-size: 11px; line-height: 1; }
.or { display: flex; align-items: center; gap: 10px; margin: var(--sp-4) 0 0;
  color: var(--dim); font-size: var(--fs-xs); }
.or::before, .or::after { content: ""; flex: 1; height: 1px; background: var(--line); }
/* Tarjeta de Conexiones (Ajustes) */
.conn-card { border: 1px solid var(--line); border-radius: var(--r-md); padding: var(--sp-5);
  max-width: 520px; display: flex; flex-direction: column; gap: var(--sp-3); background: var(--panel); }
.conn-head { display: flex; align-items: center; gap: 8px; }
.conn-form { display: flex; flex-direction: column; gap: 6px; }
.conn-form input { background: var(--bg); border: 1px solid var(--line); color: var(--text);
  padding: 9px 11px; border-radius: var(--r-sm); }
.conn-form input:focus { border-color: var(--accent); box-shadow: var(--ring); outline: none; }
.conn-disc { margin-top: 4px; }
.switch-row { display: flex; align-items: center; justify-content: space-between; gap: 12px;
  padding: 6px 0; }
.hint { color: var(--dim); font-size: var(--fs-xs); margin-top: var(--sp-4); text-align: center; }
.alert { background: rgba(255,59,48,.10); border: 1px solid rgba(255,59,48,.4);
  color: var(--danger); padding: 10px 12px; border-radius: var(--r-sm); font-size: var(--fs-sm); font-weight: 600; }

/* ---------- Botones ---------- */
/* La base aplica a <button> y a CUALQUIER elemento con .btn/.btn-primary/.btn-ghost
   (incluye los <a> que actúan como botón), para que todos se vean idénticos. */
button, .btn, .btn-primary, .btn-ghost { display: inline-flex; align-items: center; justify-content: center;
  gap: 7px; font-family: inherit; cursor: pointer; border: 1px solid transparent; text-decoration: none;
  border-radius: var(--r-sm); padding: 9px 18px; font-size: var(--fs-sm); font-weight: 500; letter-spacing: -.01em;
  line-height: 1.2; white-space: nowrap;
  transition: background-color .15s ease, border-color .15s ease, color .15s ease, transform .05s ease; }
button:active, .btn-primary:active, .btn-ghost:active { transform: translateY(1px); }
.btn-primary, .login-card button { background: var(--accent); color: #fafafa; border: 1px solid var(--accent); }
.btn-primary:hover, .login-card button:hover { background: var(--accent-strong); border-color: var(--accent-strong); }
.btn-ghost { background: transparent; color: var(--text); border: 1px solid var(--line-strong); }
.btn-ghost:hover { background: var(--raised); border-color: var(--muted); }

/* ---------- Layout ---------- */
.layout { display: grid; grid-template-columns: 248px 1fr; min-height: 100vh; }
.sidebar { position: sticky; top: 0; align-self: start; height: 100vh;
  background: var(--panel); border-right: 1px solid var(--line);
  padding: var(--sp-6) var(--sp-4); display: flex; flex-direction: column; gap: var(--sp-6);
  z-index: var(--z-nav); }
.nav-search input { width: 100%; min-height: 42px; background: var(--bg); border: 1px solid var(--line);
  color: var(--text); padding: 8px 12px; border-radius: var(--r-sm); font-family: inherit; font-size: 14px; }
.nav-search input:focus { border-color: var(--accent); box-shadow: var(--ring); outline: none; }
.sidebar-top { display: flex; align-items: center; justify-content: space-between; gap: var(--sp-2); }
.nav-toggle { background: transparent; border: 0; color: var(--muted); padding: 6px; border-radius: 8px;
  cursor: pointer; min-height: 36px; min-width: 36px; display: grid; place-items: center; }
.nav-toggle:hover { background: var(--raised); color: var(--text); }
.sidebar nav { display: flex; flex-direction: column; gap: var(--sp-4); flex: 1 1 auto; min-height: 0;
  overflow-y: auto; margin: 0 -4px; padding: 0 4px; }
.nav-group { display: flex; flex-direction: column; gap: 3px; }
.nav-group-label { display: flex; align-items: center; gap: 6px; width: 100%;
  background: transparent; border: 0; cursor: pointer; text-align: left;
  font-family: var(--mono); font-size: 11px; text-transform: uppercase; letter-spacing: .1em;
  color: var(--dim); font-weight: 500; padding: 7px 12px; border-radius: 8px;
  transition: color .15s ease, background-color .15s ease; }
.nav-group-label:hover { color: var(--muted); background: var(--raised); }
.nav-group-label::before { content: "— "; color: var(--line-strong); }
.nav-group-label .chev { width: 13px; height: 13px; margin-left: auto; stroke: var(--line-strong);
  fill: none; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round;
  transition: transform .18s ease; }
.nav-group.collapsed .nav-group-label .chev { transform: rotate(-90deg); }
.nav-group-items { display: flex; flex-direction: column; gap: 3px; }
.nav-group.collapsed .nav-group-items { display: none; }
.navlink { display: flex; align-items: center; gap: 11px; min-height: 38px; padding: 8px 12px;
  border-radius: 9px; color: var(--text); font-weight: 500; font-size: 14.5px;
  letter-spacing: -.01em; transition: background-color .15s ease, color .15s ease; }
.navlink .icon { stroke: var(--muted); }
.navlink:hover { background: var(--raised); }
.navlink.active { background: var(--accent-weak); color: var(--accent); font-weight: 600; }
.navlink.active .icon { stroke: var(--accent); }
.navlink .icon { width: 17px; height: 17px; }
.logout-link { min-height: 40px; display: inline-flex; align-items: center; }
.sidebar-foot { display: flex; flex-direction: column; gap: 4px;
  padding-top: var(--sp-4); border-top: 1px solid var(--line); }
.logout-link { display: flex; align-items: center; gap: 11px; min-height: 40px; color: var(--muted);
  padding: 8px 12px; border-radius: 10px; }
.logout-link:hover { background: var(--raised); color: var(--text); }
.logout-link .icon { width: 18px; height: 18px; }

/* Menú colapsado (solo íconos) — se recuerda con localStorage. */
@media (min-width: 901px) {
  html.nav-collapsed .layout { grid-template-columns: 76px 1fr; }
  html.nav-collapsed .sidebar { padding: var(--sp-5) 12px; }
  html.nav-collapsed .nav-search,
  html.nav-collapsed .nav-group-label,
  html.nav-collapsed .sidebar-top .brand,
  html.nav-collapsed .navlink .label,
  html.nav-collapsed .logout-link .label,
  html.nav-collapsed .brand-text { display: none; }
  html.nav-collapsed .sidebar-top { justify-content: center; }
  html.nav-collapsed .navlink,
  html.nav-collapsed .logout-link { justify-content: center; gap: 0; padding: 11px 0; }
  html.nav-collapsed .nav-group { gap: 5px; }
  /* En modo solo-íconos se muestran todos los items (el acordeón solo aplica con etiquetas). */
  html.nav-collapsed .nav-group.collapsed .nav-group-items { display: flex; }
}

.content { padding: var(--sp-6) var(--sp-8); max-width: 1180px; }
.topbar { display: flex; justify-content: space-between; align-items: center;
  gap: var(--sp-4); flex-wrap: wrap;
  position: sticky; top: 0; z-index: 20;
  margin: calc(-1 * var(--sp-6)) calc(-1 * var(--sp-8)) var(--sp-8);
  padding: var(--sp-5) var(--sp-8);
  background: var(--bg);
  border-bottom: 1px solid var(--line); }
.topbar h1 { font-size: var(--fs-2xl); font-weight: 700; letter-spacing: -.03em; margin-bottom: 5px; }
.topbar .sub { color: var(--muted); font-size: var(--fs-sm); display: flex; align-items: center;
  gap: 7px; flex-wrap: wrap; }
.switcher { display: flex; flex-direction: column; gap: 4px; }
.switcher label { font-family: var(--mono); font-size: 11px; text-transform: uppercase; letter-spacing: .1em; color: var(--dim); }
select { background: var(--raised); color: var(--text); border: 1px solid var(--line);
  padding: 9px 12px; border-radius: var(--r-sm); font-family: inherit; font-size: var(--fs-sm); cursor: pointer; }
select:focus { border-color: var(--accent); box-shadow: var(--ring); outline: none; }

.pill { display: inline-flex; align-items: center; background: transparent;
  border: 1px solid var(--line); border-radius: var(--r-sm); padding: 2px 9px;
  font-family: var(--mono); font-size: 11px; letter-spacing: .04em;
  font-weight: 500; color: var(--muted); }
.pill-active { color: var(--accent); border-color: var(--line-strong); background: var(--accent-weak); }
.pill-trial { color: var(--warn); border-color: var(--line-strong); background: transparent; }

/* ---------- Stat cards ---------- */
.cards { display: grid; grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
  gap: var(--sp-4); margin-bottom: var(--sp-6); }
.card { background: var(--panel); border: 1px solid var(--line); border-radius: var(--r);
  padding: var(--sp-5) var(--sp-6); display: flex; flex-direction: column; gap: 8px;
  transition: border-color .15s ease; }
.card:hover { border-color: var(--line-strong); }
.card .k { font-family: var(--mono); text-transform: uppercase; letter-spacing: .08em;
  color: var(--dim); font-size: 11px; font-weight: 500; }
.card .v { font-size: var(--fs-2xl); font-weight: 700; letter-spacing: -.03em; color: var(--text); }
.card.accent .v { color: var(--text); }

/* ---------- Tablas ---------- */
.grid { width: 100%; border-collapse: collapse; background: var(--panel);
  border: 1px solid var(--line); border-radius: var(--r); overflow: hidden; }
.grid th { text-align: left; font-family: var(--mono); font-size: 11px; text-transform: uppercase; letter-spacing: .08em;
  color: var(--dim); font-weight: 500; padding: 12px 16px; background: var(--panel-2);
  border-bottom: 1px solid var(--line); }
.grid td { padding: 14px 16px; border-bottom: 1px solid var(--line); font-size: var(--fs-sm); }
.grid tbody tr:last-child td { border-bottom: 0; }
.grid tbody tr { transition: background-color .12s ease; }
.grid tbody tr:hover { background: var(--panel-2); }

/* ---------- Status pills ---------- */
.state { display: inline-block; font-family: var(--mono); font-size: 11px; letter-spacing: .03em;
  font-weight: 500; padding: 3px 9px; border-radius: 6px; border: 1px solid var(--line); color: var(--muted);
  background: transparent; }
.s-CONFIRMADA, .s-VENDIDA, .s-DESPACHADO, .s-DESPACHADA, .s-ENTREGADA, .s-ENTREGADO {
  color: var(--success); background: var(--success-weak); border-color: rgba(47,143,87,.28); }
.s-PAGO_PENDIENTE, .s-RESERVADA, .s-BORRADOR, .s-PAGO_DETECTADO {
  color: var(--warn); background: rgba(138,90,28,.09); border-color: rgba(138,90,28,.26); }
.s-PUBLICADA, .s-HISTORIA_BAJADA, .s-LISTA_PARA_DESPACHO {
  color: var(--info); background: rgba(74,85,104,.08); border-color: rgba(74,85,104,.24); }
.s-CANCELADA, .s-REEMBOLSADA, .s-PAGO_SIN_MATCHEAR {
  color: var(--danger); background: rgba(192,57,43,.08); border-color: rgba(192,57,43,.26); }

/* ---------- Simulador ---------- */
.lead { color: var(--muted); font-size: var(--fs-sm); max-width: 68ch; margin: 0 0 var(--sp-5);
  line-height: 1.6; }
.sim-grid { display: grid; grid-template-columns: 1.25fr 1fr; gap: var(--sp-6); align-items: start; }
.sect-title { font-family: var(--mono); font-size: 11px; text-transform: uppercase; letter-spacing: .1em;
  color: var(--dim); font-weight: 500; margin: 0 0 var(--sp-4); }
.sect-title::before { content: "— "; color: var(--line-strong); }
.sect-title.mt { margin-top: var(--sp-8); }

/* ---------- Sub-hojas (pestañas dentro de la página) ---------- */
.subtabs { display: flex; gap: var(--sp-5); border-bottom: 1px solid var(--line);
  margin: 0 0 var(--sp-6); flex-wrap: wrap; }
.subtab { background: transparent; border: 0; border-bottom: 2px solid transparent; border-radius: 0;
  padding: 10px 2px; color: var(--muted); font-weight: 500; font-size: var(--fs-sm); cursor: pointer;
  transition: color .15s ease, border-color .15s ease; }
.subtab:hover { color: var(--text); }
.subtab.active { color: var(--text); border-bottom-color: var(--accent); }
.subpanel[hidden] { display: none; }
.msgbox { display: flex; gap: var(--sp-2); }
.msgbox input { background: var(--bg); border: 1px solid var(--line); color: var(--text);
  padding: 11px 13px; border-radius: var(--r-sm); font-size: var(--fs-md, 16px); font-family: inherit;
  transition: border-color .15s ease, box-shadow .15s ease; }
.msgbox input:focus { border-color: var(--accent); box-shadow: var(--ring); outline: none; }
.msgbox .phone { max-width: 150px; }
.msgbox input:not(.phone) { flex: 1; }
.msgbox button { background: var(--accent); color: #fff; display: inline-flex; align-items: center; gap: 7px; }
.msgbox button:hover { background: var(--accent-strong); }
.chips { display: flex; flex-wrap: wrap; gap: 6px; margin-top: var(--sp-3); }
.chip { background: var(--raised); border: 1px solid var(--line); border-radius: var(--r-pill);
  padding: 4px 11px; font-size: var(--fs-xs); font-family: var(--mono); color: var(--muted); }
button.pay { background: var(--accent); color: #fafafa; border: 1px solid var(--accent); padding: 9px 14px;
  min-height: 38px; font-size: var(--fs-sm); display: inline-flex; align-items: center; gap: 6px; white-space: nowrap; }
button.pay:hover { background: var(--accent-strong); border-color: var(--accent-strong); }
.feed { display: flex; flex-direction: column; gap: var(--sp-2); max-height: 520px; overflow-y: auto;
  padding-right: 4px; }
.ev { display: flex; gap: 10px; align-items: flex-start; background: var(--panel);
  border: 1px solid var(--line); border-left-width: 3px; border-radius: var(--r-sm);
  padding: 10px 13px; font-size: var(--fs-sm); line-height: 1.45; }
.ev .tag { font-size: var(--fs-xs); text-transform: uppercase; letter-spacing: .04em; font-weight: 700;
  padding: 2px 8px; border-radius: var(--r-pill); background: var(--raised); color: var(--muted);
  white-space: nowrap; }
.ev-in { border-left-color: var(--info); }
.ev-out { border-left-color: var(--accent); }
.ev-story { border-left-color: var(--warn); }
.ev-notify { border-left-color: var(--purple); }
.ev-system { border-left-color: var(--danger); }

/* ---------- Conversaciones (lista) ---------- */
.conv-list { display: flex; flex-direction: column; gap: var(--sp-2); }
.conv-item { display: flex; align-items: center; gap: var(--sp-3); background: var(--panel);
  border: 1px solid var(--line); border-radius: var(--r); padding: 12px 14px;
  transition: border-color .15s ease, background-color .15s ease; }
.conv-item:hover { border-color: var(--line-strong); background: var(--panel-2); }
.conv-avatar { width: 38px; height: 38px; flex: none; border-radius: 50%; display: grid;
  place-items: center; font-weight: 700; color: var(--accent); background: var(--accent-weak);
  border: 1px solid var(--line); }
.conv-main { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 2px; }
.conv-top { display: flex; justify-content: space-between; gap: var(--sp-3); align-items: baseline; }
.conv-snippet { font-size: var(--fs-sm); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.conv-count { flex: none; min-width: 24px; height: 22px; padding: 0 7px; border-radius: var(--r-pill);
  background: var(--raised); color: var(--muted); font-size: var(--fs-xs); font-weight: 700;
  display: grid; place-items: center; }
.conv-channels { display: flex; gap: 5px; margin-top: 4px; }
.ch-tag { font-size: 10.5px; font-weight: 700; text-transform: uppercase; letter-spacing: .03em;
  padding: 2px 8px; border-radius: var(--r-pill); border: 1px solid var(--line); color: var(--muted); }
.ch-whatsapp { color: var(--success); background: var(--success-weak); border-color: rgba(47,143,87,.3); }
.ch-instagram { color: var(--purple); background: rgba(107,91,138,.1); border-color: rgba(107,91,138,.28); }
.ch-email { color: var(--info); background: rgba(74,85,104,.08); border-color: rgba(74,85,104,.24); }
.thread-block { margin-bottom: var(--sp-5); }
.empty-state { background: var(--panel); border: 1px dashed var(--line); border-radius: var(--r);
  padding: var(--sp-8); text-align: center; display: flex; flex-direction: column; gap: var(--sp-4);
  align-items: center; }

/* ---------- Chat (detalle) ---------- */
.chat-grid { display: grid; grid-template-columns: 1fr 280px; gap: var(--sp-6); align-items: start; }
.chat-pane { background: var(--panel); border: 1px solid var(--line); border-radius: var(--r-lg);
  padding: var(--sp-5); }
.chat-thread { display: flex; flex-direction: column; gap: var(--sp-3); max-height: 62vh;
  overflow-y: auto; }
.bubble-row { display: flex; }
.bubble-row.left { justify-content: flex-start; }
.bubble-row.right { justify-content: flex-end; }
.bubble { max-width: 75%; padding: 9px 13px; border-radius: 14px; font-size: var(--fs-sm);
  line-height: 1.45; display: flex; flex-direction: column; gap: 3px; }
.bubble-in { background: var(--raised); border: 1px solid var(--line); border-bottom-left-radius: 4px; }
.bubble-out { background: var(--success-weak); border: 1px solid rgba(47,143,87,.25);
  border-bottom-right-radius: 4px; }
.bubble-text { word-break: break-word; }
.bubble-time { font-size: 10.5px; color: var(--dim); align-self: flex-end; }
.order-cards { display: flex; flex-direction: column; gap: var(--sp-3); }
.order-card { background: var(--panel); border: 1px solid var(--line); border-radius: var(--r);
  padding: var(--sp-3) var(--sp-4); display: flex; flex-direction: column; gap: 5px; }
.order-card-top { display: flex; justify-content: space-between; align-items: center; gap: var(--sp-2); }
.order-amount { font-weight: 700; }

/* ---------- Colecciones ---------- */
.accent-txt { color: var(--accent); }
.col-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(260px, 1fr)); gap: var(--sp-4); }
.col-card { background: var(--panel); border: 1px solid var(--line); border-radius: var(--r);
  padding: var(--sp-5); display: flex; flex-direction: column; gap: 8px;
  transition: border-color .15s ease, transform .05s ease; }
.col-card:hover { border-color: var(--line-strong); }
.col-card-head { display: flex; justify-content: space-between; align-items: center; gap: var(--sp-2); }
.col-metrics { display: flex; gap: var(--sp-4); flex-wrap: wrap; font-size: var(--fs-sm);
  color: var(--muted); margin-top: 4px; }
.col-metrics b { color: var(--text); }
.bar { height: 7px; background: var(--raised); border-radius: var(--r-pill); overflow: hidden; margin-top: 4px; }
.bar span { display: block; height: 100%; background: var(--accent); border-radius: var(--r-pill); }

/* ---------- Campañas ---------- */
.cmp-form { display: flex; flex-direction: column; gap: 6px; background: var(--panel);
  border: 1px solid var(--line); border-radius: var(--r); padding: var(--sp-5); }
.cmp-form label { font-size: var(--fs-sm); color: var(--muted); margin-top: 6px; font-weight: 500; }
.cmp-form textarea { background: var(--bg); border: 1px solid var(--line); color: var(--text);
  border-radius: var(--r-sm); padding: 10px 12px; font-family: inherit; font-size: var(--fs-sm); resize: vertical; }
.cmp-form textarea:focus, .cmp-form select:focus { border-color: var(--accent); box-shadow: var(--ring); outline: none; }
.cmp-form button { margin-top: var(--sp-4); }
.cmp-list { display: flex; flex-direction: column; gap: var(--sp-3); }
.cmp-card { background: var(--panel); border: 1px solid var(--line); border-radius: var(--r);
  padding: var(--sp-4); display: flex; flex-direction: column; gap: 8px; }
.cmp-top { display: flex; align-items: center; gap: var(--sp-2); }
.cmp-msg { font-size: var(--fs-sm); line-height: 1.5; }
.cmp-foot { display: flex; justify-content: flex-end; }

/* ---------- Ficha de cliente ---------- */
.link-strong { color: var(--text); font-weight: 600; }
.link-strong:hover { color: var(--accent); }
.row-actions { display: flex; gap: var(--sp-2); white-space: nowrap; align-items: center; }
.row-actions a { color: var(--link); font-size: var(--fs-sm); font-weight: 500; padding: 7px 10px;
  border-radius: 8px; border: 1px solid transparent; }
.sub a { color: var(--link); font-weight: 500; }
.row-actions a:hover { color: var(--accent); background: var(--raised); border-color: var(--line); }
.ficha-grid { display: grid; grid-template-columns: 1.4fr 1fr; gap: var(--sp-6); align-items: start; }
.chat-summary { display: flex; flex-direction: column; gap: var(--sp-2); }
.chat-sum-item { display: flex; align-items: center; gap: var(--sp-3); background: var(--panel);
  border: 1px solid var(--line); border-radius: var(--r-sm); padding: 10px 13px;
  transition: border-color .15s ease; }
.chat-sum-item:hover { border-color: var(--line-strong); }
.chat-sum-item .muted:last-child { margin-left: auto; }
.timeline { display: flex; flex-direction: column; gap: 0; border-left: 2px solid var(--line);
  padding-left: var(--sp-4); margin-left: 4px; }
.tl-item { position: relative; padding: 8px 0; border-bottom: 1px solid var(--line); }
.tl-item:last-child { border-bottom: 0; }
.tl-item::before { content: ""; position: absolute; left: calc(-1 * var(--sp-4) - 5px); top: 14px;
  width: 8px; height: 8px; border-radius: 50%; background: var(--dim); }
.tl-msg-in::before { background: var(--info); }
.tl-msg-out::before { background: var(--accent); }
.tl-order::before { background: var(--warn); }
.tl-time { display: block; }
.tl-text { font-size: var(--fs-sm); }

/* ---------- Flash / banner ---------- */
.flash { background: var(--accent-weak); border: 1px solid var(--line-strong); color: var(--accent);
  padding: 11px 15px; border-radius: var(--r-sm); font-size: var(--fs-sm); font-weight: 600;
  margin-bottom: var(--sp-5); }

/* ---------- Inicio (Hoy) ---------- */
.todo-list { display: flex; flex-direction: column; gap: var(--sp-2); }
.todo { display: flex; justify-content: space-between; align-items: center; gap: var(--sp-3);
  background: var(--panel); border: 1px solid var(--line);
  border-radius: var(--r-sm); padding: 14px 16px; transition: border-color .15s ease; }
.todo:hover { border-color: var(--line-strong); }
.todo strong { color: var(--text); font-weight: 600; }
.todo.urgent strong { color: var(--warn); }

/* ---------- Notas internas ---------- */
.notes-box { margin-top: var(--sp-5); max-width: 560px; }
.notes-form { display: flex; flex-direction: column; gap: var(--sp-3); }
.notes-form textarea { background: var(--bg); border: 1px solid var(--line); color: var(--text);
  border-radius: var(--r-sm); padding: 11px 13px; font-family: inherit; font-size: var(--fs-sm); resize: vertical; }
.notes-form textarea:focus { border-color: var(--accent); box-shadow: var(--ring); outline: none; }
.notes-form button { align-self: flex-start; }
.fb-right { display: flex; gap: var(--sp-3); align-items: flex-start; }

/* ---------- Barra de filtros / búsqueda ---------- */
.filterbar { display: flex; justify-content: space-between; gap: var(--sp-4); flex-wrap: wrap;
  align-items: center; margin-bottom: var(--sp-5); }
.chips-filter { display: flex; gap: 6px; flex-wrap: wrap; }
.fchip { display: inline-flex; align-items: center; gap: 7px; padding: 6px 12px; border-radius: var(--r-pill);
  border: 1px solid var(--line); color: var(--muted); font-size: var(--fs-sm); font-weight: 600;
  background: var(--panel); transition: border-color .15s ease, color .15s ease; }
.fchip:hover { border-color: var(--line-strong); color: var(--text); }
.fchip.active { background: var(--accent); color: #fafafa; border-color: var(--accent); }
.fcount { font-size: var(--fs-xs); background: var(--raised); color: var(--muted); border-radius: var(--r-pill);
  padding: 0 6px; min-width: 18px; text-align: center; }
.fchip.active .fcount { background: rgba(255,255,255,.22); color: #fafafa; }
.search { display: flex; gap: var(--sp-2); }
.search input { background: var(--bg); border: 1px solid var(--line); color: var(--text);
  padding: 9px 12px; border-radius: var(--r-sm); font-family: inherit; font-size: var(--fs-sm); min-width: 220px; }
.search input:focus { border-color: var(--accent); box-shadow: var(--ring); outline: none; }

/* ---------- Inventario (acciones) ---------- */
.price-form { display: flex; gap: 4px; align-items: center; }
.price-form input { width: 104px; min-height: 38px; background: var(--bg); border: 1px solid var(--line);
  color: var(--text); padding: 7px 9px; border-radius: 7px; font-family: var(--mono); font-size: var(--fs-sm); }
.price-form input:focus { border-color: var(--accent); box-shadow: var(--ring); outline: none; }
.price-form button { background: var(--raised); border: 1px solid var(--line); color: var(--accent);
  min-height: 38px; padding: 6px 12px; border-radius: 7px; font-weight: 700; cursor: pointer; }
.price-form button:hover { border-color: var(--accent); }
.mini-btn { background: var(--raised); border: 1px solid var(--line); color: var(--text);
  min-height: 38px; padding: 7px 13px; border-radius: 7px; font-size: var(--fs-sm); font-weight: 600; cursor: pointer; }
.mini-btn:hover { border-color: var(--line-strong); }
.mini-btn.danger { color: var(--danger); }
.mini-btn.danger:hover { border-color: var(--danger); }
.row-actions form { display: inline; margin: 0; }
.new-block { margin-top: var(--sp-6); background: var(--panel); border: 1px solid var(--line);
  border-radius: var(--r); padding: var(--sp-4) var(--sp-5); }
.new-block summary { cursor: pointer; font-weight: 600; color: var(--accent); }
.new-garment { display: grid; grid-template-columns: repeat(auto-fit, minmax(160px, 1fr)); gap: var(--sp-3);
  margin-top: var(--sp-4); align-items: end; }
.new-garment label { display: block; font-size: var(--fs-xs); color: var(--muted); margin-bottom: 3px; }
.new-garment input, .new-garment select { width: 100%; background: var(--bg); border: 1px solid var(--line);
  color: var(--text); padding: 9px 11px; border-radius: var(--r-sm); font-family: inherit; font-size: var(--fs-sm); }
.new-garment input:focus, .new-garment select:focus { border-color: var(--accent); box-shadow: var(--ring); outline: none; }
.new-garment button { grid-column: 1 / -1; justify-self: start; }

/* ---------- Embudo (Kanban) ---------- */
.kanban { display: flex; gap: var(--sp-4); overflow-x: auto; padding-bottom: var(--sp-4); align-items: flex-start; }
.kcol { flex: 0 0 230px; background: var(--panel-2); border: 1px solid var(--line); border-radius: var(--r);
  padding: var(--sp-4); display: flex; flex-direction: column; gap: 4px; }
.kcol-head { display: flex; justify-content: space-between; align-items: center; }
.kcount { background: var(--raised); color: var(--muted); border-radius: var(--r-pill); min-width: 24px;
  height: 22px; padding: 0 8px; font-size: var(--fs-xs); font-weight: 700; display: grid; place-items: center; }
.kcol-sub { margin-bottom: var(--sp-2); }
.kcards { display: flex; flex-direction: column; gap: var(--sp-2); }
.kcard { background: var(--panel); border: 1px solid var(--line); border-radius: var(--r-sm);
  box-shadow: var(--shadow); padding: 11px 13px; display: flex; flex-direction: column; gap: 3px; }
.kcard-top { display: flex; justify-content: space-between; gap: var(--sp-2); font-weight: 600; }
.kempty { text-align: center; padding: var(--sp-4) 0; }

/* ---------- Ajustes / módulos ---------- */
.mod-list { display: flex; flex-direction: column; gap: var(--sp-2); max-width: 640px; }
.mod-row { display: flex; justify-content: space-between; align-items: center; gap: var(--sp-4);
  background: var(--panel); border: 1px solid var(--line); border-radius: var(--r-sm);
  padding: 14px 18px; margin: 0; }
.mod-info { display: flex; flex-direction: column; gap: 2px; }
.mod-locked { opacity: .65; }
.plan-banner { display: inline-flex; align-items: center; gap: 10px; background: var(--accent-weak);
  border: 1px solid var(--line-strong); color: var(--accent); border-radius: var(--r-sm);
  padding: 8px 16px; margin-bottom: var(--sp-5); font-size: var(--fs-sm); }
.plan-banner strong { font-size: var(--fs-base); }
.switch { position: relative; display: inline-block; width: 50px; height: 30px; flex: none; cursor: pointer; }
.switch input { opacity: 0; width: 0; height: 0; }
.switch .slider { position: absolute; inset: 0; background: var(--line-strong); border-radius: 980px;
  transition: background-color .2s ease; }
.switch .slider::before { content: ""; position: absolute; height: 26px; width: 26px; left: 2px; top: 2px;
  background: #fff; border-radius: 50%; box-shadow: 0 1px 3px rgba(0,0,0,.25); transition: transform .2s ease; }
.switch input:checked + .slider { background: var(--accent); }
.switch input:checked + .slider::before { transform: translateX(20px); }
.switch input:focus-visible + .slider { box-shadow: var(--ring); }

/* ---------- Tareas ---------- */
.task-add { display: flex; gap: var(--sp-2); margin-bottom: var(--sp-5); max-width: 640px; }
.task-add input { flex: 1; background: var(--bg); border: 1px solid var(--line); color: var(--text);
  padding: 11px 14px; border-radius: var(--r-sm); font-family: inherit; font-size: var(--fs-base); }
.task-add input:focus { border-color: var(--accent); box-shadow: var(--ring); outline: none; }
.task-list { list-style: none; padding: 0; margin: 0; max-width: 640px; display: flex; flex-direction: column; gap: var(--sp-2); }
.task { display: flex; align-items: center; gap: var(--sp-3); background: var(--panel);
  border: 1px solid var(--line); border-radius: var(--r-sm); padding: 12px 16px; }
.task-check-form { margin: 0; }
.task-check { width: 26px; height: 26px; min-height: 26px; padding: 0; border-radius: 50%;
  border: 2px solid var(--line-strong); background: transparent; color: #fff; display: grid; place-items: center; cursor: pointer; }
.task-check.checked { background: var(--success); border-color: var(--success); }
.task-title { font-size: var(--fs-base); }
.task.done .task-title { color: var(--muted); text-decoration: line-through; }

/* ---------- Distribución (rediseño compacto) ---------- */
.dist-actions { display: flex; justify-content: space-between; align-items: flex-start; gap: var(--sp-4);
  flex-wrap: wrap; margin-bottom: var(--sp-5); }
.filters { background: var(--panel); border: 1px solid var(--line); border-radius: var(--r-sm); }
.filters > summary { cursor: pointer; padding: 9px 16px; font-weight: 600; font-size: var(--fs-sm); list-style: none; }
.filters > summary::-webkit-details-marker { display: none; }
.filters > summary::before { content: "▸ "; color: var(--muted); }
.filters[open] > summary::before { content: "▾ "; }
.filters-form { display: flex; gap: var(--sp-3); align-items: flex-end; flex-wrap: wrap;
  padding: 0 16px 14px; }
.filters-form label { display: flex; flex-direction: column; gap: 4px; font-size: var(--fs-xs); color: var(--muted); }
.filters-form select { background: var(--bg); border: 1px solid var(--line); color: var(--text);
  padding: 8px 11px; border-radius: var(--r-sm); font-family: inherit; font-size: var(--fs-sm); }
.dist-export { display: flex; gap: var(--sp-2); flex-wrap: wrap; }

.grid.compact td, .grid.compact th { padding: 10px 14px; }
.grid.compact .chip { font-size: 11px; padding: 2px 8px; }
.td-action { white-space: nowrap; }
/* Toast (confirmación de acción) */
.toast { position: fixed; bottom: 24px; left: 50%; transform: translateX(-50%);
  background: #1d1d1f; color: #fff; padding: 12px 20px; border-radius: 980px;
  font-size: 15px; font-weight: 500; box-shadow: 0 8px 28px rgba(0,0,0,.28); z-index: 1000;
  opacity: 1; transition: opacity .4s ease, transform .4s ease; }
.toast.hide { opacity: 0; transform: translateX(-50%) translateY(10px); }

/* Onboarding (primeros pasos) */
.onboard { background: #fff; border-radius: 18px; padding: 18px 20px; margin-bottom: 22px;
  box-shadow: 0 1px 3px rgba(0,0,0,.06); }
.onboard-head { display: flex; justify-content: space-between; align-items: baseline; margin-bottom: 12px; }
.onboard-steps { display: flex; flex-direction: column; gap: 8px; }
.onboard-step { display: flex; align-items: center; gap: 10px; padding: 10px 12px; border-radius: 12px;
  background: #f5f5f7; color: var(--text); text-decoration: none; font-weight: 500; transition: background .15s; }
.onboard-step:hover { background: #ececf0; }
.onboard-step.done { color: var(--muted); }
.onboard-step.done span:last-child { text-decoration: line-through; }
.ob-check { display: inline-flex; width: 22px; height: 22px; align-items: center; justify-content: center;
  border-radius: 50%; font-size: 13px; background: #e8e8ed; color: var(--muted); }
.onboard-step.done .ob-check { background: var(--success); color: #fff; }

/* Acciones en lote (barra) */
.bulk-bar { display: none; align-items: center; gap: 14px; padding: 10px 14px; margin-bottom: 10px;
  background: #f0f6ff; border: 1px solid #cfe2ff; border-radius: 14px; }
.bulk-bar.on { display: flex; }
.bulk-count { display: flex; align-items: center; gap: 8px; font-weight: 600; font-size: 14px; }
.bulk-cell { width: 34px; text-align: center; }

/* Empty state guiado */
.empty-state.guided { text-align: center; padding: 44px 20px; }
.es-icon { color: var(--dim); margin-bottom: 12px; line-height: 0; }
.es-title { font-size: 19px; font-weight: 600; margin: 0 0 6px; }
.es-text { max-width: 460px; margin: 0 auto 18px; }
.bot-status { display: flex; gap: 8px; margin: 10px 0 16px; flex-wrap: wrap; align-items: center; }
.bot-test { margin-left: auto; }
/* Vista previa del bot (mini-chat embebido, estilo "Start Chat" de ManyChat) */
.bot-preview { max-width: 480px; border: 1px solid var(--line); border-radius: var(--r);
  padding: 14px; margin: 0 0 var(--sp-6); background: var(--panel); }
.bp-head { font-family: var(--mono); font-size: 11px; text-transform: uppercase; letter-spacing: .08em;
  color: var(--dim); margin-bottom: 10px; }
.bp-thread { display: flex; flex-direction: column; gap: 8px; max-height: 230px; overflow-y: auto;
  padding: 2px; margin-bottom: 10px; }
.bp-msg { max-width: 85%; padding: 8px 12px; border-radius: 14px; font-size: var(--fs-sm); line-height: 1.4; }
.bp-bot { align-self: flex-start; background: var(--raised); border: 1px solid var(--line);
  border-bottom-left-radius: 4px; }
.bp-cli { align-self: flex-end; background: var(--success-weak); border: 1px solid rgba(47,143,87,.25);
  border-bottom-right-radius: 4px; }
.bp-input { display: flex; gap: 8px; }
.bp-input input { flex: 1; min-width: 0; padding: 9px 12px; border: 1px solid var(--line-strong);
  border-radius: var(--r-sm); font: inherit; font-size: var(--fs-sm); background: var(--bg); color: var(--text); }
.bp-input input:focus { outline: none; border-color: var(--accent); box-shadow: var(--ring); }
/* Flujo del bot estilo ManyChat: pasos numerados conectados (timeline). */
.bot-flow { max-width: 720px; margin-bottom: var(--sp-4); }
.flow-step { display: grid; grid-template-columns: 28px 1fr; gap: 14px; padding-bottom: 18px; position: relative; }
.flow-step:not(:last-child)::before { content: ""; position: absolute; left: 13px; top: 30px; bottom: 0;
  width: 1px; background: var(--line); }
.fs-num { width: 28px; height: 28px; border-radius: 50%; border: 1px solid var(--line-strong);
  display: grid; place-items: center; font-family: var(--mono); font-size: 12px; color: var(--muted);
  background: var(--panel); z-index: 1; }
.fs-body { display: flex; flex-direction: column; gap: 5px; min-width: 0; }
.fs-title { font-weight: 600; font-size: 15px; }
.fs-when { margin-top: -2px; }
.flow-step textarea, .bot-field textarea { width: 100%; padding: 10px 12px; border: 1px solid #d2d2d7;
  border-radius: 12px; font: inherit; font-size: 15px; resize: vertical; background: var(--panel); color: var(--text); }
.flow-step textarea:focus, .bot-field textarea:focus { outline: none; border-color: var(--accent); box-shadow: var(--ring); }
.bot-secondary { display: grid; grid-template-columns: repeat(auto-fit, minmax(300px, 1fr)); gap: 14px; max-width: 760px; }
.bot-dialogs { display: flex; flex-direction: column; gap: 14px; max-width: 760px; }
.bot-field { display: flex; flex-direction: column; gap: 5px; }
.bot-field label { font-weight: 600; font-size: 14px; color: var(--text); }
.bot-field textarea { width: 100%; padding: 10px 12px; border: 1px solid #d2d2d7; border-radius: 12px;
  font: inherit; font-size: 15px; resize: vertical; background: #fff; color: var(--text); }
.bot-field textarea:focus { outline: none; border-color: var(--accent); box-shadow: var(--ring); }
.td-thumb { width: 56px; padding-right: 0 !important; }
/* Stock / variantes (tallas) */
.stock-ok { font-weight: 600; }
.stock-out { color: #b3261e; font-weight: 600; }
.stock-mgr summary { cursor: pointer; color: var(--accent); font-size: 12px; }
.stock-mgr { margin-top: 4px; }
.stk-row { display: flex; align-items: center; gap: 6px; margin-top: 6px; }
.stk-row input[type=number] { width: 60px; }
.stk-row input[type=text] { width: 84px; }
.stk-row input { padding: 4px 8px; border: 1px solid #d2d2d7; border-radius: 8px; font: inherit; font-size: 13px; }
.thumb { width: 44px; height: 44px; border-radius: 12px; object-fit: cover; display: block;
  background: #f0f0f3; box-shadow: 0 1px 3px rgba(0,0,0,.10); }
.row-actions2 { display: flex; gap: 6px; align-items: center; flex-wrap: wrap; }
.mini-btn.primary { background: var(--accent); color: #fff; border-color: var(--accent); }
.mini-btn.primary:hover { background: var(--accent-strong); }
.mini-btn.starken { background: var(--accent); color: #fafafa; border-color: var(--accent); }
.mini-btn.starken:hover { filter: brightness(1.07); }
.manual-dispatch { margin: 0; }
.manual-dispatch > summary { cursor: pointer; font-size: var(--fs-xs); color: var(--muted); list-style: none; padding: 2px 0; }
.manual-dispatch > summary::-webkit-details-marker { display: none; }
.manual-dispatch[open] { margin-top: 4px; }
.quick-dispatch { display: inline-flex; gap: 5px; align-items: center; margin: 0; }
.quick-dispatch input { width: 110px; background: var(--bg); border: 1px solid var(--line); color: var(--text);
  padding: 6px 9px; border-radius: 7px; font-size: var(--fs-sm); font-family: inherit; }
.quick-dispatch input:focus { border-color: var(--accent); box-shadow: var(--ring); outline: none; }

.label-multi { margin-bottom: 28px; }
@media print {
  .label-multi { page-break-after: always; margin: 0; }
}

/* ---------- Distribución (paquetes — vista anterior) ---------- */
.pkg-list { display: flex; flex-direction: column; gap: var(--sp-3); }
.pkg-card { background: var(--panel); border: 1px solid var(--line); border-radius: var(--r);
  box-shadow: var(--shadow); padding: var(--sp-4) var(--sp-5); display: flex; gap: var(--sp-4);
  justify-content: space-between; align-items: flex-start; flex-wrap: wrap; }
.pkg-main { display: flex; flex-direction: column; gap: 6px; min-width: 220px; flex: 1; }
.pkg-head { display: flex; align-items: center; gap: var(--sp-3); }
.pkg-items { display: flex; flex-wrap: wrap; gap: 6px; }
.pkg-action, .dispatch-form { display: flex; flex-direction: column; gap: 8px; min-width: 240px; }
.pkg-side { display: flex; flex-direction: column; gap: 8px; align-items: stretch; min-width: 240px; }
.pkg-side .mini-btn { text-align: center; }
.addr-input, .dispatch-form input { background: var(--bg); border: 1px solid var(--line); color: var(--text);
  padding: 9px 12px; border-radius: var(--r-sm); font-family: inherit; font-size: var(--fs-sm); }
.addr-input:focus, .dispatch-form input:focus { border-color: var(--accent); box-shadow: var(--ring); outline: none; }

/* ---------- Etiqueta de envío ---------- */
.label-page { max-width: 620px; margin: 0 auto; padding: var(--sp-6); }
.label-toolbar { display: flex; justify-content: space-between; margin-bottom: var(--sp-5); }
.label-sheet { background: #fff; border: 2px solid #1d1d1f; border-radius: 14px; padding: 28px; color: #1d1d1f; }
.label-row { display: flex; justify-content: space-between; gap: var(--sp-4); border-bottom: 1px dashed #c4c4cc;
  padding-bottom: 16px; margin-bottom: 16px; }
.label-block { display: flex; flex-direction: column; gap: 3px; }
.label-tracking { text-align: right; }
.label-tag { font-size: 11px; letter-spacing: .08em; font-weight: 700; color: #6b6c6c; }
.label-to { border-bottom: 1px dashed #c4c4cc; padding-bottom: 16px; margin-bottom: 16px; }
.label-name { font-size: 24px; font-weight: 700; margin: 4px 0; letter-spacing: -.02em; }
.label-addr { font-size: 18px; line-height: 1.4; }
.label-items { margin: 6px 0 0; padding-left: 18px; }
.label-items li { font-size: 16px; margin-bottom: 3px; }
.label-foot { margin-top: 16px; }

@media print {
  .layout, .sidebar, .topbar, .no-print { display: none !important; }
  body { background: #fff; }
  .label-page { padding: 0; max-width: 100%; }
  .label-sheet { border-radius: 0; }
}

/* ---------- Pagos por confirmar ---------- */
.tr-list { display: flex; flex-direction: column; gap: var(--sp-3); }
.tr-card { background: var(--panel); border: 1px solid var(--line); border-radius: var(--r);
  padding: var(--sp-4) var(--sp-5); display: flex; flex-direction: column; gap: var(--sp-3); }
.tr-head { display: flex; justify-content: space-between; align-items: baseline; gap: var(--sp-3);
  flex-wrap: wrap; }
.tr-amount { font-size: var(--fs-lg); font-weight: 700; color: var(--text); }
.tr-cands { display: flex; flex-direction: column; gap: 6px; }
.tr-cand { margin: 0; }
.tr-cand .mini-btn { width: 100%; text-align: left; display: flex; gap: 8px; align-items: center; }
.tr-foot { display: flex; justify-content: flex-end; border-top: 1px solid var(--line); padding-top: var(--sp-3); }

/* ---------- Tabs (hojas de la ficha) ---------- */
.tabs { display: flex; gap: 4px; border-bottom: 1px solid var(--line); margin-bottom: var(--sp-5);
  flex-wrap: wrap; }
.tab { padding: 9px 14px; border-radius: var(--r-sm) var(--r-sm) 0 0; color: var(--muted);
  font-size: var(--fs-sm); font-weight: 600; border-bottom: 2px solid transparent; margin-bottom: -1px;
  transition: color .15s ease, border-color .15s ease, background-color .15s ease; }
.tab:hover { color: var(--text); background: var(--panel); }
.tab.active { color: var(--accent); border-bottom-color: var(--accent); }
.sheet { min-height: 120px; }

/* ---------- Etiquetas ---------- */
.tag-chip { display: inline-flex; align-items: center; gap: 6px; background: rgba(167,139,250,.12);
  color: var(--purple); border: 1px solid rgba(167,139,250,.35); border-radius: var(--r-pill);
  padding: 2px 10px; font-size: var(--fs-xs); font-weight: 600; }
.tag-chip.sm { font-size: 10.5px; padding: 1px 8px; }
.tag-list, .tag-list-sm { display: flex; flex-wrap: wrap; gap: 6px; }
.tag-list-sm { margin-top: 5px; }
.tag-chip.removable form { display: inline; margin: 0; }
.tag-chip.removable button { background: none; border: 0; color: var(--purple); cursor: pointer;
  font-size: 14px; line-height: 1; padding: 0 0 0 2px; }
.tag-chip.removable button:hover { color: var(--danger); }
.tags-box { max-width: 560px; display: flex; flex-direction: column; gap: var(--sp-3); }
.tag-add { display: flex; gap: var(--sp-2); margin-top: var(--sp-2); }
.tag-add input { flex: 1; background: var(--bg); border: 1px solid var(--line); color: var(--text);
  padding: 10px 12px; border-radius: var(--r-sm); font-family: inherit; font-size: var(--fs-md, 16px); }
.tag-add input:focus { border-color: var(--accent); box-shadow: var(--ring); outline: none; }

/* ---------- Métricas (sparkline) ---------- */
.spark { display: flex; align-items: flex-end; gap: 8px; height: 120px; padding-top: var(--sp-2); }
.spark-col { flex: 1; height: 100%; display: flex; align-items: flex-end; }
.spark-col span { display: block; width: 100%; background: var(--accent); border-radius: 6px 6px 0 0;
  min-height: 4px; transition: height .2s ease; }

/* ---------- Reportes ---------- */
.rep-grid { display: grid; grid-template-columns: 1fr 1fr; gap: var(--sp-5); align-items: start; }
.rep-card { background: var(--panel); border: 1px solid var(--line); border-radius: var(--r);
  padding: var(--sp-5); }
.rep-row { display: grid; grid-template-columns: 130px 1fr auto; align-items: center; gap: var(--sp-3);
  margin-bottom: 10px; }
.rep-label { font-size: var(--fs-sm); }
.rep-val { font-size: var(--fs-sm); color: var(--muted); white-space: nowrap; }
.rep-card .grid { border: 0; }

/* ---------- Catálogo público (link-in-bio) ---------- */
.shop { max-width: 1000px; margin: 0 auto; padding: var(--sp-8) var(--sp-5) var(--sp-10); }
.shop-head { text-align: center; margin-bottom: var(--sp-8); display: flex; flex-direction: column;
  align-items: center; gap: 6px; }
.shop-head .dot { width: 18px; height: 18px; border-radius: 5px; }
.shop-head h1 { font-size: var(--fs-2xl); font-weight: 700; letter-spacing: -.03em; }
.shop-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(220px, 1fr)); gap: var(--sp-5); }
.shop-card { border: 1px solid var(--line); border-radius: var(--r); overflow: hidden; background: var(--panel);
  display: flex; flex-direction: column; transition: border-color .15s ease; }
.shop-card:hover { border-color: var(--line-strong); }
.shop-img { width: 100%; aspect-ratio: 1 / 1; object-fit: cover; display: block; background: var(--raised); }
.shop-info { padding: 14px; display: flex; flex-direction: column; gap: 5px; }
.shop-code { font-size: var(--fs-xs); color: var(--dim); }
.shop-desc { font-weight: 600; font-size: var(--fs-sm); }
.shop-price { font-size: var(--fs-lg); font-weight: 700; letter-spacing: -.02em; margin-bottom: 8px; }
.shop-buy { text-align: center; }
.shop-foot { text-align: center; margin-top: var(--sp-10); }

/* ---------- Responsive ---------- */
@media (max-width: 900px) {
  .layout { grid-template-columns: 1fr; }
  .sidebar { position: static; height: auto; flex-direction: row; align-items: center;
    flex-wrap: wrap; gap: var(--sp-3); padding: var(--sp-3) var(--sp-4); }
  .sidebar nav { flex-direction: row; flex-wrap: wrap; gap: 6px; }
  .nav-group { display: contents; }
  .nav-group-label { display: none; }
  .navlink span.label { display: none; }
  .navlink { padding: 10px; min-width: 46px; justify-content: center; }
  .sidebar-foot { margin: 0 0 0 auto; flex-direction: row; gap: var(--sp-3); padding: 0; border: 0; }
  .content { padding: var(--sp-5) var(--sp-4); }
  .topbar { margin: calc(-1 * var(--sp-5)) calc(-1 * var(--sp-4)) var(--sp-5); padding: var(--sp-3) var(--sp-4); }
  .sim-grid, .chat-grid, .ficha-grid, .rep-grid { grid-template-columns: 1fr; }
  .row-actions { flex-direction: column; gap: 2px; }
  .row-actions2 { flex-wrap: wrap; }
  .topbar h1 { font-size: var(--fs-xl); }
  /* Anti-zoom en iOS: campos a 16px en el celular. */
  input, select, textarea { font-size: 16px; }
  /* Objetivos tactiles >= 44px en el celular. */
  .mini-btn, .stk-row button, .price-form button, .fchip, .btn-ghost, .btn-primary { min-height: 44px; }
  .stk-row input, .price-form input { min-height: 44px; }
  .mini-btn { padding: 10px 14px; }
  /* Densidad: filas un poco mas compactas (la tabla ya hace scroll horizontal). */
  .grid td, .grid th { padding: 11px 12px; }
  /* Tablas: scroll horizontal en vez de romper el layout en el celular. */
  .content table.grid { display: block; overflow-x: auto; -webkit-overflow-scrolling: touch; white-space: nowrap; }
  /* Tarjetas del inicio: 2 columnas en tablet, 1 en móvil chico. */
  .cards { grid-template-columns: repeat(2, 1fr); }
  /* Barras de acciones/filtros: que envuelvan en vez de desbordar. */
  .filterbar, .fb-right, .dist-actions, .dist-export, .bot-status, .chips-filter { flex-wrap: wrap; }
  /* Topbar: título arriba, controles abajo. */
  .topbar { flex-direction: column; align-items: flex-start; gap: var(--sp-2); }
  .switcher select, .search input { max-width: 100%; }
  /* La búsqueda del menú toma su propia fila completa. */
  .nav-search { order: 5; flex: 1 1 100%; }
}

@media (max-width: 560px) {
  .cards { grid-template-columns: 1fr; }
  .content { padding: var(--sp-4) var(--sp-3); }
  .onboard-head { flex-direction: column; align-items: flex-start; gap: 2px; }
}

@media (prefers-reduced-motion: reduce) {
  * { transition: none !important; animation: none !important; }
}

/* ── Celdas a completar: ESTÉTICA ÚNICA ───────────────────────────────────
   Regla base para TODA caja de entrada (texto, número, área, lista). Unifica
   borde, radio, padding, tipografía y foco usando los tokens del sistema, de
   modo que un formulario nuevo se vea idéntico a los existentes sin esfuerzo.
   No toca checkbox/radio/switch (esos llevan su propio diseño).            */
input[type="text"], input[type="email"], input[type="password"],
input[type="number"], input[type="search"], input[type="tel"],
input[type="url"], input[type="date"], input[type="time"],
input:not([type]), textarea, select {
  width: 100%;
  box-sizing: border-box;
  background: var(--bg);
  color: var(--text);
  border: 1px solid var(--line-strong, #d9d9e0);
  border-radius: 10px;
  padding: 10px 12px;
  font-family: inherit;
  font-size: 14px;
  line-height: 1.4;
  transition: border-color .15s ease, box-shadow .15s ease;
}
textarea { min-height: 84px; resize: vertical; }
/* Los <select> conservan ancho automático salvo que su contenedor pida 100%. */
select { width: auto; max-width: 100%; }
.pf-field select, .filters-form select, label > select { width: 100%; }
input[type="text"]:focus, input[type="email"]:focus, input[type="password"]:focus,
input[type="number"]:focus, input[type="search"]:focus, input[type="tel"]:focus,
input[type="url"]:focus, input[type="date"]:focus, input[type="time"]:focus,
input:not([type]):focus, textarea:focus, select:focus {
  outline: none;
  border-color: var(--accent);
  box-shadow: var(--ring);
}
input::placeholder, textarea::placeholder { color: var(--dim); opacity: 1; }
input:disabled, textarea:disabled, select:disabled {
  background: var(--raised); color: var(--dim); cursor: not-allowed;
}

/* ── Portal de acceso (login) ─────────────────────────────────────────────
   Nivel profesional: tarjeta elevada sobre halos suaves con los colores de la
   marca (anillo de historia), tipografía de la app y el botón de Google real. */
.auth-wrap {
  min-height: 100vh; display: grid; place-items: center; align-content: center;
  gap: 14px; padding: 28px 16px;
  background:
    radial-gradient(420px 320px at 18% 12%, rgba(254, 192, 83, .14), transparent 70%),
    radial-gradient(460px 360px at 84% 20%, rgba(214, 41, 118, .10), transparent 70%),
    radial-gradient(520px 420px at 50% 96%, rgba(79, 91, 213, .10), transparent 72%),
    var(--bg);
}
.auth-card {
  width: min(420px, 100%); background: #fff; border: 1px solid var(--line);
  border-radius: 22px; padding: 38px 34px 26px;
  box-shadow: 0 24px 70px rgba(24, 24, 27, .10), 0 2px 8px rgba(24, 24, 27, .04);
  animation: auth-in .45s cubic-bezier(.16, 1, .3, 1);
}
@keyframes auth-in { from { opacity: 0; transform: translateY(14px); } to { opacity: 1; transform: none; } }
.auth-brand { text-align: center; margin-bottom: 20px; }
.auth-logo { display: block; margin: 0 auto; }
.auth-word {
  margin: 10px 0 4px; font-size: 1.65rem; font-weight: 800; letter-spacing: -.02em;
  color: var(--text); line-height: 1.1;
}
.auth-tag { margin: 0; color: var(--dim); font-size: .92rem; line-height: 1.45; }
.auth-google {
  display: flex; align-items: center; justify-content: center; gap: 10px;
  width: 100%; padding: 11px 14px; border: 1px solid var(--line-strong);
  border-radius: 12px; background: #fff; color: var(--text); font-weight: 600;
  font-size: .95rem; text-decoration: none; cursor: pointer;
  transition: border-color .15s ease, box-shadow .15s ease;
}
.auth-google:hover { border-color: var(--accent); box-shadow: 0 2px 10px rgba(24,24,27,.08); }
.auth-or {
  display: flex; align-items: center; gap: 12px; margin: 18px 0 14px;
  color: var(--dim); font-size: .8rem;
}
.auth-or::before, .auth-or::after { content: ""; flex: 1; height: 1px; background: var(--line); }
.auth-form { display: flex; flex-direction: column; }
.auth-label { font-size: .82rem; font-weight: 600; color: var(--text); margin: 10px 0 6px; }
.auth-submit {
  width: 100%; margin-top: 18px; padding: 12px 14px; border: 0; border-radius: 12px;
  background: var(--accent); color: #fff; font-weight: 700; font-size: .98rem;
  font-family: inherit; cursor: pointer; transition: opacity .15s ease, transform .15s ease;
}
.auth-submit:hover { opacity: .92; }
.auth-submit:active { transform: translateY(1px); }
.auth-hint { text-align: center; color: var(--dim); font-size: .8rem; margin: 12px 0 0; }
.auth-foot {
  display: flex; justify-content: center; gap: 8px; margin-top: 22px; padding-top: 16px;
  border-top: 1px solid var(--line); font-size: .78rem; color: var(--dim);
}
.auth-foot a { color: var(--dim); text-decoration: none; }
.auth-foot a:hover { color: var(--text); text-decoration: underline; }
.auth-by { margin: 0; text-align: center; color: var(--dim); font-size: .78rem; }
@media (max-width: 480px) { .auth-card { padding: 30px 22px 22px; } }

/* Portal comercial: split — promesa + producto a la izquierda, acceso a la derecha. */
.auth-split { display: grid; grid-template-columns: 1.1fr 1fr; min-height: 100vh; }
.auth-hero {
  display: flex; flex-direction: column; justify-content: space-between; gap: 28px;
  padding: 44px 52px 28px; color: #fff; overflow: hidden;
  background:
    radial-gradient(560px 420px at 88% -10%, rgba(214, 41, 118, .28), transparent 70%),
    radial-gradient(520px 420px at -10% 30%, rgba(254, 192, 83, .20), transparent 70%),
    radial-gradient(640px 520px at 60% 115%, rgba(79, 91, 213, .30), transparent 72%),
    #141417;
}
.auth-hero-brand {
  display: flex; align-items: center; gap: 10px; font-weight: 800; font-size: 1.25rem;
  letter-spacing: -.02em; text-transform: lowercase;
}
.auth-hero-brand img { background: #fff; border-radius: 50%; padding: 3px; }
.auth-hero-main { max-width: 540px; }
.auth-hero-title {
  margin: 0 0 14px; font-size: clamp(1.7rem, 2.6vw, 2.35rem); font-weight: 800;
  letter-spacing: -.025em; line-height: 1.14;
}
.auth-hero-sub { margin: 0 0 22px; color: rgba(255, 255, 255, .74); font-size: 1rem; line-height: 1.55; max-width: 48ch; }
.auth-hero-points { list-style: none; margin: 0 0 28px; padding: 0; display: flex; flex-direction: column; gap: 10px; }
.auth-hero-points li { display: flex; align-items: center; gap: 11px; font-size: .95rem; color: rgba(255, 255, 255, .92); }
.auth-hero-points .pt {
  flex: none; width: 21px; height: 21px; border-radius: 50%; display: inline-flex;
  align-items: center; justify-content: center; font-size: .72rem; font-weight: 800;
  background: rgba(255, 255, 255, .16); color: #fff;
}
.auth-chat {
  background: #fff; color: var(--text); border-radius: 16px; padding: 14px 16px 16px;
  max-width: 392px; box-shadow: 0 22px 60px rgba(0, 0, 0, .35);
  display: flex; flex-direction: column; gap: 8px;
}
.auth-chat-head {
  display: flex; align-items: center; gap: 7px; color: var(--dim); font-size: .74rem;
  font-weight: 600; text-transform: uppercase; letter-spacing: .06em; margin-bottom: 2px;
}
.auth-chat-dot { width: 8px; height: 8px; border-radius: 50%; background: #25d366; }
.auth-msg {
  max-width: 86%; padding: 9px 13px; border-radius: 14px; font-size: .88rem; line-height: 1.4;
}
.auth-msg.in { background: #f0f0f3; align-self: flex-start; border-bottom-left-radius: 5px; }
.auth-msg.out { background: var(--accent); color: #fff; align-self: flex-end; border-bottom-right-radius: 5px; }
.auth-hero-foot { margin: 0; color: rgba(255, 255, 255, .48); font-size: .78rem; }
.auth-side {
  display: grid; place-items: center; padding: 28px 20px;
  background:
    radial-gradient(420px 320px at 80% 10%, rgba(254, 192, 83, .10), transparent 70%),
    radial-gradient(460px 380px at 15% 92%, rgba(79, 91, 213, .07), transparent 72%),
    var(--bg);
}
@media (max-width: 920px) {
  .auth-split { grid-template-columns: 1fr; min-height: 0; }
  .auth-hero { padding: 26px 22px; gap: 18px; }
  .auth-chat, .auth-hero-foot { display: none; }
  .auth-hero-sub { margin-bottom: 14px; }
  .auth-hero-points { margin-bottom: 4px; }
  .auth-side { padding: 26px 16px 34px; }
}

/* Badge de atención en el menú: número de pendientes (ej. Precios por aprobar 3). */
.nav-badge {
  margin-left: auto; background: var(--accent); color: #fff; font-family: var(--mono);
  font-size: 11px; font-weight: 700; min-width: 18px; height: 18px; padding: 0 5px;
  border-radius: 999px; display: inline-flex; align-items: center; justify-content: center;
  line-height: 1; flex: none;
}
.navlink.active .nav-badge { background: #fff; color: var(--accent); }

/* Vista simple: oculta los ítems avanzados del menú (Embudo, Métricas, Conciliación, etc.). */
.sidebar.simple [data-adv="1"] { display: none; }
.nav-simple-toggle { width: 100%; background: transparent; border: 0; cursor: pointer;
  font: inherit; text-align: left; opacity: .85; }
.nav-simple-toggle:hover { opacity: 1; }
