:root {
  --navy: #1c2a5c;
  --navy-light: #263672;
  --purple: #7c6ce8;
  --purple-light: #a89bff;
  --coral: #ff7a5c;
  --yellow: #ffd23f;
  --bg: #f4f6f8;
  --surface: #fff;
  --text: #1f2933;
  --muted: #6b7280;
}

* { margin: 0; padding: 0; box-sizing: border-box; }
body {
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
  background: var(--bg); color: var(--text);
  display: flex; min-height: 100vh;
}

/* ── Sidebar ── */
.sidebar {
  width: 232px; background: var(--navy); color: #cbd3ef;
  display: flex; flex-direction: column; padding: 20px 0; flex-shrink: 0;
}
.sidebar .brand {
  display: flex; align-items: center; gap: 10px;
  font-size: 17px; font-weight: 700; padding: 4px 20px 24px; color: #fff;
}
.brand-logo { width: 30px; height: 30px; object-fit: contain; flex-shrink: 0; }
.brand-text { display: flex; flex-direction: column; line-height: 1.3; min-width: 0; }
.brand-text small {
  font-size: 11px; font-weight: 500; color: #aab3d8;
  overflow: hidden; text-overflow: ellipsis; white-space: nowrap; max-width: 160px;
}
.sidebar a {
  display: flex; align-items: center; gap: 12px;
  color: #aab3d8; text-decoration: none; padding: 11px 20px; font-size: 14px;
  font-weight: 500; margin: 2px 10px; border-radius: 10px; transition: background .15s, color .15s;
}
.nav-icon { width: 19px; height: 19px; flex-shrink: 0; opacity: .85; }
.sidebar a:hover { color: #fff; background: var(--navy-light); }
.sidebar a.active { color: #fff; background: var(--purple); }
.sidebar a.active .nav-icon { opacity: 1; }
.sidebar-footer { margin-top: auto; }
.sidebar-footer a:hover { background: rgba(255,255,255,.08); }
.sidebar-user-link {
  display: block; text-decoration: none; margin: 2px 10px; border-radius: 10px;
  transition: background .15s;
}
.sidebar-user-link:hover { background: var(--navy-light); }
.sidebar-user-link.active { background: var(--purple); }
.sidebar-user { padding: 8px 10px 8px; display: flex; flex-direction: column; gap: 1px; }
.sidebar-user-name { color: #fff; font-size: 13px; font-weight: 600; }
.sidebar-user-role { color: #aab3d8; font-size: 11px; text-transform: capitalize; }
.nav-section-label {
  color: #7885b8; font-size: 11px; font-weight: 700; text-transform: uppercase;
  letter-spacing: .06em; padding: 16px 20px 6px;
}

.lang-switcher {
  display: flex; align-items: center; gap: 10px; margin: 6px 20px 0; padding: 10px 0 0;
  border-top: 1px solid rgba(255,255,255,.08); color: #aab3d8;
}
.lang-switcher select {
  flex: 1; background: var(--navy-light); color: #fff; border: none; border-radius: 8px;
  padding: 6px 8px; font-size: 13px; cursor: pointer;
}
.lang-switcher-login {
  position: absolute; top: 16px; right: 16px;
}
.lang-switcher-login select {
  background: #fff; color: var(--navy); border: 1px solid #e5e7eb; border-radius: 8px;
  padding: 6px 10px; font-size: 13px; cursor: pointer;
}

.content { flex: 1; padding: 28px 32px; min-width: 0; }

/* Páginas de contenido angosto (formularios cortos + tabla de pocas columnas):
   evita que se vea disperso en pantallas anchas. */
.page-narrow { max-width: 960px; margin: 0 auto; }

/* ── Menú móvil (barra + drawer) ── */
.mobile-topbar { display: none; }
.mobile-menu-toggle { background: none; border: none; color: #fff; padding: 6px; cursor: pointer; display: flex; }
.mobile-topbar-brand { display: flex; align-items: center; gap: 8px; color: #fff; font-weight: 700; font-size: 15px; min-width: 0; }
.mobile-topbar-brand img { width: 24px; height: 24px; object-fit: contain; flex-shrink: 0; }
.mobile-topbar-brand span { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.sidebar-overlay { display: none; }

/* ── Panel de plataforma (super-admin) ── */
body.superadmin-body { flex-direction: column; }
.superadmin-topbar {
  display: flex; align-items: center; justify-content: space-between;
  background: var(--navy); padding: 14px 32px; flex-shrink: 0;
  border-bottom: 3px solid transparent;
  border-image: linear-gradient(90deg, var(--purple), var(--coral) 40%, var(--yellow)) 1;
}
.brand-text-row { display: flex; align-items: center; gap: 10px; font-size: 17px; font-weight: 700; color: #fff; }
.superadmin-content { flex: 1; padding: 32px; max-width: 900px; margin: 0 auto; width: 100%; }
.superadmin-heading { font-size: 22px; font-weight: 800; color: var(--navy); letter-spacing: -.01em; margin-bottom: 20px; }

.bot-mark { width: 13px; height: 13px; object-fit: contain; vertical-align: -2px; margin-right: 3px; }

/* ── Encabezado ── */
.page-header {
  display: flex; justify-content: space-between; align-items: center;
  margin-bottom: 24px; padding-bottom: 18px;
  border-bottom: 3px solid transparent;
  border-image: linear-gradient(90deg, var(--purple), var(--coral) 40%, var(--yellow)) 1;
}
.page-header h1 { font-size: 24px; font-weight: 800; color: var(--navy); letter-spacing: -.01em; }

.pill {
  border: none; border-radius: 999px; padding: 8px 16px; font-size: 13px;
  cursor: pointer; font-weight: 600;
}
.pill.running { background: #d1fae5; color: #065f46; }
.pill.paused  { background: #fee2e2; color: #991b1b; }

.hint { font-size: 13px; color: #6b7280; margin-top: 16px; max-width: 640px; }
.empty { color: #9ca3af; font-size: 14px; padding: 16px; }

/* ── Dashboard ── */
.cards { display: grid; grid-template-columns: repeat(auto-fit, minmax(160px, 1fr)); gap: 16px; }
.card {
  background: #fff; border-radius: 12px; padding: 20px;
  box-shadow: 0 1px 3px rgba(0,0,0,.08);
  border-top: 4px solid var(--purple);
}
.card:nth-of-type(4n+2) { border-top-color: var(--coral); }
.card:nth-of-type(4n+3) { border-top-color: var(--navy); }
.card:nth-of-type(4n)   { border-top-color: var(--yellow); }
.card-value { font-size: 32px; font-weight: 700; color: var(--navy); }
.card-label { font-size: 13px; color: #6b7280; margin-top: 4px; }

/* ── Analíticas (reutiliza .cards, .range-filter y .bar-chart de Reportes) ── */
.keyword-list { display: flex; flex-direction: column; gap: 8px; }
.keyword-row { display: flex; align-items: center; gap: 10px; font-size: 13px; }
.keyword-word { width: 110px; flex-shrink: 0; color: #374151; font-weight: 600; text-transform: capitalize; }
.keyword-bar-track { flex: 1; background: #f3f4f6; border-radius: 999px; height: 10px; overflow: hidden; }
.keyword-bar { height: 100%; background: var(--yellow); border-radius: 999px; }
.keyword-count { width: 30px; text-align: right; color: #6b7280; }

/* ── Bandeja ── */
.inbox { display: flex; gap: 16px; height: calc(100vh - 48px); }
.conv-list {
  width: 300px; flex-shrink: 0; overflow-y: auto;
  background: #fff; border-radius: 12px; box-shadow: 0 1px 3px rgba(0,0,0,.08);
}
.conv {
  display: block; padding: 12px 14px; border-bottom: 1px solid #f3f4f6;
  text-decoration: none; color: inherit;
}
.conv:hover { background: #f9fafb; }
.conv.selected { background: #eff6ff; border-left: 3px solid var(--purple); }
.conv-top { display: flex; justify-content: space-between; align-items: center; }
.conv-name { font-weight: 600; font-size: 14px; }
.conv-tags { display: flex; gap: 4px; flex-shrink: 0; }
.conv-labels { display: flex; flex-wrap: wrap; gap: 4px; margin-top: 4px; }
.label-pill {
  background: #ede9fe; color: #5b21b6; font-size: 10px; font-weight: 600;
  padding: 1px 7px; border-radius: 999px;
}
.conv-preview { font-size: 13px; color: #6b7280; margin-top: 2px;
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.conv-time { font-size: 11px; color: #9ca3af; margin-top: 2px; }

.conv-search { padding: 12px 14px; border-bottom: 1px solid #f3f4f6; display: flex; flex-direction: column; gap: 6px; }
.conv-search input[type="text"], .conv-search input[type="date"], .conv-search select {
  border: 1px solid #d1d5db; border-radius: 8px; padding: 7px 9px; font-size: 13px; width: 100%;
}
.conv-search-row { display: flex; gap: 6px; align-items: center; }
.conv-search-row select { flex: 1; }
.conv-search-row input[type="date"] { flex: 1; min-width: 0; }
.conv-search-star {
  display: flex; align-items: center; gap: 3px; font-size: 15px; color: #d1d5db;
  cursor: pointer; flex-shrink: 0; padding: 0 4px;
}
.conv-search-star input:checked ~ * { color: #f59e0b; }
.conv-search button {
  background: var(--purple); color: #fff; border: none; border-radius: 8px;
  padding: 7px 14px; font-size: 13px; font-weight: 600; cursor: pointer;
}
.conv-search-clear { font-size: 12px; color: #6b7280; align-self: center; }
.tags-editor {
  display: flex; align-items: center; gap: 8px; padding: 10px 16px;
  border-bottom: 1px solid #f3f4f6; font-size: 13px;
}
.tags-editor-label { color: #6b7280; font-weight: 600; flex-shrink: 0; }
.tags-editor input {
  flex: 1; border: 1px solid #d1d5db; border-radius: 8px; padding: 6px 10px; font-size: 13px;
}
.tags-editor button {
  background: var(--purple); color: #fff; border: none; border-radius: 8px;
  padding: 6px 14px; font-size: 12px; font-weight: 600; cursor: pointer; flex-shrink: 0;
}
.star-toggle {
  background: none; border: 1px solid #d1d5db; border-radius: 999px; width: 30px; height: 30px;
  font-size: 15px; color: #d1d5db; cursor: pointer; flex-shrink: 0;
}
.star-toggle.starred { color: #f59e0b; border-color: #f59e0b; }

.tag.manual {
  background: #fef3c7; color: #92400e; font-size: 11px;
  padding: 1px 8px; border-radius: 999px; font-weight: 600;
}
.tag.attention {
  background: #fee2e2; color: #991b1b; font-size: 11px;
  padding: 1px 8px; border-radius: 999px; font-weight: 600; margin-left: 4px;
}
.card-alert { border-top-color: #dc2626 !important; }
.attention-banner {
  display: flex; align-items: center; justify-content: space-between; gap: 12px;
  background: #fee2e2; color: #991b1b; padding: 10px 16px; font-size: 13px; font-weight: 600;
}
.attention-banner button {
  background: #fff; color: #991b1b; border: 1px solid #991b1b; border-radius: 999px;
  padding: 6px 14px; font-size: 12px; font-weight: 600; cursor: pointer; flex-shrink: 0;
}

.chat {
  flex: 1; display: flex; flex-direction: column; min-width: 0;
  background: #fff; border-radius: 12px; box-shadow: 0 1px 3px rgba(0,0,0,.08);
}
.chat-header {
  display: flex; justify-content: space-between; align-items: center;
  padding: 12px 16px; border-bottom: 1px solid #f3f4f6;
}
.chat-phone { color: #6b7280; font-size: 13px; margin-left: 8px; }
.chat-header-actions { display: flex; align-items: center; gap: 10px; }
.export-link-inline { color: var(--purple); font-size: 13px; font-weight: 600; text-decoration: none; }
.export-link-inline:hover { text-decoration: underline; }
.chat-messages { flex: 1; overflow-y: auto; padding: 16px; display: flex; flex-direction: column; gap: 8px; }
.bubble { max-width: 70%; padding: 8px 12px; border-radius: 12px; font-size: 14px; }
.bubble.in  { background: #f3f4f6; align-self: flex-start; }
.bubble.out { background: #dbeafe; align-self: flex-end; }
.bubble-text { white-space: pre-wrap; word-break: break-word; }
.bubble-time { font-size: 10px; color: #9ca3af; margin-top: 4px; text-align: right; }

.chat-input { display: flex; gap: 8px; padding: 12px 16px; border-top: 1px solid #f3f4f6; }
.chat-input input {
  flex: 1; border: 1px solid #d1d5db; border-radius: 999px; padding: 10px 16px; font-size: 14px;
}
.chat-input button {
  background: var(--purple); color: #fff; border: none; border-radius: 999px;
  padding: 10px 20px; font-size: 14px; font-weight: 600; cursor: pointer;
}
.chat-input button:disabled { opacity: .5; }
.send-error { color: #b91c1c; font-size: 13px; padding: 0 16px 12px; }

/* ── CRM ── */
.crm { width: 100%; border-collapse: collapse; background: #fff; border-radius: 12px;
  overflow: hidden; box-shadow: 0 1px 3px rgba(0,0,0,.08); }
.crm th, .crm td { padding: 10px 12px; text-align: left; font-size: 14px; }
.crm th { background: #f9fafb; color: #6b7280; font-size: 12px; text-transform: uppercase; }
.crm tr { border-bottom: 1px solid #f3f4f6; }
.crm input { border: 1px solid transparent; border-radius: 6px; padding: 6px 8px;
  font-size: 14px; width: 100%; background: transparent; }
.crm input:hover, .crm input:focus { border-color: #d1d5db; background: #fff; outline: none; }
.crm-save { background: var(--purple); color: #fff; border: none; border-radius: 6px;
  padding: 6px 12px; font-size: 13px; cursor: pointer; }
.crm a { color: var(--purple); text-decoration: none; }
.qr-shortcut-cell { display: flex; align-items: center; gap: 2px; color: #9ca3af; font-weight: 600; }

/* ── Menú / Catálogo ── */
.callout-warn {
  background: #fef3c7; color: #92400e; border-radius: 10px;
  padding: 12px 16px; font-size: 13px; margin-bottom: 20px; max-width: 700px;
}
.menu-form-card, .catalog-doc-card {
  background: #fff; border-radius: 12px; padding: 18px 20px; margin-bottom: 20px;
  box-shadow: 0 1px 3px rgba(0,0,0,.08); max-width: 700px;
}
.menu-form-card h2, .catalog-doc-card h2 { font-size: 15px; margin-bottom: 12px; }
.menu-form { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; }
.menu-form input[type="text"], .menu-form input[type="number"] {
  border: 1px solid #d1d5db; border-radius: 8px; padding: 8px 10px; font-size: 13px;
}
.menu-form input[type="file"] { font-size: 12px; }
.menu-form button, .catalog-doc-card button {
  background: var(--purple); color: #fff; border: none; border-radius: 8px;
  padding: 8px 16px; font-size: 13px; font-weight: 600; cursor: pointer;
}
.menu-form button:disabled, .catalog-doc-card button:disabled { opacity: .5; cursor: not-allowed; }
.form-error { color: #b91c1c; font-size: 13px; margin-top: 8px; }
.catalog-doc-card form { display: flex; gap: 8px; align-items: center; margin-top: 8px; }

.menu-table .item-image { display: block; font-size: 11px; margin-top: 4px; width: 110px; }
.menu-thumb { width: 44px; height: 44px; object-fit: cover; border-radius: 8px; display: block; }
.item-delete { background: #fee2e2; color: #991b1b; border: none; border-radius: 6px;
  padding: 6px 10px; font-size: 12px; cursor: pointer; margin-left: 6px; }

/* ── Pedidos (Kanban) ── */
.kanban { display: flex; gap: 16px; overflow-x: auto; padding-bottom: 8px; }
.kanban-col { flex: 1; min-width: 220px; }
.kanban-col h3 { font-size: 14px; margin-bottom: 10px; color: #374151; }
.kanban-count { color: #9ca3af; font-weight: 400; }
.order-card {
  background: #fff; border-radius: 10px; padding: 12px 14px; margin-bottom: 12px;
  box-shadow: 0 1px 3px rgba(0,0,0,.08); font-size: 13px;
}
.order-card.cancelled { opacity: .6; }
.order-top { display: flex; justify-content: space-between; margin-bottom: 6px; font-size: 13px; }
.order-top span { color: #6b7280; }
.order-items { list-style: none; margin-bottom: 6px; }
.order-items li { color: #374151; }
.order-total { font-weight: 700; color: var(--purple); margin-bottom: 4px; }
.order-delivery, .order-notes { color: #6b7280; font-size: 12px; margin-bottom: 4px; }
.order-actions { display: flex; gap: 6px; margin-top: 8px; flex-wrap: wrap; }
.order-advance {
  background: var(--purple); color: #fff; border: none; border-radius: 6px;
  padding: 6px 10px; font-size: 12px; cursor: pointer;
}
.order-cancel {
  background: #fee2e2; color: #991b1b; border: none; border-radius: 6px;
  padding: 6px 10px; font-size: 12px; cursor: pointer;
}
.cancelled-heading { font-size: 15px; color: #6b7280; margin: 20px 0 10px; }
.cancelled-col { display: flex; flex-wrap: wrap; gap: 12px; }
.cancelled-col .order-card { width: 220px; margin-bottom: 0; }

/* ── Embudo de leads (Kanban) ── */
.lead-card {
  background: #fff; border-radius: 10px; padding: 12px 14px; margin-bottom: 12px;
  box-shadow: 0 1px 3px rgba(0,0,0,.08); font-size: 13px;
}
/* Un lead cerrado se apaga pero se sigue leyendo: sirve de historial, y en
   "perdido" hay que poder repasar qué se perdió y por qué. */
.lead-card.lead-ganado, .lead-card.lead-perdido { opacity: .75; }
.lead-card.lead-ganado { border-left: 3px solid #16a34a; }
.lead-card.lead-perdido { border-left: 3px solid #9ca3af; }
.lead-source { color: #6b7280; font-size: 12px; }
.lead-value { font-weight: 700; color: var(--purple); margin: 4px 0; font-size: 13px; }
/* "Sin monto" no se destaca como si fuera una cifra: es la ausencia de una,
   y pintarlo igual que un total haría leer el tablero como si estuviera
   completo cuando no lo está. */
.lead-value-empty { font-weight: 400; color: #9ca3af; font-size: 12px; }
/* Las notas de un lead se acumulan: cada vez que el bot habla con el mismo
   interesado suma una línea. Sin `pre-line` el HTML colapsa el salto y dos
   anotaciones de días distintos se leen como una sola frase corrida — que es
   justo el momento en que el asesor deja de confiar en lo que dice la ficha.
   Va aparte de `.order-notes` porque la nota de un pedido es una sola línea
   escrita a mano y no tiene este problema. */
.lead-notes { white-space: pre-line; }
.lead-edit-link {
  background: #ede9fe; color: #5b21b6; border-radius: 6px;
  padding: 6px 10px; font-size: 12px; text-decoration: none; display: inline-block;
}
.kanban-value { color: var(--purple); font-weight: 600; font-size: 12px; }
.funnel-money {
  display: flex; flex-wrap: wrap; gap: 14px; align-items: center;
  font-size: 13px; color: #374151; margin-bottom: 14px;
}
.funnel-open-value strong { color: var(--purple); }
.funnel-won-value strong { color: #16a34a; }
/* El aviso de "sin monto" tiene que verse tanto como el total al que le
   falta contexto, si no el total se lee solo. */
.funnel-missing { color: #b45309; font-weight: 600; }

/* ── Conexión de WhatsApp de un negocio (/admin) ── */
.token-own { color: var(--purple); }
#whatsapp-token-form, #phone-number-id-form {
  display: flex; gap: 8px; align-items: center; flex-wrap: wrap;
}
#whatsapp-token-form input, #phone-number-id-form input {
  flex: 1; min-width: 240px; padding: 9px 10px;
  border: 1px solid #d1d5db; border-radius: 8px; font-size: 14px;
}
#whatsapp-token-form button, #phone-number-id-form button {
  background: var(--purple); color: #fff; border: none; border-radius: 8px;
  padding: 9px 20px; font-size: 13px; font-weight: 600; cursor: pointer;
}
/* Mismo caso que .lead-edit-saved: un `display` explícito le gana al
   atributo `hidden`, y el aviso quedaría fijo en pantalla. */
#whatsapp-token-ok[hidden], #phone-number-id-ok[hidden] { display: none; }

/* ── Pantalla de edición de un lead ── */
.back-link { font-size: 13px; color: #6b7280; text-decoration: none; display: block; margin-bottom: 6px; }
.back-link:hover { color: var(--purple); }
.lead-facts { display: flex; flex-wrap: wrap; gap: 16px; font-size: 13px; color: #6b7280; margin-bottom: 18px; }
.lead-fact strong { color: #111827; }
.lead-edit-card { max-width: 560px; }
#lead-edit-form { display: grid; gap: 14px; }
#lead-edit-form label { display: grid; gap: 4px; font-size: 13px; color: #4b5563; }
#lead-edit-form input, #lead-edit-form select, #lead-edit-form textarea {
  padding: 9px 10px; border: 1px solid #d1d5db; border-radius: 8px;
  font-size: 14px; font-family: inherit; width: 100%;
}
#lead-edit-form textarea { resize: vertical; }
/* El formulario no es `.menu-form`, así que no hereda el estilo del botón
   morado del resto del panel — sin esto queda el botón gris del navegador. */
#lead-edit-form button[type="submit"] {
  background: var(--purple); color: #fff; border: none; border-radius: 8px;
  padding: 9px 20px; font-size: 13px; font-weight: 600; cursor: pointer;
}
.lead-edit-actions { display: flex; align-items: center; gap: 12px; }
.lead-edit-saved { color: #16a34a; font-size: 13px; }
/* Un `display` explícito le gana al atributo `hidden` del navegador — el
   mismo caso que .alta-panel, y acá el aviso de "guardado" quedaría fijo
   en pantalla para siempre. `.lead-edit-actions` es flex, y sus hijos
   heredan un display de bloque que pisa el hidden. */
.lead-edit-saved[hidden] { display: none; }
.lead-owner { color: #4b5563; font-size: 12px; margin-top: 6px; }
.lead-unassigned { color: #b45309; font-weight: 600; }
.lead-filters { display: flex; gap: 4px; margin-bottom: 12px; }
.lead-filters .conv-filter { flex: 0 0 auto; padding: 6px 12px; }
.funnel-summary { display: flex; flex-wrap: wrap; gap: 10px; align-items: center; margin-bottom: 14px; }
.funnel-step, .funnel-won, .funnel-lost { white-space: nowrap; }
.funnel-won { color: #16a34a; }
.funnel-lost { color: #9ca3af; }
.lead-lost, .lead-delete {
  background: #fee2e2; color: #991b1b; border: none; border-radius: 6px;
  padding: 6px 10px; font-size: 12px; cursor: pointer;
}
.lead-advance, .lead-reopen {
  background: var(--purple); color: #fff; border: none; border-radius: 6px;
  padding: 6px 10px; font-size: 12px; cursor: pointer;
}
/* El selector de dueño comparte fila con los botones de la tarjeta, que es
   angosta: sin esto se desborda de la columna del Kanban. */
.lead-card .assign-select { max-width: 100%; font-size: 12px; }

/* ── Tickets (Kanban + SLA) ── */
.ticket-card {
  background: #fff; border-radius: 10px; padding: 12px 14px; margin-bottom: 12px;
  box-shadow: 0 1px 3px rgba(0,0,0,.08); font-size: 13px;
}
.ticket-subject { font-weight: 700; color: #111827; margin-bottom: 4px; }
.ticket-meta { display: flex; align-items: center; gap: 6px; margin-top: 6px; flex-wrap: wrap; }
.ticket-close {
  background: #f3f4f6; color: #374151; border: none; border-radius: 6px;
  padding: 6px 10px; font-size: 12px; cursor: pointer;
}
.sla-badge { font-size: 11px; font-weight: 700; padding: 1px 8px; border-radius: 999px; }
.sla-a_tiempo, .sla-cumplido { background: #dcfce7; color: #166534; }
.sla-en_riesgo { background: #fef3c7; color: #92400e; }
.sla-vencido, .sla-incumplido { background: #fee2e2; color: #991b1b; }
.priority-badge { font-size: 11px; font-weight: 600; padding: 1px 8px; border-radius: 999px; }
.priority-baja { background: #e5e7eb; color: #374151; }
.priority-media { background: #dbeafe; color: #1e40af; }
.priority-alta { background: #fed7aa; color: #9a3412; }
.priority-urgente { background: #fecaca; color: #991b1b; }

.login-link { display: block; margin-top: 12px; font-size: 13px; color: var(--purple); text-decoration: none; }
.login-link:hover { text-decoration: underline; }
.login-success {
  background: #dcfce7; color: #166534; border-radius: 8px;
  padding: 10px 12px; font-size: 13px; margin-bottom: 12px;
}

.nav-dot { color: var(--coral); font-size: 10px; margin-left: auto; }
.account-activa, .account-prueba { background: #dcfce7; color: #166534; }
.account-vencida { background: #fef3c7; color: #92400e; }
.account-suspendida, .account-cancelada { background: #fee2e2; color: #991b1b; }

/* ── Documento de entrega ── */
.entrega { max-width: 780px; }
.entrega-header { display: flex; justify-content: space-between; align-items: flex-start; gap: 16px; margin-bottom: 20px; }
.entrega-header h1 { font-size: 22px; font-weight: 800; color: var(--navy); }
.entrega-checklist, .entrega-users { list-style: none; display: grid; gap: 8px; margin-top: 10px; }
.entrega-checklist li { display: flex; gap: 10px; align-items: baseline; font-size: 14px; }
.entrega-checklist li.pending { color: #92400e; }
.entrega-mark { font-weight: 700; width: 16px; flex-shrink: 0; }
.entrega-checklist li.done .entrega-mark { color: #16a34a; }
.entrega-detail { color: #6b7280; font-size: 12px; margin-left: 6px; }
.entrega-users li { font-size: 14px; }

/* Se guarda como PDF desde el navegador: no hace falta una dependencia
   para generar PDFs de una sola página. */
@media print {
  .no-print { display: none !important; }
  body.entrega-body { background: #fff; }
  .config-card { box-shadow: none; border: 1px solid #e5e7eb; break-inside: avoid; }
}

/* ── Asistente de alta (/admin/nuevo) ── */
.alta-steps {
  display: flex; gap: 8px; list-style: none; margin-bottom: 20px;
  flex-wrap: wrap; counter-reset: paso;
}
.alta-steps li {
  flex: 1; min-width: 120px; font-size: 12px; font-weight: 600; color: #9ca3af;
  padding: 8px 10px; border-top: 3px solid #e5e7eb; counter-increment: paso;
}
.alta-steps li::before { content: counter(paso) ". "; }
.alta-steps li.current { color: var(--purple); border-top-color: var(--purple); }
.alta-steps li.done { color: #16a34a; border-top-color: #16a34a; }
.alta-card { max-width: none; }
.alta-panel { display: grid; gap: 12px; }
/* Un `display` explícito le gana al atributo `hidden` del navegador, así que
   sin esta regla los cinco pasos se ven todos a la vez. */
.alta-panel[hidden] { display: none; }
.alta-panel h2 { margin-bottom: 4px; }
.alta-nav { display: flex; gap: 10px; margin-top: 20px; align-items: center; }
.alta-preview { margin-top: 12px; }
.alta-preview-text {
  background: #f9fafb; border: 1px solid #e5e7eb; border-radius: 8px;
  padding: 12px; font-size: 12px; line-height: 1.5; max-height: 260px;
  overflow: auto; white-space: pre-wrap; color: #374151;
}
.alta-summary { display: grid; grid-template-columns: auto 1fr; gap: 6px 16px; font-size: 14px; }
.alta-summary dt { color: #6b7280; }
.alta-summary dd { font-weight: 600; word-break: break-all; }
.alta-done { border-left: 3px solid #16a34a; }
.button-link {
  display: inline-block; text-decoration: none; background: var(--purple); color: #fff;
  padding: 9px 16px; border-radius: 8px; font-size: 14px; font-weight: 600;
}
.button-link:hover { background: var(--purple-light); }
.topbar-link { color: #cbd3ef; text-decoration: none; font-size: 14px; }
.topbar-link:hover { color: #fff; }

/* ── Cobros recurrentes ── */
.cobro-list { display: grid; gap: 12px; grid-template-columns: repeat(auto-fill, minmax(300px, 1fr)); }
.cobro-card {
  background: #fff; border-radius: 10px; padding: 12px 14px;
  box-shadow: 0 1px 3px rgba(0,0,0,.08); font-size: 13px;
  border-left: 3px solid transparent;
}
/* El borde izquierdo repite el semáforo del badge: en una lista larga el
   color del canto se lee de un vistazo sin tener que leer cada etiqueta. */
.cobro-card.state-vencido { border-left-color: #dc2626; }
.cobro-card.state-por_vencer { border-left-color: #f59e0b; }
.cobro-card.state-al_dia { border-left-color: #16a34a; }
.cobro-card.state-pausado, .cobro-card.state-cancelado { opacity: .6; }
.cobro-amount { font-size: 15px; font-weight: 700; color: #111827; margin-bottom: 4px; }
.cobro-due { color: #6b7280; margin: 6px 0; }
.cobro-days { color: #6b7280; font-size: 12px; }
.cobro-days.overdue { color: #991b1b; font-weight: 700; }
.due-badge { font-size: 11px; font-weight: 700; padding: 1px 8px; border-radius: 999px; }
.due-al_dia { background: #dcfce7; color: #166534; }
.due-por_vencer { background: #fef3c7; color: #92400e; }
.due-vencido { background: #fee2e2; color: #991b1b; }
.due-pausado { background: #e5e7eb; color: #374151; }
.due-cancelado { background: #e5e7eb; color: #6b7280; }
.cobro-pay-form { display: grid; gap: 8px; margin-top: 10px; padding-top: 10px; border-top: 1px solid #e5e7eb; }
.cobro-pay-form h4 { font-size: 13px; color: #374151; }
.cobro-pay-form input[type="number"], .cobro-pay-form input[type="text"] {
  padding: 7px 9px; border: 1px solid #d1d5db; border-radius: 6px; font-size: 13px; width: 100%;
}
.file-label { font-size: 12px; color: #6b7280; display: grid; gap: 4px; }
.cobro-payments { margin-top: 10px; padding-top: 10px; border-top: 1px solid #e5e7eb; }
.cobro-payment { display: grid; gap: 2px; padding: 6px 0; border-bottom: 1px solid #f3f4f6; font-size: 12px; }
.cobro-payment-due, .cobro-payment-notes { color: #6b7280; }

/* ── Reportes ── */
.range-filter { display: flex; align-items: center; gap: 8px; margin-bottom: 20px; flex-wrap: wrap; }
.range-chip {
  text-decoration: none; color: #374151; background: #fff; border: 1px solid #d1d5db;
  border-radius: 999px; padding: 7px 16px; font-size: 13px; font-weight: 600;
}
.range-chip.active { background: var(--purple); border-color: var(--purple); color: #fff; }
.range-custom { display: flex; align-items: center; gap: 6px; margin-left: 4px; }
.range-custom input[type="date"] {
  border: 1px solid #d1d5db; border-radius: 8px; padding: 6px 8px; font-size: 13px;
}
.range-custom span { color: #9ca3af; font-size: 13px; }
.range-custom button {
  background: #fff; border: 1px solid #d1d5db; border-radius: 999px; padding: 7px 14px;
  font-size: 13px; font-weight: 600; cursor: pointer;
}

.report-card {
  background: #fff; border-radius: 12px; padding: 20px 24px; margin-top: 16px;
  box-shadow: 0 1px 3px rgba(0,0,0,.08); max-width: 800px;
}
.report-card h2 { font-size: 15px; margin-bottom: 16px; }

.bar-chart {
  display: flex; align-items: flex-end; gap: 6px; height: 200px;
  padding-top: 8px; border-bottom: 1px solid #e5e7eb;
}
.bar-col { flex: 1; display: flex; flex-direction: column; align-items: center; height: 100%; min-width: 0; }
.bar-wrap { flex: 1; display: flex; align-items: flex-end; justify-content: center; width: 100%; }
.bar {
  width: 60%; max-width: 26px; min-height: 3px; background: var(--purple);
  border-radius: 4px 4px 0 0; position: relative; transition: background .15s;
}
.bar:hover { background: var(--navy); }
.bar[data-tooltip]:hover::after {
  content: attr(data-tooltip);
  position: absolute; bottom: 100%; left: 50%; transform: translateX(-50%);
  background: var(--navy); color: #fff; font-size: 11px; padding: 5px 9px;
  border-radius: 6px; white-space: nowrap; margin-bottom: 8px; pointer-events: none; z-index: 10;
}
.bar-label { font-size: 10px; color: #9ca3af; margin-top: 8px; }

/* ── Configuración ── */
.config-card {
  background: #fff; border-radius: 12px; padding: 20px 24px; margin-bottom: 20px;
  box-shadow: 0 1px 3px rgba(0,0,0,.08); max-width: 640px;
}
.config-card h2 { font-size: 15px; margin-bottom: 14px; }
.config-card .hint { margin-top: 0; margin-bottom: 14px; }
.config-form { display: flex; flex-direction: column; gap: 14px; }
.config-form label { display: flex; flex-direction: column; gap: 6px; font-size: 13px; color: #374151; font-weight: 600; }
.config-form input, .config-form textarea, .config-form select {
  border: 1px solid #d1d5db; border-radius: 8px; padding: 9px 11px; font-size: 14px;
  font-weight: 400; font-family: inherit; resize: vertical;
}
.config-form button {
  align-self: flex-start; background: var(--purple); color: #fff; border: none; border-radius: 8px;
  padding: 10px 20px; font-size: 14px; font-weight: 600; cursor: pointer;
}
.form-success { color: #065f46; font-size: 13px; margin-top: 8px; min-height: 18px; }
.export-link {
  display: inline-block; background: var(--purple); color: #fff; text-decoration: none;
  border-radius: 8px; padding: 10px 20px; font-size: 14px; font-weight: 600; margin-top: 4px;
}

/* ── Errores ── */
.error-list { display: flex; flex-direction: column; gap: 8px; max-width: 900px; }
.error-item {
  background: #fff; border-radius: 10px; box-shadow: 0 1px 3px rgba(0,0,0,.08);
  padding: 12px 16px;
}
.error-item summary {
  display: flex; align-items: center; gap: 10px; cursor: pointer; font-size: 13px;
  list-style: none;
}
.error-item summary::-webkit-details-marker { display: none; }
.error-source {
  background: #fee2e2; color: #991b1b; font-size: 11px; font-weight: 600;
  padding: 2px 8px; border-radius: 999px; flex-shrink: 0;
}
.error-message { flex: 1; color: #374151; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.error-time { color: #9ca3af; font-size: 12px; flex-shrink: 0; }
.error-trace {
  margin-top: 10px; background: #111827; color: #e5e7eb; padding: 12px; border-radius: 8px;
  font-size: 12px; overflow-x: auto; white-space: pre-wrap; word-break: break-word;
}
.hours-row { display: flex; align-items: center; gap: 10px; }
.hours-row input { flex: none; width: auto; }
.days-row { display: flex; flex-wrap: wrap; gap: 6px; }
.day-check {
  display: flex !important; flex-direction: row !important; align-items: center; gap: 4px;
  font-weight: 400 !important; font-size: 13px; background: #f3f4f6; border-radius: 8px;
  padding: 6px 10px; cursor: pointer;
}
.day-check input { width: auto; }
.color-row { display: flex !important; flex-direction: row !important; align-items: center; gap: 10px; }
.color-row input[type="color"] { width: 44px; height: 34px; padding: 2px; flex: none; cursor: pointer; }
.color-row span { font-size: 12px; font-weight: 400; color: #6b7280; }
.logo-form { display: flex; align-items: center; gap: 10px; margin-top: 16px; flex-wrap: wrap; }
.logo-form input[type="file"] { font-size: 12px; }
.logo-form button {
  background: var(--purple); color: #fff; border: none; border-radius: 8px;
  padding: 8px 16px; font-size: 13px; font-weight: 600; cursor: pointer;
}
.logo-preview { width: 40px; height: 40px; object-fit: contain; border-radius: 8px; background: #f3f4f6; }

/* ── Login ── */
.login-body {
  position: relative;
  display: flex; align-items: center; justify-content: center; min-height: 100vh;
  background: radial-gradient(circle at 30% 20%, var(--navy-light), var(--navy) 60%);
}
.login-card {
  background: #fff; border-radius: 16px; padding: 36px; width: 320px;
  display: flex; flex-direction: column; align-items: center; gap: 10px; text-align: center;
  box-shadow: 0 20px 50px rgba(0,0,0,.25);
}
.login-logo { width: 56px; height: 56px; object-fit: contain; margin-bottom: 4px; }
.login-card h1 { font-size: 21px; font-weight: 800; color: var(--navy); }
.login-card p { color: #6b7280; font-size: 14px; margin-bottom: 8px; }
.login-card input {
  border: 1px solid #d1d5db; border-radius: 8px; padding: 12px; font-size: 15px;
}
.login-card button {
  background: var(--purple); color: #fff; border: none; border-radius: 8px;
  padding: 12px; font-size: 15px; font-weight: 600; cursor: pointer;
}
.login-error { background: #fee2e2; color: #991b1b; border-radius: 8px; padding: 8px; font-size: 13px; }

/* ── Móvil ── */
@media (max-width: 760px) {
  body { flex-direction: column; }

  .mobile-topbar {
    display: flex; align-items: center; gap: 12px;
    background: var(--navy); padding: 12px 16px; position: sticky; top: 0; z-index: 50;
  }

  .sidebar {
    position: fixed; top: 0; left: -280px; height: 100vh; width: 260px;
    z-index: 60; transition: left .25s ease; overflow-y: auto; flex-direction: column;
  }
  .sidebar.open { left: 0; }
  .sidebar .brand { padding: 4px 20px 24px; font-size: 17px; }
  .sidebar a { padding: 11px 20px; font-size: 14px; }
  .sidebar-footer { margin-top: auto; margin-left: 0; }

  .sidebar-overlay {
    display: none; position: fixed; inset: 0; background: rgba(15,23,42,.5); z-index: 55;
  }
  .sidebar-overlay.open { display: block; }

  .content { padding: 20px 16px; }
  .inbox { flex-direction: column; height: auto; }
  .conv-list { width: 100%; max-height: 40vh; }
  .chat { min-height: 60vh; }

  /* Tablas .crm: filas apiladas como tarjetas en vez de scroll horizontal */
  .crm { display: block; }
  .crm thead { display: none; }
  .crm tbody, .crm tr { display: block; width: 100%; }
  .crm tr {
    background: #fff; border-radius: 12px; box-shadow: 0 1px 3px rgba(0,0,0,.08);
    margin-bottom: 12px; padding: 12px 14px;
  }
  .crm td {
    display: flex; align-items: center; justify-content: space-between; gap: 12px;
    padding: 8px 0; border-bottom: 1px solid #f3f4f6; text-align: right;
  }
  .crm td:last-child { border-bottom: none; }
  .crm td::before {
    content: attr(data-label); font-size: 11px; font-weight: 700; color: #9ca3af;
    text-transform: uppercase; letter-spacing: .04em; text-align: left; flex-shrink: 0;
  }
  .crm td:empty::before { content: none; }
}

/* ── Demo público (ver demo.py) ── */
.demo-banner {
  background: #ecfdf5; color: #065f46; border: 1px solid #a7f3d0;
  border-radius: 10px; padding: 10px 14px; font-size: 13px;
  margin-bottom: 18px; font-weight: 600;
}
.demo-badge {
  background: #ecfdf5; color: #065f46; border-radius: 8px;
  padding: 8px 12px; font-size: 12px; font-weight: 700;
  margin-bottom: 8px; text-align: center; letter-spacing: .02em;
}
.demo-credentials {
  background: #f0fdf4; color: #166534; border: 1px dashed #86efac;
  border-radius: 8px; padding: 8px 12px; font-size: 13px;
  margin-bottom: 12px; text-align: center; font-family: ui-monospace, monospace;
}

/* ── Anticipo, saldo y fecha prometida en el pedido ── */
.order-payment { font-size: 12px; color: #4b5563; margin-top: 2px; }
.order-balance { color: #b91c1c; font-weight: 700; }
.order-settled { color: #047857; font-weight: 600; }
.order-due { font-size: 12px; color: #4b5563; margin-top: 2px; }
.order-due.due-today { color: #92400e; font-weight: 700; }
.order-due.overdue { color: #b91c1c; font-weight: 700; }

/* ── Puerta pública (/empezar) ── */
/* El body del panel es `display:flex` para la barra lateral. La página
   pública no la tiene, así que vuelve al flujo normal en bloque — si no,
   el header y el footer se acomodan como columnas. */
body.public-body { display: block; background: #f7f7fb; color: #1f2436; margin: 0;
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif; line-height: 1.6; }
.public-header { background: #1c2a5c; color: #fff; padding: 16px 20px; }
.public-header-inner { max-width: 880px; margin: 0 auto; display: flex; align-items: center; gap: 12px; }
.public-brand { font-weight: 800; font-size: 17px; }
.public-tagline { font-size: 12px; color: #aab3d8; }
.public-main { max-width: 880px; margin: 0 auto; padding: 36px 20px 60px; }
.public-hero h1 { font-size: clamp(1.6rem, 4vw, 2.2rem); margin: 0 0 8px; letter-spacing: -.01em; }
.public-lead { font-size: 16px; color: #4b5563; margin: 0 0 20px; max-width: 620px; }
.public-cta { display: inline-block; background: #1c2a5c; color: #fff; text-decoration: none;
  padding: 12px 22px; border-radius: 10px; font-weight: 700; }
.public-demo-note { font-size: 13px; color: #6b7280; margin-top: 8px; }
.public-features { display: grid; grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  gap: 16px; margin: 40px 0; }
.public-feature { background: #fff; border-radius: 12px; padding: 16px 18px;
  box-shadow: 0 1px 3px rgba(0,0,0,.07); }
.public-feature h3 { font-size: 15px; margin: 0 0 6px; }
.public-feature p { font-size: 14px; color: #4b5563; margin: 0; }
.public-plans h2, .public-form-section h2 { font-size: 20px; margin: 0 0 14px; }
.public-plan-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(200px, 1fr)); gap: 14px; }
.public-plan { background: #fff; border-radius: 12px; padding: 16px 18px; box-shadow: 0 1px 3px rgba(0,0,0,.07); }
.public-plan h3 { font-size: 15px; margin: 0 0 6px; color: #1c2a5c; }
.public-plan p { font-size: 13.5px; color: #4b5563; margin: 0; }
.public-plans-note { font-size: 13px; color: #6b7280; margin-top: 12px; }
.public-form-section { margin-top: 44px; }
.public-form-intro { font-size: 14.5px; color: #4b5563; margin: 0 0 16px; max-width: 620px; }
.public-form { background: #fff; border-radius: 12px; padding: 20px; max-width: 560px;
  box-shadow: 0 1px 3px rgba(0,0,0,.07); display: flex; flex-direction: column; gap: 12px; }
.public-form label { font-size: 13px; font-weight: 600; color: #374151; display: flex; flex-direction: column; gap: 5px; }
.public-form input[type="text"], .public-form select, .public-form textarea {
  border: 1px solid #d1d5db; border-radius: 8px; padding: 9px 11px; font-size: 14px;
  font-family: inherit; font-weight: 400; }
.public-form button { background: #1c2a5c; color: #fff; border: none; border-radius: 9px;
  padding: 11px 18px; font-size: 15px; font-weight: 700; cursor: pointer; margin-top: 4px; }
.public-privacy { font-size: 12px; color: #6b7280; margin: 4px 0 0; }
/* El campo trampa nunca se ve: si aparece, es un bot el que lo llenó. */
.public-hp { position: absolute; left: -9999px; width: 1px; height: 1px; overflow: hidden; }

/* ── Aviso de privacidad ── */
.lang-links { margin-left: auto; display: flex; gap: 10px; font-size: 13px; }
.lang-links a { color: #aab3d8; text-decoration: none; }
.lang-links a.active { color: #fff; font-weight: 700; }
.legal { max-width: 760px; line-height: 1.65; color: #374151; }
.legal h1 { font-size: clamp(1.4rem, 3.5vw, 1.9rem); margin: 6px 0 18px; color: var(--navy); }
.legal h2 { font-size: 17px; margin: 28px 0 8px; color: var(--navy); }
.legal p, .legal li { margin-bottom: 10px; }
.legal ul { padding-left: 20px; list-style: disc; }
.legal .eyebrow {
  font-size: 12px; text-transform: uppercase; letter-spacing: .09em;
  color: var(--purple); font-weight: 700;
}
.legal .updated { font-size: 13px; color: var(--muted); }
.legal .muted { color: var(--muted); font-size: 14px; }
.legal .callout {
  background: #f3f0ff; border-left: 3px solid var(--purple);
  padding: 12px 16px; border-radius: 0 8px 8px 0; margin: 18px 0;
}
/* Las tablas de proveedores y de datos son anchas; en un teléfono tienen
   que desplazarse ellas, no empujar la página entera. */
.legal .table-wrap { overflow-x: auto; margin: 14px 0; }
.legal table { border-collapse: collapse; width: 100%; font-size: 14px; }
.legal th, .legal td {
  border: 1px solid #e5e7eb; padding: 8px 10px; text-align: left; vertical-align: top;
}
.legal th { background: #f9fafb; font-weight: 700; color: var(--navy); }
.legal-back { margin-top: 32px; font-size: 14px; }
.legal-back a { color: var(--purple); }
.public-success { background: #ecfdf5; border: 1px solid #a7f3d0; color: #065f46;
  border-radius: 12px; padding: 18px 20px; max-width: 560px; }
.public-success p { margin: 6px 0 0; font-size: 14px; }
.public-error { background: #fef2f2; border: 1px solid #fecaca; color: #991b1b;
  border-radius: 10px; padding: 11px 14px; font-size: 14px; margin-bottom: 12px; max-width: 560px; }
.public-footer { text-align: center; font-size: 12px; color: #6b7280; padding: 24px 20px 40px; }
.signup-done { opacity: .55; }
.signup-message { max-width: 260px; font-size: 12.5px; color: #4b5563; }

/* Chat de prueba del demo */
.demo-chat-log {
  max-height: 320px;
  overflow-y: auto;
  display: flex;
  flex-direction: column;
  gap: 8px;
  margin-bottom: 12px;
}
.demo-bubble {
  padding: 8px 12px;
  border-radius: 12px;
  max-width: 80%;
  white-space: pre-wrap;
  word-break: break-word;
}
.demo-bubble-user {
  align-self: flex-end;
  background: var(--accent, #2563eb);
  color: #fff;
  border-bottom-right-radius: 3px;
}
.demo-bubble-bot {
  align-self: flex-start;
  background: rgba(127, 127, 127, 0.15);
  border-bottom-left-radius: 3px;
}
.demo-chat-form {
  display: flex;
  gap: 8px;
}
.demo-chat-form input { flex: 1; }

/* Filtro de bandeja por asignación */
.conv-filters {
  display: flex;
  gap: 4px;
  padding: 8px 8px 0;
}
.conv-filter {
  flex: 1;
  text-align: center;
  padding: 6px 4px;
  border-radius: 6px;
  font-size: 0.85rem;
  text-decoration: none;
  color: inherit;
  opacity: 0.7;
}
.conv-filter.active {
  background: rgba(127, 127, 127, 0.18);
  opacity: 1;
  font-weight: 600;
}
.conv-filter-count {
  display: inline-block;
  min-width: 1.4em;
  padding: 0 4px;
  border-radius: 999px;
  background: var(--accent, #2563eb);
  color: #fff;
  font-size: 0.75rem;
}
.assign-select { max-width: 11rem; }

/* ── Inventario ─────────────────────────────────────────────────────────── */

/* El formulario se arma según el rubro, así que la cantidad de campos varía
   entre 4 y 15. Con `auto-fit` la grilla se acomoda sola: sin eso habría que
   elegir un número de columnas que estaría mal para la mitad de los rubros. */
.inv-grid {
  display: grid; gap: 12px;
  grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
  margin-bottom: 18px;
}
.inv-grid label { display: flex; flex-direction: column; gap: 4px; font-size: 13px; }
.inv-wide { grid-column: 1 / -1; }
.inv-suffix { color: #9ca3af; font-weight: 400; }

.inv-ops { margin: 18px 0; }
.inv-ops h3 { font-size: 13px; text-transform: uppercase; letter-spacing: .05em;
  color: #6b7280; margin: 0 0 8px; }
/* Cada fila es tipo · monto · moneda · unidad · quitar. El monto lleva más
   espacio porque es el único que se escribe; los demás son listas. */
.inv-op-row {
  display: grid; gap: 8px; margin-bottom: 8px; align-items: center;
  grid-template-columns: 1.3fr 1fr 0.8fr 1fr auto;
}
/* Sin esto la fila desborda en pantallas angostas: el mínimo de un elemento
   de grilla es el ancho de su contenido, y un `select` mide lo que mide su
   opción más larga. Con `1fr` uno espera que se achique, y no se achica. */
.inv-op-row > * { min-width: 0; }
.inv-op-remove {
  background: #fee2e2; color: #b91c1c; border: none; border-radius: 6px;
  padding: 6px 10px; cursor: pointer; font-size: 13px; line-height: 1;
}
.inv-op-add {
  background: #ede9fe; color: #5b21b6; border: none; border-radius: 6px;
  padding: 6px 12px; cursor: pointer; font-size: 13px;
}

.inv-summary { display: flex; flex-wrap: wrap; gap: 18px; margin: 18px 0 10px; font-size: 14px;
  align-items: center; }
.inv-sitio { margin-left: auto; font-weight: 700; }
.inv-incomplete { color: #b45309; font-weight: 600; }

.inv-search { display: flex; gap: 8px; align-items: center; margin-bottom: 16px; }
.inv-search input { flex: 1; max-width: 340px; }
.inv-clear { font-size: 13px; color: #6b7280; }

.inv-list { display: grid; gap: 14px; grid-template-columns: repeat(auto-fill, minmax(280px, 1fr)); }
.inv-card {
  background: #fff; border: 1px solid var(--linea, #e5e7eb); border-radius: 12px;
  padding: 14px; border-left: 3px solid #d1d5db;
}
/* La ficha publicada se distingue de un vistazo: es la diferencia entre lo
   que ven los clientes del cliente y lo que todavía es un borrador. */
.inv-card.inv-published { border-left-color: #16a34a; }
.inv-card-top { display: flex; justify-content: space-between; gap: 8px; align-items: baseline; }
.inv-status { font-size: 11px; padding: 2px 8px; border-radius: 999px; background: #f3f4f6; color: #4b5563; }
.inv-status-reservado { background: #fef3c7; color: #92400e; }
.inv-status-cerrado { background: #e5e7eb; color: #6b7280; }
.inv-price { font-weight: 700; color: var(--purple, #6b4ee6); margin: 6px 0 2px; font-size: 14px; }
.inv-price-more { font-size: 12px; color: #9ca3af; margin-bottom: 4px; }
.inv-attrs { font-size: 12px; color: #6b7280; margin-bottom: 4px; }
/* Las descripciones son largas y en una grilla desalinean todas las tarjetas.
   Se cortan en tres líneas y el texto completo está en la pantalla de edición. */
.inv-desc {
  font-size: 12px; color: #9ca3af; margin-bottom: 8px;
  display: -webkit-box; -webkit-line-clamp: 3; -webkit-box-orient: vertical; overflow: hidden;
}
.inv-card-actions { display: flex; flex-wrap: wrap; gap: 6px; align-items: center; }
.inv-edit {
  background: #ede9fe; color: #5b21b6; border-radius: 6px; padding: 6px 10px;
  font-size: 12px; text-decoration: none;
}
.inv-publish { background: #dcfce7; color: #166534; border: none; border-radius: 6px;
  padding: 6px 10px; font-size: 12px; cursor: pointer; }
.inv-unpublish { background: #f3f4f6; color: #4b5563; border: none; border-radius: 6px;
  padding: 6px 10px; font-size: 12px; cursor: pointer; }
.inv-delete { background: #fee2e2; color: #b91c1c; border: none; border-radius: 6px;
  padding: 6px 10px; font-size: 12px; cursor: pointer; }
/* No es un botón deshabilitado a propósito: un botón gris invita a hacer
   clic y no explica nada. Esto dice qué pasa, y el `title` dice por qué. */
.inv-cant-publish { font-size: 12px; color: #b45309; cursor: help; }

.inv-facts { display: flex; flex-wrap: wrap; gap: 18px; margin-bottom: 14px; }
.inv-warning {
  background: #fff6ed; border-left: 3px solid #b45309; color: #92400e;
  padding: 10px 14px; border-radius: 0 8px 8px 0; margin-bottom: 16px; font-size: 14px;
}
.inv-orphans { background: #f9fafb; border-radius: 12px; padding: 14px 18px; margin-top: 20px; }
.inv-orphans h3 { font-size: 14px; margin: 0 0 4px; }
.inv-orphans-help { font-size: 12px; color: #6b7280; margin: 0 0 8px; }
.inv-orphans ul { margin: 0; padding-left: 18px; font-size: 13px; }

@media (max-width: 640px) {
  /* En un teléfono las cinco columnas de una operación quedan en 60px cada
     una. Se apilan en dos filas, con el botón de quitar al lado del monto. */
  .inv-op-row { grid-template-columns: 1fr 1fr auto; }
}

/* ── Sitio público de cada negocio (storefront.py) ─────────────────────────
   Mismo espíritu que .public-* de arriba, pero con los colores del negocio:
   --purple y --coral los pisa la plantilla con los de su marca, así que acá
   se usan las variables y no valores fijos. Un catálogo que se ve igual
   para todos los clientes es lo contrario de lo que vende la marca blanca. */
body.sitio-body { display: block; background: #f7f7fb; color: #1f2436; margin: 0;
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif; line-height: 1.55; }
.sitio-header { background: var(--purple, #1c2a5c); color: #fff; padding: 14px 20px;
  display: flex; align-items: center; justify-content: space-between; gap: 12px; flex-wrap: wrap; }
.sitio-brand { display: flex; align-items: center; gap: 10px; color: #fff; text-decoration: none; }
.sitio-brand img { border-radius: 8px; object-fit: cover; background: #fff; }
.sitio-brand strong { display: block; font-size: 17px; }
.sitio-brand small { display: block; font-size: 12px; opacity: .8; }
.sitio-wa { background: var(--coral, #ff6b57); color: #fff; text-decoration: none;
  padding: 9px 16px; border-radius: 999px; font-weight: 700; font-size: 14px; }
.sitio-main { max-width: 1040px; margin: 0 auto; padding: 24px 20px 60px; }

.sitio-filtros { display: flex; flex-wrap: wrap; gap: 10px; align-items: flex-end;
  background: #fff; border-radius: 12px; padding: 14px; box-shadow: 0 1px 3px rgba(0,0,0,.07); }
.sitio-filtros input[type=search] { flex: 1 1 240px; }
.sitio-filtros input, .sitio-filtros select { padding: 8px 10px; border: 1px solid #d7dbe6;
  border-radius: 8px; font-size: 14px; background: #fff; color: inherit; min-width: 0; }
.sitio-filtro { display: flex; flex-direction: column; gap: 3px; font-size: 12px; color: #6b7280; }
.sitio-filtro-check { flex-direction: row; align-items: center; gap: 6px; font-size: 13px; color: #1f2436; }
.sitio-filtros button { background: var(--purple, #1c2a5c); color: #fff; border: 0;
  padding: 10px 18px; border-radius: 8px; font-weight: 700; cursor: pointer; }
.sitio-limpiar { align-self: center; font-size: 13px; color: #6b7280; }
.sitio-conteo { color: #6b7280; font-size: 14px; margin: 18px 2px 12px; }

.sitio-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(240px, 1fr)); gap: 16px; }
.sitio-card { background: #fff; border-radius: 12px; overflow: hidden; text-decoration: none;
  color: inherit; box-shadow: 0 1px 3px rgba(0,0,0,.07); display: flex; flex-direction: column; }
.sitio-card img, .sitio-card-sinfoto { width: 100%; height: 168px; object-fit: cover; display: block; }
.sitio-card-sinfoto { background: linear-gradient(135deg, #e9ecf5, #f7f7fb); }
.sitio-card-cuerpo { padding: 12px 14px 16px; }
.sitio-card h3 { margin: 0 0 6px; font-size: 15px; line-height: 1.3; }
.sitio-precio { margin: 0; font-weight: 700; color: var(--purple, #1c2a5c); }
.sitio-attrs { margin: 6px 0 0; font-size: 13px; color: #6b7280; }
.sitio-reservado { display: inline-block; margin-top: 8px; font-size: 12px; font-weight: 700;
  background: #fff4e5; color: #92400e; padding: 2px 8px; border-radius: 999px; }

.sitio-paginacion { display: flex; gap: 14px; align-items: center; justify-content: center;
  margin-top: 26px; font-size: 14px; }
.sitio-volver { display: inline-block; margin-bottom: 14px; font-size: 14px; color: #6b7280; }
.sitio-ficha { background: #fff; border-radius: 12px; padding: 20px;
  box-shadow: 0 1px 3px rgba(0,0,0,.07); }
.sitio-ficha h1 { margin: 0 0 10px; font-size: clamp(1.3rem, 3vw, 1.7rem); }
/* Las fotos scrollean en su propio carril: con tres o cuatro apiladas hay
   que bajar media pantalla para llegar al precio, que es lo que la persona
   vino a ver. */
.sitio-fotos { display: flex; gap: 10px; overflow-x: auto; padding-bottom: 6px; margin: 12px 0; }
.sitio-fotos img { height: 240px; border-radius: 10px; flex: 0 0 auto; }
.sitio-operaciones, .sitio-datos-ficha { margin: 12px 0; padding-left: 18px; }
.sitio-operaciones li { font-weight: 700; color: var(--purple, #1c2a5c); }
.sitio-descripcion { color: #4b5563; white-space: pre-line; }
.sitio-cta { display: inline-block; margin-top: 14px; background: var(--coral, #ff6b57);
  color: #fff; text-decoration: none; padding: 12px 22px; border-radius: 10px; font-weight: 700; }
.sitio-contacto-alt { margin-top: 14px; font-weight: 700; }
.sitio-footer { border-top: 1px solid #e5e7f0; padding: 20px; text-align: center;
  color: #6b7280; font-size: 13px; }
.sitio-datos { display: flex; gap: 16px; justify-content: center; flex-wrap: wrap; }
.sitio-atribucion { margin: 10px 0 0; font-size: 12px; opacity: .75; }
.sitio-mas { flex: 1 1 100%; }
.sitio-mas summary { cursor: pointer; font-size: 13px; font-weight: 700;
  color: var(--purple, #1c2a5c); padding: 4px 0; }
.sitio-mas-campos { display: flex; flex-wrap: wrap; gap: 10px; align-items: flex-end;
  margin-top: 10px; }
