/* ============================================================
   Victorix · styles.css
   Dirección: "cockpit de comanda / parrilla" — cálido, vivo.
   Acentos de fuego y maíz tomados del logo de Areppitas.
   Firma visual: tarjetas de pedido como tiquetes de cocina.
   ============================================================ */

:root {
  --bg: #15100c;
  --bg-2: #1d1711;
  --bg-3: #271f17;
  --bg-hover: #312719;
  --line: rgba(245, 226, 198, 0.10);
  --line-2: rgba(245, 226, 198, 0.18);
  --text: #f4ecdd;
  --text-2: #b6a892;
  --text-3: #8a7d6c;
  --fire: #f5a524;     /* maíz / amber */
  --fire-soft: rgba(245, 165, 36, 0.14);
  --ember: #ec5a2c;    /* fuego / coral */
  --ember-soft: rgba(236, 90, 44, 0.14);
  --tomato: #cf4127;
  --guac: #8bbb4e;     /* positivo */
  --guac-soft: rgba(139, 187, 78, 0.15);
  --info: #5aa9e6;
  --warn: #e6b450;
  --paper: #f1e7d2;
  --paper-ink: #2a2016;
  --paper-line: rgba(42, 32, 22, 0.16);
  --radius: 14px;
  --radius-sm: 9px;
  --radius-lg: 20px;
  --shadow: 0 1px 0 rgba(245, 226, 198, 0.04), 0 12px 32px -18px rgba(0, 0, 0, 0.7);
  --font-display: "Bricolage Grotesque", "Inter", system-ui, sans-serif;
  --font: "Inter", system-ui, -apple-system, sans-serif;
  --font-mono: "JetBrains Mono", "SFMono-Regular", ui-monospace, monospace;
}

[data-theme="light"] {
  --bg: #f7f1e7;
  --bg-2: #fffdf9;
  --bg-3: #ffffff;
  --bg-hover: #f1e9da;
  --line: rgba(46, 34, 20, 0.10);
  --line-2: rgba(46, 34, 20, 0.18);
  --text: #241a11;
  --text-2: #6c5d4b;
  --text-3: #9a8b76;
  --fire-soft: rgba(245, 165, 36, 0.18);
  --ember-soft: rgba(236, 90, 44, 0.14);
  --guac-soft: rgba(139, 187, 78, 0.20);
  --paper: #fffaf0;
  --paper-ink: #2a2016;
  --paper-line: rgba(42, 32, 22, 0.14);
  --shadow: 0 1px 2px rgba(46, 34, 20, 0.05), 0 14px 30px -20px rgba(46, 34, 20, 0.35);
}

* { box-sizing: border-box; margin: 0; padding: 0; }
:focus-visible { outline: 2px solid var(--fire); outline-offset: 2px; border-radius: 4px; }
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: .001ms !important; transition-duration: .001ms !important; }
}
html, body { height: 100%; }
body {
  font-family: var(--font);
  background: var(--bg);
  color: var(--text);
  font-size: 14px;
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
  overflow: hidden;
}
button { font-family: inherit; cursor: pointer; color: inherit; }
::-webkit-scrollbar { width: 10px; height: 10px; }
::-webkit-scrollbar-thumb { background: var(--line-2); border-radius: 20px; border: 3px solid transparent; background-clip: padding-box; }
::selection { background: var(--ember); color: #fff; }

/* ---------- Layout shell ---------- */
.app { display: grid; grid-template-columns: 244px 1fr; height: 100vh; }

.sidebar {
  background: var(--bg-2);
  border-right: 1px solid var(--line);
  display: flex; flex-direction: column;
  padding: 18px 14px;
  gap: 4px;
  overflow-y: auto;
}
.brand { display: flex; align-items: center; gap: 11px; padding: 6px 8px 16px; }
.brand-mark {
  width: 34px; height: 34px; border-radius: 10px; flex: none;
  background: linear-gradient(145deg, var(--fire), var(--ember));
  display: grid; place-items: center; color: #2a1606; font-size: 19px;
  box-shadow: 0 4px 14px -6px var(--ember);
}
.brand-name { font-family: var(--font-display); font-weight: 800; font-size: 17px; letter-spacing: -0.02em; line-height: 1; }
.brand-sub { font-size: 11px; color: var(--text-3); letter-spacing: 0.04em; margin-top: 2px; }

.tenant {
  display: flex; align-items: center; gap: 10px;
  background: var(--bg-3); border: 1px solid var(--line);
  border-radius: var(--radius-sm); padding: 9px 10px; margin: 2px 4px 14px; cursor: pointer;
  transition: border-color .15s;
}
.tenant:hover { border-color: var(--line-2); }
.tenant-logo { width: 30px; height: 30px; border-radius: 8px; object-fit: cover; flex: none; background: var(--bg-hover); }
.tenant-meta { min-width: 0; flex: 1; }
.tenant-name { font-weight: 600; font-size: 13px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.tenant-status { font-size: 11px; color: var(--guac); display: flex; align-items: center; gap: 5px; }
.dot { width: 6px; height: 6px; border-radius: 50%; background: var(--guac); box-shadow: 0 0 0 3px var(--guac-soft); }

.nav-label { font-size: 10px; text-transform: uppercase; letter-spacing: 0.12em; color: var(--text-3); padding: 12px 10px 6px; }
.nav-item {
  display: flex; align-items: center; gap: 11px;
  padding: 9px 11px; border-radius: var(--radius-sm);
  color: var(--text-2); font-size: 13.5px; font-weight: 500;
  border: 1px solid transparent; width: 100%; text-align: left; background: none;
  transition: background .14s, color .14s;
}
.nav-item .ti { font-size: 19px; }
.nav-item:hover { background: var(--bg-3); color: var(--text); }
.nav-item.active { background: var(--fire-soft); color: var(--fire); border-color: rgba(245,165,36,.22); }
.nav-item .badge { margin-left: auto; background: var(--ember); color: #fff; font-size: 11px; font-weight: 600; min-width: 19px; height: 19px; border-radius: 10px; display: grid; place-items: center; padding: 0 5px; }
.sidebar-foot { margin-top: auto; padding-top: 12px; border-top: 1px solid var(--line); }

/* ---------- Main ---------- */
.main { display: flex; flex-direction: column; min-width: 0; overflow: hidden; }
.topbar {
  height: 62px; flex: none; border-bottom: 1px solid var(--line);
  display: flex; align-items: center; gap: 16px; padding: 0 24px; background: var(--bg);
}
.topbar h1 { font-family: var(--font-display); font-size: 19px; font-weight: 700; letter-spacing: -0.02em; }
.topbar .crumb { color: var(--text-3); font-size: 13px; }
.spacer { flex: 1; }

/* Simulación control */
.sim-ctl { display: flex; align-items: center; gap: 8px; background: var(--bg-2); border: 1px solid var(--line); border-radius: 999px; padding: 4px 5px 4px 12px; }
.sim-clock { font-family: var(--font-mono); font-size: 13px; color: var(--text); letter-spacing: 0.02em; min-width: 86px; }
.sim-clock .day { color: var(--text-3); font-size: 11px; }
.btn-icon { width: 32px; height: 32px; border-radius: 50%; border: 1px solid var(--line-2); background: var(--bg-3); display: grid; place-items: center; font-size: 16px; transition: .14s; }
.btn-icon:hover { background: var(--bg-hover); border-color: var(--line-2); }
.btn-play { background: linear-gradient(145deg, var(--fire), var(--ember)); border: none; color: #2a1606; }
.btn-play:hover { filter: brightness(1.06); }
.speed { display: flex; background: var(--bg-3); border-radius: 8px; padding: 2px; gap: 2px; }
.speed button { font-size: 11.5px; font-weight: 600; padding: 4px 8px; border-radius: 6px; border: none; background: none; color: var(--text-3); }
.speed button.on { background: var(--fire-soft); color: var(--fire); }

.btn {
  display: inline-flex; align-items: center; gap: 8px; font-size: 13px; font-weight: 600;
  padding: 9px 15px; border-radius: var(--radius-sm); border: 1px solid var(--line-2);
  background: var(--bg-3); transition: .14s;
}
.btn:hover { background: var(--bg-hover); }
.btn-primary { background: linear-gradient(145deg, var(--fire), var(--ember)); border: none; color: #2a1606; }
.btn-primary:hover { filter: brightness(1.06); }
.btn .ti { font-size: 17px; }

.content { flex: 1; overflow-y: auto; padding: 24px; }
.view { display: none; }
.view.active { display: block; animation: fade .25s ease; }
@keyframes fade { from { opacity: 0; transform: translateY(4px); } to { opacity: 1; transform: none; } }

/* ---------- KPIs ---------- */
.kpi-row { display: grid; grid-template-columns: repeat(4, 1fr); gap: 14px; margin-bottom: 22px; }
.kpi { background: var(--bg-2); border: 1px solid var(--line); border-radius: var(--radius); padding: 16px 18px; position: relative; overflow: hidden; }
.kpi-label { font-size: 12px; color: var(--text-2); display: flex; align-items: center; gap: 7px; }
.kpi-label .ti { font-size: 15px; color: var(--text-3); }
.kpi-val { font-family: var(--font-display); font-size: 28px; font-weight: 700; letter-spacing: -0.02em; margin-top: 8px; }
.kpi-delta { font-size: 11.5px; margin-top: 4px; display: flex; align-items: center; gap: 4px; }
.up { color: var(--guac); } .down { color: var(--tomato); }

.panel { background: var(--bg-2); border: 1px solid var(--line); border-radius: var(--radius); }
.panel-head { display: flex; align-items: center; gap: 10px; padding: 15px 18px; border-bottom: 1px solid var(--line); }
.panel-head h2 { font-family: var(--font-display); font-size: 15px; font-weight: 700; }
.panel-head .sub { font-size: 12px; color: var(--text-3); }
.section-title { font-family: var(--font-display); font-size: 14px; font-weight: 700; color: var(--text-2); text-transform: uppercase; letter-spacing: 0.06em; margin: 4px 0 14px; }

/* ---------- Kanban de comandas ---------- */
.board { display: grid; grid-template-columns: repeat(4, 1fr); gap: 14px; align-items: start; }
.col { background: var(--bg-2); border: 1px solid var(--line); border-radius: var(--radius); display: flex; flex-direction: column; min-height: 120px; }
.col-head { display: flex; align-items: center; gap: 8px; padding: 12px 14px; border-bottom: 1px solid var(--line); position: sticky; top: 0; }
.col-head .ti { font-size: 16px; }
.col-head .name { font-weight: 600; font-size: 13px; }
.col-head .count { margin-left: auto; font-family: var(--font-mono); font-size: 12px; color: var(--text-3); background: var(--bg-3); padding: 1px 8px; border-radius: 10px; }
.col-body { padding: 10px; display: flex; flex-direction: column; gap: 10px; }
.col.nuevo .col-head .ti { color: var(--ember); }
.col.preparando .col-head .ti { color: var(--fire); }
.col.camino .col-head .ti { color: var(--info); }
.col.entregado .col-head .ti { color: var(--guac); }

/* Tiquete de cocina (firma visual) */
.ticket {
  background: var(--paper); color: var(--paper-ink); border-radius: 4px;
  padding: 12px 13px 13px; position: relative; font-family: var(--font-mono);
  box-shadow: 0 2px 8px -3px rgba(0,0,0,.35); animation: drop .3s ease;
}
.ticket::before {
  content: ""; position: absolute; left: 0; right: 0; top: -5px; height: 6px;
  background-image: radial-gradient(circle at 5px 0, transparent 4px, var(--paper) 4px);
  background-size: 11px 6px; background-position: -2px 0;
}
@keyframes drop { from { opacity: 0; transform: translateY(-8px) scale(.98); } to { opacity: 1; transform: none; } }
.ticket-top { display: flex; justify-content: space-between; align-items: baseline; margin-bottom: 7px; }
.ticket-id { font-weight: 700; font-size: 12px; }
.ticket-time { font-size: 11px; opacity: .6; }
.ticket-cust { font-family: var(--font); font-weight: 600; font-size: 13px; margin-bottom: 2px; }
.ticket-addr { font-family: var(--font); font-size: 11px; opacity: .7; margin-bottom: 8px; line-height: 1.35; }
.ticket-items { font-size: 11.5px; line-height: 1.7; border-top: 1px dashed var(--paper-line); border-bottom: 1px dashed var(--paper-line); padding: 7px 0; margin-bottom: 8px; }
.ticket-foot { display: flex; justify-content: space-between; align-items: center; }
.ticket-total { font-weight: 700; font-size: 14px; }
.ticket-pago { font-family: var(--font); font-size: 10.5px; background: var(--paper-line); padding: 2px 7px; border-radius: 5px; }
.ticket-adv { width: 100%; margin-top: 9px; border: none; border-radius: 5px; padding: 7px; font-family: var(--font); font-weight: 600; font-size: 12px; background: var(--paper-ink); color: var(--paper); transition: .14s; }
.ticket-adv:hover { filter: brightness(1.25); }
.ticket-tag { font-family: var(--font); font-size: 10px; color: var(--text-3); }
.empty-col { color: var(--text-3); font-size: 12px; text-align: center; padding: 22px 8px; }

/* ---------- WhatsApp ---------- */
.wa-wrap { display: grid; grid-template-columns: 380px 1fr; gap: 20px; align-items: start; }
.phone { background: #0b141a; border-radius: 30px; padding: 12px; border: 1px solid var(--line-2); box-shadow: var(--shadow); }
.wa-head { background: #1f2c33; border-radius: 22px 22px 0 0; padding: 12px 14px; display: flex; align-items: center; gap: 11px; }
.wa-av { width: 38px; height: 38px; border-radius: 50%; object-fit: cover; background: #2a3942; }
.wa-name { color: #e9edef; font-weight: 600; font-size: 14px; }
.wa-on { color: #8fa6b2; font-size: 11px; }
.wa-body {
  background: #0b141a;
  background-image: linear-gradient(rgba(11,20,26,.95), rgba(11,20,26,.95));
  height: 440px; overflow-y: auto; padding: 14px 12px; display: flex; flex-direction: column; gap: 7px;
}
.bubble { max-width: 80%; padding: 7px 10px 8px; border-radius: 9px; font-size: 13px; line-height: 1.42; white-space: pre-wrap; word-wrap: break-word; position: relative; animation: pop .2s ease; }
@keyframes pop { from { opacity: 0; transform: translateY(4px); } to { opacity: 1; } }
.bubble.in { background: #202c33; color: #e9edef; align-self: flex-start; border-top-left-radius: 3px; }
.bubble.out { background: #005c4b; color: #e9edef; align-self: flex-end; border-top-right-radius: 3px; }
.bubble .bt { display: block; font-size: 10px; opacity: .55; text-align: right; margin-top: 3px; }
.bubble strong { font-weight: 700; }
.typing { align-self: flex-start; background: #202c33; padding: 10px 13px; border-radius: 9px; display: flex; gap: 4px; }
.typing span { width: 6px; height: 6px; border-radius: 50%; background: #8fa6b2; animation: blink 1.2s infinite; }
.typing span:nth-child(2){ animation-delay:.2s } .typing span:nth-child(3){ animation-delay:.4s }
@keyframes blink { 0%,60%,100%{opacity:.3} 30%{opacity:1} }
.wa-input { background: #1f2c33; border-radius: 0 0 22px 22px; padding: 9px 11px; display: flex; gap: 8px; align-items: center; }
.wa-input input { flex: 1; background: #2a3942; border: none; border-radius: 18px; padding: 9px 14px; color: #e9edef; font-size: 13px; font-family: var(--font); outline: none; }
.wa-input input::placeholder { color: #8696a0; }
.wa-send { width: 38px; height: 38px; border-radius: 50%; border: none; background: #00a884; color: #fff; display: grid; place-items: center; font-size: 18px; flex: none; }

.wa-side .chip { display: inline-flex; align-items: center; gap: 6px; font-size: 12px; background: var(--bg-3); border: 1px solid var(--line); border-radius: 999px; padding: 6px 11px; margin: 0 6px 8px 0; transition: .14s; }
.wa-side .chip:hover { border-color: var(--fire); color: var(--fire); }
.info-card { background: var(--bg-2); border: 1px solid var(--line); border-radius: var(--radius); padding: 16px 18px; margin-bottom: 14px; }
.info-card h3 { font-family: var(--font-display); font-size: 14px; font-weight: 700; margin-bottom: 4px; display: flex; align-items: center; gap: 8px; }
.info-card h3 .ti { color: var(--fire); }
.info-card p { font-size: 12.5px; color: var(--text-2); line-height: 1.6; }

/* ---------- Inteligencia / charts ---------- */
.grid-2 { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; }
.bars { display: flex; flex-direction: column; gap: 9px; padding: 16px 18px; }
.bar-row { display: grid; grid-template-columns: 120px 1fr 54px; align-items: center; gap: 10px; font-size: 12.5px; }
.bar-row .nm { color: var(--text-2); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.bar-track { height: 9px; background: var(--bg-3); border-radius: 6px; overflow: hidden; }
.bar-fill { height: 100%; background: linear-gradient(90deg, var(--fire), var(--ember)); border-radius: 6px; transition: width .5s ease; }
.bar-val { font-family: var(--font-mono); font-size: 12px; text-align: right; color: var(--text); }

.hours { display: flex; align-items: flex-end; gap: 5px; height: 150px; padding: 16px 18px 10px; }
.hbar { flex: 1; display: flex; flex-direction: column; align-items: center; gap: 6px; height: 100%; justify-content: flex-end; }
.hbar .b { width: 100%; max-width: 26px; background: var(--fire-soft); border-radius: 5px 5px 0 0; transition: height .5s ease; min-height: 3px; position: relative; }
.hbar.peak .b { background: linear-gradient(180deg, var(--ember), var(--fire)); }
.hbar .hl { font-size: 10px; color: var(--text-3); font-family: var(--font-mono); }

.insights { display: flex; flex-direction: column; gap: 10px; }
.insight { display: flex; gap: 12px; padding: 14px 16px; background: var(--bg-2); border: 1px solid var(--line); border-left: 3px solid var(--fire); border-radius: var(--radius); }
.insight .ic { width: 34px; height: 34px; border-radius: 9px; background: var(--fire-soft); color: var(--fire); display: grid; place-items: center; font-size: 18px; flex: none; }
.insight.green { border-left-color: var(--guac); } .insight.green .ic { background: var(--guac-soft); color: var(--guac); }
.insight.warn { border-left-color: var(--warn); } .insight.warn .ic { background: rgba(230,180,80,.15); color: var(--warn); }
.insight h4 { font-size: 13.5px; font-weight: 600; margin-bottom: 2px; }
.insight p { font-size: 12.5px; color: var(--text-2); line-height: 1.5; }

/* ---------- Tablas / clientes ---------- */
table.tbl { width: 100%; border-collapse: collapse; font-size: 13px; }
.tbl th { text-align: left; font-size: 11px; text-transform: uppercase; letter-spacing: 0.06em; color: var(--text-3); font-weight: 600; padding: 11px 18px; border-bottom: 1px solid var(--line); }
.tbl td { padding: 12px 18px; border-bottom: 1px solid var(--line); }
.tbl tr:last-child td { border-bottom: none; }
.tbl tr:hover td { background: var(--bg-3); }
.avatar { width: 30px; height: 30px; border-radius: 50%; background: var(--fire-soft); color: var(--fire); display: inline-grid; place-items: center; font-size: 12px; font-weight: 600; margin-right: 9px; vertical-align: middle; }
.tag { font-size: 11px; font-weight: 600; padding: 3px 9px; border-radius: 999px; display: inline-flex; align-items: center; gap: 5px; }
.tag.activo { background: var(--guac-soft); color: var(--guac); }
.tag.riesgo { background: rgba(230,180,80,.16); color: var(--warn); }
.tag.dormido { background: var(--ember-soft); color: var(--ember); }
.num { font-family: var(--font-mono); }

/* ---------- Recompra ---------- */
.reco-hero { display: grid; grid-template-columns: 1.3fr 1fr; gap: 16px; margin-bottom: 18px; }
.reco-cta { background: linear-gradient(150deg, var(--bg-2), var(--bg-3)); border: 1px solid var(--line-2); border-radius: var(--radius-lg); padding: 22px; }
.reco-cta h2 { font-family: var(--font-display); font-size: 19px; font-weight: 700; margin-bottom: 6px; }
.reco-cta p { color: var(--text-2); font-size: 13px; line-height: 1.55; margin-bottom: 16px; max-width: 42ch; }

/* ---------- Config ---------- */
.cfg-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; }
.field { margin-bottom: 14px; }
.field label { display: block; font-size: 12px; color: var(--text-2); margin-bottom: 6px; }
.field input, .field select, .field textarea {
  width: 100%; background: var(--bg-3); border: 1px solid var(--line-2); border-radius: var(--radius-sm);
  padding: 10px 12px; color: var(--text); font-family: var(--font); font-size: 13px; outline: none;
}
.field input:focus, .field textarea:focus { border-color: var(--fire); }
.menu-list { display: flex; flex-direction: column; }
.menu-li { display: flex; align-items: center; gap: 12px; padding: 11px 18px; border-bottom: 1px solid var(--line); font-size: 13px; }
.menu-li:last-child { border: none; }
.menu-li .price { margin-left: auto; font-family: var(--font-mono); color: var(--text); }
.menu-li .cat { font-size: 11px; color: var(--text-3); background: var(--bg-3); padding: 2px 8px; border-radius: 6px; }

.toast-wrap { position: fixed; bottom: 22px; right: 22px; display: flex; flex-direction: column; gap: 9px; z-index: 50; }
.toast { background: var(--bg-3); border: 1px solid var(--line-2); border-left: 3px solid var(--guac); border-radius: var(--radius-sm); padding: 11px 15px; font-size: 13px; box-shadow: var(--shadow); animation: slidein .3s ease; max-width: 320px; }
.toast.fire { border-left-color: var(--ember); }
@keyframes slidein { from { opacity: 0; transform: translateX(20px); } to { opacity: 1; } }

.feed { display: flex; flex-direction: column; }
.feed-item { display: flex; gap: 10px; align-items: center; padding: 10px 18px; border-bottom: 1px solid var(--line); font-size: 12.5px; }
.feed-item:last-child { border: none; }
.feed-item .ti { font-size: 16px; color: var(--text-3); }
.feed-item .ft { margin-left: auto; font-family: var(--font-mono); font-size: 11px; color: var(--text-3); }

.muted { color: var(--text-3); }
.hl-fire { color: var(--fire); } .hl-ember { color: var(--ember); } .hl-guac { color: var(--guac); }

@media (max-width: 1080px) {
  .app { grid-template-columns: 70px 1fr; }
  .brand-name, .brand-sub, .tenant-meta, .nav-item span:not(.badge), .nav-label { display: none; }
  .nav-item { justify-content: center; }
  .kpi-row, .board { grid-template-columns: repeat(2, 1fr); }
  .wa-wrap, .grid-2, .reco-hero, .cfg-grid { grid-template-columns: 1fr; }
}
