/* Softexpress — sistema de diseño (moderno, claro, táctil)
   Paleta de la marca: Naranja Softexpress #F36B21 · Gris azulado #3F5265 · Blanco #FFFFFF · Negro #121212 · Crema cálido #FFF1E6 */
:root {
  --bg: #FFF1E6; --surface: #FFFFFF; --surface-2: #FFF7F1; --line: #EFDCCE;
  --text: #121212; --muted: #3F5265; --faint: #8A98A6;
  --accent: #F36B21; --accent-2: #D95A15; --accent-soft: #FFE4D2;
  --slate: #3F5265; --slate-2: #33434F; --slate-soft: #E8EDF1;
  --ok: #10B981; --ok-soft: #E3F6EE; --warn: #F59E0B; --warn-soft: #FFF0D6;
  --danger: #EF4444; --danger-soft: #FEE7E7; --info: #3F5265; --info-soft: #E8EDF1;
  --purple: #8B5CF6; --purple-soft: #F1ECFE;
  --ok-text: #0B7A55; --warn-text: #A15C00; --danger-text: #B42318; --info-text: #2F4050; --purple-text: #6D28D9;
  --r: 14px; --r-sm: 10px; --r-xs: 7px;
  --sh: 0 1px 2px rgba(63,82,101,.06), 0 4px 16px -4px rgba(63,82,101,.12);
  --sh-lg: 0 12px 40px -8px rgba(63,82,101,.28);
  --font: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Inter, "Helvetica Neue", Arial, sans-serif;
  --toast: #121212; --scroll: #E5D2C4; --glow: #FFD9C0; --marca-op: 0;
  /* Barra lateral (caja y administración): gris azulado con texto crema, naranja para lo activo */
  --side-bg: #3F5265; --side-txt: #FFF1E6; --side-muted: rgba(255,241,230,.72); --side-line: rgba(255,255,255,.12); --side-hover: rgba(255,255,255,.09); --side-item: rgba(255,255,255,.07);
  color-scheme: light;
}
/* Modo oscuro: cada dispositivo elige el suyo (botón ☾/☀ en la barra; se guarda en localStorage se_tema) */
:root[data-theme="dark"] {
  --bg: #111619; --surface: #1A2025; --surface-2: #232A31; --line: #2E363E;
  --text: #F3EDE8; --muted: #A9B4BF; --faint: #6F7A85;
  --accent-2: #FF8A4D; --accent-soft: rgba(243,107,33,.2);
  --slate: #6F8398; --slate-2: #8A9DB0; --slate-soft: rgba(63,82,101,.35);
  --ok-soft: rgba(16,185,129,.18); --warn-soft: rgba(245,158,11,.18); --danger-soft: rgba(239,68,68,.2); --info-soft: rgba(111,131,152,.25); --purple-soft: rgba(139,92,246,.22);
  --ok-text: #34D399; --warn-text: #FBBF24; --danger-text: #F87171; --info-text: #B8C7D6; --purple-text: #C4B5FD;
  --sh: 0 1px 2px rgba(0,0,0,.35), 0 4px 16px -4px rgba(0,0,0,.5);
  --sh-lg: 0 12px 40px -8px rgba(0,0,0,.75);
  --toast: #2C313C; --scroll: #3A404C; --glow: rgba(243,107,33,.16); --marca-op: 0;
  --side-bg: #171C21; --side-txt: #F3EDE8; --side-muted: rgba(243,237,232,.65); --side-line: rgba(255,255,255,.08); --side-hover: rgba(255,255,255,.07); --side-item: rgba(255,255,255,.05);
  color-scheme: dark;
}
/* Marco de agua de la marca en todas las pantallas (fijo, al fondo, no estorba al tocar) */
body::before { content: ""; position: fixed; inset: 0; z-index: 0; pointer-events: none; background: var(--text); -webkit-mask: url(/banner.png) center / min(72vw, 640px) auto no-repeat; mask: url(/banner.png) center / min(72vw, 640px) auto no-repeat; opacity: var(--marca-op); }
body > * { position: relative; z-index: 1; }
@media print { body::before { display: none; } }
/* Botón de tema */
.btn-tema { width: 38px; height: 38px; padding: 0; border-radius: 50%; font-size: 17px; }
.btn-tema svg { width: 18px; height: 18px; flex: none; }
.btn-idioma { min-width: 38px; height: 38px; padding: 0 8px; border-radius: 19px; font-size: 12px; font-weight: 800; letter-spacing: .04em; }
* { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }
html, body { height: 100%; }
body { margin: 0; font-family: var(--font); background: var(--bg); color: var(--text); font-size: 15px; line-height: 1.4; -webkit-font-smoothing: antialiased; overscroll-behavior: none; }
button, input, select, textarea { font: inherit; color: inherit; }
button { cursor: pointer; border: 0; background: none; padding: 0; }
a { color: inherit; text-decoration: none; }
h1, h2, h3 { margin: 0; font-weight: 700; letter-spacing: -.01em; }
.hidden { display: none !important; }
.muted { color: var(--muted); } .faint { color: var(--faint); }
.b { font-weight: 700; } .sm { font-size: 13px; } .xs { font-size: 12px; }
.row { display: flex; align-items: center; gap: 10px; } .grow { flex: 1; } .wrap { flex-wrap: wrap; }
.col { display: flex; flex-direction: column; gap: 10px; }
.right { text-align: right; } .center { text-align: center; }
.mono { font-variant-numeric: tabular-nums; }

/* Botones */
.btn { display: inline-flex; align-items: center; justify-content: center; gap: 8px; padding: 11px 18px; border-radius: var(--r-sm); font-weight: 600; font-size: 15px; background: var(--surface); color: var(--text); border: 1px solid var(--line); transition: transform .06s, background .15s, box-shadow .15s; user-select: none; white-space: nowrap; min-height: 44px; }
.btn:active { transform: scale(.97); }
.btn:disabled { opacity: .45; cursor: not-allowed; transform: none; }
.btn-primary { background: var(--accent); color: #fff; border-color: var(--accent); box-shadow: 0 6px 16px -6px rgba(243,107,33,.6); }
.btn-primary:hover { background: var(--accent-2); }
.btn-ok { background: var(--ok); color: #fff; border-color: var(--ok); }
.btn-danger { background: var(--danger); color: #fff; border-color: var(--danger); }
.btn-info { background: var(--slate); color: #fff; border-color: var(--slate); }
.btn-ghost { background: transparent; border-color: transparent; color: var(--muted); }
.btn-ghost:hover { background: rgba(0,0,0,.05); color: var(--text); }
.btn-soft { background: var(--accent-soft); color: var(--accent-2); border-color: transparent; }
.btn-lg { padding: 14px 22px; font-size: 17px; min-height: 54px; border-radius: var(--r); }
.btn-sm { padding: 6px 12px; font-size: 13px; min-height: 34px; border-radius: var(--r-xs); }
.btn-icon { width: 44px; height: 44px; padding: 0; border-radius: 50%; }
.btn-block { width: 100%; }

/* Campos */
.field { display: flex; flex-direction: column; gap: 6px; }
.field label { font-size: 13px; font-weight: 600; color: var(--muted); }
.input, select.input, textarea.input { width: 100%; padding: 11px 14px; border: 1.5px solid var(--line); border-radius: var(--r-sm); background: var(--surface); outline: none; min-height: 44px; transition: border-color .15s, box-shadow .15s; }
.input:focus { border-color: var(--accent); box-shadow: 0 0 0 4px rgba(243,107,33,.16); }
textarea.input { min-height: 80px; resize: vertical; }
.input-lg { font-size: 22px; font-weight: 700; padding: 12px 16px; text-align: right; }

/* Tarjetas, badges */
.card { background: var(--surface); border-radius: var(--r); box-shadow: var(--sh); padding: 16px; }
.badge { display: inline-flex; align-items: center; gap: 5px; padding: 3px 9px; border-radius: 999px; font-size: 12px; font-weight: 700; line-height: 1.3; }
.badge-ok { background: var(--ok-soft); color: var(--ok-text); } .badge-warn { background: var(--warn-soft); color: var(--warn-text); }
.badge-danger { background: var(--danger-soft); color: var(--danger-text); } .badge-info { background: var(--info-soft); color: var(--info-text); }
.badge-muted { background: var(--surface-2); color: var(--muted); } .badge-accent { background: var(--accent-soft); color: var(--accent-2); }
.badge-purple { background: var(--purple-soft); color: var(--purple-text); }
.dot { width: 9px; height: 9px; border-radius: 50%; display: inline-block; }
.cat-img { width: 26px; height: 26px; border-radius: 50%; object-fit: cover; margin: -4px 0 -4px -6px; flex: none; }

/* Barra superior */
.topbar { height: 60px; background: var(--surface); border-bottom: 1px solid var(--line); display: flex; align-items: center; gap: 14px; padding: 0 16px; position: sticky; top: 0; z-index: 20; }
.brand { display: flex; align-items: center; gap: 10px; font-weight: 800; font-size: 17px; letter-spacing: -.02em; }
.brand .logo { width: 34px; height: 34px; border-radius: 9px; background: #fff; padding: 3px; display: grid; place-items: center; flex: none; box-shadow: 0 4px 10px -3px rgba(0,0,0,.18); }
.brand .logo img { width: 100%; height: 100%; object-fit: contain; display: block; }
.brand small { color: var(--muted); font-weight: 500; font-size: 13px; }
.user-chip { display: flex; align-items: center; gap: 8px; padding: 6px 10px 6px 6px; border-radius: 999px; background: var(--surface-2); border: 1px solid var(--line); font-size: 13px; font-weight: 600; }
.avatar { width: 28px; height: 28px; border-radius: 50%; background: var(--slate-soft); color: var(--slate); display: grid; place-items: center; font-weight: 800; font-size: 12px; overflow: hidden; }
.avatar img { width: 100%; height: 100%; object-fit: contain; display: block; }
/* v1.14.30 (mismo arreglo que Rovanta, pedido del dueño): con el logo del negocio dentro no se le agrega
   ningún fondo de color */
.avatar:has(img) { background: none; }
.tabs { display: flex; gap: 4px; background: var(--surface-2); padding: 4px; border-radius: 999px; border: 1px solid var(--line); }
.tabs button { padding: 7px 14px; border-radius: 999px; font-weight: 600; font-size: 14px; color: var(--muted); }
.tabs button.active { background: var(--surface); color: var(--text); box-shadow: var(--sh); }

/* Barra lateral (caja y administración) */
.layout { display: flex; min-height: 100vh; }
.sidenav { width: 232px; flex: 0 0 232px; height: 100vh; position: sticky; top: 0; background: var(--side-bg); color: var(--side-txt); border-right: 1px solid var(--side-line); display: flex; flex-direction: column; padding: 14px 12px; gap: 6px; z-index: 20; overflow-y: auto; overflow-x: hidden; }
.sidenav .brand { padding: 4px 8px 12px; color: var(--side-txt); }
.sidenav .brand small { display: block; font-size: 12px; margin-top: -2px; color: var(--side-muted); }
.sidenav .brand .logo { background: #fff; }
.sidenav .brand .txt { display: flex; flex-direction: column; line-height: 1.15; min-width: 0; }
.sidenav .brand .txt span, .sidenav .brand .txt small { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.sidenav .sec { font-size: 11px; font-weight: 700; text-transform: uppercase; letter-spacing: .08em; color: var(--side-muted); opacity: .8; padding: 12px 10px 4px; }
.sidenav .nav { display: flex; flex-direction: column; gap: 2px; background: none; border: 0; padding: 0; border-radius: 0; }
.sidenav .nav button, .sidenav .nav a { display: flex; align-items: center; gap: 11px; width: 100%; padding: 10px 12px; border-radius: var(--r-sm); font-weight: 600; font-size: 14px; color: var(--side-muted); text-align: left; transition: background .12s, color .12s; box-shadow: none; }
.sidenav .nav button:hover, .sidenav .nav a:hover { background: var(--side-hover); color: var(--side-txt); }
.sidenav .nav button.active { background: var(--accent); color: #fff; box-shadow: 0 6px 16px -6px rgba(243,107,33,.7); }
.sidenav .nav .ico { width: 22px; font-size: 17px; text-align: center; flex: 0 0 22px; }
.sidenav .nav .lbl { flex: 1; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.sidenav .nav .ext { font-size: 12px; color: var(--side-muted); opacity: .7; }
.sidenav .foot { margin-top: auto; padding-top: 12px; border-top: 1px solid var(--side-line); display: flex; flex-direction: column; gap: 8px; }
.sidenav .foot .badge { justify-content: center; white-space: normal; text-align: center; }
.sidenav .btn-turno { width: 100%; justify-content: center; gap: 8px; min-height: 44px; font-size: 14px; }
.sidenav .btn-turno .ico { font-size: 16px; }
.sidenav .btn-ghost { color: var(--side-muted); }
.sidenav .btn-ghost:hover { background: var(--side-hover); color: var(--side-txt); }
.sidenav .me { display: flex; align-items: center; gap: 10px; padding: 8px 10px; border-radius: var(--r-sm); background: var(--side-item); border: 1px solid var(--side-line); }
.sidenav .me .avatar { width: 34px; height: 34px; font-size: 13px; flex: 0 0 34px; background: var(--accent); color: #fff; }
.sidenav .me .who { flex: 1; min-width: 0; display: flex; flex-direction: column; line-height: 1.2; }
.sidenav .me .who b { font-size: 13px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.sidenav .me .who span { font-size: 11px; color: var(--side-muted); }
.sidenav .conn { background: rgba(255,255,255,.35); } .sidenav .conn.on { background: #34D399; box-shadow: 0 0 0 3px rgba(52,211,153,.25); }
.content { flex: 1; min-width: 0; display: flex; flex-direction: column; min-height: 0; }
/* Pantallas angostas: solo iconos */
@media (max-width: 900px) {
  .sidenav { width: 68px; flex-basis: 68px; padding: 12px 8px; }
  .sidenav .brand { justify-content: center; padding: 4px 0 10px; } .sidenav .brand .txt, .sidenav .sec, .sidenav .nav .lbl, .sidenav .nav .ext, .sidenav .me .who, .sidenav .foot .badge { display: none; }
  .sidenav .nav button, .sidenav .nav a { justify-content: center; padding: 12px 0; } .sidenav .nav .ico { font-size: 20px; }
  .sidenav .me { justify-content: center; padding: 6px; } .sidenav .foot .btn .lbl { display: none; }
}

/* Modal */
.modal-bg { position: fixed; inset: 0; background: rgba(8,10,14,.55); backdrop-filter: blur(3px); display: flex; align-items: center; justify-content: center; z-index: 100; padding: 16px; animation: fade .15s; }
.modal { background: var(--surface); border-radius: 20px; box-shadow: var(--sh-lg); width: 100%; max-width: 480px; max-height: calc(100vh - 32px); overflow: auto; animation: pop .18s; }
.modal-lg { max-width: 760px; }
.modal-h { display: flex; align-items: center; justify-content: space-between; padding: 18px 22px 8px; }
.modal-h h2 { font-size: 20px; }
.modal-b { padding: 8px 22px 18px; display: flex; flex-direction: column; gap: 14px; }
.modal-f { display: flex; gap: 10px; padding: 12px 22px 20px; justify-content: flex-end; }
@keyframes fade { from { opacity: 0 } } @keyframes pop { from { transform: scale(.96) translateY(6px); opacity: 0 } }

/* Toast */
#toasts { position: fixed; bottom: 20px; left: 50%; transform: translateX(-50%); display: flex; flex-direction: column; gap: 8px; z-index: 200; pointer-events: none; }
.toast { background: var(--toast); color: #fff; padding: 12px 18px; border-radius: 12px; font-weight: 600; font-size: 14px; box-shadow: var(--sh-lg); animation: up .2s; max-width: 90vw; }
.toast.ok { background: var(--ok); } .toast.err { background: var(--danger); }
@keyframes up { from { transform: translateY(12px); opacity: 0 } }

/* Aviso arriba a la derecha (pedido del usuario): para confirmaciones que importa que no se pasen de noche,
   como que el correo de la factura sí se mandó — dura más que el toast normal y hay que cerrarlo a mano o
   esperar a que se apague solo. */
#avisos-tr { position: fixed; top: 16px; right: 16px; z-index: 300; display: flex; flex-direction: column; gap: 10px; max-width: 360px; pointer-events: none; }
.aviso-tr { pointer-events: auto; background: var(--surface); border: 1.5px solid var(--line); border-radius: 14px; box-shadow: var(--sh-lg); padding: 12px 14px; animation: up .2s; }
.aviso-tr.ok { border-color: var(--ok); } .aviso-tr.err { border-color: var(--danger); }
.aviso-tr-h { display: flex; justify-content: space-between; align-items: center; gap: 10px; font-size: 14px; font-weight: 700; }
.aviso-tr.ok .aviso-tr-h { color: var(--ok); } .aviso-tr.err .aviso-tr-h { color: var(--danger); }
.aviso-tr-x { background: none; border: 0; cursor: pointer; font-size: 14px; color: var(--muted); padding: 2px 4px; line-height: 1; }
.aviso-tr-m { font-size: 13px; color: var(--muted); margin-top: 4px; line-height: 1.4; }

/* Teclado numérico */
.numpad { display: grid; grid-template-columns: repeat(3, 1fr); gap: 10px; }
.numpad button { height: 62px; border-radius: var(--r); background: var(--surface-2); border: 1px solid var(--line); font-size: 24px; font-weight: 700; transition: background .1s, transform .06s; }
.numpad button:active { transform: scale(.95); background: var(--accent-soft); }

/* Tablas */
table.tbl { width: 100%; border-collapse: collapse; }
.tbl th { text-align: left; font-size: 12px; text-transform: uppercase; letter-spacing: .04em; color: var(--muted); padding: 8px 10px; border-bottom: 1px solid var(--line); }
.tbl td { padding: 10px; border-bottom: 1px solid var(--line); vertical-align: middle; }
.tbl tr:last-child td { border-bottom: 0; }
.tbl .r { text-align: right; }

/* Estado de conexión */
.conn { width: 8px; height: 8px; border-radius: 50%; background: var(--faint); }
.conn.on { background: var(--ok); box-shadow: 0 0 0 3px var(--ok-soft); }
.conn.off { background: var(--danger); animation: blink 1s infinite; }
@keyframes blink { 50% { opacity: .3 } }

/* Reordenar arrastrando (SE.sortable) */
.dragging { opacity: .3; }
.drag-ghost { border-radius: var(--r); }
[data-sortable] > * { cursor: grab; }

/* Empty */
.empty { text-align: center; color: var(--muted); padding: 40px 16px; }
.empty .ico { font-size: 40px; margin-bottom: 8px; } .empty .ico svg { width: 48px; height: 48px; display: block; margin: 0 auto; opacity: .75; }

::-webkit-scrollbar { width: 8px; height: 8px; } ::-webkit-scrollbar-thumb { background: var(--scroll); border-radius: 8px; }

/* Guarniciones: se eligen con un toque al agregar el producto */
.guarn-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: 8px; }
.guarn { min-height: 56px; border: 2px solid var(--line); border-radius: var(--r-sm); background: var(--surface); font: inherit; font-weight: 700; color: var(--text); display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 2px; padding: 6px 8px; cursor: pointer; }
.guarn small { font-weight: 600; color: var(--muted); font-size: 12px; }
.guarn.on { border-color: var(--accent); background: var(--accent-soft); color: var(--accent-2); }
.guarn.on small { color: inherit; }
.item-guarn { font-size: 12px; color: var(--accent-2); font-weight: 600; }
/* Existencias en las tarjetas de producto (productos con inventario) */
.prod .stock { position: absolute; top: 6px; right: 6px; font-size: 11px; font-weight: 800; padding: 2px 7px; border-radius: 999px; background: var(--ok-soft, #DCFCE7); color: var(--ok-text, #166534); }
.prod .stock.bajo { background: var(--warn-soft); color: var(--warn-text); } .prod .stock.cero { background: var(--danger-soft); color: var(--danger-text); }
.prod.agotado { opacity: .55; }
.prod .guarn-tag { position: absolute; bottom: 6px; right: 8px; font-size: 11px; opacity: .7; }
/* Fuera de su horario (ej. desayunos a las 4 de la tarde): se ve en gris, pero en caja y meseros sí se puede vender */
.prod.fuera { opacity: .55; }
.prod .horario { position: absolute; bottom: 6px; left: 8px; font-size: 10px; font-weight: 800; padding: 2px 6px; border-radius: 999px; background: var(--info-soft); color: var(--info-text); }

/* v1.14: grupos de opciones (Sabores, Toppings…) */
.opg { margin-bottom: 14px; }
.opg-h { display: flex; align-items: baseline; gap: 10px; flex-wrap: wrap; margin-bottom: 8px; }
.opg-h b { font-size: 17px; } .opg-h small { color: var(--muted); font-size: 13px; }
.opg-g { display: grid; grid-template-columns: repeat(auto-fill, minmax(140px, 1fr)); gap: 8px; }
.opc { position: relative; min-height: 58px; padding: 10px 12px; border-radius: 12px; border: 1.5px solid var(--line); background: var(--surface); display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 2px; font-weight: 700; text-align: center; box-shadow: inset 0 -3px 0 var(--line); transition: transform .06s; }
.opc:active { transform: scale(.97); }
.opc small { font-weight: 600; color: var(--muted); font-size: 12px; }
.opc.on { border-color: var(--accent); background: var(--accent-soft); box-shadow: inset 0 -3px 0 var(--accent); }
.opc .opc-ck { position: absolute; top: 6px; left: 6px; min-width: 20px; height: 20px; border-radius: 6px; background: var(--accent); color: #fff; font-style: normal; font-size: 12px; display: grid; place-items: center; padding: 0 4px; }
.opc .opc-menos { position: absolute; top: 4px; right: 4px; width: 26px; height: 26px; border-radius: 8px; background: var(--surface-2); display: grid; place-items: center; font-weight: 900; }
.opg-aviso { margin-top: 6px; padding: 10px 12px; border-radius: 10px; border: 1px solid var(--warn); color: var(--warn-text); background: var(--warn-soft); font-weight: 600; }

/* v1.14: iconos SVG del menú lateral */
.ico svg { width: 20px; height: 20px; display: block; margin: auto; }
.sidenav .nav .ico { display: grid; place-items: center; }
.sidenav .nav button:not(.active) .ico svg, .sidenav .nav a .ico svg { opacity: .85; }
.sidenav .nav button:hover .ico svg, .sidenav .nav a:hover .ico svg { opacity: 1; }
.sidenav .btn .ico svg { width: 17px; height: 17px; }
@media (max-width: 900px) { .sidenav .nav .ico svg { width: 22px; height: 22px; } }

/* Plan de la licencia (core.js boot): funciones fuera del plan */
.sin-cocina [data-f="cocina"], .sin-qr [data-f="qr"], .sin-mesero [data-f="mesero"] { display: none !important; }

/* Tutorial de destello (SE.destacar) */
#se-spot-ov { position: fixed; inset: 0; z-index: 500; pointer-events: none; animation: fade .25s; }
.se-spot-bub { position: fixed; z-index: 501; transform: translateX(-50%); background: var(--text); color: var(--bg); font-weight: 700; font-size: 14px; padding: 9px 14px; border-radius: 12px; box-shadow: var(--sh-lg); pointer-events: none; animation: fade .25s; max-width: 260px; text-align: center; }
.se-spot-btn { position: relative; z-index: 502; animation: se-spot-pulso 1s ease-in-out infinite; }
@keyframes se-spot-pulso { 0%, 100% { box-shadow: 0 0 0 0 rgba(255,255,255,.75); transform: scale(1); } 50% { box-shadow: 0 0 0 9px rgba(255,255,255,0); transform: scale(1.1); } }
/* Caja cerrada: "Abrir turno" late solo para que sea obvio dónde empezar */
#btn-turno.pulso { animation: se-spot-pulso 1s ease-in-out infinite; }
