/* ============ Tokens (SCHPOS) ============ */
:root {
  --brand: #246bfe;
  --brand-hover: #1a56d9;
  --brand-soft: #e8f0ff;
  --brand-text: #184fc4;
  --on-brand: #ffffff;
  --header: #07111f;

  --bg: #f4f7fb;
  --surface: #ffffff;
  --surface-2: #eef3f9;
  --text: #0a1525;
  --text-2: #4d5f75;
  --muted: #4d5f75;
  --line: #dce4ed;

  --ok: #16b77c;
  --ok-soft: #e8f8f1;
  --warn: #f59b3d;
  --warn-soft: #fff4e8;
  --err: #dc2626;
  --err-soft: #fef2f2;

  --r-sm: 10px;
  --r: 14px;
  --r-lg: 20px;
  --shadow: 0 1px 2px rgba(10, 21, 37, .04), 0 4px 14px rgba(10, 21, 37, .05);
  --shadow-lg: 0 10px 30px rgba(10, 21, 37, .12);
  --font: "Inter", system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  color-scheme: light;
}
@media (prefers-color-scheme: dark) {
  :root {
    --brand: #4d8aff;
    --brand-hover: #6ba0ff;
    --brand-soft: #12233f;
    --brand-text: #9fc0ff;
    --on-brand: #07111f;
    --header: #07111f;
    --bg: #07111f;
    --surface: #0d1a2c;
    --surface-2: #132338;
    --text: #e8eef6;
    --text-2: #a8b8cb;
    --muted: #8a9bb0;
    --line: #243449;
    --ok: #2fd49a;
    --ok-soft: #0f2a21;
    --warn: #f5b066;
    --warn-soft: #2d2410;
    --err: #f87171;
    --err-soft: #2f1416;
    --shadow: 0 1px 2px rgba(0, 0, 0, .3);
    --shadow-lg: 0 10px 30px rgba(0, 0, 0, .5);
    color-scheme: dark;
  }
}

/* ============ Base ============ */
* { box-sizing: border-box; }
[hidden] { display: none !important; }
html, body { margin: 0; }
body {
  font: 15px/1.45 var(--font);
  background: var(--bg);
  color: var(--text);
  -webkit-font-smoothing: antialiased;
  -webkit-tap-highlight-color: transparent;
}
h1, h2, h3 { margin: 0; letter-spacing: -.01em; }
a { color: var(--brand); }
.num { font-variant-numeric: tabular-nums; }
.muted { color: var(--muted); }
.small { font-size: 13px; }
svg.ic { width: 20px; height: 20px; flex: none; stroke: currentColor; fill: none; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; }

/* ============ Layout ============ */
.shell { min-height: 100vh; }
.sidebar { display: none; }
.principal { min-width: 0; }
.contenido {
  max-width: 720px; margin: 0 auto;
  padding: 16px 16px calc(96px + env(safe-area-inset-bottom));
}

.topbar {
  position: sticky; top: 0; z-index: 20;
  display: flex; align-items: center; gap: 8px;
  padding: calc(10px + env(safe-area-inset-top)) 16px 10px;
  background: color-mix(in srgb, var(--bg) 85%, transparent);
  backdrop-filter: saturate(1.4) blur(12px);
  -webkit-backdrop-filter: saturate(1.4) blur(12px);
  min-height: 56px;
}
.topbar h1 { font-size: 19px; font-weight: 700; flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

.tabbar {
  position: fixed; left: 0; right: 0; bottom: 0; z-index: 30;
  display: flex; align-items: flex-end;
  background: var(--surface); border-top: 1px solid var(--line);
  padding: 6px 4px calc(6px + env(safe-area-inset-bottom));
}
.tabbar a {
  flex: 1; display: flex; flex-direction: column; align-items: center; gap: 3px;
  padding: 4px 0; font-size: 11px; font-weight: 500; color: var(--muted); text-decoration: none;
}
.tabbar a .ic { width: 22px; height: 22px; }
.tabbar a.activo { color: var(--brand); }
.tabbar a.fab-tab .fab {
  width: 48px; height: 48px; border-radius: 16px; margin-top: -22px;
  display: grid; place-items: center;
  background: var(--brand); color: var(--on-brand); box-shadow: 0 6px 16px color-mix(in srgb, var(--brand) 45%, transparent);
}
.tabbar a.fab-tab .fab .ic { width: 24px; height: 24px; stroke-width: 2.2; }

body.sin-sesion .tabbar, body.sin-sesion .sidebar, body.sin-sesion .topbar { display: none !important; }
body.sin-tabs .tabbar { display: none; }

@media (min-width: 900px) {
  .shell { display: grid; grid-template-columns: 248px 1fr; }
  body.sin-tabs .shell { grid-template-columns: 248px 1fr; }
  .sidebar {
    display: flex; flex-direction: column; gap: 8px;
    position: sticky; top: 0; height: 100vh; padding: 20px 14px;
    background: var(--surface); border-right: 1px solid var(--line);
  }
  .tabbar { display: none !important; }
  .contenido { padding: 24px 32px 48px; max-width: 860px; }
  .topbar { padding: 18px 32px 6px; background: transparent; backdrop-filter: none; -webkit-backdrop-filter: none; max-width: 860px; margin: 0 auto; }
  .banner-admin { max-width: 796px; margin: 0 auto 8px; }
  .topbar h1 { font-size: 24px; }
}
.marca { display: flex; align-items: center; gap: 10px; padding: 4px 10px 16px; font-weight: 800; font-size: 18px; color: var(--text); text-decoration: none; }
.marca img { border-radius: 9px; }
.nav-lateral { display: flex; flex-direction: column; gap: 2px; flex: 1; }
.nav-lateral a {
  display: flex; align-items: center; gap: 12px; padding: 10px 12px; border-radius: var(--r-sm);
  color: var(--text-2); text-decoration: none; font-weight: 500;
}
.nav-lateral a:hover { background: var(--surface-2); }
.nav-lateral a.activo { background: var(--brand-soft); color: var(--brand-text); }
.nav-lateral a.primario { background: var(--brand); color: var(--on-brand); margin-bottom: 8px; justify-content: center; }
.nav-lateral a.primario:hover { background: var(--brand-hover); }
.sidebar-pie { border-top: 1px solid var(--line); padding-top: 12px; }

.banner-admin {
  display: flex; align-items: center; justify-content: space-between; gap: 8px;
  margin: 0 16px; padding: 10px 14px; border-radius: var(--r);
  background: var(--warn-soft); color: var(--warn); font-size: 14px;
}

/* ============ Componentes ============ */
.card {
  background: var(--surface); border: 1px solid var(--line); border-radius: var(--r-lg);
  padding: 18px; box-shadow: var(--shadow); margin-bottom: 14px;
}
.card-titulo { display: flex; align-items: center; justify-content: space-between; gap: 8px; margin-bottom: 12px; }
.card-titulo h2, .card-titulo h3 { font-size: 16px; font-weight: 700; }
.seccion-titulo { display: flex; align-items: baseline; justify-content: space-between; margin: 22px 4px 10px; }
.seccion-titulo h2 { font-size: 16px; font-weight: 700; }
.seccion-titulo a { font-size: 14px; font-weight: 600; text-decoration: none; }

.hero {
  border-radius: var(--r-lg); padding: 22px 20px; margin-bottom: 14px; color: #fff;
  background: radial-gradient(120% 140% at 100% 0%, #4d8aff 0%, #246bfe 45%, #07111f 100%);
  box-shadow: 0 12px 30px rgba(36, 107, 254, .28);
}
.hero .etiqueta { font-size: 14px; opacity: .85; }
.hero .monto { font-size: 34px; font-weight: 800; letter-spacing: -.02em; margin: 4px 0 10px; }
.hero .detalle { display: flex; gap: 8px; flex-wrap: wrap; }
.hero .detalle span { background: rgba(255, 255, 255, .16); padding: 4px 10px; border-radius: 99px; font-size: 13px; font-weight: 500; }

.acciones-rapidas { display: grid; grid-template-columns: repeat(3, 1fr); gap: 10px; margin-bottom: 6px; }
.accion {
  display: flex; flex-direction: column; align-items: flex-start; gap: 10px; padding: 14px;
  background: var(--surface); border: 1px solid var(--line); border-radius: var(--r); box-shadow: var(--shadow);
  color: var(--text); text-decoration: none; font-weight: 600; font-size: 14px;
}
.accion .ic-wrap { width: 36px; height: 36px; border-radius: 11px; display: grid; place-items: center; background: var(--brand-soft); color: var(--brand); }
.accion.primaria { background: var(--brand); color: var(--on-brand); border-color: transparent; }
.accion.primaria .ic-wrap { background: rgba(255, 255, 255, .18); color: var(--on-brand); }

/* Listas */
.lista { list-style: none; margin: 0; padding: 0; background: var(--surface); border: 1px solid var(--line); border-radius: var(--r-lg); box-shadow: var(--shadow); overflow: hidden; }
.lista li { display: flex; align-items: center; gap: 12px; padding: 13px 16px; cursor: pointer; }
.lista li + li { border-top: 1px solid var(--line); }
.lista li:hover { background: var(--surface-2); }
.lista .grow { flex: 1; min-width: 0; }
.lista .titulo { font-weight: 600; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.lista .sub { color: var(--muted); font-size: 13px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.lista .der { text-align: right; display: flex; flex-direction: column; align-items: flex-end; gap: 4px; }
.lista .chev { color: var(--muted); }
.importe { font-weight: 700; white-space: nowrap; font-variant-numeric: tabular-nums; }
.grupo-mes { display: flex; justify-content: space-between; margin: 18px 6px 8px; font-size: 13px; font-weight: 600; color: var(--muted); }

.avatar {
  width: 40px; height: 40px; border-radius: 12px; flex: none; display: grid; place-items: center;
  font-weight: 700; font-size: 14px; background: var(--brand-soft); color: var(--brand-text);
}
.avatar.letra { font-size: 16px; font-weight: 800; }

/* Chips de estado */
.chip { display: inline-flex; align-items: center; gap: 4px; font-size: 12px; font-weight: 600; padding: 3px 9px; border-radius: 99px; white-space: nowrap; background: var(--surface-2); color: var(--text-2); }
.chip-ok { background: var(--ok-soft); color: var(--ok); }
.chip-warn { background: var(--warn-soft); color: var(--warn); }
.chip-err { background: var(--err-soft); color: var(--err); }
.chip-brand { background: var(--brand-soft); color: var(--brand-text); }

/* Filtros */
.filtros { display: flex; gap: 8px; overflow-x: auto; margin: 0 -16px 4px; padding: 0 16px 4px; scrollbar-width: none; }
.filtros::-webkit-scrollbar { display: none; }
.filtros button { flex: none; padding: 7px 14px; border-radius: 99px; font-size: 14px; font-weight: 600; background: var(--surface); border: 1px solid var(--line); color: var(--text-2); }
.filtros button.activo { background: var(--text); color: var(--bg); border-color: var(--text); }

/* Formularios */
label, .label { display: block; font-size: 13px; font-weight: 600; color: var(--text-2); margin: 14px 0 6px; }
.card > label:first-child, .card > .campo:first-child label { margin-top: 0; }
input, select, textarea {
  width: 100%; font: inherit; font-size: 16px; color: var(--text); background: var(--surface);
  border: 1px solid var(--line); border-radius: var(--r-sm); padding: 11px 12px; min-height: 46px;
  transition: border-color .15s, box-shadow .15s;
}
textarea { min-height: auto; font-family: ui-monospace, SFMono-Regular, Menlo, monospace; font-size: 12px; }
input:focus, select:focus, textarea:focus { outline: none; border-color: var(--brand); box-shadow: 0 0 0 3px color-mix(in srgb, var(--brand) 22%, transparent); }
input:disabled { background: var(--surface-2); color: var(--muted); }
.ayuda { font-size: 13px; color: var(--muted); margin: 6px 0 0; }
.fila { display: flex; gap: 10px; }
.fila > * { flex: 1; min-width: 0; }
.buscar { position: relative; margin-bottom: 12px; }
.buscar .ic { position: absolute; left: 12px; top: 13px; color: var(--muted); }
.buscar input { padding-left: 40px; background: var(--surface); }

.segmentado { display: flex; background: var(--surface-2); border-radius: 12px; padding: 4px; gap: 4px; }
.segmentado label { flex: 1; margin: 0; position: relative; }
.segmentado input { position: absolute; inset: 0; width: 1px; height: 1px; min-height: 0; padding: 0; opacity: 0; pointer-events: none; }
.segmentado span {
  display: block; text-align: center; padding: 9px 6px; border-radius: 9px; font-size: 14px; font-weight: 600;
  color: var(--muted); cursor: pointer; transition: background .15s, color .15s;
}
.segmentado input:checked + span { background: var(--surface); color: var(--text); box-shadow: var(--shadow); }
.segmentado input:focus-visible + span { outline: 2px solid var(--brand); }

/* Botones */
button { font: inherit; cursor: pointer; }
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  font: inherit; font-weight: 600; font-size: 15px; border: 1px solid transparent; border-radius: 12px;
  padding: 12px 18px; min-height: 46px; text-decoration: none; cursor: pointer;
  background: var(--brand); color: var(--on-brand); transition: background .15s, transform .05s;
}
.btn:hover { background: var(--brand-hover); }
.btn:active { transform: scale(.98); }
.btn:disabled { opacity: .5; cursor: default; transform: none; }
.btn.sec { background: var(--surface); color: var(--text); border-color: var(--line); }
.btn.sec:hover { background: var(--surface-2); }
.btn.suave { background: var(--brand-soft); color: var(--brand-text); }
.btn.peligro { background: var(--surface); color: var(--err); border-color: var(--line); }
.btn.chico { padding: 7px 12px; min-height: 36px; font-size: 14px; border-radius: 10px; }
.btn.bloque { width: 100%; }
.btn .ic { width: 18px; height: 18px; }
.icon-btn {
  display: grid; place-items: center; width: 40px; height: 40px; border-radius: 12px; border: 0;
  background: transparent; color: var(--text); margin-left: -8px;
}
.icon-btn:hover { background: var(--surface-2); }
.botonera { display: flex; gap: 10px; flex-wrap: wrap; margin-top: 16px; }
.botonera > * { flex: 1; }

/* Barra inferior fija (totales / guardar) */
.barra-fija {
  position: sticky; bottom: calc(76px + env(safe-area-inset-bottom)); z-index: 15;
  display: flex; align-items: center; gap: 12px; padding: 12px 14px; margin-top: 16px;
  background: var(--surface); border: 1px solid var(--line); border-radius: var(--r-lg); box-shadow: var(--shadow-lg);
}
.barra-fija .total-label { font-size: 12px; color: var(--muted); font-weight: 600; }
.barra-fija .total-monto { font-size: 20px; font-weight: 800; letter-spacing: -.02em; white-space: nowrap; }
.barra-fija .btn { padding: 12px 14px; }
.barra-fija .grow { flex: 1; min-width: 0; }
body.sin-tabs .barra-fija { bottom: calc(12px + env(safe-area-inset-bottom)); }
@media (min-width: 900px) { .barra-fija { bottom: 16px; } }

/* Ítems de factura */
.item { border: 1px solid var(--line); border-radius: var(--r); padding: 12px; margin-top: 10px; background: var(--surface); }
.item-cab { display: flex; align-items: center; gap: 8px; }
.item-cab input { flex: 1; font-weight: 600; }
.item .fila { margin-top: 8px; }
.item .fila label { margin: 0 0 4px; font-size: 12px; }
.item .subtotal { text-align: right; font-size: 13px; color: var(--muted); margin-top: 8px; }

/* Comprobante (detalle) */
.comprobante { padding: 0; overflow: hidden; }
.comp-cab { display: flex; gap: 14px; align-items: center; padding: 18px; border-bottom: 1px dashed var(--line); }
.comp-letra { width: 52px; height: 52px; border-radius: 14px; display: grid; place-items: center; font-size: 26px; font-weight: 800; background: var(--brand-soft); color: var(--brand-text); }
.comp-cuerpo { padding: 16px 18px; }
.comp-total { display: flex; justify-content: space-between; align-items: baseline; padding: 16px 18px; background: var(--surface-2); }
.comp-total .monto { font-size: 26px; font-weight: 800; letter-spacing: -.02em; }
.linea { display: flex; justify-content: space-between; gap: 12px; padding: 6px 0; }
.linea .desc { color: var(--text-2); }
dl.datos { display: grid; grid-template-columns: auto 1fr; gap: 6px 16px; margin: 0; font-size: 14px; }
dl.datos dt { color: var(--muted); }
dl.datos dd { margin: 0; text-align: right; overflow-wrap: anywhere; font-weight: 500; }

/* Avisos */
.aviso { display: flex; gap: 12px; align-items: flex-start; padding: 14px; border-radius: var(--r); font-size: 14px; margin-bottom: 14px; }
.aviso .ic { margin-top: 1px; }
.aviso.err { background: var(--err-soft); color: var(--err); }
.aviso.ok { background: var(--ok-soft); color: var(--ok); }
.aviso.warn { background: var(--warn-soft); color: var(--warn); }
.aviso.info { background: var(--brand-soft); color: var(--brand-text); }
.aviso a { color: inherit; font-weight: 700; }
.aviso p { margin: 0; white-space: pre-wrap; }

/* Pasos (conexión ARCA) */
.pasos { list-style: none; margin: 0; padding: 0; counter-reset: paso; }
.pasos > li { position: relative; padding: 0 0 18px 44px; counter-increment: paso; font-size: 14px; color: var(--text-2); }
.pasos > li::before {
  content: counter(paso); position: absolute; left: 0; top: -2px; width: 28px; height: 28px; border-radius: 50%;
  display: grid; place-items: center; font-size: 13px; font-weight: 700; background: var(--surface-2); color: var(--text-2);
}
.pasos > li.hecho::before { content: "✓"; background: var(--ok-soft); color: var(--ok); }
.pasos > li:not(:last-child)::after { content: ""; position: absolute; left: 13.5px; top: 30px; bottom: 4px; width: 1px; background: var(--line); }
.pasos strong { color: var(--text); }
.pasos .botonera { margin-top: 10px; }
.copiable { user-select: all; font-family: ui-monospace, monospace; background: var(--surface-2); padding: 2px 8px; border-radius: 6px; font-weight: 600; color: var(--text); }

/* Menú (Más) */
.menu { list-style: none; margin: 0 0 14px; padding: 0; background: var(--surface); border: 1px solid var(--line); border-radius: var(--r-lg); box-shadow: var(--shadow); overflow: hidden; }
.menu a, .menu button {
  display: flex; align-items: center; gap: 14px; width: 100%; padding: 14px 16px; border: 0; background: none;
  color: var(--text); text-decoration: none; font-weight: 500; text-align: left; font-size: 15px;
}
.menu li + li { border-top: 1px solid var(--line); }
.menu a:hover, .menu button:hover { background: var(--surface-2); }
.menu .ic-wrap { width: 34px; height: 34px; border-radius: 10px; display: grid; place-items: center; background: var(--surface-2); color: var(--text-2); }
.menu .grow { flex: 1; }
.menu .peligro { color: var(--err); }
.menu .peligro .ic-wrap { background: var(--err-soft); color: var(--err); }

/* Vacío, carga, toast */
.vacio { text-align: center; padding: 48px 20px; color: var(--muted); }
.vacio .ic-grande { width: 64px; height: 64px; margin: 0 auto 14px; border-radius: 20px; display: grid; place-items: center; background: var(--brand-soft); color: var(--brand); }
.vacio .ic-grande .ic { width: 30px; height: 30px; }
.vacio h3 { color: var(--text); font-size: 17px; margin-bottom: 6px; }
.vacio p { margin: 0 0 18px; }
.cargando { display: grid; place-items: center; padding: 80px 0; }
.spinner { width: 28px; height: 28px; border-radius: 50%; border: 3px solid var(--line); border-top-color: var(--brand); animation: girar .8s linear infinite; }
.btn .spinner { width: 16px; height: 16px; border-width: 2px; border-color: rgba(255, 255, 255, .4); border-top-color: currentColor; }
@keyframes girar { to { transform: rotate(360deg); } }
.toast {
  position: fixed; left: 16px; right: 16px; bottom: calc(92px + env(safe-area-inset-bottom)); z-index: 50;
  max-width: 440px; margin: 0 auto; display: flex; gap: 10px; align-items: center;
  background: #0f172a; color: #fff; padding: 13px 16px; border-radius: 14px; box-shadow: var(--shadow-lg); font-size: 14px; font-weight: 500;
  animation: aparecer .2s ease-out;
}
@media (min-width: 900px) { .toast { bottom: 24px; } }
@keyframes aparecer { from { opacity: 0; transform: translateY(8px); } }

/* Login */
.login-wrap { min-height: 100vh; display: grid; place-items: center; padding: 24px 16px; }
.login { width: 100%; max-width: 380px; }
.login-marca { text-align: center; margin-bottom: 24px; }
.login-marca img { width: 64px; height: 64px; border-radius: 18px; box-shadow: 0 10px 24px rgba(36, 107, 254, .3); }
.login-marca h1 { font-size: 26px; font-weight: 800; margin-top: 14px; }
.login-marca .de-schpos { font-size: 14px; font-weight: 600; color: var(--brand); margin: 2px 0 0; }
.login-marca p { color: var(--muted); margin: 4px 0 0; }

details.plegable summary { list-style: none; cursor: pointer; display: flex; align-items: center; gap: 10px; }
details.plegable summary::-webkit-details-marker { display: none; }
details.plegable summary .chev-abajo { margin-left: auto; transition: transform .2s; color: var(--muted); }
details.plegable[open] summary .chev-abajo { transform: rotate(90deg); }
details.plegable[open] summary { margin-bottom: 14px; }

.stats { display: grid; grid-template-columns: repeat(auto-fit, minmax(140px, 1fr)); gap: 10px; margin-bottom: 14px; }
.stat { background: var(--surface); border: 1px solid var(--line); border-radius: var(--r); padding: 14px; box-shadow: var(--shadow); }
.stat .v { font-size: 22px; font-weight: 800; }
.stat .k { font-size: 12px; color: var(--muted); font-weight: 600; }

/* Notas de crédito */
.avatar.nc, .comp-letra.nc { background: var(--err-soft); color: var(--err); }
.avatar.nc { font-size: 13px; }
.tachado { text-decoration: line-through; color: var(--muted); }

/* Fechas: en iPhone el campo de fecha no se achica solo y se desborda */
input[type="date"] {
  -webkit-appearance: none; appearance: none; display: block;
  min-width: 0; max-width: 100%; width: 100%; text-align: left;
}
input[type="date"]::-webkit-date-and-time-value { text-align: left; }
@media (max-width: 380px) { .fila-apilable { flex-direction: column; gap: 0; } }

/* Visor de PDF dentro de la app */
.visor-pdf { position: fixed; inset: 0; z-index: 60; display: flex; flex-direction: column; background: var(--bg); }
.visor-barra {
  display: flex; align-items: center; gap: 10px;
  padding: calc(10px + env(safe-area-inset-top)) 12px 10px; background: var(--surface); border-bottom: 1px solid var(--line);
}
.visor-titulo { flex: 1; min-width: 0; font-weight: 600; font-size: 14px; text-align: center; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.visor-paginas { flex: 1; overflow: auto; -webkit-overflow-scrolling: touch; padding: 12px; background: var(--surface-2); }
.visor-paginas canvas { display: block; margin: 0 auto 12px; background: #fff; box-shadow: var(--shadow-lg); border-radius: 4px; }
body.con-visor { overflow: hidden; }

/* Barra de total en pantallas muy angostas (iPhone SE) */
@media (max-width: 380px) {
  .barra-fija { gap: 8px; padding: 10px 12px; }
  .barra-fija .total-monto { font-size: 17px; }
  .barra-fija .btn { padding: 10px 12px; font-size: 14px; }
  .barra-fija #emitir-ya .ic { display: none; }
}

/* ============ Nueva factura (diseño liviano) ============ */
.nf { display: flex; flex-direction: column; gap: 12px; }
.nf-fila {
  display: flex; align-items: center; gap: 12px; width: 100%; text-align: left; font: inherit; color: var(--text);
  background: var(--surface); border: 1px solid var(--line); border-radius: var(--r-lg); padding: 12px 14px; box-shadow: var(--shadow); cursor: pointer;
}
.nf-fila .grow { flex: 1; min-width: 0; display: flex; flex-direction: column; }
.nf-etiqueta { font-size: 12px; font-weight: 700; color: var(--muted); text-transform: uppercase; letter-spacing: .04em; width: 34px; }
.nf-cli-nombre { font-weight: 700; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.nf-cli-sub { font-size: 13px; color: var(--muted); }
.nf-opciones { box-shadow: none; background: transparent; border-style: dashed; font-size: 14px; color: var(--text-2); }

.nf-items { background: var(--surface); border: 1px solid var(--line); border-radius: var(--r-lg); box-shadow: var(--shadow); overflow: hidden; }
.nf-item { padding: 12px 14px; display: flex; flex-direction: column; gap: 8px; }
.nf-item + .nf-item { border-top: 1px solid var(--line); }
.nf-item-fila { display: flex; align-items: center; gap: 8px; }
.nf-item .nf-desc { flex: 1; border: 0; padding: 4px 0; min-height: 36px; font-size: 17px; font-weight: 600; background: transparent; box-shadow: none; }
.nf-item .nf-desc:focus { box-shadow: none; }
.nf-item .quitar { width: 34px; height: 34px; margin: 0; color: var(--muted); }
.nf-precio { flex: 1; display: flex; align-items: center; gap: 4px; justify-content: flex-end; }
.nf-precio span { color: var(--muted); font-weight: 600; }
.nf-precio input { max-width: 150px; text-align: right; font-size: 18px; font-weight: 700; min-height: 40px; padding: 6px 10px; }
.nf-iva { width: auto; min-height: 40px; padding: 6px 8px; font-size: 14px; }

.stepper { display: inline-flex; align-items: center; border: 1px solid var(--line); border-radius: 10px; overflow: hidden; flex: none; }
.stepper button { width: 36px; height: 38px; border: 0; background: var(--surface-2); color: var(--text); font-size: 18px; font-weight: 600; }
.stepper input { width: 44px; min-height: 38px; border: 0; border-radius: 0; padding: 0; text-align: center; font-weight: 600; -moz-appearance: textfield; }
.stepper input::-webkit-outer-spin-button, .stepper input::-webkit-inner-spin-button { -webkit-appearance: none; margin: 0; }
.stepper input:focus { box-shadow: none; }

.nf-agregar {
  display: flex; align-items: center; justify-content: center; gap: 8px; width: 100%; padding: 12px; font: inherit; font-weight: 600;
  color: var(--brand); background: transparent; border: 1px dashed color-mix(in srgb, var(--brand) 45%, var(--line)); border-radius: var(--r);
}
.nf-chips { display: flex; gap: 8px; overflow-x: auto; margin: -4px -16px 0; padding: 0 16px 2px; scrollbar-width: none; }
.nf-chips::-webkit-scrollbar { display: none; }
.nf-chips button {
  flex: none; padding: 8px 12px; border-radius: 99px; border: 1px solid var(--line); background: var(--surface);
  font: inherit; font-size: 14px; font-weight: 600; color: var(--text);
}
.nf-panel { background: var(--surface); border: 1px solid var(--line); border-radius: var(--r-lg); padding: 16px; margin-top: -4px; }

/* Hoja inferior (elegir cliente) */
.hoja-fondo { position: fixed; inset: 0; z-index: 60; background: rgba(15, 23, 42, .45); display: flex; align-items: flex-end; justify-content: center; animation: aparecer .15s ease-out; }
.hoja {
  width: 100%; max-width: 560px; max-height: 85vh; display: flex; flex-direction: column;
  background: var(--bg); border-radius: 22px 22px 0 0; padding: 14px 16px calc(16px + env(safe-area-inset-bottom));
}
@media (min-width: 900px) { .hoja-fondo { align-items: center; } .hoja { border-radius: 22px; } }
.hoja-cab { display: flex; align-items: center; justify-content: space-between; margin-bottom: 10px; }
.hoja-cab h3 { font-size: 17px; }
.hoja-lista { list-style: none; margin: 0; padding: 0; overflow-y: auto; background: var(--surface); border: 1px solid var(--line); border-radius: var(--r-lg); }
.hoja-lista li { display: flex; align-items: center; gap: 12px; padding: 11px 14px; cursor: pointer; }
.hoja-lista li + li { border-top: 1px solid var(--line); }
.hoja-lista li.activo { background: var(--brand-soft); }
.hoja-lista .grow { flex: 1; min-width: 0; display: flex; flex-direction: column; }
.hoja-lista .titulo { font-weight: 600; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.hoja-lista .sub { font-size: 13px; color: var(--muted); }
#nf-resumen { display: block; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
@media (max-width: 440px) {
  .barra-fija { flex-wrap: wrap; }
  .barra-fija .grow { flex-basis: 100%; display: flex; align-items: baseline; justify-content: space-between; }
  .barra-fija .btn { flex: 1; }
}

/* ============ Tablas (informes) ============ */
.tabla { width: 100%; border-collapse: collapse; font-size: 14px; }
.tabla th, .tabla td { padding: 11px 14px; border-bottom: 1px solid var(--line); text-align: left; }
.tabla th { font-size: 12px; color: var(--muted); font-weight: 600; text-transform: uppercase; letter-spacing: .03em; }
.tabla tr:last-child td { border-bottom: 0; }
.tabla .der { text-align: right; }

/* ============ Varios CUIT ============ */
.barra-cuit { margin: 0 16px 8px; }
@media (min-width: 900px) { .barra-cuit { max-width: 796px; margin: 0 auto 8px; } }
.barra-cuit-btn {
  width: 100%; display: flex; align-items: center; gap: 10px;
  padding: 10px 14px; border-radius: var(--r); border: 1px solid color-mix(in srgb, var(--cuit-color) 35%, var(--line));
  background: color-mix(in srgb, var(--cuit-color) 12%, var(--surface)); color: var(--text);
  font: inherit; font-weight: 600; text-align: left; cursor: pointer;
}
.barra-cuit-punto { width: 12px; height: 12px; border-radius: 50%; background: var(--cuit-color); flex: none; }
.barra-cuit-texto { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-size: 14px; }
.barra-cuit-flecha { color: var(--muted); transform: rotate(90deg); }
.barra-cuit-flecha .ic { width: 18px; height: 18px; }
.banda-cuit {
  display: flex; align-items: center; justify-content: space-between; gap: 10px; flex-wrap: wrap;
  padding: 12px 14px; border-radius: var(--r); margin-bottom: 2px;
  background: color-mix(in srgb, var(--cuit-color) 14%, var(--surface));
  border: 1px solid color-mix(in srgb, var(--cuit-color) 40%, var(--line));
  border-left: 5px solid var(--cuit-color); font-size: 14px;
}
.banda-cuit-cambiar {
  border: 0; background: transparent; color: var(--cuit-color); font: inherit; font-weight: 700; cursor: pointer; padding: 4px 0;
}
.cuit-marca { width: 14px; height: 14px; border-radius: 4px; flex: none; }
.sr-only { position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px; overflow: hidden; clip: rect(0,0,0,0); border: 0; }
body.sin-sesion .barra-cuit { display: none !important; }
