/* ============================================================
   VALEN — styles.css  (v2)
   "Lo que vendes, lo que gastas y lo que realmente vale."
   ============================================================ */

@import url('https://fonts.googleapis.com/css2?family=Sora:wght@500;600;700&family=Inter:wght@400;500;600;700&display=swap');

/* Dirección visual C v2.2 — Fase 1B: Instrument Sans auto-hospedada.
   Un solo archivo .woff2 (variable, subset "latin") cubre los pesos
   400/500/600/700 — los confirmados por grep en el código real.
   PENDIENTE sin resolver: esta familia NO tiene pesos 800/900 (confirmado
   contra la propia API de Google Fonts: su eje variable real es 400–700),
   y el código real usa font-weight:800 en 118+ declaraciones — no hay
   equivalente en Instrument Sans para ese peso. Decisión pendiente antes
   de migrar cualquier selector que use 800/900 a esta fuente.
   No se activa globalmente en esta fase: --sans y body siguen en Inter/Sora. */
@font-face {
  font-family: 'Instrument Sans';
  font-style: normal;
  font-weight: 400 700;
  font-display: swap;
  src: url('fonts/InstrumentSans-Variable.woff2') format('woff2');
}

:root {
  --ink:        #11161D;
  --ink-soft:   #1B2530;
  --bg:         #F2F5F2;
  --card:       #FFFFFF;
  --line:       #E2E7E3;
  --line-soft:  #EDF1EE;

  --brand:      #0E7C66;
  --brand-dk:   #0A5D4C;
  --brand-tint: #E6F2EE;

  --pos:        #15924E;  --pos-tint: #E7F5EC;
  --warn:       #C77700;  --warn-tint:#FBF1DD;
  --neg:        #C8362E;  --neg-tint: #FBE9E7;
  --info:       #2563A8;  --info-tint:#E7EFF8;

  --muted:      #66727D;
  --muted-2:    #91A0AB;

  /* Estados activos de navegación jerárquica (área → subcategoría → filtro).
     Un solo verde de referencia (#0b8f69) con tres pesos visuales. Usados por
     ownerDashboardConsistencyV1.css y los .active de cada módulo de owner-dashboard. */
  --valen-active-accent:     #0b8f69;
  --valen-active-accent-dk:  #075f49;

  --valen-active-1-bg-from:  #f5fcf9;
  --valen-active-1-bg-to:    #ecf9f4;
  --valen-active-1-border:   #78c6ac;
  --valen-active-1-text:     #075f49;
  --valen-active-1-text-soft:#3d7564;
  --valen-active-1-icon-bg:  #0b8f69;
  --valen-active-1-icon-fg:  #ffffff;

  --valen-active-2-bg:       #eef8f4;
  --valen-active-2-border:   #0b9b72;
  --valen-active-2-text:     #075f49;
  --valen-active-2-text-soft:#3d7564;
  --valen-active-2-icon-bg:  #0b9b72;
  --valen-active-2-icon-fg:  #ffffff;

  --valen-active-3-bg:       #0b8f69;
  --valen-active-3-border:   #0b8f69;
  --valen-active-3-text:     #ffffff;

  --valen-active-focus-ring: rgba(11,143,105,.34);

  --radius:     14px;
  --radius-sm:  10px;
  --radius-lg:  20px;
  --shadow:     0 1px 2px rgba(17,22,29,.04), 0 8px 24px rgba(17,22,29,.06);
  --shadow-sm:  0 1px 2px rgba(17,22,29,.06);

  --sans: 'Inter', system-ui, -apple-system, 'Segoe UI', Roboto, sans-serif;
  --display: 'Sora', var(--sans);
  font-feature-settings: "tnum" 1;

  /* Sistema Visual Valen — tokens canónicos (Fase 2).
     Se agregan sin tocar los valores existentes arriba; cada pantalla los
     adopta cuando se migra, no se imponen de golpe en todo el sitio. */
  --fs-hero-solo:  36px; /* N1 de una sola cifra protagonista (ej. Total a pagar) */
  --fs-hero-grupo: 32px; /* N1 de cifras agrupadas (otras pantallas) */
  --fs-micro:      11px; /* eyebrow / etiqueta mínima — ya en uso de hecho en .rs-row span */
  --fs-small:      12.5px; /* meta, ayuda — ya en uso de hecho en .field label */
  --radius-control: 8px;  /* radio único para controles chicos (botón, input, pill) */
  --target-touch:   44px; /* área táctil mínima en mobile para controles interactivos */

  /* Dirección visual C v2.2 — Fase 1A: tokens nuevos, sin uso todavía.
     Nombres nuevos para no colisionar con --ink (hoy texto del body + fondo
     del sidebar) ni con --bg/--card existentes. Valores tomados del artifact
     aprobado y congelado (Dashboard/Registrar/Reportes .dc.html). */
  --forest:       #10211A; /* antes --ink en el mockup; fondo estructural (sidebar) */
  --forest-soft:  #17301F; /* antes --ink-2 en el mockup; superficie activa sobre forest */
  --sage:         #EEF1E4; /* antes --page en el mockup; fondo de página */
  --sage-soft:    #E3E8D6; /* antes --page-soft en el mockup; superficie suave sobre sage */
  --lime:         #D4FF4D; /* acción primaria disponible — nunca fondo, nunca estado bloqueado */
  --lime-dk:      #7A9A1E; /* hover/active de controles lima */

  /* Corrección de paleta (post-Fase 4): --forest (#10211A) se había vuelto
     "verde pantano" y se usaba como un solo verde para sidebar + hero +
     activo. Valores siguientes MEDIDOS reales vía computed styles en
     designs.magicpath.ai/v1/noble-forest-8057 (no estimados). El sidebar
     pasa a ser el único protagonista oscuro de marca; el contenido usa
     sage real, nunca este verde oscuro. --forest/--forest-soft NO se
     eliminan: Registrar venta (congelado/aprobado) sigue usándolos tal
     cual para texto/acentos — no se tocan aquí. */
  --brand-deep:   #11372E; /* sidebar — real medido (aside bg) */
  --brand-active: #1A5648; /* estado activo del sidebar — real medido */
  --brand-text:   #15372D; /* texto principal de marca (encabezados) — real medido (body text de la referencia) */
  --sage-panel:   #DCE8D9; /* real medido: contenedor "Explorar áreas" — superficie protagonista de contenido, reemplaza el hero oscuro */
  --shadow-card:  0 1px 2px rgba(16,33,26,.03), 0 6px 16px rgba(16,33,26,.04); /* CONFIRMADO en Fase 3: es el valor real del buscador y el panel Cobro en Registrar.dc.html/RegistrarPoblado.dc.html */
}

* { box-sizing: border-box; margin: 0; padding: 0; }
html, body { height: 100%; }
body { font-family: var(--sans); color: var(--ink); background: var(--bg); -webkit-font-smoothing: antialiased; line-height: 1.45; }
.tnum { font-variant-numeric: tabular-nums; }
button { font-family: inherit; cursor: pointer; border: none; background: none; }
input, select, textarea { font-family: inherit; font-size: 14px; }
a { color: inherit; }
.hidden { display: none !important; }
:focus-visible { outline: 2px solid var(--brand); outline-offset: 2px; border-radius: 6px; }

/* ============ LOGIN ============ */
.login-wrap { min-height: 100vh; display: grid; grid-template-columns: 1.05fr .95fr; }
.login-aside { background: linear-gradient(160deg, var(--brand) 0%, var(--brand-dk) 60%, #073a30 100%); color: #fff; padding: 56px 64px; display: flex; flex-direction: column; justify-content: space-between; position: relative; overflow: hidden; }
.login-aside::after { content: ""; position: absolute; right: -120px; bottom: -120px; width: 380px; height: 380px; border-radius: 50%; background: rgba(255,255,255,.06); }
.login-brand { font-family: var(--display); font-weight: 700; font-size: 28px; letter-spacing: -.5px; }
.login-brand span { opacity: .55; }
.login-claim { font-family: var(--display); font-weight: 600; font-size: 38px; line-height: 1.15; letter-spacing: -1px; max-width: 14ch; }
.login-claim em { color: #9FE3CF; font-style: normal; }
.login-sub { opacity: .8; max-width: 36ch; margin-top: 18px; font-size: 15px; }
.login-foot { font-size: 13px; opacity: .6; }
.login-main { display: flex; align-items: center; justify-content: center; padding: 40px; }
.login-card { width: 100%; max-width: 380px; }
.login-card h1 { font-family: var(--display); font-size: 24px; letter-spacing: -.5px; }
.login-card p.lead { color: var(--muted); margin: 6px 0 26px; font-size: 14px; }
.role-pick { display: grid; gap: 12px; margin-bottom: 22px; }
.role-btn { display: flex; align-items: center; gap: 14px; text-align: left; border: 1.5px solid var(--line); background: var(--card); border-radius: var(--radius); padding: 16px; transition: .15s; }
.role-btn:hover { border-color: var(--brand); }
.role-btn.active { border-color: var(--brand); background: var(--brand-tint); box-shadow: 0 0 0 3px rgba(14,124,102,.12); }
.role-ico { width: 42px; height: 42px; flex: none; border-radius: 10px; display: grid; place-items: center; background: var(--brand); color: #fff; font-size: 20px; }
.role-btn .role-ico.sec { background: var(--ink); }
.role-meta b { display: block; font-size: 15px; }
.role-meta small { color: var(--muted); font-size: 12.5px; }

.field { margin-bottom: 14px; }
.field label { display: block; font-size: 12.5px; font-weight: 600; color: var(--muted); margin-bottom: 6px; }
.input { width: 100%; padding: 11px 13px; border: 1.5px solid var(--line); border-radius: var(--radius-sm); background: #fff; transition: .15s; color: var(--ink); }
.input:focus { outline: none; border-color: var(--brand); box-shadow: 0 0 0 3px rgba(14,124,102,.12); }
textarea.input { resize: vertical; min-height: 64px; }

.btn { display: inline-flex; align-items: center; justify-content: center; gap: 8px; padding: 11px 18px; border-radius: var(--radius-sm); font-weight: 600; font-size: 14px; transition: .15s; }
.btn-primary { background: var(--brand); color: #fff; box-shadow: 0 2px 8px rgba(14,124,102,.25); }
.btn-primary:hover { background: var(--brand-dk); }
.btn-block { width: 100%; }
.btn-ghost { background: var(--line-soft); color: var(--ink); }
.btn-ghost:hover { background: var(--line); }
.btn-outline { background: #fff; color: var(--brand); border: 1.5px solid var(--brand); }
.btn-outline:hover { background: var(--brand-tint); }
.btn-danger { background: var(--neg-tint); color: var(--neg); }
.btn-danger:hover { background: #f7ddd9; }
.btn-sm { padding: 8px 13px; font-size: 13px; }
.btn-lg { padding: 16px 22px; font-size: 16px; }
.login-hint { font-size: 12.5px; color: var(--muted-2); text-align: center; margin-top: 16px; }

/* ============ APP SHELL ============ */
.app { display: grid; grid-template-columns: 248px 1fr; min-height: 100vh; }
/* C v2.2 — Fase 2: Sidebar. Bosque (--forest) en vez de --ink; wordmark con
   punto lima; nav-item sin ícono (identidad limpia del artifact aprobado);
   activo = superficie --forest-soft, nunca pill de marca teal. */
.sidebar { background: var(--forest); color: #C7D0D8; padding: 28px 20px; display: flex; flex-direction: column; position: sticky; top: 0; height: 100vh; font-family: 'Instrument Sans', var(--sans); }
.side-brand { font-family: 'Instrument Sans', var(--sans); font-weight: 700; color: #fff; font-size: 22px; letter-spacing: -.3px; padding: 0 8px 32px; }
.side-brand span { color: var(--lime); }
.nav { display: flex; flex-direction: column; gap: 4px; flex: 1; overflow-y: auto; }
.nav-item { display: flex; align-items: center; gap: 12px; padding: 11px 14px; border-radius: 11px; color: rgba(255,255,255,.66); font-size: 14px; font-weight: 500; letter-spacing: normal; line-height: 1.4; text-align: left; width: 100%; transition: .12s; }
.nav-item .ni { display: none; }
.nav-item:hover { background: rgba(255,255,255,.08); color: #fff; }
/* C v2.2 — corrección de fidelidad: en la referencia real el ítem activo se
   distingue SOLO por fondo+color, sin negrita extra ("no mediante negrita
   en casi todos los elementos") — se baja de 600, sin llegar al 400 medido
   para no perder del todo la señal de peso en un sidebar operativo. */
.nav-item.active { background: var(--forest-soft); color: #fff; font-weight: 500; }
.nav-sep { height: 1px; background: rgba(255,255,255,.08); margin: 10px 6px; }
.side-foot { padding: 12px 10px 2px; border-top: 1px solid rgba(255,255,255,.08); margin-top: 8px; min-width: 0; }
.side-user { display: flex; align-items: center; gap: 10px; min-width: 0; }
.side-user > div { min-width: 0; overflow: hidden; }
.side-avatar { width: 34px; height: 34px; border-radius: 9px; background: var(--forest-soft); color: #fff; display: grid; place-items: center; font-weight: 700; font-size: 14px; flex: none; }
.side-user b { color: #fff; font-size: 13.5px; display: block; line-height: 1.2; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.side-user small { color: rgba(255,255,255,.55); font-size: 11.5px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; display: block; }
.side-logout { color: rgba(255,255,255,.55); font-size: 12.5px; margin-top: 10px; display: inline-flex; gap: 6px; align-items: center; }
.side-logout:hover { color: #fff; }

.main { display: flex; flex-direction: column; min-width: 0; }
/* C v2.2 — Fase 2: Topbar. Mockup aprobado: sage-soft (ni blanco ni oscuro,
   no compite con el contenido). Jerarquía: título (1) → spacer → contexto (2,
   staging/negocio-fecha/caja) → sin acciones globales inventadas (3). */
.topbar { height: 60px; flex: none; background: var(--sage-soft); border-bottom: 1px solid rgba(19,32,24,.09); display: flex; align-items: center; gap: 20px; padding: 0 32px; position: sticky; top: 0; z-index: 20; font-family: 'Instrument Sans', var(--sans); box-sizing: border-box; }
.topbar h2 { font-family: 'Instrument Sans', var(--sans); font-size: 17px; font-weight: 600; letter-spacing: -.2px; flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.topbar .spacer { flex: 1; }
.staging-chip { display: none; align-items: center; gap: 7px; font-size: 12.5px; color: var(--muted); flex: none; white-space: nowrap; }
.staging-chip .dot { width: 6px; height: 6px; border-radius: 50%; background: var(--warn); flex: none; }
.staging-chip .stxt::after { content: "Entorno de pruebas"; }
html[data-valen-environment="staging"] .staging-chip { display: flex; }
.biz-chip { font-size: 12.5px; color: var(--muted); display: flex; align-items: center; gap: 8px; flex: none; white-space: nowrap; }
.biz-chip b { color: var(--ink); }
.caja-pill { display: inline-flex; align-items: center; gap: 6px; font-size: 12px; font-weight: 600; padding: 5px 10px; border-radius: 999px; flex: none; white-space: nowrap; }
.caja-pill.open { background: var(--pos-tint); color: var(--pos); }
.caja-pill.closed { background: var(--neg-tint); color: var(--neg); }
.caja-pill .dot { width: 6px; height: 6px; border-radius: 50%; background: currentColor; }
.menu-toggle { display: none; }

/* C v2.2 — Fase 2: degradación del contexto del Topbar por prioridad inversa
   (negocio/fecha primero, luego compactar staging), independiente del
   breakpoint de colapso del Sidebar (760px — sin tocar, ver @media 760 abajo). */
@media (max-width: 820px) {
  .topbar { padding: 0 20px; gap: 14px; }
  .topbar h2 { font-size: 16px; }
  .biz-chip { display: none; }
  .staging-chip .stxt::after { content: "Pruebas"; }
  .caja-pill { font-size: 11.5px; padding: 5px 9px; }
}
@media (max-width: 390px) {
  .topbar { flex-wrap: wrap; padding: 10px 14px; height: auto; min-height: 56px; gap: 8px; }
  .staging-chip { font-size: 10.5px; font-weight: 700; letter-spacing: .04em; gap: 5px; }
  .staging-chip .dot { width: 5px; height: 5px; }
  .staging-chip .stxt::after { content: "STAGING"; }
  /* Fix overflow (estabilización C v2.2): flex-basis:100% + margin-left:48px
     sumaban 48px más allá del ancho del contenedor — el margin se añade
     fuera del basis, no se resta de él. Restando el margin directamente
     del basis, el total vuelve a sumar exactamente 100%. */
  .caja-pill { flex: 0 0 calc(100% - 48px); margin-left: 48px; font-size: 11px; padding: 4px 9px; }
}

.content { padding: 26px 28px 56px; max-width: 1240px; width: 100%; }
.page-head { display: flex; align-items: flex-end; gap: 16px; flex-wrap: wrap; margin-bottom: 22px; }
.page-head .ph-text { flex: 1; min-width: 200px; }
.page-head h3 { font-family: var(--display); font-size: 22px; letter-spacing: -.4px; }
.page-head p { color: var(--muted); font-size: 13.5px; margin-top: 3px; }
.page-actions { display: flex; gap: 10px; flex-wrap: wrap; }

/* Eyebrow / section label para jerarquía */
.eyebrow { font-size: 11.5px; font-weight: 700; letter-spacing: .08em; text-transform: uppercase; color: var(--muted-2); margin: 28px 0 12px; display: flex; align-items: center; gap: 10px; }
.eyebrow::after { content: ""; flex: 1; height: 1px; background: var(--line); }
.eyebrow:first-child { margin-top: 0; }

/* ============ KPI CARDS ============ */
.kpi-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(200px,1fr)); gap: 14px; margin-bottom: 8px; }
.kpi { background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); padding: 16px 18px; box-shadow: var(--shadow-sm); }
.kpi .kpi-label { font-size: 12.5px; color: var(--muted); font-weight: 600; display: flex; align-items: center; gap: 7px; }
.kpi .kpi-ico { font-size: 14px; }
.kpi .kpi-val { font-family: var(--display); font-size: 26px; font-weight: 700; letter-spacing: -.6px; margin-top: 8px; font-variant-numeric: tabular-nums; }
.kpi .kpi-sub { font-size: 12px; color: var(--muted-2); margin-top: 4px; }
.kpi.accent-pos { border-left: 3px solid var(--pos); }
.kpi.accent-neg { border-left: 3px solid var(--neg); }
.kpi.accent-brand { border-left: 3px solid var(--brand); }
.kpi.accent-info { border-left: 3px solid var(--info); }

/* ============ ALERTS ============ */
.alert { display: flex; align-items: flex-start; gap: 12px; padding: 13px 16px; border-radius: var(--radius); font-size: 13.5px; border: 1px solid transparent; }
.alert + .alert { margin-top: 10px; }
.alert .a-ico { font-size: 16px; line-height: 1.3; flex: none; }
.alert b { font-weight: 600; }
.alert.warn { background: var(--warn-tint); border-color: #f0dcae; color: #7a4d00; }
.alert.neg  { background: var(--neg-tint);  border-color: #f1c4bf; color: #8a241d; }
.alert.pos  { background: var(--pos-tint);  border-color: #b9e0c6; color: #11633a; }
.alert.info { background: var(--info-tint); border-color: #c2d6ee; color: #1b4a7a; }

/* ============ PANELS / TABLES ============ */
.section-grid { display: grid; grid-template-columns: 1.6fr 1fr; gap: 16px; align-items: start; }
.section-grid.even { grid-template-columns: 1fr 1fr; }
.panel { background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); box-shadow: var(--shadow-sm); overflow: hidden; }
.panel + .panel { margin-top: 16px; }
.panel-head { padding: 15px 18px; border-bottom: 1px solid var(--line-soft); display: flex; align-items: center; gap: 10px; }
.panel-head h4 { font-family: var(--display); font-size: 15px; font-weight: 600; }
.panel-head .spacer { flex: 1; }
.panel-body { padding: 16px 18px; }

.filters { display: flex; gap: 10px; flex-wrap: wrap; margin-bottom: 16px; align-items: flex-end; }
.filters .field { margin: 0; min-width: 140px; }
.filters .input { padding: 8px 11px; }

.table-wrap { overflow-x: auto; }
table.tbl { width: 100%; border-collapse: collapse; font-size: 13.5px; }
table.tbl th { text-align: left; padding: 11px 14px; font-size: 11.5px; text-transform: uppercase; letter-spacing: .04em; color: var(--muted); font-weight: 600; border-bottom: 1px solid var(--line); background: #FAFBFA; white-space: nowrap; }
table.tbl td { padding: 12px 14px; border-bottom: 1px solid var(--line-soft); vertical-align: middle; }
table.tbl tr:last-child td { border-bottom: none; }
table.tbl tbody tr:hover { background: #FAFBFA; }
table.tbl .num { text-align: right; font-variant-numeric: tabular-nums; white-space: nowrap; }
table.tbl .center { text-align: center; }

.tag { display: inline-flex; align-items: center; gap: 5px; font-size: 11.5px; font-weight: 600; padding: 3px 9px; border-radius: 999px; white-space: nowrap; }
.tag.green { background: var(--pos-tint); color: var(--pos); }
.tag.gray  { background: var(--line-soft); color: var(--muted); }
.tag.red   { background: var(--neg-tint); color: var(--neg); }
.tag.amber { background: var(--warn-tint); color: var(--warn); }
.tag.blue  { background: var(--info-tint); color: var(--info); }
.tag.brand { background: var(--brand-tint); color: var(--brand); }

.row-actions { display: flex; gap: 6px; justify-content: flex-end; }
.icon-btn { width: 30px; height: 30px; border-radius: 8px; display: grid; place-items: center; background: var(--line-soft); color: var(--muted); font-size: 14px; transition: .12s; }
.icon-btn:hover { background: var(--line); color: var(--ink); }
.icon-btn.danger:hover { background: var(--neg-tint); color: var(--neg); }

.empty { text-align: center; padding: 40px 20px; color: var(--muted); }
.empty .e-ico { font-size: 32px; opacity: .35; }
.empty p { margin-top: 10px; font-size: 14px; }
.empty small { color: var(--muted-2); }

.rank { display: flex; flex-direction: column; }
.rank-row { display: flex; align-items: center; gap: 12px; padding: 11px 0; border-bottom: 1px solid var(--line-soft); }
.rank-row:last-child { border-bottom: none; }
.rank-n { width: 24px; height: 24px; flex: none; border-radius: 7px; background: var(--brand-tint); color: var(--brand); font-weight: 700; font-size: 12px; display: grid; place-items: center; }
.rank-row .r-name { flex: 1; font-size: 13.5px; font-weight: 500; }
.rank-row .r-name small { display: block; color: var(--muted); font-weight: 400; font-size: 12px; }
.rank-row .r-val { font-variant-numeric: tabular-nums; font-weight: 600; font-size: 13.5px; }
.bar-line { height: 6px; border-radius: 4px; background: var(--line-soft); overflow: hidden; margin-top: 5px; }
.bar-line span { display: block; height: 100%; background: var(--brand); border-radius: 4px; }

.stat-line { display: flex; justify-content: space-between; padding: 9px 0; border-bottom: 1px solid var(--line-soft); font-size: 13.5px; gap: 12px; }
.stat-line:last-child { border-bottom: none; }
.stat-line span:first-child { color: var(--muted); }
.stat-line b { font-variant-numeric: tabular-nums; text-align: right; }

/* Estado del día */
.estado-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 0 26px; }
@media (max-width: 560px){ .estado-grid { grid-template-columns: 1fr; } }
.accion-box { margin-top: 14px; }

.seg { display: inline-flex; background: var(--line-soft); border-radius: 10px; padding: 3px; gap: 2px; }
.seg button { padding: 8px 16px; border-radius: 8px; font-size: 13px; font-weight: 600; color: var(--muted); }
.seg button.active { background: #fff; color: var(--ink); box-shadow: var(--shadow-sm); }

/* ============ FORMS ============ */
.form-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; }
.form-grid .full { grid-column: 1 / -1; }
.help { font-size: 12px; color: var(--muted); margin-top: 4px; }
.switch-row { display: flex; align-items: center; justify-content: space-between; padding: 12px 0; border-bottom: 1px solid var(--line-soft); gap: 14px; }
.switch-row:last-child { border-bottom: none; }
.switch-row .sr-text b { font-size: 14px; }
.switch-row .sr-text small { display: block; color: var(--muted); font-size: 12.5px; }
.switch { position: relative; width: 44px; height: 25px; flex: none; }
.switch input { display: none; }
.switch .track { position: absolute; inset: 0; background: var(--line); border-radius: 999px; transition: .15s; }
.switch .track::after { content: ""; position: absolute; top: 3px; left: 3px; width: 19px; height: 19px; background: #fff; border-radius: 50%; transition: .15s; box-shadow: var(--shadow-sm); }
.switch input:checked + .track { background: var(--brand); }
.switch input:checked + .track::after { transform: translateX(19px); }

/* ============ MODAL ============ */
.modal-overlay { position: fixed; inset: 0; background: rgba(17,22,29,.42); display: flex; align-items: flex-start; justify-content: center; padding: 40px 16px; z-index: 100; overflow-y: auto; backdrop-filter: blur(2px); }
.modal { background: var(--card); border-radius: var(--radius-lg); width: 100%; max-width: 560px; box-shadow: 0 24px 60px rgba(17,22,29,.25); animation: pop .18s ease; }
.modal.wide { max-width: 720px; }
@keyframes pop { from { transform: translateY(8px) scale(.98); opacity: 0; } to { transform: none; opacity: 1; } }
.modal-head { padding: 20px 24px; border-bottom: 1px solid var(--line-soft); display: flex; align-items: center; gap: 12px; }
.modal-head h3 { font-family: var(--display); font-size: 18px; letter-spacing: -.3px; }
.modal-head .spacer { flex: 1; }
.modal-close { font-size: 22px; color: var(--muted); width: 32px; height: 32px; border-radius: 8px; }
.modal-close:hover { background: var(--line-soft); color: var(--ink); }
.modal-body { padding: 22px 24px; }
.modal-foot { padding: 16px 24px; border-top: 1px solid var(--line-soft); display: flex; gap: 10px; justify-content: flex-end; flex-wrap: wrap; }

/* ============ REGISTRAR VENTA ============ */
.sale-layout { display: grid; grid-template-columns: 1.2fr 1fr; gap: 16px; align-items: start; }
.sale-cart-col { position: sticky; top: 80px; }
.prod-search { margin-bottom: 12px; }
.prod-list { max-height: 460px; overflow-y: auto; display: grid; gap: 8px; }
.prod-pick { display: flex; align-items: center; gap: 12px; padding: 12px 14px; border: 1px solid var(--line); border-radius: var(--radius-sm); text-align: left; width: 100%; transition: .12s; }
.prod-pick:hover { border-color: var(--brand); background: var(--brand-tint); }
.prod-pick .p-name { flex: 1; }
.prod-pick .p-name b { font-size: 14px; display: block; }
.prod-pick .p-name small { color: var(--muted); font-size: 12px; }
.prod-pick .p-price { font-weight: 700; font-variant-numeric: tabular-nums; color: var(--brand); }

.cart { background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); padding: 18px; box-shadow: var(--shadow-sm); }
.cart-title { font-family: var(--display); font-size: 16px; font-weight: 600; margin-bottom: 12px; display: flex; align-items: center; justify-content: space-between; }
.cart-item { display: flex; align-items: center; gap: 8px; padding: 9px 0; border-bottom: 1px solid var(--line-soft); }
.cart-item:last-of-type { border-bottom: none; }
.cart-item .ci-name { flex: 1; font-size: 13.5px; min-width: 0; }
.cart-item .ci-name small { display: block; color: var(--muted); font-size: 12px; }
.cart-item .ci-sub { width: 76px; text-align: right; font-weight: 600; }
.ci-del { width: 26px; height: 26px; border-radius: 7px; color: var(--muted-2); font-size: 16px; display: grid; place-items: center; }
.ci-del:hover { background: var(--neg-tint); color: var(--neg); }
.qty { display: flex; align-items: center; gap: 6px; }
.qty button { width: 28px; height: 28px; border-radius: 7px; background: var(--line-soft); font-weight: 700; color: var(--ink); font-size: 15px; }
.qty button:hover { background: var(--line); }
.qty input { width: 40px; text-align: center; padding: 5px; border: 1px solid var(--line); border-radius: 7px; }
.cart-total { display: flex; justify-content: space-between; align-items: baseline; margin-top: 14px; padding-top: 14px; border-top: 2px solid var(--line); }
.cart-total .ct-label { color: var(--muted); font-size: 13px; }
.cart-total .ct-val { font-family: var(--display); font-size: 28px; font-weight: 700; color: var(--brand); font-variant-numeric: tabular-nums; }
.pay-grid { display: grid; grid-template-columns: repeat(3,1fr); gap: 8px; margin-top: 10px; }
.pay-opt { padding: 11px 6px; border: 1.5px solid var(--line); border-radius: var(--radius-sm); font-size: 12.5px; font-weight: 600; color: var(--muted); text-align: center; transition: .12s; }
.pay-opt:hover { border-color: var(--brand); }
.pay-opt.active { border-color: var(--brand); background: var(--brand-tint); color: var(--brand); }
.mixed-row { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; margin-top: 8px; }
details.opt summary { cursor: pointer; font-size: 13px; color: var(--brand); font-weight: 600; padding: 6px 0; list-style: none; }
details.opt summary::-webkit-details-marker { display: none; }
details.opt summary::before { content: "＋ "; }
details.opt[open] summary::before { content: "− "; }

/* Éxito de venta */
.sale-success { text-align: center; padding: 18px 6px; }
.sale-success .ok-ring { width: 64px; height: 64px; border-radius: 50%; background: var(--pos-tint); color: var(--pos); display: grid; place-items: center; font-size: 30px; margin: 0 auto 14px; }
.sale-success h3 { font-family: var(--display); font-size: 19px; }
.sale-success .ss-total { font-family: var(--display); font-size: 30px; font-weight: 700; color: var(--brand); margin: 6px 0 4px; font-variant-numeric: tabular-nums; }
.sale-success small { color: var(--muted); }
.sale-success .ss-actions { display: grid; gap: 10px; margin-top: 20px; }

/* Comprobante interno */
.receipt { border: 1px dashed var(--line); border-radius: var(--radius); padding: 18px; background: #FAFBFA; }
.receipt .r-head { text-align: center; border-bottom: 1px dashed var(--line); padding-bottom: 12px; margin-bottom: 12px; }
.receipt .r-head b { font-family: var(--display); font-size: 16px; }
.receipt .r-head small { display: block; color: var(--muted); font-size: 12px; margin-top: 2px; }
.receipt .r-line { display: flex; justify-content: space-between; font-size: 13px; padding: 4px 0; gap: 10px; }
.receipt .r-prod { display: flex; justify-content: space-between; font-size: 13px; padding: 5px 0; border-bottom: 1px solid var(--line-soft); }
.receipt .r-total { display: flex; justify-content: space-between; border-top: 1px dashed var(--line); margin-top: 8px; padding-top: 10px; font-weight: 700; }
.receipt .r-total .tnum { font-family: var(--display); font-size: 18px; color: var(--brand); }

/* Banner aviso */
.note { display: flex; gap: 12px; align-items: flex-start; background: var(--info-tint); border: 1px solid #c2d6ee; color: #1b4a7a; padding: 12px 16px; border-radius: var(--radius); font-size: 13.5px; margin-bottom: 18px; }
.note .n-ico { font-size: 16px; }

/* Permisos chips */
.perm-list { display: flex; flex-wrap: wrap; gap: 5px; }
.perm-list .tag { font-size: 11px; }

/* Toast */
.toast-wrap { position: fixed; bottom: 24px; right: 24px; z-index: 200; display: flex; flex-direction: column; gap: 10px; }
.toast { background: var(--ink); color: #fff; padding: 13px 18px; border-radius: var(--radius-sm); font-size: 13.5px; box-shadow: 0 10px 30px rgba(0,0,0,.25); display: flex; align-items: center; gap: 10px; animation: slideIn .2s ease; max-width: 340px; }
.toast.ok { background: var(--brand-dk); }
.toast.err { background: var(--neg); }
@keyframes slideIn { from { transform: translateX(20px); opacity: 0; } to { transform: none; opacity: 1; } }

/* ============ RESPONSIVE ============ */
@media (max-width: 980px) {
  .section-grid, .section-grid.even { grid-template-columns: 1fr; }
  .sale-layout { grid-template-columns: 1fr; }
  .sale-cart-col { position: static; }
  .login-wrap { grid-template-columns: 1fr; }
  .login-aside { display: none; }
}
@media (max-width: 760px) {
  .app { grid-template-columns: 1fr; }
  .sidebar { position: fixed; left: 0; top: 0; bottom: 0; z-index: 60; transform: translateX(-100%); transition: transform .2s; width: 250px; }
  .sidebar.show { transform: none; box-shadow: 0 0 50px rgba(0,0,0,.4); }
  .menu-toggle { display: grid; place-items: center; width: 40px; height: 40px; border-radius: 9px; background: var(--line-soft); font-size: 19px; }
  .scrim { position: fixed; inset: 0; background: rgba(0,0,0,.45); z-index: 55; }
  .content { padding: 18px 16px 48px; }
  .topbar { padding: 0 14px; gap: 12px; }
  .biz-chip { display: none; }
  .form-grid { grid-template-columns: 1fr; }
  .pay-grid { grid-template-columns: repeat(2,1fr); }
  .page-head h3 { font-size: 20px; }
  .prod-list { max-height: 320px; }
  .kpi-grid { grid-template-columns: repeat(2, 1fr); gap: 10px; }
  .kpi .kpi-val { font-size: 22px; }
  .modal-foot { justify-content: stretch; }
  .modal-foot .btn { flex: 1; }
}
@media (max-width: 400px) {
  .kpi-grid { grid-template-columns: 1fr; }
}

/* ============================================================
   REGISTRAR VENTA v3 — caja real
   ============================================================ */
.sale-search-wrap { margin-bottom: 18px; }
.sale-search-input { width: 100%; font-size: 17px; font-weight: 500; padding: 16px 18px; border: 1.5px solid var(--line); border-radius: 14px; background: #fff; box-shadow: var(--shadow-sm); transition: .15s; color: var(--ink); }
.sale-search-input::placeholder { color: var(--muted-2); font-weight: 400; }
.sale-search-input:focus { outline: none; border-color: var(--brand); box-shadow: 0 0 0 3px rgba(14,124,102,.14); }
.sale-help { font-size: 12.5px; color: var(--muted); margin-top: 8px; }

.sale-results { margin-top: 12px; border: 1px solid var(--line); border-radius: 14px; background: #fff; box-shadow: var(--shadow); overflow: hidden; }
.res-item { display: flex; align-items: center; gap: 12px; width: 100%; text-align: left; padding: 13px 16px; border-bottom: 1px solid var(--line-soft); transition: .12s; }
.res-item:last-child { border-bottom: none; }
.res-item:hover { background: var(--brand-tint); }
.res-item .ri-name { flex: 1; min-width: 0; }
.res-item .ri-name b { font-size: 14px; display: block; }
.res-item .ri-name small { color: var(--muted); font-size: 12px; }
.res-item .ri-price { font-weight: 700; color: var(--brand); font-variant-numeric: tabular-nums; }
.res-item .ri-add { font-size: 11.5px; font-weight: 700; color: var(--brand); background: var(--brand-tint); padding: 5px 11px; border-radius: 999px; white-space: nowrap; }

.noresult { display: flex; align-items: center; gap: 14px; padding: 16px; flex-wrap: wrap; }
.noresult .nr-ico { width: 40px; height: 40px; flex: none; border-radius: 10px; background: var(--line-soft); display: grid; place-items: center; font-size: 16px; color: var(--muted); }
.noresult b { font-size: 14px; }
.noresult .nr-actions { display: flex; gap: 8px; flex-wrap: wrap; }

.sale-grid { display: grid; grid-template-columns: 1.5fr 1fr; gap: 16px; align-items: start; }
.venta-actual { border: 1.5px solid #cfe6dd; }
.venta-actual .panel-head { background: var(--brand-tint); }
.venta-actual .panel-head h4 { color: var(--brand-dk); }
.cobro { position: sticky; top: 80px; }
.link-clear { font-size: 12.5px; font-weight: 600; color: var(--muted); margin-left: 8px; }
.link-clear:hover { color: var(--neg); }

/* Acción terciaria: texto con color de marca, sin borde ni fondo — para
   acciones opcionales o de baja frecuencia que no necesitan peso de botón. */
.link-action { font-size: 13.5px; font-weight: 600; color: var(--brand-dk); padding: 10px 2px; min-height: var(--target-touch); display: inline-flex; align-items: center; }
.link-action:hover { text-decoration: underline; }

.qa-check { display: flex; align-items: center; gap: 10px; margin-top: 16px; font-size: 14px; font-weight: 500; cursor: pointer; padding: 12px 14px; background: var(--brand-tint); border-radius: 10px; }
.qa-check input { width: 18px; height: 18px; accent-color: var(--brand); }

@media (max-width: 980px) {
  .sale-grid { grid-template-columns: 1fr; }
  .cobro { position: static; }
}

/* ============================================================
   ARQUITECTURA v4 — densidad, pestañas, scroll interno
   ============================================================ */
.content { padding-top: 20px; padding-bottom: 40px; }
.page-head { margin-bottom: 14px; }
.eyebrow { margin: 16px 0 10px; }
.kpi-grid { grid-template-columns: repeat(auto-fill, minmax(178px,1fr)); gap: 12px; margin-bottom: 14px; }
.kpi { padding: 13px 15px; }
.kpi .kpi-val { font-size: 22px; margin-top: 5px; }
.kpi .kpi-sub { margin-top: 3px; }
.panel + .panel { margin-top: 14px; }
.panel-head { padding: 13px 16px; }
.panel-body { padding: 14px 16px; }

/* tablas con scroll interno + encabezado fijo */
.table-wrap { max-height: 442px; overflow: auto; }
.table-wrap table.tbl thead th { position: sticky; top: 0; z-index: 2; }

/* pestañas horizontales (referencia Vuelve) */
.tabs { display: flex; gap: 2px; border-bottom: 1px solid var(--line); margin-bottom: 16px; overflow-x: auto; }
.tabs button { padding: 10px 15px; font-size: 13.5px; font-weight: 600; color: var(--muted); border-bottom: 2px solid transparent; white-space: nowrap; transition: .12s; }
.tabs button:hover { color: var(--ink); }
.tabs button.active { color: var(--brand); border-bottom-color: var(--brand); }
.seg { margin-bottom: 14px; }

/* dashboard en 3 bloques compactos */
.dash-grid { display: grid; grid-template-columns: 1.25fr 1fr 1fr; gap: 14px; align-items: start; }
.dash-grid .panel-body { max-height: 340px; overflow: auto; }
@media (max-width: 1100px){ .dash-grid { grid-template-columns: 1fr 1fr; } }
@media (max-width: 720px){ .dash-grid { grid-template-columns: 1fr; } }

/* caja: estado compacto en 2 columnas */
.caja-estado { display: grid; grid-template-columns: 1fr 1fr; gap: 0 26px; }
@media (max-width: 560px){ .caja-estado { grid-template-columns: 1fr; } }

/* venta actual con scroll interno */
.venta-actual .panel-body { max-height: 360px; overflow: auto; }

/* franja compacta de resumen (ventas) */
.bar-strip { display: flex; flex-wrap: wrap; gap: 18px; align-items: center; padding: 10px 14px; background: var(--brand-tint); border-radius: 10px; margin-bottom: 12px; font-size: 13px; }
.bar-strip .bs-item span { color: var(--brand-dk); opacity: .8; }
.bar-strip .bs-item b { font-variant-numeric: tabular-nums; color: var(--brand-dk); margin-left: 5px; }
.bar-strip .spacer { flex: 1; }

/* note compacta */
.note.slim { padding: 9px 13px; font-size: 12.5px; margin-bottom: 14px; }

/* ============================================================
   REGISTRAR VENTA v5 — caja a pantalla completa
   ============================================================ */
/* C v2.2 — Fase 2: esta regla es global (sin scope a Registrar) y ganaba la
   cascada sobre el --topbar de arriba, dejándolo en 56px en TODA la app.
   Se actualiza a 60px para no revertir el Topbar nuevo. Cuando Registrar
   venta migre a C v2.2, esta herencia cruzada entre pantallas debería
   resolverse con una regla scoped — no se decide aquí. */
.topbar { height: 60px; }
.content { padding-top: 18px; }

.reg-head { margin-bottom: 12px; }
.reg-head h3 { font-family: var(--display); font-size: 18px; letter-spacing: -.3px; margin-bottom: 10px; }
.sale-search-wrap { margin-bottom: 12px; }
.sale-search-input { padding: 13px 16px; font-size: 16px; }
.sale-help { margin-top: 6px; }
.reg-view .alert { margin-bottom: 12px; }

.sale-grid { grid-template-columns: 1.5fr 1fr; align-items: start; }

/* Venta actual: scroll interno, no empuja el cobro */
.venta-actual .panel-head { padding: 11px 16px; }
.venta-actual .panel-body { max-height: calc(100vh - 268px); min-height: 130px; overflow-y: auto; padding: 6px 16px; }
.venta-actual .cart-item { padding: 8px 0; }

/* Cobro: cabecera + cuerpo scrollable + pie fijo */
.cobro { position: sticky; top: 70px; max-height: calc(100vh - 86px); display: flex; flex-direction: column; padding: 0; }
.cobro .panel-head { padding: 11px 16px; flex: none; }
.cobro-body { flex: 1 1 auto; overflow-y: auto; padding: 12px 16px; }
.cobro-body .stat-line { padding: 6px 0; }
.cobro-body .field { margin: 8px 0 4px; }
.cobro-body .field label { margin-bottom: 4px; }
.cobro-body .pay-grid { margin-top: 8px; gap: 7px; }
/* Estabilización C v2.2: área táctil mínima 44px en TODOS los anchos, no
   solo mobile — 31px en desktop no cumplía el mínimo definido. Grid,
   colores, tipografía y estado seleccionado (forest) no cambian; solo
   crece el propio botón, no el resto de la tarjeta de Cobro. */
.cobro-body .pay-opt { padding: 8px 6px; min-height: var(--target-touch); display: flex; align-items: center; justify-content: center; }
.cobro-body details.opt summary { padding: 5px 0; }
.cobro-foot { flex: none; padding: 12px 16px 14px; border-top: 1px solid var(--line); background: var(--card); }
.foot-total { display: flex; justify-content: space-between; align-items: baseline; margin-bottom: 9px; }
.foot-total span { color: var(--muted); font-size: 13px; }
.foot-total b { font-family: var(--display); font-size: 25px; color: var(--brand); font-variant-numeric: tabular-nums; }

/* Celular: total + cobrar en barra inferior fija */
@media (max-width: 980px) {
  .sale-grid { grid-template-columns: 1fr; }
  .cobro { position: static; max-height: none; display: block; }
  .cobro-body { overflow: visible; }
  .venta-actual .panel-body { max-height: 46vh; }
  .cobro-foot { position: fixed; left: 0; right: 0; bottom: 0; z-index: 50; border-top: 1px solid var(--line); box-shadow: 0 -6px 20px rgba(17,22,29,.14); }
  .reg-view { padding-bottom: 104px; }
  /* Área táctil mínima 44px del segmento %/$ del descuento — solo mobile,
     no se tocó (fuera del alcance de esta estabilización). El mínimo de
     .pay-opt ya es incondicional (ver regla base junto a .cobro-body
     .pay-grid, arriba), por eso no se repite aquí. */
  .disc-seg .ds-opt { min-height: var(--target-touch); }
}

/* ============================================================
   RESULTADOS DE BÚSQUEDA — dropdown flotante (no empuja layout)
   ============================================================ */
.sale-search-box { position: relative; }
#saleResults { position: absolute; left: 0; right: 0; top: calc(100% + 6px); z-index: 60; }
#saleResults:empty { display: none; }
#saleResults .sale-results { margin-top: 0; max-height: 320px; overflow-y: auto; box-shadow: 0 16px 40px rgba(17,22,29,.18); }

/* ============================================================
   PAGO MIXTO — resumen compacto en panel de cobro
   ============================================================ */
.mix-summary { display: flex; align-items: center; justify-content: space-between; gap: 10px; margin-top: 8px; padding: 8px 10px 8px 12px; border-radius: 10px; font-size: 13px; font-weight: 600; }
.mix-summary.pos { background: var(--pos-tint); color: var(--pos); }
.mix-summary.warn { background: var(--warn-tint); color: var(--warn); }
.mix-summary.neg { background: var(--neg-tint); color: var(--neg); }
.mix-summary .btn { flex: none; }

/* ============================================================
   REGISTRAR VENTA v6 — buscador dentro de la columna izquierda
   ============================================================ */
.reg-head { margin-bottom: 10px; }
.reg-head h3 { margin-bottom: 0; font-size: 18px; }

.sale-left { display: flex; flex-direction: column; gap: 10px; min-width: 0; }
.sale-search-box { position: relative; }
.sale-search-input { padding: 11px 14px; font-size: 15px; }
.sale-help { margin: 0 0 2px; font-size: 12px; color: var(--muted); }

/* Venta actual debajo del buscador, con scroll interno propio */
.venta-actual .panel-body { max-height: calc(100vh - 300px); }

/* El cobro arranca arriba, alineado con el buscador */
.sale-grid { align-items: start; }

@media (max-width: 980px) {
  /* En móvil el buscador puede ocupar todo el ancho */
  .venta-actual .panel-body { max-height: 46vh; }
}

/* Pago mixto — desglose en el resumen de cobro */
.mix-summary { align-items: flex-start; }
.mix-summary .ms-body { flex: 1; min-width: 0; }
.ms-title { font-weight: 700; margin-bottom: 3px; }
.ms-row { display: flex; justify-content: space-between; gap: 12px; font-weight: 600; font-size: 12.5px; padding: 1px 0; }
.ms-row.vuelto { margin-top: 2px; padding-top: 3px; border-top: 1px dashed currentColor; }

/* ============================================================
   PANEL TIPO CAJA — total / recibido / vuelto grande
   ============================================================ */
.reg-summary { margin-bottom: 10px; }
.rs-row { display: flex; justify-content: space-between; align-items: baseline; gap: 12px; padding: 2px 0; }
.rs-row span { font-size: var(--fs-micro); font-weight: 700; letter-spacing: .06em; color: var(--muted); }
.rs-row b { font-family: var(--display); font-size: 20px; font-variant-numeric: tabular-nums; color: var(--ink); }
/* N1 real de Registrar venta: Total a pagar, por escala tipográfica y
   posición (siempre al cierre del cobro), no por tarjeta de color. */
.rs-row.rs-total { padding-top: 4px; }
.rs-row.rs-total span { font-size: var(--fs-small); }
.rs-row.rs-total b { font-size: var(--fs-hero-solo); font-weight: 700; }
.rs-row.vuelto { margin-top: 5px; padding-top: 8px; border-top: 2px solid var(--pos); }
.rs-row.vuelto span { color: var(--pos); font-size: 13px; }
.rs-row.vuelto b { color: var(--pos); font-size: 30px; line-height: 1.05; }
.rs-row.faltan { margin-top: 5px; padding-top: 8px; border-top: 2px solid var(--neg); }
.rs-row.faltan span { color: var(--neg); font-size: 13px; }
.rs-row.faltan b { color: var(--neg); font-size: 30px; line-height: 1.05; }
.rs-row.exacto span, .rs-row.exacto b { color: var(--pos); }

/* ============================================================
   ANTES DE CERRAR LA VENTA — Club Natural + adicionales
   ============================================================ */
.pc-opts { display: flex; flex-wrap: wrap; gap: 8px; }
.pc-chips { display: flex; flex-wrap: wrap; gap: 8px; }
.chip-btn { border: 1px solid var(--line); background: var(--card); color: var(--ink); border-radius: 999px; padding: 7px 14px; font-size: 13px; font-weight: 600; cursor: pointer; transition: .15s; }
.chip-btn:hover { border-color: var(--brand); color: var(--brand-dk); background: var(--brand-tint); }
.chip-btn.alt { background: var(--brand-tint); border-color: transparent; color: var(--brand-dk); }
.chip-btn.alt:hover { background: var(--brand); color: #fff; }
.pc-foot { display: flex; flex-wrap: wrap; gap: 8px; justify-content: flex-end; }
@media (max-width: 560px) {
  .pc-foot { flex-direction: column-reverse; }
  .pc-foot .btn { width: 100%; }
}

/* ============================================================
   ANTES DE CERRAR LA VENTA v2 — rediseño limpio
   ============================================================ */
.modal-sub { margin: 3px 0 0; font-size: 13px; color: var(--muted); font-weight: 400; }
.pc-body { padding: 22px 24px; }
.pc-section { margin-bottom: 24px; }
.pc-section:last-child { margin-bottom: 0; }
.pc-label { font-size: 11px; font-weight: 700; letter-spacing: .07em; text-transform: uppercase; color: var(--muted-2); margin-bottom: 12px; }

.pc-cards { display: grid; grid-template-columns: repeat(3, 1fr); gap: 10px; }
.pc-card { text-align: left; border: 1px solid var(--line); background: var(--card); border-radius: 12px; padding: 13px 14px; cursor: pointer; display: flex; flex-direction: column; gap: 3px; transition: .15s; }
.pc-card b { font-size: 13.5px; color: var(--ink); }
.pc-card small { font-size: 11.5px; color: var(--muted); line-height: 1.3; }
.pc-card:hover { border-color: var(--brand); }
.pc-card.active { border-color: var(--brand); background: var(--brand-tint); box-shadow: inset 0 0 0 1px var(--brand); }

.pc-note { margin: 12px 0 0; font-size: 13px; color: var(--muted); }
.pc-cli { display: flex; align-items: center; gap: 10px; margin-top: 14px; padding: 10px 12px; border-radius: 10px; background: var(--pos-tint); color: var(--pos); font-size: 13px; font-weight: 600; }
.pc-cli-ico { display: inline-flex; align-items: center; justify-content: center; width: 20px; height: 20px; border-radius: 50%; background: var(--pos); color: #fff; font-size: 12px; flex: none; }

.pc-more { background: none; border: none; color: var(--brand-dk); font-weight: 600; font-size: 13px; cursor: pointer; padding: 10px 0 0; }
.pc-more:hover { text-decoration: underline; }

.pc-foot { display: flex; gap: 10px; justify-content: flex-end; }

@media (max-width: 560px) {
  .pc-cards { grid-template-columns: 1fr; }
  .pc-foot { flex-direction: column-reverse; }
  .pc-foot .btn { width: 100%; }
}

/* Total actual dentro del modal pre-cierre */
.pc-total { font-size: 13px; color: var(--muted); margin-bottom: 10px; }
.pc-total b { font-family: var(--display); font-size: 16px; color: var(--brand-dk); font-variant-numeric: tabular-nums; }

/* Resumen del cliente asociado en el panel de cobro */
.cli-tag { margin-top: 10px; padding: 8px 12px; border-radius: 10px; background: var(--brand-tint); color: var(--brand-dk); font-size: 12.5px; font-weight: 600; }

/* ============================================================
   ADMIN VALEN + login admin
   ============================================================ */
.role-ico.adm { background: linear-gradient(135deg,#7c3aed,#4f46e5); color: #fff; }
.plan-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(200px, 1fr)); gap: 14px; }
@media (max-width: 700px){ .plan-grid { grid-template-columns: 1fr; } }

/* Planes (admin) */
.plan-card .plan-price { font-family: var(--display); font-size: 28px; margin: 6px 0 12px; }
.plan-card .plan-price small { font-size: 13px; color: var(--muted); font-family: var(--sans); }
.plan-list { list-style: none; margin: 0; padding: 0; }
.plan-list li { display: flex; justify-content: space-between; gap: 10px; padding: 6px 0; border-bottom: 1px solid var(--line-soft); font-size: 13px; }
.plan-list li:last-child { border-bottom: none; }
.plan-list li span { color: var(--muted); }
.tag.accent { background: #ede9fe; color: #6d28d9; }

/* ============================================================
   PULIDO VISUAL v8 — jerarquía, aire y limpieza
   ============================================================ */
/* Más aire entre secciones */
.panel { box-shadow: var(--shadow-sm); border-color: var(--line-soft); }
.panel + .panel { margin-top: 16px; }
.kpi-grid { margin-bottom: 16px; }
.dash-grid { margin-top: 4px; }

/* Jerarquía de KPIs: primarios destacados, secundarios discretos */
.kpi-grid.primary { grid-template-columns: repeat(auto-fit, minmax(210px,1fr)); gap: 16px; margin-bottom: 14px; }
.kpi-grid.primary .kpi { padding: 18px 20px; }
.kpi-grid.primary .kpi .kpi-val { font-size: 30px; }
.kpi-grid.secondary { grid-template-columns: repeat(auto-fit, minmax(180px,1fr)); gap: 12px; margin-bottom: 18px; }
.kpi-grid.secondary .kpi { padding: 13px 15px; background: transparent; box-shadow: none; border-color: var(--line-soft); }
.kpi-grid.secondary .kpi .kpi-val { font-size: 21px; color: var(--muted); }
.kpi-grid.secondary .kpi .kpi-label { font-size: 12px; }

/* Tablas más limpias */
.tbl thead th { background: transparent; border-bottom: 1px solid var(--line-soft); color: var(--muted-2); font-weight: 600; font-size: 11.5px; letter-spacing: .04em; text-transform: uppercase; }
.tbl td { border-bottom: 1px solid var(--line-soft); }
.tbl tbody tr:last-child td { border-bottom: none; }
.tbl tbody tr:hover { background: var(--brand-tint); }

/* Badges/tags más suaves */
.tag { font-weight: 600; border-radius: 7px; }

/* Encabezados de panel y títulos más calmados */
.panel-head h4 { font-size: 14px; letter-spacing: -.2px; }
.page-head h2 { letter-spacing: -.5px; }

/* Alertas "Qué mirar hoy" más suaves */
.panel-body > .alert + .alert { margin-top: 8px; }

/* ============================================================
   REDISEÑO VISUAL v9 — layout, jerarquía y componentes
   ============================================================ */

/* ---- KPI cards: más limpias, menos altura, sin borde de color fuerte ---- */
.kpi { border-color: var(--line-soft); box-shadow: 0 1px 2px rgba(17,22,29,.04); padding: 14px 16px; }
.kpi.accent-pos, .kpi.accent-neg, .kpi.accent-brand, .kpi.accent-info, .kpi.accent-accent, .kpi.accent-warn, .kpi.accent-color { border-left: 1px solid var(--line-soft); }
.kpi .kpi-label { font-size: 11.5px; color: var(--muted-2); font-weight: 600; }
.kpi .kpi-ico { opacity: .5; font-size: 13px; }
.kpi .kpi-val { font-size: 24px; margin-top: 6px; }

/* ---- Hero row (dashboard) ---- */
.hero-row { display: grid; grid-template-columns: 1.3fr 1fr; gap: 16px; margin-bottom: 16px; }
.hero-card { background: var(--card); border: 1px solid var(--line-soft); border-radius: 16px; padding: 22px 24px; box-shadow: 0 2px 10px rgba(17,22,29,.05); }
.hero-card.feat { background: linear-gradient(135deg, var(--brand), var(--brand-dk)); color: #fff; border: none; }
.hero-card.feat .hero-label, .hero-card.feat .hero-sub { color: rgba(255,255,255,.85); }
.hero-card.feat .hero-ico { color: rgba(255,255,255,.9); }
.hero-card.feat .btn-primary { background: #fff; color: var(--brand-dk); }
.hero-top { display: flex; align-items: center; gap: 8px; margin-bottom: 14px; }
.hero-ico { font-size: 15px; opacity: .8; }
.hero-label { font-size: 12.5px; font-weight: 700; letter-spacing: .03em; text-transform: uppercase; color: var(--muted); }
.hero-val { font-family: var(--display); font-size: 40px; font-weight: 700; letter-spacing: -1px; line-height: 1; font-variant-numeric: tabular-nums; }
.hero-sub { font-size: 13px; color: var(--muted); margin-top: 8px; }
.hero-card.caja .hero-val { color: var(--brand-dk); }
.hero-card.caja.off .hero-val { color: var(--muted-2); }

/* ---- Metric row (3 chicas) ---- */
.metric-row { display: grid; grid-template-columns: repeat(3, 1fr); gap: 14px; margin-bottom: 16px; }
.metric { background: var(--card); border: 1px solid var(--line-soft); border-radius: 12px; padding: 14px 16px; }
.metric .m-label { font-size: 11.5px; font-weight: 600; color: var(--muted-2); text-transform: uppercase; letter-spacing: .03em; }
.metric .m-val { font-family: var(--display); font-size: 23px; margin-top: 5px; font-variant-numeric: tabular-nums; }
.metric .m-sub { font-size: 12px; color: var(--muted-2); margin-top: 3px; }

/* ---- Sub-métricas (control del mes), discretas en línea ---- */
.sub-metrics { display: flex; flex-wrap: wrap; align-items: center; gap: 22px; padding: 12px 18px; background: var(--bg-soft, #f3f5f4); border-radius: 12px; margin-bottom: 18px; }
.sub-metrics .sm-title { font-size: 11px; font-weight: 700; text-transform: uppercase; letter-spacing: .05em; color: var(--muted-2); }
.sub-metrics .sm-item { display: flex; flex-direction: column; }
.sub-metrics .sm-item span { font-size: 11.5px; color: var(--muted-2); }
.sub-metrics .sm-item b { font-size: 15px; font-variant-numeric: tabular-nums; }
.sub-metrics .sm-item b.pos { color: var(--pos); } .sub-metrics .sm-item b.neg { color: var(--neg); }

/* ---- Insights (alertas suaves) ---- */
.insights .insight { display: flex; gap: 10px; align-items: flex-start; padding: 9px 0; border-bottom: 1px solid var(--line-soft); font-size: 13px; }
.insights .insight:last-child { border-bottom: none; }
.insight .i-dot { width: 7px; height: 7px; border-radius: 50%; margin-top: 6px; flex: none; background: var(--muted-2); }
.insight.pos .i-dot { background: var(--pos); } .insight.neg .i-dot { background: var(--neg); }
.insight.info .i-dot { background: var(--info); } .insight.warn .i-dot { background: var(--warn); }

/* ---- Vendedor: barra de estado + tiles + accesos ---- */
.vend-bar { display: flex; align-items: center; gap: 12px; padding: 11px 16px; border-radius: 12px; border: 1px solid var(--line-soft); background: var(--card); }
.vend-bar.on { border-left: 3px solid var(--pos); } .vend-bar.off { border-left: 3px solid var(--warn); }
.vend-bar .vb-resp { font-size: 13px; color: var(--muted); }
.btn.btn-xl { padding: 18px; font-size: 17px; border-radius: 14px; }
.tile-row { display: grid; grid-template-columns: repeat(4, 1fr); gap: 12px; margin-bottom: 16px; }
.tile { background: var(--card); border: 1px solid var(--line-soft); border-radius: 12px; padding: 14px 16px; }
.tile.feat { background: var(--brand-tint); border-color: transparent; }
.tile .t-label { font-size: 11.5px; color: var(--muted-2); font-weight: 600; text-transform: uppercase; letter-spacing: .03em; }
.tile .t-val { font-family: var(--display); font-size: 22px; margin-top: 5px; font-variant-numeric: tabular-nums; }
.tile.feat .t-val { color: var(--brand-dk); }
.quick-actions { display: flex; flex-wrap: wrap; gap: 10px; }
.qa-btn { display: flex; align-items: center; gap: 8px; padding: 11px 16px; border-radius: 10px; border: 1px solid var(--line); background: var(--card); font-weight: 600; font-size: 13.5px; cursor: pointer; transition: .15s; }
.qa-btn span { opacity: .6; }
.qa-btn:hover { border-color: var(--brand); color: var(--brand-dk); background: var(--brand-tint); }

/* ---- Caja: hero + columnas ---- */
.caja-hero { display: grid; grid-template-columns: 1.4fr 1fr; gap: 16px; align-items: stretch; margin-bottom: 16px; }
.ch-main { background: linear-gradient(135deg, var(--brand), var(--brand-dk)); color: #fff; border-radius: 16px; padding: 24px 26px; }
.ch-top { display: flex; align-items: center; gap: 10px; margin-bottom: 16px; }
.ch-top .caja-pill { background: rgba(255,255,255,.18); color: #fff; }
.ch-date { font-size: 12px; color: rgba(255,255,255,.8); }
.ch-label { font-size: 12.5px; text-transform: uppercase; letter-spacing: .04em; color: rgba(255,255,255,.85); }
.ch-val { font-family: var(--display); font-size: 42px; font-weight: 700; letter-spacing: -1px; line-height: 1.05; margin-top: 4px; font-variant-numeric: tabular-nums; }
.ch-resp { font-size: 13px; color: rgba(255,255,255,.85); margin-top: 10px; }
.ch-actions { display: flex; flex-direction: column; justify-content: center; gap: 10px; background: var(--card); border: 1px solid var(--line-soft); border-radius: 16px; padding: 20px; }
.caja-cols { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; }
.mov-row { display: flex; justify-content: space-between; align-items: center; padding: 10px 16px; border-bottom: 1px solid var(--line-soft); }
.mov-row:last-child { border-bottom: none; }
.mov-row .mv-t { font-size: 13.5px; font-weight: 600; }
.mov-row .mv-l small { font-size: 11.5px; color: var(--muted-2); }
.mov-row .mv-r { display: flex; align-items: center; gap: 10px; }

/* ---- Summary bar (gastos) ---- */
.summary-bar { display: flex; flex-wrap: wrap; align-items: center; gap: 28px; padding: 14px 20px; background: var(--card); border: 1px solid var(--line-soft); border-radius: 12px; margin-bottom: 16px; }
.summary-bar .sb-item { display: flex; flex-direction: column; }
.summary-bar .sb-item span { font-size: 11.5px; color: var(--muted-2); font-weight: 600; text-transform: uppercase; letter-spacing: .03em; }
.summary-bar .sb-item b { font-family: var(--display); font-size: 19px; margin-top: 3px; font-variant-numeric: tabular-nums; }
.summary-bar .sb-item b small { font-family: var(--sans); font-size: 12px; color: var(--muted-2); font-weight: 500; }

/* ---- Reportes: Fase 2 — alcance local a esta pantalla, sin tocar
   selectores compartidos (.panel/.page-head/.tabs se reutilizan tal cual). ---- */
.rep-filters-bar { display: flex; flex-wrap: wrap; align-items: flex-end; gap: 16px; padding: 12px 16px; background: var(--line-soft); border-radius: var(--radius-control); margin: 12px 0; }
.rep-filters-bar .field { margin: 0; min-width: 140px; }
.rep-filters-bar .input { padding: 8px 11px; }
.rep-filters-actions { display: flex; gap: 8px; align-self: flex-end; }
.rep-filters-actions .btn { min-height: var(--target-touch); }
.rep-filters-note { flex-basis: 100%; font-size: var(--fs-small); color: var(--muted); margin-top: 2px; }

.rep-tabs-wrap { position: relative; }
.rep-tabs-wrap .tabs button { min-height: var(--target-touch); display: inline-flex; align-items: center; }

/* Resumen: un solo contenedor (reutiliza .panel/.panel-body sin modificarlos)
   para las cifras N1 agrupadas + N2 de apoyo, en vez de 6 tarjetas separadas. */
.rep-headline-row { display: flex; flex-wrap: wrap; gap: 32px; }
.rep-stat-lbl { font-size: var(--fs-micro); text-transform: uppercase; letter-spacing: .06em; color: var(--muted-2); font-weight: 700; }
.rep-stat-num { font-family: var(--display); font-size: var(--fs-hero-grupo); font-weight: 700; letter-spacing: -.8px; margin-top: 4px; font-variant-numeric: tabular-nums; }
.rep-stat-num.brand { color: var(--brand-dk); }
.rep-stat-sub { font-size: var(--fs-small); color: var(--muted-2); margin-top: 3px; }

.rep-support-row { display: flex; flex-wrap: wrap; gap: 0; margin-top: 20px; padding-top: 16px; border-top: 1px solid var(--line-soft); }
.rep-support-stat { padding-right: 20px; margin-right: 20px; border-right: 1px solid var(--line-soft); }
.rep-support-stat:last-child { border-right: none; margin-right: 0; padding-right: 0; }
.rep-support-stat .rep-stat-num { font-size: 19px; margin-top: 2px; }
.rep-support-stat .rep-stat-lbl { margin-top: 2px; }

/* Destacados del período: texto plano (reutiliza .insights/.insight tal cual
   las usa Dashboard), no otra tarjeta. */
.rep-highlights { margin-top: 18px; }
.rep-highlights-title { font-size: var(--fs-micro); text-transform: uppercase; letter-spacing: .06em; color: var(--muted-2); font-weight: 700; margin-bottom: 8px; }

/* ---- Tablas más compactas y suaves ---- */
table.tbl th { padding: 9px 14px; background: transparent; color: var(--muted-2); border-bottom: 1px solid var(--line-soft); }
table.tbl td { padding: 9px 14px; }
table.tbl.tight td { padding: 7px 14px; }
.tag.soft { background: var(--line-soft); color: var(--muted); font-weight: 600; }
.tag { padding: 2px 8px; font-size: 11px; }

/* ---- Sidebar más liviano ---- */
/* C v2.2 — Fase 2: esta capa "epoch" ganaba la cascada sobre la base de
   arriba (mismo selector, declarado después) y dejaba el sidebar en un gris
   #14181d hardcodeado + nav-item.active en teal con sombra — se actualiza
   aquí para que no revierta silenciosamente el bosque/forest-soft nuevos.
   Corrección de paleta: el sidebar es ahora el único protagonista oscuro
   de marca (antes se repetía el mismo --forest en hero/cards). Degradado
   muy sutil (misma familia de --brand-deep, ~180deg) para dar profundidad
   sin que se note como "efecto" — no es un gradient de la Opción C (no
   existe ninguno en la referencia), es una variante aprobada visualmente. */
.sidebar { background: linear-gradient(180deg, #123A30 0%, #0F3129 100%); }
.nav-item { font-size: 14px; padding: 11px 14px; }
.nav-item.active { background: var(--brand-active); box-shadow: none; }
.nav-sep { margin: 14px 6px; }
.side-user { padding: 4px; }

/* ---- Responsive ---- */
@media (max-width: 900px){
  .hero-row, .caja-hero { grid-template-columns: 1fr; }
  .metric-row { grid-template-columns: 1fr 1fr; }
  .tile-row { grid-template-columns: 1fr 1fr; }
  .caja-cols { grid-template-columns: 1fr; }
}

@media (max-width: 820px){
  .rep-tabs-wrap::after { content:""; position:absolute; top:0; right:0; bottom:16px; width:28px; background:linear-gradient(to right, transparent, var(--bg)); pointer-events:none; }
}

/* ============================================================
   DASHBOARD DUEÑO v10 — jerarquía SaaS
   ============================================================ */
.metric-row.four { grid-template-columns: repeat(4, 1fr); }
.dash-2col { display: grid; grid-template-columns: 1.1fr 1fr; gap: 16px; align-items: start; }

/* Recomendación destacada (primera línea de "Qué mirar hoy") */
.reco { border-radius: 12px; padding: 13px 15px; margin-bottom: 12px; }
.reco .reco-k { font-size: 11px; font-weight: 700; text-transform: uppercase; letter-spacing: .05em; margin-bottom: 3px; opacity: .9; }
.reco-warn { background: var(--warn-tint); color: #7a4d00; }
.reco-info { background: var(--info-tint); color: #1b4a7a; }
.reco-pos  { background: var(--pos-tint); color: var(--pos); }
.reco-neg  { background: var(--neg-tint); color: var(--neg); }

/* Ranking limpio con barras suaves */
.rank.clean .rank-row { padding: 9px 0; }
.rank.clean .rank-n { background: var(--line-soft); color: var(--muted); }
.rank.clean .bar-line { height: 5px; background: var(--line-soft); }
.rank.clean .bar-line span { background: var(--brand); opacity: .55; }

@media (max-width: 900px){
  .metric-row.four { grid-template-columns: 1fr 1fr; }
  .dash-2col { grid-template-columns: 1fr; }
}

/* ============================================================
   INICIO VENDEDOR v11 — operativo y compacto
   ============================================================ */
.tile-row.six { grid-template-columns: repeat(6, 1fr); gap: 10px; }
.tile-row.six .tile { padding: 11px 13px; }
.tile-row.six .tile .t-val { font-size: 18px; margin-top: 3px; }
.tile-row.six .tile .t-label { font-size: 10.5px; }

.turno-state { display: flex; align-items: flex-start; gap: 12px; padding: 13px 16px; border-radius: 12px; font-size: 13px; }
.turno-state b { display: block; margin-bottom: 1px; }
.turno-state.on { background: var(--pos-tint); color: var(--pos); }
.turno-state.off { background: var(--warn-tint); color: #7a4d00; }
.turno-state .ts-ico { width: 26px; height: 26px; border-radius: 50%; display: flex; align-items: center; justify-content: center; font-size: 13px; flex: none; color: #fff; }
.turno-state.on .ts-ico { background: var(--pos); }
.turno-state.off .ts-ico { background: var(--warn); }

@media (max-width: 900px){
  .tile-row.six { grid-template-columns: repeat(3, 1fr); }
}
@media (max-width: 560px){
  .tile-row.six { grid-template-columns: 1fr 1fr; }
}

/* ============================================================
   CAJA v12 — resumen en bloques + movimientos tabla
   ============================================================ */
.cs-title { font-size: 11px; font-weight: 700; text-transform: uppercase; letter-spacing: .05em; color: var(--muted-2); margin: 4px 2px 10px; }
.caja-summary { display: flex; flex-wrap: wrap; align-items: stretch; gap: 8px; margin-bottom: 18px; }
.caja-summary .cs-block { flex: 1; min-width: 130px; background: var(--card); border: 1px solid var(--line-soft); border-radius: 12px; padding: 12px 14px; }
.caja-summary .cs-block span { display: block; font-size: 11px; color: var(--muted-2); font-weight: 600; text-transform: uppercase; letter-spacing: .02em; }
.caja-summary .cs-block b { font-family: var(--display); font-size: 19px; margin-top: 4px; display: block; font-variant-numeric: tabular-nums; }
.caja-summary .cs-block b.neg { color: var(--neg); }
.caja-summary .cs-block.strong { background: var(--brand-tint); border-color: transparent; }
.caja-summary .cs-block.strong b { color: var(--brand-dk); }
.caja-summary .cs-op { display: flex; align-items: center; justify-content: center; font-size: 18px; color: var(--muted-2); font-weight: 700; padding: 0 2px; }

@media (max-width: 900px){
  .caja-summary { display: grid; grid-template-columns: 1fr 1fr; }
  .caja-summary .cs-op { display: none; }
}

/* ============================================================
   CAJA v12 — pulido visual
   ============================================================ */
.ch-main { box-shadow: 0 8px 24px rgba(14,124,102,.22); padding: 26px 28px; display: flex; flex-direction: column; justify-content: center; }
.ch-label { font-size: 12px; opacity: .9; }
.ch-val { font-size: 48px; letter-spacing: -1.5px; margin-top: 6px; }
.ch-actions { box-shadow: 0 1px 3px rgba(17,22,29,.05); }
.ch-actions .btn { padding: 13px; font-size: 15px; }

/* Resumen: bloques más limpios y "esperado" más destacado */
.caja-summary .cs-block { box-shadow: 0 1px 2px rgba(17,22,29,.04); }
.caja-summary .cs-block span { font-size: 10.5px; }
.caja-summary .cs-block.strong { box-shadow: inset 0 0 0 1px var(--brand); }
.caja-summary .cs-block.strong b { font-size: 22px; }
.caja-summary .cs-op { color: var(--line); font-size: 16px; }

/* Movimientos: tabla más liviana y compacta */
.panel .panel-head + .panel-body .tbl.tight th { background: transparent; }
.tbl.tight td, .tbl.tight th { padding: 8px 16px; }

/* ============================================================
   VENTA LIBRE — botón junto al buscador
   ============================================================ */
.sale-search-row { display: flex; gap: 10px; align-items: flex-start; }
.sale-search-row .sale-search-box { flex: 1; position: relative; }
.vl-btn { flex: none; white-space: nowrap; height: 46px; align-self: stretch; }
@media (max-width: 560px){
  .sale-search-row { flex-direction: column; }
  .vl-btn { width: 100%; height: auto; min-height: var(--target-touch); }
}

/* ============================================================
   DESCUENTO GENERAL — selector compacto %/$
   ============================================================ */
.disc-field .disc-row { display: flex; gap: 8px; align-items: center; }
.disc-seg { display: inline-flex; border: 1px solid var(--line); border-radius: 9px; overflow: hidden; flex: none; }
.disc-seg .ds-opt { padding: 9px 14px; font-weight: 700; font-size: 14px; background: var(--card); color: var(--muted); cursor: pointer; border: none; }
.disc-seg .ds-opt + .ds-opt { border-left: 1px solid var(--line); }
.disc-seg .ds-opt.on { background: var(--brand); color: #fff; }
.disc-field .disc-val { flex: 1; min-width: 0; }
.disc-field .disc-note { margin-top: 6px; min-height: 16px; color: var(--brand-dk); font-weight: 600; }

/* Autorizaciones de descuento */
.discount-auth { display:flex; align-items:center; gap:10px; margin:10px 0 12px; padding:11px 12px; border:1px solid var(--line); border-left-width:4px; border-radius:12px; background:var(--card); }
.discount-auth.required, .discount-auth.pending { border-left-color:var(--warn); background:var(--warn-tint); }
.discount-auth.approved { border-left-color:var(--pos); background:var(--pos-tint); }
.discount-auth.rejected { border-left-color:var(--neg); background:var(--neg-tint); }
.discount-auth-mark { width:28px; height:28px; display:grid; place-items:center; flex:none; border-radius:9px; background:rgba(255,255,255,.78); font-weight:800; }
.discount-auth-copy { display:flex; flex-direction:column; gap:2px; min-width:0; flex:1; font-size:12.5px; }
.discount-auth-copy b { font-size:13px; }
.discount-auth-copy span { color:var(--muted); line-height:1.35; }
.discount-request-summary { display:grid; gap:8px; padding:12px 14px; margin-bottom:14px; border:1px solid var(--line); border-radius:12px; background:var(--line-soft); }
.discount-request-summary > div { display:flex; justify-content:space-between; gap:12px; }
.discount-request-summary .total { padding-top:8px; border-top:1px solid var(--line); font-size:16px; }
.authorization-toolbar { display:flex; align-items:center; justify-content:space-between; gap:16px; margin-bottom:16px; }
.discount-review-grid { display:grid; grid-template-columns:repeat(2,minmax(0,1fr)); gap:14px; }
.discount-review-card { padding:16px; border:1px solid var(--line); border-top:4px solid var(--line); border-radius:14px; background:var(--card); box-shadow:var(--shadow-sm); }
.discount-review-card.pending { border-top-color:var(--warn); }
.discount-review-card.approved, .discount-review-card.used { border-top-color:var(--pos); }
.discount-review-card.rejected { border-top-color:var(--neg); }
.discount-review-head { display:flex; justify-content:space-between; gap:12px; align-items:flex-start; }
.discount-review-person { font-weight:700; }
.discount-review-reason { margin:13px 0; padding:10px 12px; border-radius:10px; background:var(--line-soft); color:var(--ink); line-height:1.4; }
.discount-review-items { display:grid; gap:5px; padding-bottom:12px; border-bottom:1px solid var(--line); }
.discount-review-item { display:flex; justify-content:space-between; gap:12px; font-size:12.5px; }
.discount-review-numbers { display:grid; grid-template-columns:repeat(2,minmax(0,1fr)); gap:10px; margin-top:12px; }
.discount-review-numbers > div { display:flex; flex-direction:column; gap:2px; }
.discount-review-numbers span { color:var(--muted); font-size:11.5px; }
.discount-review-numbers b { font-size:15px; }
.discount-review-numbers .neg { color:var(--neg); }
.discount-review-numbers .pos { color:var(--pos); }
.discount-review-customer { margin-top:12px; }
.discount-review-actions { display:flex; flex-wrap:wrap; justify-content:flex-end; gap:8px; margin-top:15px; padding-top:13px; border-top:1px solid var(--line); }

@media (max-width: 860px){
  .discount-review-grid { grid-template-columns:1fr; }
  .authorization-toolbar { align-items:flex-start; flex-direction:column; }
}

@media (max-width: 560px){
  .discount-auth { align-items:flex-start; flex-wrap:wrap; }
  .discount-auth .btn { margin-left:38px; }
  .discount-review-actions .btn { flex:1 1 100%; }
}

/* ============================================================
   EFECTIVO RECIBIDO — error sutil bajo el campo
   ============================================================ */
.field-error { font-size: 12px; color: var(--neg); margin-top: 5px; line-height: 1.3; }
.input.input-error { border-color: rgba(214,69,69,.45); background: rgba(214,69,69,.03); }
.input.input-error:focus { border-color: var(--neg); }


/* 6.7.22 Pulido visual beta */
:root{
  --valen-soft-shadow: 0 14px 38px rgba(15,23,42,.08);
  --valen-soft-border: 1px solid rgba(15,23,42,.08);
}

.panel,
.modal,
.receipt,
.login-card,
.table-wrap,
.venta-actual,
.cobro{
  box-shadow: var(--valen-soft-shadow);
}

.panel,
.receipt,
.login-card,
.table-wrap{
  border: var(--valen-soft-border);
}

.btn{
  transition: transform .12s ease, box-shadow .12s ease, opacity .12s ease, background .12s ease;
}

.btn:hover{
  transform: translateY(-1px);
}

.btn:disabled,
.btn[disabled]{
  transform: none !important;
  opacity: .55 !important;
  cursor: not-allowed !important;
}

.input,
select.input,
textarea.input{
  transition: border-color .12s ease, box-shadow .12s ease, background .12s ease;
}

.input:focus,
select.input:focus,
textarea.input:focus{
  box-shadow: 0 0 0 4px rgba(0,128,96,.10);
}

.tag{
  letter-spacing: .01em;
}

.tbl th{
  white-space: nowrap;
}

.tbl td{
  vertical-align: middle;
}

.modal{
  border-radius: 22px;
}

.modal-head{
  border-bottom: 1px solid rgba(15,23,42,.06);
}

.modal-foot{
  border-top: 1px solid rgba(15,23,42,.06);
}

.receipt{
  background: linear-gradient(180deg,#fff,#fbfcfc);
}

.sale-help,
.help{
  line-height: 1.35;
}

.alert{
  border-radius: 16px;
}

.kpi-grid .panel,
.kpi-card{
  min-height: 108px;
}

@media (max-width: 900px){
  .sale-grid{
    grid-template-columns: 1fr !important;
  }

  .cobro{
    position: static !important;
  }
}

/* 6.7.22-B Fix login: quitar caja artificial */
.login-card{
  box-shadow: none !important;
  border: none !important;
  background: transparent !important;
  border-radius: 0 !important;
}

.login-card:hover{
  transform: none !important;
}


/* 6.7.23-E9 Configuración real limpia */
#valenRealConfigBox{
  padding: 24px !important;
  border-radius: 20px !important;
  background: #fff !important;
  border: 1px solid rgba(15,23,42,.06) !important;
  box-shadow: 0 18px 42px rgba(15,23,42,.06) !important;
  margin-top: 20px !important;
  margin-bottom: 18px !important;
}

#valenRealConfigBox h3{
  margin: 0 0 6px !important;
  line-height: 1.15 !important;
}

#valenRealConfigBox .help{
  color: #64748b !important;
}

#valenRealConfigBox .form-grid{
  margin-top: 18px !important;
  gap: 18px !important;
}

#valenRealConfigBox label{
  display: block !important;
  margin-bottom: 7px !important;
}

#valenRealConfigBox .check-row{
  display: flex !important;
  align-items: center !important;
  gap: 8px !important;
  margin-top: 30px !important;
}

#valenRealConfigBox .btn{
  min-height: 46px !important;
}

details.panel{
  padding: 12px 16px !important;
  border-radius: 16px !important;
  background: rgba(255,255,255,.72) !important;
  box-shadow: none !important;
}

/* Los previews de ramas usan Valen Staging y lo muestran de forma visible.
   C v2.2 — Fase 2: dentro de #app esto ya lo resuelve .staging-chip en el
   Topbar (siempre visible, integrado). Este badge flotante se restringe a
   la pantalla de login (antes de que exista topbar) para no duplicar el
   indicador ni dejarlo compitiendo con el nuevo Topbar. #login recibe la
   clase .hidden al autenticar (app.js, doLogin) — selector sin tocar JS. */
html[data-valen-environment="staging"] #login:not(.hidden)::after{
  content: "ENTORNO DE PRUEBAS";
  position: fixed;
  top: 12px;
  left: 50%;
  z-index: 10000;
  transform: translateX(-50%);
  padding: 7px 12px;
  border: 1px solid rgba(180,83,9,.28);
  border-radius: 999px;
  background: rgba(255,247,237,.96);
  color: #9a3412;
  box-shadow: 0 8px 22px rgba(124,45,18,.12);
  font-size: 11px;
  font-weight: 800;
  letter-spacing: .08em;
  pointer-events: none;
}

/* Productos importados desde factura */
.cip-bulk{display:flex;justify-content:flex-end;margin-bottom:10px}
.cip-bulk label{min-width:260px}
.cip-bulk label>span,.cip-row label>span{display:block;margin-bottom:5px;font-size:11px;font-weight:700;color:var(--muted)}
.cip-list{display:grid;gap:8px}
.cip-row{display:grid;grid-template-columns:minmax(280px,1fr) minmax(150px,190px) minmax(190px,230px);gap:10px;align-items:end;padding:12px;border:1px solid var(--line);border-radius:12px;background:var(--panel)}
.cip-product{align-self:center;min-width:0}
.cip-product b{display:block;font-size:13px;line-height:1.3}
.cip-product small{display:block;margin-top:4px;color:var(--muted);font-size:11px}
@media(max-width:900px){
  .cip-row{grid-template-columns:1fr 1fr}
  .cip-product{grid-column:1/-1}
  .cip-bulk{justify-content:stretch}
  .cip-bulk label{width:100%;min-width:0}
}
@media(max-width:600px){
  .cip-row{grid-template-columns:1fr}
  .cip-product{grid-column:auto}
}

/* ============================================================
   REGISTRAR VENTA — C v2.2 (Fase 3)
   Implementa el mockup aprobado (Registrar.dc.html / RegistrarPoblado.dc.html).
   Se agrega AL FINAL del archivo a propósito: Registrar ya tiene 3 capas
   previas (base, "v5", "v6") que redeclaran los mismos selectores — esta
   es la única forma de ganar la cascada sin reescribir esas 3 capas.
   Solo selectores scoped a Registrar (.reg-*, .venta-actual, .cobro*,
   .cart-item, .pay-*, .disc-*, .vl-btn, .rs-row, .qty, #cobrarBtn,
   #cashInput) — no se toca .btn/.panel/.input/.tabs/.tbl globales ni
   Dashboard/Reportes. Instrument Sans scoped a .reg-view; peso máximo
   real 700 (no 800/900 — decisión ya cerrada: tamaño/espaciado
   compensan la jerarquía en vez del peso). */

.reg-view {
  background: var(--sage);
  margin: -26px -28px -56px;
  padding: 26px 28px 56px;
  min-height: calc(100vh - 60px);
  font-family: 'Instrument Sans', var(--sans);
}
/* OJO: la regla de arriba es unscoped y, al ir al final del archivo, pisaba
   silenciosamente el padding-bottom:104px que la Fase 2 v1 ya ponía a
   ≤980px para no tapar contenido bajo el .cobro-foot fijo — exactamente el
   tipo de error de cascada que este proyecto viene vigilando. Se corrige
   abajo, en su propio @media, con un valor medido contra el pie de 3 filas
   (recibido+vuelto), que además quedó más alto que antes por el nuevo
   padding/tipografía del Cobro. */

/* ---- Corrección de fidelidad (ritmo tipográfico + espaciado) ----
   Inspeccionado en vivo contra la Opción C real (designs.magicpath.ai/v1/
   noble-forest-8057, pantalla "Registrar venta") vía DOM/computed styles,
   no a ojo. Hallazgo central: C usa letter-spacing NORMAL (0) en casi todo
   — el único tracking amplio es el eyebrow uppercase (.16em). Mi versión
   anterior tenía letter-spacing NEGATIVO en el H1, que es exactamente lo
   contrario — eso es lo que se sentía "apretado". Line-height generoso
   (~1.4 en texto, ~1.1 en H1) y padding vertical real de fila ~16px
   (py-4 en Tailwind) en vez de los 6-9px que tenía. No adopté el fondo
   oscuro que la referencia usa en su buscador ni el peso 400 "plano" que
   usa en TODOS sus textos — eso es paleta/jerarquía ya aprobada, fuera
   de esta pasada. */

/* Eyebrow "Punto de venta" retirado (revisión humana, todos los
   breakpoints): junto al título del Topbar y el H1 "Registrar venta"
   formaba un tercer nivel redundante. Sin reemplazo de texto — el H1
   simplemente sube al espacio liberado, sin hueco vacío. */
.reg-head { position: relative; margin-bottom: 28px; }
.reg-head h3 {
  font-family: 'Instrument Sans', var(--sans);
  font-size: 40px;
  font-weight: 700;
  letter-spacing: normal;
  line-height: 1.1;
  color: var(--forest);
}

/* Buscador: una sola tarjeta clara (icono + input + Venta libre) */
.sale-search-row {
  background: var(--card);
  border: 1.5px solid rgba(19,32,24,.14);
  border-radius: 20px;
  box-shadow: var(--shadow-card);
  padding: 18px 22px;
  gap: 18px;
  align-items: center;
}
.sale-search-row::before {
  content: "⌕";
  font-size: 22px;
  color: var(--muted-2);
  flex: none;
}
.sale-search-box { flex: 1; min-width: 0; }
.sale-search-input { border: none; background: transparent; box-shadow: none; padding: 6px 0; font-size: 19px; font-weight: 500; letter-spacing: normal; line-height: 1.3; color: var(--ink); }
.sale-search-input:focus { border: none; box-shadow: none; }
/* C v2.2 — corrección de semántica: lima escaso y potente, no decorativo.
   "Venta libre" NO es la acción principal de la pantalla (Cobrar lo es) —
   pasa a superficie blanca + texto forest, con un borde lima como único
   microacento de identidad, en vez de llenar todo el botón. */
.vl-btn { background: var(--card); color: var(--forest); border: 1.5px solid var(--lime); border-radius: 12px; font-weight: 600; letter-spacing: normal; }
.vl-btn:hover { background: var(--sage-soft); border-color: var(--lime-dk); color: var(--forest); }
.sale-help { margin: 14px 0 0; line-height: 1.5; }
.sale-left { gap: 16px; }

/* Venta actual: tarjeta blanca plana, sin borde ni header teñido */
.venta-actual { border: none; border-radius: 20px; box-shadow: 0 1px 2px rgba(16,33,26,.04), 0 8px 20px rgba(16,33,26,.05); }
.venta-actual .panel-head { background: transparent; padding: 28px 30px 20px; border-bottom: none; }
.venta-actual .panel-head h4 { color: var(--forest); font-size: 19px; font-weight: 600; letter-spacing: normal; line-height: 1.4; font-family: 'Instrument Sans', var(--sans); }
.venta-actual .panel-head .tag { background: var(--sage-soft); color: var(--ink); font-weight: 500; }
.venta-actual .panel-body { padding: 0 30px 30px; }

.venta-actual .cart-item { padding: 18px 0; border-bottom-color: rgba(19,32,24,.09); gap: 16px; }
.venta-actual .cart-product-thumb { width: 42px; height: 42px; flex-basis: 42px; border: none; border-radius: 11px; background: var(--sage-soft); }
.venta-actual .product-thumb-empty { color: var(--muted-2); }
.venta-actual .ci-name { font-size: 14.5px; font-weight: 600; letter-spacing: normal; line-height: 1.4; }
.venta-actual .ci-name small { font-size: 12px; margin-top: 4px; font-weight: 400; line-height: 1.4; }
.venta-actual .ci-sub { font-size: 14.5px; font-weight: 600; width: 76px; }
.venta-actual .ci-del { width: 26px; height: 26px; border-radius: 999px; border: 1.5px solid rgba(19,32,24,.14); background: #fff; color: var(--muted-2); position: relative; flex-shrink: 0; }
.venta-actual .ci-del:hover { background: var(--neg-tint); border-color: var(--neg-tint); color: var(--neg); }
/* C v2.2 (auditoría global): área táctil real medida en vivo era 26x26px
   en desktop (bajo el mínimo de 42px) y, confirmado aparte, un bug
   preexistente a 390px: .ci-del no tenía flex-shrink:0, así que .cart-item
   (fila flex) lo comprimía por debajo de su propio width:26px cuando el
   espacio era justo — se medía hasta 19px real de ancho. flex-shrink:0
   lo fija en su tamaño de diseño (sin agrandarlo) en los 4 breakpoints;
   confirmado que no cambia la altura de fila en ningún estado (comparado
   con/sin el cambio vía getBoundingClientRect, 1 producto/4 productos/
   cantidad 2 dígitos x 1440/1024/820/390 — idéntico en los 12 casos).
   Con el ancho ya estable, se amplía solo la zona clickeable mediante un
   ::after invisible y absolutamente posicionado (inset:-8px ⇒ 42x42
   real), que no afecta el layout (position:absolute se saca del flujo)
   ni el tamaño visible del botón. Verificado que el hueco hacia el
   siguiente elemento de la fila (gap:16px) y el padding vertical de la
   fila dejan margen de sobra para los 8px de expansión sin solapar la
   miniatura del producto ni la fila contigua. */
.venta-actual .ci-del::after { content: ''; position: absolute; inset: -8px; }
.venta-actual .qty { background: var(--sage-soft); border-radius: 10px; padding: 4px; gap: 8px; }
.venta-actual .qty button { width: 26px; height: 26px; border-radius: 7px; background: #fff; color: var(--ink); position: relative; }
.venta-actual .qty button:hover { opacity: .75; }
/* Mismo fix que .ci-del, para "−"/"+" (26x26 real → 42x42 clickeable),
   SIN tocar el gap:8px original de .qty (una primera versión de este
   fix lo subía a 16px para dejar espacio simétrico, pero eso ensancha
   el pill de cantidad lo suficiente para que, a 1024px, la fila del
   carrito se envuelva a una línea más — 139px -> 176px, confirmado
   comparando con/sin el cambio vía getBoundingClientRect. Revertido).
   En su lugar, la expansión es ASIMÉTRICA: hacia el input de cantidad
   (lado interno) solo 4px — deja 4px reales de margen dentro del
   gap:8px existente, cero solapamiento con el input ni con el otro
   botón — y hacia afuera 12px, que sí tiene de sobra (16px de gap de
   fila + padding), para sumar entre ambos lados los 42px de ancho
   requeridos sin mover ni un píxel el layout existente. Vertical sigue
   simétrica (8px arriba/abajo), con holgura de sobra en los 4 breakpoints. */
.venta-actual .qty button:first-child::after { content: ''; position: absolute; top: -8px; bottom: -8px; left: -12px; right: -4px; }
.venta-actual .qty button:last-child::after { content: ''; position: absolute; top: -8px; bottom: -8px; left: -4px; right: -12px; }
.venta-actual .qty input { width: 18px; border: none; background: transparent; font-weight: 600; font-size: 13.5px; padding: 0; }

/* Cobro: borde definido + sombra, sin teñido de marca */
.cobro { border: 1.5px solid rgba(19,32,24,.12); border-radius: 20px; box-shadow: var(--shadow-card); }
.cobro .panel-head { background: transparent; border-bottom: none; padding: 28px 26px 18px; }
.cobro .panel-head h4 { font-size: 18px; font-weight: 600; letter-spacing: normal; line-height: 1.4; color: var(--forest); font-family: 'Instrument Sans', var(--sans); }
.cobro-body { padding: 0 26px; }
.cobro-body .stat-line { padding: 14px 0; line-height: 1.4; }
.cobro-foot { background: transparent; border-top: none; padding: 24px 26px 28px; }

.cobro-body .field { margin: 14px 0 6px; }
.cobro-body .field label { font-weight: 500; line-height: 1.4; }
.cobro-body .pay-opt { border: none; background: var(--sage-soft); border-radius: 11px; color: var(--ink); font-weight: 600; }
.cobro-body .pay-opt:hover { opacity: .85; }
.cobro-body .pay-opt.active { background: var(--forest); color: #fff; font-weight: 600; }
.cobro-body .disc-seg { border: none; background: var(--sage-soft); border-radius: 9px; padding: 3px; }
.cobro-body .disc-seg .ds-opt { background: transparent; border-radius: 6px; color: var(--muted); }
.cobro-body .disc-seg .ds-opt + .ds-opt { border-left: none; }
.cobro-body .disc-seg .ds-opt.on { background: #fff; color: var(--ink); box-shadow: 0 1px 2px rgba(16,33,26,.08); }
.cobro-body .disc-val { background: var(--sage-soft); border: none; border-radius: 9px; font-weight: 500; color: var(--ink); }
.cobro-body #cashInput { background: var(--sage-soft); border: none; border-radius: 9px; font-weight: 500; color: var(--ink); }
.cobro-body details.opt { border-bottom: 1px solid rgba(19,32,24,.09); padding: 16px 0; }
.cobro-body details.opt summary { font-weight: 500; color: var(--ink); line-height: 1.4; }
.cobro-body details.opt summary::before { content: none; }
.cobro-body details.opt summary::after {
  content: "+";
  width: 22px; height: 22px; border-radius: 999px; background: var(--sage-soft);
  display: inline-flex; align-items: center; justify-content: center;
  color: var(--muted); font-weight: 700; font-size: 14px; flex: none;
}
.cobro-body details.opt[open] summary::after { content: "−"; }

.reg-summary { margin-bottom: 0; }
.rs-row { padding: 6px 0; }
.rs-row span { color: var(--muted-2); font-weight: 500; letter-spacing: .04em; }
.rs-row b { font-family: 'Instrument Sans', var(--sans); color: var(--forest); }
.rs-row.rs-total { padding-top: 14px; }
.rs-row.rs-total b { font-weight: 700; font-size: 44px; line-height: 1.1; }
.cobro-body .disc-note { color: var(--lime-dk); font-weight: 500; line-height: 1.4; }

/* Cobrar: lima solo cuando es una acción realmente disponible; bloqueado
   usa superficie neutra + candado (nunca lima en estado deshabilitado) */
#cobrarBtn:not(:disabled) { background: var(--lime); color: #1C2A14; font-weight: 600; letter-spacing: normal; }
#cobrarBtn:not(:disabled):hover { background: var(--lime-dk); color: #fff; }
#cobrarBtn { margin-top: 18px; }
.cobrar-locked::before {
  content: "";
  display: inline-block; width: 15px; height: 15px; margin-right: 2px; flex: none;
  background-color: var(--muted-2);
  -webkit-mask: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='black' stroke-width='2.3' stroke-linecap='round' stroke-linejoin='round'%3E%3Crect x='4' y='11' width='16' height='10' rx='2'/%3E%3Cpath d='M8 11V7a4 4 0 0 1 8 0v4'/%3E%3C/svg%3E") center / contain no-repeat;
  mask: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='black' stroke-width='2.3' stroke-linecap='round' stroke-linejoin='round'%3E%3Crect x='4' y='11' width='16' height='10' rx='2'/%3E%3Cpath d='M8 11V7a4 4 0 0 1 8 0v4'/%3E%3C/svg%3E") center / contain no-repeat;
}

@media (max-width: 980px) {
  .cobro-foot { border-top-color: rgba(19,32,24,.09); }
  /* El pie fijo mide hasta ~246px con las 3 filas de resumen (recibido+vuelto)
     — medido en vivo contra el nuevo padding/tipografía del Cobro. 280px de
     colchón para que nada quede permanentemente tapado al llegar al final. */
  .reg-view { padding-bottom: 280px; }
  /* H1 conserva protagonismo pero no domina el viewport mobile: se reduce
     escala, el peso se mantiene en 700 (ya es el máximo aprobado). Tracking
     normal, igual que en desktop (ver corrección de fidelidad arriba). */
  .reg-head h3 { font-size: 30px; letter-spacing: normal; }
}

/* C v2.2 (fix de solapamiento preexistente, hallado en la auditoría de
   touch targets, NO causado por ese fix — confirmado comparando con/sin
   los cambios de .ci-del/.qty button: ya ocurría en main sin tocar nada).
   Causa raíz medida en vivo con getBoundingClientRect/getComputedStyle a
   390px: .cart-item es flex en una fila (sin wrap); la suma de sus
   hijos de ancho fijo — thumb 42px + ci-del 26px + .qty 94px + ci-sub
   ~48-76px + 4 gaps de 16px (64px) — ya ocupa los 274px disponibles del
   .panel-body en ese ancho, dejando CERO espacio para .ci-name
   (flex:1;min-width:0). Su ancho computado daba literalmente 0px, así
   que el texto del nombre se desbordaba visualmente ENCIMA de .qty/
   .ci-sub en vez de ajustarse — con nombres largos (3+ líneas) el
   solapamiento era muy visible, pero el mismo problema de fondo (ancho
   0) ya existía con nombres cortos de una sola línea.
   Fix: SOLO ≤480px (rango de teléfono angosto; 760/820/1024/1440 no se
   tocan, siguen con el flex original sin cambios) se pasa .cart-item a
   grid de 2 filas: fila 1 = nombre a todo el ancho disponible (después
   del ícono eliminar + miniatura, que ahora ocupan ambas filas), fila 2
   = cantidad (izquierda) y precio (derecha). El nombre nunca vuelve a
   medir 0px porque ya no compite por espacio con .qty/.ci-sub en la
   misma línea — quedan en su propia fila, sin superponerse nunca,
   sea el nombre corto o largo. No se tocó ningún breakpoint existente
   (980/760/981+ más arriba) ni ninguna lógica de carrito/cantidad —
   solo la disposición visual de estos 5 elementos en pantallas angostas. */
@media (max-width: 480px) {
  .venta-actual .cart-item {
    display: grid;
    grid-template-columns: auto auto 1fr auto;
    grid-template-rows: auto auto;
    column-gap: 12px;
    row-gap: 6px;
    align-items: center;
  }
  .venta-actual .cart-item .ci-del { grid-column: 1; grid-row: 1 / 3; align-self: center; }
  .venta-actual .cart-item .cart-product-thumb { grid-column: 2; grid-row: 1 / 3; align-self: center; }
  .venta-actual .cart-item .ci-name { grid-column: 3 / 5; grid-row: 1; flex: none; min-width: 0; }
  .venta-actual .cart-item .qty { grid-column: 3; grid-row: 2; justify-self: start; }
  .venta-actual .cart-item .ci-sub { grid-column: 4; grid-row: 2; justify-self: end; width: auto; }
}

/* Estabilización C v2.2 (fix 4): .reg-view usa margin negativo para
   sangrar a todo el ancho de .content y cancelar exactamente el padding
   horizontal de .content (28px en desktop, regla base arriba). A
   ≤760px .content baja a 16px (ver @media 760px, más arriba en el
   archivo) pero el margin de .reg-view seguía fijo en -28px — el
   desfase de 12px por lado (24px total) era el overflow medido (414px
   sobre 390px de viewport). Este bloque va DESPUÉS de la regla base de
   .reg-view (más arriba en este mismo archivo) a propósito: en CSS, un
   media query no gana por estar "más calificado", gana por posición en
   la cascada — si este ajuste quedara antes de la regla base, esta
   última lo pisaría igual que pisaba el fix original. Mismo breakpoint
   que .content (760px) para que el cancelado sea exacto en todo el
   rango donde aplica. Vertical/padding propio de .reg-view no se tocan
   — no son la causa del overflow horizontal. */
@media (max-width: 760px) {
  .reg-view { margin-left: -16px; margin-right: -16px; }
}

/* ============================================================
   REGISTRAR VENTA — Workspace real (desktop ≥981px)
   RE-ARQUITECTURA (reemplaza el enfoque anterior de "altura aproximada +
   parches por ancho/alto"). Esa versión calculaba la altura de .reg-view
   con un número mágico (calc(100dvh - 60px - 16px): 60px de topbar más un
   "-16px" de "margen de seguridad" ajustado a ojo) que NUNCA restaba el
   padding real de .content (26-28px arriba, hasta 56px abajo según el
   tier), y dejaba el CTA de Cobrar sin ningún margen real de maniobra:
   .cobro-body era flex:none;overflow:visible, así que si el contenido no
   cabía, no había adónde más ir — la única "solución" era ir agregando
   tiers de compactación por ancho (981-1120px, 981-1174px) y por alto
   (820/650/600px) cada vez que aparecía un caso real nuevo (1038x699,
   luego el estado con el botón deshabilitado en 2 líneas...). Cada tier
   nuevo arreglaba el caso puntual pero el problema de fondo (el CTA podía
   quedarse sin espacio y no tenía dónde ceder) seguía ahí, listo para
   reaparecer con el próximo ancho/alto/estado no probado explícitamente
   — exactamente lo que pasó.
   Causa estructural real: nada en la cadena .app → .main → .content →
   .reg-view fijaba una altura real y exacta igual a "viewport menos
   topbar"; .reg-view intentaba adivinarla con un calc() en vez de
   heredarla. Y .cobro-body, al no poder encogerse ni scrollear, no tenía
   forma de ceder espacio al CTA cuando el contenido no cabía.
   Fix estructural (sin parches por ancho/alto):
   1. .main (flex-column: topbar flex:none 60px + .content) pasa a
      height:100dvh exacta — ahí es donde vive el "menos 60px de topbar",
      resuelto por el propio flexbox (topbar se lleva sus 60px, el resto
      es exactamente lo que le queda a .content), no por una resta manual.
   2. .content pasa a flex:1;min-height:0;padding:0 — dueño real del alto
      disponible restante, sin padding propio que una resta externa tuviera
      que conocer.
   3. .reg-view ya no calcula su propia altura: flex:1;min-height:0; ocupa
      exactamente el 100% de lo que .content realmente tiene, con su
      padding propio (8px/28px) DENTRO de esa altura (box-sizing:border-box
      global), no restado aparte.
   4. .cobro sigue flex-column, pero .cobro-body pasa a ser el único punto
      de cesión: flex:1 1 auto;min-height:0;overflow-y:auto. .cobro-foot
      (Total/Recibido/Vuelto/Cobrar) es flex:none — con el padre en altura
      exacta y .cobro-body como única pieza elástica, .cobro-foot SIEMPRE
      recibe su alto natural completo; si no alcanza el espacio, es
      .cobro-body el que se comprime y scrollea (scroll real con su propia
      barra, no overflow:hidden tapando el problema) — nunca el CTA.
   Todos los selectores (.main/.content) scoped con :has(.reg-view) a
   propósito: esas clases son compartidas por toda la app (Dashboard,
   Reportes, etc.) — :has(.reg-view) asegura que el cambio de altura/flex
   de .main y .content solo aplica cuando Registrar venta está realmente
   montado ahí, cero impacto en el resto de los módulos.
   Scoped a ≥981px: el sistema mobile (≤980px, cobro-foot fijo con
   position:fixed) ya está aprobado y no se toca (ver bloque "Celular" más
   arriba). */
@media (min-width: 981px) {
  .main:has(.reg-view) { height: 100dvh; }
  .content:has(.reg-view) { display: flex; flex-direction: column; flex: 1; min-height: 0; padding: 0; overflow: hidden; }

  .reg-view {
    flex: 1;
    min-height: 0;
    height: auto;
    margin: 0;
    padding: 8px 28px;
    display: flex;
    flex-direction: column;
    overflow: hidden;
  }
  .reg-view > .alert { flex: none; }

  .reg-head { margin-bottom: 6px; flex: none; }
  /* H1 responsive: 27px en desktop amplio (≥1121px, ver tier siguiente
     para 1024). Antes 40px (demasiado dominante) — ahora compacto pero
     conserva identidad C v2.2 (mismo peso 700, mismo tracking). */
  .reg-head h3 { font-size: 27px; }

  .sale-search-row { padding: 12px 18px; }
  .sale-help { margin-top: 6px; flex: none; }

  .sale-grid { flex: 1; min-height: 0; grid-template-rows: minmax(0,1fr); align-items: stretch; }
  .sale-left { min-height: 0; overflow: hidden; }

  .venta-actual { flex: 1; min-height: 0; display: flex; flex-direction: column; }
  .venta-actual .panel-head { flex: none; }
  .venta-actual .panel-body { flex: 1; min-height: 0; max-height: none; overflow-y: auto; }

  .cobro { position: static; height: auto; max-height: none; min-height: 0; display: flex; flex-direction: column; overflow: hidden; container-type: inline-size; }
  .cobro .panel-head { flex: none; padding: 8px 26px 4px; }
  /* Pieza clave del fix: .cobro-body es la ÚNICA zona que cede espacio
     (flex:1 1 auto;min-height:0) y la única con scroll propio
     (overflow-y:auto) — si "Método de pago" + "Efectivo recibido" +
     "Observación" no caben enteros, esta franja se comprime y scrollea
     con su propia barra; #cobrarBtn y el resto de .cobro-foot (flex:none,
     alto natural fijo) nunca se ven afectados ni recortados. */
  .cobro-body { flex: 1 1 auto; min-height: 0; overflow-y: auto; padding: 0 26px; }
  .cobro-foot { flex: none; padding: 8px 26px 8px; }

  /* Reducción de "espacios muertos" del panel Cobro (densidad ya aprobada,
     sin cambios respecto de la versión anterior) — mismo contenido,
     mismos tamaños de fuente/botón/touch target, solo el padding/margen
     vertical "muerto" de cada bloque recortado. */
  .cobro-body .stat-line { padding: 4px 0; }
  .cobro-body .field { margin: 4px 0 2px; }
  .cobro-body .pay-grid { margin-top: 3px; }
  .cobro-body details.opt { padding: 4px 0; }
  .rs-row.rs-total { padding-top: 4px; }
  .rs-row.rs-total b { line-height: 1; }
  .rs-row.vuelto, .rs-row.faltan { margin-top: 2px; padding-top: 4px; }
  #cobrarBtn { margin-top: 8px; }

  /* "TOTAL A PAGAR" (3 palabras) junto a un número a 44px sin punto de
     quiebre: cuando .cobro (el contenedor real) se angosta lo suficiente,
     el label no tiene margen para compartir línea y se parte en 2-3
     líneas verticales desordenadas. En vez de condicionar esto a un ancho
     de VIEWPORT (frágil: el ancho real de .cobro no es el del viewport,
     depende del ratio de .sale-grid, por eso el fix anterior por rango de
     viewport dejaba huecos sin cubrir y había que ir ampliándolo cada vez
     que aparecía un caso real nuevo), se usa una container query sobre el
     propio .cobro: mide directamente el ancho real que importa, sin
     aproximaciones ni números mágicos atados al viewport. 330px es el
     punto donde btnWidth deja de alcanzar para label+número en una línea
     (verificado en vivo con Range.getClientRects() sobre el elemento
     real, no una estimación de anchos). */
  @container (max-width: 330px) {
    .rs-row.rs-total { flex-direction: column; align-items: flex-start; gap: 2px; }
  }
}

/* Documentado (requisito 8/10): a ≥981 y ≤1120px (rango "1024"), el peor
   caso real combinado — Dueño + descuento visible + Efectivo con vuelto —
   necesitaba más aire que el tier general. Adaptación de este rango:
   H1 algo menor (22-24px vs 27px en desktop amplio) — mismo peso 700,
   responsive por tamaño de pantalla, no una reducción fija. (El eyebrow
   que antes se ocultaba aquí ya no existe en ningún breakpoint.)
   Nota: sigue siendo el único tier por ancho de esta sección, y es
   puramente estético (tamaño del título) — no relacionado con el CTA de
   Cobrar, que ya no depende de ningún tier de ancho/alto (ver bloque de
   arriba). */
@media (min-width: 981px) and (max-width: 1120px) {
  .reg-head { margin-bottom: 4px; }
  .reg-head h3 { font-size: 23px; }
}

/* Bug real encontrado al verificar el Preview a 820px (no introducido por
   el fix de arriba, preexistente): entre 761px y 980px el sidebar de
   escritorio sigue visible a 248px fijos (.app{grid-template-columns:248px
   1fr}, colapsa a off-canvas recién a ≤760px — ver @media(max-width:760px)
   más arriba), pero .cobro-foot{position:fixed;left:0} (sistema mobile,
   @media(max-width:980px) más arriba) ignora ese ancho y se extiende sobre
   todo el viewport, tapando el sidebar (incluido "Cerrar sesión"). Fix
   mínimo: el pie fijo arranca después del sidebar en este rango exacto.
   Fuera de 761-980px no cambia nada (≤760px el sidebar es off-canvas y
   left:0 ya es correcto; ≥981px .cobro-foot ni siquiera es fixed). */
@media (min-width: 761px) and (max-width: 980px) {
  .cobro-foot { left: 248px; }
}

/* ============================================================
   REPORTES — C v2.2 (Fase 4)
   Implementa el mockup aprobado (Reportes.dc.html): hero analítico oscuro
   único (Resultado del período + Utilidad + Ticket/Compras/Gastos/Margen
   integrados en una sola superficie), filtros planos no-protagonistas,
   5 tabs reales, destacados en texto plano. Mismo ritmo tipográfico que
   Registrar (tracking normal salvo eyebrow, line-height explícito, pesos
   400-700 reales, lima escaso).

   Scoping sin tocar .panel/.page-head/.tabs/.btn/.input globales:
   - #repSeg / .rep-filters-bar / .rep-tabs-wrap .tabs / #repBody ya son
     ganchos reales y exclusivos de Reportes (confirmado por grep en
     app.js, cero reuso en otras pantallas).
   - El hero y el page-head de Reportes no tienen un wrapper propio (a
     diferencia de .reg-view en Registrar) — en vez de agregar un div
     nuevo en app.js, se usa :has() para distinguirlos sin ambigüedad:
     ".page-head:has(+ #repSeg)" = solo el page-head de Reportes;
     ".panel:has(.rep-headline-row)" = solo el panel que es el hero.
     Soporte de :has() ya universal en browsers modernos (2022+).

   Corrección de semántica aplicada desde el inicio (no repetir el error
   de Registrar): "Utilidad estimada" en el mockup aprobado usa lima para
   la cifra — se corrige aquí a blanco (igual que "Resultado del período"),
   porque es un dato, no una acción disponible. Mismo criterio ya cerrado
   en Registrar (lima = solo CTA). "Mes actual" como link usa --lime-dk,
   no lima lleno (acción secundaria, no la principal). */

.page-head:has(+ #repSeg) { position: relative; margin-bottom: 28px; }
.page-head:has(+ #repSeg) .ph-text::before {
  content: "Analítica";
  display: block;
  font-size: 11.5px;
  font-weight: 500;
  letter-spacing: .16em;
  line-height: 1.3;
  text-transform: uppercase;
  color: var(--muted-2);
  margin-bottom: 8px;
}
.page-head:has(+ #repSeg) h3 {
  font-family: 'Instrument Sans', var(--sans);
  font-size: 40px;
  font-weight: 700;
  letter-spacing: normal;
  line-height: 1.1;
  color: var(--brand-text);
}
.page-head:has(+ #repSeg) p {
  font-size: 14.5px;
  font-weight: 400;
  line-height: 1.5;
  color: var(--muted);
  margin-top: 8px;
}

/* Filtros: seg + barra de fechas, planos, no tarjetas protagonistas */
#repSeg { background: var(--sage-soft); padding: 3px; border-radius: 10px; margin-bottom: 8px; gap: 2px; }
#repSeg button { font-size: 13px; font-weight: 600; letter-spacing: normal; color: var(--muted); padding: 7px 14px; border-radius: 8px; }
#repSeg button.active { background: var(--card); color: var(--ink); box-shadow: 0 1px 2px rgba(16,33,26,.08); }

.rep-filters-bar { background: var(--sage-soft); border-radius: 14px; padding: 14px 18px; margin: 0 0 28px; gap: 20px; }
.rep-filters-bar .field label { font-size: 11.5px; font-weight: 500; letter-spacing: normal; line-height: 1.4; color: var(--muted); }
.rep-filters-bar .input { background: var(--card); border: none; border-radius: 9px; font-weight: 500; color: var(--ink); }
.rep-filters-actions .btn-primary { background: var(--forest); border: none; font-weight: 600; }
.rep-filters-actions .btn-ghost { background: transparent; color: var(--lime-dk); font-weight: 600; }
.rep-filters-note { font-size: 13.5px; font-weight: 500; line-height: 1.4; color: var(--muted); }

/* Tabs: las 5 reales, subrayado forest — nunca pill */
.rep-tabs-wrap { margin-bottom: 28px; }
.rep-tabs-wrap .tabs { gap: 26px; border-bottom-color: rgba(19,32,24,.09); }
.rep-tabs-wrap .tabs button { font-size: 14.5px; font-weight: 600; letter-spacing: normal; line-height: 1.4; padding: 8px 2px; color: var(--muted); min-height: var(--target-touch); }
.rep-tabs-wrap .tabs button.active { color: var(--forest); border-bottom-color: var(--forest); font-weight: 700; }

/* Resumen del período (post-Fase 4, corrección estructural): deja de ser
   un "hero" — es el resumen de las métricas del período REALMENTE aplicado
   (Mes actual por defecto; Hoy/Semana/Mes aplican al toque; fechas
   manuales solo al presionar "Aplicar fechas" — lógica ya existente en
   app.js, ver valenReportSelectedRange()/applyReportRange(), no se tocó).
   Superficie = --sage-panel, el sage REAL medido en "Explorar áreas" de
   la Opción C — ya no el verde oscuro (--forest quedó fuera de las
   superficies protagonistas de contenido). Jerarquía por tamaño/color/
   espacio/divisor, no por fondo oscuro. Sin lima. */
.panel:has(.rep-headline-row) { background: var(--sage-panel); border-left: 3px solid var(--brand-deep); border-radius: 16px; margin-bottom: 28px; }
.panel:has(.rep-headline-row) .panel-body { padding: 14px 26px; }
.panel:has(.rep-headline-row) .panel-body::before {
  content: "Resumen del período";
  display: block;
  font-size: 11px;
  font-weight: 600;
  letter-spacing: .08em;
  text-transform: uppercase;
  line-height: 1.3;
  color: rgba(21,55,45,.56);
  margin-bottom: 10px;
}
.rep-headline-row { gap: 48px; }
.rep-stat-lbl { font-size: 12px; font-weight: 600; letter-spacing: .08em; line-height: 1.3; color: rgba(21,55,45,.56); }
.rep-stat-num {
  font-family: 'Instrument Sans', var(--sans);
  font-size: 30px;
  font-weight: 700;
  letter-spacing: normal;
  line-height: 1;
  color: var(--brand-text);
  margin-top: 6px;
}
/* Corrección de semántica ya cerrada en Fase 4, se conserva: Utilidad es
   un dato, no una acción — nunca lima. */
.rep-stat-num.brand { color: var(--brand-text); }
.rep-stat-sub { font-size: 13px; font-weight: 400; line-height: 1.4; color: rgba(21,55,45,.5); margin-top: 6px; }

.rep-support-row { gap: 0; margin-top: 8px; padding-top: 8px; border-top-color: rgba(21,55,45,.14); }
.rep-support-stat { border-right-color: rgba(21,55,45,.14); padding-right: 36px; margin-right: 36px; }
.rep-support-stat .rep-stat-num { font-size: 15px; font-weight: 600; color: var(--brand-text); margin-top: 3px; }
.rep-support-stat .rep-stat-lbl { color: rgba(21,55,45,.5); font-weight: 500; margin-top: 3px; }

/* Destacados del período: filas de texto plano, sin dot, label/valor */
.rep-highlights { margin-top: 0; }
.rep-highlights-title { font-size: 11.5px; font-weight: 500; letter-spacing: .09em; line-height: 1.3; color: var(--muted-2); margin-bottom: 10px; }
.insights .insight { padding: 12px 0; border-bottom-color: rgba(19,32,24,.09); font-size: 14.5px; }
.insight .i-dot { display: none; }
.insight > div:last-child { display: flex; justify-content: space-between; align-items: baseline; gap: 12px; flex: 1; color: var(--muted); font-weight: 400; }
.insight > div:last-child b { color: var(--forest); font-weight: 600; }

/* Tablas de ranking (Por vendedor/producto/categoría/método): mismo ritmo */
#repBody .rank-row { padding: 13px 0; line-height: 1.4; }
#repBody .rank-row .r-name { font-weight: 500; }
#repBody .rank-row .r-name small { font-weight: 400; margin-top: 2px; }
#repBody .rank-row .r-val { font-weight: 600; }

/* Fila de soporte (Ticket/Compras/Gastos/Margen): a 1440px cabe en una sola
   fila (el divisor border-right por flex funciona bien). Por debajo de 900px
   no cabe y se envuelve a 2x2 — el divisor basado en :last-child del flex
   queda mal (el tercer dato conserva borde, el cuarto no, pero no son
   realmente la misma fila). Se reemplaza por grid 2 columnas con divisor
   por nth-child(odd), correcto para 3 o 4 datos en cualquier viewport chico. */
@media (max-width: 900px) {
  .rep-headline-row { gap: 28px; }
  .rep-support-row { display: grid; grid-template-columns: repeat(2, 1fr); gap: 14px 24px; }
  .rep-support-stat { border-right: none; margin-right: 0; padding-right: 0; }
  .rep-support-stat:nth-child(odd):not(:last-child) { border-right: 1px solid rgba(21,55,45,.14); padding-right: 24px; }
}

@media (max-width: 620px) {
  .page-head:has(+ #repSeg) h3 { font-size: 30px; letter-spacing: normal; }
  .rep-headline-row { gap: 20px; }
  .panel:has(.rep-headline-row) .panel-body { padding: 14px 18px; }
}
