/* ==========================================================================
   Soria's Chicken · Plataforma C&C — Rework Visual v2 (Mobile-First Bento)
   ========================================================================== */

:root {
  --bg: #FAF8F5;
  --surface: #FFFFFF;
  --surface-2: #F2EFEA;
  --surface-3: #E7E2D9;
  --fg: #141210;
  --muted: #6C655E;
  --line: #E8E2D9;
  --line-soft: rgba(20, 18, 16, 0.07);

  --accent: #E03E1A;
  --accent-2: #F36B2C;
  --accent-hover: #C43111;
  --accent-soft: #FFF0EB;
  --accent-ring: rgba(224, 62, 26, 0.18);
  --accent-ink: #FFFFFF;

  --gold: #D97706;
  --gold-soft: #FEF3C7;
  --ok: #15803D;
  --ok-soft: #DCFCE7;
  --bad: #DC2626;
  --bad-soft: #FEE2E2;
  --info: #1D4ED8;
  --info-soft: #DBEAFE;
  --pay-bg: #FFFFFF;
  --pay-bd: rgba(20, 18, 16, 0.14);
  --pay-fg: #141210;

  --hero-bg: linear-gradient(135deg, #1E1714 0%, #2C1B15 58%, #471E12 100%);
  --side: #131110;
  --side-elev: #221D1A;
  --side-fg: #F7F4F0;
  --side-muted: #9B938B;

  --f-display: "Bricolage Grotesque", "Plus Jakarta Sans", system-ui, sans-serif;
  --f-body: "Plus Jakarta Sans", system-ui, -apple-system, "Segoe UI", sans-serif;

  --r-xl: 24px;
  --r-lg: 18px;
  --r: 16px;
  --r-sm: 11px;

  --sh-sm: 0 1px 2px rgba(20, 18, 16, 0.04), 0 4px 12px rgba(20, 18, 16, 0.035);
  --sh-md: 0 10px 30px rgba(20, 18, 16, 0.09), 0 2px 6px rgba(20, 18, 16, 0.04);
  --sh-glow: 0 8px 24px rgba(224, 62, 26, 0.28);
  --sh-sheet: 0 -12px 40px rgba(0, 0, 0, 0.24);

  --bnav-h: 68px;
  --top-h: 60px;
  color-scheme: light;
}

@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --bg: #0C0B0A;
    --surface: #161412;
    --surface-2: #211E1B;
    --surface-3: #2D2824;
    --fg: #F6F3EE;
    --muted: #A19890;
    --line: #2B2622;
    --line-soft: rgba(255, 255, 255, 0.07);

    --accent: #FF6240;
    --accent-2: #FF8A4C;
    --accent-hover: #FF785A;
    --accent-soft: rgba(255, 98, 64, 0.14);
    --accent-ring: rgba(255, 98, 64, 0.28);
    --accent-ink: #170905;

    --gold: #FBBF24;
    --gold-soft: rgba(251, 191, 36, 0.14);
    --ok: #34D399;
    --ok-soft: rgba(52, 211, 153, 0.14);
    --bad: #F87171;
    --bad-soft: rgba(248, 113, 113, 0.15);
    --info: #60A5FA;
    --info-soft: rgba(96, 165, 250, 0.15);
    --pay-bg: rgba(255, 255, 255, 0.08);
    --pay-bd: rgba(255, 255, 255, 0.24);
    --pay-fg: #FFFFFF;

    --hero-bg: linear-gradient(135deg, #1E1613 0%, #2D1811 60%, #4C1E10 100%);
    --side: #080706;
    --side-elev: #1B1715;
    --side-fg: #F6F3EE;
    --side-muted: #8E857D;

    --sh-sm: 0 2px 8px rgba(0, 0, 0, 0.35);
    --sh-md: 0 14px 36px rgba(0, 0, 0, 0.55);
    --sh-glow: 0 8px 26px rgba(255, 98, 64, 0.25);
    color-scheme: dark;
  }
}

:root[data-theme="dark"] {
  --bg: #0C0B0A;
  --surface: #161412;
  --surface-2: #211E1B;
  --surface-3: #2D2824;
  --fg: #F6F3EE;
  --muted: #A19890;
  --line: #2B2622;
  --line-soft: rgba(255, 255, 255, 0.07);

  --accent: #FF6240;
  --accent-2: #FF8A4C;
  --accent-hover: #FF785A;
  --accent-soft: rgba(255, 98, 64, 0.14);
  --accent-ring: rgba(255, 98, 64, 0.28);
  --accent-ink: #170905;

  --gold: #FBBF24;
  --gold-soft: rgba(251, 191, 36, 0.14);
  --ok: #34D399;
  --ok-soft: rgba(52, 211, 153, 0.14);
  --bad: #F87171;
  --bad-soft: rgba(248, 113, 113, 0.15);
  --info: #60A5FA;
  --info-soft: rgba(96, 165, 250, 0.15);
  --pay-bg: rgba(255, 255, 255, 0.08);
  --pay-bd: rgba(255, 255, 255, 0.24);
  --pay-fg: #FFFFFF;

  --hero-bg: linear-gradient(135deg, #1E1613 0%, #2D1811 60%, #4C1E10 100%);
  --side: #080706;
  --side-elev: #1B1715;
  --side-fg: #F6F3EE;
  --side-muted: #8E857D;

  --sh-sm: 0 2px 8px rgba(0, 0, 0, 0.35);
  --sh-md: 0 14px 36px rgba(0, 0, 0, 0.55);
  --sh-glow: 0 8px 26px rgba(255, 98, 64, 0.25);
  color-scheme: dark;
}

/* ---------- Base ---------- */
*, *::before, *::after { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }
html, body { margin: 0; padding: 0; }
body {
  background: var(--bg);
  color: var(--fg);
  font-family: var(--f-body);
  font-size: 14px;
  line-height: 1.48;
  font-variant-numeric: tabular-nums;
  -webkit-font-smoothing: antialiased;
  min-height: 100dvh;
  overscroll-behavior-y: contain;
}
img { max-width: 100%; display: block; }
[hidden] { display: none !important; }
h1, h2, h3, h4 { font-family: var(--f-display); margin: 0; letter-spacing: -0.02em; text-wrap: balance; }
p { margin: 0; }
button, input, select, textarea { font: inherit; color: inherit; }
button { cursor: pointer; touch-action: manipulation; -webkit-user-select: none; user-select: none; }
:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }

.muted { color: var(--muted); }
.small { font-size: 12.5px; }
.xs { font-size: 11px; }
.big { font-family: var(--f-display); font-size: 26px; font-weight: 800; line-height: 1.08; letter-spacing: -0.025em; }
.diff-ok { color: var(--ok); }
.diff-bad { color: var(--bad); }

/* ---------- Boot ---------- */
.boot-screen {
  min-height: 100dvh;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 14px;
  padding: 24px;
  background: radial-gradient(circle at 50% 35%, var(--accent-soft), var(--bg) 60%);
}
.boot-logo-wrap {
  padding: 10px;
  border-radius: 24px;
  background: var(--surface);
  box-shadow: var(--sh-md);
}
.boot-title { font-family: var(--f-display); font-size: 24px; font-weight: 800; }
.boot-sub { color: var(--muted); font-size: 13px; }

/* ---------- Layout principal ---------- */
.app {
  display: grid;
  grid-template-columns: 264px minmax(0, 1fr);
  min-height: 100dvh;
}

/* Sidebar Desktop */
.side {
  background: var(--side);
  color: var(--side-fg);
  padding: 22px 14px 18px;
  display: flex;
  flex-direction: column;
  gap: 18px;
  position: sticky;
  top: 0;
  height: 100dvh;
  overflow-y: auto;
  border-right: 1px solid rgba(255, 255, 255, 0.06);
}
.is-emp .side {
  background: linear-gradient(180deg, #B82E12 0%, #821C09 100%);
}
.is-emp .side .nav button[aria-current="true"] {
  background: rgba(255, 255, 255, 0.16);
  box-shadow: inset 0 0 0 1px rgba(255, 255, 255, 0.22);
}

.brand {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 4px 8px;
}
.brand-icon {
  width: 42px;
  height: 42px;
  border-radius: 13px;
  flex: none;
  box-shadow: 0 4px 14px rgba(0, 0, 0, 0.32);
}
.brand h1 { font-size: 17.5px; line-height: 1.12; font-weight: 800; }
.brand small { display: block; color: var(--side-muted); font-size: 11.5px; margin-top: 2px; font-weight: 500; }
.is-emp .brand small, .is-emp .nav button, .is-emp .side-who { color: rgba(255, 255, 255, 0.85); }

.nav { display: flex; flex-direction: column; gap: 4px; }
.nav-grp {
  font-size: 10px;
  text-transform: uppercase;
  letter-spacing: 0.12em;
  color: var(--side-muted);
  padding: 12px 12px 4px;
  font-weight: 700;
  opacity: 0.75;
}
.nav button {
  all: unset;
  box-sizing: border-box;
  cursor: pointer;
  padding: 10px 13px;
  border-radius: 12px;
  color: var(--side-muted);
  display: flex;
  align-items: center;
  gap: 11px;
  font-weight: 600;
  font-size: 13.5px;
  min-height: 44px;
  transition: background 0.15s, color 0.15s, transform 0.1s;
}
.nav button svg { width: 19px; height: 19px; flex: none; opacity: 0.82; }
@media (hover: hover) {
  .nav button:hover { color: #fff; background: rgba(255, 255, 255, 0.06); }
}
.nav button[aria-current="true"] {
  color: #fff;
  background: linear-gradient(90deg, rgba(224, 62, 26, 0.92), rgba(243, 107, 44, 0.85));
  box-shadow: 0 4px 14px rgba(224, 62, 26, 0.35);
}
.nav button[aria-current="true"] svg { opacity: 1; }
.nav .badge-pill {
  margin-left: auto;
  font-size: 11px;
  font-weight: 800;
  background: #fff;
  color: var(--accent);
  border-radius: 99px;
  padding: 1px 7px;
}

.side-who {
  margin-top: auto;
  background: rgba(255, 255, 255, 0.05);
  border: 1px solid rgba(255, 255, 255, 0.08);
  border-radius: 14px;
  padding: 12px;
  display: flex;
  flex-direction: column;
  gap: 10px;
  font-size: 12px;
  color: var(--side-muted);
}
.side-who-row { display: flex; align-items: center; gap: 10px; }
.side-who b { color: #fff; font-size: 13.5px; display: block; }
.side-actions { display: grid; grid-template-columns: 1fr auto; gap: 6px; }
.side-btn {
  border: 1px solid rgba(255, 255, 255, 0.16);
  background: rgba(255, 255, 255, 0.07);
  color: #fff;
  border-radius: 9px;
  padding: 7px 10px;
  font-size: 12px;
  font-weight: 600;
}
@media (hover: hover) { .side-btn:hover { background: rgba(255, 255, 255, 0.16); } }

/* Avatar con iniciales */
.avatar {
  width: 34px;
  height: 34px;
  border-radius: 11px;
  background: linear-gradient(135deg, var(--accent), var(--accent-2));
  color: #fff;
  font-family: var(--f-display);
  font-weight: 800;
  font-size: 13px;
  display: grid;
  place-items: center;
  flex: none;
  letter-spacing: 0.02em;
}
.avatar.sm { width: 26px; height: 26px; border-radius: 8px; font-size: 10.5px; }
.avatar.alt { background: var(--surface-2); color: var(--fg); border: 1px solid var(--line); }

/* Área principal y cabecera */
.main { min-width: 0; display: flex; flex-direction: column; }

.top {
  position: sticky;
  top: 0;
  z-index: 12;
  min-height: var(--top-h);
  padding: calc(10px + env(safe-area-inset-top, 0px)) 24px 10px;
  background: color-mix(in srgb, var(--bg) 82%, transparent);
  backdrop-filter: blur(18px);
  -webkit-backdrop-filter: blur(18px);
  border-bottom: 1px solid var(--line-soft);
  display: flex;
  align-items: center;
  gap: 12px;
}
.top-brand-m {
  display: none;
  width: 36px;
  height: 36px;
  border-radius: 11px;
  flex: none;
  box-shadow: 0 2px 8px rgba(224, 62, 26, 0.25);
}
.top-titles { margin-right: auto; min-width: 0; }
.top h2 {
  font-size: 20px;
  font-weight: 800;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  line-height: 1.15;
}
.top-sub { font-size: 11.5px; color: var(--muted); display: block; font-weight: 500; }
.top-ctl { display: flex; align-items: center; gap: 8px; flex: none; }

.branch-sel {
  max-width: 165px;
  padding: 7px 30px 7px 12px;
  font-size: 13px;
  font-weight: 700;
  border-radius: 99px;
  background-color: var(--surface);
  border: 1px solid var(--line);
  min-height: 38px;
  box-shadow: var(--sh-sm);
}

.status-dot {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 6px 11px;
  border-radius: 99px;
  font-size: 12px;
  font-weight: 700;
}
.status-dot.ok { background: var(--ok-soft); color: var(--ok); }
.status-dot.warn { background: var(--gold-soft); color: var(--gold); }
.status-dot.info { background: var(--info-soft); color: var(--info); }

.offline-banner {
  background: var(--gold-soft);
  color: var(--fg);
  border-bottom: 1px solid var(--line);
  padding: 10px 24px;
  font-size: 12.5px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  flex-wrap: wrap;
}
.offline-banner b { color: var(--gold); }

.view {
  padding: 20px 24px 48px;
  display: flex;
  flex-direction: column;
  gap: 18px;
  min-width: 0;
  max-width: 1340px;
  width: 100%;
  margin: 0 auto;
}

/* ---------- Hero Card Ejecutivo (Dashboard) ---------- */
.hero-bento {
  display: grid;
  grid-template-columns: 1.35fr 1fr;
  gap: 14px;
}
.hero-card {
  background: var(--hero-bg);
  color: #FFF9F3;
  border-radius: var(--r-xl);
  padding: 22px;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  gap: 16px;
  box-shadow: 0 12px 32px rgba(24, 14, 10, 0.24);
  position: relative;
  overflow: hidden;
}
.hero-card::after {
  content: "";
  position: absolute;
  top: -50px;
  right: -40px;
  width: 190px;
  height: 190px;
  border-radius: 50%;
  background: radial-gradient(circle, rgba(243, 107, 44, 0.32), transparent 70%);
  pointer-events: none;
}
.hero-top { display: flex; justify-content: space-between; align-items: flex-start; gap: 10px; position: relative; z-index: 1; }
.hero-lbl { font-size: 11.5px; text-transform: uppercase; letter-spacing: 0.1em; opacity: 0.72; font-weight: 700; }
.hero-amount {
  font-family: var(--f-display);
  font-size: clamp(32px, 5vw, 44px);
  font-weight: 800;
  line-height: 1.02;
  letter-spacing: -0.03em;
  margin-top: 4px;
}
.hero-pill {
  background: rgba(255, 255, 255, 0.12);
  border: 1px solid rgba(255, 255, 255, 0.16);
  color: #fff;
  padding: 5px 11px;
  border-radius: 99px;
  font-size: 12px;
  font-weight: 700;
  backdrop-filter: blur(8px);
}
.hero-split {
  display: flex;
  flex-direction: column;
  gap: 8px;
  position: relative;
  z-index: 1;
}
.split-bar {
  height: 8px;
  border-radius: 99px;
  background: rgba(255, 255, 255, 0.14);
  overflow: hidden;
  display: flex;
}
.split-card { background: #60A5FA; height: 100%; }
.split-cash { background: #34D399; height: 100%; }
.split-legend {
  display: flex;
  justify-content: space-between;
  gap: 10px;
  font-size: 12.5px;
  flex-wrap: wrap;
}
.split-legend span { display: inline-flex; align-items: center; gap: 6px; opacity: 0.92; }

.bento-kpis {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 12px;
}

/* ---------- Contenedores de Sucursales en Árbol (Branch Tree) ---------- */
.btree-shell {
  display: flex;
  flex-direction: column;
  align-items: center;
  margin-top: 0;
}
.btree-root {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 6px 14px;
  border-radius: 99px;
  background: #12151E;
  color: #F8FAFC;
  border: 1px solid rgba(224, 62, 26, 0.45);
  font-family: var(--f-display);
  font-size: 13px;
  font-weight: 800;
  box-shadow: 0 4px 16px rgba(224, 62, 26, 0.22);
}
.btree-root .dot { color: var(--accent); box-shadow: 0 0 8px var(--accent); }
.btree-trunk {
  width: 2.5px;
  height: 36px;
  margin-bottom: -22px;
  position: relative;
  z-index: 2;
  background: linear-gradient(180deg, var(--accent), rgba(224, 62, 26, 0.85));
  box-shadow: 0 0 12px rgba(224, 62, 26, 0.6);
}
.btree-box {
  width: 100%;
  background: #12151E;
  border: 1px solid rgba(255, 255, 255, 0.08);
  border-radius: 20px;
  padding: 22px 18px 18px;
  box-shadow: 0 14px 34px rgba(10, 12, 18, 0.28);
  position: relative;
}
.btree-rail {
  height: 2.5px;
  background: linear-gradient(90deg, rgba(224, 62, 26, 0.55), var(--accent), rgba(224, 62, 26, 0.55));
  box-shadow: 0 0 14px rgba(224, 62, 26, 0.55);
  border-radius: 99px;
  margin: 0 6px;
}
.btree-grid {
  display: grid;
  grid-template-columns: repeat(var(--bt-cols, 4), minmax(0, 1fr));
  gap: 14px;
}
.btree-col {
  display: flex;
  flex-direction: column;
  align-items: center;
  min-width: 0;
}
.btree-drop {
  width: 2.5px;
  height: 20px;
  background: linear-gradient(180deg, var(--accent), rgba(224, 62, 26, 0.5));
  box-shadow: 0 0 10px rgba(224, 62, 26, 0.45);
}
.btree-node {
  width: 100%;
  min-height: 76px;
  padding: 14px 14px;
  border-radius: 15px;
  border: 1px solid rgba(255, 255, 255, 0.11);
  background: #191D29;
  color: #F8FAFC;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 12px;
  text-align: left;
  position: relative;
  transition: transform 0.12s, border-color 0.16s, background 0.16s, box-shadow 0.16s;
}
@media (hover: hover) {
  .btree-node:hover {
    background: #202636;
    border-color: rgba(224, 62, 26, 0.65);
    box-shadow: 0 8px 22px rgba(224, 62, 26, 0.22);
    transform: translateY(-2px);
  }
}
.btree-node:active {
  transform: scale(0.97);
  border-color: var(--accent);
}
.btree-node.is-selected {
  border-color: var(--accent);
  background: #221A1F;
  box-shadow: 0 0 0 2px rgba(224, 62, 26, 0.35), 0 8px 22px rgba(224, 62, 26, 0.25);
}
.btree-node-ico {
  width: 34px;
  height: 34px;
  border-radius: 10px;
  background: rgba(255, 255, 255, 0.06);
  color: #E2E8F0;
  display: grid;
  place-items: center;
  flex: none;
}
.btree-node-ico svg { width: 19px; height: 19px; }
.btree-node-txt { min-width: 0; display: flex; flex-direction: column; gap: 2px; }
.btree-node-txt b {
  font-family: var(--f-display);
  font-size: 15.5px;
  font-weight: 800;
  color: #FFFFFF;
  line-height: 1.15;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.btree-node-txt span {
  font-size: 12px;
  color: #94A3B8;
  font-weight: 600;
  display: inline-flex;
  align-items: center;
  gap: 5px;
}
.btree-node .st-led {
  position: absolute;
  top: 9px;
  right: 10px;
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: #64748B;
}
.btree-node .st-led.ok { background: #34D399; box-shadow: 0 0 8px rgba(52, 211, 153, 0.7); }
.btree-node .st-led.warn { background: #FBBF24; box-shadow: 0 0 8px rgba(251, 191, 36, 0.7); }

/* Detalle dentro del Bottom Sheet / Modal de sucursal */
.bdet-hero {
  background: var(--hero-bg);
  color: #fff;
  border-radius: 18px;
  padding: 16px 18px;
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 12px;
  flex-wrap: wrap;
}
.bdet-hero .bdet-val {
  font-family: var(--f-display);
  font-size: 32px;
  font-weight: 800;
  line-height: 1.05;
}
.bdet-kpis {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 10px;
}
.bdet-stat {
  background: var(--surface-2);
  border-radius: 14px;
  padding: 12px 14px;
  display: flex;
  flex-direction: column;
  gap: 2px;
}
.bdet-stat span {
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--muted);
  font-weight: 700;
}
.bdet-stat b {
  font-family: var(--f-display);
  font-size: 26px;
  font-weight: 800;
  line-height: 1.08;
}
.bdet-prod {
  border: 1px solid var(--line-soft);
  background: var(--surface);
  border-radius: 14px;
  padding: 12px 14px;
  display: flex;
  flex-direction: column;
  gap: 9px;
}
.bdet-prod.hl-ranch { border-left: 4px solid var(--accent); }
.bdet-prod.hl-kfc { border-left: 4px solid var(--gold); }
.bdet-prod.hl-rost { border-left: 4px solid var(--ok); }
.bdet-prod-hd { display: flex; justify-content: space-between; align-items: center; gap: 8px; }
.bdet-prod-hd b { font-family: var(--f-display); font-size: 15.5px; }

/* Accesos rápidos debajo de Venta total (Configuración · Reportes · Inventario) */
.bdet-quick {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 10px;
}
.bdet-qbtn {
  border: 1px solid var(--line-soft);
  background: var(--surface-2);
  border-radius: 15px;
  padding: 12px 8px 10px;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 7px;
  text-align: center;
  color: var(--fg);
  font-size: 12px;
  font-weight: 700;
  transition: transform 0.1s, border-color 0.15s, background 0.15s;
}
.bdet-qbtn:active { transform: scale(0.96); }
@media (hover: hover) {
  .bdet-qbtn:hover { border-color: var(--accent); background: var(--accent-soft); }
}
.bdet-qico {
  width: 40px;
  height: 40px;
  border-radius: 13px;
  display: grid;
  place-items: center;
}
.bdet-qico svg { width: 20px; height: 20px; }
.bdet-qico.cfg { background: rgba(245, 158, 11, 0.16); color: #F59E0B; }
.bdet-qico.rep { background: rgba(56, 189, 248, 0.16); color: #38BDF8; }
.bdet-qico.inv { background: rgba(52, 211, 153, 0.16); color: #34D399; }

/* Tarjetas métricas oscuras con sparklines neón (Diarias, Semanales, Mensuales, Reinversión) */
.mcards {
  display: flex;
  flex-direction: column;
  gap: 11px;
}
.mcard {
  background: linear-gradient(135deg, #121B22 0%, #162028 100%);
  border: 1px solid rgba(255, 255, 255, 0.09);
  border-radius: 18px;
  padding: 15px 16px;
  color: #F8FAFC;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  box-shadow: 0 6px 20px rgba(6, 10, 14, 0.24);
}
.mcard.mcard-col {
  flex-direction: column;
  align-items: stretch;
  gap: 14px;
}
.mcard-left {
  display: flex;
  flex-direction: column;
  gap: 6px;
  min-width: 0;
}
.mcard-hd {
  display: flex;
  align-items: center;
  gap: 9px;
}
.mcard-ico {
  width: 30px;
  height: 30px;
  border-radius: 9px;
  display: grid;
  place-items: center;
  flex: none;
}
.mcard-ico svg { width: 16px; height: 16px; }
.mcard-ico.emerald { background: rgba(52, 211, 153, 0.15); color: #34D399; }
.mcard-ico.sky { background: rgba(56, 189, 248, 0.15); color: #38BDF8; }
.mcard-ico.indigo { background: rgba(129, 140, 248, 0.16); color: #818CF8; }
.mcard-ico.amber { background: rgba(245, 158, 11, 0.16); color: #F59E0B; }

.mcard-title {
  font-size: 11.5px;
  font-weight: 800;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: #94A3B8;
}
.mcard-val {
  font-family: var(--f-display);
  font-size: 26px;
  font-weight: 800;
  line-height: 1.05;
  letter-spacing: -0.02em;
}
.mcard-val.emerald { color: #34D399; }
.mcard-val.sky { color: #38BDF8; }
.mcard-val.indigo { color: #818CF8; }
.mcard-sub {
  font-size: 12px;
  color: #94A3B8;
  font-weight: 600;
}

.mcard-spark {
  width: 118px;
  height: 58px;
  flex: none;
  border-radius: 12px;
  background: #0D141A;
  border: 1px solid rgba(255, 255, 255, 0.07);
  overflow: hidden;
  display: block;
}
.mcard-spark svg { width: 100%; height: 100%; display: block; }

.mcard-dots {
  display: inline-flex;
  gap: 5px;
  align-items: center;
  height: 26px;
}
.mcard-dots i {
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: currentColor;
  animation: mDotPulse 1.2s ease-in-out infinite;
}
.mcard-dots i:nth-child(2) { animation-delay: 0.18s; }
.mcard-dots i:nth-child(3) { animation-delay: 0.36s; }
@keyframes mDotPulse {
  0%, 100% { opacity: 0.35; transform: scale(0.85); }
  50% { opacity: 1; transform: scale(1.15); }
}

.mcard-fin-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 10px;
  padding-top: 2px;
}
.mcard-fin-row + .mcard-fin-row {
  border-top: 1px solid rgba(255, 255, 255, 0.07);
  padding-top: 12px;
}
.mcard-fin-lbl {
  font-size: 12.5px;
  font-weight: 800;
  letter-spacing: 0.04em;
  color: #F1F5F9;
}
.mcard-fin-val {
  font-family: var(--f-display);
  font-size: 17px;
  font-weight: 800;
  color: #34D399;
}

@media (max-width: 780px) {
  .btree-trunk { height: 28px; margin-bottom: -14px; }
  .btree-box { padding: 14px 8px 12px; border-radius: 18px; }
  .btree-rail { margin: 0 4px; }
  .btree-grid { grid-template-columns: repeat(var(--bt-cols, 4), minmax(0, 1fr)); gap: 6px; }
  .btree-drop { height: 13px; }
  .btree-node {
    min-height: 82px;
    padding: 10px 4px 9px;
    border-radius: 12px;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    text-align: center;
    gap: 5px;
  }
  .btree-node-ico { width: 26px; height: 26px; border-radius: 8px; }
  .btree-node-ico svg { width: 15px; height: 15px; }
  .btree-node-txt { align-items: center; width: 100%; }
  .btree-node-txt b {
    font-size: 11.5px;
    line-height: 1.15;
    white-space: normal;
    word-break: break-word;
  }
  .btree-node-txt span { font-size: 10.5px; justify-content: center; }
  .btree-node-txt .bt-hint { display: none; }
  .btree-node .st-led { top: 6px; right: 6px; width: 6px; height: 6px; }
}

/* ---------- Tarjetas y KPIs ---------- */
.panel {
  background: var(--surface);
  border: 1px solid var(--line-soft);
  border-radius: var(--r);
  padding: 18px;
  box-shadow: var(--sh-sm);
  min-width: 0;
}
.panel.flat { box-shadow: none; background: var(--surface-2); border-color: transparent; }
.panel.danger-border { border: 1.5px solid var(--bad); }

.sec-h {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
}
.sec-h h3 { font-size: 17px; font-weight: 800; }

.grid { display: grid; gap: 14px; }
.g4 { grid-template-columns: repeat(4, minmax(0, 1fr)); }
.g3 { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.g2 { grid-template-columns: repeat(2, minmax(0, 1fr)); }

.kpi {
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  gap: 6px;
}
.kpi-top { display: flex; justify-content: space-between; align-items: center; gap: 8px; }
.kpi-ico {
  width: 34px;
  height: 34px;
  border-radius: 10px;
  display: grid;
  place-items: center;
  flex: none;
}
.kpi-ico svg { width: 17px; height: 17px; }
.kpi-ico.accent { background: var(--accent-soft); color: var(--accent); }
.kpi-ico.ok { background: var(--ok-soft); color: var(--ok); }
.kpi-ico.warn { background: var(--gold-soft); color: var(--gold); }
.kpi-ico.bad { background: var(--bad-soft); color: var(--bad); }
.kpi-ico.info { background: var(--info-soft); color: var(--info); }

.kpi .lbl {
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--muted);
  font-weight: 700;
}
.kpi .val { font-family: var(--f-display); font-size: 26px; font-weight: 800; line-height: 1.06; }
.kpi .sub { font-size: 12px; color: var(--muted); }

/* Tarjeta de sucursal con acento superior */
.branch-card {
  display: flex;
  flex-direction: column;
  gap: 12px;
  position: relative;
  overflow: hidden;
  padding-top: 20px;
}
.branch-card::before {
  content: "";
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  height: 4px;
  background: var(--line);
}
.branch-card.st-ok::before { background: linear-gradient(90deg, var(--ok), #34D399); }
.branch-card.st-warn::before { background: linear-gradient(90deg, var(--gold), #F59E0B); }

/* ---------- Botones ---------- */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 7px;
  min-height: 44px;
  padding: 10px 16px;
  border-radius: 12px;
  border: 1px solid var(--line);
  background: var(--surface);
  color: var(--fg);
  font-weight: 700;
  font-size: 13.5px;
  transition: transform 0.08s, background 0.15s, box-shadow 0.15s, border-color 0.15s;
  white-space: nowrap;
}
.btn:active:not(:disabled) { transform: scale(0.97); }
.btn:disabled { opacity: 0.45; cursor: not-allowed; }
@media (hover: hover) { .btn:hover:not(:disabled) { border-color: var(--muted); } }

.btn.primary {
  background: linear-gradient(135deg, var(--accent), var(--accent-2));
  border-color: transparent;
  color: var(--accent-ink);
  box-shadow: 0 4px 14px var(--accent-ring);
}
@media (hover: hover) {
  .btn.primary:hover:not(:disabled) { filter: brightness(1.05); box-shadow: var(--sh-glow); }
}

.btn.ok { background: var(--ok); border-color: var(--ok); color: #fff; }
.btn.danger { color: var(--bad); background: var(--bad-soft); border-color: transparent; }
.btn.danger-fill { background: var(--bad); border-color: var(--bad); color: #fff; }
.btn.ghost { background: transparent; border-color: transparent; }
.btn.soft { background: var(--surface-2); border-color: transparent; }
.btn.sm { min-height: 34px; padding: 6px 12px; font-size: 12.5px; border-radius: 10px; }
.btn.lg { min-height: 52px; padding: 13px 20px; font-size: 15.5px; font-weight: 800; border-radius: 14px; }
.btn.block { width: 100%; }

.icon-btn {
  width: 40px;
  height: 40px;
  min-height: 40px;
  padding: 0;
  border-radius: 12px;
  position: relative;
}
.icon-btn svg { width: 19px; height: 19px; }
.bell-badge {
  position: absolute;
  top: -3px;
  right: -3px;
  min-width: 19px;
  height: 19px;
  padding: 0 5px;
  border-radius: 99px;
  background: var(--accent);
  color: #fff;
  font-size: 10px;
  font-weight: 800;
  display: grid;
  place-items: center;
  border: 2px solid var(--bg);
}

.actions { display: flex; gap: 8px; flex-wrap: wrap; align-items: center; }

/* Pills & Badges */
.pill {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  border-radius: 99px;
  padding: 4px 10px;
  font-size: 11.5px;
  font-weight: 700;
  white-space: nowrap;
}
.pill.ok { background: var(--ok-soft); color: var(--ok); }
.pill.bad { background: var(--bad-soft); color: var(--bad); }
.pill.warn { background: var(--gold-soft); color: var(--gold); }
.pill.info { background: var(--info-soft); color: var(--info); }
.pill.neutral { background: var(--surface-2); color: var(--muted); }
.pill.pay { background: var(--pay-bg); border: 1px solid var(--pay-bd); color: var(--pay-fg); }
.dot { width: 7px; height: 7px; border-radius: 50%; background: currentColor; flex: none; }
.dot.pulse { animation: livePulse 1.8s ease-in-out infinite; }
@keyframes livePulse {
  0%, 100% { opacity: 1; transform: scale(1); }
  50% { opacity: 0.4; transform: scale(1.35); }
}
.feed-chips { display: flex; gap: 6px; overflow-x: auto; padding-bottom: 2px; scrollbar-width: none; }
.feed-chips::-webkit-scrollbar { display: none; }
.feed-chip {
  flex: none;
  border: 1px solid var(--line);
  background: var(--surface-2);
  color: var(--muted);
  border-radius: 99px;
  padding: 5px 11px;
  font-size: 12px;
  font-weight: 700;
  min-height: 30px;
}
.feed-chip[aria-pressed="true"] {
  background: var(--accent-soft);
  border-color: var(--accent);
  color: var(--accent);
}

/* Inputs y selects modernos con flecha SVG */
select, input, textarea {
  background: var(--surface);
  border: 1.5px solid var(--line);
  border-radius: 12px;
  padding: 10px 13px;
  min-height: 46px;
  min-width: 0;
  width: 100%;
  font-size: 14.5px;
  transition: border-color 0.15s, box-shadow 0.15s;
}
select {
  appearance: none;
  -webkit-appearance: none;
  padding-right: 34px;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='16' height='16' viewBox='0 0 24 24' fill='none' stroke='%2378716C' stroke-width='2.4' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='m6 9 6 6 6-6'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 11px center;
  background-size: 15px;
}
select:focus, input:focus, textarea:focus {
  border-color: var(--accent);
  box-shadow: 0 0 0 3px var(--accent-ring);
  outline: none;
}
textarea { min-height: 80px; resize: vertical; }

.form {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(165px, 1fr));
  gap: 11px;
  align-items: end;
}
.form.cols2 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.form.cols1 { grid-template-columns: 1fr; }
.field {
  display: flex;
  flex-direction: column;
  gap: 5px;
  font-size: 12px;
  font-weight: 700;
  color: var(--muted);
  min-width: 0;
}
.field input, .field select, .field textarea { color: var(--fg); font-weight: 600; }

/* Switch */
.switch {
  position: relative;
  width: 48px;
  height: 28px;
  border-radius: 99px;
  border: 0;
  background: var(--surface-3);
  padding: 0;
  flex: none;
  transition: background 0.18s;
}
.switch::after {
  content: "";
  position: absolute;
  top: 3px;
  left: 3px;
  width: 22px;
  height: 22px;
  border-radius: 50%;
  background: #fff;
  box-shadow: 0 2px 5px rgba(0, 0, 0, 0.22);
  transition: transform 0.18s cubic-bezier(0.22, 1, 0.36, 1);
}
.switch[aria-checked="true"] { background: var(--ok); }
.switch[aria-checked="true"]::after { transform: translateX(20px); }

/* Tabs horizontales tipo cápsula */
.tabs {
  display: flex;
  gap: 8px;
  overflow-x: auto;
  padding: 2px 0;
  scrollbar-width: none;
}
.tabs::-webkit-scrollbar { display: none; }
.tab-btn {
  flex: none;
  border: 1px solid var(--line);
  background: var(--surface);
  color: var(--muted);
  border-radius: 99px;
  padding: 8px 16px;
  font-weight: 700;
  font-size: 13px;
  min-height: 40px;
  transition: background 0.14s, color 0.14s, border-color 0.14s, box-shadow 0.14s;
}
.tab-btn[aria-selected="true"] {
  background: var(--fg);
  border-color: var(--fg);
  color: var(--bg);
  box-shadow: var(--sh-sm);
}

/* Barra de fecha */
.datebar {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 12px;
  padding: 3px;
  box-shadow: var(--sh-sm);
}
.datebar .btn { border: 0; min-height: 34px; padding: 0 10px; border-radius: 9px; }
.datebar input[type="date"] {
  width: auto;
  min-height: 34px;
  padding: 4px 8px;
  font-size: 13px;
  font-weight: 700;
  border: 0;
  background: transparent;
}
.datebar input[type="date"]:focus { box-shadow: none; }

/* ---------- Login / Setup (Inmersivo con cabecera de marca) ---------- */
.auth-wrap {
  min-height: 100dvh;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: calc(16px + env(safe-area-inset-top, 0px)) 16px calc(24px + env(safe-area-inset-bottom, 0px));
  background:
    radial-gradient(circle at 20% 10%, var(--accent-soft), transparent 45%),
    radial-gradient(circle at 85% 90%, var(--gold-soft), transparent 45%),
    var(--bg);
}
.auth-shell {
  width: 100%;
  max-width: 430px;
  background: var(--surface);
  border: 1px solid var(--line-soft);
  border-radius: 28px;
  overflow: hidden;
  box-shadow: var(--sh-md);
}
.auth-hero {
  background: var(--hero-bg);
  color: #fff;
  padding: 24px 24px 20px;
  display: flex;
  align-items: center;
  gap: 14px;
  position: relative;
  overflow: hidden;
}
.auth-hero::after {
  content: "";
  position: absolute;
  right: -30px;
  top: -30px;
  width: 140px;
  height: 140px;
  border-radius: 50%;
  background: radial-gradient(circle, rgba(243, 107, 44, 0.45), transparent 70%);
}
.auth-hero img {
  width: 52px;
  height: 52px;
  border-radius: 15px;
  box-shadow: 0 6px 18px rgba(0, 0, 0, 0.35);
  position: relative;
  z-index: 1;
}
.auth-hero h1 { font-size: 22px; font-weight: 800; position: relative; z-index: 1; }
.auth-hero span { font-size: 12.5px; opacity: 0.78; position: relative; z-index: 1; }

.auth-body {
  padding: 22px;
  display: flex;
  flex-direction: column;
  gap: 16px;
}

.seg {
  display: grid;
  grid-template-columns: 1fr 1fr;
  background: var(--surface-2);
  border-radius: 14px;
  padding: 4px;
  gap: 4px;
}
.seg button {
  border: 0;
  border-radius: 11px;
  background: transparent;
  color: var(--muted);
  font-weight: 700;
  padding: 10px 8px;
  min-height: 42px;
  transition: background 0.15s, color 0.15s, box-shadow 0.15s;
}
.seg button[aria-pressed="true"] {
  background: var(--surface);
  color: var(--fg);
  box-shadow: var(--sh-sm);
}

.pin-dots {
  display: flex;
  justify-content: center;
  gap: 14px;
  padding: 8px 0 4px;
}
.pin-dot {
  width: 16px;
  height: 16px;
  border-radius: 50%;
  border: 2px solid var(--line);
  background: var(--surface-2);
  transition: transform 0.14s cubic-bezier(0.22, 1, 0.36, 1), background 0.14s, border-color 0.14s, box-shadow 0.14s;
}
.pin-dot.filled {
  background: var(--accent);
  border-color: var(--accent);
  transform: scale(1.16);
  box-shadow: 0 0 0 4px var(--accent-ring);
}

.pinpad {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 10px;
}
.pinpad button {
  min-height: 56px;
  border-radius: 16px;
  border: 1px solid var(--line-soft);
  background: var(--surface-2);
  font-family: var(--f-display);
  font-size: 23px;
  font-weight: 800;
  display: grid;
  place-items: center;
  box-shadow: 0 1px 0 rgba(255, 255, 255, 0.3) inset;
  transition: transform 0.07s, background 0.12s, color 0.12s;
}
.pinpad button:active {
  transform: scale(0.93);
  background: var(--accent);
  color: #fff;
  border-color: var(--accent);
}
.pinpad button.fn {
  font-family: var(--f-body);
  font-size: 13px;
  font-weight: 700;
  color: var(--muted);
  background: var(--surface);
  border-color: var(--line);
}

/* ---------- POS (Punto de venta rework premium) ---------- */
.pos-layout {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 372px;
  gap: 18px;
  align-items: start;
}
.pos-catalog { display: flex; flex-direction: column; gap: 16px; min-width: 0; }
.pos-sticky-cats {
  position: sticky;
  top: var(--top-h);
  z-index: 8;
  background: color-mix(in srgb, var(--bg) 90%, transparent);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  padding: 8px 0;
  margin: -8px 0;
}

.pblock { display: flex; flex-direction: column; gap: 10px; }
.pblock + .pblock { border-top: 1px solid var(--line-soft); padding-top: 16px; }
.pblock-h { display: flex; justify-content: space-between; align-items: center; gap: 8px; }
.pblock-h b { font-family: var(--f-display); font-size: 17px; font-weight: 800; }

.ptiles {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 11px;
}
.ptile {
  position: relative;
  aspect-ratio: 4 / 3.2;
  padding: 0;
  border: 0;
  border-radius: 18px;
  overflow: hidden;
  display: block;
  width: 100%;
  text-align: left;
  box-shadow: 0 4px 14px rgba(20, 16, 12, 0.12);
  transition: transform 0.12s cubic-bezier(0.22, 1, 0.36, 1), box-shadow 0.15s;
}
@media (hover: hover) {
  .ptile:hover:not(:disabled) { transform: translateY(-2px); box-shadow: 0 10px 22px rgba(20, 16, 12, 0.18); }
}
.ptile:active:not(:disabled) { transform: scale(0.95); }
.ptile:disabled { opacity: 0.44; filter: grayscale(0.55); cursor: not-allowed; }
.ptile.in-cart {
  box-shadow: 0 0 0 3px var(--accent), 0 8px 20px var(--accent-ring);
}

.ptile-rost { background: radial-gradient(circle at 50% 35%, #FFF1D0 0%, #F1BE70 58%, #CF8839 100%); }
.ptile-ranch { background: radial-gradient(circle at 50% 35%, #FFE2D2 0%, #EB8E6B 58%, #BD4726 100%); }
.ptile-kfc { background: radial-gradient(circle at 50% 35%, #FFF5CC 0%, #F2C45A 58%, #C98A22 100%); }
.ptile-default { background: radial-gradient(circle at 50% 35%, #F8E8D4 0%, #DFAA72 60%, #B87239 100%); }

.ptile .tile-img {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: cover;
}
.ptile svg.tile-img { padding: 7% 10% 28%; }

.ptile-stock {
  position: absolute;
  top: 8px;
  left: 8px;
  background: rgba(18, 14, 11, 0.68);
  color: #fff;
  font-size: 10.5px;
  font-weight: 700;
  padding: 3px 8px;
  border-radius: 99px;
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
}
.ptile-stock.low { background: rgba(220, 38, 38, 0.92); }

.ptile-q {
  position: absolute;
  top: 8px;
  right: 8px;
  min-width: 30px;
  height: 30px;
  padding: 0 8px;
  border-radius: 99px;
  background: var(--accent);
  color: #fff;
  font-family: var(--f-display);
  font-weight: 800;
  font-size: 14px;
  display: grid;
  place-items: center;
  box-shadow: 0 3px 10px rgba(0, 0, 0, 0.35);
  border: 2px solid #fff;
}

.tile-cap {
  position: absolute;
  left: 0;
  right: 0;
  bottom: 0;
  padding: 30px 11px 10px;
  background: linear-gradient(transparent 0%, rgba(16, 12, 9, 0.88) 72%);
  color: #fff;
  display: flex;
  justify-content: space-between;
  align-items: flex-end;
  gap: 6px;
}
.tile-cap b { font-family: var(--f-display); font-size: clamp(14.5px, 2vw, 19px); line-height: 1.05; }
.tile-cap .price-pill {
  background: rgba(255, 255, 255, 0.18);
  backdrop-filter: blur(6px);
  -webkit-backdrop-filter: blur(6px);
  padding: 2px 8px;
  border-radius: 8px;
  font-family: var(--f-display);
  font-weight: 800;
  font-size: clamp(13px, 1.8vw, 16px);
}

/* Tiles secundarios */
.tiles-md {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(114px, 1fr));
  gap: 10px;
}
.tiles-list {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(210px, 1fr));
  gap: 10px;
}
.mtile {
  position: relative;
  border: 1.5px solid var(--line);
  background: var(--surface);
  border-radius: 16px;
  padding: 12px 10px;
  display: flex;
  flex-direction: column;
  gap: 4px;
  text-align: left;
  box-shadow: var(--sh-sm);
  transition: transform 0.1s, border-color 0.15s, box-shadow 0.15s;
}
.mtile.center { align-items: center; text-align: center; }
.mtile.in-cart { border-color: var(--accent); box-shadow: 0 0 0 2px var(--accent-ring); }
.mtile:active:not(:disabled) { transform: scale(0.96); background: var(--accent-soft); border-color: var(--accent); }
.mtile:disabled { opacity: 0.45; cursor: not-allowed; }
.mtile.promo { border-style: dashed; border-color: color-mix(in srgb, var(--accent) 45%, var(--line)); }
.mtile.season { border-color: var(--gold); background: color-mix(in srgb, var(--gold-soft) 35%, var(--surface)); }
.mtile .pimg { width: 64px; height: 48px; object-fit: cover; border-radius: 10px; }
.mtile b { font-size: 13.5px; line-height: 1.2; font-weight: 700; }
.mtile .price-tag { font-family: var(--f-display); font-size: 16px; font-weight: 800; color: var(--accent); }

/* Carrito */
.cart-desk { position: sticky; top: calc(var(--top-h) + 16px); border-radius: var(--r-lg); }
.cart-box { display: flex; flex-direction: column; gap: 13px; }
.cart-items { display: flex; flex-direction: column; max-height: 36vh; overflow-y: auto; gap: 2px; }
.cart-row {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto auto;
  gap: 10px;
  align-items: center;
  padding: 10px 0;
  border-bottom: 1px solid var(--line-soft);
}
.cart-row:last-child { border-bottom: 0; }
.qty-ctl { display: inline-flex; align-items: center; gap: 7px; }
.qty-ctl button {
  width: 34px;
  height: 34px;
  border-radius: 10px;
  border: 1px solid var(--line);
  background: var(--surface-2);
  font-weight: 800;
  font-size: 16px;
  display: grid;
  place-items: center;
}
.qty-ctl button:active { background: var(--accent-soft); border-color: var(--accent); color: var(--accent); }
.qty-ctl span { min-width: 20px; text-align: center; font-weight: 800; }

.cash-box {
  background: var(--surface-2);
  border-radius: 14px;
  padding: 13px;
  display: flex;
  flex-direction: column;
  gap: 10px;
}
.cash-quick { display: grid; grid-template-columns: repeat(4, 1fr); gap: 6px; }
.cash-quick .btn { min-height: 38px; padding: 6px 4px; font-size: 12.5px; border-radius: 10px; }
.cash-quick .btn[aria-pressed="true"] { background: var(--fg); color: var(--bg); border-color: var(--fg); }
.cash-change {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 8px;
  background: var(--surface);
  border-radius: 11px;
  padding: 10px 12px;
  border: 1px solid var(--line-soft);
}
.cash-change b { font-family: var(--f-display); font-size: 24px; }
.cart-total {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  padding: 6px 2px 2px;
}
.cart-total .big { font-size: 32px; }

/* ---------- Inventario y cocina ---------- */
.inv3 {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 8px;
}
.inv3.two { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.inv3 > div {
  background: var(--surface-2);
  border-radius: 12px;
  padding: 9px 10px;
  display: flex;
  flex-direction: column;
  gap: 2px;
}
.inv3 b { font-family: var(--f-display); font-size: 21px; line-height: 1.08; }
.inv3 span { font-size: 10px; text-transform: uppercase; letter-spacing: 0.06em; color: var(--muted); font-weight: 700; }
.inv3 em { font-style: normal; font-size: 11px; color: var(--muted); }

.kgrid { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 13px; }
.kcard {
  background: var(--surface);
  border: 1px solid var(--line-soft);
  border-radius: var(--r);
  padding: 16px;
  display: flex;
  flex-direction: column;
  gap: 10px;
  box-shadow: var(--sh-sm);
}
.kstep {
  width: 32px;
  height: 32px;
  border-radius: 11px;
  background: var(--accent-soft);
  color: var(--accent);
  font-family: var(--f-display);
  font-weight: 800;
  display: grid;
  place-items: center;
  flex: none;
}
.kstep.md { background: var(--gold-soft); color: var(--gold); }
.kcard-hd { display: flex; align-items: center; gap: 10px; }
.kcard h4 { font-size: 15.5px; font-weight: 800; }

.mdrow {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(152px, 1fr));
  gap: 9px;
}
.mdchip {
  display: flex;
  align-items: center;
  gap: 9px;
  background: var(--surface-2);
  border-radius: 12px;
  padding: 8px 10px;
}
.pimg-sm { width: 38px; height: 30px; object-fit: cover; border-radius: 8px; flex: none; }
.mdchip .pimg-sm { width: 34px; height: 26px; object-fit: cover; border-radius: 7px; flex: none; }
.mdchip .pill { margin-left: auto; }

/* Listas / Tickets / Empty States */
.tlist { display: flex; flex-direction: column; }
.trow {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 10px;
  padding: 12px 0;
  border-bottom: 1px solid var(--line-soft);
  align-items: center;
}
.trow:last-child { border-bottom: 0; }
.trow.cancelled { opacity: 0.56; }
.trow.cancelled .t-amount { text-decoration: line-through; }
.sale-x {
  width: 30px;
  height: 30px;
  border-radius: 9px;
  border: 1px solid color-mix(in srgb, var(--bad) 26%, transparent);
  background: var(--bad-soft);
  color: var(--bad);
  font-size: 13px;
  font-weight: 800;
  display: grid;
  place-items: center;
  flex: none;
  transition: transform 0.1s, background 0.14s, color 0.14s;
}
.sale-x:active { transform: scale(0.92); background: var(--bad); color: #fff; }
@media (hover: hover) { .sale-x:hover { background: var(--bad); color: #fff; } }

/* Fila destacada por sucursal en Ventas en tiempo real */
.live-list { display: flex; flex-direction: column; gap: 9px; }
.live-row {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 10px;
  align-items: center;
  padding: 11px 12px 11px 13px;
  border-radius: 14px;
  background: var(--surface-2);
  border: 1px solid var(--line-soft);
  border-left: 4px solid #FFFFFF;
}
.live-row.cancelled { opacity: 0.55; }
.live-row.cancelled .t-amount { text-decoration: line-through; }

.live-b-tag {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 3px 10px;
  border-radius: 99px;
  background: #181C26;
  border: 1px solid rgba(255, 255, 255, 0.42);
  color: #FFFFFF;
  font-family: var(--f-display);
  font-size: 13.5px;
  font-weight: 800;
  letter-spacing: 0.01em;
  line-height: 1.2;
}
.live-b-tag .dot { width: 7px; height: 7px; background: #FFFFFF; box-shadow: 0 0 6px rgba(255, 255, 255, 0.7); }

select.live-filter {
  width: auto;
  min-width: 152px;
  max-width: 220px;
  min-height: 40px;
  padding: 7px 36px 7px 15px;
  border-radius: 12px;
  font-size: 14px;
  font-weight: 700;
  background-color: var(--pay-bg);
  border: 1.5px solid var(--pay-bd);
  color: var(--pay-fg);
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='16' height='16' viewBox='0 0 24 24' fill='none' stroke='%2394A3B8' stroke-width='2.5' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='m6 9 6 6 6-6'/%3E%3C/svg%3E");
  background-position: right 11px center;
  background-size: 16px;
  cursor: pointer;
}
select.live-filter option {
  background: var(--surface);
  color: var(--fg);
}

.empty-state {
  padding: 26px 14px;
  text-align: center;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 6px;
  color: var(--muted);
}
.empty-state b { color: var(--fg); font-size: 14px; }

/* Catálogo e imágenes */
.upgrid { display: grid; grid-template-columns: repeat(auto-fill, minmax(220px, 1fr)); gap: 13px; }
.upcard {
  border: 1px solid var(--line-soft);
  border-radius: var(--r);
  padding: 13px;
  display: flex;
  flex-direction: column;
  gap: 10px;
  background: var(--surface);
  box-shadow: var(--sh-sm);
}
.upimg {
  width: 100%;
  aspect-ratio: 4 / 3;
  object-fit: cover;
  border-radius: 12px;
  background: var(--surface-2);
}
svg.upimg { padding: 14px; }

/* Promos / Temporada */
.card-list { display: grid; grid-template-columns: repeat(auto-fill, minmax(280px, 1fr)); gap: 13px; }
.pcard { display: flex; flex-direction: column; gap: 10px; }
.pcard.off { opacity: 0.6; }
.pcard-hd { display: flex; justify-content: space-between; align-items: flex-start; gap: 10px; }
.pcard .price { font-family: var(--f-display); font-size: 24px; font-weight: 800; color: var(--accent); }

/* Mensaje WhatsApp */
.msg-box {
  background: var(--surface-2);
  border-radius: 14px;
  padding: 16px;
  font-family: ui-monospace, "SF Mono", Menlo, monospace;
  font-size: 12.5px;
  white-space: pre-wrap;
  line-height: 1.58;
  max-height: 440px;
  overflow: auto;
}

/* Barras de producto */
.bar-track {
  height: 11px;
  background: var(--surface-2);
  border-radius: 99px;
  overflow: hidden;
  margin-top: 6px;
}
.bar-fill { height: 100%; border-radius: 99px; transition: width 0.3s ease; }

/* ---------- Overlays: Scrim, Drawer, Bottom Sheet, Toast ---------- */
.scrim {
  position: fixed;
  inset: 0;
  background: rgba(12, 10, 8, 0.52);
  backdrop-filter: blur(4px);
  -webkit-backdrop-filter: blur(4px);
  z-index: 30;
}

.drawer {
  position: fixed;
  top: 0;
  right: 0;
  bottom: 0;
  width: min(420px, 100%);
  background: var(--surface);
  border-left: 1px solid var(--line-soft);
  z-index: 40;
  display: flex;
  flex-direction: column;
  transform: translateX(100%);
  transition: transform 0.24s cubic-bezier(0.22, 1, 0.36, 1);
  padding-top: env(safe-area-inset-top, 0px);
  padding-bottom: env(safe-area-inset-bottom, 0px);
  visibility: hidden;
  box-shadow: -12px 0 36px rgba(0, 0, 0, 0.18);
}
.drawer.open { transform: none; visibility: visible; }
.drawer-hd {
  padding: 16px 18px;
  border-bottom: 1px solid var(--line-soft);
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 8px;
}
.drawer-list { overflow-y: auto; padding: 8px 18px; display: flex; flex-direction: column; }
.nt {
  padding: 12px 0;
  border-bottom: 1px solid var(--line-soft);
  display: flex;
  flex-direction: column;
  gap: 4px;
}
.nt.unread { box-shadow: inset 3px 0 0 var(--accent); padding-left: 11px; }
.nt-meta { display: flex; align-items: center; gap: 7px; font-size: 12px; color: var(--muted); }

/* Sheet (Modal escritorio · Bottom Sheet móvil) */
.sheet {
  position: fixed;
  z-index: 45;
  background: var(--surface);
  box-shadow: var(--sh-sheet);
  display: flex;
  flex-direction: column;
  visibility: hidden;
  opacity: 0;
  transition: transform 0.26s cubic-bezier(0.22, 1, 0.36, 1), opacity 0.18s;
  top: 50%;
  left: 50%;
  width: min(540px, calc(100% - 32px));
  max-height: min(88dvh, 740px);
  border-radius: 24px;
  border: 1px solid var(--line-soft);
  transform: translate(-50%, -46%) scale(0.96);
}
.sheet.open {
  visibility: visible;
  opacity: 1;
  transform: translate(-50%, -50%) scale(1);
}
.sheet-handle { display: none; }
.sheet-body {
  padding: 20px 22px 24px;
  overflow-y: auto;
  display: flex;
  flex-direction: column;
  gap: 14px;
}

.more-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 10px;
}
.more-item {
  border: 1px solid var(--line-soft);
  background: var(--surface-2);
  border-radius: 16px;
  padding: 16px 14px;
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 10px;
  text-align: left;
  font-weight: 700;
  font-size: 13.5px;
  transition: transform 0.08s;
}
.more-item:active { transform: scale(0.97); }
.more-item svg { width: 22px; height: 22px; color: var(--accent); }
.more-item.active { border-color: var(--accent); background: var(--accent-soft); }

.cartbar { display: none; }
.bnav { display: none; }

.toast {
  position: fixed;
  left: 50%;
  bottom: calc(22px + env(safe-area-inset-bottom, 0px));
  transform: translateX(-50%);
  background: #141210;
  color: #fff;
  padding: 12px 20px;
  border-radius: 14px;
  font-weight: 700;
  font-size: 13.5px;
  z-index: 60;
  max-width: calc(100% - 32px);
  box-shadow: 0 12px 32px rgba(0, 0, 0, 0.32);
  text-align: center;
}

/* ---------- Breakpoints ---------- */
@media (max-width: 1140px) {
  .hero-bento { grid-template-columns: 1fr; }
  .g4 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .kgrid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .pos-layout { grid-template-columns: minmax(0, 1fr) 330px; }
}

/* ---------- Vista de Teléfono (<= 920px) ---------- */
@media (max-width: 920px) {
  .app { grid-template-columns: 1fr; }
  .side { display: none; }
  .top {
    padding: calc(9px + env(safe-area-inset-top, 0px)) 14px 9px;
    gap: 9px;
  }
  .top-brand-m { display: block; }
  .top h2 { font-size: 17.5px; }
  .branch-sel { max-width: 126px; font-size: 12px; padding: 6px 26px 6px 10px; min-height: 36px; }
  .status-dot .st-txt { display: none; }
  .status-dot { padding: 7px; }

  .view {
    padding: 14px 14px calc(var(--bnav-h) + 30px + env(safe-area-inset-bottom, 0px));
    gap: 14px;
  }
  .has-cartbar .view {
    padding-bottom: calc(var(--bnav-h) + 104px + env(safe-area-inset-bottom, 0px));
  }

  .pos-layout { grid-template-columns: 1fr; }
  .cart-desk { display: none; }
  .g2, .g3 { grid-template-columns: 1fr; }
  .hero-card { padding: 18px; border-radius: 20px; }

  /* Bottom Bar estilo Material 3 / iOS con indicador cápsula */
  .bnav:not([hidden]) {
    display: grid;
    grid-auto-flow: column;
    grid-auto-columns: 1fr;
    position: fixed;
    left: 0;
    right: 0;
    bottom: 0;
    z-index: 25;
    background: color-mix(in srgb, var(--surface) 90%, transparent);
    backdrop-filter: blur(20px);
    -webkit-backdrop-filter: blur(20px);
    border-top: 1px solid var(--line-soft);
    padding: 6px 4px calc(7px + env(safe-area-inset-bottom, 0px));
    min-height: calc(var(--bnav-h) + env(safe-area-inset-bottom, 0px));
    box-shadow: 0 -4px 20px rgba(0, 0, 0, 0.06);
  }
  .bnav button {
    all: unset;
    box-sizing: border-box;
    cursor: pointer;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 2px;
    padding: 3px 1px;
    min-width: 0;
    color: var(--muted);
    font-size: 10px;
    font-weight: 700;
    letter-spacing: -0.01em;
    position: relative;
  }
  .bnav .bnav-ico {
    width: 40px;
    height: 28px;
    border-radius: 99px;
    display: grid;
    place-items: center;
    transition: background 0.16s, color 0.16s, transform 0.1s;
  }
  .bnav button svg { width: 19px; height: 19px; }
  .bnav button span:not(.bnav-ico):not(.bnav-dot) {
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    max-width: 100%;
  }
  .bnav button:active .bnav-ico { transform: scale(0.92); }
  .bnav button[aria-current="true"] { color: var(--accent); }
  .bnav button[aria-current="true"] .bnav-ico {
    background: var(--accent-soft);
    color: var(--accent);
  }
  .bnav .bnav-dot {
    position: absolute;
    top: 3px;
    right: calc(50% - 14px);
    width: 7px;
    height: 7px;
    border-radius: 50%;
    background: var(--bad);
    border: 1.5px solid var(--surface);
  }

  /* Barra flotante de carrito móvil */
  .cartbar:not([hidden]) {
    display: flex;
    position: fixed;
    left: 12px;
    right: 12px;
    bottom: calc(var(--bnav-h) + 10px + env(safe-area-inset-bottom, 0px));
    z-index: 26;
    background: var(--hero-bg);
    color: #fff;
    border-radius: 18px;
    padding: 10px 12px;
    align-items: center;
    justify-content: space-between;
    gap: 10px;
    box-shadow: 0 10px 28px rgba(18, 12, 9, 0.35);
    border: 1px solid rgba(255, 255, 255, 0.12);
  }
  .cb-info { display: flex; align-items: center; gap: 11px; min-width: 0; }
  .cb-n {
    min-width: 34px;
    height: 34px;
    border-radius: 11px;
    background: linear-gradient(135deg, var(--accent), var(--accent-2));
    color: #fff;
    font-family: var(--f-display);
    font-weight: 800;
    font-size: 15px;
    display: grid;
    place-items: center;
    padding: 0 8px;
  }
  .cb-info b { display: block; font-family: var(--f-display); font-size: 20px; line-height: 1.05; }
  .cb-info .small { opacity: 0.78; font-size: 11.5px; }
  .cartbar .btn {
    background: #fff;
    border-color: #fff;
    color: #141210;
    min-height: 40px;
    padding: 8px 15px;
    border-radius: 12px;
    font-weight: 800;
  }

  /* Bottom Sheet nativo en móvil */
  .sheet {
    top: auto;
    left: 0;
    right: 0;
    bottom: 0;
    width: 100%;
    max-height: 90dvh;
    border-radius: 26px 26px 0 0;
    border: 0;
    border-top: 1px solid var(--line-soft);
    transform: translateY(100%);
    padding-bottom: env(safe-area-inset-bottom, 0px);
  }
  .sheet.open { transform: translateY(0); }
  .sheet-handle {
    display: flex;
    justify-content: center;
    padding: 11px 0 4px;
  }
  .sheet-handle span {
    width: 42px;
    height: 4.5px;
    border-radius: 99px;
    background: var(--line);
  }
  .sheet-body { padding: 10px 16px 22px; }

  .toast {
    bottom: calc(var(--bnav-h) + 14px + env(safe-area-inset-bottom, 0px));
  }
  .has-cartbar .toast {
    bottom: calc(var(--bnav-h) + 88px + env(safe-area-inset-bottom, 0px));
  }
}

@media (max-width: 560px) {
  .ptiles { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px; }
  .tiles-md { grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 8px; }
  .tiles-md .mtile { padding: 9px 6px; }
  .tiles-md .mtile b { font-size: 12px; }
  .kgrid { grid-template-columns: 1fr; }
  .form.cols2 { grid-template-columns: 1fr; }
  .kpi .val { font-size: 22px; }
  .panel { padding: 14px; }
  .g4 { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px; }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { transition: none !important; animation: none !important; }
}
