/* Panel de pedidos · diseño v3 aprobado (copiado de knowledge/iscapalma/demo/v3-fuente/style.css + drawer.css, 2026-11-30f). No cambiar el aspecto. */
/* Iscapalma · colores y letras de su web (iscapalma.com, revisado 2026-11-28) */
:root {
  color-scheme: light;
  --navy: #032f4d; --navy-h: #0a4267; --sky: #66b3c1; --sky-soft: #eaf5f7; --steel: #457b9d; --brown: #624241;
  --text: #13293a; --muted: #5b6b78; --line: #e2e8ed; --soft: #f5f8fa; --bg: #ffffff;
  --ok: #1f6b45; --ok-bg: #e7f3ec; --red: #9b2c2c; --red-bg: #fbeeee;
  --f-title: "Sora", "Segoe UI", system-ui, -apple-system, sans-serif;
  --f-text: "IBM Plex Sans", "Segoe UI", system-ui, -apple-system, sans-serif;
  --r: 12px;
}
* { box-sizing: border-box; }
html, body { margin: 0; }
body { background: var(--bg); color: var(--text); font: 15px/1.5 var(--f-text); -webkit-font-smoothing: antialiased; }
button, select { font: inherit; color: inherit; }
button { cursor: pointer; }
h1, h2, h3 { font-family: var(--f-title); color: var(--navy); margin: 0; letter-spacing: -.01em; }
.i { width: 18px; height: 18px; flex: none; }
.grow { flex: 1; min-width: 0; }
.muted { color: var(--muted); }
:focus-visible { outline: 3px solid var(--sky); outline-offset: 2px; }

/* cabecera */
.top { border-bottom: 1px solid var(--line); background: #fff; position: sticky; top: 0; z-index: 5; }
.top-in { max-width: 1240px; margin: 0 auto; padding: 0 32px; height: 76px; display: flex; align-items: center; gap: 28px; }
.logo { height: 50px; width: auto; display: block; mix-blend-mode: multiply; }
.prod { font-family: var(--f-title); font-size: 13px; color: var(--steel); border-left: 1px solid var(--line); padding-left: 18px; line-height: 1.25; white-space: nowrap; }
.tabs { display: flex; gap: 6px; align-self: stretch; margin-left: 8px; }
.tabs button { border: 0; background: none; padding: 0 14px; font-family: var(--f-title); font-size: 15px; font-weight: 500; color: var(--muted); border-bottom: 3px solid transparent; display: flex; align-items: center; gap: 8px; }
.tabs button:hover { color: var(--navy); }
.tabs button[aria-selected="true"] { color: var(--navy); border-bottom-color: var(--navy); font-weight: 600; }
.ej { font-size: 12px; color: var(--muted); border: 1px solid var(--line); border-radius: 999px; padding: 4px 10px; white-space: nowrap; }

/* página */
main { max-width: 1240px; margin: 0 auto; padding: 36px 32px 24px; }
.pagehead { display: flex; align-items: flex-end; justify-content: space-between; gap: 24px; margin-bottom: 28px; }
h1 { font-size: 28px; font-weight: 600; }
.sub { margin: 4px 0 0; color: var(--muted); font-size: 14.5px; }
.btn-print { display: inline-flex; align-items: center; gap: 10px; background: var(--navy); color: #fff; border: 0; border-radius: 999px; padding: 15px 26px; font: 600 16px/1 var(--f-title); white-space: nowrap; }
.btn-print .i { width: 20px; height: 20px; }
.btn-print:hover { background: var(--navy-h); }

/* cifras */
.kpis { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 16px; margin-bottom: 28px; max-width: 640px; }
.kpi { border: 1px solid var(--line); border-radius: var(--r); padding: 20px 22px; display: flex; flex-direction: column; align-items: flex-start; gap: 6px; background: #fff; text-align: left; transition: border-color .15s, background .15s; }
.kpi:hover { border-color: var(--sky); }
.kpi.on { border-color: var(--navy); box-shadow: inset 0 0 0 1px var(--navy); background: var(--sky-soft); }
.kpi-n { font: 600 40px/1 var(--f-title); color: var(--navy); }
.kpi-l { color: var(--muted); font-size: 14px; }

.filt { margin: -14px 0 18px; font-size: 14px; color: var(--muted); display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
.filt .link { padding: 0; }

/* tarjetas y tablas */
.card { border: 1px solid var(--line); border-radius: var(--r); background: #fff; }
.grid { display: grid; grid-template-columns: minmax(0, 11fr) minmax(0, 13fr); gap: 20px; align-items: start; }
.tbl { width: 100%; border-collapse: collapse; }
.tbl th { text-align: left; font: 500 12.5px/1.2 var(--f-text); color: var(--muted); padding: 14px 16px; border-bottom: 1px solid var(--line); }
.tbl td { padding: 14px 16px; border-bottom: 1px solid var(--line); vertical-align: middle; }
.tbl tr:last-child td { border-bottom: 0; }
.num { text-align: right; font-variant-numeric: tabular-nums; white-space: nowrap; }
.orders .row { cursor: pointer; }
.orders .row:hover td { background: var(--soft); }
.orders .row.on td { background: var(--sky-soft); }
.orders .row.on td:first-child { box-shadow: inset 3px 0 0 var(--navy); }
.cli { display: block; font-weight: 600; color: var(--navy); }
.who { display: block; font-size: 13px; color: var(--muted); }
.pill { display: inline-flex; align-items: center; gap: 5px; border-radius: 999px; padding: 4px 10px 4px 8px; font-size: 13px; font-weight: 500; white-space: nowrap; }
.pill .i { width: 15px; height: 15px; }
.tag-upd { display: inline-flex; align-items: center; gap: 4px; margin-top: 5px; font-size: 12px; font-weight: 500; color: var(--steel); background: var(--sky-soft); border-radius: 999px; padding: 2px 9px 2px 7px; }
.tag-upd .i { width: 13px; height: 13px; }
.okc { display: inline-flex; align-items: center; gap: 5px; color: var(--ok); font-weight: 500; }
.okc .i { width: 16px; height: 16px; }
.pill.ok { background: var(--ok-bg); color: var(--ok); }

/* detalle del pedido */
.detail { padding: 24px 26px; }
.d-head { display: flex; justify-content: space-between; align-items: flex-start; gap: 16px; }
h2 { font-size: 21px; font-weight: 600; }
.facts { margin: 16px 0 6px; display: grid; gap: 6px; }
.facts p { margin: 0; display: flex; gap: 8px; align-items: flex-start; color: var(--text); font-size: 14px; }
.facts .i { color: var(--steel); margin-top: 1px; }
.lines { margin-top: 14px; }
.lines th { padding: 10px 10px; }
.lines td { padding: 12px 10px; }
.lines th:first-child, .lines td:first-child { padding-left: 0; }
.lines th:last-child, .lines td:last-child { padding-right: 0; }
.pn { display: block; font-weight: 600; }
.src { display: block; font-size: 12.5px; color: var(--muted); margin-top: 2px; }
.qty { font-weight: 600; }
.note { display: inline-block; margin-left: 8px; font-size: 12px; font-weight: 500; color: var(--steel); border: 1px solid #c9dfe6; border-radius: 999px; padding: 0 8px; vertical-align: 1px; }
.d-num { margin: 0 0 2px; font-size: 12px; color: var(--muted); letter-spacing: .03em; }
.changes { margin: 18px 0 4px; border: 1px solid #c9dfe6; background: #f7fbfc; border-radius: 10px; padding: 14px 16px; }
.changes h3 { font-size: 15px; display: flex; align-items: center; gap: 8px; }
.changes h3 .i { color: var(--steel); }
.chg { margin-top: 10px; }
.chg + .chg { border-top: 1px solid #d9e8ed; padding-top: 10px; }
.chg-h { margin: 0 0 6px; font-size: 14px; color: var(--text); }
.chg-t { display: inline-block; font-weight: 600; color: var(--navy); margin-right: 8px; font-variant-numeric: tabular-nums; }
.chg ul { list-style: none; margin: 0; padding: 0; display: grid; gap: 4px; }
.chg li { display: flex; gap: 10px; align-items: baseline; font-size: 14px; }
.chg li b { font-size: 12px; font-weight: 600; border-radius: 999px; padding: 1px 9px; min-width: 76px; text-align: center; }
.chg li.add b { background: var(--ok-bg); color: var(--ok); }
.chg li.rem b { background: var(--red-bg); color: var(--red); }
.chg li.rem span { text-decoration: line-through; color: var(--muted); }
.chg li.mod b { background: var(--sky-soft); color: var(--navy); }
.chg-b { margin: 8px 0 0; font-size: 12.5px; color: var(--muted); }
.chg-b span { font-weight: 600; }
.na { color: #9aa8b3; }
.notes { margin: 14px 0 0; padding: 0; list-style: none; display: grid; gap: 4px; }
.notes li { font-size: 13.5px; color: var(--muted); padding-left: 14px; position: relative; }
.notes li::before { content: ""; position: absolute; left: 2px; top: .62em; width: 5px; height: 5px; border-radius: 50%; background: #b8c4cd; }
.d-foot { display: flex; justify-content: space-between; align-items: center; gap: 12px; margin-top: 20px; padding-top: 16px; border-top: 1px solid var(--line); font-size: 13.5px; }
.d-foot .muted { display: flex; align-items: center; gap: 6px; }
.d-foot .muted .i { color: var(--ok); width: 16px; height: 16px; }
.link { background: none; border: 0; color: var(--steel); font-weight: 600; display: inline-flex; align-items: center; gap: 6px; padding: 6px 0; white-space: nowrap; }
.link .i { width: 16px; height: 16px; }
.link:hover { color: var(--navy); text-decoration: underline; }
#detail, .pane { scroll-margin-top: 92px; }
.empty { color: var(--muted); padding: 40px 0; text-align: center; }

/* conversaciones */
.convs { display: grid; grid-template-columns: 340px minmax(0, 1fr); height: calc(100vh - 250px); min-height: 520px; overflow: hidden; }
.chats { border-right: 1px solid var(--line); overflow-y: auto; }
.chat { width: 100%; display: flex; gap: 12px; align-items: center; text-align: left; background: none; border: 0; border-bottom: 1px solid var(--line); padding: 14px 16px; }
.chat:hover { background: var(--soft); }
.chat.on { background: var(--sky-soft); box-shadow: inset 3px 0 0 var(--navy); }
.av { width: 40px; height: 40px; border-radius: 50%; background: var(--sky-soft); color: var(--navy); display: grid; place-items: center; font: 600 13px/1 var(--f-title); flex: none; }
.chat .mid { min-width: 0; flex: 1; display: flex; flex-direction: column; gap: 2px; }
.chat .ctop { display: flex; justify-content: space-between; gap: 8px; }
.chat .nm { font-weight: 600; color: var(--navy); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.tm2 { font-size: 12px; color: var(--muted); }
.pv { font-size: 13px; color: var(--muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; display: flex; align-items: center; gap: 4px; }
.pv .i { width: 14px; height: 14px; }
.pane { display: flex; flex-direction: column; min-height: 0; }
.pane-h { display: flex; align-items: center; gap: 12px; padding: 14px 20px; border-bottom: 1px solid var(--line); }
.pane-h .nm { font-weight: 600; color: var(--navy); }
.pane-h .sub { margin: 0; font-size: 13px; }
.ro { display: inline-flex; align-items: center; gap: 6px; font-size: 12.5px; color: var(--muted); border: 1px solid var(--line); border-radius: 999px; padding: 4px 10px; white-space: nowrap; }
.ro .i { width: 14px; height: 14px; }
.thread { flex: 1; overflow-y: auto; background: var(--soft); padding: 20px 24px 28px; display: flex; flex-direction: column; gap: 10px; }
.daysep { text-align: center; margin: 6px 0; }
.daysep span { font-size: 12px; color: var(--muted); background: #fff; border: 1px solid var(--line); border-radius: 999px; padding: 3px 12px; }
.bub { max-width: min(560px, 82%); border-radius: 12px; padding: 9px 13px 7px; position: relative; font-size: 14.5px; }
.bub.in { background: #fff; border: 1px solid var(--line); align-self: flex-start; border-top-left-radius: 4px; }
.bub.out { background: #e3f0f4; align-self: flex-end; border-top-right-radius: 4px; }
.bub .tx { white-space: pre-line; }
.tm { display: block; text-align: right; font-size: 11px; color: var(--muted); margin-top: 2px; }
.auto { display: block; font-size: 11.5px; color: var(--steel); font-weight: 600; margin-bottom: 2px; }
.qr { display: flex; gap: 6px; margin-top: 6px; border-top: 1px solid #c9dfe6; padding-top: 6px; }
.qr span { flex: 1; text-align: center; color: var(--muted); font-weight: 500; font-size: 13.5px; display: inline-flex; align-items: center; justify-content: center; gap: 6px; }
.qr .i { width: 15px; height: 15px; }
.lrows { display: flex; flex-wrap: wrap; gap: 4px 6px; margin-top: 6px; font-size: 12px; color: var(--muted); }
.lrows span { border: 1px solid #c9dfe6; border-radius: 999px; padding: 0 8px; }
.bub.tap .lbl { display: block; font-size: 11.5px; color: var(--muted); }
.bub.tap { font-weight: 600; }
.bub.audio { width: min(520px, 86%); }
.player { display: flex; align-items: center; gap: 12px; }
.pl { width: 38px; height: 38px; border-radius: 50%; border: 0; background: var(--navy); color: #fff; display: grid; place-items: center; flex: none; }
.pl .i { width: 16px; height: 16px; }
.wave { flex: 1; display: flex; align-items: center; gap: 2px; height: 26px; }
.wave i { flex: 1; background: #c3d3dd; border-radius: 2px; min-width: 2px; }
.wave i.on { background: var(--navy); }
.dur { font-size: 12px; color: var(--muted); font-variant-numeric: tabular-nums; }
.transc { margin-top: 10px; padding-top: 8px; border-top: 1px solid var(--line); font-size: 14px; }
.transc .tl { display: block; font-size: 11.5px; font-weight: 600; color: var(--steel); margin-bottom: 2px; }
.sim { display: block; font-size: 11px; color: #8a99a5; margin-top: 6px; }

/* pie */
.foot { max-width: 1240px; margin: 0 auto; padding: 8px 32px 28px; font-size: 12px; color: #8a99a5; display: flex; justify-content: space-between; gap: 12px; flex-wrap: wrap; }

/* hoja del almacén: solo al imprimir */
#hoja { display: none; }

/* pantallas medianas y móvil */
@media (max-width: 1080px) {
  .prod { display: none; }
}
@media (max-width: 960px) {
  .grid { grid-template-columns: minmax(0, 1fr); }
  .convs { grid-template-columns: minmax(0, 1fr); height: auto; min-height: 0; overflow: visible; }
  .chats { border-right: 0; border-bottom: 1px solid var(--line); }
  .thread { max-height: 70vh; }
}
@media (max-width: 640px) {
  .top { position: static; }
  .top-in { padding: 10px 16px; height: auto; flex-wrap: wrap; gap: 8px 14px; }
  .orders th:nth-child(3), .orders td:nth-child(3), .orders .who { display: none; }
  .logo { height: 36px; }
  .tabs { order: 3; width: 100%; margin: 0; height: 44px; }
  .tabs button { flex: 1; justify-content: center; }
  main { padding: 22px 16px 16px; }
  .pagehead { flex-direction: column; align-items: stretch; gap: 14px; }
  .btn-print { justify-content: center; }
  h1 { font-size: 23px; }
  .kpi { padding: 14px 16px; }
  .kpi-n { font-size: 32px; }
  .tbl th, .tbl td { padding: 12px 10px; }
  .detail { padding: 18px 16px; }
  .d-head { flex-direction: column; gap: 8px; }
  .kpis { gap: 10px; }
  .chg li { flex-direction: column; gap: 2px; }
  .d-foot { flex-direction: column; align-items: flex-start; }
  .pane-h { flex-wrap: wrap; padding: 12px 14px; }
  .pane-h .grow { flex: 1 1 calc(100% - 60px); }
  .pane-h .ro { margin-left: 52px; }
  #detail, .pane { scroll-margin-top: 8px; }
  .thread { padding: 14px 12px 20px; }
  .bub, .bub.audio { max-width: 92%; width: auto; }
  .foot { padding: 8px 16px 24px; }
}

/* imprimir: una hoja de reparto por cliente, en dos columnas, limpia en A4 */

/* la hoja (igual en pantalla y en papel) */
#hoja { color: #000; font-size: 9.5pt; }
.h-top { display: flex; justify-content: space-between; align-items: flex-end; gap: 16pt; border-bottom: 1.5pt solid var(--navy); padding-bottom: 7pt; margin-bottom: 8pt; }
.h-l { display: flex; align-items: center; gap: 9pt; }
.h-ico { width: 24pt; height: 24pt; border-radius: 5pt; background: var(--navy); color: #fff; display: grid; place-items: center; -webkit-print-color-adjust: exact; print-color-adjust: exact; }
.h-ico .i { width: 14pt; height: 14pt; }
#hoja h1 { font-size: 17pt; color: var(--navy); line-height: 1.1; }
.h-l p { margin: 1pt 0 0; font-size: 8.5pt; color: var(--muted); }
.h-r { text-align: right; display: flex; flex-direction: column; gap: 1pt; }
.h-r b { font: 600 11pt var(--f-title); color: var(--navy); }
.h-r span { font-size: 8.5pt; color: var(--steel); font-weight: 600; }
.h-cols { columns: 2; column-gap: 18pt; }
.h-c { break-inside: avoid; page-break-inside: avoid; padding: 6pt 0 5pt; border-bottom: .5pt solid #d3dbe1; }
.h-ch { display: flex; align-items: baseline; gap: 7pt; }
.h-n { font-size: 7pt; color: #7d8b96; letter-spacing: .02em; flex: none; width: 34pt; }
.h-ch b { flex: 1; font: 600 10.5pt var(--f-title); color: var(--navy); }
.h-tot { font: 600 9.5pt var(--f-title); color: var(--navy); white-space: nowrap; }
.h-c ul { list-style: none; margin: 3pt 0 0; padding: 0 0 0 41pt; }
.h-c li { display: flex; align-items: center; gap: 6pt; padding: 1.6pt 0; font-size: 9pt; color: #1d2b36; }
.h-c li .ck { width: 7.5pt; height: 7.5pt; border: .8pt solid #6b7a86; border-radius: 1.5pt; flex: none; }
.h-c li .p { flex: 1; }
.h-c li .p i { color: var(--muted); }
.h-c li .q { white-space: nowrap; font-variant-numeric: tabular-nums; }
.h-f { display: flex; justify-content: space-between; margin-top: 10pt; padding-top: 4pt; font-size: 7.5pt; color: #7d8b96; }

/* columna lateral (versión A: siempre visible en el ordenador) */
.shell { display: grid; grid-template-columns: 236px minmax(0, 1fr); min-height: 100vh; }
.side { position: sticky; top: 0; height: 100vh; border-right: 1px solid var(--line); background: var(--soft); display: flex; flex-direction: column; gap: 6px; padding: 26px 16px 20px; }
.side .logo { width: 176px; height: auto; margin: 0 4px; }
.side .prod { border: 0; padding: 0 6px; margin: 6px 0 22px; font-size: 13px; white-space: normal; }
.side .tabs { flex-direction: column; align-self: stretch; margin: 0; gap: 4px; }
.side .tabs button { width: 100%; padding: 11px 12px; border: 0; border-radius: 10px; justify-content: flex-start; gap: 12px; text-align: left; font-size: 15px; }
.side .tabs button:hover { background: #fff; }
.side .tabs button[aria-selected="true"] { background: #fff; color: var(--navy); font-weight: 600; box-shadow: inset 3px 0 0 var(--navy), 0 1px 2px rgba(3,47,77,.06); }
.side-f { margin-top: auto; padding: 0 6px; }
.col { min-width: 0; display: flex; flex-direction: column; }
.col main { width: 100%; }
.mbar, .scrim { display: none; }

/* vista previa a pantalla completa al pulsar «Imprimir hoja del almacén» */
body.prev { overflow: hidden; }
body.prev #hoja { display: block; position: fixed; inset: 0; z-index: 60; background: #dfe6eb; overflow: auto; padding: 0 16px 40px; }
.pv-bar { position: sticky; top: 0; z-index: 2; display: flex; align-items: center; gap: 12px; max-width: 900px; margin: 0 auto; padding: 16px 0; background: #dfe6eb; }
.pv-bar b { font: 600 18px var(--f-title); color: var(--navy); }
.pv-bar .grow { flex: 1; }
.pv-close { border: 1px solid #b9c6d0; background: #fff; color: var(--navy); border-radius: 999px; padding: 12px 22px; font: 600 15px/1 var(--f-title); }
.pv-close:hover { border-color: var(--steel); }
.paper { background: #fff; width: 210mm; max-width: 100%; min-height: 297mm; margin: 0 auto; padding: 11mm 11mm 12mm; box-shadow: 0 10px 40px -12px rgba(3,47,77,.35); border-radius: 4px; zoom: 1.15; }
@media (max-width: 700px) {
  .paper { zoom: 1; min-height: 0; padding: 18px 14px; }
  .h-cols { columns: 1; }
  .pv-bar b { display: none; }
}

/* imprimir: va al final para que gane a las reglas de la vista previa */
@page { size: A4; margin: 11mm 11mm 12mm; }
@media print {
  body, body.prev { background: #fff; color: #000; font-size: 9.5pt; overflow: visible; }
  body > *:not(#hoja) { display: none !important; }
  #hoja { display: block; }
  #hoja, body.prev #hoja { position: static; background: none; overflow: visible; padding: 0; }
  .pv-bar { display: none !important; }
  .paper { width: auto; max-width: none; min-height: 0; margin: 0; padding: 0; box-shadow: none; border-radius: 0; zoom: 1; }
}

/* versión B y móvil: la columna se abre con el ☰ */
body.lay-menu .shell { grid-template-columns: minmax(0, 1fr); }
body.lay-menu .side { position: fixed; left: 0; top: 0; bottom: 0; width: 264px; height: auto; z-index: 30; background: #fff; transform: translateX(-105%); transition: transform .25s ease; box-shadow: 0 0 40px rgba(3,47,77,.18); }
body.lay-menu .side.open { transform: none; }
body.lay-menu .scrim { display: block; position: fixed; inset: 0; background: rgba(3,47,77,.32); opacity: 0; pointer-events: none; transition: opacity .2s; z-index: 25; }
body.lay-menu .scrim.on { opacity: 1; pointer-events: auto; }
body.lay-menu .mbar { display: flex; align-items: center; gap: 16px; padding: 12px 32px; border-bottom: 1px solid var(--line); background: #fff; position: sticky; top: 0; z-index: 20; }
body.lay-menu .mbar .logo { height: 40px; width: auto; mix-blend-mode: multiply; }
body.lay-menu .burger { width: 42px; height: 42px; border: 1px solid var(--line); border-radius: 10px; background: #fff; display: grid; place-items: center; color: var(--navy); }
body.lay-menu .burger:hover { border-color: var(--steel); }
body.lay-menu .side .tabs { order: 0; width: auto; height: auto; }
body.lay-menu .side .tabs button { flex: none; justify-content: flex-start; }

/* ===== Añadidos para el panel real (2026-11-30f): mismas piezas y colores de la demo ===== */
[hidden] { display: none !important; }
input, textarea { font: inherit; color: inherit; }
input[type=text], input[type=tel], input[type=password], input[type=search], input[type=date], input[type=datetime-local], select, textarea { border: 1px solid var(--line); border-radius: 10px; padding: 10px 12px; background: #fff; font-size: 15px; color: var(--text); min-width: 0; }
input:focus, select:focus, textarea:focus { border-color: var(--steel); outline: none; box-shadow: 0 0 0 3px var(--sky-soft); }
textarea { width: 100%; min-height: 72px; resize: vertical; }
.campo { display: grid; gap: 6px; font-size: 13px; color: var(--muted); font-weight: 500; }
.err { color: var(--red); font-size: 14px; min-height: 20px; margin: 0; }
.btn-print:disabled { opacity: .45; cursor: default; }
.btn-print.danger { background: var(--red); } .btn-print.danger:hover { background: #7f2222; }
.btn2 { display: inline-flex; align-items: center; gap: 8px; border: 1px solid #b9c6d0; background: #fff; color: var(--navy); border-radius: 999px; padding: 13px 22px; font: 600 15px/1 var(--f-title); white-space: nowrap; cursor: pointer; }
.btn2:hover { border-color: var(--steel); }
.btn2 .i { width: 18px; height: 18px; }
.link.sm { font-size: 13px; padding: 2px 0; font-weight: 500; }
.link.danger { color: var(--red); }
/* inicio de sesión */
.login { min-height: 100vh; display: grid; place-items: center; padding: 24px 16px; background: var(--soft); }
.login-card { width: min(400px, 100%); padding: 32px 28px; display: grid; gap: 14px; justify-items: start; }
.login-card .logo { height: 52px; width: auto; margin-bottom: 6px; }
.login-card .campo, .login-card input { width: 100%; }
.login-card .btn-print { width: 100%; justify-content: center; }
.login-card .ej { justify-self: center; }
/* barra de arriba y menú */
.mbar .ej { margin-left: 4px; }
.side-sec { display: block; margin: 18px 12px 4px; font: 600 11.5px/1 var(--f-text); letter-spacing: .06em; text-transform: uppercase; color: var(--muted); }
/* estados (mismas píldoras de la demo) */
.pill.wait, .stc.wait { color: #8a5a00; } .pill.wait { background: #fdf4e3; }
.pill.bad, .stc.bad { color: var(--red); } .pill.bad { background: var(--red-bg); border: 0; cursor: pointer; font: inherit; font-size: 13px; font-weight: 500; }
.pill.gr, .stc.gr { color: var(--muted); } .pill.gr { background: var(--soft); }
.stc { display: inline-flex; align-items: center; gap: 5px; font-weight: 500; font-size: 14px; }
.stc .i { width: 16px; height: 16px; }
/* encabezado con selector de día */
.pagehead .acts { display: flex; gap: 12px; flex-wrap: wrap; justify-content: flex-end; }
.diasel { display: flex; align-items: center; gap: 6px; margin-top: 8px; flex-wrap: wrap; }
.dsb { width: 34px; height: 34px; border: 1px solid var(--line); border-radius: 50%; background: #fff; display: grid; place-items: center; color: var(--navy); cursor: pointer; position: relative; overflow: hidden; }
.dsb:hover { border-color: var(--steel); }
.dsb .i { width: 17px; height: 17px; }
.dsl { font: 600 16px/1 var(--f-title); color: var(--steel); padding: 0 6px; min-width: 150px; text-align: center; }
.dsb.cal { margin-left: 4px; }
.dia-in { position: absolute; inset: 0; opacity: 0; cursor: pointer; width: 100%; height: 100%; padding: 0; border: 0; }
.diasel .link { margin-left: 8px; font-size: 13.5px; }
.otros { margin: 6px 0 0; font-size: 13px; color: var(--muted); }
.kpis.k3 { grid-template-columns: repeat(3, minmax(0, 1fr)); max-width: 960px; }
.vacio { padding: 40px 24px; text-align: center; color: var(--muted); }
.vacio p { margin: 0 0 8px; }
.tag-sim { display: inline-block; margin: 5px 0 0 6px; font-size: 11px; color: #8a99a5; border: 1px solid var(--line); border-radius: 999px; padding: 0 8px; }
.orders .row.anul .cli, .orders .row.anul .who { text-decoration: line-through; color: var(--muted); }
.tbl.anul td { text-decoration: line-through; color: var(--muted); }
.falta { color: var(--red); font-weight: 600; font-size: 13.5px; }
.src.rv { color: var(--red); }
.d-acts { display: inline-flex; gap: 18px; align-items: center; flex-wrap: wrap; }
/* hoja */
.h-warn { margin: 2pt 0 0 41pt; font-size: 8.5pt; font-weight: 700; color: #000; }
.h-nota { margin: 2pt 0 0 41pt; font-size: 8.5pt; font-style: italic; color: #333; }
.h-total { margin-top: 8pt; border-top: 1pt solid var(--navy); border-bottom: 0; }
/* conversaciones: audio y foto con el texto debajo */
.bub.media { width: min(440px, 86%); }
.bub.media .lbl { display: inline-flex; align-items: center; gap: 5px; font-size: 11.5px; font-weight: 600; color: var(--steel); margin-bottom: 6px; }
.bub.media .lbl .i { width: 14px; height: 14px; }
.bub .aud { display: block; width: 100%; height: 40px; }
.bub .foto { display: block; max-width: 100%; max-height: 280px; border-radius: 8px; border: 1px solid var(--line); }
.bub .cap { margin-top: 6px; }
.transc .ll { display: block; }
.transc s { color: var(--muted); }
.duda { background: var(--red-bg); color: var(--red); border-radius: 4px; padding: 0 3px; }
.mwarn { display: block; color: var(--red); font-size: 12.5px; margin-top: 6px; }
/* pantallas de pruebas (menú ☰) */
.grid2 { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 20px; margin-bottom: 20px; align-items: start; }
.card.pad { padding: 22px 24px; }
.card.pad h2 { font-size: 18px; margin-bottom: 10px; }
.card.pad + .card { margin-top: 20px; }
.qrbox { display: flex; gap: 18px; align-items: center; flex-wrap: wrap; margin-top: 12px; }
.qrbox img { width: 220px; height: 220px; border: 1px solid var(--line); border-radius: 8px; }
.qrbox ol { margin: 0; padding-left: 18px; font-size: 14px; }
.kv { display: grid; grid-template-columns: max-content 1fr; gap: 6px 16px; font-size: 14px; margin: 12px 0 18px; }
.kv dt { color: var(--muted); } .kv dd { margin: 0; } .kv .rv { color: var(--red); font-weight: 600; }
.frm { display: flex; gap: 14px; flex-wrap: wrap; align-items: end; }
.frm .err { width: 100%; }
.simf { display: grid; gap: 16px; }
.simfile { display: flex; gap: 12px; align-items: center; flex-wrap: wrap; font-size: 14px; }
.simprev img { max-width: 260px; max-height: 200px; border-radius: 8px; border: 1px solid var(--line); }
.simres { white-space: pre-line; font-size: 14px; color: var(--text); background: var(--soft); border-radius: 10px; padding: 0 14px; }
.simres:not(:empty) { padding: 12px 14px; }
/* panel lateral de nuevo pedido / editar (como el menú, pero a la derecha) */
.dscrim { position: fixed; inset: 0; background: rgba(3,47,77,.32); opacity: 0; pointer-events: none; transition: opacity .2s; z-index: 40; }
.dscrim.on { opacity: 1; pointer-events: auto; }
.drawer { position: fixed; top: 0; right: 0; bottom: 0; width: min(720px, 100vw); background: #fff; z-index: 45; transform: translateX(105%); transition: transform .2s ease; box-shadow: 0 0 40px rgba(3,47,77,.18); display: flex; }
.drawer.open { transform: none; }
body.dopen { overflow: hidden; }
.drawer form { display: flex; flex-direction: column; width: 100%; min-height: 0; }
.dr-h, .dr-f { display: flex; align-items: center; gap: 12px; padding: 18px 26px; }
.dr-h { border-bottom: 1px solid var(--line); } .dr-h h2 { flex: 1; font-size: 21px; }
.dr-f { border-top: 1px solid var(--line); flex-wrap: wrap; } .dr-f .muted { font-size: 13px; }
.dr-f .btn-print { padding: 13px 24px; font-size: 15px; } .dr-f .pv-close { padding: 12px 20px; }
.dr-b { flex: 1; overflow-y: auto; padding: 20px 26px; display: grid; gap: 16px; align-content: start; }
.x { border: 0; background: none; font-size: 26px; line-height: 1; color: var(--muted); padding: 4px 8px; border-radius: 8px; cursor: pointer; }
.x:hover { background: var(--soft); color: var(--navy); }
.elegido { display: flex; gap: 10px; align-items: baseline; flex-wrap: wrap; background: var(--sky-soft); border-radius: 10px; padding: 10px 14px; color: var(--text); font-size: 15px; font-weight: 400; }
.elegido b { color: var(--navy); }
.res { border: 1px solid var(--line); border-radius: 10px; max-height: 230px; overflow-y: auto; }
.res:empty { display: none; }
.res button { display: block; width: 100%; text-align: left; border: 0; border-bottom: 1px solid var(--line); background: #fff; padding: 10px 14px; font-size: 14px; color: var(--text); }
.res button b { color: var(--navy); }
.res button:last-child { border-bottom: 0; }
.res button:hover, .res button:focus-visible { background: var(--sky-soft); }
.nores { margin: 0; padding: 10px 14px; }
.fila3 { display: grid; grid-template-columns: 180px 1fr; gap: 14px; align-items: end; }
.seg { border: 0; padding: 0; margin: 0; display: grid; gap: 6px; font-size: 13px; color: var(--muted); font-weight: 500; min-width: 0; }
.seg legend { padding: 0; margin-bottom: 6px; }
.seg div { display: flex; border: 1px solid var(--line); border-radius: 10px; overflow: hidden; }
.seg label { flex: 1; text-align: center; padding: 10px 6px; cursor: pointer; color: var(--text); font-size: 14px; border-right: 1px solid var(--line); }
.seg label:last-child { border-right: 0; }
.seg input { position: absolute; opacity: 0; pointer-events: none; }
.seg label:has(input:checked) { background: var(--navy); color: #fff; }
.seg label:has(input:focus-visible) { outline: 3px solid var(--sky); outline-offset: -3px; }
.aviso-f { margin: -6px 0 0; font-size: 13.5px; color: var(--muted); }
.aviso-f:empty { display: none; }
.lin-cab { display: flex; align-items: center; gap: 12px; flex-wrap: wrap; margin-bottom: 10px; }
.lin-cab h3 { font-size: 16px; flex: 1; }
.lin-cab .btn2 { padding: 9px 16px; font-size: 14px; }
.lineas { display: grid; gap: 8px; margin-bottom: 4px; }
.lin { display: grid; grid-template-columns: minmax(0, 1fr) 84px 104px 160px 36px; gap: 8px; align-items: center; }
.lin input, .lin select { width: 100%; min-width: 0; padding: 9px 10px; font-size: 14.5px; }
.lin .mal { border-color: var(--red); background: var(--red-bg); }
.lin-tit { font-size: 12.5px; color: var(--muted); margin-bottom: 4px; }
.lin .sin-op { font-size: 12.5px; color: var(--muted); padding-left: 4px; }
.avisos { background: #fdf4e3; color: #8a5a00; border-radius: 10px; padding: 12px 16px; font-size: 14px; }
.avisos ul { margin: 4px 0 0; padding-left: 18px; }
.toast { position: fixed; left: 50%; bottom: 22px; transform: translateX(-50%); background: var(--navy); color: #fff; padding: 11px 20px; border-radius: 999px; font-size: 14px; z-index: 70; box-shadow: 0 6px 20px rgba(3,47,77,.25); }
@media (max-width: 960px) { .grid2 { grid-template-columns: minmax(0, 1fr); } .kpis.k3 { grid-template-columns: repeat(3, minmax(0, 1fr)); } }
@media (max-width: 640px) {
  body.lay-menu .mbar { padding: 10px 16px; }
  .mbar .ej { display: none; }
  .pagehead .acts { flex-direction: column; align-items: stretch; }
  .pagehead .acts .btn2 { justify-content: center; }
  .dsl { min-width: 0; font-size: 15px; }
  .kpis.k3 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .orders th:nth-child(2), .orders td:nth-child(2) { display: none; }
  .fila3 { grid-template-columns: 1fr; }
  .dr-h, .dr-f, .dr-b { padding-left: 16px; padding-right: 16px; }
  .lin { grid-template-columns: 1fr 1fr 40px; padding-bottom: 10px; border-bottom: 1px solid var(--line); }
  .lin .c-prod { grid-row: 1; grid-column: 1 / 3; } .lin .c-x { grid-row: 1; grid-column: 3; }
  .lin .c-cant { grid-row: 2; grid-column: 1; } .lin .c-uni { grid-row: 2; grid-column: 2; }
  .lin .c-op { grid-row: 3; grid-column: 1 / 3; } .lin .c-op:not(:has(select)) { display: none; }
  .lin-tit { display: none; }
  .d-acts { gap: 14px; }
  .card.pad { padding: 18px 16px; }
}
@media print { .drawer, .dscrim, .toast, #login { display: none !important; } .h-warn, .h-nota { color: #000; } }
.grid2 > .card.pad + .card { margin-top: 0; }

/* ===== Probar como cliente (2026-11-30h): conversación como la del cocinero, con los estilos de Conversaciones ===== */
.simgrid { display: grid; grid-template-columns: minmax(0, 1fr) 290px; gap: 20px; align-items: start; }
.simchat { display: grid; grid-template-columns: 290px minmax(0, 1fr); height: calc(100vh - 230px); min-height: 540px; overflow: hidden; }
.simcli { display: flex; flex-direction: column; min-height: 0; overflow: hidden; }
.simbus { padding: 12px 14px; border-bottom: 1px solid var(--line); }
.simbus input { width: 100%; font: inherit; border: 1px solid var(--line); border-radius: 999px; padding: 8px 14px; background: var(--soft); }
.simcli-l { overflow-y: auto; flex: 1; }
.simcli .nores { padding: 16px; margin: 0; }
.simchat .pane { min-height: 0; }
/* aquí tú eres el cocinero: sus mensajes a la derecha, el agente a la izquierda */
.simthread .bub.in { align-self: flex-end; background: #e3f0f4; border: 0; border-top-left-radius: 12px; border-top-right-radius: 4px; }
.simthread .bub.out { align-self: flex-start; background: #fff; border: 1px solid var(--line); border-top-right-radius: 12px; border-top-left-radius: 4px; }
.simthread .bub.in .transc { border-top-color: #c9dfe6; }
.simthread .simnota { align-self: flex-end; margin: -4px 2px 0; font-size: 12px; color: var(--muted); }
.simvacio { margin: auto; text-align: center; color: var(--muted); display: grid; gap: 4px; max-width: 360px; font-size: 14px; }
.simvacio b { color: var(--navy); font-family: var(--f-title); font-weight: 600; }
.simaviso { align-self: center; display: flex; gap: 8px; align-items: flex-start; max-width: 460px; margin: 4px 0 0; background: #fff8e8; border: 1px solid #f0dfb4; color: #6b4e12; border-radius: 10px; padding: 9px 13px; font-size: 13.5px; }
.simaviso .i { width: 16px; height: 16px; margin-top: 2px; }
.bub.typing { display: inline-flex; align-items: center; gap: 8px; color: var(--muted); font-size: 13.5px; padding: 10px 14px; }
.dots { display: inline-flex; gap: 3px; }
.dots i { width: 6px; height: 6px; border-radius: 50%; background: var(--steel); opacity: .35; animation: simdot 1.2s infinite; }
.dots i:nth-child(2) { animation-delay: .2s; } .dots i:nth-child(3) { animation-delay: .4s; }
@keyframes simdot { 0%, 60%, 100% { opacity: .35; transform: none; } 30% { opacity: 1; transform: translateY(-3px); } }
@media (prefers-reduced-motion: reduce) { .dots i { animation: none; opacity: .7; } }
.simbox { border-top: 1px solid var(--line); background: #fff; padding: 10px 14px 8px; display: grid; gap: 6px; }
.simrow { display: flex; align-items: flex-end; gap: 8px; }
.simrow textarea { flex: 1; min-width: 0; resize: none; font: inherit; border: 1px solid var(--line); border-radius: 20px; padding: 9px 16px; min-height: 42px; max-height: 140px; line-height: 1.45; background: var(--soft); }
.simrow textarea:focus { background: #fff; }
.simico { width: 42px; height: 42px; border-radius: 50%; border: 1px solid var(--line); background: #fff; color: var(--steel); display: grid; place-items: center; flex: none; cursor: pointer; }
.simico:hover { color: var(--navy); background: var(--soft); }
.simico.rec { background: var(--red); border-color: var(--red); color: #fff; animation: simrec 1.2s infinite; }
@keyframes simrec { 50% { box-shadow: 0 0 0 5px var(--red-bg); } }
.simsend { width: 42px; height: 42px; border-radius: 50%; border: 0; background: var(--navy); color: #fff; display: grid; place-items: center; flex: none; }
.simsend:hover { background: var(--navy-h); }
.simsend:disabled { opacity: .5; cursor: wait; }
.simsend .i { width: 18px; height: 18px; }
.simest { margin: 0; font-size: 12.5px; color: var(--muted); }
.simest:empty { display: none; }
.simadj { display: flex; align-items: center; gap: 10px; background: var(--soft); border: 1px solid var(--line); border-radius: 10px; padding: 6px 8px; font-size: 13px; }
.simadj[hidden] { display: none; }
.simadj img { height: 52px; width: auto; max-width: 90px; border-radius: 6px; object-fit: cover; }
.simadj audio { height: 34px; max-width: 220px; }
.simadj .muted { flex: 1; min-width: 0; }
.simmas { font-size: 12.5px; color: var(--muted); }
.simmas summary { cursor: pointer; width: max-content; }
.simmas .campo { margin-top: 6px; max-width: 320px; }
.simped { padding: 20px 20px 16px; display: grid; gap: 10px; }
.simped h2 { font-size: 16px; }
.simped-h { display: flex; justify-content: space-between; align-items: center; gap: 8px; }
.simped-h .d-num { margin: 0; }
.simped-f, .simped-q { display: flex; gap: 8px; align-items: flex-start; margin: 0; font-size: 14px; }
.simped-f .i, .simped-q .i { width: 16px; height: 16px; margin-top: 3px; color: var(--steel); }
.simped-q { color: #6b4e12; }
.simped-l { margin: 0; padding: 0; list-style: none; display: grid; gap: 4px; font-size: 14px; border-top: 1px solid var(--line); padding-top: 10px; }
.simped-l li { display: flex; flex-direction: column; }
.simped-s, .simped-v { margin: 0; font-size: 13px; }
.simped .link { justify-self: start; }
.solo-movil { display: none; }
@media (max-width: 1180px) {
  .simgrid { grid-template-columns: minmax(0, 1fr); }
  .simchat { grid-template-columns: 260px minmax(0, 1fr); }
}
@media (max-width: 960px) {
  .simchat { grid-template-columns: minmax(0, 1fr); height: auto; min-height: 0; overflow: visible; }
  .simchat:not(.conlista) .simcli { display: none; }
  .simchat.conlista .simcli { max-height: 50vh; border-right: 0; border-bottom: 1px solid var(--line); }
  .simchat .thread { height: 58vh; min-height: 320px; max-height: none; flex: none; }
  .solo-movil { display: inline-flex; }
}
@media (max-width: 640px) {
  .simchat .pane-h .ro { display: none; }
  .simchat .pane-h .grow { flex: 1 1 auto; }
  .simbox { padding: 8px 10px 6px; }
  .simrow { gap: 6px; }
  .simico, .simsend { width: 40px; height: 40px; }
  .simthread .simnota { margin-right: 0; }
}
