/* ==========================================================================
   Agentev2 — Diseño Oficial VAC Violeta Claro (Modelo E_violeta)
   Paleta base verificada de vac_gifs.py:
     bg:   #F4F0FB   tx:   #3A2A5F   ac:   #7B5CC0
     pr:   #4B2F88   su:   #9A8CB8   bd:   #DCD1F0   fila: #FFFFFF
   Compatible Desktop + iPhone 14 Pro Max (safe-area, 44px touch targets)
   ========================================================================== */
:root {
  --bg: #F4F0FB;
  --surface: #FFFFFF;
  --surface-soft: #ECE4FA;
  --surface-tint: #F8F5FD;
  --ink: #3A2A5F;
  --ink-deep: #261942;
  --muted: #7D6EA0;
  --muted-light: #9A8CB8;
  --violet: #7B5CC0;
  --violet-hover: #6949B0;
  --purple: #4B2F88;
  --border: #DCD1F0;
  --border-strong: #C6B5E8;

  --ok: #157F56;
  --ok-bg: #E7F7F0;
  --bad: #C5304A;
  --bad-bg: #FDECEF;
  --warn: #AE620B;
  --warn-bg: #FEF5E6;

  --radius: 14px;
  --radius-sm: 10px;
  --shadow: 0 6px 22px rgba(75, 47, 136, 0.06);
}

* {
  box-sizing: border-box;
}

html, body {
  margin: 0;
  padding: 0;
  background: var(--bg);
  color: var(--ink);
  font-family: 'Bahnschrift', 'Segoe UI', system-ui, -apple-system, sans-serif;
  font-size: 15px;
  line-height: 1.48;
  -webkit-font-smoothing: antialiased;
}

[hidden] {
  display: none !important;
}

/* Modo Discreto de Privacidad Visual (oculta importes y CUIT ante miradas externas) */
body.privacy-masked .maskable {
  filter: blur(7px);
  user-select: none;
  transition: filter 0.15s ease;
}
body.privacy-masked .maskable:hover {
  filter: none;
}

h1, h2, h3, h4 {
  color: var(--ink-deep);
  margin: 0;
  letter-spacing: -0.02em;
}

h1 { font-size: 28px; font-weight: 700; }
h2 { font-size: 18px; font-weight: 700; margin-bottom: 12px; }
h3 { font-size: 15px; font-weight: 700; margin-bottom: 8px; }

p { margin: 0 0 10px; }

code {
  background: var(--surface-soft);
  color: var(--purple);
  padding: 2px 6px;
  border-radius: 6px;
  font-size: 12.5px;
}

/* ─────────────────── Controles y Botones ─────────────────── */
button, input, select, textarea, a.btn-secondary, a.btn-primary {
  font: inherit;
}

input, select, textarea {
  width: 100%;
  min-height: 44px;
  padding: 9px 12px;
  border: 1.5px solid var(--border);
  border-radius: var(--radius-sm);
  background: var(--surface);
  color: var(--ink-deep);
  transition: border-color 0.15s ease, box-shadow 0.15s ease;
}

textarea {
  min-height: 86px;
  resize: vertical;
}

input:focus, select:focus, textarea:focus {
  outline: none;
  border-color: var(--violet);
  box-shadow: 0 0 0 3px rgba(123, 92, 192, 0.18);
}

input[type="checkbox"] {
  width: 20px;
  min-height: 20px;
  accent-color: var(--violet);
  cursor: pointer;
}

label {
  display: block;
  font-size: 12.5px;
  font-weight: 700;
  color: var(--muted);
  letter-spacing: 0.02em;
}

label > input, label > select, label > textarea {
  margin-top: 5px;
  font-weight: 500;
}

.check-inline {
  display: flex;
  align-items: center;
  gap: 9px;
  font-size: 13.5px;
  color: var(--ink);
  cursor: pointer;
  padding: 6px 0;
}
.check-inline input {
  margin: 0;
}

button, .btn-primary, .btn-secondary {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  min-height: 42px;
  padding: 9px 16px;
  border-radius: var(--radius-sm);
  border: 1.5px solid transparent;
  font-weight: 700;
  font-size: 14px;
  cursor: pointer;
  text-decoration: none;
  transition: transform 0.08s ease, background 0.15s ease;
}

button:active {
  transform: translateY(1px);
}

button:disabled {
  opacity: 0.55;
  cursor: wait;
}

.btn-primary {
  background: var(--violet);
  color: #FFFFFF;
}
.btn-primary:hover {
  background: var(--violet-hover);
}

.btn-secondary {
  background: var(--surface);
  color: var(--purple);
  border-color: var(--border-strong);
}
.btn-secondary:hover {
  background: var(--surface-soft);
}

.btn-secondary.btn-toggle-on {
  background: var(--surface-soft);
  color: var(--purple);
  border-color: var(--violet);
  box-shadow: inset 0 0 0 1px var(--violet);
}

.btn-danger {
  background: var(--bad-bg);
  color: var(--bad);
  border-color: #F5C2CC;
}

.btn-ghost {
  background: transparent;
  color: var(--purple);
  border-color: transparent;
  min-height: 36px;
  padding: 6px 10px;
}
.btn-ghost:hover {
  background: rgba(123, 92, 192, 0.10);
}

.btn-sm {
  min-height: 32px;
  padding: 4px 10px;
  font-size: 12.5px;
}

.full {
  width: 100%;
}

/* ─────────────────── Login ─────────────────── */
.login-wrap {
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 24px;
  background: radial-gradient(circle at top right, #E7DDF9 0%, #F4F0FB 62%);
}

.login-card {
  width: 100%;
  max-width: 440px;
  background: var(--surface);
  border: 1.5px solid var(--border);
  border-radius: 20px;
  padding: 34px 30px;
  box-shadow: 0 16px 42px rgba(58, 42, 95, 0.10);
}

.brand-hero {
  text-align: center;
  margin-bottom: 24px;
}

.brand-pill {
  display: inline-block;
  background: var(--surface-soft);
  color: var(--purple);
  font-size: 11px;
  font-weight: 800;
  letter-spacing: 0.12em;
  padding: 5px 11px;
  border-radius: 999px;
  border: 1px solid var(--border);
}

.brand-hero h1 {
  font-size: 42px;
  letter-spacing: 0.04em;
  color: var(--ink);
  margin-top: 10px;
}
.brand-hero h1 span {
  color: var(--violet);
}
.brand-hero p {
  color: var(--muted);
  font-size: 13.5px;
  margin-top: 6px;
}

#login-form {
  display: flex;
  flex-direction: column;
  gap: 14px;
}

.demo-hint {
  margin-top: 20px;
  padding: 12px 14px;
  background: var(--surface-tint);
  border: 1px dashed var(--border-strong);
  border-radius: 12px;
  font-size: 12.5px;
  color: var(--ink);
}
.demo-hint small {
  display: block;
  margin-top: 4px;
  color: var(--muted);
}

/* ─────────────────── Layout Principal ─────────────────── */
.shell {
  display: flex;
  min-height: 100vh;
}

.sidebar {
  width: 262px;
  flex-shrink: 0;
  background: linear-gradient(180deg, #EBE2FA 0%, #E2D5F7 100%);
  border-right: 1.5px solid var(--border);
  padding: 24px 16px;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  position: sticky;
  top: 0;
  height: 100vh;
  overflow-y: auto;
}

.brand-logo {
  font-size: 30px;
  font-weight: 800;
  letter-spacing: 0.05em;
  color: var(--ink-deep);
  padding: 0 8px;
}
.brand-logo span {
  color: var(--violet);
}

.brand-sub {
  font-size: 10.5px;
  font-weight: 800;
  letter-spacing: 0.14em;
  color: var(--muted);
  padding: 0 8px 14px;
  border-bottom: 1.5px solid var(--border);
}

.local-picker-label {
  margin-top: 14px;
  padding: 0 4px;
  color: var(--purple);
}
.local-select {
  background: #FFFFFF;
  border-color: var(--border-strong);
  font-weight: 700;
  color: var(--purple);
}

.nav-list {
  display: flex;
  flex-direction: column;
  gap: 4px;
  margin: 16px 0;
}

.nav-btn {
  width: 100%;
  justify-content: flex-start;
  min-height: 40px;
  padding: 8px 12px;
  border-radius: 10px;
  background: transparent;
  color: var(--ink);
  font-weight: 600;
  font-size: 13.8px;
  text-align: left;
}
.nav-btn:hover {
  background: rgba(255, 255, 255, 0.55);
}
.nav-btn.active {
  background: var(--violet);
  color: #FFFFFF;
  box-shadow: 0 4px 12px rgba(123, 92, 192, 0.28);
}

.sidebar-footer {
  padding-top: 12px;
  border-top: 1.5px solid var(--border);
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.user-chip {
  font-size: 12.5px;
  color: var(--ink);
  background: rgba(255, 255, 255, 0.65);
  padding: 8px 10px;
  border-radius: 10px;
  border: 1px solid var(--border);
}

.privacy-badges {
  display: flex;
  gap: 6px;
  flex-wrap: wrap;
}
.pbadge {
  font-size: 10.5px;
  font-weight: 800;
  padding: 3px 8px;
  border-radius: 999px;
  background: #FFFFFF;
  color: var(--purple);
  border: 1px solid var(--border);
}
.pbadge.ok {
  background: var(--ok-bg);
  color: var(--ok);
  border-color: #B7E8D4;
}

.workspace {
  flex: 1;
  min-width: 0;
  padding: 26px 32px 60px;
  max-width: 1920px;
}

.topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  flex-wrap: wrap;
  padding-bottom: 16px;
  border-bottom: 2px solid var(--border);
  margin-bottom: 18px;
}

.kicker {
  display: block;
  font-size: 11px;
  font-weight: 800;
  letter-spacing: 0.14em;
  color: var(--violet);
  text-transform: uppercase;
}

.topbar-actions {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
}

/* ─────────────────── Tarjetas, Grillas y KPIs ─────────────────── */
.card {
  background: var(--surface);
  border: 1.5px solid var(--border);
  border-radius: var(--radius);
  padding: 20px 22px;
  margin-bottom: 16px;
  box-shadow: var(--shadow);
}

.card-soft {
  background: var(--surface-tint);
}

.kpi-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(205px, 1fr));
  gap: 13px;
  margin-bottom: 16px;
}

.kpi-card {
  background: var(--surface);
  border: 1.5px solid var(--border);
  border-radius: var(--radius);
  padding: 16px 18px;
  box-shadow: var(--shadow);
  position: relative;
  overflow: hidden;
}
.kpi-card::before {
  content: "";
  position: absolute;
  top: 0; left: 0; right: 0;
  height: 4px;
  background: var(--violet);
}
.kpi-card.highlight::before {
  background: var(--purple);
}
.kpi-card.highlight {
  background: linear-gradient(180deg, #FFFFFF 0%, #F6F2FD 100%);
  border-color: var(--violet);
}

.kpi-label {
  font-size: 11.5px;
  font-weight: 800;
  text-transform: uppercase;
  letter-spacing: 0.07em;
  color: var(--muted);
}

.kpi-val {
  font-size: 26px;
  font-weight: 800;
  color: var(--purple);
  margin-top: 6px;
  font-variant-numeric: tabular-nums;
}

.kpi-sub {
  font-size: 12px;
  color: var(--muted-light);
  margin-top: 4px;
}

.grid-2 {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 16px;
}

.grid-3 {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(210px, 1fr));
  gap: 12px;
}

.grid-4 {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(165px, 1fr));
  gap: 12px;
}

.filters-bar {
  display: flex;
  gap: 12px;
  flex-wrap: wrap;
  align-items: flex-end;
  background: var(--surface);
  border: 1.5px solid var(--border);
  border-radius: var(--radius);
  padding: 14px 18px;
  margin-bottom: 16px;
}
.filters-bar label {
  flex: 1;
  min-width: 145px;
}

/* ─────────────────── Tablas Claras Estilo Lista VAC ─────────────────── */
.table-wrap {
  overflow-x: auto;
  border: 1px solid var(--border);
  border-radius: 12px;
}

table {
  width: 100%;
  border-collapse: collapse;
  font-size: 13.5px;
  font-variant-numeric: tabular-nums;
}

th {
  background: var(--surface-soft);
  color: var(--purple);
  text-align: left;
  font-size: 11.5px;
  font-weight: 800;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  padding: 11px 12px;
  border-bottom: 1.5px solid var(--border);
  white-space: nowrap;
}

td {
  padding: 10px 12px;
  border-bottom: 1px solid #EFEAF9;
  vertical-align: middle;
}

tr:last-child td {
  border-bottom: none;
}

tbody tr:hover td {
  background: var(--surface-tint);
}

.num {
  text-align: right;
  white-space: nowrap;
}

.price-ink {
  color: var(--purple);
  font-weight: 800;
}

td input.compact {
  min-height: 36px;
  padding: 5px 8px;
  min-width: 85px;
}
td input.wide {
  min-width: 195px;
}

/* ─────────────────── Badges, Barras y Avisos ─────────────────── */
.badge {
  display: inline-block;
  padding: 3px 9px;
  border-radius: 999px;
  font-size: 11.5px;
  font-weight: 700;
  background: var(--surface-soft);
  color: var(--purple);
  white-space: nowrap;
}
.badge.ok { background: var(--ok-bg); color: var(--ok); }
.badge.bad { background: var(--bad-bg); color: var(--bad); }
.badge.warn { background: var(--warn-bg); color: var(--warn); }

.good { color: var(--ok); font-weight: 700; }
.bad { color: var(--bad); font-weight: 700; }
.warn-txt { color: var(--warn); font-weight: 700; }
.muted { color: var(--muted); }

.bar-list {
  display: flex;
  flex-direction: column;
  gap: 12px;
}
.bar-head {
  display: flex;
  justify-content: space-between;
  font-size: 13.5px;
  font-weight: 600;
}
.bar-track {
  height: 9px;
  background: var(--surface-soft);
  border-radius: 999px;
  overflow: hidden;
  margin-top: 4px;
}
.bar-fill {
  height: 100%;
  background: linear-gradient(90deg, var(--violet) 0%, var(--purple) 100%);
  border-radius: 999px;
}

.toast {
  padding: 12px 16px;
  border-radius: 12px;
  background: #EDE4FC;
  border: 1.5px solid var(--violet);
  color: var(--purple);
  font-weight: 700;
  margin-bottom: 16px;
}
.toast.error {
  background: var(--bad-bg);
  border-color: var(--bad);
  color: var(--bad);
}

.alert-inline {
  background: var(--bad-bg);
  color: var(--bad);
  padding: 10px 12px;
  border-radius: 9px;
  font-size: 13px;
  font-weight: 700;
}

.help-banner {
  background: var(--surface-tint);
  border-left: 4px solid var(--violet);
  padding: 10px 14px;
  border-radius: 8px;
  font-size: 13px;
  color: var(--ink);
  margin-bottom: 14px;
}

.line-row {
  display: grid;
  grid-template-columns: 2.6fr 0.9fr 1.1fr 0.8fr auto;
  gap: 10px;
  align-items: end;
  margin-bottom: 10px;
  padding: 10px;
  background: var(--surface-tint);
  border: 1px solid var(--border);
  border-radius: 10px;
}

.tabs-row {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
  margin-bottom: 14px;
}

.preview-box {
  border: 1.5px dashed var(--border-strong);
  border-radius: 12px;
  padding: 12px;
  background: var(--surface-tint);
  text-align: center;
}
.preview-box img {
  max-width: 100%;
  max-height: 360px;
  border-radius: 8px;
}

.empty-state {
  text-align: center;
  padding: 28px 16px;
  color: var(--muted);
}

/* ─────────────────── Adaptación iPhone 14 Pro Max y Móvil ─────────────────── */
@media (max-width: 980px) {
  .shell {
    flex-direction: column;
  }
  .sidebar {
    width: 100%;
    height: auto;
    position: static;
    padding: 14px 16px;
    border-right: none;
    border-bottom: 1.5px solid var(--border);
  }
  .nav-list {
    flex-direction: row;
    overflow-x: auto;
    padding-bottom: 4px;
    margin: 10px 0 6px;
  }
  .nav-btn {
    width: auto;
    white-space: nowrap;
    padding: 8px 13px;
  }
  .sidebar-footer {
    flex-direction: row;
    align-items: center;
    justify-content: space-between;
    flex-wrap: wrap;
  }
  .sidebar-footer .full {
    width: auto;
  }
  .workspace {
    padding: 18px 14px calc(40px + env(safe-area-inset-bottom));
  }
  .grid-2 {
    grid-template-columns: 1fr;
  }
  .line-row {
    grid-template-columns: 1fr 1fr;
  }
  .line-row > label:first-child {
    grid-column: 1 / -1;
  }
  .kpi-grid {
    grid-template-columns: 1fr 1fr;
  }
  .kpi-val {
    font-size: 21px;
  }
  input, select, textarea {
    font-size: 16px;
  }
}

/* ==========================================================================
   MODO VISTA ALEJADA / ZOOM (-1) — Todas las pestañas (Web + iPhone + Android)
   Mantiene el modo Normal 100% intacto y ofrece un segundo formato panorámico,
   más alejado, aireado y con más datos visibles de un vistazo sin deformar.
   ========================================================================== */
html.zoom-out,
html.zoom-out body {
  font-size: 12.8px;
  line-height: 1.4;
}

html.zoom-out h1 { font-size: 20px; }
html.zoom-out h2 { font-size: 14.5px; margin-bottom: 8px; }
html.zoom-out h3 { font-size: 13px; margin-bottom: 6px; }
html.zoom-out p { margin: 0 0 7px; }
html.zoom-out code { font-size: 11px; padding: 1px 5px; }

html.zoom-out .sidebar {
  width: 206px;
  padding: 16px 11px;
}
html.zoom-out .brand-logo {
  font-size: 22px;
  padding: 0 6px;
}
html.zoom-out .brand-sub {
  font-size: 9px;
  padding: 0 6px 10px;
}
html.zoom-out .nav-list {
  gap: 2px;
  margin: 10px 0;
}
html.zoom-out .nav-btn {
  min-height: 31px;
  padding: 5px 9px;
  font-size: 12px;
  border-radius: 8px;
}
html.zoom-out .sidebar-footer {
  padding-top: 8px;
  gap: 6px;
}

html.zoom-out .workspace {
  padding: 15px 22px 42px;
  max-width: 100%;
}
html.zoom-out .topbar {
  gap: 10px;
  padding-bottom: 10px;
  margin-bottom: 12px;
}
html.zoom-out .kicker {
  font-size: 9.5px;
}
html.zoom-out .topbar-actions {
  gap: 6px;
}

html.zoom-out .card {
  padding: 12px 15px;
  margin-bottom: 11px;
  border-radius: 11px;
}
html.zoom-out .filters-bar {
  padding: 9px 12px;
  gap: 8px;
  margin-bottom: 11px;
  border-radius: 11px;
}
html.zoom-out .filters-bar label {
  min-width: 115px;
}
html.zoom-out .help-banner {
  padding: 7px 11px;
  font-size: 11.6px;
  margin-bottom: 10px;
}

/* En Resumen y demás pestañas: KPIs más compactos y panorámicos en 1 fila */
html.zoom-out .kpi-grid {
  grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
  gap: 9px;
  margin-bottom: 11px;
}
@media (min-width: 1220px) {
  html.zoom-out .kpi-grid {
    grid-template-columns: repeat(6, minmax(0, 1fr));
  }
}
html.zoom-out .kpi-card {
  padding: 10px 12px;
  border-radius: 11px;
}
html.zoom-out .kpi-card::before {
  height: 3px;
}
html.zoom-out .kpi-label {
  font-size: 9.6px;
  letter-spacing: 0.05em;
}
html.zoom-out .kpi-val {
  font-size: 18px;
  margin-top: 4px;
}
html.zoom-out .kpi-sub {
  font-size: 10.4px;
  margin-top: 2px;
}

html.zoom-out .grid-2 {
  gap: 11px;
}
html.zoom-out .grid-3 {
  grid-template-columns: repeat(auto-fit, minmax(155px, 1fr));
  gap: 8px;
}
html.zoom-out .grid-4 {
  grid-template-columns: repeat(auto-fit, minmax(125px, 1fr));
  gap: 8px;
}

html.zoom-out label {
  font-size: 10.8px;
}
html.zoom-out label > input,
html.zoom-out label > select,
html.zoom-out label > textarea {
  margin-top: 3px;
}
html.zoom-out input,
html.zoom-out select,
html.zoom-out textarea {
  min-height: 31px;
  padding: 5px 8px;
  font-size: 12.2px;
  border-radius: 7px;
}
html.zoom-out textarea {
  min-height: 58px;
}
html.zoom-out input[type="checkbox"] {
  width: 16px;
  min-height: 16px;
}
html.zoom-out .check-inline {
  font-size: 11.8px;
  gap: 7px;
  padding: 3px 0;
}

html.zoom-out button,
html.zoom-out .btn-primary,
html.zoom-out .btn-secondary {
  min-height: 31px;
  padding: 5px 11px;
  font-size: 12px;
  border-radius: 7px;
}
html.zoom-out .btn-sm {
  min-height: 25px;
  padding: 3px 8px;
  font-size: 11px;
}
html.zoom-out .btn-ghost {
  min-height: 27px;
  padding: 4px 8px;
}

html.zoom-out .line-row {
  gap: 7px;
  margin-bottom: 6px;
  padding: 6px 8px;
  border-radius: 8px;
}

html.zoom-out table {
  font-size: 11.6px;
}
html.zoom-out th {
  font-size: 9.8px;
  padding: 7px 8px;
}
html.zoom-out td {
  padding: 5px 8px;
}
html.zoom-out td input.compact {
  min-height: 26px;
  padding: 2px 6px;
  min-width: 64px;
  font-size: 11.5px;
}
html.zoom-out td input.wide {
  min-width: 145px;
}
html.zoom-out .badge {
  font-size: 10px;
  padding: 2px 7px;
}
html.zoom-out .bar-list {
  gap: 8px;
}
html.zoom-out .bar-head {
  font-size: 11.8px;
}
html.zoom-out .bar-track {
  height: 7px;
}

/* Adaptación móvil iOS / Android en modo Zoom (-1) */
@media (max-width: 980px) {
  html.zoom-out .sidebar {
    width: 100%;
    padding: 8px 10px;
  }
  html.zoom-out .brand-logo {
    font-size: 18px;
  }
  html.zoom-out .brand-sub {
    font-size: 8.5px;
    padding-bottom: 6px;
  }
  html.zoom-out .nav-list {
    margin: 6px 0 4px;
    gap: 3px;
  }
  html.zoom-out .nav-btn {
    min-height: 27px;
    padding: 4px 8px;
    font-size: 11px;
  }
  html.zoom-out .workspace {
    padding: 10px 8px calc(28px + env(safe-area-inset-bottom));
  }
  html.zoom-out h1 { font-size: 16.5px; }
  html.zoom-out h2 { font-size: 13.2px; }
  html.zoom-out .topbar {
    gap: 6px;
    padding-bottom: 8px;
    margin-bottom: 9px;
  }
  html.zoom-out .topbar-actions button,
  html.zoom-out .topbar-actions a {
    min-height: 27px;
    padding: 4px 8px;
    font-size: 10.8px;
  }
  html.zoom-out .kpi-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 6px;
  }
  html.zoom-out .kpi-card {
    padding: 7px 8px;
    border-radius: 9px;
  }
  html.zoom-out .kpi-label {
    font-size: 8.6px;
    line-height: 1.15;
  }
  html.zoom-out .kpi-val {
    font-size: 13.5px;
    margin-top: 3px;
  }
  html.zoom-out .kpi-sub {
    font-size: 9px;
    line-height: 1.2;
  }
  html.zoom-out .grid-3,
  html.zoom-out .grid-4 {
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 6px;
  }
  html.zoom-out .filters-bar {
    padding: 7px 9px;
    gap: 6px;
  }
  html.zoom-out .filters-bar label {
    min-width: 45%;
  }
  html.zoom-out table {
    font-size: 10.6px;
  }
  html.zoom-out th {
    font-size: 9px;
    padding: 5px 5px;
  }
  html.zoom-out td {
    padding: 4px 5px;
  }
}

@media (min-width: 385px) and (max-width: 980px) {
  html.zoom-out .kpi-grid {
    grid-template-columns: repeat(3, minmax(0, 1fr));
  }
}

/* Evita que iOS Safari fuerce zoom-in automático al tocar un campo */
@media (hover: none) and (pointer: coarse) {
  html.zoom-out input:focus,
  html.zoom-out select:focus,
  html.zoom-out textarea:focus {
    font-size: 16px;
  }
}

/* Guardado central por sección (filas modificadas sin guardar) */
.bulk-bar {
  position: sticky;
  top: 0;
  z-index: 5;
  padding: 8px 0;
  background: var(--surface);
}
.bulk-bar .btn-primary {
  width: 100%;
}
.bulk-bar .btn-primary:disabled {
  opacity: 0.55;
}
tr.row-dirty td {
  background: var(--warn-bg);
}
tr.row-error td {
  background: var(--bad-bg);
}

/* Columna fija: el nombre del producto queda a la vista al deslizar la planilla en el celu */
.freeze-col2 th:nth-child(2),
.freeze-col2 td:nth-child(2) {
  position: sticky;
  left: 0;
  z-index: 2;
  background: var(--surface);
  box-shadow: 2px 0 4px rgba(75, 47, 136, 0.12);
}
.freeze-col2 th:nth-child(2) {
  background: var(--surface-soft);
  z-index: 3;
}
.freeze-col2 td:nth-child(2) input.wide {
  min-width: 0;
  width: 150px;
}
