/* ───────── Panadería H.Nos Calvo · estilos ───────── */
:root {
  --bg: #f7f2ea;
  --surface: #ffffff;
  --surface-2: #fbf8f3;
  --border: #e7ddcf;
  --text: #2a2119;
  --muted: #7a6b5d;
  --pri: #8a4f1d;
  --pri-hover: #713f15;
  --pri-soft: #f4e6d6;
  --accent: #d9a441;
  --sidebar: #2f241b;
  --sidebar-text: #e9dccb;
  --gris: #6b7280;   --gris-bg: #eef0f2;
  --azul: #1d5fa8;   --azul-bg: #e3eefa;
  --ambar: #8a5a00;  --ambar-bg: #fdf1d6;
  --verde: #1f7a46;  --verde-bg: #e1f3e8;
  --rojo: #b3261e;   --rojo-bg: #fbe3e1;
  --radius: 10px;
  --shadow: 0 1px 2px rgba(60, 40, 20, .06), 0 4px 14px rgba(60, 40, 20, .06);
  --font: system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
}
* { box-sizing: border-box; }
html, body { margin: 0; }
body { font-family: var(--font); font-size: 15px; line-height: 1.45; color: var(--text); background: var(--bg); }
h1, h2, h3, h4 { margin: 0 0 .4em; line-height: 1.2; }
h1 { font-size: 1.55rem; }
h4 { font-size: .95rem; margin-top: 1rem; }
a { color: var(--pri); }
code { background: var(--pri-soft); padding: 1px 5px; border-radius: 4px; font-size: .9em; }
.muted { color: var(--muted); }
.small { font-size: .85rem; }
.skip { position: absolute; left: -9999px; }
.skip:focus { left: 8px; top: 8px; z-index: 999; background: #fff; padding: 6px 10px; }
:focus-visible { outline: 3px solid var(--accent); outline-offset: 2px; }

/* ───── Barra demo ───── */
.demo-bar { display: flex; flex-wrap: wrap; align-items: center; gap: 6px 8px; padding: 6px 12px; background: #1d1611; color: #f4e9da; font-size: .85rem; position: sticky; top: 0; z-index: 50; }
.demo-tag { background: var(--accent); color: #1d1611; font-weight: 700; font-size: .7rem; letter-spacing: .06em; padding: 2px 6px; border-radius: 4px; }
.demo-label { opacity: .8; }
.demo-actores { display: flex; flex-wrap: wrap; gap: 4px; }
.demo-btn { background: #3a2d22; color: #f4e9da; border: 1px solid #54412f; border-radius: 6px; padding: 4px 9px; cursor: pointer; font: inherit; display: inline-flex; align-items: center; gap: 5px; }
.demo-btn:hover { background: #4a3a2c; }
.demo-btn.activo { background: var(--accent); color: #1d1611; border-color: var(--accent); font-weight: 600; }
.demo-sel { background: #3a2d22; color: #f4e9da; border: 1px solid #54412f; border-radius: 6px; padding: 3px 4px; font: inherit; max-width: 140px; }
.demo-sels { display: inline-flex; gap: 4px; }
.demo-spacer { flex: 1; }
.pill { background: #25d366; color: #06300f; border-radius: 999px; padding: 0 6px; font-size: .75rem; font-weight: 700; }
.pill-warn { background: var(--accent); color: #1d1611; }
.switch { display: inline-flex; align-items: center; gap: 6px; cursor: pointer; user-select: none; }
.switch input { position: absolute; opacity: 0; width: 1px; height: 1px; }
.switch-ui { width: 30px; height: 17px; background: #54412f; border-radius: 999px; position: relative; transition: background .15s; }
.switch-ui::after { content: ""; position: absolute; top: 2px; left: 2px; width: 13px; height: 13px; background: #f4e9da; border-radius: 50%; transition: transform .15s; }
.switch.on .switch-ui { background: #d9534f; }
.switch.on .switch-ui::after { transform: translateX(13px); }
.switch input:focus-visible + .switch-ui { outline: 3px solid var(--accent); }
.demo-mini { position: fixed; top: 0; right: 16px; z-index: 50; background: #1d1611; color: #f4e9da; border: 0; border-radius: 0 0 8px 8px; padding: 3px 10px; font: inherit; font-size: .75rem; cursor: pointer; opacity: .75; }
.demo-mini:hover { opacity: 1; }
.banda { border-radius: 0; margin: 0; }

/* ───── Topbar / layout ───── */
.topbar { display: flex; align-items: center; gap: 12px; padding: 10px 18px; background: var(--surface); border-bottom: 1px solid var(--border); }
.brand { display: flex; align-items: center; gap: 10px; text-decoration: none; color: var(--text); }
.brand-logo { font-size: 1.7rem; }
.brand strong { display: block; font-size: 1.05rem; }
.brand small { display: block; color: var(--muted); font-size: .75rem; }
.spacer { flex: 1; }
.user-box { display: flex; align-items: center; gap: 12px; }
.user-info { text-align: right; }
.user-info strong { display: block; font-size: .9rem; }
.user-rol { font-size: .75rem; color: var(--pri); background: var(--pri-soft); padding: 1px 7px; border-radius: 999px; }
.topbar .menu-toggle { display: none; }
.layout { display: grid; grid-template-columns: 240px minmax(0, 1fr); min-height: calc(100vh - 100px); }
.sidebar { background: var(--sidebar); color: var(--sidebar-text); padding: 14px 10px; }
.nav-group { margin-bottom: 14px; }
.nav-title { font-size: .7rem; text-transform: uppercase; letter-spacing: .08em; opacity: .55; padding: 0 10px 4px; }
.nav-link { display: grid; grid-template-columns: 22px 1fr; align-items: center; gap: 2px 6px; padding: 7px 10px; border-radius: 8px; color: var(--sidebar-text); text-decoration: none; font-size: .92rem; }
.nav-link:hover { background: rgba(255, 255, 255, .07); }
.nav-link.activo { background: var(--accent); color: #1d1611; font-weight: 600; }
.nav-cu { grid-column: 2; font-size: .68rem; opacity: .6; }
.nav-link.activo .nav-cu { opacity: .8; }
.main { padding: 22px 26px 40px; min-width: 0; }
.publico { min-height: calc(100vh - 40px); }

/* ───── Página ───── */
.page { max-width: 1240px; margin: 0 auto; }
.page-head { display: flex; justify-content: space-between; align-items: flex-start; gap: 12px; flex-wrap: wrap; margin-bottom: 16px; }
.page-actions { display: flex; gap: 8px; flex-wrap: wrap; align-items: center; }
.cu-list { display: flex; gap: 4px; flex-wrap: wrap; }
.cu-chip { font-size: .7rem; font-weight: 600; color: var(--pri); background: var(--pri-soft); border: 1px solid #e8cfb2; padding: 1px 6px; border-radius: 4px; letter-spacing: .02em; }
.card { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); box-shadow: var(--shadow); padding: 16px 18px; margin-bottom: 16px; min-width: 0; }
.card-title { font-size: 1.05rem; margin-bottom: 10px; }
.grid-2 { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 16px; }
.grid-2 > .card { margin-bottom: 0; }
.grid-2 + .grid-2, .grid-2 + .card { margin-top: 16px; }
.grid-calc { grid-template-columns: minmax(0, 5fr) minmax(0, 7fr); align-items: start; }
.grid-cards { display: grid; grid-template-columns: repeat(auto-fill, minmax(300px, 1fr)); gap: 16px; margin-bottom: 16px; }
.grid-cards > .card { margin-bottom: 0; }
.row-between { display: flex; justify-content: space-between; align-items: center; gap: 8px; flex-wrap: wrap; }
.row-gap { display: flex; gap: 6px; flex-wrap: wrap; align-items: center; margin-top: 8px; }
.dl { display: grid; grid-template-columns: max-content 1fr; gap: 4px 14px; margin: 0 0 10px; }
.dl dt { color: var(--muted); font-size: .85rem; }
.dl dd { margin: 0; }
.inline-field { display: inline-flex; gap: 6px; align-items: center; }
.inline-field input { padding: 6px 8px; border: 1px solid var(--border); border-radius: 6px; font: inherit; }

/* ───── KPIs ───── */
.kpis { display: grid; grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); gap: 12px; margin-bottom: 16px; }
.kpi { background: var(--surface); border: 1px solid var(--border); border-left: 4px solid var(--gris); border-radius: var(--radius); padding: 12px 14px; text-align: left; font: inherit; color: inherit; }
button.kpi { cursor: pointer; }
button.kpi:hover { box-shadow: var(--shadow); }
.kpi-val { font-size: 1.5rem; font-weight: 700; font-variant-numeric: tabular-nums; }
.kpi-label { font-size: .85rem; color: var(--muted); }
.kpi-nota { font-size: .75rem; color: var(--muted); margin-top: 2px; }
.kpi-azul { border-left-color: var(--azul); } .kpi-ambar { border-left-color: var(--accent); } .kpi-verde { border-left-color: var(--verde); } .kpi-rojo { border-left-color: var(--rojo); }

/* ───── Badges / avisos ───── */
.badge { display: inline-block; font-size: .75rem; font-weight: 600; padding: 2px 8px; border-radius: 999px; white-space: nowrap; }
.badge-gris { color: var(--gris); background: var(--gris-bg); }
.badge-azul { color: var(--azul); background: var(--azul-bg); }
.badge-ambar { color: var(--ambar); background: var(--ambar-bg); }
.badge-verde { color: var(--verde); background: var(--verde-bg); }
.badge-rojo { color: var(--rojo); background: var(--rojo-bg); }
.aviso { padding: 10px 14px; border-radius: 8px; margin: 0 0 12px; font-size: .9rem; border: 1px solid transparent; }
.aviso-info { background: var(--azul-bg); color: #164a83; border-color: #c9dcf2; }
.aviso-warn { background: var(--ambar-bg); color: #6b4700; border-color: #f0dca8; }
.aviso-ok { background: var(--verde-bg); color: #175e36; border-color: #bfe3cd; }
.aviso-error { background: var(--rojo-bg); color: #8c1d17; border-color: #f2c4c0; }

/* ───── Botones ───── */
.btn { font: inherit; font-size: .9rem; border-radius: 8px; padding: 8px 14px; border: 1px solid transparent; cursor: pointer; display: inline-flex; align-items: center; gap: 6px; text-decoration: none; white-space: nowrap; }
.btn:disabled { opacity: .5; cursor: not-allowed; }
.btn-pri { background: var(--pri); color: #fff; }
.btn-pri:hover:not(:disabled) { background: var(--pri-hover); }
.btn-sec { background: var(--surface); color: var(--text); border-color: var(--border); }
.btn-sec:hover:not(:disabled) { background: var(--surface-2); border-color: #d6c7b3; }
.btn-peligro { background: var(--rojo); color: #fff; }
.btn-peligro-sec { background: var(--surface); color: var(--rojo); border-color: #efc6c2; }
.btn-peligro-sec:hover { background: var(--rojo-bg); }
.btn-sm { padding: 5px 10px; font-size: .82rem; }
.btn-icon { background: transparent; border: 1px solid var(--border); border-radius: 8px; width: 32px; height: 32px; display: inline-grid; place-items: center; cursor: pointer; font: inherit; color: inherit; padding: 0; }
.btn-icon:hover:not(:disabled) { background: var(--surface-2); }
.btn-icon.btn-pri { background: var(--pri); color: #fff; border-color: var(--pri); }

/* ───── Formularios (diseño homogéneo) ───── */
.form-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 12px 16px; }
.field { display: flex; flex-direction: column; gap: 4px; min-width: 0; }
.field.full, .form-section.full { grid-column: 1 / -1; }
.field > label { font-size: .85rem; font-weight: 600; }
.req { color: var(--rojo); }
.field input, .field select, .field textarea, .linea-row select, .linea-row input, .table-tools input, .table-tools select, .wa-tools select {
  font: inherit; font-size: .92rem; padding: 8px 10px; border: 1px solid #d9ccbb; border-radius: 8px; background: #fff; color: var(--text); width: 100%; min-width: 0; }
.field input:disabled, .field select:disabled { background: #f3efe9; color: var(--muted); }
.field textarea { resize: vertical; }
.field.has-err input, .field.has-err select, .field.has-err textarea { border-color: var(--rojo); background: #fff8f7; }
.field-err { color: var(--rojo); font-size: .8rem; min-height: 0; }
.field-err:empty { display: none; }
.hint { font-size: .78rem; color: var(--muted); }
.field-check { justify-content: center; }
.check { display: inline-flex; align-items: flex-start; gap: 8px; font-weight: 500; cursor: pointer; }
.check input { width: 18px; height: 18px; margin-top: 2px; accent-color: var(--pri); flex: none; }
.form-section { font-size: .8rem; text-transform: uppercase; letter-spacing: .06em; color: var(--pri); border-bottom: 1px solid var(--border); padding-bottom: 4px; margin: 8px 0 0; }
.form-error { background: var(--rojo-bg); color: #8c1d17; border-radius: 8px; padding: 8px 12px; margin-bottom: 12px; font-size: .9rem; }
.form-error[hidden] { display: none; }
.form-actions { display: flex; justify-content: flex-end; gap: 8px; margin-top: 16px; flex-wrap: wrap; }

/* Editor de líneas */
.lineas-editor { display: flex; flex-direction: column; gap: 8px; align-items: flex-start; }
.linea-row { display: grid; grid-template-columns: minmax(0, 3fr) 90px minmax(0, 2fr) 32px; gap: 8px; width: 100%; align-items: center; }
.linea-row:not(:has(input + input)) { grid-template-columns: minmax(0, 1fr) 90px 32px; }
.lineas-resumen { margin-top: 10px; }
.lineas-total { text-align: right; font-size: .95rem; margin-top: 6px; }

/* ───── Tablas / listados (salidas) ───── */
.table-tools { display: flex; gap: 8px; flex-wrap: wrap; align-items: center; margin-bottom: 10px; }
.table-tools .search { flex: 1 1 220px; }
.table-tools select { width: auto; flex: 0 1 auto; }
.table-scroll { overflow-x: auto; }
.table { width: 100%; border-collapse: collapse; font-size: .9rem; }
.table th { text-align: left; font-size: .75rem; text-transform: uppercase; letter-spacing: .05em; color: var(--muted); font-weight: 600; padding: 8px 10px; border-bottom: 2px solid var(--border); white-space: nowrap; }
.table td { padding: 9px 10px; border-bottom: 1px solid #f0e8dd; vertical-align: middle; }
.table tr.clickable { cursor: pointer; }
.table tbody tr:hover td { background: var(--surface-2); }
.table .num { text-align: right; font-variant-numeric: tabular-nums; white-space: nowrap; }
.table .acciones { text-align: right; white-space: nowrap; }
.table td.acciones { display: flex; gap: 4px; justify-content: flex-end; flex-wrap: wrap; }
.table .empty { text-align: center; color: var(--muted); padding: 20px; }
.table tfoot td { border-bottom: 0; padding: 4px 10px; }
.table tfoot tr.total td { font-weight: 700; font-size: 1rem; border-top: 2px solid var(--border); }
.table-mini { margin: 8px 0; }
.meter { width: 90px; height: 8px; background: #efe7dc; border-radius: 999px; overflow: hidden; }
.meter span { display: block; height: 100%; border-radius: 999px; }
.meter-verde span { background: var(--verde); } .meter-ambar span { background: var(--accent); } .meter-rojo span { background: var(--rojo); }

/* ───── Modal / toasts ───── */
.overlay { position: fixed; inset: 0; background: rgba(30, 20, 10, .45); display: grid; place-items: center; z-index: 100; padding: 16px; }
.modal { background: var(--surface); border-radius: 12px; width: min(560px, 100%); max-height: calc(100vh - 32px); display: flex; flex-direction: column; box-shadow: 0 20px 60px rgba(0, 0, 0, .25); }
.modal-ancho { width: min(820px, 100%); }
.modal-head { display: flex; justify-content: space-between; align-items: center; padding: 14px 18px; border-bottom: 1px solid var(--border); }
.modal-head h3 { margin: 0; font-size: 1.1rem; }
.modal-body { padding: 16px 18px; overflow: auto; }
#toasts { position: fixed; bottom: 16px; right: 16px; display: flex; flex-direction: column; gap: 8px; z-index: 200; max-width: min(420px, calc(100vw - 32px)); }
.toast { background: #2a2119; color: #fff; padding: 10px 14px; border-radius: 8px; box-shadow: var(--shadow); font-size: .9rem; border-left: 4px solid var(--verde); animation: tin .2s ease-out; transition: opacity .4s, transform .4s; }
.toast-error { border-left-color: #ff6b60; }
.toast-warn { border-left-color: var(--accent); }
.toast.out { opacity: 0; transform: translateY(8px); }
@keyframes tin { from { opacity: 0; transform: translateY(8px); } }

/* ───── Panel WhatsApp ───── */
.wa-overlay { position: fixed; inset: 0; background: rgba(30, 20, 10, .3); z-index: 90; display: flex; justify-content: flex-end; }
.wa-panel { width: min(400px, 100%); height: 100%; background: #efeae2; display: flex; flex-direction: column; box-shadow: -10px 0 30px rgba(0, 0, 0, .2); }
.wa-head { background: #075e54; color: #fff; padding: 12px 14px; display: flex; justify-content: space-between; align-items: center; }
.wa-head .btn-icon { color: #fff; border-color: rgba(255, 255, 255, .3); }
.wa-tools { padding: 8px 10px; display: flex; gap: 8px; align-items: center; background: #f6f3ee; border-bottom: 1px solid #ddd5ca; }
.wa-list { overflow: auto; padding: 12px; display: flex; flex-direction: column; gap: 10px; }
.wa-msg { background: #dcf8c6; border-radius: 8px 8px 2px 8px; padding: 8px 10px; box-shadow: 0 1px 1px rgba(0, 0, 0, .08); align-self: flex-end; max-width: 92%; }
.wa-msg.wa-pend { background: #fff4d6; border: 1px dashed #d9a441; }
.wa-meta { font-size: .72rem; color: #44665c; margin-bottom: 3px; }
.wa-tipo { font-weight: 600; }
.wa-text { font-size: .9rem; white-space: pre-wrap; }
.wa-foot { font-size: .7rem; color: #667; text-align: right; margin-top: 4px; }
.wa-check { color: #34b7f1; font-weight: 700; }

/* ───── Login ───── */
.login-wrap { min-height: calc(100vh - 40px); display: grid; grid-template-columns: 1fr minmax(320px, 460px); gap: 40px; align-items: center; max-width: 1060px; margin: 0 auto; padding: 32px 20px; }
.login-wrap.single { grid-template-columns: minmax(0, 560px); justify-content: center; }
.login-hero h1 { font-size: 2.2rem; color: var(--pri); }
.hero-logo { font-size: 3.5rem; }
.hero-list { padding-left: 1.2em; color: var(--muted); }
.login-card { padding: 22px; }
.login-card .form-grid { grid-template-columns: 1fr; }
.login-links { margin-top: 12px; font-size: .9rem; }
.tabs { display: flex; gap: 4px; border-bottom: 1px solid var(--border); margin-bottom: 14px; }
.tab { padding: 8px 14px; text-decoration: none; color: var(--muted); border-bottom: 3px solid transparent; margin-bottom: -1px; font-weight: 600; font-size: .9rem; }
.tab.activo { color: var(--pri); border-bottom-color: var(--pri); }
.cred { margin-top: 16px; font-size: .85rem; background: var(--surface-2); border: 1px solid var(--border); border-radius: 8px; padding: 8px 12px; }
.cred summary { cursor: pointer; font-weight: 600; }

/* ───── Tienda ───── */
.chips { display: flex; flex-wrap: wrap; gap: 6px; margin-bottom: 14px; }
.chip { font: inherit; font-size: .85rem; border: 1px solid var(--border); background: var(--surface); border-radius: 999px; padding: 5px 12px; cursor: pointer; }
.chip.activo { background: var(--pri); color: #fff; border-color: var(--pri); }
.chip.estatico { cursor: default; }
.productos { display: grid; grid-template-columns: repeat(auto-fill, minmax(230px, 1fr)); gap: 14px; }
.producto { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); overflow: hidden; display: flex; flex-direction: column; box-shadow: var(--shadow); }
.producto.agotado { opacity: .6; }
.producto-img { font-size: 3rem; text-align: center; padding: 18px 0; background: linear-gradient(135deg, #f6e7d2, #efd7b6); }
.producto-body { padding: 12px 14px; display: flex; flex-direction: column; gap: 4px; flex: 1; }
.producto-body h3 { font-size: 1rem; margin: 0; }
.producto-body p { margin: 0; }
.producto-foot { display: flex; justify-content: space-between; align-items: flex-end; margin-top: auto; padding-top: 6px; }
.precio { font-size: 1.25rem; font-weight: 700; color: var(--pri); }
.qty-ctrl { display: flex; align-items: center; gap: 10px; justify-content: flex-end; margin-top: 6px; }
.qty-val { min-width: 20px; text-align: center; font-weight: 700; }
.ok-box { text-align: center; }
.ok-ico { font-size: 3rem; }

/* ───── Timeline / historial ───── */
.timeline { list-style: none; display: flex; padding: 0; margin: 10px 0 14px; counter-reset: s; }
.timeline li { flex: 1; text-align: center; font-size: .72rem; color: var(--muted); position: relative; padding-top: 18px; }
.timeline li::before { content: ""; position: absolute; top: 6px; left: 0; right: 0; height: 3px; background: #e5dccf; }
.timeline li:first-child::before { left: 50%; } .timeline li:last-child::before { right: 50%; }
.tl-dot { position: absolute; top: 1px; left: 50%; transform: translateX(-50%); width: 13px; height: 13px; border-radius: 50%; background: #e5dccf; border: 2px solid #fff; }
.timeline li.hecho { color: var(--verde); } .timeline li.hecho::before, .timeline li.hecho .tl-dot { background: var(--verde); }
.timeline li.actual { color: var(--pri); font-weight: 700; } .timeline li.actual .tl-dot { background: var(--accent); box-shadow: 0 0 0 3px var(--pri-soft); }
.timeline.cancelado { opacity: .45; }
.historial { list-style: none; padding: 0; margin: 0; font-size: .85rem; display: flex; flex-direction: column; gap: 4px; }
.detalle-head { margin-bottom: 4px; }
.pedido-card { margin-bottom: 0; }

/* ───── Kanban preparación ───── */
.kanban { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 14px; }
.kanban-col { background: #efe6da; border-radius: var(--radius); padding: 10px; display: flex; flex-direction: column; gap: 10px; }
.kanban-head { display: flex; justify-content: space-between; align-items: center; }
.kcard { background: var(--surface); border-radius: 8px; padding: 10px 12px; box-shadow: var(--shadow); font-size: .9rem; }
.kcard-lineas { margin: 6px 0; padding-left: 1.1em; font-size: .85rem; }
.kcard .aviso { margin: 6px 0; padding: 6px 8px; }

/* ───── Reparto ───── */
.paradas { list-style: none; padding: 0; margin: 10px 0 0; display: flex; flex-direction: column; gap: 8px; }
.paradas > li { border: 1px solid var(--border); border-radius: 8px; padding: 10px 12px; background: var(--surface-2); }
.paradas > li.activa { border-color: var(--accent); background: #fffaf0; box-shadow: 0 0 0 2px var(--pri-soft); }
.check-list { list-style: none; padding: 0; margin: 0; display: flex; flex-direction: column; gap: 8px; }
.check-list li { border: 1px solid var(--border); border-radius: 8px; padding: 8px 10px; }

/* ───── Gráfico de barras (inicio) ───── */
.barras { display: flex; flex-direction: column; gap: 8px; }
.barra-row { display: grid; grid-template-columns: 170px 1fr 30px; align-items: center; gap: 10px; font-size: .85rem; }
.barra { background: #f1eae0; border-radius: 4px; height: 14px; overflow: hidden; }
.barra-fill { display: block; height: 100%; border-radius: 4px; }
.fill-gris { background: #9aa1aa; } .fill-azul { background: var(--azul); } .fill-ambar { background: var(--accent); } .fill-verde { background: var(--verde); } .fill-rojo { background: var(--rojo); }
.barra-n { text-align: right; font-variant-numeric: tabular-nums; font-weight: 600; }

/* ───── Ayuda ───── */
.mapa { display: grid; grid-template-columns: repeat(auto-fit, minmax(210px, 1fr)); gap: 14px; }
.mapa-rol { background: var(--surface-2); border: 1px solid var(--border); border-radius: 8px; padding: 10px 12px; font-size: .88rem; }
.mapa-rol h3 { font-size: .95rem; color: var(--pri); }
.mapa-rol ul { padding-left: 1.1em; margin: 4px 0; }
.manual details { border-bottom: 1px solid var(--border); padding: 8px 0; }
.manual summary { cursor: pointer; font-weight: 600; }
.recorrido { padding-left: 1.3em; display: flex; flex-direction: column; gap: 8px; }
.recorrido li > * { vertical-align: middle; }
.recorrido li { padding-left: 4px; }
.recorrido li .btn { margin-left: 8px; }
.formula { margin-top: 12px; }
.formula ul { padding-left: 1.1em; }
.no-auth { text-align: center; padding: 30px 10px; background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); }
.no-auth-ico { font-size: 3rem; }

/* ───── Responsive ───── */
@media (max-width: 900px) {
  .layout { grid-template-columns: 1fr; }
  .sidebar { display: none; position: fixed; top: 0; left: 0; bottom: 0; width: 260px; z-index: 80; overflow: auto; }
  body.menu-abierto .sidebar { display: block; }
  .topbar .menu-toggle { display: inline-grid; }
  .main { padding: 16px; }
  .grid-2, .grid-calc, .kanban { grid-template-columns: 1fr; }
  .form-grid { grid-template-columns: 1fr; }
  .login-wrap { grid-template-columns: 1fr; gap: 16px; }
  .login-hero { text-align: center; }
  .hero-list { display: none; }
  .user-info { display: none; }
  .barra-row { grid-template-columns: 120px 1fr 26px; }
  .linea-row, .linea-row:not(:has(input + input)) { grid-template-columns: minmax(0, 1fr) 70px 32px; }
  .linea-row input[type="text"]:not(.qty) { grid-column: 1 / -1; }
  .demo-sels { display: none; }
  .demo-bar { position: static; }
}

/* ───── Barra de sesiones abiertas ───── */
.demo-bar { flex-wrap: nowrap; gap: 8px; padding: 6px 10px 0; align-items: flex-end; min-height: 50px; }
.demo-bar > .demo-tag, .demo-bar > .demo-btn, .demo-bar > .pop-wrap { margin-bottom: 6px; align-self: center; }
.ses-tabs { display: flex; gap: 2px; align-items: flex-end; overflow-x: auto; min-width: 0; flex: 0 1 auto; scrollbar-width: thin; }
.ses-vacio { opacity: .7; padding: 0 6px 12px; white-space: nowrap; }
.ses-tab { display: flex; align-items: center; background: #33271d; border: 1px solid #4a3a2c; border-bottom: 0; border-radius: 9px 9px 0 0; flex: none; }
.ses-tab:hover { background: #3d2f23; }
.ses-tab.activa { background: var(--bg); border-color: var(--bg); }
.ses-btn { display: flex; align-items: center; gap: 7px; background: none; border: 0; color: #f4e9da; font: inherit; padding: 6px 4px 7px 10px; cursor: pointer; text-align: left; }
.ses-tab.activa .ses-btn { color: var(--text); cursor: default; }
.ses-ico { font-size: 1.15rem; }
.ses-txt { display: flex; flex-direction: column; line-height: 1.1; }
.ses-nombre { font-weight: 600; font-size: .85rem; white-space: nowrap; }
.ses-rol { font-size: .7rem; opacity: .7; white-space: nowrap; }
.ses-badge { background: var(--accent); color: #1d1611; border-radius: 999px; padding: 1px 7px; font-size: .72rem; font-weight: 700; margin-left: 2px; animation: pulso 1.6s ease-out 2; }
.ses-badge.wa { background: #25d366; color: #06300f; }
@keyframes pulso { 0% { box-shadow: 0 0 0 0 rgba(217, 164, 65, .7); } 100% { box-shadow: 0 0 0 8px rgba(217, 164, 65, 0); } }
.ses-x { background: none; border: 0; color: inherit; opacity: .55; font-size: 1.1rem; line-height: 1; padding: 4px 8px 4px 4px; cursor: pointer; color: #f4e9da; }
.ses-tab.activa .ses-x { color: var(--text); }
.ses-x:hover { opacity: 1; }
.ses-mas { background: transparent; color: #f4e9da; border: 1px dashed #6b5440; border-radius: 8px; padding: 6px 10px; font: inherit; font-size: .85rem; cursor: pointer; white-space: nowrap; }
.ses-mas:hover { background: #3a2d22; border-style: solid; }
.pill-rojo { background: #d9534f; color: #fff; }
.demo-btn { white-space: nowrap; }

/* Desplegables de la barra */
.pop-wrap { position: relative; flex: none; }
.popover { position: absolute; top: calc(100% + 6px); left: 0; z-index: 120; background: var(--surface); color: var(--text); border: 1px solid var(--border); border-radius: 10px; box-shadow: 0 12px 40px rgba(0, 0, 0, .25); padding: 6px; width: 320px; max-width: calc(100vw - 20px); }
.popover.derecha { left: auto; right: 0; }
.pop-scroll { max-height: min(52vh, 420px); overflow: auto; }
.pop-item { display: flex; align-items: flex-start; gap: 10px; width: 100%; text-align: left; background: none; border: 0; border-radius: 7px; padding: 7px 9px; font: inherit; font-size: .9rem; color: inherit; cursor: pointer; }
.pop-item:hover, .pop-item:focus-visible { background: var(--pri-soft); }
.pop-item.ya { opacity: .65; }
.pop-item.destacado { font-weight: 600; }
.pop-ico { width: 20px; text-align: center; flex: none; }
.pop-sub { display: block; font-size: .75rem; color: var(--muted); font-weight: 400; }
.pop-title { font-size: .68rem; text-transform: uppercase; letter-spacing: .08em; color: var(--muted); padding: 8px 9px 2px; }
.pop-hint { font-size: .75rem; color: var(--muted); padding: 8px 9px 0; border-top: 1px solid var(--border); margin-top: 4px; }
.pop-sep { height: 1px; background: var(--border); margin: 6px 0; }
.pop-toggle { display: flex; align-items: flex-start; gap: 10px; padding: 8px 9px; border-radius: 7px; cursor: pointer; font-size: .9rem; }
.pop-toggle:hover { background: var(--pri-soft); }
.pop-toggle input { position: absolute; opacity: 0; width: 1px; height: 1px; }
.pop-toggle .switch-ui { flex: none; margin-top: 2px; background: #cdbfae; }
.pop-toggle.on .switch-ui { background: #d9534f; }
.pop-toggle.on .switch-ui::after { transform: translateX(13px); }
.pop-toggle input:focus-visible + .switch-ui { outline: 3px solid var(--accent); }

@media (max-width: 900px) {
  .demo-btn-txt, .demo-bar > .demo-tag { display: none; }
  .ses-rol { display: none; }
  .demo-bar { position: static; }
}

/* ───── WhatsApp: bandeja por sesión y aviso ───── */
.wa-tabs { display: flex; background: #075e54; padding: 0 8px; gap: 2px; }
.wa-tab { flex: 1; background: none; border: 0; border-bottom: 3px solid transparent; color: rgba(255, 255, 255, .75); font: inherit; font-size: .85rem; font-weight: 600; padding: 8px 6px; cursor: pointer; display: inline-flex; justify-content: center; gap: 6px; align-items: center; }
.wa-tab.activo { color: #fff; border-bottom-color: #25d366; }
.wa-registro { display: flex; flex-direction: column; min-height: 0; flex: 1; }
.wa-registro .wa-list { flex: 1; }
.wa-chat { flex: 1; }
.wa-chat-info { align-self: center; background: #fdf5c4; color: #5b5233; font-size: .75rem; text-align: center; border-radius: 6px; padding: 5px 10px; max-width: 90%; }
.wa-msg.entrante { background: #fff; border-radius: 8px 8px 8px 2px; align-self: flex-start; }
.wa-msg.nuevo { box-shadow: 0 0 0 2px #25d366; }
.wa-nuevo { background: #25d366; color: #06300f; font-size: .65rem; font-weight: 700; border-radius: 999px; padding: 0 6px; margin-left: 6px; text-transform: uppercase; }
.wa-vacio { align-self: center; }
.wa-toast { display: flex; gap: 10px; align-items: flex-start; text-align: left; background: #fff; color: var(--text); border: 0; border-left: 4px solid #25d366; border-radius: 10px; padding: 10px 12px; box-shadow: 0 8px 28px rgba(0, 0, 0, .22); font: inherit; font-size: .88rem; cursor: pointer; animation: tin .2s ease-out; width: 100%; }
.wa-toast:hover { background: #f3fbf5; }
.wa-toast-ico { font-size: 1.4rem; }
.wa-toast-txt { display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; color: var(--muted); font-size: .82rem; margin-top: 2px; }
.wa-toast strong { display: block; }

/* Botón «Mi WhatsApp» en la cabecera de cada usuario */
.mi-wa { gap: 6px; }
.mi-wa.con-nuevos { border-color: #25d366; box-shadow: 0 0 0 2px rgba(37, 211, 102, .2); }
@media (max-width: 900px) { .mi-wa-txt { display: none; } }
