/* ============================================================================
   Administración · tablero claro: blanco, aireado y verde.
   Solo esta app cambia de tema: los tokens de css/base.css se sobrescriben aquí,
   así el POS, Cocina y el Menú siguen como estaban.
   ============================================================================ */

:root {
  color-scheme: light;

  --bg:        #F5F7F9;   /* lienzo */
  --side:      #FFFFFF;   /* navegación */
  --surface:   #FFFFFF;   /* tarjetas y paneles */
  --surface-2: #F3F5F8;   /* campos y hovers */
  --surface-3: #E9EDF1;

  --line:   #E7EAEE;
  --line-2: #D7DCE2;

  --text:   #17241C;
  --text-2: #4B5560;
  --muted:  #8B959F;

  --accent:        #1BA45B;
  --accent-strong: #15874B;
  --accent-soft:   rgba(27, 164, 91, 0.10);

  --maiz:  #E9A23B;   /* el segundo color del tablero */
  --lime:  #1BA45B;
  --cielo: #4C93D9;

  --ok:        #1BA45B;
  --ok-text:   #15874B;
  --ok-soft:   rgba(27, 164, 91, 0.12);
  --warn:      #B8791A;
  --warn-soft: rgba(233, 162, 59, 0.16);
  --bad:       #E0575B;
  --bad-text:  #C33B40;

  --radius:    14px;
  --radius-sm: 11px;
  --radius-lg: 20px;

  /* Tipografía moderna: Segoe UI Variable (la de Windows 11) con su corte Display
     para titulares; si el equipo tiene Inter o Manrope se usan; y si no, las de
     siempre. Nada se descarga: la app funciona en la red del local, sin internet. */
  --font:         "Segoe UI Variable Text", "Segoe UI Variable", "Inter", "Manrope", "Segoe UI", system-ui, -apple-system, sans-serif;
  --font-display: "Segoe UI Variable Display", "Segoe UI Variable", "Inter", "Manrope", "SF Pro Display", "Segoe UI", system-ui, sans-serif;

  --sh-1: 0 1px 2px rgba(23, 36, 28, 0.06);
  --sh-2: 0 8px 24px rgba(23, 36, 28, 0.10);
  --sh-3: 0 24px 60px rgba(23, 36, 28, 0.18);
}

/* Sobre blanco el grano se notaría como suciedad: casi fuera. */
body::before { opacity: 0.012; }

/* --- Retoques a las piezas de base.css, para el tema claro ------------------- */
h1, h2, h3 { font-family: var(--font-display); letter-spacing: -0.01em; }
.btn { background: var(--surface); border: 1px solid var(--line-2); font-weight: 600; }
.btn:hover:not(:disabled) { background: var(--surface-2); }
.btn.primary {
  background: var(--accent); border-color: transparent; color: #fff;
  box-shadow: 0 2px 8px rgba(27, 164, 91, 0.26);
}
.btn.primary:hover:not(:disabled) { background: var(--accent-strong); box-shadow: 0 4px 14px rgba(27, 164, 91, 0.30); }
.btn.ghost { background: transparent; border-color: var(--line-2); }
.btn.danger { background: transparent; border-color: rgba(224, 87, 91, 0.5); color: var(--bad-text); }
.btn.danger:hover:not(:disabled) { background: rgba(224, 87, 91, 0.10); }
.icon-btn { color: var(--text-2); }
.icon-btn:hover { background: var(--surface-2); color: var(--text); }
.icon-btn.danger:hover { color: var(--bad-text); background: rgba(224, 87, 91, 0.10); }
.input { background: var(--surface-2); border-color: transparent; }
.input:hover { background: #EDF0F4; border-color: transparent; }
.input:focus { background: var(--surface); border-color: var(--accent); box-shadow: 0 0 0 3px var(--accent-soft); }
.chip { background: var(--surface); border-color: var(--line-2); color: var(--text-2); font-weight: 600; }
.chip:hover { background: var(--surface-2); color: var(--text); }
.chip.active { background: var(--accent-soft); border-color: var(--accent); color: var(--accent-strong); box-shadow: none; }
.badge { background: var(--surface-2); color: var(--text-2); }
.badge.ok { background: var(--ok-soft); color: var(--ok-text); }
.badge.warn { background: var(--warn-soft); color: var(--warn); }
.badge.bad { background: rgba(224, 87, 91, 0.12); color: var(--bad-text); }
.card { box-shadow: none; }
.logo-mark { background: var(--accent); box-shadow: none; }
.switch span { background: var(--surface-3); }
.switch input:checked + span { background: var(--accent); }
.modal-back { background: rgba(23, 36, 28, 0.35); }
.modal-actions { background: linear-gradient(180deg, transparent, rgba(23, 36, 28, 0.03)); }
.toast { background: var(--surface); box-shadow: var(--sh-2); }
.toast.err { border-color: rgba(224, 87, 91, 0.45); }
.toast.ok { border-color: rgba(27, 164, 91, 0.45); }
.toast::before { background: var(--cielo); }
.toast.err::before { background: var(--bad); }
.toast.ok::before { background: var(--accent); }
.keypad button { background: var(--surface); border-color: var(--line); }
.keypad button:hover:not(:disabled) { background: var(--surface-2); }
.keypad .go { background: var(--accent); border-color: transparent; }
.pimg.ph { color: #7E8C84; background: linear-gradient(145deg, #F1F4F2, #E4EAE6); box-shadow: inset 0 0 0 1px rgba(23, 36, 28, 0.05); }
::selection { color: var(--accent-strong); }

/* Administración: navegación lateral · ventas · editor de menú · ajustes */

.shell { display: grid; grid-template-columns: 244px minmax(0, 1fr); height: 100%; }

/* --- Navegación ----------------------------------------------------------- */
.side {
  background: var(--side); border-right: 1px solid var(--line);
  display: flex; flex-direction: column; gap: 16px; padding: 18px 14px; min-height: 0;
}
.side-brand { display: flex; align-items: center; gap: 12px; padding: 4px 6px 14px; border-bottom: 1px solid var(--line); }
.side-brand .logo-mark { width: 44px; height: 44px; border-radius: 14px; font-size: 20px; flex: none; }
.brand-name {
  font-family: var(--font-display); font-weight: 700; font-size: 18px; line-height: 1.15;
  color: var(--accent); letter-spacing: -0.01em; overflow-wrap: anywhere;
}
.nav-list { display: grid; gap: 4px; }
.nav-link {
  position: relative; display: flex; align-items: center; gap: 12px; width: 100%;
  padding: 12px 14px; border-radius: 12px;
  color: var(--text-2); font-weight: 600; text-decoration: none;
  transition: background var(--dur) var(--ease), color var(--dur) var(--ease);
}
.nav-link:hover { background: var(--surface-2); color: var(--text); }
/* La sección activa se marca como el riel del POS: verde suave y barrita a la izquierda. */
.nav-link.active { background: var(--accent-soft); color: var(--accent-strong); box-shadow: none; }
.nav-link.active::before {
  content: ""; position: absolute; left: 0; top: 50%; height: 52%; width: 3px; border-radius: 3px;
  background: var(--accent); transform: translateY(-50%);
}
.side .spacer { flex: 1; }
/* Salir, abajo: discreto, y se tiñe de rojo al pasar el ratón. */
.nav-link.salir { margin-top: 10px; padding-top: 16px; border-top: 1px solid var(--line); border-radius: 0; color: var(--muted); }
.nav-link.salir:hover { background: transparent; color: var(--bad-text); }

.content { overflow: auto; height: 100%; padding: 24px 28px 64px; overscroll-behavior: contain; }
.view {
  display: grid; gap: 18px; max-width: 1280px; margin: 0 auto; align-content: start;
  transition: opacity var(--dur) var(--ease);
  animation: rise 340ms var(--ease-out) both;
}
.view.narrow { max-width: 760px; }
.view.loading { opacity: 0.5; }

/* --- Filtros --------------------------------------------------------------- */
.filters {
  display: flex; flex-wrap: wrap; align-items: center; gap: 12px 20px;
  padding: 12px 16px; border-radius: var(--radius);
  background: var(--surface); border: 1px solid var(--line);
}
.f-group { display: flex; align-items: center; gap: 8px; }
.f-group.right { margin-left: auto; }
.f-group.grow { flex: 1; min-width: 200px; max-width: 420px; }
.filters .input[type="date"] { width: 160px; }
.chip.sm { min-height: 36px; padding: 0 14px; font-size: 13.5px; }
.segmented {
  display: inline-flex; background: var(--surface-2); border: 1px solid var(--line);
  border-radius: 13px; padding: 3px; gap: 2px;
}
.segmented button {
  display: inline-flex; align-items: center; gap: 6px; padding: 7px 14px; border-radius: 10px;
  font-weight: 600; font-size: 13.5px; color: var(--text-2);
  transition: background var(--dur) var(--ease), color var(--dur) var(--ease);
}
.segmented button:hover { color: var(--text); }
.segmented button.on { background: var(--surface-3); color: var(--text); box-shadow: var(--sh-1); }
.segmented.sm button { padding: 5px 11px; font-size: 12.5px; }

/* --- KPIs ------------------------------------------------------------------- */
.kpis { display: grid; grid-template-columns: minmax(0, 1.6fr) repeat(3, minmax(0, 1fr)); gap: 14px; }

/* El dato del día, en grande: es lo primero que quiere ver el dueño. */
.card.hero {
  position: relative; overflow: hidden; padding: 22px 24px; display: grid; align-content: center; gap: 4px;
  background: var(--surface); border-color: var(--line); box-shadow: var(--sh-2);
}
.card.hero::after {
  content: ""; position: absolute; right: -60px; top: -60px; width: 220px; height: 220px; border-radius: 50%;
  background: radial-gradient(circle, var(--accent-soft) 0%, transparent 70%); pointer-events: none;
}
.hero-num {
  font-family: var(--font-display); font-size: 58px; font-weight: 800; line-height: 1;
  letter-spacing: -0.03em; margin: 6px 0 4px; overflow-wrap: anywhere;
  font-variant-numeric: tabular-nums;
}
.card.tile { display: grid; gap: 4px; align-content: center; padding: 18px 20px; border-top: 0; border-left: 3px solid var(--surface-3); }
.card.tile:nth-child(2) { border-left-color: var(--accent); }
.card.tile:nth-child(3) { border-left-color: var(--maiz); }
.card.tile:nth-child(4) { border-left-color: var(--cielo); }
.tile-num {
  font-family: var(--font-display); font-size: 32px; font-weight: 800; line-height: 1.1;
  letter-spacing: -0.01em; overflow-wrap: anywhere;
}
.num-prop { font-variant-numeric: normal; }
.pad { padding: 18px 20px; }

/* --- Paneles ------------------------------------------------------------------ */
.panel { padding: 18px 20px 20px; min-width: 0; }
.panel-head { display: flex; align-items: flex-start; justify-content: space-between; gap: 12px; margin-bottom: 16px; }
.panel-head h2 { font-size: 17px; }
.panel-head .muted.small { margin-top: 3px; }
.stack-sm { display: grid; gap: 10px; }
.acciones-pin { display: flex; flex-wrap: wrap; gap: 10px; }
.panel-head .badge { white-space: nowrap; flex: none; }
/* Tarjeta de cobros: barras por método + totales sueltos debajo. */
.cobros { display: grid; gap: 12px; }
.cobros-extra { display: grid; gap: 2px; }
.cobros-row { display: flex; justify-content: space-between; gap: 12px; }

/* --- Gráficas --------------------------------------------------------------- */
.chart { position: relative; width: 100%; }
.chart svg { display: block; overflow: visible; }
.c-grid { stroke: var(--line); stroke-width: 1; }
.c-axis { stroke: var(--line-2); stroke-width: 1; }
.c-tick { fill: var(--muted); font-size: 11px; font-variant-numeric: tabular-nums; }
.c-tick-sel { fill: var(--text); font-weight: 700; }
.c-bar { fill: var(--accent); transition: opacity 140ms var(--ease), fill 140ms var(--ease); }
.c-bar.dim { opacity: 0.5; }
.c-bar.hover { opacity: 1; fill: var(--maiz); }
.c-val { fill: var(--text); font-size: 12px; font-weight: 700; font-variant-numeric: tabular-nums; }
.c-hit { fill: transparent; cursor: default; }
[role="button"].c-hit { cursor: pointer; }
.c-hit:focus-visible { outline: 2px solid var(--accent); outline-offset: -2px; }
.tip {
  position: absolute; z-index: 5; pointer-events: none; display: grid; gap: 2px; padding: 9px 12px;
  background: var(--surface-3); border: 1px solid var(--line-2); border-radius: 12px;
  box-shadow: var(--sh-2); font-size: 12.5px; white-space: nowrap;
}
.tip strong { font-size: 16px; font-family: var(--font-num); }

.hbars { list-style: none; margin: 0; padding: 0; display: grid; gap: 16px; }
.hb-head { display: flex; align-items: baseline; gap: 10px; min-width: 0; }
.hb-rank {
  width: 22px; height: 22px; flex: none; display: grid; place-items: center; border-radius: 7px;
  background: var(--surface-3); color: var(--text-2); font-family: var(--font-num); font-size: 12px;
}
.hb-label { font-weight: 600; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.hb-row { display: flex; align-items: center; gap: 12px; margin-top: 7px; padding-left: 32px; }
.hb-track { flex: 1; height: 11px; background: var(--surface-2); border-radius: 999px; overflow: hidden; }
.hb-track i {
  display: block; height: 100%; width: 100%; border-radius: 999px;
  background: linear-gradient(90deg, var(--accent), var(--maiz));
  transform: scaleX(var(--p, 0)); transform-origin: left; transition: transform 420ms var(--ease-out);
}
.hb-val { min-width: 80px; text-align: right; font-weight: 700; white-space: nowrap; font-family: var(--font-num); }
.hb-sub { padding-left: 32px; margin-top: 3px; color: var(--muted); font-size: 12.5px; }

.tbl-wrap { overflow: auto; border-radius: var(--radius-sm); }
.tbl { width: 100%; border-collapse: collapse; font-size: 14px; }
.tbl th, .tbl td { padding: 11px 13px; border-bottom: 1px solid var(--line); text-align: left; vertical-align: middle; }
.tbl thead th {
  position: sticky; top: 0; z-index: 2; color: var(--muted); font-size: 11.5px; font-weight: 600;
  white-space: nowrap; text-transform: uppercase; letter-spacing: 0.1em;
  background: var(--surface);
}
.tbl tbody tr { transition: background var(--dur) var(--ease); }
.tbl tbody tr:hover { background: var(--surface-2); }
.tbl .r { text-align: right; }
.tbl td.num { font-family: var(--font-num); }
.tbl tr.dim td { opacity: 0.45; }
.tbl .items-cell { max-width: 360px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; color: var(--text-2); }

/* --- Menú: espacio de trabajo a pantalla completa ---------------------------- */
/* La vista del menú ocupa todo el alto y el ancho: la barra queda fija y el riel y la lista se
   desplazan por separado. (La clase "flush" la pone main.js solo en esta sección.) */
.content.flush { padding: 0; overflow: hidden; }
.view.menu { max-width: none; width: 100%; height: 100%; margin: 0; gap: 0; grid-template-rows: auto minmax(0, 1fr); }

/* Barra superior: título y resumen · buscador · Productos/Extras y agregar. */
.mn-bar {
  display: flex; align-items: center; flex-wrap: wrap; gap: 12px 24px;
  padding: 14px 28px; background: var(--surface); border-bottom: 1px solid var(--line);
}
.mn-title { display: grid; gap: 2px; min-width: 170px; }
.mn-title h1 { font-family: var(--font-display); font-size: 25px; line-height: 1.1; text-transform: none; letter-spacing: -0.02em; }
.mn-stats { font-size: 13.5px; color: var(--muted); }
.mn-stats-bad { color: var(--bad-text); font-weight: 600; }
.mn-search { position: relative; flex: 1 1 300px; max-width: 580px; }
.mn-search > svg { position: absolute; left: 15px; top: 50%; transform: translateY(-50%); color: var(--muted); pointer-events: none; }
.mn-search .input { padding-left: 44px; border-radius: 999px; min-height: 48px; font-size: 15.5px; }
.mn-bar-r { margin-left: auto; display: flex; align-items: center; gap: 12px; }
.mn-bar-r .segmented button { min-height: 40px; padding: 0 20px; font-size: 15px; }
.mn-bar-r .btn { min-height: 48px; padding: 0 22px; font-size: 15.5px; }

.mn-body { display: grid; grid-template-columns: 276px minmax(0, 1fr); min-height: 0; }

/* Riel: categorías y, en la activa, sus subcategorías. */
.mn-rail {
  display: flex; flex-direction: column; gap: 4px; overflow-y: auto; overscroll-behavior: contain;
  padding: 18px 14px 28px; background: var(--surface); border-right: 1px solid var(--line);
}
.mn-rail-title {
  padding: 6px 12px 10px; font-size: 12px; font-weight: 700; letter-spacing: 0.08em; text-transform: uppercase; color: var(--muted);
}
/* Categoría: ícono con su color, nombre, cantidad de productos y aviso de agotados. */
.mn-rail-group { --tint: hsl(var(--h, 150) 60% 95%); --tint-2: hsl(var(--h, 150) 45% 86%); --ink: hsl(var(--h, 150) 55% 28%); --solid: hsl(var(--h, 150) 52% 38%); }
.mn-rail-title { display: flex; align-items: center; justify-content: space-between; }
.mn-rail-n { padding: 0 8px; border-radius: 999px; background: var(--surface-3); color: var(--text-2); font-family: var(--font-num); font-size: 12px; letter-spacing: 0; }
.mn-cat-row { display: flex; align-items: stretch; gap: 2px; }
.mn-cat {
  position: relative; flex: 1; min-width: 0; min-height: 60px; display: flex; align-items: center; gap: 12px; text-align: left;
  padding: 8px 10px; border-radius: 16px; border: 1px solid transparent; color: var(--text-2);
  transition: background var(--dur) var(--ease), border-color var(--dur) var(--ease), color var(--dur) var(--ease);
}
.mn-cat:hover { background: var(--surface-2); color: var(--text); }
.mn-cat.active { background: var(--tint); border-color: var(--tint-2); color: var(--ink); }
.mn-ico {
  width: 40px; height: 40px; flex: none; display: grid; place-items: center; border-radius: 13px;
  background: var(--tint); color: var(--solid); transition: background var(--dur) var(--ease), color var(--dur) var(--ease);
}
.mn-cat.active .mn-ico { background: var(--solid); color: #fff; }
.mn-cat-txt { flex: 1; min-width: 0; display: grid; gap: 1px; }
.mn-cat-name { min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-size: 16.5px; font-weight: 700; line-height: 1.2; }
.mn-cat-top { display: flex; align-items: center; gap: 8px; min-width: 0; }
.mn-cat-sub { font-size: 12.5px; font-weight: 500; color: var(--muted); white-space: nowrap; }
.mn-cat.active .mn-cat-sub { color: var(--ink); opacity: 0.8; }
.mn-cat-bad {
  flex: none; min-width: 20px; padding: 0 7px; border-radius: 999px; text-align: center;
  background: rgba(224, 87, 91, 0.14); color: var(--bad-text); font-family: var(--font-num); font-size: 12px; font-weight: 700; line-height: 20px;
}
.mn-count { font-family: var(--font-num); font-size: 13px; font-weight: 600; color: var(--muted); }
.mn-cat .mn-count { display: none; }
.mn-dot { width: 8px; height: 8px; flex: none; border-radius: 50%; background: var(--bad); }
.mn-chev { width: 36px; flex: none; display: grid; place-items: center; border-radius: 12px; color: var(--muted); transition: background var(--dur) var(--ease), color var(--dur) var(--ease); }
.mn-chev:hover { background: var(--surface-2); color: var(--text); }
.mn-chev svg { transition: transform 200ms var(--ease-out); }
.mn-rail-group.open .mn-chev svg { transform: rotate(180deg); }
.mn-subs { display: grid; grid-template-columns: minmax(0, 1fr); gap: 2px; margin: 4px 0 10px 29px; padding-left: 12px; border-left: 2px solid var(--tint-2); }
.mn-sub {
  display: flex; align-items: center; gap: 8px; width: 100%; text-align: left;
  padding: 9px 12px; border-radius: 11px; font-size: 14.5px; font-weight: 550; color: var(--text-2);
}
.mn-sub:hover { background: var(--surface-2); color: var(--text); }
.mn-sub.on { background: var(--tint); color: var(--ink); font-weight: 700; }
.mn-sub-name { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.mn-rail-note { margin-top: auto; padding: 20px 12px 0; font-size: 12.5px; line-height: 1.45; color: var(--muted); }

/* Zona de trabajo: usa todo el ancho disponible; las columnas internas se acomodan solas. */
.mn-main { container: mn / inline-size; min-width: 0; overflow-y: auto; overscroll-behavior: contain; padding: 0 28px 64px; }
.mn-head {
  position: sticky; top: 0; z-index: 6; display: flex; align-items: center; flex-wrap: wrap; gap: 8px 18px;
  height: 70px; background: var(--bg);
}
.mn-head-t { display: flex; align-items: center; flex-wrap: wrap; gap: 2px 14px; min-width: 0; }
.mn-head-t h2 { font-size: 26px; text-transform: none; letter-spacing: -0.02em; overflow-wrap: anywhere; }
.mn-head-n { font-size: 14px; color: var(--muted); }
.mn-head-hint { margin-left: auto; font-size: 14px; color: var(--muted); }
.mn-filters { margin-left: auto; display: flex; flex-wrap: wrap; gap: 8px; }
.mn-filters .chip { min-height: 40px; padding: 0 16px; font-size: 14.5px; }
.mn-filters .chip .muted { font-family: var(--font-num); font-size: 12.5px; }

.mn-list { display: grid; gap: 20px; padding-top: 2px; }
.mn-sec { background: var(--surface); border: 1px solid var(--line); border-radius: 18px; }
.mn-sec-head {
  position: sticky; top: 70px; z-index: 4; display: flex; align-items: center; gap: 12px;
  min-height: 54px; padding: 6px 12px 6px 20px; background: #F9FAFB; border-bottom: 1px solid var(--line);
  border-radius: 17px 17px 0 0;
}
.mn-sec-head h3 { font-size: 17.5px; font-weight: 700; letter-spacing: -0.01em; }
.mn-pill {
  padding: 2px 11px; border-radius: 999px; background: var(--surface-3); color: var(--text-2);
  font-family: var(--font-num); font-size: 13px; font-weight: 700;
}
.mn-sec-sub { font-size: 14px; color: var(--muted); }
.mn-sec-r { margin-left: auto; display: flex; align-items: center; gap: 8px; }
/* Las acciones de renombrar aparecen al apuntar (siempre visibles en pantallas táctiles). */
.mn-sec-head > .icon-btn, .mn-head-t .icon-btn { opacity: 0; transition: opacity var(--dur) var(--ease); }
.mn-sec-head:hover > .icon-btn, .mn-head-t:hover .icon-btn, .mn-sec-head > .icon-btn:focus-visible, .mn-head-t .icon-btn:focus-visible { opacity: 1; }
.icon-btn.sm { width: 36px; height: 36px; border-radius: 11px; }

.mn-rows { display: grid; }
.mn-rows > :last-child { border-radius: 0 0 17px 17px; }

/* Fila de producto: foto · nombre · opciones (en casillas) · menú ⋯.
   Las casillas de opciones siguen una cuadrícula: precios e interruptores quedan alineados. */
.pr {
  display: grid; grid-template-columns: 60px minmax(200px, 1fr) minmax(0, 1.6fr) 40px;
  align-items: start; gap: 6px 20px; padding: 14px 14px 14px 20px; border-top: 1px solid var(--line);
  transition: background var(--dur) var(--ease);
}
.mn-rows > :first-child { border-top: 0; }
.pr:hover, .pr:focus-within { background: #FBFCFD; }
.mn-thumb { position: relative; width: 60px; height: 60px; flex: none; font-size: 17px; transition: opacity var(--dur) var(--ease); }
.mn-thumb-in {
  display: block; width: 100%; height: 100%; border-radius: 15px; overflow: hidden;
  background: var(--surface-3); border: 1px solid var(--line); transition: border-color var(--dur) var(--ease);
}
.mn-thumb:hover .mn-thumb-in { border-color: var(--accent); }
/* La "+" (subir imagen) queda en la esquina, fuera del recorte, sin tapar las iniciales. */
.mn-thumb-add {
  position: absolute; right: -6px; bottom: -6px; width: 22px; height: 22px; display: grid; place-items: center;
  border-radius: 50%; background: var(--accent); color: #fff; border: 2px solid var(--surface);
  opacity: 0; transition: opacity var(--dur) var(--ease);
}
.pr:hover .mn-thumb-add, .mn-thumb:focus-visible .mn-thumb-add { opacity: 1; }
.pr-name { min-width: 0; min-height: 60px; display: flex; flex-direction: column; justify-content: center; gap: 4px; }
.pr-name strong {
  display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden;
  font-size: 17px; line-height: 1.25;
}
.pr-meta { display: flex; align-items: center; flex-wrap: wrap; gap: 6px; }
.pr-meta:empty { display: none; }
.pr-n { font-size: 13px; color: var(--muted); }
.pr.off .pr-name strong { color: var(--muted); }
.pr.off .mn-thumb { opacity: 0.55; }
.pr > .mn-more { margin-top: 10px; }

/* Casillas de opciones: se reparten el ancho (1, 2, 3… por renglón según el espacio). */
.pr-opts { display: grid; grid-template-columns: repeat(auto-fill, minmax(320px, 1fr)); gap: 10px 14px; }
/* Producto de una sola opción: su casilla ocupa todo el espacio y el precio queda al borde derecho. */
.pr-opts.single { grid-template-columns: minmax(0, 1fr); }

/* Opción (o extra): nombre · precio · interruptor. */
.mn-opt {
  display: grid; grid-template-columns: minmax(0, 1fr) 128px 56px; align-items: center; gap: 8px;
  min-height: 56px; padding: 6px 8px 6px 16px;
  background: #F8FAFB; border: 1px solid var(--line); border-radius: 15px;
  transition: border-color var(--dur) var(--ease), background var(--dur) var(--ease);
}
.mn-opt:hover, .mn-opt:focus-within { border-color: var(--line-2); }
.mn-opt.off { background: #FEF6F6; border-color: rgba(224, 87, 91, 0.28); }
.mn-opt-name { position: relative; display: flex; align-items: center; gap: 8px; min-width: 0; font-size: 15.5px; font-weight: 600; line-height: 1.3; }
.mn-opt-label {
  min-width: 0; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; overflow-wrap: anywhere;
}
.mn-opt-label.implicit { color: var(--muted); font-weight: 600; }
.mn-opt-name .badge { flex: none; }
.mn-opt.off .mn-opt-label { color: var(--muted); text-decoration: line-through; text-decoration-color: rgba(23, 36, 28, 0.25); }
/* Agotado: el aviso va debajo del nombre (no lo parte en dos). */
.mn-opt.off .mn-opt-name { flex-direction: column; align-items: flex-start; justify-content: center; gap: 2px; }
.mn-opt.off .mn-opt-name .badge { font-size: 11.5px; padding: 1px 8px; }
/* Editar y eliminar aparecen encima del final del nombre al apuntar la casilla (o con el teclado). */
.mn-opt-acts {
  position: absolute; right: 0; top: 50%; transform: translateY(-50%); display: flex; padding-left: 24px;
  background: linear-gradient(90deg, rgba(248, 250, 251, 0), #F8FAFB 24px);
  opacity: 0; pointer-events: none; transition: opacity var(--dur) var(--ease);
}
.mn-opt.off .mn-opt-acts { background: linear-gradient(90deg, rgba(254, 246, 246, 0), #FEF6F6 24px); }
.mn-opt:hover .mn-opt-acts, .mn-opt:focus-within .mn-opt-acts { opacity: 1; pointer-events: auto; }

/* Precio: se escribe ahí mismo y se guarda al salir del campo (Enter) */
.mn-price {
  display: flex; align-items: center; gap: 6px; height: 42px; padding: 0 12px; border-radius: 12px;
  background: var(--surface); border: 1px solid var(--line-2); color: var(--muted); font-size: 15px; font-weight: 600; cursor: text;
  transition: background var(--dur) var(--ease), border-color var(--dur) var(--ease), box-shadow var(--dur) var(--ease);
}
.mn-price:hover { border-color: var(--muted); }
.mn-price:focus-within { border-color: var(--accent); box-shadow: 0 0 0 3px var(--accent-soft); }
.mn-price.saved { background: var(--ok-soft); border-color: var(--ok); }
.mn-price input {
  flex: 1; min-width: 0; height: 100%; padding: 0; border: 0; outline: 0; background: transparent; text-align: right;
  font-family: var(--font-num); font-size: 17px; font-weight: 700; color: var(--text);
  font-variant-numeric: tabular-nums; appearance: textfield; -moz-appearance: textfield;
}
.mn-price input::-webkit-outer-spin-button, .mn-price input::-webkit-inner-spin-button { appearance: none; -webkit-appearance: none; margin: 0; }

/* Interruptor de disponibilidad; rojo suave cuando está agotado. */
.mn-sw { display: inline-flex; align-items: center; justify-content: center; padding: 8px 2px; cursor: pointer; }
.mn-sw .switch { width: 46px; height: 26px; }
.mn-sw .switch span { background: var(--line-2); }
.mn-sw .switch span::after { left: 3px; top: 3px; width: 20px; height: 20px; }
.mn-sw .switch input:checked + span { background: var(--accent); }
.mn-sw .switch input:checked + span::after { transform: translateX(20px); }
.mn-opt.off .mn-sw .switch span { background: rgba(224, 87, 91, 0.4); }

/* "Agregar opción": una casilla más, punteada, al final de las opciones. */
.mn-add {
  display: flex; align-items: center; justify-content: center; gap: 8px; min-height: 56px; padding: 0 14px;
  border: 1.5px dashed var(--line-2); border-radius: 15px; color: var(--accent-strong); font-size: 15px; font-weight: 600;
  transition: background var(--dur) var(--ease), border-color var(--dur) var(--ease);
}
.mn-add:hover { background: var(--accent-soft); border-color: var(--accent); }

/* Extras: las casillas del grupo se reparten el ancho igual que las opciones. */
.mn-rows-extras { grid-template-columns: repeat(auto-fill, minmax(340px, 1fr)); gap: 12px 16px; padding: 16px 20px 20px; }

/* Menú "⋯" de la fila */
.mn-more { position: relative; flex: none; }
.mn-more .icon-btn { width: 40px; height: 40px; color: var(--text-2); }
.mn-more .icon-btn svg { stroke-width: 3.4; }
.mn-pop {
  position: absolute; right: 0; top: calc(100% + 6px); z-index: 30; min-width: 290px; display: grid; padding: 8px;
  background: var(--surface); border: 1px solid var(--line-2); border-radius: 16px; box-shadow: var(--sh-3);
  animation: fade 120ms var(--ease-out);
}
.mn-pop.up { top: auto; bottom: calc(100% + 6px); }
.mn-pop-item {
  display: flex; align-items: center; gap: 12px; width: 100%; padding: 12px 14px; border-radius: 11px;
  text-align: left; font-size: 15px; font-weight: 600; color: var(--text);
}
.mn-pop-item svg { color: var(--text-2); }
.mn-pop-item:hover, .mn-pop-item:focus-visible { background: var(--surface-2); }
.mn-pop-item.danger, .mn-pop-item.danger svg { color: var(--bad-text); }

.mn-empty { display: grid; justify-items: center; gap: 12px; padding: 72px 20px; text-align: center; color: var(--text-2); }
.mn-empty-ico { width: 72px; height: 72px; display: grid; place-items: center; border-radius: 22px; background: var(--accent-soft); color: var(--accent-strong); }
.mn-empty h3 { font-size: 20px; }

/* Cuando la zona de trabajo es angosta (tablet vertical, celular): el producto pasa a dos renglones. */
@container mn (max-width: 680px) {
  .mn-head { height: auto; min-height: 60px; padding: 8px 0; }
  .mn-sec-head { position: static; }
  .pr { grid-template-columns: 52px minmax(0, 1fr) 40px; padding: 12px 10px 12px 14px; }
  .mn-thumb { width: 52px; height: 52px; }
  .pr-name { min-height: 52px; }
  .pr > .mn-more { grid-column: 3; grid-row: 1; margin-top: 6px; }
  .pr-opts, .pr-opts.single { grid-column: 1 / -1; grid-row: 2; grid-template-columns: minmax(0, 1fr); }
  .mn-rows-extras { grid-template-columns: minmax(0, 1fr); padding: 12px; }
}
/* Selector de imagen (diálogos) y formularios */
.img-picker { display: flex; align-items: center; gap: 16px; flex-wrap: wrap; }
.img-preview {
  width: 116px; height: 116px; flex: none; border-radius: 20px; overflow: hidden;
  background: var(--surface-3); border: 1px solid var(--line); font-size: 32px; box-shadow: var(--sh-1);
}
.img-actions { display: grid; gap: 8px; justify-items: start; min-width: 0; flex: 1; }
.grid-form { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }

/* --- Responsive -------------------------------------------------------------- */
@media (max-width: 1100px) {
  .kpis { grid-template-columns: repeat(3, minmax(0, 1fr)); }
  .card.hero { grid-column: 1 / -1; }
}
@media (max-width: 820px) {
  .shell { grid-template-columns: minmax(0, 1fr); grid-template-rows: auto minmax(0, 1fr); }
  .side {
    flex-direction: row; align-items: center; gap: 8px; padding: 8px 10px;
    border-right: 0; border-bottom: 1px solid var(--line); overflow-x: auto;
  }
  .side-brand { padding: 0; flex: none; border-bottom: 0; }
  .side-brand > div:last-child { display: none; }
  .nav-list { display: flex; gap: 4px; }
  .nav-link { width: auto; padding: 10px 12px; flex: none; }
  .side .spacer { flex: 1; min-width: 4px; }
  .content { padding: 16px 14px 60px; }
  .hero-num { font-size: 46px; }
}
@media (max-width: 560px) {
  .kpis { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px; }
  .card.tile:last-child { grid-column: 1 / -1; }
  .tile-num { font-size: 25px; }
  .hero-num { font-size: 40px; }
  .grid-form { grid-template-columns: minmax(0, 1fr); }
  .f-group.right { margin-left: 0; }
}

/* ============================================================================
   Tablero: aprovecha todo el ancho y se ordena por importancia —
   primero el día, luego el mes, después los rankings y al final los pedidos.
   ============================================================================ */
/* --- Espaciado: un ritmo constante, sin aire de más -------------------------- */
@media (min-width: 821px) {
  .content { padding: 26px 30px 72px; }
}
.view { max-width: 1720px; gap: 22px; }
.view.narrow { max-width: 760px; }

/* La barra de filtros se queda pegada arriba: el día y el mes a la vista siempre. */
.filters {
  position: sticky; top: 0; z-index: 6;
  background: rgba(255, 255, 255, 0.9); backdrop-filter: blur(10px) saturate(1.2);
  box-shadow: 0 6px 18px rgba(23, 36, 28, 0.05);
}

/* Fila principal: la gráfica manda (2 partes) y el panel de apoyo acompaña (1). */
.dash-main { display: grid; grid-template-columns: minmax(0, 2fr) minmax(0, 1fr); gap: 22px; align-items: start; }
/* El panel de apoyo (cobros, categorías) baja hasta el fondo de su fila y reparte
   su contenido en el alto: así no queda un hueco debajo de él. */
.dash-main > .panel:last-child { align-self: stretch; display: flex; flex-direction: column; }
.dash-main > .panel:last-child > :last-child { flex: 1; min-height: 0; align-content: space-evenly; }
/* Rankings: se reparten solos según el ancho disponible. */
.dash-cards { display: grid; grid-template-columns: repeat(auto-fit, minmax(300px, 1fr)); gap: 22px; }

/* --- KPIs: el dato del día manda, los apoyos al lado ------------------------ */
.kpis { gap: 22px; }
.card.tile:nth-child(2) { border-left-color: var(--accent); }
.card.tile:nth-child(3) { border-left-color: var(--maiz); }
.card.tile:nth-child(4) { border-left-color: var(--cielo); }
.label {
  text-transform: uppercase; letter-spacing: 0.06em; font-size: 11.5px; font-weight: 700; color: var(--muted);
}
.tile-num { font-size: clamp(26px, 2.2vw, 34px); }
.hero-num { font-size: clamp(44px, 4.6vw, 68px); }

/* --- Paneles ----------------------------------------------------------------- */
.panel { padding: 22px 24px 24px; }
.panel-head { margin-bottom: 20px; }
.panel-head h2 { font-size: 16px; }

/* --- Tablas: encabezado pegado, filas que respiran, resalte al pasar ------- */
.tbl-wrap { max-height: 480px; overflow: auto; border: 1px solid var(--line); border-radius: var(--radius-sm); }
.tbl thead th {
  position: sticky; top: 0; z-index: 2; background: var(--surface-2); color: var(--text-2);
  text-transform: uppercase; letter-spacing: 0.05em; font-size: 11px; font-weight: 700;
}
.tbl tbody tr:hover { background: var(--surface-2); }

/* --- Rankings: pista redondeada y relleno verde ----------------------------- */
.hb-track { background: var(--surface-2); border-radius: 999px; overflow: hidden; }
.hb-track i { background: linear-gradient(90deg, var(--accent), var(--accent-strong)); border-radius: 999px; }

@media (max-width: 1180px) {
  .dash-main { grid-template-columns: minmax(0, 1fr); }
}
@media (max-width: 900px) {
  .view { gap: 14px; }
  .dash-main, .dash-cards, .kpis { gap: 14px; }
  .filters { position: static; box-shadow: none; }
  .tbl-wrap { max-height: none; }
}

/* Pantallas táctiles: toques de 40 px o más. */
@media (pointer: coarse) {
  .btn.sm { min-height: 40px; }
  .segmented button, .segmented.sm button { min-height: 40px; }
}

/* ============================================================================
   Menú: tablets, celulares y pantallas táctiles
   ============================================================================ */
@media (max-width: 1280px) {
  .mn-body { grid-template-columns: 240px minmax(0, 1fr); }
  .mn-bar { padding: 12px 22px; }
  /* título y botones arriba; el buscador, en su propio renglón a todo el ancho */
  .mn-search { order: 3; flex-basis: 100%; max-width: none; }
  .mn-main { padding: 0 20px 56px; }
}
@media (max-width: 900px) {
  /* El riel pasa a una fila de categorías arriba; las subcategorías ya son los encabezados de la lista. */
  .mn-body { grid-template-columns: minmax(0, 1fr); grid-template-rows: auto minmax(0, 1fr); }
  .mn-rail {
    flex-direction: row; align-items: center; gap: 8px; overflow-x: auto; overflow-y: hidden;
    padding: 10px 14px; border-right: 0; border-bottom: 1px solid var(--line);
  }
  .mn-rail-title, .mn-rail-note, .mn-subs { display: none; }
  .mn-rail-group { flex: none; }
  .mn-cat-row { display: block; }
  .mn-cat { flex: none; width: auto; min-height: 46px; padding: 6px 14px 6px 8px; gap: 8px; border: 1px solid var(--line-2); border-radius: 999px; background: var(--surface); }
  .mn-cat.active { border-color: var(--solid); }
  .mn-ico { width: 30px; height: 30px; border-radius: 50%; }
  .mn-ico svg { width: 18px; height: 18px; }
  .mn-cat-name { font-size: 15.5px; }
  .mn-cat-sub, .mn-chev { display: none; }
  .mn-cat .mn-count { display: inline; }
  .mn-bar { padding: 10px 14px; gap: 10px 14px; }
  .mn-main { padding: 0 14px 72px; }
}
@media (max-width: 560px) {
  .mn-title h1 { font-size: 21px; }
  .mn-add-more { display: none; }
  .mn-bar-r { width: 100%; margin-left: 0; justify-content: space-between; }
  .mn-bar-r .btn { white-space: nowrap; }
  .mn-head-t h2 { font-size: 21px; }
  .mn-filters { margin-left: 0; }
  .mn-opt { grid-template-columns: minmax(0, 1fr) 116px 52px; padding-left: 14px; }
}
@media (pointer: coarse) {
  .mn-price { height: 46px; }
  .mn-price input { font-size: 17px; }
  .mn-search .input { font-size: 16px; }
  .mn-opt { min-height: 60px; }
  .mn-sub { min-height: 44px; }
  /* sin ratón no hay "apuntar": las acciones se ven siempre y el nombre les deja su sitio */
  .mn-opt-acts { opacity: 1; pointer-events: auto; background: none; padding-left: 0; }
  .mn-opt-name { padding-right: 80px; }
  .mn-sec-head > .icon-btn, .mn-head-t .icon-btn { opacity: 1; }
  .icon-btn.sm { width: 42px; height: 42px; }
  .mn-sw { padding: 10px 4px; }
  .mn-thumb-add { opacity: 1; }
  .mn-bar-r .segmented button, .mn-filters .chip { min-height: 44px; }
}

/* ============================================================================
   Pedidos: el pedido completo (como en el punto de venta) y la sección "Pedidos"
   ============================================================================ */
/* Ventana grande para listas de pedidos. */
.modal-back.xl .modal { width: min(1120px, 100%); }
.modal-back.xl .modal-body { grid-auto-rows: max-content; padding-bottom: 22px; }
.pd-modal { display: grid; gap: 16px; }
.pd-modal-sub { margin-top: -4px; }
.pd-modal-sub::first-letter { text-transform: uppercase; }
.pd-cargando { min-height: 160px; }

/* Resumen de la lista */
.pd-stats { display: flex; flex-wrap: wrap; gap: 10px; }
.pd-stat {
  display: grid; gap: 1px; min-width: 112px; padding: 9px 14px; border-radius: 13px;
  background: var(--surface-2); border: 1px solid var(--line);
}
.pd-stat strong { font-size: 18px; font-family: var(--font-display); letter-spacing: -0.01em; }
.pd-stat.warn strong { color: var(--warn); }
.pd-stat.bad strong { color: var(--bad-text); }

/* Cuadrícula: tarjetas de la misma altura por renglón, con el cobro siempre abajo. */
.pd-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(360px, 1fr)); gap: 16px; align-items: stretch; }

.pd {
  display: flex; flex-direction: column; gap: 10px; min-width: 0; padding: 16px 18px 14px;
  background: var(--surface); border: 1px solid var(--line); border-radius: 18px;
  border-left: 4px solid var(--warn);
}
.pd.listo { border-left-color: var(--accent); }
.pd.cancelado { border-left-color: var(--line-2); background: var(--surface-2); }
.pd.cancelado .pd-items, .pd.cancelado .pd-cliente { opacity: 0.6; }
.pd-head { display: flex; align-items: center; flex-wrap: wrap; gap: 6px 10px; }
.pd-folio { font-family: var(--font-display); font-size: 21px; font-weight: 800; letter-spacing: -0.01em; color: var(--accent); }
.pd-cliente { flex: 1; min-width: 80px; font-size: 16.5px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.pd-badges { display: flex; flex-wrap: wrap; gap: 6px; }
.pd-meta { display: flex; align-items: center; flex-wrap: wrap; gap: 4px 12px; font-size: 13px; color: var(--muted); }
.pd-tipo { padding: 2px 10px; border-radius: 999px; background: var(--surface-2); color: var(--text-2); font-weight: 600; }
.pd-tipo.llevar { background: var(--accent-soft); color: var(--accent-strong); }
.pd-nota { padding: 8px 12px; border-radius: 11px; background: var(--warn-soft); color: var(--warn); font-size: 13.5px; }

.pd-items { list-style: none; margin: 0; padding: 4px 0 0; display: grid; border-top: 1px dashed var(--line-2); }
.pd-items li {
  display: grid; grid-template-columns: 22px minmax(0, 1fr) auto; align-items: start; gap: 10px;
  padding: 8px 0; border-bottom: 1px dashed var(--line);
}
.pd-items li:last-child { border-bottom: 0; }
.pd-chk {
  width: 20px; height: 20px; margin-top: 1px; display: grid; place-items: center; border-radius: 6px;
  border: 2px solid var(--line-2); color: #fff;
}
.pd-items li.sal .pd-chk { background: var(--accent); border-color: var(--accent); }
.pd-it { min-width: 0; display: grid; gap: 2px; }
.pd-it-n { font-weight: 600; overflow-wrap: anywhere; }
.pd-qty { margin-right: 6px; color: var(--accent-strong); font-family: var(--font-num); font-weight: 700; }
.pd-ex { font-size: 13px; color: var(--text-2); }
.pd-itnota { font-size: 13px; color: var(--warn); font-style: italic; }
.pd-sub { font-weight: 700; font-variant-numeric: tabular-nums; }

.pd-foot { margin-top: auto; display: grid; gap: 6px; padding-top: 10px; border-top: 1px solid var(--line); }
.pd-prog { font-size: 12.5px; color: var(--muted); }
.pd-tot { display: grid; gap: 3px; }
.pd-tot .r { display: flex; justify-content: space-between; gap: 12px; font-size: 13.5px; color: var(--text-2); }
.pd-tot .r.t { font-size: 17px; font-weight: 800; color: var(--text); }
.pd-tot .num { font-variant-numeric: tabular-nums; }
.pd.cancelado .pd-tot .r.t { text-decoration: line-through; color: var(--muted); }

/* Sección Pedidos: búsqueda, pestañas y aviso */
.pd-search { position: relative; flex: 1; min-width: 200px; }
.pd-search > svg { position: absolute; left: 13px; top: 50%; transform: translateY(-50%); color: var(--muted); pointer-events: none; }
.pd-search .input { padding-left: 40px; border-radius: 999px; }
.filters .f-group.grow { max-width: 520px; }
.pd-tabs { display: flex; flex-wrap: wrap; gap: 8px; }
.pd-tabs .chip { min-height: 40px; }
.pd-tabs .chip .muted { font-family: var(--font-num); font-size: 12.5px; }
.pd-alert {
  display: flex; align-items: center; flex-wrap: wrap; gap: 8px 12px; padding: 12px 16px; border-radius: 14px;
  background: var(--warn-soft); border: 1px solid rgba(184, 121, 26, 0.3); color: var(--warn);
}
.pd-alert .muted { color: var(--text-2); }

/* Filas clicables (tablas de las gráficas y pedidos del día) */
.tbl tbody tr.clickable { cursor: pointer; }
.tbl tbody tr.clickable:focus-visible { outline: 2px solid var(--accent); outline-offset: -2px; }

@media (max-width: 560px) {
  .pd-grid { grid-template-columns: minmax(0, 1fr); }
  .pd-stat { min-width: 0; flex: 1 1 40%; }
}

/* Celular: con cuatro secciones la barra no cabe con todos los nombres. Solo la sección activa
   muestra el suyo; las demás quedan como ícono (el nombre sigue disponible para lectores de pantalla). */
@media (max-width: 560px) {
  .side { gap: 4px; }
  .nav-list { gap: 2px; }
  .nav-link { padding: 10px 12px; }
  .nav-link:not(.active) > span {
    position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap;
  }
  .nav-link.salir { margin-top: 0; padding-top: 10px; border-top: 0; }
}
