/* ============================================================================
   LHP — Sistema de diseño (Dessert & Bowl Bar)
   Sale del manual de marca aprobado (v59): Warm Cream de base, Guava Pink manda,
   Açaí Lavender acompaña, Mango solo donde corresponde. Títulos en Barlow
   Condensed Bold en mayúsculas, texto en Barlow. Sin negro ni tonos casi negros.
   Un solo tema, el claro: es el que dice el manual.
   Capa 1 primitivos · Capa 2 semánticos · Capa 3 componente.
   ========================================================================== */

/* ---------- Capa 1: primitivos ---------- */
:root {
  /* Curvas — de la tabla de animate, no inventadas */
  --ease-out:    cubic-bezier(0.23, 1, 0.32, 1);
  --ease-in-out: cubic-bezier(0.77, 0, 0.175, 1);
  --ease-drawer: cubic-bezier(0.32, 0.72, 0, 1);
  --ease-pop:    cubic-bezier(0.34, 1.4, 0.5, 1);

  /* Duraciones */
  --d-press: 160ms;
  --d-hover: 180ms;
  --d-pop:   200ms;
  --d-menu:  220ms;
  --d-modal: 250ms;
  --d-move:  260ms;
  --d-draw:  620ms;

  /* Escala tipográfica */
  --t-xs:  12px;
  --t-sm:  13px;
  --t-md:  14px;
  --t-base:15px;
  --t-lg:  17px;
  --t-xl:  22px;
  --t-2xl: 34px;
  --t-3xl: 44px;
  --t-4xl: 56px;

  /* Espaciado */
  --s-1: 4px;  --s-2: 8px;  --s-3: 12px; --s-4: 16px;
  --s-5: 20px; --s-6: 24px; --s-7: 30px; --s-8: 36px; --s-10: 44px; --s-12: 60px;

  /* Radios — LHP es redondo y juguetón */
  --r-sm: 10px; --r-md: 14px; --r-lg: 20px; --r-xl: 28px; --r-full: 999px;

  --sidebar-w: 256px;
  --topbar-h: 64px;

  --font-sans: "Barlow", system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  --font-display: "Barlow Condensed", "Barlow", system-ui, sans-serif;
  --font-mono: "Barlow Condensed", "Barlow", system-ui, sans-serif;
}

/* ---------- Capa 2: semánticos — Paleta V01 del manual ---------- */
:root {
  color-scheme: light;

  /* Marca (HEX exactos del manual) */
  --guava:    #E84064;   /* Guava Pink — lidera */
  --lavender: #8977AF;   /* Açaí Lavender */
  --mango:    #FAAE04;   /* Mango */
  --coral:    #ED4F45;   /* Strawberry Coral */
  --cream:    #F8F2ED;   /* Warm Cream */
  --green:    #87A73E;   /* Fresh Green */
  --yblue:    #5B8FC7;   /* Greek Yogurt Blue — solo categoría yogurt */
  --cacao:    #6A4336;   /* Cacao — solo chocolate */

  --bg:        var(--cream);
  --bg-deep:   #F0E7DF;
  --surface:   #FFFFFF;
  --glass:     #FFFFFF;
  --glass-2:   #FFFFFF;
  --glass-hi:  rgba(255, 255, 255, 0);
  --raise:     rgba(137, 119, 175, 0.08);

  /* Texto: un ciruela-açaí profundo, nunca negro */
  --ink:   #54447C;
  --ink-2: #6F5E99;
  --ink-3: #8272AA;

  --line:      rgba(137, 119, 175, 0.28);
  --line-soft: rgba(137, 119, 175, 0.16);

  --acc:      var(--guava);
  --acc-text: #D12F54;                 /* el mismo rosa, un punto más hondo para letra pequeña */
  --acc-2:    var(--lavender);
  --acc-ink:  #FFFFFF;
  --acc-wash: rgba(232, 64, 100, 0.10);
  --acc-2-wash: rgba(137, 119, 175, 0.14);

  /* Semánticos (color + palabra, nunca solo color) */
  --good: #5F7D1C;  --good-wash: rgba(135, 167, 62, 0.18);
  --warn: #9A6200;  --warn-wash: rgba(250, 174, 4, 0.20);
  --sers: #B4501E;  --sers-wash: rgba(237, 79, 69, 0.12);
  --crit: #C23229;  --crit-wash: rgba(237, 79, 69, 0.13);

  /* Series de gráfica — orden fijo, nunca cíclico (dataviz).
     Las seis de la paleta del manual, distinguibles entre sí. */
  --c1: #E84064; --c2: #8977AF; --c3: #FAAE04;
  --c4: #87A73E; --c5: #5B8FC7; --c6: #6A4336;

  --grid: rgba(137, 119, 175, 0.18);
  --shadow-card: 0 1px 2px rgba(137, 119, 175, 0.10), 0 14px 30px -20px rgba(137, 119, 175, 0.55);
  --shadow-pop:  0 22px 48px -16px rgba(137, 119, 175, 0.50);
}

/* ============================ Base ============================ */
* { box-sizing: border-box; touch-action: pan-x pan-y; }
@media (pointer: coarse) { input, select, textarea { font-size: 16px !important; } }

html, body { height: 100%; }

body {
  margin: 0;
  background: var(--bg);
  color: var(--ink);
  font-family: var(--font-sans);
  font-size: var(--t-base);
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
  overflow-x: hidden;
}


::selection { background: var(--acc-wash); color: var(--ink); }

h1, h2, h3, h4 { margin: 0; font-family: var(--font-display); font-weight: 700; letter-spacing: 0.01em; text-transform: uppercase; }
p { margin: 0; }
button { font: inherit; color: inherit; }
a { color: inherit; text-decoration: none; }

.eyebrow {
  font-family: var(--font-mono);
  font-size: var(--t-xs);
  letter-spacing: 0.11em;
  text-transform: uppercase;
  color: var(--ink-3);
}

/* Barra de desplazamiento propia — el detalle que delata una plantilla */
::-webkit-scrollbar { width: 10px; height: 10px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb {
  background: var(--line);
  border-radius: var(--r-full);
  border: 3px solid transparent;
  background-clip: content-box;
}
::-webkit-scrollbar-thumb:hover { background: var(--ink-3); background-clip: content-box; }

/* ====================== Estructura ====================== */
.app {
  position: relative;
  z-index: 1;
  display: grid;
  grid-template-columns: var(--sidebar-w) 1fr;
  min-height: 100vh;
}

/* ---------- Tarjeta LHP: sólida, blanca, con línea lavanda. (Se sigue llamando
   .glass en el HTML por herencia; ya no hay cristal.) ---------- */
.glass {
  position: relative;
  background: var(--glass);
  border: 1px solid var(--line-soft);
  border-radius: var(--r-xl);
  box-shadow: var(--shadow-card);
}

/* ---------- Barra lateral ---------- */
.sidebar {
  position: sticky;
  top: 0;
  align-self: start;
  height: 100vh;
  display: flex;
  flex-direction: column;
  gap: var(--s-4);
  padding: var(--s-6) var(--s-4) var(--s-5);
  background: var(--surface);
  border-right: 1px solid var(--line-soft);
  z-index: 40;
}

.brand { display: flex; align-items: center; justify-content: flex-start; padding: var(--s-1) var(--s-2) var(--s-2); }
.brand-logo { display: block; width: 132px; height: auto; transition: transform var(--d-move) var(--ease-pop); transform-origin: left center; }
.brand:hover .brand-logo { transform: scale(1.04) rotate(-1.5deg); }

/* Selector de organización (multi-empresa) */
.org { position: relative; }
.org-btn {
  width: 100%;
  display: flex; align-items: center; gap: 10px;
  padding: 9px 10px;
  background: var(--raise);
  border: 1px solid var(--line);
  border-radius: var(--r-md);
  cursor: pointer;
  text-align: left;
  transition:
    background-color var(--d-hover) var(--ease-out),
    border-color var(--d-hover) var(--ease-out),
    transform var(--d-press) var(--ease-out);
}
.org-btn:active { transform: scale(0.985); }
.org-avatar {
  width: 26px; height: 26px; flex: 0 0 26px;
  border-radius: 8px;
  display: grid; place-items: center;
  font-size: 11px; font-weight: 700;
  color: #fff;
}
.org-meta { min-width: 0; flex: 1; }
.org-name {
  font-size: var(--t-md); font-weight: 600;
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.org-role { font-size: 10px; color: var(--ink-3); }
.org-caret {
  color: var(--ink-3);
  transition: transform var(--d-menu) var(--ease-out);
}
.org-btn[aria-expanded="true"] .org-caret { transform: rotate(180deg); }

.org-menu {
  position: absolute;
  top: calc(100% + 6px); left: 0; right: 0;
  z-index: 60;
  padding: 6px;
  background: var(--glass-2);
  border: 1px solid var(--line);
  border-radius: var(--r-md);
  box-shadow: var(--shadow-pop);
  transform-origin: top center;      /* nace del disparador */
  transition:
    opacity var(--d-menu) var(--ease-out),
    transform var(--d-menu) var(--ease-out),
    visibility 0s linear var(--d-menu);
  opacity: 0;
  visibility: hidden;
  transform: scale(0.95) translateY(-4px);
}
.org-menu[data-open="true"] {
  opacity: 1;
  visibility: visible;
  transform: scale(1) translateY(0);
  transition-delay: 0s;
}
.org-item {
  width: 100%;
  display: flex; align-items: center; gap: 9px;
  padding: 8px 9px;
  border: 0; background: transparent;
  border-radius: var(--r-sm);
  cursor: pointer; text-align: left;
  transition: background-color var(--d-hover) var(--ease-out);
}
.org-item:hover { background: var(--raise); }
.org-item[aria-selected="true"] { background: var(--acc-wash); }
.org-item-name { font-size: var(--t-md); font-weight: 550; }
.org-item-sub { font-size: 10px; color: var(--ink-3); }

/* Navegación con indicador deslizante */
.nav { position: relative; flex: 1; overflow-y: auto; padding-top: var(--s-2); }
.nav-group + .nav-group { margin-top: var(--s-5); }
.nav-title { padding: 0 10px var(--s-2); }
.nav-list { position: relative; display: flex; flex-direction: column; gap: 2px; }

.nav-pill {
  position: absolute;
  left: 0; top: 0;
  width: 100%;
  border-radius: var(--r-md);
  background: var(--acc-wash);
  border: 1px solid color-mix(in srgb, var(--acc) 30%, transparent);
  opacity: 0;
  pointer-events: none;
  transition:
    transform var(--d-move) var(--ease-in-out),
    height var(--d-move) var(--ease-in-out),
    opacity var(--d-hover) var(--ease-out);
}
.nav-pill[data-ready="true"] { opacity: 1; }

.nav-link {
  position: relative;
  z-index: 1;
  display: flex; align-items: center; gap: 10px;
  padding: 9px 10px;
  border-radius: var(--r-md);
  color: var(--ink-2);
  font-size: var(--t-md);
  font-weight: 520;
  cursor: pointer;
  transition:
    color var(--d-hover) var(--ease-out),
    background-color var(--d-hover) var(--ease-out),
    transform var(--d-press) var(--ease-out);
}
.nav-link svg { flex: 0 0 17px; opacity: 0.72; transition: opacity var(--d-hover) var(--ease-out); }
.nav-link:active { transform: scale(0.985); }
.nav-link[aria-current="page"] { color: var(--ink); font-weight: 600; }
.nav-link[aria-current="page"] svg { opacity: 1; color: var(--acc-text); }

.sidebar-foot {
  padding: var(--s-3) 10px 0;
  border-top: 1px solid var(--line-soft);
}
.plan-chip {
  display: flex; align-items: center; justify-content: space-between;
  gap: var(--s-2);
  font-size: var(--t-xs);
  color: var(--ink-3);
}

/* ---------- Barra superior ---------- */
.main { min-width: 0; display: flex; flex-direction: column; }

.topbar {
  position: sticky; top: 0; z-index: 30;
  height: var(--topbar-h);
  display: flex; align-items: center; gap: var(--s-3);
  padding: 0 var(--s-6);
  background: var(--bg);
  border-bottom: 1px solid var(--line);
}

/* Interruptores */
.switch-group { display: flex; align-items: center; gap: var(--s-2); margin-left: auto; }

.lang-switch {
  position: relative;
  display: flex;
  padding: 3px;
  background: var(--raise);
  border: 1px solid var(--line);
  border-radius: var(--r-full);
}
.lang-switch .knob {
  position: absolute;
  top: 3px; left: 3px;
  width: calc(50% - 3px);
  height: calc(100% - 6px);
  border-radius: var(--r-full);
  background: var(--acc);
  box-shadow: 0 4px 12px -6px var(--acc);
  transition: transform var(--d-move) var(--ease-in-out);
}
.lang-switch[data-lang="en"] .knob { transform: translateX(100%); }
.lang-switch button {
  position: relative; z-index: 1;
  width: 34px;
  padding: 4px 0;
  border: 0; background: transparent;
  font-size: var(--t-xs); font-weight: 650; letter-spacing: 0.04em;
  color: var(--ink-3);
  cursor: pointer;
  transition: color var(--d-move) var(--ease-out);
}
.lang-switch button[aria-pressed="true"] { color: var(--acc-ink); }

.avatar {
  width: 30px; height: 30px;
  border-radius: 50%;
  display: grid; place-items: center;
  font-size: var(--t-xs); font-weight: 700;
  background: var(--lavender);
  color: #fff;
  cursor: pointer;
  transition: transform var(--d-press) var(--ease-out), box-shadow var(--d-hover) var(--ease-out);
}
.avatar:active { transform: scale(0.94); }

/* ---------- Lienzo ---------- */
.canvas {
  flex: 1;
  padding: var(--s-6) var(--s-6) var(--s-12);
  max-width: 1560px;
  width: 100%;
}

/* Ritmo vertical de la vista. Los bloques son hermanos sueltos: sin esto la
   fila de KPIs y la tarjeta de debajo se tocan. El aire entre secciones es
   mayor que el aire entre tarjetas de una misma fila, para que se lean como
   grupos y no como una rejilla continua. */
#view {
  display: flex;
  flex-direction: column;
  gap: var(--s-7);
}

.page-head {
  display: flex; align-items: flex-end; justify-content: space-between;
  gap: var(--s-4);
  margin-bottom: 0;   /* lo lleva el gap de #view */
  flex-wrap: wrap;
}
.page-title { font-size: var(--t-2xl); letter-spacing: -0.03em; }
.page-sub { color: var(--ink-2); font-size: var(--t-md); margin-top: 2px; }
.page-actions { display: flex; gap: var(--s-2); flex-wrap: wrap; max-width: 100%; min-width: 0; }

/* Buscador dentro de page-actions (p. ej. Insumos): lupa fija a la
   izquierda, el input le deja hueco con padding — el ícono no es clicable
   (pointer-events:none), es solo la pista visual de qué hace el campo. */
.ins-search-wrap { position: relative; display: flex; align-items: center; }
.ins-search-wrap svg { position: absolute; left: 10px; color: var(--ink-3); pointer-events: none; }
/* Especificidad a propósito (dos clases): la regla ".input, .select" de más
   abajo pone "padding" en las cuatro esquinas con el mismo peso — si esta
   perdiera el empate por orden de aparición, el hueco para la lupa se
   cierra y el texto empieza debajo del ícono. */
.ins-search-wrap .ins-search-input { padding-left: 34px; width: 220px; }
@media (max-width: 720px) {
  .ins-search-wrap, .ins-search-wrap .ins-search-input { width: 100%; }
}

/* ====================== Componentes ====================== */

/* Botones */
.btn {
  display: inline-flex; align-items: center; gap: 7px;
  padding: 8px 14px;
  border-radius: var(--r-full);
  border: 1px solid var(--line);
  background: var(--raise);
  color: var(--ink);
  font-size: var(--t-md);
  font-weight: 560;
  cursor: pointer;
  white-space: nowrap;
  transition:
    transform var(--d-press) var(--ease-out),
    background-color var(--d-hover) var(--ease-out),
    border-color var(--d-hover) var(--ease-out),
    box-shadow var(--d-hover) var(--ease-out);
}
.btn:active { transform: scale(0.97); }

@media (hover: hover) and (pointer: fine) {
  .btn:hover { border-color: color-mix(in srgb, var(--acc) 40%, var(--line)); }
}

/* Rejillas — align-items:start para que ninguna tarjeta se estire con medio
   cuerpo vacío al lado de otra más alta. */
.grid { display: grid; gap: var(--s-5); align-items: start; }
.g-3 { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.g-4 { grid-template-columns: repeat(4, minmax(0, 1fr)); }
.g-8-4 { grid-template-columns: minmax(0, 2fr) minmax(0, 1fr); }
.g-5-7 { grid-template-columns: minmax(0, 5fr) minmax(0, 7fr); }

/* Tarjeta */
.card { padding: var(--s-6); }
.card-head {
  display: flex; align-items: flex-start; justify-content: space-between;
  gap: var(--s-3);
  margin-bottom: var(--s-5);
}
.card-title { font-size: var(--t-lg); letter-spacing: -0.02em; }
.card-note { font-size: var(--t-sm); color: var(--ink-3); margin-top: 2px; }

/* Tarjeta de KPI */
.kpi { padding: var(--s-6); overflow: hidden; }
.kpi-top { display: flex; align-items: center; gap: 8px; margin-bottom: var(--s-3); }
.kpi-dot { width: 7px; height: 7px; border-radius: 50%; flex: 0 0 7px; }
.kpi-label { font-size: var(--t-sm); color: var(--ink-2); font-weight: 520; }
.kpi-value {
  font-size: var(--t-3xl);
  font-weight: 640;
  letter-spacing: -0.035em;
  line-height: 1.05;
  font-variant-numeric: tabular-nums;
}
.kpi-foot { display: flex; align-items: center; gap: 8px; margin-top: var(--s-3); }

.delta {
  display: inline-flex; align-items: center; gap: 3px;
  font-size: var(--t-sm); font-weight: 620;
  font-variant-numeric: tabular-nums;
  padding: 2px 7px;
  border-radius: var(--r-full);
}
.delta.up   { color: var(--good); background: var(--good-wash); }
.delta.down { color: var(--crit); background: var(--crit-wash); }
.delta.flat { color: var(--ink-3); background: var(--raise); }
.delta-note { font-size: var(--t-xs); color: var(--ink-3); }

@media (hover: hover) and (pointer: fine) {
  .kpi { transition: transform var(--d-hover) var(--ease-out), box-shadow var(--d-hover) var(--ease-out); }
  .kpi:hover { transform: translateY(-2px); box-shadow: var(--shadow-pop); }
}

/* Etiquetas de estado — nunca solo color: llevan punto e icono textual */
.tag {
  display: inline-flex; align-items: center; gap: 5px;
  padding: 2px 8px;
  border-radius: var(--r-full);
  font-size: var(--t-xs); font-weight: 600;
  letter-spacing: 0.01em;
  /* Corto = una línea; largo (p. ej. "El puente no responde...") = se parte
     en vez de salirse de la pantalla. */
  max-width: 100%; min-width: 0;
}
.tag::before { content: ""; width: 5px; height: 5px; border-radius: 50%; background: currentColor; flex: 0 0 5px; }
.tag.good { color: var(--good); background: var(--good-wash); }
.tag.warn { color: var(--warn); background: var(--warn-wash); }
.tag.sers { color: var(--sers); background: var(--sers-wash); }
.tag.crit { color: var(--crit); background: var(--crit-wash); }
.tag.neut { color: var(--ink-2); background: var(--raise); }
.tag.acc  { color: var(--acc-text);  background: var(--acc-wash); }

.tag.crit::before { animation: pulse-dot 1.9s var(--ease-in-out) infinite; }
@keyframes pulse-dot {
  0%, 100% { transform: scale(1); opacity: 1; }
  50%      { transform: scale(1.5); opacity: 0.5; }
}

/* Lista de movimientos / eventos */
.rows { display: flex; flex-direction: column; }
.row {
  display: flex; align-items: center; gap: var(--s-3);
  padding: 11px 4px;
  border-bottom: 1px solid var(--line-soft);
  cursor: pointer;
  border-left: 2px solid transparent;
  transition:
    background-color var(--d-hover) var(--ease-out),
    border-color var(--d-hover) var(--ease-out),
    padding-left var(--d-hover) var(--ease-out);
}
.row:last-child { border-bottom: 0; }
@media (hover: hover) and (pointer: fine) {
  .row:hover { background: var(--raise); border-left-color: var(--acc); padding-left: 9px; }
}
.row-ico {
  width: 32px; height: 32px; flex: 0 0 32px;
  border-radius: 10px;
  display: grid; place-items: center;
  background: var(--raise);
  color: var(--ink-2);
}
.row-main { flex: 1; min-width: 0; }
.row-title { font-weight: 550; font-size: var(--t-md); }
.row-sub { font-size: var(--t-xs); color: var(--ink-3); }
/* Una etiqueta dentro de la línea de datos (p. ej. "vence en 5 días"): va con
   el texto, NO a la derecha. A la derecha compite por el ancho y en móvil
   parte el título palabra por palabra. */
.row-sub .tag { margin-left: 5px; transform: translateY(-1px); }

/* Acciones a la derecha de una fila (monto + borrar) */
.row-actions { display: flex; align-items: center; gap: var(--s-3); flex: 0 0 auto; }
.row-amount { font-weight: 640; font-variant-numeric: tabular-nums; white-space: nowrap; }

.icon-btn {
  display: grid; place-items: center;
  width: 30px; height: 30px; flex: 0 0 30px;
  border-radius: 50%;
  border: 1px solid transparent;
  background: transparent;
  color: var(--ink-3);
  cursor: pointer;
  transition:
    background-color var(--d-hover) var(--ease-out),
    color var(--d-hover) var(--ease-out),
    transform var(--d-press) var(--ease-out);
}
@media (hover: hover) and (pointer: fine) {
  .icon-btn:hover { background: var(--crit-wash); color: var(--crit); }
}
.icon-btn:active { transform: scale(0.9); }

/* Fila reemplazada por su confirmación de borrado — mismo alto, sin salto */
.row-confirm { display: flex; align-items: center; justify-content: space-between; gap: var(--s-3); flex: 1; min-width: 0; }
.row-confirm span { font-size: var(--t-sm); color: var(--ink-2); }

/* Botones de acento y de peligro */
.btn.acc { border-color: transparent; background: var(--acc); color: var(--acc-ink); }
@media (hover: hover) and (pointer: fine) {
  .btn.acc:hover { background: var(--acc); filter: brightness(1.08); }
}
.btn.danger { border-color: color-mix(in srgb, var(--crit) 45%, var(--line)); color: var(--crit); }
@media (hover: hover) and (pointer: fine) {
  .btn.danger:hover { background: var(--crit-wash); border-color: var(--crit); }
}

/* Formularios */
.field { display: flex; flex-direction: column; gap: 6px; }
.field label { font-size: var(--t-xs); color: var(--ink-2); font-weight: 560; letter-spacing: 0.01em; }
.input, .select {
  padding: 9px 12px;
  border-radius: var(--r-sm);
  border: 1px solid var(--line);
  background: var(--raise);
  color: var(--ink);
  font: inherit;
  font-size: var(--t-md);
  transition: border-color var(--d-hover) var(--ease-out), background-color var(--d-hover) var(--ease-out);
}
.input:focus, .select:focus { outline: none; border-color: var(--acc); background: var(--surface); }

/* Casillas numéricas: nunca flechitas (se escribe el número, nada más). */
input[type="number"] { -moz-appearance: textfield; appearance: textfield; }
input[type="number"]::-webkit-outer-spin-button,
input[type="number"]::-webkit-inner-spin-button { -webkit-appearance: none; appearance: none; margin: 0; }
.form-grid { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: var(--s-4); margin-bottom: var(--s-5); }
.form-grid .span-2 { grid-column: span 2; }
.form-actions { display: flex; justify-content: flex-end; flex-wrap: wrap; gap: var(--s-2); }

.seg-toggle { display: inline-flex; gap: 4px; padding: 3px; border-radius: var(--r-full); background: var(--raise); border: 1px solid var(--line); width: fit-content; max-width: 100%; }
.seg-toggle button {
  min-width: 0;
  padding: 6px 14px; border: 0; background: transparent; border-radius: var(--r-full);
  font: inherit; font-size: var(--t-sm); font-weight: 600; color: var(--ink-2); cursor: pointer;
  transition: background-color var(--d-hover) var(--ease-out), color var(--d-hover) var(--ease-out);
}
.seg-toggle button[aria-pressed="true"] { background: var(--surface); box-shadow: var(--shadow-card); }
.seg-toggle button.tone-crit[aria-pressed="true"] { color: var(--crit); }
.seg-toggle button.tone-good[aria-pressed="true"] { color: var(--good); }
.seg-toggle button.tone-acc[aria-pressed="true"] { color: var(--acc-text); }
.seg-toggle button.tone-warn[aria-pressed="true"] { color: var(--warn); }

/* Registrar Inventario: fila del checklist sin rellenar todavía — mismo
   filo que ya usa .row al pasar el mouse, pero fijo, no solo al hover. */
.rows .row.reg-incomplete { border-left-color: var(--crit); background: var(--crit-wash); }

/* ====================== Margen — experimentar ====================== */
/* La tarjeta donde se arma un experimento lleva un filo de acento: es la
   única de toda la app que "manejamos el dinero" antes de que el producto
   exista de verdad, y se quiere que se sienta distinta al catálogo fijo. */
.exp-builder { border-color: var(--acc-2-wash); box-shadow: var(--shadow-card), 0 0 0 1px var(--acc-2-wash); }

.exp-lines { display: flex; flex-direction: column; margin: var(--s-4) 0; container-type: inline-size; }
/* El diseño depende del ancho de la TARJETA (container query), no del de la
   pantalla: con el menú lateral abierto una pantalla de 1440 deja a la tarjeta
   con ~700px y las columnas fijas se salían. minmax(0, ..) deja que los
   selects se encojan en vez de empujar el costo fuera de la tarjeta. */
.exp-line {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(0, 1.4fr) minmax(104px, 150px) minmax(64px, 84px) 32px 28px;
  gap: var(--s-3);
  align-items: center;
  padding: var(--s-3) 0;
  border-bottom: 1px solid var(--line-soft);
}
.exp-line > * { min-width: 0; }
.exp-line .select { width: 100%; text-overflow: ellipsis; }
.exp-line:last-child { border-bottom: none; }
.exp-line.line-new { animation: rise 340ms var(--ease-out) forwards; }
.exp-line-qty { display: flex; align-items: center; gap: 6px; }
.exp-line-qty .input { flex: 1 1 auto; width: 100%; min-width: 76px; }
.exp-line-unit { font-size: var(--t-sm); color: var(--ink-3); white-space: nowrap; flex: 0 0 auto; }
/* Cantidad solo escrita: sin flechitas */
.exp-line-qty input[type="number"] { -moz-appearance: textfield; appearance: textfield; }
.exp-line-qty input[type="number"]::-webkit-outer-spin-button,
.exp-line-qty input[type="number"]::-webkit-inner-spin-button { -webkit-appearance: none; margin: 0; }
/* Agarrador para reordenar */
.line-grip {
  display: grid; place-items: center; width: 28px; height: 36px; padding: 0; border: 0; border-radius: 8px;
  background: transparent; color: var(--ink-3); cursor: grab; touch-action: none; user-select: none;
  transition: color var(--d-hover) var(--ease-out), background var(--d-hover) var(--ease-out);
}
.line-grip svg { fill: currentColor; stroke: none; }
.line-grip:hover { color: var(--acc-text); background: var(--acc-2-wash); }
.line-grip:active { cursor: grabbing; }
.exp-line { position: relative; transition: box-shadow 160ms var(--ease-out), background 160ms var(--ease-out); }
.exp-line.is-dragging { z-index: 5; background: var(--surface); box-shadow: 0 14px 34px rgba(84,68,124,.26), 0 0 0 1px var(--acc-2-wash); border-radius: 12px; transition: none; will-change: transform; }
.exp-line.is-dragging.is-settling { box-shadow: 0 2px 8px rgba(84,68,124,.12); }
.exp-line { will-change: auto; }
.exp-part { position: relative; }
.exp-part.is-dragging { z-index: 6; background: var(--surface); box-shadow: 0 14px 34px rgba(84,68,124,.26), 0 0 0 1px var(--acc-2-wash); transition: none; will-change: transform; }
.exp-part.is-dragging.is-settling { box-shadow: 0 2px 8px rgba(84,68,124,.12); }
.exp-line-cost { font-weight: 640; font-variant-numeric: tabular-nums; text-align: right; white-space: nowrap; }

.exp-builder-foot {
  display: flex; align-items: center; justify-content: space-between; flex-wrap: wrap;
  gap: var(--s-4) var(--s-3);
  margin-top: var(--s-2);
  padding-top: var(--s-4);
  border-top: 1px solid var(--line);
}
.exp-total { display: flex; align-items: baseline; gap: var(--s-2); }
.exp-total span { font-size: var(--t-sm); color: var(--ink-2); }
.exp-total-value {
  font-size: var(--t-2xl); font-variant-numeric: tabular-nums; color: var(--acc-text);
  transition: color var(--d-hover) var(--ease-out);
}

@container (max-width: 640px) {
  /* Angosto: fila 1 = categoría + insumo; fila 2 = cantidad · costo · quitar. */
  .exp-line { grid-template-columns: minmax(0, 1fr) auto 32px 28px; row-gap: var(--s-2); padding: var(--s-4) 0; }
  .exp-line > .select:nth-child(1), .exp-line > .select:nth-child(2) { grid-column: 1 / -1; }
  .exp-line-qty { grid-column: 1 / 2; }
  .exp-line-cost { grid-column: 2 / 3; }
  .exp-line [data-act$="-line-remove"] { grid-column: 3 / 4; }
  .exp-line .line-grip { grid-column: 4 / 5; }
}

/* ====================== Margen — costos generales ====================== */
/* Categorías en horizontal (a diferencia de Insumos, que las apila): cada
   una es una columna que se desplaza en bloque, no una tarjeta de ancho
   completo. Así "Açaí bowls" se ve entera sin empujar a "Bebidas" fuera de
   vista. */
.dish-board { display: grid; grid-template-columns: repeat(auto-fill, minmax(min(100%, 280px), 1fr)); gap: var(--s-4); padding: 2px 2px var(--s-3); align-items: start; }
.dish-col { min-width: 0; display: flex; flex-direction: column; gap: var(--s-3); }
.dish-col-head { min-height: 34px; display: flex; align-items: center; justify-content: space-between; gap: var(--s-2); }
.dish-col-actions { display: flex; gap: var(--s-1); flex: 0 0 auto; }
.dish-col-cards { display: flex; flex-direction: column; gap: var(--s-2); min-height: 4px; }
.dish-card { border: 1px solid var(--line-soft); border-radius: var(--r-md); }
.dish-col-add { width: 100%; justify-content: center; }
.dish-margin-row { display: flex; gap: var(--s-5); flex-wrap: wrap; }

@media (max-width: 720px) {
  .form-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .form-grid .span-2 { grid-column: span 2; }
}

/* Alta rápida de una lista (Listas): una fila, sin el peso de un form-grid
   completo — es un solo dato, o dos nombres cortos. */
.quickadd { display: flex; gap: var(--s-3); flex-wrap: wrap; }
.quickadd .input { flex: 1; min-width: 160px; }
.quickadd button { flex: 0 0 auto; }
@media (max-width: 720px) {
  .quickadd { flex-direction: column; }
  .quickadd button { width: 100%; justify-content: center; }
}

/* Tarjeta de cuenta bancaria */

/* Leyenda (dataviz: presente siempre con 2+ series) */
.legend { display: flex; flex-wrap: wrap; gap: var(--s-3) var(--s-4); }
.legend-item { display: inline-flex; align-items: center; gap: 6px; font-size: var(--t-sm); color: var(--ink-2); }
.legend-key { width: 10px; height: 10px; border-radius: 3px; flex: 0 0 10px; }
.legend-key.line { height: 3px; border-radius: 2px; }

/* Gráficas */
.chart { position: relative; width: 100%; }
.chart svg { display: block; width: 100%; overflow: visible; }
.chart .axis text { font-size: 10px; fill: var(--ink-3); font-variant-numeric: tabular-nums; }
.chart .grid-line { stroke: var(--grid); stroke-width: 1; }

/* Dibujo de la línea: se traza, no aparece */
.chart .series-line {
  fill: none;
  stroke-width: 2;
  stroke-linecap: round;
  stroke-linejoin: round;
  stroke-dasharray: var(--len);
  stroke-dashoffset: var(--len);
  transition: stroke-dashoffset var(--d-draw) var(--ease-in-out);
}
.chart[data-drawn="true"] .series-line { stroke-dashoffset: 0; }

.chart .series-area {
  opacity: 0;
  transition: opacity 460ms var(--ease-out) 180ms;
}
.chart[data-drawn="true"] .series-area { opacity: 1; }

.chart .series-dashed { stroke-dasharray: 5 5; opacity: 0.85; }

/* Barras: crecen desde la base */
.chart .bar-rect {
  transform-origin: bottom;
  transform: scaleY(0);
  transition: transform 520ms var(--ease-out);
}
.chart[data-drawn="true"] .bar-rect { transform: scaleY(1); }
.chart .bar-rect:hover { filter: brightness(1.14); }

/* Arcos del donut: se rellenan por orden, con aire entre segmentos */
.chart .arc {
  stroke-dasharray: 0 100;
  transition: stroke-dasharray 700ms var(--ease-in-out);
}
.chart[data-drawn="true"] .arc { stroke-dasharray: var(--dash); }

/* Cruceta y globo */
.crosshair {
  stroke: var(--ink-3);
  stroke-width: 1;
  stroke-dasharray: 3 3;
  opacity: 0;
  transition: opacity 125ms var(--ease-out);
}
.chart[data-hover="true"] .crosshair { opacity: 0.7; }
.hover-dot {
  opacity: 0;
  transition: opacity 125ms var(--ease-out);
}
.chart[data-hover="true"] .hover-dot { opacity: 1; }

.tip {
  position: absolute;
  z-index: 20;
  pointer-events: none;
  min-width: 152px;
  padding: 9px 11px;
  background: var(--glass-2);
  border: 1px solid var(--line);
  border-radius: var(--r-md);
  box-shadow: var(--shadow-pop);
  opacity: 0;
  transform: translate(-50%, -108%) scale(0.97);
  transition:
    opacity 125ms var(--ease-out),
    transform 125ms var(--ease-out);
}
.tip[data-show="true"] { opacity: 1; transform: translate(-50%, -112%) scale(1); }
.tip-title { font-size: var(--t-xs); color: var(--ink-3); margin-bottom: 5px; letter-spacing: 0.04em; text-transform: uppercase; }
.tip-row { display: flex; align-items: center; gap: 7px; font-size: var(--t-sm); }
.tip-row + .tip-row { margin-top: 3px; }
.tip-key { width: 8px; height: 8px; border-radius: 2px; flex: 0 0 8px; }
.tip-val { margin-left: auto; font-weight: 640; font-variant-numeric: tabular-nums; }

/* Aviso flotante */
.toast-dock {
  position: fixed;
  bottom: var(--s-6); right: var(--s-6);
  z-index: 95;
  display: flex; flex-direction: column-reverse; gap: var(--s-2);
  pointer-events: none;
}
.toast {
  display: flex; align-items: center; gap: 10px;
  padding: 11px 15px;
  min-width: 250px;
  background: var(--glass-2);
  border: 1px solid var(--line);
  border-radius: var(--r-md);
  box-shadow: var(--shadow-pop);
  font-size: var(--t-md);
  /* transición, no keyframes: se puede disparar dos veces por segundo */
  opacity: 1;
  transform: translateY(0);
  transition: opacity 400ms ease, transform 400ms ease;
}
.toast[data-enter="true"] { opacity: 0; transform: translateY(100%); }

/* ====================== Entrada de la vista ====================== */
/* Escalonado 40ms: lo ve cada vez que navega, así que corto y sutil */
.enter > * {
  opacity: 0;
  transform: translateY(10px);
  animation: rise 380ms var(--ease-out) forwards;
}
.enter > *:nth-child(1) { animation-delay: 0ms; }
.enter > *:nth-child(2) { animation-delay: 45ms; }
.enter > *:nth-child(3) { animation-delay: 90ms; }
.enter > *:nth-child(4) { animation-delay: 135ms; }
.enter > *:nth-child(5) { animation-delay: 180ms; }
.enter > *:nth-child(6) { animation-delay: 215ms; }
.enter > *:nth-child(n+7) { animation-delay: 250ms; }

@keyframes rise { to { opacity: 1; transform: translateY(0); } }

/* Escalonado interno de rejillas de KPI y filas */
.stagger > * {
  opacity: 0;
  transform: translateY(8px);
  animation: rise 340ms var(--ease-out) forwards;
}
.stagger > *:nth-child(1) { animation-delay: 30ms; }
.stagger > *:nth-child(2) { animation-delay: 65ms; }
.stagger > *:nth-child(3) { animation-delay: 100ms; }
.stagger > *:nth-child(4) { animation-delay: 135ms; }
.stagger > *:nth-child(5) { animation-delay: 170ms; }
.stagger > *:nth-child(6) { animation-delay: 200ms; }
.stagger > *:nth-child(7) { animation-delay: 225ms; }
.stagger > *:nth-child(n+8) { animation-delay: 250ms; }

/* Cambio de idioma: cruce difuminado, no un salto de texto */
.lang-morph { transition: opacity 170ms ease, filter 170ms ease; }
html.lang-swapping .lang-morph { opacity: 0.25; filter: blur(3px); }

/* ====================== Ventana modal ====================== */
/* Para formularios largos (editar insumo) que no deben forzar scroll a la
   fila de arriba: se abren encima, donde estás. Va después de .enter > *
   en la hoja para ganarle su animación de entrada por cascada (misma
   especificidad, pero declarada más tarde) — si no, el modal heredaría el
   "rise" escalonado de la página en vez de abrirse de una vez.
   OJO (E-058): las tres animaciones necesitan "forwards" — sin él, al
   terminar la animación el elemento vuelve al opacity:0 que le puso
   ".enter > *" (esa regla sigue viva, solo se le ganó la animación) y el
   modal se ve abrirse y cerrarse solo en cuanto termina la entrada. */
.modal-scrim {
  position: fixed; inset: 0; z-index: 110;
  background: color-mix(in srgb, var(--bg-deep) 62%, transparent);
  backdrop-filter: blur(4px);
  -webkit-backdrop-filter: blur(4px);
  display: flex; align-items: center; justify-content: center;
  padding: var(--s-5);
  animation: modal-scrim-in 220ms var(--ease-out) forwards;
}
@keyframes modal-scrim-in { from { opacity: 0; } to { opacity: 1; } }

.modal {
  position: relative;
  width: min(620px, 100%);
  max-height: min(88vh, 780px);
  overflow-y: auto;
  padding: var(--s-6);
  border-radius: var(--r-xl);
  background: var(--surface);
  border: 1px solid var(--line);
  box-shadow: var(--shadow-pop);
  animation: modal-in 260ms var(--ease-out) forwards;
}
@keyframes modal-in {
  from { opacity: 0; transform: translateY(18px) scale(0.97); }
  to   { opacity: 1; transform: translateY(0) scale(1); }
}
.modal-head {
  display: flex; align-items: center; justify-content: space-between;
  gap: var(--s-3); margin-bottom: var(--s-5);
}
/* El modal siempre es angosto — el form-grid de 4 columnas se ahoga ahí
   aunque el viewport sea ancho, así que se acota aparte del breakpoint. */
.modal .form-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.modal .form-grid .span-2 { grid-column: span 2; }

@media (max-width: 560px) {
  .modal-scrim { padding: 0; align-items: flex-end; }
  .modal {
    width: 100%; max-height: 92vh;
    border-radius: var(--r-xl) var(--r-xl) 0 0;
    animation: modal-in-mobile 320ms var(--ease-drawer) forwards;
  }
  .modal .form-grid { grid-template-columns: minmax(0, 1fr); }
}
@keyframes modal-in-mobile { from { transform: translateY(100%); } to { transform: translateY(0); } }

/* ====================== Filas y tarjetas desplegables ====================== */
/* Insumos y categorías ya no llevan lápiz/papelera a la vista: se hace clic
   en la fila (o la cabecera de la categoría) y ahí abajo se abre el detalle
   con las acciones. Mismo truco grid 0fr->1fr que un <details> pero con
   transición — sin medir alturas en JS. */
.row-expand-wrap {
  display: grid;
  grid-template-rows: 0fr;
  transition: grid-template-rows 260ms var(--ease-out);
}
.row-expand-wrap[data-open="true"] { grid-template-rows: 1fr; }
.row-expand-inner { overflow: hidden; min-height: 0; }
.row-expand {
  padding: var(--s-3) 2px var(--s-4);
  display: flex; flex-direction: column; gap: var(--s-4);
}
.row-detail-grid {
  display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: var(--s-3) var(--s-5);
}
.row-detail-grid > div { display: flex; flex-direction: column; gap: 2px; min-width: 0; }
.row-detail-label { font-size: var(--t-xs); color: var(--ink-3); }
.row-detail-grid > div > span:last-child { font-size: var(--t-sm); font-weight: 550; }
.row-expand-actions, .cat-actions { display: flex; gap: var(--s-2); flex-wrap: wrap; }
.cat-actions { padding: 2px 2px var(--s-4); }

/* Editar/eliminar de una categoría desplegable: solo a la vista con la
   categoría abierta — si no, compiten visualmente con el gesto de desplegar
   en una cabecera que ya es clicable entera. Se ocultan con opacidad+escala,
   no display:none, para que el cambio no sea un salto seco. */
.card-head-actions { display: flex; align-items: center; gap: 2px; flex: 0 0 auto; }
.card-head-actions .icon-btn {
  opacity: 0; transform: scale(0.85); pointer-events: none;
  transition: opacity var(--d-hover) var(--ease-out), transform var(--d-hover) var(--ease-out);
}
[aria-expanded="true"] .card-head-actions .icon-btn { opacity: 1; transform: scale(1); pointer-events: auto; }

.row-chevron {
  color: var(--ink-3); flex: 0 0 auto; display: inline-flex;
  transition: transform var(--d-menu) var(--ease-out);
}
.row-chevron[data-open="true"], [aria-expanded="true"] .row-chevron { transform: rotate(180deg); }

/* .row ya tiene su propio :hover (fondo + borde) más abajo en la hoja —
   aquí solo se suma el cambio de color en el título/flecha, y el cursor
   para .card-head, que no es .row y no trae hover propio. La flecha ya
   tiene su propia transición de "transform" (rotarla al desplegar) — aquí
   se le AÑADE la de color, nunca se reemplaza el transition entero o se
   pierde el giro suave. */
.row-clickable { cursor: pointer; }
.row-clickable .row-title, .row-clickable .card-title {
  transition: color var(--d-hover) var(--ease-out);
}
.row-clickable .row-chevron {
  transition: color var(--d-hover) var(--ease-out), transform var(--d-menu) var(--ease-out);
}
@media (hover: hover) and (pointer: fine) {
  .row-clickable:hover .row-title,
  .row-clickable:hover .card-title,
  .row-clickable:hover .row-chevron { color: var(--acc-text); }
}

@media (max-width: 560px) {
  .row-detail-grid { grid-template-columns: minmax(0, 1fr); }
}

/* ====================== Responsive ====================== */
.mobile-bar { display: none; }

@media (max-width: 1180px) {
  .g-3, .g-4 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .g-8-4, .g-5-7 { grid-template-columns: minmax(0, 1fr); }
}

@media (max-width: 860px) {
  :root { --topbar-h: 56px; }

  .app { grid-template-columns: 1fr; }

  .sidebar {
    position: fixed;
    top: 0; bottom: 0; left: 0;
    width: 272px;
    height: 100dvh;
    transform: translateX(-100%);
    transition: transform 380ms var(--ease-drawer), box-shadow 380ms var(--ease-out);
    /* Cerrado no lleva sombra: asomaba como una franja gris en el borde
       izquierdo (muy visible en tema claro). */
    box-shadow: none;
    /* De cajón fijo sobre todo lo demás: cristal sólido, no traslúcido —
       ver por qué en el comentario del scrim de abajo. */
    background: var(--surface);
    backdrop-filter: none;
    -webkit-backdrop-filter: none;
  }
  .sidebar[data-open="true"] { transform: translateX(0); box-shadow: var(--shadow-pop); }

  .sheet-scrim {
    position: fixed; top: 0; bottom: 0; right: 0; left: 272px; z-index: 39;
    background: color-mix(in srgb, var(--bg-deep) 62%, transparent);
    backdrop-filter: blur(3px);
    opacity: 0; visibility: hidden;
    transition: opacity 300ms var(--ease-out), visibility 0s linear 300ms;
  }
  .sheet-scrim[data-open="true"] { opacity: 1; visibility: visible; transition-delay: 0s; }

  .mobile-bar { display: inline-grid; }
  .burger {
    place-items: center;
    width: 34px; height: 34px;
    border-radius: var(--r-md);
    border: 1px solid var(--line);
    background: var(--raise);
    cursor: pointer;
    transition: transform var(--d-press) var(--ease-out);
  }
  .burger:active { transform: scale(0.92); }

  .topbar { padding: 0 var(--s-4); gap: var(--s-2); }

  .canvas { padding: var(--s-4) var(--s-4) var(--s-12); }

  /* En móvil el ritmo se acorta: 30px de separación en una columna estrecha
     obliga a desplazar de más. */
  #view { gap: var(--s-5); }
  .grid { gap: var(--s-4); }

  .g-3, .g-4 { grid-template-columns: minmax(0, 1fr); }

  .page-title { font-size: var(--t-xl); }
  .kpi-value { font-size: var(--t-2xl); }
  .card, .kpi { padding: var(--s-4); }

  .toast-dock { left: var(--s-4); right: var(--s-4); bottom: var(--s-4); }
  .toast { min-width: 0; }

  /* Filas en columna estrecha: el texto manda, lo de la derecha se aprieta.
     Sin esto el título se parte palabra por palabra (una palabra por línea). */
  .row { gap: var(--s-2); padding: 10px 2px; }
  .row-ico { width: 28px; height: 28px; flex: 0 0 28px; border-radius: 9px; }
  .row-actions { gap: var(--s-2); }
  .row-amount { font-size: var(--t-md); }
  .row-confirm { flex-direction: column; align-items: stretch; gap: var(--s-2); }
  .row-confirm .row-actions { justify-content: flex-end; }

  .gridlines { background-size: 100% 76px, 76px 100%; }
}

/* ====================== Deuda: avance del pago ====================== */
/* Cuánto llevas pagado de una deuda, de un vistazo y sin leer un número.
   Se rellena de verde según los abonos; llena = pagada. */
.dt-bar {
  margin-top: 6px; height: 4px; border-radius: var(--r-full);
  background: var(--line); overflow: hidden; max-width: 260px;
}
.dt-bar span {
  display: block; height: 100%; border-radius: var(--r-full);
  background: var(--good);
  transition: width var(--d-slow, 420ms) var(--ease-out);
}
/* El origen de una deuda y sus abonos llevan a su transacción: se ve que
   son pulsables, sin convertirlos en botones. */
.link-like { color: var(--acc-text); cursor: pointer; text-decoration: underline; text-underline-offset: 2px; }
.link-like:hover { opacity: .82; }

/* Destello al llegar a una transacción desde su abono: sin él, en una lista
   larga no sabrías cuál de todas es. */
@keyframes row-flash {
  0%   { background: var(--acc-wash); }
  100% { background: transparent; }
}
.row-flash { animation: row-flash 1.6s var(--ease-out) both; border-radius: var(--r-md, 10px); }

/* Coincidencia del buscador de Insumos: se queda mientras haya texto en el
   campo (a diferencia de .row-flash, que se apaga solo) — mismo tinte de
   acento suave, para no inventar un segundo lenguaje de color. */
@keyframes search-match-in {
  0%   { background: transparent; }
  100% { background: var(--acc-wash); }
}
.ins-search-match { animation: search-match-in 220ms var(--ease-out) both; border-radius: var(--r-md, 10px); }

/* ====================== Movimiento reducido ====================== */
/* Menos y más suave, no cero: se conserva lo que ayuda a entender. */
@media (prefers-reduced-motion: reduce) {
  .atmosphere span { animation: none; }
  .tag.crit::before { animation: none; }
  .dt-bar span { transition: none; }
  .row-flash { animation-duration: 1ms; }
  .ins-search-match { animation-duration: 1ms; }

  .enter > *, .stagger > * {
    animation: none;
    opacity: 1;
    transform: none;
  }

  .chart .series-line { stroke-dasharray: none; stroke-dashoffset: 0; transition: none; }
  .chart .series-area { opacity: 1; transition: none; }
  .chart .bar-rect { transform: scaleY(1); transition: none; }

  .org-menu, .toast, .sidebar {
    transition-property: opacity, visibility;
    transition-duration: 160ms;
  }
  .org-menu { transform: none; }
  .toast[data-enter="true"] { transform: none; }
}

/* ===================== Equipo → Fotos de tienda (13/10) ===================== */
.ft-datenav { display: inline-flex; align-items: center; gap: 6px; padding: 4px; border-radius: var(--r-full); background: var(--raise); border: 1px solid var(--line); }
.ft-arrow {
  width: 34px; height: 34px; display: grid; place-items: center; border: 0; border-radius: var(--r-full);
  background: transparent; color: var(--ink-2); cursor: pointer;
  transition: background var(--d-hover) var(--ease-out), color var(--d-hover) var(--ease-out), transform 120ms var(--ease-out);
}
.ft-arrow:first-child svg { transform: rotate(90deg); }
.ft-arrow:last-child svg { transform: rotate(-90deg); }
.ft-arrow:hover:not(:disabled) { background: var(--surface); color: var(--acc-text); }
.ft-arrow:active:not(:disabled) { transform: scale(0.9); }
.ft-arrow:disabled { opacity: 0.35; cursor: default; }
.ft-date { min-width: 150px; text-align: center; font-weight: 600; font-size: 14px; text-transform: capitalize; }

.ft-emps { display: grid; gap: var(--s-4); grid-template-columns: repeat(auto-fill, minmax(min(100%, 340px), 1fr)); }
.ft-emp { padding: var(--s-4); border-radius: var(--r-lg); background: var(--raise); border: 1px solid var(--line-soft); }
.ft-emp-head { display: flex; align-items: center; gap: 10px; margin-bottom: var(--s-3); }
.ft-avatar {
  width: 36px; height: 36px; border-radius: 50%; display: grid; place-items: center; flex: none;
  font-size: 13px; font-weight: 700; color: var(--acc-ink); background: var(--acc);
}
.ft-tiles { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.ft-tile {
  position: relative; aspect-ratio: 3 / 4; padding: 0; overflow: hidden; border-radius: var(--r-md);
  border: 1px solid var(--line); background: var(--surface); cursor: zoom-in; font: inherit; color: inherit;
  transition: transform 200ms var(--ease-out), box-shadow 200ms var(--ease-out);
}
.ft-tile img { width: 100%; height: 100%; object-fit: cover; display: block; transition: transform 400ms var(--ease-out); }
.ft-tile:hover { transform: translateY(-2px); box-shadow: var(--shadow-card); }
.ft-tile:hover img { transform: scale(1.04); }
.ft-tile:active { transform: scale(0.98); }
.ft-tile-meta {
  position: absolute; inset: auto 0 0 0; display: flex; flex-direction: column; align-items: flex-start; gap: 2px;
  padding: 22px 10px 8px; font-size: 12px; color: #fff;
  background: linear-gradient(to top, rgba(84,68,124,.78), transparent);
}
.ft-tile-meta span { display: inline-flex; align-items: center; gap: 4px; font-size: 14px; font-weight: 650; white-space: nowrap; font-variant-numeric: tabular-nums; }
.ft-missing { cursor: default; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 4px; border-style: dashed; color: var(--ink-3); background: transparent; }
.ft-missing:hover { transform: none; box-shadow: none; }
.ft-missing b { font-size: 13px; color: var(--ink-2); }
.ft-missing small { font-size: 12px; }

.ft-modal { width: min(880px, 100%); padding: 0; display: grid; grid-template-columns: minmax(0, 1.2fr) minmax(0, 1fr); overflow: hidden; }
.ft-modal img { width: 100%; height: 100%; max-height: 80vh; object-fit: cover; display: block; background: var(--ink); }
.ft-modal-info { padding: var(--s-6); display: flex; flex-direction: column; gap: var(--s-4); }
.ft-modal-title { display: flex; align-items: center; gap: 10px; font-size: 18px; }
.ft-modal dl { margin: 0; display: grid; gap: 4px 0; }
.ft-modal dt { font-size: 12px; color: var(--ink-3); margin-top: 8px; }
.ft-modal dd { margin: 0; font-weight: 550; font-variant-numeric: tabular-nums; }
@media (max-width: 720px) {
  .ft-modal { grid-template-columns: 1fr; overflow-y: auto; }
  .ft-modal img { max-height: 52vh; }
  .ft-date { min-width: 120px; }
}

/* ===================== Editar checklist por tienda (14/10) ===================== */
.cfg-cat-head { align-items: center; flex-wrap: wrap; gap: var(--s-3); }
.cfg-cat-title { flex: 1 1 220px; min-width: 0; }
.cfg-cat-tools { display: inline-flex; gap: 4px; }
.cfg-cat-tools .icon-btn:disabled { opacity: 0.3; cursor: default; }
.rot-up { display: inline-flex; transform: rotate(180deg); }
.cfg-inline-form { display: flex; gap: var(--s-2); flex-wrap: wrap; align-items: center; margin-top: var(--s-3); width: 100%; }
.cfg-cat-title .cfg-inline-form { margin-top: 0; }
.cfg-inline-form .input { flex: 1 1 200px; min-width: 0; height: 42px; }
.cfg-confirm {
  display: flex; align-items: center; gap: var(--s-3); flex-wrap: wrap; margin: var(--s-3) 0; padding: var(--s-3) var(--s-4);
  border-radius: var(--r-md); background: var(--crit-wash); border: 1px solid color-mix(in srgb, var(--crit) 30%, transparent);
  font-size: 14px; animation: rise 260ms var(--ease-out);
}
.cfg-confirm span { flex: 1 1 260px; }
.cfg-copy { display: flex; flex-direction: column; gap: var(--s-3); align-items: flex-start; margin-top: var(--s-4); padding-top: var(--s-4); border-top: 1px solid var(--line-soft); animation: rise 260ms var(--ease-out); }
.cfg-copy .login-field { align-self: stretch; max-width: 360px; }
.cfg-item-tools { display: flex; flex-wrap: wrap; gap: var(--s-3); align-items: center; margin-top: 6px; }
.cfg-picker { margin-top: var(--s-3); border: 1px solid var(--line); border-radius: var(--r-lg); background: var(--raise); overflow: hidden; animation: rise 260ms var(--ease-out); }
.cfg-pick-head { display: flex; align-items: center; gap: var(--s-3); flex-wrap: wrap; padding: var(--s-3); border-bottom: 1px solid var(--line-soft); }
.cfg-pick-head .input { flex: 1 1 220px; height: 40px; }
.cfg-pick-list { max-height: 320px; overflow-y: auto; overscroll-behavior: contain; }
.cfg-pick-row {
  display: flex; align-items: center; gap: var(--s-3); width: 100%; padding: 11px var(--s-4); border: 0; border-bottom: 1px solid var(--line-soft);
  background: transparent; color: inherit; font: inherit; text-align: left; cursor: pointer;
  transition: background 160ms var(--ease-out), padding-left 160ms var(--ease-out);
}
.cfg-pick-row:last-child { border-bottom: 0; }
.cfg-pick-row:hover:not(:disabled) { background: var(--acc-wash); padding-left: calc(var(--s-4) + 4px); }
.cfg-pick-row:active:not(:disabled) { background: color-mix(in srgb, var(--acc) 20%, transparent); }
.cfg-pick-row:disabled { opacity: 0.4; }
.cfg-pick-name { flex: 1; font-weight: 600; font-size: 14px; min-width: 0; }
.cfg-pick-cat { font-size: 12px; color: var(--ink-3); }
.cfg-pick-add { width: 26px; height: 26px; border-radius: 50%; display: grid; place-items: center; background: var(--acc); color: var(--acc-ink); flex: none; }
.cfg-pick-empty { padding: var(--s-5); text-align: center; color: var(--ink-3); font-size: 14px; }

/* ============================ Compras (14/10) ============================ */
.icon-btn-sq { width: 40px; padding: 0; justify-content: center; }
.cp-stores { display: grid; gap: var(--s-4); grid-template-columns: repeat(auto-fit, minmax(min(100%, 220px), 1fr)); }
.cp-store {
  display: flex; flex-direction: column; gap: 8px; padding: var(--s-4); text-align: left; font: inherit; color: inherit; cursor: pointer;
  border: 1px solid var(--line); transition: transform 200ms var(--ease-out), opacity 200ms var(--ease-out), box-shadow 200ms var(--ease-out);
}
.cp-store:hover { transform: translateY(-2px); }
.cp-store:active { transform: scale(0.98); }
.cp-store.is-off { opacity: 0.45; }
.cp-store-top { display: flex; justify-content: space-between; align-items: center; gap: 8px; }
.cp-store-top b { font-size: 16px; }
.cp-store-date { display: inline-flex; align-items: center; gap: 6px; color: var(--ink-2); font-size: 13.5px; font-weight: 550; }
.cp-store-nums { display: flex; justify-content: space-between; gap: 8px; font-size: 13px; color: var(--ink-3); font-variant-numeric: tabular-nums; }
.cp-rev { color: var(--crit); font-weight: 650; }
.cp-ok { color: var(--good); font-weight: 650; }
.cp-controls { display: flex; gap: var(--s-3); flex-wrap: wrap; align-items: center; }
.cp-search { flex: 1 1 240px; max-width: 420px; height: 42px; }

.cp-card { padding: 0; overflow: clip; } /* clip, no hidden: hidden crea su propio scroll y la cabecera sticky se desplazaba dentro de la tarjeta */
.cp-row { display: grid; grid-template-columns: minmax(0, 1.7fr) repeat(var(--cp-n, 2), minmax(0, 1fr)); gap: var(--s-3); align-items: center; padding: 12px var(--s-5); border-bottom: 1px solid var(--line-soft); transition: background 160ms var(--ease-out); }
.cp-row[hidden], .cp-group[hidden] { display: none; }
.cp-row:not(.cp-head):hover { background: var(--raise); }
.cp-head { position: sticky; top: var(--topbar-h, 64px); z-index: 3; background: color-mix(in srgb, var(--surface) 94%, transparent); font-size: 12.5px; font-weight: 700; color: var(--ink-2); text-transform: uppercase; letter-spacing: 0.04em; }
.cp-head span:not(:first-child) { text-align: center; }
.cp-group-title { display: flex; align-items: center; gap: 8px; margin: 0; padding: 14px var(--s-5) 8px; font-size: 13px; font-weight: 700; color: var(--ink-2); background: var(--raise); letter-spacing: 0.02em; }
.cp-row.is-low { box-shadow: inset 3px 0 0 var(--crit); background: color-mix(in srgb, var(--crit) 5%, transparent); }
.cp-prod { display: flex; flex-direction: column; gap: 2px; min-width: 0; }
.cp-prod b { font-size: 14px; font-weight: 600; overflow-wrap: anywhere; }
.cp-prod small { font-size: 12px; color: var(--ink-3); }
.cp-cell { display: flex; justify-content: center; align-items: center; min-width: 0; }
.cp-qty { display: inline-flex; align-items: baseline; gap: 4px; font-variant-numeric: tabular-nums; }
.cp-qty b { font-size: 17px; font-weight: 700; }
.cp-qty small { font-size: 11.5px; color: var(--ink-3); }
.cp-qty.zero b { color: var(--crit); }
.cp-pill { display: inline-flex; padding: 4px 11px; border-radius: var(--r-full); font-size: 12.5px; font-weight: 650; }
.cp-pill.vacio { color: var(--crit); background: var(--crit-wash); }
.cp-pill.poco { color: var(--warn); background: var(--warn-wash); }
.cp-pill.bien { color: var(--good); background: var(--good-wash); }
.cp-none { font-size: 12px; color: var(--ink-3); font-style: italic; text-align: center; }
.cp-na { color: var(--ink-3); opacity: 0.5; }
.cp-nothing { padding: var(--s-6); text-align: center; color: var(--ink-3); }
@media (max-width: 560px) {
  .cp-row { padding: 12px var(--s-3); gap: var(--s-2); grid-template-columns: minmax(0, 1.5fr) repeat(var(--cp-n, 2), minmax(0, 1fr)); }
  .cp-group-title { padding-inline: var(--s-3); }
  .cp-head { font-size: 11px; letter-spacing: 0; }
  .cp-qty b { font-size: 15px; }
  .cp-pill { padding: 3px 8px; font-size: 11.5px; }
}
.ft-date { text-transform: none; }
.ft-date::first-letter { text-transform: uppercase; }

/* ===================== Mínimos por producto y tienda (14/10) ===================== */
.cfg-tabs { margin-bottom: var(--s-4); }
.mn-fields { display: flex; gap: var(--s-3); align-items: flex-end; flex-wrap: wrap; justify-content: flex-end; }
.mn-field { display: flex; flex-direction: column; gap: 4px; font-size: 12px; font-weight: 600; color: var(--ink-3); }
.mn-inputwrap { position: relative; display: inline-flex; align-items: center; }
.mn-inputwrap .input { width: 108px; height: 40px; padding-right: 34px; text-align: right; font-weight: 650; font-size: 15px; font-variant-numeric: tabular-nums; -moz-appearance: textfield; }
.mn-inputwrap .input::-webkit-outer-spin-button, .mn-inputwrap .input::-webkit-inner-spin-button { -webkit-appearance: none; }
.mn-inputwrap em { position: absolute; right: 10px; font-style: normal; font-size: 11.5px; font-weight: 500; color: var(--ink-3); pointer-events: none; }
.mn-field .select { height: 40px; min-width: 150px; }
.mn-ok { width: 22px; height: 22px; border-radius: 50%; display: grid; place-items: center; background: var(--good); color: #fff; opacity: 0; transform: scale(0.5); transition: opacity 200ms var(--ease-out), transform 260ms var(--ease-out); align-self: center; }
.mn-row.mn-saved .mn-ok { opacity: 1; transform: scale(1); }
.mn-row.mn-saved { background: color-mix(in srgb, var(--good) 8%, transparent); }
.mn-row { transition: background 400ms var(--ease-out); }
@media (max-width: 720px) {
  .mn-row { flex-wrap: wrap; }
  .mn-row .row-main { flex: 1 1 calc(100% - 44px); }
  .mn-fields { flex: 1 1 100%; justify-content: flex-start; padding-left: 0; }
  .mn-inputwrap .input { width: 120px; }
}

/* Compras: mínimos y "a comprar" */
.cp-qty-wrap { display: inline-flex; flex-direction: column; align-items: center; gap: 2px; }
.cp-qty.zero b { color: var(--crit); }
.cp-buy { font-size: 11.5px; font-weight: 700; color: var(--crit); background: var(--crit-wash); padding: 1px 8px; border-radius: var(--r-full); }
.cp-min { font-size: 11px; color: var(--ink-3); font-variant-numeric: tabular-nums; }
.cp-total { display: inline-flex; align-items: baseline; justify-content: center; gap: 4px; }
.cp-total b { font-size: 18px; font-weight: 750; color: var(--acc-text); font-variant-numeric: tabular-nums; }
.cp-total small { font-size: 11.5px; color: var(--ink-3); }
.cp-total-h { color: var(--acc-text); }
.cp-legend { margin: 0; font-size: 12.5px; color: var(--ink-3); }
.cp-buy { white-space: nowrap; font-style: normal; }
.cp-buy i { font-style: normal; }
.cp-head span { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
@media (max-width: 560px) {
  .cp-head { font-size: 10px; gap: 4px; }
  .cp-buy i { display: none; }
  .cp-buy::before { content: "+"; }
  .cp-buy { font-size: 11.5px; padding: 1px 7px; }
  .cp-total b { font-size: 16px; }
  .cp-total-h { text-align: center; }
}

/* ======================= Equipo → Usuarios (14/10) ======================= */
.us-gate { max-width: 520px; display: flex; flex-direction: column; gap: var(--s-4); }
.us-gate-ico { width: 44px; height: 44px; }
.us-form { display: flex; flex-direction: column; gap: var(--s-3); }
.us-form[class*="shake"], .shake { animation: login-shake 420ms var(--ease-out); }
.us-grid { display: grid; gap: var(--s-4); grid-template-columns: repeat(2, minmax(0, 1fr)); }
.us-grid .us-span { grid-column: 1 / -1; }
.us-grid .input, .us-grid .select, .us-inline .input, .us-inline .select, .us-form .input { height: 44px; }
.login-field small { font-weight: 400; color: var(--ink-3); font-size: 12px; }
.us-secs { border: 0; padding: 0; margin: 0; min-width: 0; }
.us-inline .us-secs.login-field { flex: 1 1 100%; order: 1; }
.us-inline > .btn { order: 2; }
.us-secs-row { display: flex; flex-wrap: wrap; gap: var(--s-2); margin-top: 6px; }
.us-sec { position: relative; cursor: pointer; }
.us-sec input { position: absolute; opacity: 0; inset: 0; cursor: pointer; }
.us-sec span { display: inline-flex; align-items: center; gap: 8px; min-height: 40px; padding: 0 16px; border-radius: 999px; border: 1.5px solid var(--line); color: var(--ink-3); font-weight: 600; font-size: 14px; transition: background 200ms var(--ease-out), border-color 200ms var(--ease-out), color 200ms var(--ease-out), transform 160ms var(--ease-out); }
.us-sec span::before { content: ""; width: 10px; height: 10px; border-radius: 50%; border: 1.5px solid currentColor; transition: background 200ms var(--ease-out), box-shadow 200ms var(--ease-out); }
.us-sec input:checked + span { background: color-mix(in srgb, var(--acc) 16%, transparent); border-color: var(--acc); color: var(--ink); }
.us-sec input:checked + span::before { background: var(--acc); border-color: var(--acc); box-shadow: 0 0 0 3px color-mix(in srgb, var(--acc) 25%, transparent); }
.us-sec input:active + span { transform: scale(0.96); }
.us-sec input:focus-visible + span { outline: 2px solid var(--acc); outline-offset: 2px; }
.us-pinrow { display: flex; gap: var(--s-2); }
.us-pinrow .input { flex: 1; min-width: 0; letter-spacing: 0.18em; font-variant-numeric: tabular-nums; font-weight: 650; }
.us-inline { display: flex; gap: var(--s-3); flex-wrap: wrap; align-items: flex-end; }
.us-inline .login-field { flex: 1 1 180px; }
.us-list { display: flex; flex-direction: column; }
.us-user { border-bottom: 1px solid var(--line-soft); padding: var(--s-3) 0; transition: opacity 200ms var(--ease-out); }
.us-user:last-child { border-bottom: 0; }
.us-user.is-off .us-who, .us-user.is-off .ft-avatar { opacity: 0.55; }
.us-row { display: flex; align-items: center; gap: var(--s-3); }
.us-who { flex: 1; min-width: 0; }
.us-who .row-sub { display: flex; align-items: center; gap: 4px; flex-wrap: wrap; }
.us-tools { display: inline-flex; gap: 4px; }
.us-panel { margin: var(--s-3) 0 var(--s-1) 48px; padding: var(--s-4); border-radius: var(--r-lg); background: var(--raise); border: 1px solid var(--line-soft); animation: rise 260ms var(--ease-out); }
.us-user .cfg-confirm { margin-left: 48px; }
.us-secret { border: 1.5px solid color-mix(in srgb, var(--acc) 55%, transparent); animation: rise 320ms var(--ease-out) forwards; }
.us-secret .card-title { display: flex; align-items: center; gap: 8px; }
.us-secret-grid { display: grid; grid-template-columns: max-content 1fr; gap: 6px var(--s-5); margin: var(--s-3) 0 var(--s-4); }
.us-secret-grid dt { color: var(--ink-3); font-size: 13px; }
.us-secret-grid dd { margin: 0; font-weight: 600; overflow-wrap: anywhere; }
.us-secret-grid .us-pin { font-family: var(--font-sans); font-size: 26px; letter-spacing: 0.22em; color: var(--acc-text); font-weight: 700; }
@media (max-width: 720px) {
  .us-grid { grid-template-columns: minmax(0, 1fr); }
  .us-row { flex-wrap: wrap; }
  .us-who { flex: 1 1 calc(100% - 52px); }
  .us-tools { flex: 1 1 100%; justify-content: flex-start; padding-left: 48px; }
  .us-panel, .us-user .cfg-confirm { margin-left: 0; }
}
.emp-out { width: 100%; justify-content: center; gap: 8px; }

/* ---- Compras: un cuadro por categoría, uno debajo del otro (15/10) ----
   Misma estética que Costos generales: cuadro de cristal con su título y cada
   producto en su píldora. El título pliega/abre el cuadro con animación. */
.cpx-list { display: flex; flex-direction: column; gap: var(--s-5); }
.cpx-box { padding: var(--s-5); display: flex; flex-direction: column; animation: cpx-in 380ms var(--ease-out) both; }
.cpx-box:nth-child(2) { animation-delay: 40ms; } .cpx-box:nth-child(3) { animation-delay: 80ms; }
.cpx-box:nth-child(4) { animation-delay: 120ms; } .cpx-box:nth-child(n+5) { animation-delay: 160ms; }
@keyframes cpx-in { from { opacity: 0; transform: translateY(10px); } }
.cpx-box[hidden] { display: none; }
.cpx-head { all: unset; box-sizing: border-box; display: flex; align-items: center; justify-content: space-between; gap: var(--s-3); cursor: pointer; border-radius: var(--r-md); }
.cpx-head:focus-visible { outline: 2px solid var(--acc); outline-offset: 4px; }
.cpx-title { display: flex; align-items: center; gap: 8px; margin: 0; }
.cpx-count { font-size: 12.5px; font-weight: 650; color: var(--ink-3); margin-left: 4px; font-variant-numeric: tabular-nums; }
.cpx-right { display: flex; align-items: center; gap: 10px; }
.cpx-alert { font-size: 12px; font-weight: 700; color: var(--crit); background: var(--crit-wash); padding: 3px 10px; border-radius: var(--r-full); white-space: nowrap; }
.cpx-chev { display: grid; place-items: center; width: 30px; height: 30px; border-radius: 50%; border: 1px solid var(--line-soft); color: var(--ink-2); transition: transform 280ms var(--ease-out), background 160ms var(--ease-out), color 160ms; }
.cpx-head:hover .cpx-chev { background: var(--raise); color: var(--acc-text); }
.cpx-head:active .cpx-chev { transform: scale(0.9); }
.cpx-box.is-closed .cpx-chev { transform: rotate(-90deg); }
.cpx-box.is-closed .cpx-head:active .cpx-chev { transform: rotate(-90deg) scale(0.9); }
.cpx-fold { display: grid; grid-template-rows: 1fr; transition: grid-template-rows 320ms var(--ease-out), opacity 240ms var(--ease-out); }
.cpx-box.is-closed .cpx-fold { grid-template-rows: 0fr; opacity: 0; }
.cpx-body { min-height: 0; overflow: hidden; display: flex; flex-direction: column; gap: var(--s-2); }
.cpx-cols { margin-top: var(--s-3); }
.cpx-cols, .cpx-pill { display: grid; grid-template-columns: minmax(0, 1.7fr) repeat(var(--cp-n, 2), minmax(0, 1fr)); gap: var(--s-3); align-items: center; }
.cpx-cols { padding: 0 14px; font-size: 11.5px; font-weight: 700; color: var(--ink-3); text-transform: uppercase; letter-spacing: 0.05em; }
.cpx-cols span:not(:first-child) { text-align: center; }
.cpx-pill { border: 1px solid var(--line-soft); border-radius: var(--r-md); padding: 10px 14px; background: color-mix(in srgb, var(--surface) 70%, transparent); transition: transform 160ms var(--ease-out), border-color 160ms, background 160ms; }
.cpx-pill:hover { transform: translateY(-1px); border-color: var(--line); background: var(--raise); }
.cpx-pill[hidden] { display: none; }
.cpx-pill.is-low { border-color: color-mix(in srgb, var(--crit) 35%, transparent); background: color-mix(in srgb, var(--crit) 6%, transparent); }
.cpx-list .cp-nothing { padding: var(--s-6); }
@media (max-width: 640px) {
  .cpx-box { padding: var(--s-4); }
  .cpx-cols, .cpx-pill { grid-template-columns: minmax(0, 1.5fr) repeat(var(--cp-n, 2), minmax(0, 1fr)); gap: var(--s-2); }
  .cpx-cols { padding: 0 10px; font-size: 10.5px; letter-spacing: 0; }
  .cpx-pill { padding: 9px 10px; }
  .cpx-alert { padding: 2px 8px; font-size: 11px; }
}
@media (prefers-reduced-motion: reduce) { .cpx-box, .cpx-fold, .cpx-chev, .cpx-pill { animation: none; transition: none; } }

/* ===== Pedir (21/10): círculo que se enciende + cuántos pedir ===== */
.cp-ord { display: inline-flex; align-items: center; gap: 6px; flex-wrap: wrap; justify-content: center; margin-top: 4px; }
.ord-dot { display: inline-flex; align-items: center; gap: 6px; padding: 3px 9px 3px 4px; border: 1px solid var(--line); border-radius: var(--r-full); background: transparent; color: var(--ink-3); font: inherit; font-size: 11.5px; font-weight: 650; cursor: pointer; transition: background 180ms var(--ease-out), border-color 180ms, color 180ms, transform 120ms; }
.ord-dot span { display: grid; place-items: center; width: 18px; height: 18px; border-radius: 50%; border: 1.5px solid var(--ink-3); color: transparent; transition: background 180ms var(--ease-out), border-color 180ms, color 180ms, transform 260ms cubic-bezier(.34,1.56,.64,1); }
.ord-dot em { font-style: normal; }
.ord-dot:hover { border-color: var(--acc); color: var(--ink-2); }
.ord-dot:active { transform: scale(0.94); }
.ord-dot[aria-pressed="true"] { background: var(--acc-wash); border-color: var(--acc); color: var(--acc-text); }
.ord-dot[aria-pressed="true"] span { background: var(--acc); border-color: var(--acc); color: #fff; transform: scale(1.08); }
.ord-step { display: inline-flex; align-items: center; border: 1px solid var(--acc); border-radius: var(--r-full); animation: ordIn 220ms var(--ease-out); }
.ord-step button { width: 24px; height: 24px; border: 0; background: transparent; color: var(--acc-text); font-size: 16px; font-weight: 700; cursor: pointer; border-radius: 50%; transition: background 140ms, transform 100ms; }
.ord-step button:hover { background: var(--acc-wash); }
.ord-step button:active { transform: scale(0.8); }
.ord-step b { min-width: 26px; text-align: center; font-size: 13.5px; font-variant-numeric: tabular-nums; }
@keyframes ordIn { from { opacity: 0; transform: scale(0.85); } to { opacity: 1; transform: none; } }
.cp-packhint { color: var(--acc-text); font-weight: 600; }
.cp-buy i { font-style: normal; }
.cp-orders { margin-bottom: var(--s-4); }
.cp-orders-empty { margin: 0; padding: 4px 2px 2px; color: var(--ink-3); font-size: 13.5px; }
.cp-ord-group { margin-top: var(--s-3); }
.cp-ord-group h4 { margin: 0 0 6px; font-size: 11.5px; font-weight: 700; letter-spacing: 0.06em; text-transform: uppercase; color: var(--acc-text); }
.cp-ord-line { display: grid; grid-template-columns: minmax(0, 1.6fr) minmax(0, 1.4fr) auto; gap: var(--s-3); align-items: center; padding: 8px 12px; border: 1px solid var(--line-soft); border-radius: var(--r-md); margin-bottom: 6px; background: color-mix(in srgb, var(--surface) 70%, transparent); animation: ordIn 220ms var(--ease-out); }
.cp-ord-name { display: flex; flex-direction: column; font-weight: 600; font-size: 14px; }
.cp-ord-name small { color: var(--ink-3); font-weight: 500; font-size: 11.5px; }
.cp-ord-stores { display: flex; flex-wrap: wrap; gap: 4px; }
.cp-ord-stores i { font-style: normal; font-size: 11.5px; padding: 2px 8px; border-radius: var(--r-full); background: var(--acc-wash); color: var(--ink-2); }
.cp-ord-total { font-size: 16px; color: var(--acc-text); font-variant-numeric: tabular-nums; white-space: nowrap; }
.cp-ord-total small { font-size: 11.5px; color: var(--ink-3); font-weight: 600; }
.reg-unitword { margin-left: 6px; font-size: 12px; color: var(--ink-3); }
.reg-ord { display: flex; align-items: center; gap: 8px; justify-content: flex-end; margin-top: 6px; }
@media (max-width: 720px) {
  .cp-ord-line { grid-template-columns: 1fr auto; }
  .cp-ord-stores { grid-column: 1 / -1; order: 3; }
}
/* Móvil: el botón «Pedir» SIEMPRE dice «Pedir» (antes se quedaba en un puntito sin texto)
   y cada producto pasa a tarjeta: nombre arriba, una fila por tienda, dedo cómodo. */
@media (max-width: 720px) {
  .cpx-cols { display: none; }
  .cpx-body { padding-top: var(--s-3); }
  .cpx-pill .cp-cell.cp-total { justify-content: flex-start; gap: 6px; }
  .cpx-pill { display: flex; flex-direction: column; align-items: stretch; gap: 0; padding: 12px 14px; }
  .cpx-pill .cp-prod { padding-bottom: 8px; margin-bottom: 4px; border-bottom: 1px dashed var(--line-soft); }
  .cpx-pill .cp-prod b { font-size: 15.5px; }
  .cpx-pill .cp-cell { display: flex; align-items: center; justify-content: space-between; gap: 10px; padding: 6px 0; min-height: 48px; }
  .cpx-pill .cp-cell::before { content: attr(data-label); flex: 0 0 76px; font-size: 12px; font-weight: 700; letter-spacing: 0.04em; text-transform: uppercase; color: var(--ink-3); }
  .cpx-pill .cp-cell:has(> .cp-na) { display: none; }
  .cpx-pill .cp-qty-wrap { flex: 1; display: flex; flex-direction: row; align-items: center; justify-content: space-between; gap: 8px; flex-wrap: wrap; min-width: 0; }
  .cpx-pill .cp-cell.cp-total { margin-top: 2px; border-top: 1px solid var(--line-soft); padding-top: 8px; }
  .cpx-pill .cp-cell.cp-total::before { content: attr(data-label); }
  .cpx-pill .cp-cell.cp-total:has(> .cp-na) { display: none; }
  .cp-ord { margin-top: 0; flex: 0 0 auto; justify-content: flex-end; }
  .ord-dot { min-height: 40px; padding: 4px 14px 4px 6px; gap: 8px; font-size: 14px; }
  .ord-dot span { width: 24px; height: 24px; }
  .ord-step button { width: 40px; height: 40px; font-size: 20px; }
  .ord-step b { min-width: 32px; font-size: 16px; }
  .cp-pill, .cp-qty { font-size: 15px; }
}
@media (prefers-reduced-motion: reduce) { .ord-step, .cp-ord-line { animation: none; } .ord-dot, .ord-dot span { transition: none; } }

/* ==================== Facturas por renglón (21/10) ==================== */
/* Panel de productos de una factura (en Pendientes y en Facturas). El color
   cuenta el estado: ámbar = falta revisar, verde = reconocido, rojo/verde en
   la comparación de precio = subió/bajó. Nada aparece de golpe. */
.inv { margin: var(--s-3) 0; padding: var(--s-4); border-radius: var(--r-lg); background: var(--raise); border: 1px solid var(--line); }
.inv:empty { display: none; }
.inv-head { display: flex; flex-wrap: wrap; align-items: flex-end; justify-content: space-between; gap: var(--s-3); margin-bottom: var(--s-3); }
.inv-title { font-size: var(--t-base); font-weight: 640; letter-spacing: -0.015em; }
.inv-count { display: inline-block; padding: 1px 8px; border-radius: var(--r-full); background: var(--warn-wash); color: var(--warn); font-weight: 650; font-variant-numeric: tabular-nums; transition: background-color var(--d-move) var(--ease-out), color var(--d-move) var(--ease-out); }
.inv-count.all { background: var(--good-wash); color: var(--good); }
.inv-store { display: flex; align-items: center; gap: var(--s-2); flex-wrap: wrap; }
.inv-store .input { width: 190px; max-width: 100%; padding-top: 6px; padding-bottom: 6px; }
.il-list { display: grid; gap: var(--s-2); }
.il { position: relative; padding: 10px 12px 10px 15px; border-radius: var(--r-md); background: var(--surface); border: 1px solid var(--line);
  animation: il-in 320ms var(--ease-out) both; transition: border-color var(--d-move) var(--ease-out), box-shadow var(--d-move) var(--ease-out), opacity var(--d-move) var(--ease-out); }
.il::before { content: ""; position: absolute; left: 0; top: 8px; bottom: 8px; width: 3px; border-radius: 3px; background: var(--warn); transition: background-color var(--d-move) var(--ease-out); }
.il-confirmed::before { background: var(--good); }
.il-ignored::before { background: var(--ink-3); }
.il-ignored { opacity: .78; }
.il-editing { border-color: color-mix(in srgb, var(--acc) 38%, var(--line)); box-shadow: 0 0 0 3px var(--acc-wash); }
.il:nth-child(2) { animation-delay: 40ms; } .il:nth-child(3) { animation-delay: 80ms; } .il:nth-child(4) { animation-delay: 120ms; }
.il:nth-child(5) { animation-delay: 150ms; } .il:nth-child(n+6) { animation-delay: 180ms; }
@keyframes il-in { from { opacity: 0; transform: translateY(8px); } to { opacity: 1; transform: none; } }
.il-flash { animation: il-in 320ms var(--ease-out) both, row-flash 1.6s var(--ease-out) both; }
.il-top { display: flex; align-items: baseline; justify-content: space-between; gap: var(--s-3); }
.il-raw { display: flex; flex-wrap: wrap; align-items: baseline; gap: 4px var(--s-2); min-width: 0; }
.il-name { font-weight: 620; font-size: var(--t-md); overflow-wrap: anywhere; }
.il-code { font-family: var(--font-mono); font-size: var(--t-xs); color: var(--ink-3); }
.il-amt { white-space: nowrap; font-size: var(--t-md); color: var(--ink-2); font-variant-numeric: tabular-nums; }
.il-amt b { color: var(--ink); font-weight: 650; }
.il-amt small { margin-left: 6px; color: var(--good); font-size: var(--t-xs); }
.il-edit { display: flex; flex-wrap: wrap; align-items: center; gap: var(--s-2) var(--s-3); margin-top: var(--s-3); }
.il-pick { flex: 2 1 280px; display: flex; flex-wrap: wrap; align-items: center; gap: var(--s-2); min-width: 0; }
.il-pick .select { flex: 1 1 200px; min-width: 0; }
.il-pack { flex: 0 0 auto; display: flex; flex-wrap: wrap; align-items: center; gap: var(--s-2); font-size: var(--t-sm); color: var(--ink-2); }
.il-pack .input { width: 84px; }
.il-pack .select { width: 100px; }
.il-actions { flex: 0 0 auto; display: flex; flex-wrap: wrap; gap: var(--s-2); }
.il-err { flex-basis: 100%; color: var(--crit) !important; min-height: 0; }
.il-err:empty { display: none; }
.il-done { display: flex; align-items: center; gap: var(--s-2); margin-top: 6px; flex-wrap: wrap; }
.il-mark { display: inline-grid; place-items: center; width: 20px; height: 20px; border-radius: 50%; background: var(--raise); color: var(--ink-3); flex: 0 0 20px; }
.il-mark.ok { background: var(--good-wash); color: var(--good); }
.il-flash .il-mark.ok { animation: ordIn 420ms var(--ease-out) both; }
.il-map { flex: 1 1 200px; min-width: 0; font-size: var(--t-md); display: flex; flex-wrap: wrap; align-items: center; gap: 4px 6px; }
.il-pk { color: var(--ink-3); }
.il-chg { padding: 4px 11px; font-size: var(--t-sm); }
.il-note { margin-top: 6px; font-size: var(--t-sm); color: var(--warn); }
.il-cmp { margin-top: var(--s-2); padding: 9px 12px; border-radius: var(--r-md); display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: var(--s-2) var(--s-4);
  animation: il-in 360ms var(--ease-out) both; }
.il-cmp.up { background: var(--warn-wash); } .il-cmp.down { background: var(--good-wash); }
.il-cmp.done { background: transparent; padding: 4px 0 0; justify-content: flex-start; gap: var(--s-3); }
.il-cmp-nums { display: flex; flex-wrap: wrap; align-items: center; gap: var(--s-3); }
.il-cmp-nums small { display: block; font-size: var(--t-xs); color: var(--ink-3); }
.il-cmp-nums b, .il-nums { font-variant-numeric: tabular-nums; font-weight: 640; }
.il-nums { font-size: var(--t-sm); color: var(--ink-2); font-weight: 520; }
.il-arrow { color: var(--ink-3); }
.il-cmp-act { display: flex; flex-wrap: wrap; gap: var(--s-2); }
.inv-foot { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: var(--s-2) var(--s-4); margin-top: var(--s-3); font-size: var(--t-sm); color: var(--ink-2); font-variant-numeric: tabular-nums; }
.inv-foot b { color: var(--ink); }
.inv-foot .btn { margin-left: auto; padding: 4px 11px; font-size: var(--t-sm); }
.inv-empty { display: grid; gap: var(--s-2); justify-items: start; }
.inv-dots { display: inline-flex; gap: 3px; vertical-align: middle; margin-left: 4px; }
.inv-dots i { width: 5px; height: 5px; border-radius: 50%; background: var(--acc); animation: inv-dot 1.1s var(--ease-in-out) infinite; }
.inv-dots i:nth-child(2) { animation-delay: .15s; } .inv-dots i:nth-child(3) { animation-delay: .3s; }
@keyframes inv-dot { 0%, 100% { opacity: .25; transform: translateY(0); } 50% { opacity: 1; transform: translateY(-3px); } }

/* Vista Facturas */
.fac-tabbar { margin-bottom: var(--s-4); overflow-x: auto; }
.fac-banner { margin-bottom: var(--s-4); padding: var(--s-4) var(--s-5); }
.fac-prog { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: var(--s-3); font-size: var(--t-md); }
.fac-prog > span { flex: 1 1 240px; }
.fac-bar { flex: 1 1 100%; height: 8px; border-radius: var(--r-full); background: var(--raise); overflow: hidden; }
.fac-bar i { display: block; height: 100%; border-radius: inherit; background: var(--acc); transition: width 600ms var(--ease-out); }
.fac-list { gap: var(--s-3); }
.fac-card { padding: var(--s-4) var(--s-5); }
.fac-top { display: flex; flex-wrap: wrap; align-items: center; gap: var(--s-3) var(--s-4); }
.fac-thumb { display: block; width: 52px; height: 52px; border-radius: var(--r-md); overflow: hidden; flex: 0 0 52px; border: 1px solid var(--line); transition: transform var(--d-hover) var(--ease-out); }
.fac-thumb img { width: 100%; height: 100%; object-fit: cover; display: block; }
@media (hover: hover) and (pointer: fine) { .fac-thumb:hover { transform: scale(1.06); } }
.fac-meta { flex: 1 1 180px; min-width: 0; }
.fac-meta .card-title { overflow-wrap: anywhere; font-size: var(--t-base); }
.fac-body { display: grid; grid-template-rows: 0fr; transition: grid-template-rows var(--d-move) var(--ease-out); }
.fac-card.open .fac-body { grid-template-rows: 1fr; }
.fac-body-in { min-height: 0; overflow: hidden; }
.fac-card.open .fac-body-in { overflow: visible; }

.rep-month { display: flex; align-items: center; justify-content: center; gap: var(--s-4); margin-bottom: var(--s-4); }
.rep-month-name { min-width: 150px; text-align: center; font-weight: 640; font-size: var(--t-lg); letter-spacing: -0.02em; }
.rep-month .btn[disabled] { opacity: .35; cursor: default; }
.rep-list { display: grid; gap: var(--s-2); }
.rep-item { border: 1px solid var(--line); border-radius: var(--r-md); background: var(--surface); transition: border-color var(--d-move) var(--ease-out), box-shadow var(--d-move) var(--ease-out); }
.rep-item.open { border-color: color-mix(in srgb, var(--acc) 38%, var(--line)); box-shadow: 0 0 0 3px var(--acc-wash); }
.rep-row { all: unset; box-sizing: border-box; cursor: pointer; width: 100%; padding: 12px 14px; display: grid; grid-template-columns: minmax(130px, 1.5fr) repeat(4, minmax(80px, 1fr)) minmax(150px, 1.3fr); align-items: center; gap: var(--s-3); }
.rep-row:focus-visible { outline: 2px solid var(--acc); outline-offset: -2px; border-radius: var(--r-md); }
.rep-name b, .rep-cell b { display: block; font-weight: 620; font-variant-numeric: tabular-nums; }
.rep-name small, .rep-cell small { display: block; font-size: var(--t-xs); color: var(--ink-3); }
.rep-trend { display: flex; align-items: center; justify-content: flex-end; gap: var(--s-2); flex-wrap: wrap; }
.spark path { stroke-dasharray: 1; stroke-dashoffset: 1; animation: spark-draw 900ms var(--ease-out) 120ms forwards; }
@keyframes spark-draw { to { stroke-dashoffset: 0; } }
.rep-more { display: grid; grid-template-rows: 0fr; transition: grid-template-rows var(--d-move) var(--ease-out); }
.rep-item.open .rep-more { grid-template-rows: 1fr; }
.rep-more-in { min-height: 0; overflow: hidden; padding: 0 14px; }
.rep-item.open .rep-more-in { padding-bottom: 12px; }
.rep-store { display: grid; grid-template-columns: minmax(120px, 2fr) repeat(3, minmax(70px, 1fr)); gap: var(--s-3); padding: 7px 0; border-top: 1px solid var(--line-soft); font-size: var(--t-md); font-variant-numeric: tabular-nums; }
.rep-more-in .card-note { padding: 4px 0 8px; }

.dict-store .card-head { margin-bottom: var(--s-3); }
.dict-list { display: grid; }
.dict-row { display: grid; grid-template-columns: minmax(150px, 1.5fr) 18px minmax(150px, 1.4fr) minmax(90px, .7fr) auto; align-items: center; gap: var(--s-3); padding: 9px 0; border-top: 1px solid var(--line-soft); }
.dict-row.confirm { display: flex; align-items: center; justify-content: space-between; gap: var(--s-3); flex-wrap: wrap; }
.dict-raw { font-family: var(--font-mono); font-size: var(--t-sm); overflow-wrap: anywhere; }
.dict-raw small, .dict-map small { display: block; color: var(--ink-3); font-size: var(--t-xs); font-family: var(--font-sans); }
.dict-arrow { color: var(--ink-3); text-align: center; }
.dict-seen { font-size: var(--t-xs); color: var(--ink-3); }
.dict-search { max-width: 360px; }

@media (max-width: 720px) {
  .inv { padding: var(--s-3); }
  .inv-store { width: 100%; } .inv-store .input { flex: 1 1 auto; width: auto; }
  .il-top { flex-direction: column; gap: 2px; }
  .il-actions .btn, .il-cmp-act .btn { flex: 1 1 auto; justify-content: center; }
  .fac-card { padding: var(--s-4); }
  .fac-top > .btn { flex: 1 1 100%; justify-content: center; }
  .rep-row { grid-template-columns: 1fr 1fr; gap: var(--s-2) var(--s-3); }
  .rep-name, .rep-trend { grid-column: 1 / -1; }
  .rep-trend { justify-content: flex-start; }
  .rep-range { grid-column: 1 / -1; }
  .rep-store { grid-template-columns: 1.4fr 1fr 1fr; }
  .rep-store > span:nth-child(3) { display: none; }
  .dict-row { grid-template-columns: 1fr auto; gap: 4px var(--s-3); }
  .dict-arrow { display: none; }
  .dict-map { grid-column: 1; } .dict-seen { grid-column: 1; }
  .dict-row .btn { grid-column: 2; grid-row: 1 / span 3; }
}
@media (prefers-reduced-motion: reduce) {
  .il, .il-flash, .il-cmp, .inv-dots i, .spark path, .fac-bar i { animation: none; transition: none; }
  .spark path { stroke-dashoffset: 0; }
  .fac-body, .rep-more { transition: none; }
}

/* Móvil: todo lo que se toca con el dedo mide al menos ~40px (empleados y managers usan el teléfono). */
@media (max-width: 720px) {
  .seg-toggle button { min-height: 40px; padding-inline: 14px; }
  .icon-btn { width: 40px; height: 40px; }
  .icon-btn-sq { min-width: 44px; min-height: 44px; }
  .lang-switch button { width: 40px; padding: 8px 0; }
  .cpx-head { min-height: 44px; }
  .cpx-chev { width: 36px; height: 36px; }
  .ft-arrow { min-width: 44px; min-height: 44px; }
}

/* Móvil · Registrar inventario: el nombre del producto arriba completo y el control
   (Vacío/Poco/Bien o la cantidad) debajo, ancho y cómodo — antes se salía del cuadro. */
@media (max-width: 720px) {
  .reg-line { flex-wrap: wrap; row-gap: 8px; padding-block: 12px; }
  .reg-line .row-main { flex: 1 1 0; min-width: 0; }
  .reg-line .row-title { font-size: 15.5px; white-space: normal; }
  .reg-line .row-actions { flex: 1 1 100%; display: flex; align-items: center; gap: 8px; margin: 0; }
  .reg-line .seg-toggle { width: 100%; display: flex; }
  .reg-line .seg-toggle button { flex: 1; min-height: 46px; font-size: 15px; }
  .reg-line .input { width: 100% !important; flex: 1; min-height: 46px; font-size: 17px; }
  .reg-unitword { font-size: 14px; flex: 0 0 auto; min-width: 64px; }
}

/* ============================ Tiendas · hora de corte (26/10) ============================ */
.td-grid { display: grid; gap: var(--s-4); grid-template-columns: repeat(auto-fill, minmax(min(100%, 360px), 1fr)); }
.td-card { display: flex; flex-direction: column; gap: var(--s-4); }
.td-dot { width: 12px; height: 12px; border-radius: 50%; box-shadow: 0 0 0 4px color-mix(in srgb, currentColor 0%, transparent); flex: none; }
.td-clock { display: inline-flex; align-items: center; gap: 8px; padding: 8px 14px; border-radius: var(--r-full); background: var(--raise); border: 1px solid var(--line); color: var(--ink-3); font-size: var(--t-sm); }
.td-clock b { color: var(--ink); font-variant-numeric: tabular-nums; }
.td-clock svg { color: var(--acc-text); }
.td-now { display: grid; gap: 4px; padding: var(--s-3) var(--s-4); border-radius: var(--r-lg); background: var(--acc-wash, var(--raise)); border: 1px solid var(--line-soft); }
.td-now-label { font-size: var(--t-xs, 12px); color: var(--ink-3); text-transform: uppercase; letter-spacing: .06em; }
.td-now-day { font-size: var(--t-lg, 18px); font-weight: 650; display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.td-date { display: inline-block; }
.td-date::first-letter { text-transform: uppercase; }
.td-card .card-head { min-height: 52px; }
.td-bar { position: relative; display: flex; height: 46px; border-radius: var(--r-lg); overflow: visible; background: var(--raise); border: 1px solid var(--line-soft); }
.td-seg { position: relative; height: 100%; width: 0; display: flex; align-items: center; justify-content: center; overflow: hidden; font-size: 11px; font-weight: 650; letter-spacing: .04em; text-transform: uppercase; white-space: nowrap; transition: width 700ms cubic-bezier(.2,.8,.2,1); }
.td-bar.on .td-seg { width: var(--w); }
.td-prev { background: repeating-linear-gradient(135deg, var(--warn-wash, rgba(251,191,36,.14)) 0 8px, transparent 8px 16px); color: var(--warn, #D97706); border-radius: var(--r-lg) 0 0 var(--r-lg); }
.td-this { background: linear-gradient(90deg, var(--acc-wash, rgba(34,211,238,.16)), color-mix(in srgb, var(--acc) 26%, transparent)); color: var(--acc-text); border-radius: 0 var(--r-lg) var(--r-lg) 0; }
.td-seg span { padding: 0 6px; overflow: hidden; text-overflow: ellipsis; }
.td-cut { position: absolute; top: -6px; bottom: -6px; width: 3px; margin-left: -1.5px; border-radius: 2px; background: var(--acc); box-shadow: 0 0 12px var(--acc); transition: left 700ms cubic-bezier(.2,.8,.2,1); }
.td-mark { position: absolute; top: -9px; bottom: -9px; width: 0; transition: left 700ms cubic-bezier(.2,.8,.2,1); pointer-events: none; }
.td-mark i { position: absolute; left: -1px; top: 8px; bottom: 8px; width: 2px; background: var(--ink); opacity: .85; }
.td-mark b { position: absolute; left: 0; top: -14px; transform: translateX(-50%); font-size: 10px; font-weight: 700; padding: 1px 6px; border-radius: var(--r-full); background: var(--ink); color: var(--surface, var(--bg)); }
.td-ticks { display: flex; justify-content: space-between; font-size: 10px; color: var(--ink-3); font-variant-numeric: tabular-nums; margin-top: -6px; }
.td-field { display: grid; gap: 6px; }
.td-field-label { font-size: var(--t-sm); font-weight: 640; }
.td-field-row { display: flex; gap: 8px; }
.td-field-row .input { flex: 1; min-width: 0; font-variant-numeric: tabular-nums; }
.td-help { font-size: var(--t-sm); color: var(--ink-3); }
.td-help b { color: var(--ink); }
.td-example { margin-top: var(--s-4); color: var(--ink-3); font-size: var(--t-sm); }
@media (prefers-reduced-motion: reduce) { .td-seg, .td-cut, .td-mark { transition: none; } }

/* ===== Modo empleado en el panel (/panel/): barra inferior igual a la de la app del empleado ===== */
.emp-tabbar { display: none; }
@media (max-width: 860px) {
  body.emp-panel .canvas { padding-bottom: calc(110px + env(safe-area-inset-bottom)); }
  body.emp-panel .emp-tabbar {
    display: grid; grid-template-columns: repeat(var(--n, 3), 1fr); position: fixed; z-index: 50;
    left: 8px; right: 8px; bottom: calc(12px + env(safe-area-inset-bottom));
    padding: 4px; border-radius: 22px; background: color-mix(in srgb, var(--surface) 86%, transparent);
    border: 1px solid var(--line); box-shadow: var(--shadow-pop);
  }
  .emp-tab-pill {
    position: absolute; top: 4px; bottom: 4px; left: 4px; width: calc((100% - 8px) / var(--n, 3));
    border-radius: 16px; background: var(--acc-wash); transition: transform 420ms var(--ease-drawer);
  }
  .emp-tab {
    position: relative; display: flex; flex-direction: column; align-items: center; gap: 3px; min-width: 0;
    padding: 8px 2px; border-radius: 16px; color: var(--ink-3); text-decoration: none;
    font-size: 11px; font-weight: 600; letter-spacing: -0.01em;
    transition: color 220ms var(--ease-out), transform 140ms var(--ease-out);
  }
  .emp-tab span { max-width: 100%; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
  .emp-tab[aria-current="page"] { color: var(--acc-text); }
  .emp-tab:active { transform: scale(0.92); }
  .emp-tab svg { transition: transform 300ms var(--ease-out); }
  .emp-tab[aria-current="page"] svg { transform: translateY(-1px) scale(1.08); }
}
@media (max-width: 370px) { .emp-tab { font-size: 10.5px; } }
@media (prefers-reduced-motion: reduce) { .emp-tab-pill { transition: none; } }

/* Productos que no se cuentan (modo Nivel): se piden sin número, solo un visto */
.cp-need, .cp-ord-need { display: inline-flex; align-items: center; justify-content: center; color: var(--acc-text); }
.cp-ord-need { animation: ordIn 220ms var(--ease-out); }

/* ---- Partes de una receta (una receta, un costo, varios bloques) ---- */
.exp-part {
  margin: 0 0 var(--s-4); padding: var(--s-3) var(--s-4) var(--s-4);
  border: 1px solid var(--line-soft); border-left: 3px solid var(--acc-2, var(--acc));
  border-radius: 14px; background: transparent;
  transition: border-color 200ms var(--ease-out);
}
.exp-part.part-new { animation: part-in 380ms var(--ease-out) both; }
@keyframes part-in { from { opacity: 0; transform: translateY(10px) scale(.985); } to { opacity: 1; transform: none; } }
.exp-part-head { display: flex; align-items: center; gap: var(--s-3); margin-bottom: var(--s-2); }
.exp-part-name { flex: 1 1 auto; min-width: 0; font-weight: 640; }
.exp-part-sub { font-weight: 640; font-variant-numeric: tabular-nums; color: var(--acc-text); white-space: nowrap; transition: color 160ms var(--ease-out); }
.exp-part-lines .exp-line:last-child { border-bottom: none; }
.exp-part-add { margin-top: var(--s-2); }
.exp-foot-btns { display: flex; flex-wrap: wrap; gap: var(--s-2); }
.row-detail-grid > .row-detail-part {
  grid-column: 1 / -1; margin-top: var(--s-2); padding-top: var(--s-2); border-top: 1px solid var(--line-soft);
  font-size: var(--t-xs); font-weight: 700; letter-spacing: .04em; text-transform: uppercase; color: var(--acc-text);
}
@media (prefers-reduced-motion: reduce) { .exp-part.part-new { animation: none; } .exp-part { transition: none; } }
.exp-part.drop-target { border-color: var(--acc); background: var(--acc-2-wash); }

/* ---- Ventana de producto (cuadros + partes en recuadros) ---- */
.modal.dish-modal { width: min(700px, 100%); max-height: min(90vh, 900px); }
.dish-modal .modal-head { margin-bottom: var(--s-4); }
.dish-modal .modal-head .card-title { flex: 1 1 auto; min-width: 0; }
.dd-pill { font-size: var(--t-md); font-weight: 750; font-variant-numeric: tabular-nums; padding: 4px 11px; border-radius: var(--r-full); background: var(--good-wash); white-space: nowrap; }
.dd-pill-acc { color: var(--acc-text); background: var(--acc-wash); }
.dish-detail { display: flex; flex-direction: column; gap: var(--s-2); }
.dd-tiles { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: var(--s-2); }
.dd-tile {
  display: flex; flex-direction: column; gap: 4px; min-width: 0;
  padding: var(--s-3) var(--s-4); border-radius: var(--r-lg);
  border: 1px solid var(--line-soft); background: var(--raise);
  animation: dd-in 380ms var(--ease-out) both; animation-delay: calc(var(--i, 0) * 45ms + 120ms);
  transition: transform var(--d-hover) var(--ease-out);
}
.dd-tile:hover { transform: translateY(-1px); }
.dd-label { font-size: var(--t-xs); text-transform: uppercase; letter-spacing: .06em; color: var(--ink-2); font-weight: 600; line-height: 1.25; }
.dd-value { font-size: var(--t-xl); font-weight: 700; font-variant-numeric: tabular-nums; letter-spacing: -.01em; }
.dd-price { background: var(--acc-wash); }
.dd-cost  { background: var(--warn-wash); }
.dd-margin{ background: var(--good-wash); }
.dd-yield { background: var(--acc-2-wash); }
.dd-sec { margin-top: var(--s-4); font-size: var(--t-xs); text-transform: uppercase; letter-spacing: .09em; color: var(--ink-3); font-weight: 700; }
.dd-parts { display: flex; flex-direction: column; gap: var(--s-3); }
.dd-part {
  border: 1px solid var(--line); border-radius: var(--r-lg); overflow: hidden;
  animation: dd-in 380ms var(--ease-out) both; animation-delay: 300ms;
}
.dd-part-head {
  display: flex; justify-content: space-between; gap: var(--s-3);
  padding: 9px var(--s-4); font-size: var(--t-xs); font-weight: 700; letter-spacing: .06em; text-transform: uppercase;
  color: var(--acc-2); background: var(--acc-2-wash); border-bottom: 1px solid var(--line);
  font-variant-numeric: tabular-nums;
}
.dd-row {
  display: grid; grid-template-columns: minmax(0, 1fr) auto auto; gap: var(--s-4); align-items: baseline;
  padding: 9px var(--s-4); font-size: var(--t-sm); border-bottom: 1px solid var(--line-soft);
  transition: background var(--d-hover) var(--ease-out);
}
.dd-row:last-child { border-bottom: none; }
.dd-row:hover { background: var(--acc-wash); }
.dd-name { font-weight: 600; color: var(--ink); }
.dd-qty { color: var(--ink-2); white-space: nowrap; min-width: 70px; }
.dd-money { font-weight: 650; font-variant-numeric: tabular-nums; text-align: right; min-width: 52px; }
.dd-money2 { display: inline-flex; gap: var(--s-3); justify-content: flex-end; font-weight: 700; font-variant-numeric: tabular-nums; color: var(--acc-text); }
.dd-money2 i { font-style: normal; font-weight: 500; color: var(--ink-3); min-width: 52px; text-align: right; }
.dd-legend { float: right; display: inline-flex; gap: var(--s-3); letter-spacing: .04em; }
.dd-legend i { font-style: normal; color: var(--ink-3); }
.dd-total {
  display: flex; justify-content: space-between; margin-top: var(--s-3); padding: 12px var(--s-4) 2px;
  border-top: 2px solid var(--ink-3); font-weight: 750; font-variant-numeric: tabular-nums;
}
.dd-actions { margin-top: var(--s-4); }
@keyframes dd-in { from { opacity: 0; transform: translateY(8px); } to { opacity: 1; transform: none; } }
@media (max-width: 560px) {
  .dd-tiles { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .dd-row { gap: var(--s-3); }
}
@media (prefers-reduced-motion: reduce) { .dd-tile, .dd-part { animation: none; transition: none; } }
/* Editar/Eliminar quedan fijos al pie de la ventana aunque la lista de insumos haga scroll */
.dish-modal .dd-actions {
  position: sticky; bottom: calc(var(--s-6) * -1); z-index: 1;
  margin: var(--s-4) calc(var(--s-6) * -1) calc(var(--s-6) * -1); padding: var(--s-3) var(--s-6);
  background: var(--surface); border-top: 1px solid var(--line-soft);
}

/* Franquicia: precio de venta por insumo + % que le queda a William */
.fr-sell { display: flex; flex-direction: column; gap: 6px; padding: 10px 12px; margin-top: var(--s-3); border-radius: var(--r-md); background: var(--acc-wash); }
.fr-sell > label { font-size: var(--t-sm); font-weight: 650; color: var(--acc-text); }
.fr-sell-row { display: flex; align-items: center; justify-content: space-between; gap: var(--s-3); }
.fr-sell-in { display: inline-flex; align-items: center; gap: 4px; }
.fr-sell-in b { font-weight: 800; color: var(--acc-text); }
.fr-sell-in .input { width: 110px; text-align: right; font-weight: 750; font-variant-numeric: tabular-nums; }
.fr-sell-pct { display: inline-flex; flex-direction: column; align-items: flex-end; line-height: 1.1; transition: color .25s ease, transform .25s ease; }
.fr-sell-pct small { font-size: var(--t-xs, 11px); color: var(--ink-3); font-weight: 600; }
.fr-sell-pct strong { font-size: 1.35rem; font-weight: 800; font-variant-numeric: tabular-nums; }
.fr-sell-pct[data-tone="good"] strong { color: var(--good); }
.fr-sell-pct[data-tone="bad"] strong { color: var(--bad, #d64545); }
.fr-sell-pct[data-tone="none"] strong { color: var(--ink-3); }
.fr-amounts { display: flex; flex-direction: column; align-items: flex-end; line-height: 1.15; }
.fr-amounts small { font-size: var(--t-xs, 11px); color: var(--ink-3); font-weight: 600; }
.fr-warn { margin-top: var(--s-3); }

/* Parte de franquicia: solo lectura salvo el precio de venta */
.org-franq [data-act="ins-toggle"], .org-franq [data-act="ins-cat-toggle"], .org-franq [data-act="ins-edit"], .org-franq [data-act="ins-delete"],
.org-franq [data-act="ins-cat-edit"], .org-franq [data-act="ins-cat-delete"], .org-franq [data-act="g-cat-toggle"], .org-franq [data-act="g-cat-edit"],
.org-franq [data-act="g-cat-delete"], .org-franq [data-act="dish-new"], .org-franq [data-act="prep-new"], .org-franq [data-act="exp-new"],
.org-franq [data-act="mar-config-toggle"], .org-franq .dd-actions { display: none !important; }
.fr-sell-head { display: flex; align-items: center; justify-content: space-between; flex-wrap: wrap; gap: var(--s-2); }
.fr-by button { padding: 5px 12px; font-size: var(--t-sm); }
.fr-sell-ref { font-size: var(--t-xs, 12px); color: var(--ink-3); font-variant-numeric: tabular-nums; }
.fr-sell-pct { gap: 6px; }
.fr-sell-pct small { font-size: var(--t-xs, 11px); color: var(--ink-3); font-weight: 600; margin-right: 2px; }
.fr-sell-pct .input { width: 84px; text-align: right; font-weight: 800; font-variant-numeric: tabular-nums; transition: color .25s ease; }
.fr-sell-pct b { font-weight: 800; }
.fr-sell-pct[data-tone="good"] .input, .fr-sell-pct[data-tone="good"] b { color: var(--good); }
.fr-sell-pct[data-tone="bad"] .input, .fr-sell-pct[data-tone="bad"] b { color: var(--bad, #d64545); }
.fr-sell-in.fr-sell-pct { flex-direction: row; align-items: center; }

/* Franquicia: interruptor «se le vende» por insumo (Insumos → Elegir qué vendo) */
.fr-switch {
  position: relative; flex: none; width: 46px; height: 26px; padding: 0; border-radius: var(--r-full);
  border: 1px solid var(--line); background: var(--raise); cursor: pointer;
  transition: background .28s ease, border-color .28s ease, box-shadow .28s ease, transform .15s ease;
}
.fr-switch i {
  position: absolute; top: 2px; left: 2px; width: 20px; height: 20px; border-radius: 50%;
  background: var(--surface); box-shadow: 0 1px 4px rgba(84, 68, 124, .28);
  transition: transform .28s cubic-bezier(.3, 1.4, .5, 1);
}
.fr-switch[aria-checked="true"] { background: var(--acc); border-color: transparent; box-shadow: 0 2px 10px var(--acc-wash); }
.fr-switch[aria-checked="true"] i { transform: translateX(20px); }
.fr-switch:active { transform: scale(.94); }
.fr-switch:focus-visible { outline: 2px solid var(--acc); outline-offset: 2px; }
.fr-off .row-title, .fr-off .row-amount { opacity: .45; transition: opacity .25s ease; }
.fr-off .glyph, .fr-off .row > svg:first-child { opacity: .45; }
.row-title, .row-amount { transition: opacity .25s ease; }
.fr-manage-hint { margin: 0 0 var(--s-3); padding: 10px 14px; border-radius: var(--r-md); background: var(--acc-wash); color: var(--ink-2, var(--ink)); animation: dd-in .3s ease both; }
@media (prefers-reduced-motion: reduce) { .fr-switch, .fr-switch i { transition: none; } }

/* 12/11 — Nota fija de Management en Costos generales (franquicia) */
.fr-mgmt-note{margin:var(--s-3, 12px) 0 var(--s-4, 16px);padding:10px 14px;border-radius:12px;border:1px solid color-mix(in srgb, var(--acc) 35%, transparent);background:color-mix(in srgb, var(--acc) 9%, transparent);color:var(--ink);font-weight:600;animation:fr-note-in .35s ease both}
@keyframes fr-note-in{from{opacity:0;transform:translateY(-4px)}to{opacity:1;transform:none}}
@media (prefers-reduced-motion:reduce){.fr-mgmt-note{animation:none}}

/* ---- Stock (17/11/2026): matriz de tiendas, solo lectura ---- */
.stx { display: grid; gap: 14px; max-width: 760px; }
.stx-box { padding: 12px 14px; }
.stx-row { display: grid; grid-template-columns: minmax(0, 1fr) repeat(var(--st-n, 3), minmax(56px, 96px)); gap: 6px; align-items: center; padding: 5px 0; border-bottom: 1px solid var(--line-soft); }
.stx-row:last-child { border-bottom: 0; }
.stx-ghead, .stx-hd { border-bottom: 1px solid var(--line); padding-bottom: 8px; }
.stx-gtitle { display: flex; align-items: center; gap: 8px; min-width: 0; }
.stx-sn { font-size: 10px; font-weight: 700; letter-spacing: .04em; text-transform: uppercase; color: var(--ink-3); text-align: center; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.stx-name { font-size: 13.5px; font-weight: 600; color: var(--ink); line-height: 1.2; min-width: 0; overflow-wrap: anywhere; }
.stx-c { display: grid; place-items: center; align-content: center; min-height: 46px; border-radius: 12px; font-size: 12px; font-weight: 700; text-align: center; padding: 2px 4px; line-height: 1.05; transition: transform .15s; }
.stx-c b { font-size: 18px; font-weight: 800; font-variant-numeric: tabular-nums; }
.stx-c small { font-size: 9.5px; font-weight: 600; opacity: .8; }
.stx-c.is-g { color: var(--good); background: color-mix(in srgb, var(--good) 16%, transparent); }
.stx-c.is-a { color: var(--warn); background: color-mix(in srgb, var(--warn) 22%, transparent); }
.stx-c.is-r { color: var(--crit); background: color-mix(in srgb, var(--crit) 26%, transparent); box-shadow: inset 0 0 0 1.5px color-mix(in srgb, var(--crit) 55%, transparent); }
.stx-c.is-none { color: var(--ink-3); font-size: 10px; font-weight: 600; border: 1.5px dashed var(--line); }
.stx-c.is-na { color: var(--ink-3); min-height: 30px; }
.stx-hd-l { font-size: 11px; font-weight: 700; letter-spacing: .08em; text-transform: uppercase; color: var(--ink-3); }
.stx-hc { display: grid; gap: 1px; text-align: center; min-width: 0; }
.stx-hc b { font-size: 12px; font-weight: 800; color: var(--ink); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.stx-hc i { font-style: normal; font-size: 10.5px; color: var(--ink-2); }
.stx-hc i.is-old { color: var(--warn); font-weight: 700; }
.stx-hc em { font-style: normal; font-size: 11px; font-weight: 800; }
.stx-hc em.is-low { color: var(--crit); } .stx-hc em.is-ok { color: var(--good); }
.stx-controls { display: flex; flex-wrap: wrap; gap: 10px 16px; align-items: center; }
.stx-legend { display: flex; gap: 12px; font-size: 12px; color: var(--ink-2); }
.stx-legend span { display: inline-flex; align-items: center; gap: 6px; }
.stx-legend i { width: 12px; height: 12px; border-radius: 4px; display: block; }
.stx-legend i.is-r { background: var(--crit); } .stx-legend i.is-a { background: var(--warn); } .stx-legend i.is-g { background: var(--good); }
.stx-note { display: flex; gap: 8px; align-items: center; padding: 10px 12px; border-radius: var(--r-md, 14px); background: var(--warn-wash); color: var(--warn); font-size: 12.5px; font-weight: 600; }
@media (max-width: 520px) { .stx-box { padding: 10px 10px; } .stx-row { gap: 5px; grid-template-columns: minmax(0, 1fr) repeat(var(--st-n, 3), minmax(52px, 1fr)); } .stx-name { font-size: 13px; } }


/* ============================================================================
   LHP — carácter de marca (va al final a propósito: lo que sigue manda sobre
   las reglas generales de arriba). Todo sale del manual: títulos en Barlow
   Condensed Bold en mayúsculas, rosa lidera, lavanda acompaña, esquinas redondas.
   ========================================================================== */
.eyebrow, .nav-title {
  font-family: var(--font-display);
  font-weight: 600;
  font-size: var(--t-sm);
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--lavender);
}

.page-title {
  font-family: var(--font-display);
  font-weight: 700;
  font-size: var(--t-2xl);
  line-height: 1;
  letter-spacing: 0.01em;
  text-transform: uppercase;
  color: var(--acc);
}
.page-sub { font-size: var(--t-base); color: var(--ink-2); margin-top: 6px; }

.card-title { font-family: var(--font-display); font-weight: 700; text-transform: uppercase; font-size: var(--t-xl); line-height: 1.05; letter-spacing: 0.02em; color: var(--ink); }
.card-note  { font-size: var(--t-sm); color: var(--ink-2); }

.kpi-label { font-family: var(--font-display); font-weight: 600; font-size: var(--t-md); letter-spacing: 0.1em; text-transform: uppercase; color: var(--lavender); }
.kpi-value { font-family: var(--font-display); font-weight: 700; font-size: var(--t-4xl); letter-spacing: 0; color: var(--acc); }

/* Botones: pastilla, letra condensada en mayúsculas */
.btn {
  font-family: var(--font-display);
  font-weight: 700;
  font-size: var(--t-base);
  letter-spacing: 0.06em;
  text-transform: uppercase;
  padding: 9px 18px;
  background: var(--surface);
  border: 1.5px solid var(--line);
  color: var(--ink);
}
.btn.acc { border-color: transparent; background: var(--acc); color: #fff; box-shadow: 0 8px 18px -10px var(--acc); }
@media (hover: hover) and (pointer: fine) {
  .btn:hover { border-color: var(--lavender); background: var(--raise); }
  .btn.acc:hover { background: var(--acc); filter: none; transform: translateY(-1px); box-shadow: 0 12px 22px -10px var(--acc); }
}

/* Etiquetas de estado */
.tag { font-family: var(--font-display); font-weight: 700; font-size: var(--t-sm); letter-spacing: 0.06em; text-transform: uppercase; padding: 3px 10px; }

/* Navegación */
.nav-link { font-family: var(--font-display); font-weight: 600; font-size: 17px; letter-spacing: 0.03em; text-transform: uppercase; color: var(--ink-2); padding: 10px 12px; }
.nav-link[aria-current="page"] { color: var(--acc-text); font-weight: 700; }
.nav-link svg { opacity: 0.8; }
@media (hover: hover) and (pointer: fine) {
  .nav-link:hover { color: var(--ink); }
}

/* Campos */
.input, .select, textarea.input { border-radius: var(--r-md); border: 1.5px solid var(--line); background: var(--surface); color: var(--ink); }
.input:focus, .select:focus, textarea.input:focus { outline: none; border-color: var(--acc); box-shadow: 0 0 0 4px var(--acc-wash); }

::selection { background: var(--acc-wash); color: var(--ink); }

/* Barra lateral compacta: caben las seis secciones aunque la pantalla sea baja */
.sidebar { gap: var(--s-3); padding-block: var(--s-5) var(--s-4); }
.brand-logo { width: 112px; }
.nav { scrollbar-width: thin; scrollbar-color: var(--line) transparent; }
.nav-group + .nav-group { margin-top: var(--s-3); }
.nav-title { padding: 0 12px 4px; }
.nav-link { padding: 6px 12px; font-size: 16px; }
.nav-list { gap: 1px; }
/* Texto sobre Mango: el manual lo permite en blanco para títulos grandes; en una etiqueta pequeña va en ciruela */
.org-avatar[style*="--c3"] { color: var(--ink); }

.btn.icon-btn-sq { padding: 0; width: 42px; min-height: 42px; justify-content: center; }

.plan-chip { justify-content: flex-start; font-family: var(--font-display); font-weight: 700; font-size: var(--t-base); letter-spacing: 0.12em; color: var(--acc); }

/* ============================================================================
   Legibilidad (17/11): la letra condensada se ve áspera en pantallas de Windows
   cuando es pequeña. Condensada solo en títulos grandes; lo chico va en Barlow
   normal, un poco más grueso y con menos separación entre letras.
   ========================================================================== */
.nav-link, .nav-title, .eyebrow, .kpi-label, .btn, .tag, .plan-chip {
  font-family: var(--font-sans);
  -webkit-font-smoothing: auto;
  text-rendering: auto;
}
.nav-link { font-weight: 600; font-size: 15px; letter-spacing: 0.04em; }
.nav-link[aria-current="page"] { font-weight: 700; }
.nav-title, .eyebrow { font-weight: 700; font-size: 12px; letter-spacing: 0.12em; }
.kpi-label { font-weight: 700; font-size: 13px; letter-spacing: 0.08em; }
.btn { font-weight: 700; font-size: 14px; letter-spacing: 0.05em; }
.tag { font-weight: 700; font-size: 12px; letter-spacing: 0.05em; }
.plan-chip { font-weight: 700; font-size: 13px; letter-spacing: 0.1em; }
body { -webkit-font-smoothing: auto; text-rendering: auto; }
