/* ekuatiahai — hoja de estilos de la aplicación.
   Modo "Operate": precisión y calma. El verde de e-Kuatia es la carcasa; el color va a los datos y estados. */

/* IBM Plex (SIL OFL 1.1), servida localmente */
@font-face { font-family: "IBM Plex Sans"; font-style: normal; font-weight: 400; font-display: swap; src: url("../fonts/ibm-plex-sans-latin-400-normal.woff2") format("woff2"); }
@font-face { font-family: "IBM Plex Sans"; font-style: normal; font-weight: 500; font-display: swap; src: url("../fonts/ibm-plex-sans-latin-500-normal.woff2") format("woff2"); }
@font-face { font-family: "IBM Plex Sans"; font-style: normal; font-weight: 600; font-display: swap; src: url("../fonts/ibm-plex-sans-latin-600-normal.woff2") format("woff2"); }
@font-face { font-family: "IBM Plex Mono"; font-style: normal; font-weight: 400; font-display: swap; src: url("../fonts/ibm-plex-mono-latin-400-normal.woff2") format("woff2"); }
@font-face { font-family: "IBM Plex Mono"; font-style: normal; font-weight: 500; font-display: swap; src: url("../fonts/ibm-plex-mono-latin-500-normal.woff2") format("woff2"); }

:root {
  --rail: #22371e;
  --rail-ink: #e9eee5;
  --rail-muted: #a7b6a0;
  --rail-hover: rgba(255, 255, 255, .07);
  --rail-active: rgba(255, 255, 255, .13);

  --ground: #f4f3ee;
  --surface: #ffffff;
  --surface-2: #fafaf7;
  --ink: #1b2419;
  --ink-2: #3a4536;
  --muted: #5c6657;
  --line: #dfe2d8;
  --line-strong: #c6cbbd;

  --accent: #2d4729;
  --accent-hover: #213620;
  --accent-soft: #e7eee3;
  --data: #b9502b;
  --data-soft: #f7e6de;

  --ok: #276b33;
  --ok-bg: #e5f1e4;
  --err: #a3271c;
  --err-bg: #fbe9e6;
  --warn: #7f5500;
  --warn-bg: #fdf1d3;
  --neutral-bg: #eceee7;

  --radius: 6px;
  --radius-lg: 10px;
  --shadow: 0 1px 2px rgba(27, 36, 25, .06), 0 4px 14px rgba(27, 36, 25, .05);
  --font: "IBM Plex Sans", system-ui, -apple-system, "Segoe UI", sans-serif;
  --mono: "IBM Plex Mono", ui-monospace, "Cascadia Mono", Consolas, monospace;
}

*, *::before, *::after { box-sizing: border-box; }
[hidden] { display: none !important; }

html { -webkit-text-size-adjust: 100%; }

body {
  margin: 0;
  font-family: var(--font);
  font-size: 14px;
  line-height: 1.5;
  color: var(--ink);
  background: var(--ground);
  font-feature-settings: "tnum" 1;
}

::selection { background: #cfe0c7; color: var(--ink); }

a { color: var(--accent); text-underline-offset: 3px; }
a:hover { color: var(--accent-hover); }

:focus-visible { outline: 2px solid var(--data); outline-offset: 2px; border-radius: 3px; }

h1, h2, h3 { margin: 0; line-height: 1.25; text-wrap: balance; }
h1 { font-size: 20px; font-weight: 600; letter-spacing: -0.01em; }
h2 { font-size: 15px; font-weight: 600; }
h3 { font-size: 13px; font-weight: 600; }
p { margin: 0 0 8px; }

.mono, code { font-family: var(--mono); font-size: .95em; }
.num { text-align: right; font-variant-numeric: tabular-nums; white-space: nowrap; }
.muted { color: var(--muted); }
.small { font-size: 12.5px; }
.nowrap { white-space: nowrap; }
.sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }

svg.i { width: 18px; height: 18px; flex: none; stroke: currentColor; fill: none; stroke-width: 1.75; stroke-linecap: round; stroke-linejoin: round; }
svg.i.sm { width: 15px; height: 15px; }

/* ------------------------------------------------------------------ Carcasa */

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

.rail {
  background: var(--rail);
  color: var(--rail-ink);
  display: flex;
  flex-direction: column;
  position: sticky;
  top: 0;
  height: 100vh;
  overflow-y: auto;
  scrollbar-width: thin;
  scrollbar-color: rgba(255,255,255,.18) transparent;
}

.marca { display: flex; align-items: center; gap: 10px; padding: 18px 18px 14px; color: #fff; text-decoration: none; }
.marca:hover { color: #fff; }
.marca svg { width: 30px; height: 30px; }
.marca b { font-size: 16px; letter-spacing: -0.01em; }
.marca span { display: block; font-size: 11.5px; color: var(--rail-muted); font-weight: 400; }

.rail .cuenta-actual {
  margin: 0 12px 10px;
  padding: 9px 10px;
  border: 1px solid rgba(255,255,255,.12);
  border-radius: var(--radius);
  font-size: 12.5px;
}
.rail .cuenta-actual strong { display: block; color: #fff; font-weight: 500; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.rail .cuenta-actual span { color: var(--rail-muted); }

.nav { padding: 4px 10px 16px; flex: 1; }
.nav h4 {
  margin: 16px 8px 6px;
  font-size: 11px;
  font-weight: 600;
  color: var(--rail-muted);
  letter-spacing: .04em;
  text-transform: uppercase;
}
.nav a {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 7px 8px;
  border-radius: var(--radius);
  color: var(--rail-ink);
  text-decoration: none;
  font-size: 13.5px;
}
.nav a svg.i { color: var(--rail-muted); }
.nav a:hover { background: var(--rail-hover); color: #fff; }
.nav a.activo { background: var(--rail-active); color: #fff; }
.nav a.activo svg.i { color: #fff; }
.nav a .candado {
  margin-left: auto;
  font-size: 10.5px;
  color: var(--rail-muted);
  border: 1px solid rgba(255,255,255,.18);
  border-radius: 99px;
  padding: 0 7px;
}

.rail-pie { border-top: 1px solid rgba(255,255,255,.1); padding: 12px; display: flex; align-items: center; gap: 10px; }
.avatar {
  width: 32px; height: 32px; border-radius: 50%;
  display: grid; place-items: center;
  background: #e9d8c8; color: #5a3720; font-weight: 600; font-size: 12px; flex: none;
}
.rail-pie .quien { min-width: 0; flex: 1; font-size: 12.5px; }
.rail-pie .quien b { display: block; font-weight: 500; color: #fff; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.rail-pie .quien span { color: var(--rail-muted); }
.rail-pie button {
  background: none; border: 0; color: var(--rail-muted); cursor: pointer; padding: 6px; border-radius: var(--radius);
}
.rail-pie button:hover { color: #fff; background: var(--rail-hover); }

.topbar-movil { display: none; }

.main { min-width: 0; }
.cabecera {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  padding: 18px 32px 16px;
  border-bottom: 1px solid var(--line);
  background: var(--surface);
}
.cabecera .ruta { font-size: 12.5px; color: var(--muted); margin-bottom: 2px; }
.cabecera .acciones { display: flex; gap: 8px; flex-wrap: wrap; justify-content: flex-end; }

.contenido { padding: 24px 32px 48px; max-width: 1200px; }

/* ------------------------------------------------------------------ Bloques */

.panel {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius-lg);
  margin-bottom: 20px;
}
.panel > header {
  display: flex; align-items: center; justify-content: space-between; gap: 12px;
  padding: 14px 18px;
  border-bottom: 1px solid var(--line);
}
.panel > header p { margin: 2px 0 0; color: var(--muted); font-size: 12.5px; }
.panel .cuerpo { padding: 18px; }
.panel .cuerpo.sin-pad { padding: 0; }
.panel > footer { padding: 12px 18px; border-top: 1px solid var(--line); background: var(--surface-2); border-radius: 0 0 var(--radius-lg) var(--radius-lg); }

.grid-2 { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 20px; }
.grid-3 { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 20px; }
.col-principal { display: grid; grid-template-columns: minmax(0, 1fr) 320px; gap: 20px; align-items: start; }

.cifras { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); border: 1px solid var(--line); border-radius: var(--radius-lg); background: var(--surface); margin-bottom: 20px; }
.cifra { padding: 16px 18px; border-right: 1px solid var(--line); }
.cifra:last-child { border-right: 0; }
.cifra .etq { font-size: 12.5px; color: var(--muted); }
.cifra .val { font-size: 22px; font-weight: 600; letter-spacing: -0.01em; margin-top: 2px; font-variant-numeric: tabular-nums; }
.cifra .val small { font-size: 13px; font-weight: 500; color: var(--muted); margin-right: 2px; }
.cifra .sub { font-size: 12px; color: var(--muted); margin-top: 2px; }

/* ------------------------------------------------------------------ Formularios */

.campo { display: flex; flex-direction: column; gap: 5px; min-width: 0; }
.campo > label, .etiqueta { font-size: 12.5px; font-weight: 500; color: var(--ink-2); }
.campo .ayuda { font-size: 12px; color: var(--muted); }
.fila { display: grid; gap: 14px; grid-template-columns: repeat(auto-fit, minmax(180px, 1fr)); margin-bottom: 14px; }
.fila.f-2-1 { grid-template-columns: 2fr 1fr; }
.fila.f-1-2 { grid-template-columns: 1fr 2fr; }
.fila.f-1-1-2 { grid-template-columns: 1fr 1fr 2fr; }

input[type=text], input[type=email], input[type=password], input[type=number], input[type=date],
input[type=search], input[type=tel], input[type=file], select, textarea {
  width: 100%;
  font: inherit;
  color: var(--ink);
  background: var(--surface);
  border: 1px solid var(--line-strong);
  border-radius: var(--radius);
  padding: 7px 10px;
  min-height: 36px;
  transition: border-color .15s ease, box-shadow .15s ease;
}
input[type=file] { padding: 5px 8px; background: var(--surface-2); }
input::placeholder, textarea::placeholder { color: #8a9285; }
input:focus, select:focus, textarea:focus { outline: none; border-color: var(--accent); box-shadow: 0 0 0 3px rgba(45, 71, 41, .14); }
input[readonly], input:disabled, select:disabled { background: var(--surface-2); color: var(--muted); }
input[type=color] { width: 54px; height: 36px; padding: 2px; border: 1px solid var(--line-strong); border-radius: var(--radius); background: var(--surface); }
input.mono { font-family: var(--mono); }
textarea { min-height: 72px; resize: vertical; }
input[type=number] { font-variant-numeric: tabular-nums; }
input[type=checkbox], input[type=radio] { accent-color: var(--accent); width: 16px; height: 16px; }

.check { display: flex; align-items: center; gap: 8px; font-size: 13.5px; cursor: pointer; }

.segmentado { display: inline-flex; border: 1px solid var(--line-strong); border-radius: var(--radius); overflow: hidden; background: var(--surface); }
.segmentado label { display: flex; align-items: center; gap: 6px; padding: 7px 12px; cursor: pointer; font-size: 13px; border-right: 1px solid var(--line); position: relative; }
.segmentado label:last-child { border-right: 0; }
.segmentado input { position: absolute; opacity: 0; pointer-events: none; }
.segmentado label:has(input:checked) { background: var(--accent-soft); color: var(--accent); font-weight: 600; }
.segmentado label:has(input:disabled) { color: #9aa294; cursor: not-allowed; }
.segmentado label:has(input:focus-visible) { outline: 2px solid var(--data); outline-offset: -2px; }

.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 7px;
  font: inherit; font-weight: 500; font-size: 13.5px;
  min-height: 36px; padding: 7px 14px;
  border-radius: var(--radius);
  border: 1px solid var(--line-strong);
  background: var(--surface);
  color: var(--ink);
  cursor: pointer;
  text-decoration: none;
  white-space: nowrap;
  transition: background .15s ease, border-color .15s ease, color .15s ease, transform .1s ease;
}
.btn:hover { background: var(--surface-2); border-color: #b3b9aa; color: var(--ink); }
.btn:active { transform: translateY(1px); }
.btn.primario { background: var(--accent); border-color: var(--accent); color: #fff; }
.btn.primario:hover { background: var(--accent-hover); border-color: var(--accent-hover); color: #fff; }
.btn.peligro { color: var(--err); border-color: #e2b9b3; }
.btn.peligro:hover { background: var(--err-bg); }
.btn.peligro.lleno { background: var(--err); color: #fff; border-color: var(--err); }
.btn.fantasma { border-color: transparent; background: transparent; }
.btn.fantasma:hover { background: var(--neutral-bg); }
.btn.chico { min-height: 30px; padding: 4px 10px; font-size: 12.5px; }
.btn.grande { min-height: 42px; padding: 9px 20px; font-size: 14.5px; }
.btn[disabled], .btn.cargando { opacity: .6; pointer-events: none; }
.btn.cargando::after {
  content: ""; width: 13px; height: 13px; border-radius: 50%;
  border: 2px solid currentColor; border-right-color: transparent;
  animation: girar .7s linear infinite;
}
@keyframes girar { to { transform: rotate(360deg); } }

.acciones-form { display: flex; gap: 10px; align-items: center; flex-wrap: wrap; }

/* ------------------------------------------------------------------ Alertas y etiquetas */

.alerta {
  display: flex; gap: 10px; align-items: flex-start;
  padding: 11px 14px;
  border-radius: var(--radius);
  margin-bottom: 16px;
  font-size: 13.5px;
  border: 1px solid transparent;
}
.alerta svg.i { margin-top: 1px; }
.alerta.ok { background: var(--ok-bg); color: var(--ok); border-color: #c8e0c6; }
.alerta.error { background: var(--err-bg); color: var(--err); border-color: #f0c9c3; }
.alerta.aviso { background: var(--warn-bg); color: var(--warn); border-color: #f1dca5; }
.alerta.info { background: var(--accent-soft); color: var(--accent); border-color: #cddbc6; }
.alerta p { margin: 0; }

.estado {
  display: inline-flex; align-items: center; gap: 6px;
  font-size: 12px; font-weight: 500;
  padding: 2px 9px; border-radius: 99px;
  white-space: nowrap;
}
.estado::before { content: ""; width: 6px; height: 6px; border-radius: 50%; background: currentColor; }
.estado.APROBADO, .estado.VALIDADO { background: var(--ok-bg); color: var(--ok); }
.estado.RECHAZADO { background: var(--err-bg); color: var(--err); }
.estado.PENDIENTE { background: var(--warn-bg); color: var(--warn); }
.estado.ANULADO { background: var(--neutral-bg); color: var(--muted); }

.pastilla { display: inline-block; font-size: 11.5px; font-weight: 500; padding: 1px 8px; border-radius: 99px; background: var(--neutral-bg); color: var(--ink-2); }
.pastilla.pago { background: var(--data-soft); color: #8a3a1e; }
.pastilla.dev { background: var(--warn-bg); color: var(--warn); }
.pastilla.prod { background: var(--ok-bg); color: var(--ok); }

/* ------------------------------------------------------------------ Tablas */

.tabla-envoltura { overflow-x: auto; }
table.tabla { width: 100%; border-collapse: collapse; font-size: 13.5px; }
.tabla th {
  text-align: left; font-weight: 500; font-size: 12.5px; color: var(--muted);
  padding: 9px 14px; border-bottom: 1px solid var(--line); white-space: nowrap;
}
.tabla td { padding: 10px 14px; border-bottom: 1px solid var(--line); vertical-align: middle; }
.tabla tr:last-child td { border-bottom: 0; }
.tabla tbody tr:hover td { background: #fbfbf8; }
.tabla th.num, .tabla td.num { text-align: right; }
.tabla .doc-num { font-family: var(--mono); font-size: 13px; }
.tabla a.fila-link { color: inherit; text-decoration: none; }
.tabla a.fila-link:hover { color: var(--accent); text-decoration: underline; }

.vacio { padding: 36px 20px; text-align: center; color: var(--muted); }
.vacio h3 { color: var(--ink); font-size: 14px; margin-bottom: 4px; }
.vacio .btn { margin-top: 12px; }

.paginacion { display: flex; justify-content: space-between; align-items: center; padding: 10px 14px; border-top: 1px solid var(--line); font-size: 12.5px; color: var(--muted); }

.filtros { display: flex; gap: 10px; flex-wrap: wrap; align-items: end; padding: 14px 18px; border-bottom: 1px solid var(--line); }
.filtros .campo { min-width: 150px; }
.filtros .campo.ancho { flex: 1; min-width: 220px; }

dl.datos { display: grid; grid-template-columns: 160px minmax(0, 1fr); gap: 8px 14px; margin: 0; font-size: 13.5px; }
dl.datos dt { color: var(--muted); }
dl.datos dd { margin: 0; overflow-wrap: anywhere; }

/* ------------------------------------------------------------------ Talonario (firma visual) */

.talonario {
  position: relative;
  display: grid;
  grid-template-columns: auto minmax(0, 1fr);
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius-lg);
  margin-bottom: 20px;
  overflow: hidden;
}
.talonario .talon {
  padding: 14px 22px 14px 18px;
  border-right: 2px dashed var(--line-strong);
  background: linear-gradient(var(--surface-2), var(--surface-2));
  min-width: 250px;
}
.talonario .talon .etq { font-size: 12px; color: var(--muted); }
.talonario .talon .numero {
  font-family: var(--mono);
  font-size: 24px;
  font-weight: 500;
  letter-spacing: .01em;
  color: var(--data);
  line-height: 1.2;
  margin: 2px 0;
}
.talonario .talon select { margin-top: 6px; max-width: 260px; min-height: 32px; padding: 4px 8px; font-size: 12.5px; }
.talonario .detalle { padding: 14px 20px; display: flex; gap: 28px; flex-wrap: wrap; align-items: center; }
.talonario .detalle .dato .etq { font-size: 12px; color: var(--muted); }
.talonario .detalle .dato b { display: block; font-weight: 500; }

.medidor { min-width: 240px; flex: 1; max-width: 380px; }
.medidor .barra { height: 6px; border-radius: 99px; background: var(--neutral-bg); overflow: hidden; margin: 6px 0 4px; }
.medidor .barra i { display: block; height: 100%; background: var(--data); border-radius: 99px; transition: width .4s cubic-bezier(.16, 1, .3, 1); }
.medidor .barra i.lleno { background: var(--err); }
.medidor .leyenda { display: flex; justify-content: space-between; font-size: 12px; color: var(--muted); }

/* ------------------------------------------------------------------ Editor de ítems */

.items-tabla td { padding: 6px 6px; vertical-align: top; }
.items-tabla th { padding: 8px 6px; }
.items-tabla td:first-child, .items-tabla th:first-child { padding-left: 14px; }
.items-tabla td:last-child, .items-tabla th:last-child { padding-right: 14px; }
.items-tabla input, .items-tabla select { min-height: 34px; }
.items-tabla .c-cod { width: 96px; }
.items-tabla .c-cant { width: 84px; }
.items-tabla .c-precio { width: 128px; }
.items-tabla .c-iva { width: 86px; }
.items-tabla .c-total { width: 112px; padding-top: 14px; }
.items-tabla .c-quitar { width: 42px; }
.items-tabla tbody tr:hover td { background: transparent; }
.items-tabla .total-fila { font-weight: 500; }

.resumen { display: grid; gap: 6px; font-size: 13.5px; }
.resumen .linea { display: flex; justify-content: space-between; gap: 12px; }
.resumen .linea span:first-child { color: var(--muted); }
.resumen .total { border-top: 1px solid var(--line); margin-top: 6px; padding-top: 10px; font-size: 20px; font-weight: 600; }
.resumen .total span:first-child { color: var(--ink); font-size: 14px; font-weight: 500; align-self: center; }

.pegajoso { position: sticky; top: 16px; }

.ruc-estado { font-size: 12px; min-height: 18px; }
.ruc-estado.ok { color: var(--ok); }
.ruc-estado.error { color: var(--err); }
.ruc-estado.buscando { color: var(--muted); }

/* ------------------------------------------------------------------ Pasos de inicio */

.pasos { list-style: none; margin: 0; padding: 0; }
.pasos li { display: flex; gap: 12px; align-items: center; padding: 12px 18px; border-bottom: 1px solid var(--line); }
.pasos li:last-child { border-bottom: 0; }
.pasos .marca-paso { width: 22px; height: 22px; border-radius: 50%; border: 1.5px solid var(--line-strong); display: grid; place-items: center; flex: none; color: transparent; }
.pasos li.hecho .marca-paso { background: var(--ok); border-color: var(--ok); color: #fff; }
.pasos li.hecho .texto { color: var(--muted); }
.pasos .texto { flex: 1; }
.pasos .texto b { display: block; font-weight: 500; color: var(--ink); }

/* ------------------------------------------------------------------ Planes */

.planes { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 0; border: 1px solid var(--line); border-radius: var(--radius-lg); background: var(--surface); margin-bottom: 20px; }
.plan { padding: 20px; border-right: 1px solid var(--line); display: flex; flex-direction: column; gap: 10px; }
.plan:last-child { border-right: 0; }
.plan.actual { background: var(--accent-soft); }
.plan .precio { font-size: 22px; font-weight: 600; letter-spacing: -0.01em; }
.plan .precio small { font-size: 12.5px; color: var(--muted); font-weight: 400; }
.plan ul { margin: 0; padding: 0; list-style: none; font-size: 13px; display: grid; gap: 6px; }
.plan li { display: flex; gap: 8px; align-items: flex-start; }
.plan li svg.i { color: var(--ok); margin-top: 1px; }
.plan li.no { color: var(--muted); }
.plan li.no svg.i { color: #a0a79a; }

.cuadro-transferencia { background: var(--surface-2); border: 1px dashed var(--line-strong); border-radius: var(--radius); padding: 14px; }

/* ------------------------------------------------------------------ Autenticación */

.auth {
  min-height: 100vh;
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(0, 1.1fr);
}
.auth .lado {
  background: var(--rail);
  color: var(--rail-ink);
  padding: 48px;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
}
.auth .lado h2 { font-size: 28px; font-weight: 600; letter-spacing: -0.02em; color: #fff; max-width: 420px; line-height: 1.2; }
.auth .lado p { color: var(--rail-muted); max-width: 420px; font-size: 14.5px; }
.auth .lado .muestra {
  font-family: var(--mono); color: #f2c5b1; font-size: 15px;
  border-left: 2px dashed rgba(255,255,255,.25); padding-left: 14px; margin-top: 28px;
}
.auth .lado .muestra span { display: block; color: var(--rail-muted); font-family: var(--font); font-size: 12px; }
.auth .formulario { display: grid; place-items: center; padding: 40px 24px; }
.auth .caja { width: 100%; max-width: 380px; }
.auth .caja h1 { font-size: 22px; margin-bottom: 4px; }
.auth .caja .sub { color: var(--muted); margin-bottom: 22px; }
.auth .caja .campo { margin-bottom: 14px; }
.auth .caja .btn.primario { width: 100%; margin-top: 6px; }
.auth .caja .pie { margin-top: 20px; font-size: 13.5px; color: var(--muted); text-align: center; }

/* ------------------------------------------------------------------ Varios */

details.desplegable > summary { cursor: pointer; list-style: none; }
details.desplegable > summary::-webkit-details-marker { display: none; }
details.desplegable[open] > summary { margin-bottom: 10px; }

.separador { height: 1px; background: var(--line); margin: 16px 0; border: 0; }
.logo-preview { max-height: 70px; max-width: 220px; border: 1px solid var(--line); border-radius: var(--radius); padding: 6px; background: #fff; }
.texto-cdc { font-family: var(--mono); font-size: 13px; word-spacing: 2px; }
.entrar { animation: entrar .35s cubic-bezier(.16, 1, .3, 1) both; }
@keyframes entrar { from { opacity: 0; transform: translateY(4px); } to { opacity: 1; transform: none; } }

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

/* ------------------------------------------------------------------ Responsive */

@media (max-width: 1100px) {
  .col-principal { grid-template-columns: minmax(0, 1fr); }
  .pegajoso { position: static; }
  .cifras { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .cifra:nth-child(2) { border-right: 0; }
  .cifra:nth-child(-n+2) { border-bottom: 1px solid var(--line); }
}

@media (max-width: 860px) {
  .shell { grid-template-columns: minmax(0, 1fr); }
  .rail { position: fixed; inset: 0 auto 0 0; width: 260px; z-index: 50; transform: translateX(-100%); transition: transform .25s cubic-bezier(.16, 1, .3, 1); }
  body.menu-abierto .rail { transform: none; box-shadow: 0 0 0 100vmax rgba(15, 20, 14, .35); }
  .topbar-movil { display: flex; align-items: center; gap: 10px; padding: 10px 16px; background: var(--rail); color: #fff; position: sticky; top: 0; z-index: 40; }
  .topbar-movil button { background: none; border: 0; color: #fff; padding: 6px; cursor: pointer; }
  .topbar-movil b { font-size: 15px; }
  .cabecera { padding: 14px 16px; flex-wrap: wrap; }
  .contenido { padding: 16px 16px 40px; }
  .grid-2, .grid-3, .planes { grid-template-columns: minmax(0, 1fr); }
  .plan { border-right: 0; border-bottom: 1px solid var(--line); }
  .plan:last-child { border-bottom: 0; }
  .fila.f-2-1, .fila.f-1-2, .fila.f-1-1-2 { grid-template-columns: minmax(0, 1fr); }
  .talonario { grid-template-columns: minmax(0, 1fr); }
  .talonario .talon { border-right: 0; border-bottom: 2px dashed var(--line-strong); }
  .auth { grid-template-columns: minmax(0, 1fr); }
  .auth .lado { padding: 28px 20px; }
  .auth .lado .muestra, .auth .lado p { display: none; }
  dl.datos { grid-template-columns: minmax(0, 1fr); gap: 2px; }
  dl.datos dd { margin-bottom: 8px; }

  .items-tabla thead { display: none; }
  .items-tabla, .items-tabla tbody, .items-tabla tr, .items-tabla td { display: block; width: 100% !important; }
  .items-tabla tr { border-bottom: 1px solid var(--line); padding: 8px 8px 10px; display: grid; grid-template-columns: 1fr 1fr; gap: 6px; }
  .items-tabla td { padding: 0 !important; border: 0 !important; }
  .items-tabla td.c-desc { grid-column: 1 / -1; order: -1; }
  .items-tabla td[data-etq]::before { content: attr(data-etq); display: block; font-size: 11.5px; color: var(--muted); }
}

@media (max-width: 520px) {
  .cifras { grid-template-columns: minmax(0, 1fr); }
  .cifra { border-right: 0; border-bottom: 1px solid var(--line); }
  .cifra:last-child { border-bottom: 0; }
}

/* Columnas fijas en el editor de ítems: la descripción ocupa el resto. */
@media (min-width: 861px) {
  .items-tabla { table-layout: fixed; }
}

/* Código del catálogo DNCP bajo la descripción (B2G) */
.items-tabla input.dncp { margin-top: 6px; font-size: 12.5px; }

/* Si el panel de ítems queda angosto (pantallas de ~1300 px con el menú y la columna de totales),
   las filas pasan al formato de tarjeta para que la descripción tenga lugar. */
.panel:has(> .tabla-envoltura > .items-tabla) { container-type: inline-size; }
@container (max-width: 760px) {
  .items-tabla { table-layout: auto !important; }
  .items-tabla thead { display: none; }
  .items-tabla, .items-tabla tbody, .items-tabla tr, .items-tabla td { display: block; width: 100% !important; }
  .items-tabla tr { border-bottom: 1px solid var(--line); padding: 10px 14px 12px; display: grid; grid-template-columns: 96px 1fr 1fr 96px auto auto; gap: 8px; align-items: end; }
  .items-tabla td { padding: 0 !important; border: 0 !important; }
  .items-tabla td.c-desc { grid-column: 1 / -1; order: -1; }
  .items-tabla td.c-total { padding-bottom: 8px !important; text-align: right; }
  .items-tabla td[data-etq]::before { content: attr(data-etq); display: block; font-size: 11.5px; color: var(--muted); margin-bottom: 2px; }
}
