/* KDS Manola — estilos compartidos entre Cocina y Empaque.
   El color de acento se inyecta desde config/business.json al arrancar. */
:root {
  --accent: #C8401A;
  --urgent: #C62828;
  --green:  #2E7D32;
  --bg:     #EBEBEB;
  --card:   #FFFFFF;
  --border: #DEDEDE;
  --sep:    #F2F2F2;
  --text:   #111111;
  --muted:  #888888;
  --drink:  #0277BD;
  --font:   -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
}
* { margin:0; padding:0; box-sizing:border-box }
body { background:var(--bg); color:var(--text); font-family:var(--font); height:100vh; overflow:hidden }

/* ═══ ALERTA DESCONEXIÓN ═══ */
#offlineOverlay {
  display:none; position:fixed; inset:0; background:rgba(0,0,0,.85);
  z-index:9999; flex-direction:column; align-items:center; justify-content:center; gap:18px;
}
#offlineOverlay.show { display:flex }
#offlineOverlay .ov-icon { font-size:56px }
#offlineOverlay .ov-title { font-size:22px; font-weight:800; color:#FFB74D }
#offlineOverlay .ov-sub   { font-size:14px; color:#AAA; text-align:center; max-width:320px; line-height:1.5 }
#offlineOverlay .ov-btn   { margin-top:8px; padding:14px 36px; background:#FFB74D; color:#000; font-size:16px; font-weight:800; border:none; border-radius:12px; cursor:pointer }
#offlineOverlay .ov-count { font-size:12px; color:#666 }

/* ═══ CARRIL ═══ */
.lane {
  position:fixed; top:0; left:0; right:0; bottom:52px;
  display:flex; align-items:flex-start; gap:12px;
  padding:14px 16px; overflow-x:auto; overflow-y:hidden;
}
.lane::-webkit-scrollbar { height:5px }
.lane::-webkit-scrollbar-track { background:transparent }
.lane::-webkit-scrollbar-thumb { background:#CCC; border-radius:3px }
.empty-lane { width:100%; display:flex; align-items:center; justify-content:center; color:var(--muted); font-size:14px; letter-spacing:.3px }

/* ═══ TICKET ═══ */
.ticket {
  width:310px; min-width:310px;
  background:var(--card);
  border:1px solid var(--border);
  border-left:5px solid var(--accent);
  border-radius:10px;
  display:flex; flex-direction:column;
  flex-shrink:0;
  height:calc(100vh - 80px);
  overflow-y:auto;
  box-shadow:0 2px 8px rgba(0,0,0,.09);
}
.ticket::-webkit-scrollbar { display:none }
.ticket.t-yellow { border-left-color:#F9A825 }
.ticket.t-red    { border-left-color:#C62828 }
.ticket.t-blink  { animation:blinkColor 1s ease-in-out infinite }
@keyframes blinkColor {
  0%,100% { border-color:var(--border); box-shadow:0 2px 8px rgba(0,0,0,.09) }
  50%     { border-color:#C62828; box-shadow:0 0 0 3px rgba(198,40,40,.45) }
}

/* Pedido para llevar / delivery: tarjeta gris (mismos tonos que Hot Dog Maracay) */
.ticket.takeout                  { background:#C8C8C8 }
.ticket.takeout .tk-head         { background:#B8B8B8 }
.ticket.takeout .tk-item:active  { background:#B0B0B0 }

/* Drag & drop */
.tk-head { touch-action:none; cursor:grab; user-select:none; position:relative }
.tk-head:active { cursor:grabbing }
.tk-head::after { content:'⠿'; position:absolute; top:6px; right:9px; color:#C2C2C2; font-size:17px; letter-spacing:-3px; pointer-events:none }
.ticket.dragging { opacity:.85; box-shadow:0 12px 30px rgba(0,0,0,.28); transform:scale(1.02); z-index:50; animation:none }

/* Ticket: cabecera */
.tk-head { padding:14px 16px 10px; border-bottom:1px solid var(--sep) }
.tk-name { font-size:22px; font-weight:900; color:var(--text); letter-spacing:-.3px; margin-bottom:4px; line-height:1.1; word-break:break-word }
.tk-num  { font-size:12px; font-weight:700; color:var(--muted); margin-bottom:5px }
.tk-badges-row { margin-top:7px; display:flex; gap:6px; flex-wrap:wrap }
.chan {
  font-size:11px; font-weight:800; text-transform:uppercase; letter-spacing:.4px;
  padding:4px 10px; border-radius:6px; display:inline-flex; align-items:center; gap:5px;
}
.chan-uber    { background:#E5F6E8; color:#137333; border:1px solid #9FD9AA }
.chan-dd      { background:#FDE7EA; color:#C5221F; border:1px solid #F2A7AD }
.chan-grubhub { background:#FFF0E5; color:#B3400F; border:1px solid #F2BE9E }
.chan-online  { background:#FFF6DA; color:#9A6700; border:1px solid #EBCF6B }
.chan-kiosk   { background:#EDE7F6; color:#4527A0; border:1px solid #C5B6E8 }
.chan-takeout { background:#111; color:#FFF; border:1px solid #111 }
.chan-delivery{ background:#E3F2FD; color:#0D47A1; border:1px solid #A6CDF2 }
.chan-mesa    { background:#E8F5E9; color:#1B5E20; border:1px solid #A9D8AC }

/* Ticket: items */
.tk-items { flex:1; padding:6px 0 }
.tk-item {
  padding:10px 16px; cursor:pointer; transition:opacity .2s;
  -webkit-tap-highlight-color:transparent; user-select:none;
}
.tk-item:active { background:#FAFAFA }
.tk-item.done { opacity:.32 }
.tk-item.done .tk-item-name { text-decoration:line-through }
.tk-item.done .tk-mods      { max-height:0; margin-top:0; overflow:hidden }
.tk-item.is-drink { background:#E8F4FB; border-radius:7px; margin:2px 6px }
.tk-item-sep { height:1px; background:var(--sep); margin:2px 0 }
.tk-item-row { display:flex; gap:8px; align-items:flex-start }
.tk-qty {
  background:var(--accent); color:#FFF;
  min-width:28px; height:28px; border-radius:7px;
  display:flex; align-items:center; justify-content:center;
  font-size:20px; line-height:1; font-weight:900; flex-shrink:0;
  box-shadow:0 2px 4px rgba(0,0,0,.22);
}
.tk-item.done .tk-qty { background:#C0C0C0; box-shadow:none }
.tk-item-info { flex:1; min-width:0 }
.tk-item-name { font-size:16px; font-weight:700; color:var(--text); line-height:1.25 }
.tk-item-chk {
  width:20px; height:20px; border-radius:50%;
  border:2px solid var(--border); background:var(--card);
  flex-shrink:0; margin-top:3px; transition:all .15s;
}
.tk-item.done .tk-item-chk { background:var(--green); border-color:var(--green) }

/* Chip de producto: emoji + nombre con color de su categoría */
.ph {
  display:inline-block; padding:5px 11px; border-radius:7px;
  color:#FFF; font-weight:900; font-size:15px; letter-spacing:.3px;
  line-height:1.25; text-transform:uppercase;
}
.tk-item.done .ph { text-decoration:line-through }
.tk-name-plain { font-size:16px; font-weight:800; color:var(--text) }

/* Modificadores */
.tk-mods { margin-top:4px; display:flex; flex-direction:column; gap:3px; max-height:600px; overflow:hidden; transition:max-height .18s ease, margin-top .18s ease }
.tk-mod  { font-size:16px; font-weight:800; line-height:1.25; color:#333 }
.tk-mod.sin    { color:#B71C1C; text-transform:uppercase; letter-spacing:.2px }
.tk-mod.extra  { color:#1B5E20; text-transform:uppercase; letter-spacing:.2px }
.tk-mod.keep   { color:#1B5E20; font-size:15px; text-transform:uppercase; letter-spacing:.2px }
.tk-mod.choice { color:var(--accent); font-size:15px; text-transform:uppercase; letter-spacing:.2px }
.tk-mod.item-note { color:#1a5fc4; font-weight:700; font-size:13px }
.tk-mod.solo {
  display:inline-block; margin-top:2px;
  background:#FFF3E0; color:#B45309;
  font-weight:900; font-size:15px; letter-spacing:.3px;
  padding:5px 11px; border-radius:6px; text-transform:uppercase;
}

/* Bloque de bebidas (empaque) */
.tk-drinks    { margin:4px 12px 2px; padding:8px 11px; background:#E8F4FB; border-radius:8px; border-left:3px solid var(--drink) }
.tk-drinks-hd { font-size:11px; font-weight:900; color:var(--drink); text-transform:uppercase; letter-spacing:.5px; margin-bottom:3px }
.tk-drink-row { font-size:16px; font-weight:800; color:#01579B; line-height:1.3 }

/* Ticket: nota */
.tk-notes { margin:2px 12px 8px; padding:9px 12px; background:#FFFDE7; border-radius:7px; border-left:3px solid #F9A825 }
.tk-notes-txt { font-size:13px; color:#4E342E; line-height:1.5 }

/* Ticket: pie */
.tk-ft { padding:10px 14px; border-top:1px solid var(--sep); margin-top:auto; display:flex; align-items:center; gap:10px }
.tk-ft-timer { display:flex; flex-direction:column; align-items:center; gap:1px; flex-shrink:0 }
.tk-elapsed { font-size:22px; font-weight:200; letter-spacing:2px; font-variant-numeric:tabular-nums; color:var(--muted); line-height:1 }
.tk-elapsed.t-green  { color:#2E7D32; font-weight:500 }
.tk-elapsed.t-yellow { color:#F9A825; font-weight:700 }
.tk-elapsed.t-red    { color:#C62828; font-weight:800 }
.tk-timer-lbl { font-size:9px; color:var(--muted); text-transform:uppercase; letter-spacing:.5px }
.tk-done-btn {
  flex:1; padding:14px;
  background:#111; color:#FFF;
  border:none; border-radius:9px;
  font-size:15px; font-weight:800; letter-spacing:.5px; text-transform:uppercase;
  cursor:pointer; transition:all .15s;
}
.tk-done-btn:hover  { background:#333 }
.tk-done-btn:active { transform:scale(.97) }
.tk-done-btn:disabled { background:#BDBDBD; cursor:default }

/* ═══ BARRA INFERIOR ═══ */
.fab-bar {
  position:fixed; bottom:0; left:0; right:0; height:52px; box-sizing:border-box;
  background:var(--card); border-top:1px solid var(--border);
  display:flex; align-items:center; justify-content:flex-end; flex-wrap:nowrap;
  padding:0 clamp(8px,1.4vw,18px); gap:clamp(6px,1vw,12px); z-index:100;
  box-shadow:0 -1px 4px rgba(0,0,0,.06);
  overflow:hidden; white-space:nowrap;
}
.fab-bar > * { flex:0 0 auto }
.fab-brand { margin-right:auto; font-size:20px; line-height:1; font-weight:800; color:var(--accent); white-space:nowrap }
.fab-clock { font-size:21px; line-height:1; font-weight:300; letter-spacing:1.5px; font-variant-numeric:tabular-nums; color:var(--muted) }
.fab-div   { width:1px; height:34px; background:var(--border) }
.fab-count { display:inline-flex; align-items:center; gap:6px; font-size:15px; line-height:1; color:var(--muted) }
.fab-count .n { font-size:26px; line-height:1; font-weight:800; color:var(--text) }
.fab-count.urg .n { color:var(--urgent) }
.fab-hist  {
  height:calc(100% - 8px); display:inline-flex; align-items:center; justify-content:center;
  background:none; border:1px solid var(--border); color:var(--muted);
  padding:0 16px; border-radius:20px; font-size:16px; line-height:1; cursor:pointer;
  white-space:nowrap; transition:all .2s;
}
.fab-hist:hover { border-color:var(--accent); color:var(--accent) }
.conn-pill { display:inline-flex; align-items:center; gap:8px; height:calc(100% - 8px); padding:0 14px; background:#F5F5F5; border-radius:20px; font-size:15px; line-height:1; color:var(--muted); white-space:nowrap }
.conn-dot  { width:10px; height:10px; border-radius:50%; background:var(--green); animation:blink 2s infinite; flex:0 0 auto }
.conn-dot.off { background:var(--urgent); animation:blink .7s infinite }
@keyframes blink { 0%,100%{opacity:1} 50%{opacity:.3} }

/* Panel de producción (pills por categoría) */
.prod-panel { display:inline-flex; align-items:center; gap:6px; height:100% }
.prod-pill {
  height:calc(100% - 8px); display:inline-flex; align-items:center; justify-content:center; gap:5px;
  padding:0 11px; border-radius:8px; line-height:1;
  background:#F5F5F5; border:1px solid var(--border);
  transition:opacity .25s; white-space:nowrap; cursor:default;
}
.prod-pill.prod-zero { opacity:.18 }
.prod-pill .plbl { font-size:15px; line-height:1 }
.prod-pill .pval { font-size:21px; line-height:1; font-weight:900; color:var(--accent) }

/* ═══ HISTORIAL ═══ */
.hist-panel { position:fixed; inset:0; background:rgba(0,0,0,.55); z-index:200; display:none; align-items:flex-end }
.hist-panel.open { display:flex }
.hist-inner { background:#1A1A1A; width:100%; max-height:55vh; border-top:1px solid #2A2A2A; display:flex; flex-direction:column }
.hist-head  { padding:14px 22px; border-bottom:1px solid #2A2A2A; display:flex; align-items:center; justify-content:space-between }
.hist-head h3 { font-size:14px; font-weight:700; color:#FFB74D }
.hist-close { background:none; border:none; font-size:20px; cursor:pointer; color:#666 }
.hist-list  { overflow-y:auto; flex:1 }
.hist-row   { padding:11px 22px; border-bottom:1px solid #222; display:flex; align-items:center; gap:14px; font-size:12px }
.hist-row-nom  { font-weight:800; color:#FFB74D; min-width:90px; white-space:nowrap; overflow:hidden; text-overflow:ellipsis }
.hist-row-info { flex:1; color:#888; overflow:hidden; text-overflow:ellipsis; white-space:nowrap }
.hist-row-time { font-size:11px; color:#555; white-space:nowrap }
.hist-recover  { background:none; border:1px solid #333; color:#666; padding:4px 12px; border-radius:20px; font-size:11px; cursor:pointer; transition:all .2s; white-space:nowrap }
.hist-recover:hover { border-color:#FFB74D; color:#FFB74D }
.hist-empty { padding:48px; text-align:center; color:#555; font-size:13px }

/* ═══ TOAST ═══ */
.toast { position:fixed; bottom:68px; left:50%; transform:translateX(-50%) translateY(14px); background:#111; color:#FFF; padding:11px 22px; border-radius:10px; font-size:13px; font-weight:700; z-index:500; opacity:0; transition:all .28s; pointer-events:none; white-space:nowrap }
.toast.show { opacity:1; transform:translateX(-50%) translateY(0) }
