/* ==========================================================================
   Ventas Catálogo — estilos
   Tono: editorial/cálido para una consultora de ventas por catálogo.
   Tipografía: Fraunces (títulos) + Space Grotesk (texto) + JetBrains Mono (datos)
   ========================================================================== */

:root {
  --ink: #2E1A24;
  --ink-soft: #7A5B66;
  --paper: #FBF2EC;
  --paper-soft: #F3E1D8;
  --line: rgba(46, 26, 36, 0.12);
  --rose: #D46A8F;
  --rose-deep: #B44E72;
  --gold: #C9982E;
  --sage: #5F8A63;
  --berry: #A63446;
  --card-bg: rgba(255, 255, 255, 0.78);
  --card-bg-solid: #FFFDFB;
  --shadow: 0 6px 20px rgba(46, 26, 36, 0.08);
  --radius: 16px;
  --radius-sm: 10px;
}

* { box-sizing: border-box; }
html, body { height: 100%; }
body {
  margin: 0;
  font-family: 'Space Grotesk', system-ui, sans-serif;
  background: var(--paper);
  color: var(--ink);
  -webkit-font-smoothing: antialiased;
}
h1, h2, h3 { font-family: 'Fraunces', serif; margin: 0; font-weight: 600; }
p { margin: 0; }
button { font-family: inherit; cursor: pointer; }
input, select, textarea { font-family: inherit; }
.mono, .mono-tag { font-family: 'JetBrains Mono', monospace; }

#app {
  max-width: 560px;
  margin: 0 auto;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  background: var(--paper);
  position: relative;
}

/* ---------------- Topbar ---------------- */
.topbar {
  position: sticky; top: 0; z-index: 20;
  display: flex; align-items: center; justify-content: space-between;
  padding: 14px 18px;
  background: linear-gradient(120deg, var(--ink) 0%, var(--rose-deep) 68%, var(--gold) 130%);
  color: #fff;
  box-shadow: 0 4px 16px rgba(46, 26, 36, 0.18);
}
.topbar-brand { display: flex; align-items: center; gap: 10px; }
.brand-mark {
  width: 36px; height: 36px; border-radius: 10px;
  background: rgba(255, 255, 255, 0.16);
  border: 1px solid rgba(255, 255, 255, 0.35);
  color: #fff; display: flex; align-items: center; justify-content: center;
  font-family: 'Fraunces', serif; font-weight: 700; font-size: 14px;
}
.brand-text { display: flex; flex-direction: column; line-height: 1.15; }
.brand-name { font-family: 'Fraunces', serif; font-weight: 600; font-size: 16px; color: #fff; }
.brand-sub { font-size: 11px; color: rgba(255, 255, 255, 0.78); }
.topbar .icon-btn {
  width: 36px; height: 36px; border-radius: 50%;
  border: 1px solid rgba(255, 255, 255, 0.35); background: rgba(255, 255, 255, 0.14);
  display: flex; align-items: center; justify-content: center; color: #fff;
}
.icon-btn {
  width: 36px; height: 36px; border-radius: 50%;
  border: 1px solid var(--line); background: var(--card-bg-solid);
  display: flex; align-items: center; justify-content: center; color: var(--ink);
}
.icon-btn svg { width: 18px; height: 18px; }
.icon-btn-sm { width: 28px; height: 28px; border: none; background: transparent; color: var(--ink-soft); }
.icon-btn-sm svg { width: 15px; height: 15px; }
.icon-btn.hidden { display: none; }

/* ---------------- Aviso de actualización disponible ---------------- */
.update-banner {
  display: flex; align-items: center; justify-content: space-between; gap: 10px;
  background: var(--paper-soft); border-bottom: 1px solid var(--line);
  padding: 10px 18px; font-size: 12.5px; color: var(--ink);
}
.update-banner.hidden { display: none; }
.update-banner span { flex: 1; min-width: 0; }
.update-banner button { flex-shrink: 0; }

/* ---------------- Tabbar ---------------- */
.tabbar {
  position: sticky; bottom: 0; z-index: 20;
  display: flex; justify-content: space-around;
  background: rgba(251, 242, 236, 0.96);
  backdrop-filter: blur(8px);
  border-top: 1px solid var(--line);
  padding: 6px 4px calc(6px + env(safe-area-inset-bottom));
}
.tab-btn {
  flex: 1; display: flex; flex-direction: column; align-items: center; gap: 3px;
  border: none; background: none; color: var(--ink-soft);
  padding: 6px 2px; border-radius: var(--radius-sm); font-size: 10.5px;
}
.tab-btn svg { width: 21px; height: 21px; }
.tab-btn.active { color: var(--rose-deep); font-weight: 600; }

/* ---------------- Screen layout ---------------- */
.screen-root { flex: 1; overflow-y: auto; padding: 18px 18px 28px; }
.screen { display: flex; flex-direction: column; gap: 16px; }
.screen-head h2 {
  font-size: 22px; position: relative; padding-left: 14px;
}
.screen-head h2::before {
  content: ''; position: absolute; left: 0; top: 3px; bottom: 3px; width: 4px;
  border-radius: 4px; background: linear-gradient(180deg, var(--rose-deep), var(--gold));
}
.section-head h3 { color: var(--rose-deep); }
.screen-sub { color: var(--ink-soft); font-size: 13px; margin-top: 2px; }
.screen-head-row { display: flex; align-items: flex-start; justify-content: space-between; gap: 10px; }
.head-actions { display: flex; gap: 8px; }
.head-actions-wrap { flex-wrap: wrap; }
.back-btn {
  align-self: flex-start; border: none; background: none; color: var(--rose-deep);
  font-weight: 600; font-size: 13.5px; padding: 0;
}
.link-btn { border: none; background: none; color: var(--rose-deep); font-weight: 600; font-size: 12.5px; }
.section-head { display: flex; align-items: center; justify-content: space-between; margin-top: 4px; }
.section-head h3 { font-size: 15.5px; }
.loading, .empty-state { color: var(--ink-soft); font-size: 13.5px; padding: 18px 4px; text-align: center; }
.error-text { color: var(--berry); font-size: 13.5px; }

/* ---------------- Alert banner ---------------- */
.alert-banner {
  background: rgba(166, 52, 70, 0.1); color: var(--berry);
  border: 1px solid rgba(166, 52, 70, 0.25);
  border-radius: var(--radius-sm); padding: 10px 14px; font-size: 12.5px; font-weight: 600;
}

/* ---------------- KPI grid ---------------- */
.kpi-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.kpi-card {
  background: var(--card-bg); border: 1px solid var(--line); border-radius: var(--radius);
  padding: 14px; display: flex; flex-direction: column; gap: 6px; box-shadow: var(--shadow);
}
.kpi-label { font-size: 11px; color: var(--ink-soft); text-transform: uppercase; letter-spacing: 0.04em; }
.kpi-value { font-family: 'JetBrains Mono', monospace; font-size: 20px; font-weight: 600; }
.kpi-value-sm { font-family: 'JetBrains Mono', monospace; font-size: 15px; font-weight: 600; }
.kpi-cobrar .kpi-value { color: var(--sage); }
.kpi-pagar .kpi-value { color: var(--berry); }

/* ---------------- Pill tabs ---------------- */
.pill-tabs { display: flex; gap: 6px; flex-wrap: wrap; }
.pill-tabs-secondary { margin-top: -6px; }
.pill-tab {
  border: 1px solid var(--line); background: var(--card-bg-solid); color: var(--ink-soft);
  border-radius: 999px; padding: 6px 13px; font-size: 12.5px; font-weight: 500;
}
.pill-tab.active { background: var(--ink); color: #fff; border-color: var(--ink); }

/* ---------------- Lists / cards ---------------- */
.list-stack { display: flex; flex-direction: column; gap: 8px; }
.list-stack-tight { gap: 6px; }
.row-card {
  display: flex; align-items: center; justify-content: space-between; gap: 10px;
  background: var(--card-bg); border: 1px solid var(--line); border-radius: var(--radius);
  padding: 12px 14px; box-shadow: var(--shadow);
}
.row-card-producto { flex-wrap: wrap; }
.row-card-main { display: flex; flex-direction: column; gap: 3px; min-width: 0; }
.row-card-title { font-weight: 600; font-size: 14px; }
.row-card-sub { font-size: 12px; color: var(--ink-soft); }
.row-card-end { display: flex; flex-direction: column; align-items: flex-end; gap: 4px; }
.row-card-monto { font-size: 13px; font-weight: 600; }
.chevron { color: var(--ink-soft); font-size: 18px; }
.tag-muted { font-size: 10px; color: var(--ink-soft); border: 1px solid var(--line); border-radius: 999px; padding: 1px 6px; margin-left: 6px; }
.mono-tag { font-size: 11px; background: var(--paper-soft); border-radius: 6px; padding: 1px 6px; margin-left: 6px; }
.texto-alerta { color: var(--berry); font-weight: 600; }
.texto-leve { color: var(--ink-soft); font-weight: 400; }
.kpi-sub { font-size: 11.5px; line-height: 1.2; }

/* ---------------- "Ver a quién entregar" (detalle de clientes por producto) ---------------- */
.detalle-clientes-producto { margin-top: 4px; width: 100%; }
.detalle-clientes-producto summary {
  cursor: pointer; font-size: 11.5px; font-weight: 600; color: var(--rose-deep);
  list-style: none;
}
.detalle-clientes-producto summary::-webkit-details-marker { display: none; }
.detalle-clientes-producto summary::before { content: '▸ '; }
.detalle-clientes-producto[open] summary::before { content: '▾ '; }
.lista-clientes-producto {
  list-style: none; margin: 6px 0 0; padding: 0; display: flex; flex-direction: column; gap: 4px;
}
.lista-clientes-producto li {
  display: flex; justify-content: space-between; gap: 8px;
  background: var(--paper-soft); border-radius: 8px; padding: 6px 10px; font-size: 12.5px;
}

/* ---------------- Checklist de pedido por producto/marca (Pedidos) ---------------- */
.checklist-empresa-head {
  display: flex; align-items: baseline; justify-content: space-between; gap: 8px;
  margin-top: 10px;
}
.checklist-empresa-head h3 { color: var(--rose-deep); font-size: 15.5px; }
.checklist-empresa-sub { font-size: 11.5px; color: var(--ink-soft); }
.checklist-campana-nombre { font-size: 12px; font-weight: 600; color: var(--ink-soft); margin: 6px 0 2px; }
.row-card-checklist { align-items: flex-start; flex-wrap: wrap; }
.checklist-cantidades { display: flex; gap: 10px; flex-wrap: wrap; margin-top: 2px; }
.checklist-cantidades span { font-size: 12px; color: var(--ink-soft); }
.checklist-cantidades strong { color: var(--ink); }
.checklist-diferencia { color: var(--berry) !important; }
.checklist-diferencia strong { color: var(--berry) !important; }
.checklist-acciones { display: flex; gap: 6px; align-items: center; flex-wrap: wrap; justify-content: flex-end; }
.checklist-check { display: flex; align-items: center; gap: 6px; font-size: 12px; color: var(--ink-soft); cursor: pointer; }
.checklist-check input { width: 17px; height: 17px; accent-color: var(--sage); }

.card-pedido {
  background: var(--card-bg); border: 1px solid var(--line); border-radius: var(--radius);
  padding: 14px; box-shadow: var(--shadow); display: flex; flex-direction: column; gap: 10px;
}
.card-pedido-head { display: flex; align-items: flex-start; justify-content: space-between; gap: 8px; }
.card-pedido-actions { display: flex; gap: 8px; flex-wrap: wrap; }
.mini-items { display: flex; flex-direction: column; gap: 5px; }
.mini-item {
  display: flex; align-items: center; justify-content: space-between; gap: 8px;
  font-size: 12.5px; background: var(--paper-soft); border-radius: 8px; padding: 6px 8px;
}
/* ---------------- Tarjeta de campaña (Inicio) ---------------- */
.campana-card-dash {
  display: flex; gap: 12px; align-items: stretch;
  background: var(--card-bg); border: 1px solid var(--line); border-radius: var(--radius);
  padding: 12px; box-shadow: var(--shadow); cursor: pointer;
}
.campana-card-media {
  width: 76px; flex-shrink: 0; border-radius: 12px; overflow: hidden;
  background: linear-gradient(145deg, var(--rose), var(--gold));
  display: flex; align-items: center; justify-content: center;
}
.campana-card-media img { width: 100%; height: 100%; object-fit: cover; }
.campana-media-inicial { font-family: 'Fraunces', serif; font-size: 26px; font-weight: 700; color: #fff; }
.campana-card-body { display: flex; flex-direction: column; gap: 6px; min-width: 0; flex: 1; }
.campana-card-top { display: flex; align-items: center; justify-content: space-between; gap: 8px; }
.tag-marca {
  font-size: 10px; font-weight: 700; text-transform: uppercase; letter-spacing: 0.03em;
  background: var(--paper-soft); color: var(--rose-deep); border-radius: 999px; padding: 2px 8px; flex-shrink: 0;
}
.campana-card-stats { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; margin-top: 2px; }
.campana-card-stats > div { display: flex; flex-direction: column; gap: 2px; }
.campana-card-stats .kpi-value-sm { font-size: 13px; line-height: 1.3; }
.campana-card-actions { display: flex; justify-content: flex-end; }

/* ---------------- Banner de filtro activo ---------------- */
.filtro-banner {
  display: flex; align-items: center; justify-content: space-between; gap: 10px;
  background: var(--paper-soft); border: 1px solid var(--line); border-radius: var(--radius-sm);
  padding: 8px 12px; font-size: 12.5px;
}

.notas-cliente {
  font-size: 12.5px; color: var(--ink-soft); background: var(--paper-soft);
  border-radius: var(--radius-sm); padding: 8px 12px;
}

/* ---------------- Badges ---------------- */
.badge {
  display: inline-block; font-size: 10px; font-weight: 700; letter-spacing: 0.03em;
  padding: 3px 8px; border-radius: 999px; text-transform: uppercase;
}
.badge-neutral { background: rgba(46,26,36,0.08); color: var(--ink-soft); }
.badge-gold { background: rgba(201,152,46,0.16); color: #8A6A1F; }
.badge-ok { background: rgba(95,138,99,0.16); color: var(--sage); }
.badge-alert { background: rgba(166,52,70,0.14); color: var(--berry); }

/* ---------------- Buttons ---------------- */
.btn {
  border: none; border-radius: 999px; padding: 10px 18px; font-size: 13.5px; font-weight: 600;
  display: inline-flex; align-items: center; justify-content: center; gap: 6px;
}
.btn-primary { background: var(--rose-deep); color: #fff; }
.btn-secondary { background: var(--card-bg-solid); color: var(--ink); border: 1px solid var(--line); }
.btn-danger { background: rgba(166,52,70,0.12); color: var(--berry); }
.btn-sm { padding: 7px 13px; font-size: 12px; }
.btn-eliminar-cliente { align-self: flex-start; }
.btn-upload { display: inline-flex; cursor: pointer; }

/* ---------------- Search box ---------------- */
.search-box {
  display: flex; align-items: center; gap: 8px;
  background: var(--card-bg-solid); border: 1px solid var(--line); border-radius: 999px;
  padding: 9px 14px;
}
.search-box svg { width: 16px; height: 16px; color: var(--ink-soft); flex-shrink: 0; }
.search-box input { border: none; outline: none; background: none; width: 100%; font-size: 13.5px; color: var(--ink); }

/* ---------------- Forms ---------------- */
.form-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.field { display: flex; flex-direction: column; gap: 5px; font-size: 12px; color: var(--ink-soft); }
.field-wide { grid-column: 1 / -1; }
.field-inline { flex-direction: row; align-items: center; gap: 8px; }
.field-inline-end { justify-content: flex-end; align-items: flex-end; }
.field-hint { font-size: 11.5px; color: var(--ink-soft); }
.field input[type="text"], .field input[type="tel"], .field input[type="number"],
.field input[type="date"], .field select, .field textarea {
  border: 1px solid var(--line); border-radius: var(--radius-sm); padding: 9px 11px;
  font-size: 13.5px; color: var(--ink); background: var(--card-bg-solid); outline: none;
}
.field input:focus, .field select:focus, .field textarea:focus { border-color: var(--rose); }
.field textarea { resize: vertical; }
.confirm-text { font-size: 14px; line-height: 1.5; }

.autocomplete-list { display: flex; flex-direction: column; gap: 2px; max-height: 160px; overflow-y: auto; }
.autocomplete-item {
  padding: 8px 10px; border-radius: 8px; font-size: 13px; cursor: pointer;
  display: flex; justify-content: space-between; gap: 8px;
}
.autocomplete-item:hover { background: var(--paper-soft); }
.autocomplete-new { color: var(--rose-deep); font-weight: 600; }

/* ---------------- Cuenta resumen ---------------- */
.cuenta-resumen {
  display: grid; grid-template-columns: repeat(4, 1fr); gap: 10px;
  background: var(--paper-soft); border-radius: var(--radius-sm); padding: 12px;
}
.cuenta-resumen-sm { grid-template-columns: repeat(3, 1fr); }
.cuenta-resumen > div { display: flex; flex-direction: column; gap: 3px; }
/* Total general del cliente (todas las marcas/campañas juntas): mismas 3
   columnas que cuenta-resumen-sm, pero con un acento para distinguirlo de
   los totales por campaña de cada tarjeta de pedido. */
.cuenta-resumen-total {
  grid-template-columns: repeat(3, 1fr);
  background: var(--card-bg-solid); border: 1px solid var(--rose-deep);
}

/* ---------------- Catálogo ---------------- */
.catalogo-preview { display: flex; justify-content: center; }
.catalogo-img { width: 100%; border-radius: var(--radius); border: 1px solid var(--line); }
.catalogo-item { align-items: flex-start; flex-wrap: wrap; gap: 8px; }
.catalogo-item-acciones { display: flex; gap: 6px; flex-wrap: wrap; align-items: center; }
.pagina-preview { display: flex; justify-content: center; margin-top: 10px; }
.pagina-preview-img { max-width: 100%; border-radius: var(--radius); border: 1px solid var(--line); }

/* ---------------- Importación por OCR ---------------- */
.ocr-panel { margin-top: 10px; }
#ocr-progreso { display: flex; align-items: center; gap: 10px; margin-top: 6px; }

/* ---------------- Modal ---------------- */
.modal-backdrop {
  position: fixed; inset: 0; background: rgba(46,26,36,0.45); backdrop-filter: blur(2px);
  display: flex; align-items: flex-end; justify-content: center; z-index: 100;
}
.modal-backdrop.hidden { display: none; }
.modal-box {
  width: 100%; max-width: 560px; max-height: 88vh; overflow-y: auto;
  background: var(--paper); border-radius: 22px 22px 0 0; box-shadow: 0 -10px 30px rgba(0,0,0,0.2);
  padding: 18px 18px calc(18px + env(safe-area-inset-bottom));
  animation: modal-up 0.22s ease-out;
}
@media (min-width: 620px) {
  .modal-backdrop { align-items: center; }
  .modal-box { border-radius: 20px; max-height: 82vh; }
}
.modal-wide { max-width: 620px; }
@keyframes modal-up { from { transform: translateY(24px); opacity: 0; } to { transform: translateY(0); opacity: 1; } }
.modal-head { display: flex; align-items: center; justify-content: space-between; margin-bottom: 14px; }
.modal-head h3 { font-size: 17px; }
.modal-body { display: flex; flex-direction: column; gap: 14px; }
.modal-footer { display: flex; justify-content: flex-end; gap: 8px; margin-top: 16px; }
.modal-footer-inline { justify-content: space-between; align-items: center; }

/* ---------------- Edición de líneas de pedido ---------------- */
.linea-editable {
  display: grid; grid-template-columns: minmax(0, 1.2fr) minmax(0, 1.4fr) 64px 84px 28px;
  gap: 6px; align-items: center; background: var(--paper-soft); border-radius: 8px; padding: 6px 8px;
  font-size: 12px;
}
.linea-editable-base { color: var(--ink-soft); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.linea-editable input {
  border: 1px solid var(--line); border-radius: 6px; padding: 5px 7px; font-size: 12px;
  background: var(--card-bg-solid); color: var(--ink); width: 100%;
}

/* ---------------- Tabla de importación de PDF ---------------- */
.import-tabla { display: flex; flex-direction: column; gap: 6px; max-height: 320px; overflow-y: auto; }
.import-fila {
  display: grid; grid-template-columns: 20px 90px minmax(0, 1fr) 90px auto;
  gap: 8px; align-items: center; background: var(--card-bg-solid); border: 1px solid var(--line);
  border-radius: 8px; padding: 8px;
}
.import-fila input[type="text"], .import-fila input[type="number"] {
  border: 1px solid var(--line); border-radius: 6px; padding: 6px 8px; font-size: 12.5px; width: 100%;
}
.import-fila .badge { justify-self: end; white-space: nowrap; }

/* ---------------- Toast ---------------- */
.toast-root { position: fixed; bottom: 84px; left: 50%; transform: translateX(-50%); z-index: 200; display: flex; flex-direction: column; gap: 6px; align-items: center; }
.toast {
  background: var(--ink); color: #fff; padding: 9px 16px; border-radius: 999px; font-size: 12.5px;
  opacity: 0; transform: translateY(8px); transition: all 0.2s ease; box-shadow: var(--shadow);
}
.toast.show { opacity: 1; transform: translateY(0); }
.toast-error { background: var(--berry); }

/* ---------------- Captura oculta (estado de cuenta / afiches) ---------------- */
.captura-root { position: fixed; left: -9999px; top: 0; }
.captura-root.render { left: -9999px; }
.captura-card { width: 480px; background: var(--paper); padding: 28px; font-family: 'Space Grotesk', sans-serif; color: var(--ink); }
.ec-head { text-align: center; margin-bottom: 16px; }
.ec-marca { font-size: 11px; letter-spacing: 0.08em; text-transform: uppercase; color: var(--rose-deep); font-weight: 700; }
.ec-head h2 { font-family: 'Fraunces', serif; font-size: 24px; margin: 4px 0 2px; }
.ec-head p { color: var(--ink-soft); font-size: 12.5px; }
.ec-cliente { display: flex; justify-content: space-between; align-items: baseline; border-top: 1px solid var(--line); border-bottom: 1px solid var(--line); padding: 10px 0; margin-bottom: 12px; font-size: 13px; }
.ec-tabla { width: 100%; border-collapse: collapse; font-size: 12.5px; margin-bottom: 14px; }
.ec-tabla th { text-align: left; color: var(--ink-soft); font-weight: 600; font-size: 10.5px; text-transform: uppercase; padding-bottom: 6px; border-bottom: 1px solid var(--line); }
.ec-tabla td { padding: 6px 0; border-bottom: 1px dashed var(--line); }
.ec-totales { display: flex; flex-direction: column; gap: 4px; font-size: 13px; margin-bottom: 10px; }
.ec-totales > div { display: flex; justify-content: space-between; }
.ec-saldo { font-weight: 700; font-size: 15px; border-top: 1px solid var(--line); padding-top: 6px; }
.ec-limite { text-align: center; font-size: 12px; color: var(--rose-deep); font-weight: 600; }
.ec-seccion { margin-bottom: 14px; padding-bottom: 10px; border-bottom: 1px dashed var(--line); }
.ec-seccion:last-of-type { border-bottom: none; }
.ec-seccion-head { display: flex; align-items: baseline; gap: 6px; margin-bottom: 6px; }
.ec-seccion-head strong { font-size: 13.5px; }
.ec-subtotal { display: flex; justify-content: space-between; font-size: 12.5px; color: var(--ink-soft); font-weight: 600; }

/* ---------------- Cuentas por pagar agrupadas por empresa ---------------- */
.empresa-grupo { display: flex; flex-direction: column; gap: 8px; margin-bottom: 4px; }
.empresa-grupo-head {
  display: flex; align-items: center; justify-content: space-between;
  background: var(--paper-soft); border-radius: var(--radius-sm);
  padding: 10px 12px;
}
.empresa-grupo-head .empresa-nombre { font-family: 'Fraunces', serif; font-weight: 600; font-size: 14.5px; }
.empresa-grupo-head .empresa-saldo { font-family: 'JetBrains Mono', monospace; font-weight: 600; font-size: 13.5px; color: var(--rose-deep); }

/* ---------------- Ajustes ---------------- */
.ajustes-body { display: flex; flex-direction: column; gap: 8px; font-size: 13.5px; }

/* ---------- Acceso (login) y aviso de abono desde Control Bancario ---------- */
.login-wrap { min-height: 70vh; display: grid; place-items: center; padding: 16px; }
.login-card { width: 100%; max-width: 380px; text-align: center; padding: 22px 18px; background: var(--card-bg-solid); border: 1px solid var(--line); border-radius: var(--radius); box-shadow: var(--shadow); }
.login-card h2 { margin: 10px 0 4px; }
.login-card .field { text-align: left; display: block; margin-bottom: 10px; }
.login-logo { margin: 0 auto; }
.login-error { color: #B4332B; background: #FBE6E3; border-radius: 10px; padding: 8px 12px; font-size: 13.5px; margin: 0 0 12px; text-align: left; }
.abono-banner { margin: 10px 14px 0; padding: 12px 14px; border-radius: 14px; background: var(--paper-soft); border: 1px solid var(--rose); font-size: 13.5px; line-height: 1.45; }
.abono-banner.ok { background: #E4F3EA; border-color: #1E7A4D; }
.abono-acc { display: flex; gap: 8px; margin-top: 8px; flex-wrap: wrap; }

/* ---------- Flete de la campaña (Cuenta por pagar) ---------- */
.flete-card { margin: 10px 0 4px; align-items: center; gap: 10px; flex-wrap: wrap; }
.flete-card .head-actions { display: flex; gap: 6px; flex-wrap: wrap; }

/* ==========================================================================
   v27 — Marcas visibles, campaña como centro de trabajo, entregas y cierre
   ========================================================================== */

/* ---------- Color de marca ---------- */
.tag-marca { box-shadow: none; }
.tag-marca-grande { font-size: 12px; padding: 4px 11px; letter-spacing: 0.05em; }
.tag-marca-topbar { font-size: 9.5px; padding: 1px 7px; border: 1px solid rgba(255,255,255,0.55); vertical-align: 1px; }
.topbar-campana { font-weight: 600; color: #fff; }
.topbar.topbar-con-marca {
  background: linear-gradient(120deg, var(--ink) 0%, var(--marca) 75%);
}
.con-marca { border-left: 6px solid var(--marca); }
.campana-row { cursor: pointer; }
.campana-row-top { display: flex; align-items: center; gap: 6px; }
.campana-row-nombre { font-size: 15px; }
.campana-card-media-marca { background: linear-gradient(145deg, var(--marca), var(--ink)); }
.campana-card-actions { gap: 6px; flex-wrap: wrap; }
#btn-adelante.hidden { display: none; }
.btn[disabled] { opacity: 0.45; cursor: not-allowed; }

/* ---------- Encabezado de la campaña ---------- */
.hub-head {
  display: flex; align-items: flex-start; justify-content: space-between; gap: 10px;
  background: var(--marca-suave); border: 1px solid var(--line); border-left: 6px solid var(--marca);
  border-radius: var(--radius); padding: 14px;
}
.hub-head-main { display: flex; flex-direction: column; gap: 6px; min-width: 0; }
.hub-head-top { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.hub-titulo { font-size: 22px; color: var(--ink); }
.hub-fechas { font-size: 12px; color: var(--ink-soft); }

/* ---------- Barra de secciones (se desliza de lado en el celular) ---------- */
.hub-secciones {
  display: flex; gap: 6px; overflow-x: auto; padding: 2px 0 6px;
  scrollbar-width: none; -webkit-overflow-scrolling: touch;
  position: sticky; top: 0; z-index: 5; background: var(--paper);
}
.hub-secciones::-webkit-scrollbar { display: none; }
.hub-sec {
  flex-shrink: 0; display: inline-flex; align-items: center; gap: 6px;
  border: 1px solid var(--line); background: var(--card-bg-solid); color: var(--ink);
  border-radius: 999px; padding: 7px 12px; font-size: 12.5px; font-weight: 500; white-space: nowrap;
}
.hub-sec.active { background: var(--marca); border-color: var(--marca); color: #fff; font-weight: 600; }
.hub-sec-num {
  width: 19px; height: 19px; border-radius: 50%; display: inline-flex; align-items: center; justify-content: center;
  font-size: 11px; font-weight: 700; background: var(--paper-soft); color: var(--ink-soft);
}
.hub-sec.hecho .hub-sec-num { background: var(--sage); color: #fff; }
.hub-sec.active .hub-sec-num { background: rgba(255,255,255,0.25); color: #fff; }
.hub-total { font-size: 12.5px; color: var(--ink-soft); }

/* ---------- Resumen ---------- */
.hub-numeros {
  display: grid; grid-template-columns: 1fr 1fr; gap: 10px;
  background: var(--card-bg); border: 1px solid var(--line); border-radius: var(--radius); padding: 14px; box-shadow: var(--shadow);
}
.hub-numeros > div { display: flex; flex-direction: column; gap: 2px; min-width: 0; }
.pasos-lista { display: flex; flex-direction: column; gap: 6px; }
.paso {
  display: flex; align-items: center; gap: 10px; text-align: left; width: 100%;
  background: var(--card-bg); border: 1px solid var(--line); border-radius: var(--radius-sm);
  padding: 10px 12px; color: var(--ink);
}
.paso-marca {
  width: 26px; height: 26px; border-radius: 50%; flex-shrink: 0;
  display: inline-flex; align-items: center; justify-content: center;
  font-size: 12px; font-weight: 700; background: var(--paper-soft); color: var(--ink-soft);
}
.paso-ok .paso-marca { background: var(--sage); color: #fff; }
.paso-falta .paso-marca { background: rgba(166,52,70,0.14); color: var(--berry); }
.paso-texto { display: flex; flex-direction: column; gap: 2px; flex: 1; min-width: 0; font-size: 13px; }
.paso-texto span { font-size: 11.5px; color: var(--ink-soft); }
.paso .chevron { margin-left: auto; }

/* ---------- Clientas ---------- */
.link-cliente {
  border: none; background: none; padding: 0; text-align: left;
  font-weight: 600; font-size: 14.5px; color: var(--ink);
}
.link-cliente:hover { color: var(--marca, var(--rose-deep)); }

/* ---------- Entregas ---------- */
.fila-recibido {
  display: flex; align-items: center; justify-content: space-between; gap: 8px; flex-wrap: wrap;
  background: var(--card-bg); border: 1px solid var(--line); border-left: 4px solid var(--line);
  border-radius: var(--radius-sm); padding: 8px 10px; font-size: 13px;
}
.fila-recibido.ok { border-left-color: var(--sage); }
.fila-recibido.parcial { border-left-color: var(--berry); }
.fila-recibido-nombre { min-width: 0; flex: 1 1 160px; }
.fila-recibido-ctrl { display: inline-flex; align-items: center; gap: 6px; flex-wrap: wrap; }
.icon-btn-mini { width: 28px; height: 28px; font-size: 16px; font-weight: 700; line-height: 1; }
.entrega-items { display: flex; flex-direction: column; gap: 5px; }
.entrega-item {
  display: flex; align-items: center; justify-content: space-between; gap: 8px;
  background: var(--paper-soft); border-radius: 8px; padding: 6px 8px; font-size: 13px;
}
.entrega-item.ok { background: rgba(95,138,99,0.12); }
.entrega-check { display: flex; align-items: center; gap: 8px; cursor: pointer; min-width: 0; }
.entrega-check input { width: 20px; height: 20px; accent-color: var(--sage); flex-shrink: 0; }
.aviso-chico { display: block; font-size: 10.5px; color: var(--berry); font-weight: 600; }
.card-entrega.listo { opacity: 0.75; }

/* ---------- Cierre y acta ---------- */
.aviso-suave {
  font-size: 12px; background: rgba(201,152,46,0.12); color: #6E5418;
  border-radius: var(--radius-sm); padding: 8px 12px;
}
.liquidacion-tabla {
  display: flex; flex-direction: column; gap: 2px;
  background: var(--card-bg); border: 1px solid var(--line); border-radius: var(--radius); padding: 12px 14px;
}
.liquidacion-tabla > div { display: flex; justify-content: space-between; gap: 10px; font-size: 13px; padding: 4px 0; }
.liq-total { border-top: 1px solid var(--line); font-weight: 700; font-size: 14.5px !important; }
.liq-margen { color: var(--sage); font-weight: 700; }
.btn-cierre { align-self: stretch; padding: 13px 18px; font-size: 14px; background: var(--marca, var(--rose-deep)); }
.cierre-ok {
  display: flex; flex-direction: column; gap: 3px; font-size: 13px;
  background: rgba(95,138,99,0.12); border: 1px solid rgba(95,138,99,0.4); border-radius: var(--radius-sm); padding: 10px 12px;
}
.acta-preview { background: #fff; border: 1px solid var(--line); border-radius: var(--radius); padding: 18px; overflow-x: auto; }
.acta { font-family: 'Space Grotesk', sans-serif; color: #2E1A24; background: #fff; }
.acta-head { text-align: center; border-bottom: 3px solid; padding-bottom: 10px; margin-bottom: 12px; }
.acta-marca { display: inline-block; color: #fff; font-size: 11px; font-weight: 700; letter-spacing: 0.06em; text-transform: uppercase; border-radius: 999px; padding: 3px 10px; }
.acta-head h2 { font-family: 'Fraunces', serif; font-size: 22px; margin: 6px 0 2px; }
.acta-head p { font-size: 12.5px; color: #7A5B66; }
.acta-tabla { width: 100%; border-collapse: collapse; font-size: 13px; margin-bottom: 12px; }
.acta-tabla td { padding: 6px 0; border-bottom: 1px dashed rgba(46,26,36,0.15); }
.acta-tabla td:last-child { text-align: right; }
.acta-fuerte td { font-weight: 700; }
.acta-traslado { display: flex; justify-content: space-between; align-items: center; gap: 10px; border: 2px solid; border-radius: 10px; padding: 10px 12px; font-size: 13px; }
.acta-traslado strong.mono { font-size: 16px; }
.acta-nota { font-size: 12px; color: #7A5B66; margin-top: 8px; }
.acta-caja { font-size: 12.5px; margin-top: 10px; text-align: center; }
.acta-firmas { display: grid; grid-template-columns: 1fr 1fr; gap: 24px; margin-top: 34px; font-size: 11.5px; color: #7A5B66; text-align: center; }
.acta-firmas span { display: block; border-top: 1px solid #2E1A24; margin-bottom: 4px; }

/* Imprimir / guardar PDF: solo el acta */
#print-root { display: none; }
@media print {
  body.imprimiendo #app, body.imprimiendo .modal-backdrop, body.imprimiendo .toast-root, body.imprimiendo #captura-root { display: none !important; }
  body.imprimiendo #print-root { display: block; }
  body.imprimiendo { background: #fff; }
  .print-card { width: auto; max-width: 640px; margin: 0 auto; background: #fff; padding: 0; }
}

@media (max-width: 380px) {
  .hub-numeros { grid-template-columns: 1fr; }
  .hub-titulo { font-size: 19px; }
}
.campana-card-media { width: 58px; }
.campana-card-media .campana-media-inicial { font-size: 22px; }
.field input[type="text"], .field input[type="tel"], .field input[type="number"],
.field input[type="date"], .field select { width: 100%; min-width: 0; }
.form-grid > * { min-width: 0; }
/* la barra de secciones queda pegada justo debajo de la barra superior */
.hub-secciones { top: 64px; margin: 0 -18px; padding: 6px 18px; }
.campana-hub .section-head { flex-wrap: wrap; gap: 8px; }
.campana-hub .section-head .head-actions { flex-wrap: wrap; }

/* ---------- v28: varias marcas en una sola campaña (L'Bel + Ésika + Cyzone) ---------- */
.tag-marca-mini { font-size: 8.5px; padding: 1px 6px; vertical-align: 1px; }
.hub-marcas { display: flex; flex-wrap: wrap; align-items: center; gap: 5px; font-size: 11.5px; color: var(--ink-soft); }
.chip-marca {
  display: inline-flex; align-items: center; gap: 4px;
  background: #fff; color: var(--marca); border: 1px solid var(--marca);
  border-radius: 999px; padding: 1px 8px; font-size: 11px; font-weight: 600;
}
.chip-marca b { background: var(--marca); color: #fff; border-radius: 999px; padding: 0 5px; font-size: 10px; }
.pill-tab.pill-marca.active { background: var(--marca); border-color: var(--marca); }
.aviso-unir {
  display: flex; align-items: center; justify-content: space-between; gap: 10px; flex-wrap: wrap;
  background: var(--marca-suave); border: 1px solid var(--marca); border-left: 6px solid var(--marca);
  border-radius: var(--radius-sm); padding: 10px 12px; font-size: 12.5px;
}
.aviso-unir > div { display: flex; flex-direction: column; gap: 3px; flex: 1 1 220px; }
.aviso-unir span { color: var(--ink-soft); font-size: 11.5px; }
.unir-opcion { justify-content: flex-start; cursor: pointer; }
.unir-opcion input { width: 20px; height: 20px; accent-color: var(--rose-deep); flex-shrink: 0; }
.modal-footer { flex-wrap: wrap; }

/* v29 — todas las secciones de la campaña a la vista, sin deslizar:
   los botones bajan a una segunda (o tercera) fila cuando no caben. */
.hub-secciones {
  position: static; flex-wrap: wrap; overflow: visible;
  margin: 0; padding: 0; gap: 6px;
}
.hub-sec { padding: 6px 11px; font-size: 12.5px; }
