/* =====================================================================
   Seguimiento Ventas · estilos
   Idea: taller cálido de velas. Fondo crema, tarjetas blancas suaves, pastel
   rosa / amarillo / celeste; una columna para el pulgar, navegación abajo.
   ===================================================================== */
:root {
  /* Paleta (modo claro) */
  --fondo: #FFF8F2;
  --superficie: #FFFFFF;
  --superficie-2: #FFF1E8;
  --borde: #F0E2D8;
  --texto: #3D3A3A;
  --texto-2: #6B6363;
  --rosa: #F9D5E5;
  --amarillo: #FFF3C4;
  --celeste: #CDEBF7;
  --acento: #E89AB8;
  --acento-hover: #E187AA;
  --acento-tinta: #9C3D66;
  --peligro: #B3261E;
  --peligro-fondo: #FCE8E6;
  --aviso-fondo: #FFF3C4;
  --aviso-tinta: #6E5100;
  --est-solicitado-fondo: #CDEBF7; --est-solicitado-tinta: #1D5671;
  --est-elaboracion-fondo: #FFF3C4; --est-elaboracion-tinta: #6E5100;
  --est-entregado-fondo: #F9D5E5; --est-entregado-tinta: #8A2E58;
  --pago-pendiente: #B4483B;
  --pago-parcial: #8A5B00;
  --pago-pagado: #5B4A99;
  --serie-1: #CF5F8E;
  --serie-2: #2B86C5;
  --sombra: 0 1px 2px rgba(61, 58, 58, .05), 0 6px 18px rgba(61, 58, 58, .06);
  --sombra-alta: 0 -4px 24px rgba(61, 58, 58, .10);

  /* Tipografía */
  --fuente-titulo: 'Fredoka', ui-rounded, 'Nunito', system-ui, sans-serif;
  --fuente: 'Nunito', ui-rounded, system-ui, -apple-system, 'Segoe UI', Roboto, sans-serif;

  /* Forma y espacio (ritmo de 4 px) */
  --radio: 18px;
  --radio-m: 14px;
  --radio-s: 10px;
  --ancho: 560px;
  --nav-alto: 72px;
  color-scheme: light;
}

/* Modo oscuro: elegido en Ajustes, o automático según el sistema / la vista. */
:root[data-tema="oscuro"],
:root[data-tema="auto"][data-theme="dark"] {
  --fondo: #1E191C; --superficie: #2A2327; --superficie-2: #332A2F; --borde: #43383E;
  --texto: #F4ECEF; --texto-2: #C9BCC2;
  --rosa: #4D2A3B; --amarillo: #4A4020; --celeste: #23414F;
  --acento: #E89AB8; --acento-hover: #F0AECA; --acento-tinta: #F2B5CD;
  --peligro: #FF8A80; --peligro-fondo: #4A2523; --aviso-fondo: #4A4020; --aviso-tinta: #FFE6A0;
  --est-solicitado-fondo: #23414F; --est-solicitado-tinta: #CDEBF7;
  --est-elaboracion-fondo: #4A4020; --est-elaboracion-tinta: #FFF3C4;
  --est-entregado-fondo: #4D2A3B; --est-entregado-tinta: #F9D5E5;
  --pago-pendiente: #F19A8E; --pago-parcial: #F2C55C; --pago-pagado: #B9A9EE;
  --serie-1: #D9668F; --serie-2: #2F8FD3;
  --sombra: 0 1px 2px rgba(0, 0, 0, .3), 0 6px 18px rgba(0, 0, 0, .25);
  --sombra-alta: 0 -4px 24px rgba(0, 0, 0, .4);
  color-scheme: dark;
}
@media (prefers-color-scheme: dark) {
  :root[data-tema="auto"]:not([data-theme="light"]) {
    --fondo: #1E191C; --superficie: #2A2327; --superficie-2: #332A2F; --borde: #43383E;
    --texto: #F4ECEF; --texto-2: #C9BCC2;
    --rosa: #4D2A3B; --amarillo: #4A4020; --celeste: #23414F;
    --acento: #E89AB8; --acento-hover: #F0AECA; --acento-tinta: #F2B5CD;
    --peligro: #FF8A80; --peligro-fondo: #4A2523; --aviso-fondo: #4A4020; --aviso-tinta: #FFE6A0;
    --est-solicitado-fondo: #23414F; --est-solicitado-tinta: #CDEBF7;
    --est-elaboracion-fondo: #4A4020; --est-elaboracion-tinta: #FFF3C4;
    --est-entregado-fondo: #4D2A3B; --est-entregado-tinta: #F9D5E5;
    --pago-pendiente: #F19A8E; --pago-parcial: #F2C55C; --pago-pagado: #B9A9EE;
    --serie-1: #D9668F; --serie-2: #2F8FD3;
    --sombra: 0 1px 2px rgba(0, 0, 0, .3), 0 6px 18px rgba(0, 0, 0, .25);
    --sombra-alta: 0 -4px 24px rgba(0, 0, 0, .4);
    color-scheme: dark;
  }
}

/* ---------------------------------------------------------------------
   Base
   --------------------------------------------------------------------- */
*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; height: 100%; }
body {
  margin: 0; min-height: 100%;
  background: var(--fondo); color: var(--texto);
  font-family: var(--fuente); font-size: 16px; line-height: 1.5;
  -webkit-font-smoothing: antialiased;
  -webkit-tap-highlight-color: transparent;
}
body.sin-scroll { overflow: hidden; }
h1, h2, h3, p { margin: 0; }
h1, h2, h3 { font-family: var(--fuente-titulo); font-weight: 600; text-wrap: balance; line-height: 1.2; }
a { color: inherit; text-decoration: none; }
img { max-width: 100%; display: block; }
button, input, select, textarea { font: inherit; color: inherit; }
button { cursor: pointer; }
[hidden] { display: none !important; }
:focus-visible { outline: 3px solid var(--acento); outline-offset: 2px; border-radius: 8px; }
.solo-lector { position: absolute !important; width: 1px; height: 1px; padding: 0; margin: -1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; border: 0; }
.texto-suave { color: var(--texto-2); }
.texto-centro { text-align: center; }
.negativo { color: var(--peligro); }
.icono { display: inline-flex; width: 20px; height: 20px; flex: none; }
.icono svg { width: 100%; height: 100%; }

.app { max-width: var(--ancho); margin: 0 auto; padding: max(16px, env(safe-area-inset-top)) 16px 32px; }
body.con-nav .app { padding-bottom: calc(var(--nav-alto) + 40px + env(safe-area-inset-bottom)); }
.vista { outline: none; }
.vista__lienzo { display: flex; flex-direction: column; gap: 16px; }
.arranque { padding: 48px 0; text-align: center; color: var(--texto-2); }
.pila { display: flex; flex-direction: column; gap: 16px; }
.pila--chica { gap: 12px; }
.grid-2 { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.grid-2--sin-espacio { gap: 0; }
.fila-2 { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; align-items: end; }
.fila-botones { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; }
.fila-botones--centro { justify-content: center; }

/* ---------------------------------------------------------------------
   Tarjetas
   --------------------------------------------------------------------- */
.tarjeta {
  background: var(--superficie); border: 1px solid var(--borde); border-radius: var(--radio);
  box-shadow: var(--sombra); padding: 16px;
}
.tarjeta.pila { gap: 14px; }
.tarjeta__titulo { font-size: 18px; }
.tarjeta__cabecera { display: flex; align-items: center; justify-content: space-between; gap: 12px; flex-wrap: wrap; margin-bottom: 8px; }
.seccion-titulo { font-size: 18px; margin-top: 4px; }
.tarjeta--demo { background: var(--superficie-2); }

/* ---------------------------------------------------------------------
   Barra superior y saludo
   --------------------------------------------------------------------- */
.barra-superior { display: flex; align-items: center; gap: 8px; min-height: 48px; }
.barra-superior__textos { flex: 1; min-width: 0; }
.barra-superior__titulo { font-size: 26px; overflow-wrap: anywhere; }
.barra-superior__subtitulo { color: var(--texto-2); font-size: 14px; }
.barra-superior__acciones { display: flex; gap: 8px; align-items: center; }
.saludo { display: flex; align-items: flex-start; justify-content: space-between; gap: 12px; padding-top: 4px; }
.saludo__hola { color: var(--texto-2); font-weight: 600; }
.saludo__negocio { font-size: 28px; }
.saludo__acciones { display: flex; align-items: center; gap: 8px; }
.insignia-demo {
  font-size: 12px; font-weight: 800; letter-spacing: .04em; text-transform: uppercase;
  background: var(--amarillo); color: var(--aviso-tinta); padding: 4px 10px; border-radius: 999px;
}

/* ---------------------------------------------------------------------
   Botones
   --------------------------------------------------------------------- */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  min-height: 48px; padding: 10px 18px; border-radius: 999px; border: 1.5px solid transparent;
  font-weight: 700; font-size: 16px; line-height: 1.2; text-align: center;
  transition: background-color .15s ease, border-color .15s ease, transform .1s ease;
  user-select: none;
}
.btn:active { transform: scale(.98); }
.btn[disabled] { opacity: .6; cursor: default; }
.btn--primario { background: var(--acento); color: #3D3A3A; }
.btn--primario:hover { background: var(--acento-hover); }
.btn--secundario { background: var(--superficie); border-color: var(--borde); color: var(--texto); }
.btn--secundario:hover { border-color: var(--acento); }
.btn--fantasma { background: transparent; color: var(--texto-2); }
.btn--fantasma:hover { color: var(--texto); background: var(--superficie-2); }
.btn--peligro { background: var(--peligro); color: #FFFFFF; }
:root[data-tema="oscuro"] .btn--peligro { color: #2A1414; }
.btn--texto-peligro { color: var(--peligro); }
.btn--bloque { width: 100%; }
.btn--pequeno { min-height: 40px; padding: 6px 14px; font-size: 15px; }
.btn--alto { min-height: 56px; border-radius: var(--radio-m); font-size: 15px; padding: 8px 12px; }
.btn .icono { width: 20px; height: 20px; }
.btn-icono {
  display: inline-grid; place-items: center; width: 44px; height: 44px; flex: none;
  border-radius: 999px; border: none; background: transparent; color: var(--texto);
}
.btn-icono:hover { background: var(--superficie-2); }
.btn-icono[disabled] { opacity: .35; cursor: default; background: transparent; }
.btn-icono .icono { width: 22px; height: 22px; }
.btn-icono--chico { width: 36px; height: 36px; color: var(--texto-2); }
.btn-icono--chico .icono { width: 18px; height: 18px; }
.btn-icono--peligro { color: var(--peligro); }
.enlace { background: none; border: none; padding: 4px 0; color: var(--acento-tinta); font-weight: 700; text-decoration: underline; text-underline-offset: 3px; align-self: flex-start; }
.girador { width: 16px; height: 16px; border-radius: 50%; border: 2.5px solid currentColor; border-right-color: transparent; animation: girar .7s linear infinite; display: inline-block; }
@keyframes girar { to { transform: rotate(360deg); } }

/* ---------------------------------------------------------------------
   Chips de estado (rellenas) y de pago (con borde)
   --------------------------------------------------------------------- */
.chip { display: inline-flex; align-items: center; padding: 3px 10px; border-radius: 999px; font-size: 13px; font-weight: 700; white-space: nowrap; }
.chip--solicitado { background: var(--est-solicitado-fondo); color: var(--est-solicitado-tinta); }
.chip--en_elaboracion { background: var(--est-elaboracion-fondo); color: var(--est-elaboracion-tinta); }
.chip--entregado { background: var(--est-entregado-fondo); color: var(--est-entregado-tinta); }
.chip-pago { display: inline-flex; align-items: center; gap: 6px; padding: 2px 10px; border-radius: 999px; border: 1.5px solid currentColor; font-size: 13px; font-weight: 700; white-space: nowrap; background: var(--superficie); }
.chip-pago__punto { width: 7px; height: 7px; border-radius: 50%; background: currentColor; }
.chip-pago--pendiente { color: var(--pago-pendiente); }
.chip-pago--parcial { color: var(--pago-parcial); }
.chip-pago--pagado { color: var(--pago-pagado); }

/* ---------------------------------------------------------------------
   Panel (Inicio)
   --------------------------------------------------------------------- */
.selector-mes { display: flex; align-items: center; justify-content: space-between; background: var(--superficie); border: 1px solid var(--borde); border-radius: 999px; padding: 4px; }
.selector-mes__nombre { font-family: var(--fuente-titulo); font-weight: 600; font-size: 18px; text-transform: capitalize; }
.kpi-principal { background: linear-gradient(135deg, var(--rosa), var(--superficie) 85%); }
.kpi__etiqueta { display: flex; align-items: center; gap: 6px; color: var(--texto-2); font-weight: 700; font-size: 14px; }
.kpi__etiqueta .icono { width: 16px; height: 16px; }
.kpi__valor { font-family: var(--fuente-titulo); font-weight: 600; font-size: 24px; font-variant-numeric: tabular-nums; margin-top: 4px; overflow-wrap: anywhere; }
.kpi__valor--grande { font-size: 40px; line-height: 1.1; }
.kpi__nota { color: var(--texto-2); font-size: 13px; margin-top: 2px; }
.kpi--por-cobrar { background: var(--amarillo); border-color: transparent; }
.kpi--por-cobrar .kpi__etiqueta, .kpi--por-cobrar .kpi__nota { color: var(--aviso-tinta); }
.ganancia { padding: 4px 4px 4px 0; }
.ganancia + .ganancia { padding-left: 14px; border-left: 1px solid var(--borde); }
.ganancia__etiqueta { font-weight: 700; font-size: 14px; color: var(--texto-2); }
.ganancia__valor { font-family: var(--fuente-titulo); font-weight: 600; font-size: 22px; font-variant-numeric: tabular-nums; }
.ganancia__ayuda { font-size: 12px; color: var(--texto-2); }
.ganancia--negativa .ganancia__valor { color: var(--peligro); }
.nota-costo, .nota-negativa { display: flex; gap: 8px; align-items: flex-start; font-size: 13px; margin-top: 12px; padding: 10px 12px; border-radius: var(--radio-s); }
.nota-costo { background: var(--superficie-2); color: var(--texto-2); }
.nota-costo .icono { width: 16px; height: 16px; margin-top: 1px; }
.nota-negativa { background: var(--peligro-fondo); color: var(--peligro); }

.acceso { display: grid; grid-template-columns: auto 1fr; grid-template-rows: auto auto; column-gap: 10px; align-items: center; padding: 14px; border-radius: var(--radio); border: 1px solid var(--borde); background: var(--superficie); box-shadow: var(--sombra); min-height: 76px; }
.acceso__icono { grid-row: span 2; display: grid; place-items: center; width: 40px; height: 40px; border-radius: 12px; }
.acceso--celeste .acceso__icono { background: var(--celeste); color: var(--est-solicitado-tinta); }
.acceso--amarillo .acceso__icono { background: var(--amarillo); color: var(--aviso-tinta); }
.acceso__cantidad { font-family: var(--fuente-titulo); font-weight: 600; font-size: 24px; line-height: 1; }
.acceso__titulo { font-size: 13px; font-weight: 700; color: var(--texto-2); line-height: 1.25; }

/* Avisos */
.aviso { display: flex; gap: 12px; align-items: flex-start; padding: 14px; border-radius: var(--radio); }
.aviso > .icono { width: 22px; height: 22px; margin-top: 1px; }
.aviso__titulo { font-weight: 800; }
.aviso p + p, .aviso p + .btn { margin-top: 4px; }
.aviso .btn { margin-top: 10px; }
.aviso--peligro { background: var(--peligro-fondo); color: var(--peligro); }
.aviso--peligro p:not(.aviso__titulo) { color: var(--texto); }
.aviso--suave { background: var(--superficie-2); color: var(--texto); }
.aviso--enlace > div { flex: 1; }
.aviso--compacto { padding: 10px 12px; font-size: 14px; gap: 8px; margin-top: 12px; }
.aviso--compacto .icono { width: 18px; height: 18px; }

/* ---------------------------------------------------------------------
   Gráfico
   --------------------------------------------------------------------- */
.leyenda { display: flex; gap: 16px; flex-wrap: wrap; font-size: 13px; color: var(--texto-2); font-weight: 700; margin: 4px 0 2px; }
.leyenda__item { display: inline-flex; align-items: center; gap: 6px; }
.leyenda__muestra { width: 12px; height: 12px; border-radius: 4px; }
.leyenda__muestra.serie-1 { background: var(--serie-1); }
.leyenda__muestra.serie-2 { background: var(--serie-2); }
.grafico { position: relative; }
.grafico__svg { width: 100%; height: auto; display: block; overflow: visible; }
.grafico__rejilla { stroke: var(--borde); stroke-width: 1; }
.grafico__cero { stroke: var(--texto-2); stroke-width: 1; opacity: .5; }
.grafico__eje { fill: var(--texto-2); font-size: 10px; font-family: var(--fuente); font-variant-numeric: tabular-nums; }
.grafico__mes { fill: var(--texto-2); font-size: 11px; font-weight: 700; font-family: var(--fuente); }
.grafico__mes--activo { fill: var(--texto); }
.grafico__fondo { fill: transparent; }
.grafico__grupo { cursor: pointer; outline: none; }
.grafico__grupo--activo .grafico__fondo { fill: var(--superficie-2); }
.grafico__grupo:focus-visible .grafico__fondo { stroke: var(--acento); stroke-width: 2; }
.grafico__barra.serie-1 { fill: var(--serie-1); }
.grafico__barra.serie-2 { fill: var(--serie-2); }
.grafico__barra--negativa { opacity: .75; }
.grafico__detalle { display: flex; flex-wrap: wrap; gap: 4px 14px; font-size: 14px; color: var(--texto-2); padding: 8px 12px; background: var(--superficie-2); border-radius: var(--radio-s); margin-bottom: 6px; }
.grafico__detalle strong { color: var(--texto); font-variant-numeric: tabular-nums; }
.grafico__detalle .negativo strong { color: var(--peligro); }
.grafico__mes-elegido { font-weight: 800; color: var(--texto); text-transform: capitalize; width: 100%; }

/* ---------------------------------------------------------------------
   Segmentado (opciones en botones)
   --------------------------------------------------------------------- */
.segmentado { display: flex; gap: 4px; padding: 4px; background: var(--superficie-2); border-radius: 999px; }
.segmentado button { flex: 1; min-height: 40px; padding: 6px 10px; border: none; border-radius: 999px; background: transparent; color: var(--texto-2); font-weight: 700; font-size: 14px; line-height: 1.2; }
.segmentado button[aria-checked="true"] { background: var(--superficie); color: var(--texto); box-shadow: 0 1px 3px rgba(61, 58, 58, .14); }
.tarjeta__cabecera .segmentado button { min-height: 34px; font-size: 13px; padding: 4px 12px; }

/* ---------------------------------------------------------------------
   Buscador y filtros
   --------------------------------------------------------------------- */
.buscador { position: relative; }
.buscador__icono { position: absolute; left: 16px; top: 50%; transform: translateY(-50%); color: var(--texto-2); pointer-events: none; }
.control--buscar { padding-left: 46px !important; border-radius: 999px !important; }
.buscador .control--buscar { background: var(--superficie); }
.filtros { display: flex; flex-direction: column; gap: 8px; }
.filtros__grupo { display: flex; align-items: center; gap: 8px; min-width: 0; }
.filtros__titulo { font-size: 13px; font-weight: 800; color: var(--texto-2); width: 52px; flex: none; }
.filtros__opciones { display: flex; gap: 6px; overflow-x: auto; scrollbar-width: none; padding: 2px 24px 2px 2px; margin: -2px; -webkit-mask-image: linear-gradient(to right, #000 calc(100% - 28px), transparent); mask-image: linear-gradient(to right, #000 calc(100% - 28px), transparent); }
.filtros__opciones::-webkit-scrollbar { display: none; }
.filtro { display: inline-flex; align-items: center; gap: 4px; flex: none; min-height: 36px; padding: 4px 12px; border-radius: 999px; border: 1.5px solid var(--borde); background: var(--superficie); color: var(--texto); font-size: 14px; font-weight: 700; white-space: nowrap; }
.filtro .icono { width: 16px; height: 16px; }
.filtro[aria-pressed="true"] { border-color: var(--texto); background: var(--texto); color: var(--fondo); }
.filtros .enlace { font-size: 14px; }
.enlace-papelera { display: inline-flex; align-items: center; gap: 6px; align-self: center; color: var(--texto-2); font-weight: 700; font-size: 14px; padding: 10px 14px; border-radius: 999px; }
.enlace-papelera:hover { background: var(--superficie-2); color: var(--texto); }
.enlace-papelera .icono { width: 18px; height: 18px; }

/* ---------------------------------------------------------------------
   Tarjeta de pedido
   --------------------------------------------------------------------- */
.lista { display: flex; flex-direction: column; gap: 10px; }
.tarjeta-pedido { display: grid; grid-template-columns: 60px 1fr; gap: 12px; align-items: start; padding: 12px; background: var(--superficie); border: 1px solid var(--borde); border-radius: var(--radio); box-shadow: var(--sombra); transition: border-color .15s ease; }
.tarjeta-pedido:hover { border-color: var(--acento); }
.tarjeta-pedido--alerta { border-left: 5px solid var(--peligro); padding-left: 8px; }
.tp-miniatura { width: 60px; height: 60px; border-radius: 14px; overflow: hidden; background: var(--superficie-2); flex: none; }
.tp-miniatura img { width: 100%; height: 100%; object-fit: cover; }
.tp-miniatura--vela { display: grid; place-items: center; background: var(--rosa); }
.tp-cuerpo { min-width: 0; display: flex; flex-direction: column; gap: 3px; }
.tp-linea { display: flex; align-items: baseline; justify-content: space-between; gap: 8px; min-width: 0; }
.tp-nombre { font-weight: 800; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.tp-numero { font-weight: 800; }
.tp-detalle { font-size: 14px; color: var(--texto-2); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.tp-chips { display: flex; gap: 6px; flex-wrap: wrap; margin-top: 4px; }
.tp-aviso { display: flex; align-items: center; gap: 4px; font-size: 13px; font-weight: 700; color: var(--peligro); margin-top: 2px; }
.tp-aviso .icono { width: 15px; height: 15px; }
.tp-monto { flex: none; white-space: nowrap; font-variant-numeric: tabular-nums; }
.tp-monto strong { font-family: var(--fuente-titulo); font-weight: 600; font-size: 16px; }
.tp-chips .chip, .tp-chips .chip-pago { font-size: 12px; }
.tp-monto__etiqueta { font-size: 12px; color: var(--texto-2); font-weight: 700; }
.tp-monto--pagado { display: inline-flex; gap: 4px; align-items: center; color: var(--pago-pagado); font-weight: 800; font-size: 14px; }
.tp-monto--pagado .icono { width: 16px; height: 16px; }
.tp-monto--favor strong { color: var(--pago-pagado); }
.vela-ilustracion { width: 100%; height: 100%; display: grid; place-items: center; }
.vela-ilustracion svg { width: 78%; height: 78%; }

/* ---------------------------------------------------------------------
   Formularios
   --------------------------------------------------------------------- */
.formulario { display: flex; flex-direction: column; gap: 16px; }
.campo { display: flex; flex-direction: column; gap: 6px; min-width: 0; }
.campo__etiqueta { font-weight: 800; font-size: 15px; }
.campo__opcional { font-weight: 600; color: var(--texto-2); font-size: 14px; font-family: var(--fuente); }
.campo__ayuda { font-size: 13px; color: var(--texto-2); }
.campo__error { font-size: 14px; font-weight: 700; color: var(--peligro); }
.campo__error:empty { display: none; }
.control {
  width: 100%; min-height: 48px; padding: 11px 14px; border-radius: var(--radio-m);
  border: 1.5px solid var(--borde); background: var(--fondo); color: var(--texto); font-size: 16px;
  transition: border-color .15s ease, box-shadow .15s ease;
}
textarea.control { resize: vertical; min-height: 72px; line-height: 1.4; }
.control:focus { outline: none; border-color: var(--acento); box-shadow: 0 0 0 3px color-mix(in srgb, var(--acento) 30%, transparent); }
.campo--error .control, .control[aria-invalid="true"] { border-color: var(--peligro); }
.control--moneda { font-variant-numeric: tabular-nums; font-weight: 700; }
.control--centro { text-align: center; font-weight: 800; -moz-appearance: textfield; appearance: textfield; }
.control--centro::-webkit-outer-spin-button, .control--centro::-webkit-inner-spin-button { -webkit-appearance: none; margin: 0; }
select.control { appearance: none; background-image: linear-gradient(45deg, transparent 50%, var(--texto-2) 50%), linear-gradient(135deg, var(--texto-2) 50%, transparent 50%); background-position: calc(100% - 20px) 21px, calc(100% - 15px) 21px; background-size: 5px 5px; background-repeat: no-repeat; padding-right: 36px; }
.contador { display: grid; grid-template-columns: 44px 1fr 44px; gap: 6px; align-items: center; }
.contador__btn { height: 48px; border-radius: var(--radio-m); border: 1.5px solid var(--borde); background: var(--superficie); font-size: 22px; font-weight: 700; line-height: 1; }
.contador .control { padding: 11px 4px; }
.total-vivo { display: flex; justify-content: space-between; align-items: baseline; padding: 12px 14px; background: var(--rosa); border-radius: var(--radio-m); }
.total-vivo__etiqueta { font-weight: 800; }
.total-vivo__valor { font-family: var(--fuente-titulo); font-weight: 600; font-size: 24px; font-variant-numeric: tabular-nums; }
.atajos { display: flex; gap: 8px; margin-top: -4px; }
.atajo { min-height: 36px; padding: 4px 14px; border-radius: 999px; border: 1.5px dashed var(--borde); background: transparent; font-weight: 700; font-size: 14px; color: var(--texto-2); }
.atajo:hover { border-color: var(--acento); color: var(--texto); }
.barra-guardar { position: sticky; bottom: 0; padding: 12px 0 max(12px, env(safe-area-inset-bottom)); background: linear-gradient(to top, var(--fondo) 70%, transparent); z-index: 5; }

/* Interruptor */
.interruptor { display: flex; gap: 12px; align-items: center; cursor: pointer; }
.interruptor__input { position: absolute; opacity: 0; width: 1px; height: 1px; }
.interruptor__pista { position: relative; width: 50px; height: 30px; border-radius: 999px; background: var(--borde); flex: none; transition: background-color .2s ease; }
.interruptor__pista::after { content: ''; position: absolute; top: 3px; left: 3px; width: 24px; height: 24px; border-radius: 50%; background: var(--superficie); box-shadow: 0 1px 3px rgba(0, 0, 0, .25); transition: transform .2s ease; }
.interruptor__input:checked + .interruptor__pista { background: var(--acento); }
.interruptor__input:checked + .interruptor__pista::after { transform: translateX(20px); }
.interruptor__input:focus-visible + .interruptor__pista { outline: 3px solid var(--acento); outline-offset: 2px; }
.interruptor__titulo { display: block; font-weight: 800; }
.interruptor__texto { display: block; font-size: 13px; color: var(--texto-2); }

/* Cliente en el formulario */
.cliente-elegido { display: grid; grid-template-columns: auto 1fr auto; gap: 12px; align-items: center; padding: 10px 10px 10px 12px; border-radius: var(--radio-m); background: var(--superficie-2); }
.cliente-elegido .campo__error { grid-column: 1 / -1; }
.cliente-elegido__nombre { font-weight: 800; }
.cliente-elegido__telefono { font-size: 14px; color: var(--texto-2); }
.opciones-cliente { display: flex; flex-direction: column; gap: 4px; }
.opcion-cliente { display: flex; align-items: center; gap: 10px; padding: 8px 10px; border: none; border-radius: var(--radio-s); background: transparent; text-align: left; min-height: 52px; }
.opcion-cliente:hover, .opcion-cliente:focus-visible { background: var(--superficie-2); }
.opcion-cliente__textos { display: flex; flex-direction: column; }
.opcion-cliente__nombre { font-weight: 700; }
.opcion-cliente__telefono { font-size: 13px; color: var(--texto-2); }
.opciones-cliente__vacio { display: flex; flex-direction: column; gap: 8px; align-items: flex-start; padding: 8px 4px; color: var(--texto-2); font-size: 14px; }
.avatar { display: inline-grid; place-items: center; width: 42px; height: 42px; border-radius: 50%; background: var(--celeste); color: var(--est-solicitado-tinta); font-weight: 800; font-size: 15px; flex: none; }
.avatar--chico { width: 34px; height: 34px; font-size: 13px; }
.avatar--grande { width: 64px; height: 64px; font-size: 22px; background: var(--rosa); color: var(--est-entregado-tinta); }

/* Imagen de referencia */
.subir-imagen { display: flex; flex-direction: column; align-items: center; gap: 6px; padding: 24px 16px; border: 2px dashed var(--borde); border-radius: var(--radio); text-align: center; cursor: pointer; color: var(--texto-2); background: var(--fondo); }
.subir-imagen:hover { border-color: var(--acento); }
.subir-imagen .icono { width: 32px; height: 32px; color: var(--acento-tinta); }
.subir-imagen__titulo { font-weight: 800; color: var(--texto); }
.subir-imagen__texto { font-size: 13px; }
.vista-imagen { border-radius: var(--radio); overflow: hidden; background: var(--superficie-2); }
.vista-imagen img { width: 100%; max-height: 320px; object-fit: contain; }
.zona-imagen { display: flex; flex-direction: column; gap: 10px; }
.zona-imagen__procesando { display: flex; align-items: center; gap: 10px; padding: 24px; justify-content: center; color: var(--texto-2); font-weight: 700; }
.zona-logo { display: flex; align-items: center; gap: 14px; }
.zona-logo__img { width: 72px; height: 72px; border-radius: 50%; object-fit: cover; border: 1px solid var(--borde); }
.zona-logo__vacio { display: grid; place-items: center; width: 72px; height: 72px; border-radius: 50%; background: var(--superficie-2); color: var(--texto-2); }
.zona-logo__vacio .icono { width: 28px; height: 28px; }

/* ---------------------------------------------------------------------
   Detalle del pedido
   --------------------------------------------------------------------- */
.detalle-cabecera { display: grid; grid-template-columns: 132px 1fr; gap: 16px; align-items: center; }
.detalle-imagen { width: 132px; height: 132px; border-radius: var(--radio); overflow: hidden; background: var(--superficie-2); box-shadow: var(--sombra); }
.detalle-imagen img { width: 100%; height: 100%; object-fit: cover; }
.detalle-imagen--vela { background: var(--rosa); display: grid; place-items: center; }
.detalle-imagen[role="button"] { cursor: zoom-in; }
.detalle-cabecera__textos { display: flex; flex-direction: column; gap: 6px; align-items: flex-start; }
.detalle-producto { font-family: var(--fuente-titulo); font-weight: 600; font-size: 24px; line-height: 1.15; }
.detalle-color { color: var(--texto-2); font-weight: 600; }
.tarjeta-cliente { display: flex; align-items: center; gap: 12px; padding: 12px 14px; }
.tarjeta-cliente:hover { border-color: var(--acento); }
.tarjeta-cliente__textos { flex: 1; display: flex; flex-direction: column; min-width: 0; }
.tarjeta-cliente__nombre { font-weight: 800; }
.tarjeta-cliente__telefono { font-size: 14px; color: var(--texto-2); }
.tarjeta-cliente > .icono { color: var(--texto-2); }

.pasos { display: grid; grid-template-columns: repeat(3, 1fr); gap: 6px; margin-top: 12px; }
.paso { display: flex; flex-direction: column; align-items: center; gap: 6px; padding: 10px 4px; border-radius: var(--radio-m); border: 1.5px solid var(--borde); background: var(--superficie); color: var(--texto-2); font-weight: 700; font-size: 13px; line-height: 1.2; min-height: 76px; }
.paso__marca { display: grid; place-items: center; width: 28px; height: 28px; border-radius: 50%; background: var(--superficie-2); font-weight: 800; }
.paso__marca .icono { width: 16px; height: 16px; }
.paso--hecho { color: var(--texto); }
.paso--actual { border-color: transparent; color: var(--texto); }
.paso--actual.paso--solicitado { background: var(--est-solicitado-fondo); color: var(--est-solicitado-tinta); }
.paso--actual.paso--en_elaboracion { background: var(--est-elaboracion-fondo); color: var(--est-elaboracion-tinta); }
.paso--actual.paso--entregado { background: var(--est-entregado-fondo); color: var(--est-entregado-tinta); }
.paso--actual .paso__marca { background: var(--superficie); color: var(--texto); }

.fila-dato { display: flex; justify-content: space-between; align-items: baseline; gap: 16px; padding: 8px 0; border-bottom: 1px dashed var(--borde); font-size: 15px; }
.fila-dato:last-child { border-bottom: none; }
.fila-dato__etiqueta { color: var(--texto-2); flex: 1 1 auto; min-width: 0; }
.fila-dato__valor { flex: 0 1 auto; text-align: right; font-variant-numeric: tabular-nums; overflow-wrap: anywhere; }
.fila-dato__valor > span, .fila-dato__valor > strong, .sin-corte { white-space: nowrap; }
.fila-dato--total { border-bottom: none; }
.costo-venta { display: flex; flex-direction: column; gap: 4px; }
.costo-venta .tarjeta__titulo { margin-bottom: 4px; }
.abonos { padding: 6px 0; border-bottom: 1px dashed var(--borde); }
.abonos__titulo { font-weight: 800; font-size: 15px; margin-top: 4px; }
.abonos__vacio { font-size: 14px; padding: 4px 0; }
.abonos__lista { list-style: none; margin: 4px 0; padding: 0; display: flex; flex-direction: column; }
.abono { display: grid; grid-template-columns: 1fr auto auto; gap: 4px 8px; align-items: center; padding: 4px 0; }
.abono__textos { display: flex; flex-direction: column; min-width: 0; }
.abono__fecha { font-size: 14px; }
.abono__nota { font-size: 12px; color: var(--texto-2); }
.abono__monto { font-weight: 800; font-variant-numeric: tabular-nums; }
.saldo { display: flex; justify-content: space-between; align-items: center; gap: 12px; padding: 14px 16px; border-radius: var(--radio-m); margin: 8px 0; font-weight: 800; }
.saldo span { display: inline-flex; align-items: center; gap: 6px; }
.saldo strong { font-family: var(--fuente-titulo); font-weight: 600; font-size: 26px; font-variant-numeric: tabular-nums; }
.saldo--debe { background: var(--amarillo); color: var(--aviso-tinta); }
.saldo--favor { background: var(--celeste); color: var(--est-solicitado-tinta); }
.saldo--pagado { background: var(--superficie-2); color: var(--pago-pagado); }
.saldo--pagado strong { font-size: 20px; }
.costo-venta__ganancias { margin-top: 12px; padding-top: 4px; border-top: 1px solid var(--borde); }
.fila-dato--ganancia .fila-dato__valor { font-weight: 800; }
.notas { padding-top: 8px; }
.notas__titulo { color: var(--texto-2); font-size: 15px; }
.notas__texto { white-space: pre-wrap; margin-top: 2px; }

/* Menú de opciones */
.menu-lista { display: flex; flex-direction: column; }
.menu-lista__item { display: flex; align-items: center; gap: 12px; min-height: 52px; padding: 8px 6px; border: none; background: transparent; font-weight: 700; text-align: left; border-radius: var(--radio-s); }
.menu-lista__item:hover { background: var(--superficie-2); }
.menu-lista__item--peligro { color: var(--peligro); }

/* ---------------------------------------------------------------------
   Clientes
   --------------------------------------------------------------------- */
.tarjeta-cliente-lista { display: flex; align-items: center; gap: 12px; padding: 12px 14px; background: var(--superficie); border: 1px solid var(--borde); border-radius: var(--radio); box-shadow: var(--sombra); }
.tarjeta-cliente-lista:hover { border-color: var(--acento); }
.tcl-cuerpo { flex: 1; min-width: 0; display: flex; flex-direction: column; }
.tcl-nombre { font-weight: 800; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.tcl-detalle { font-size: 13px; color: var(--texto-2); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.tcl-debe { display: flex; flex-direction: column; align-items: flex-end; font-variant-numeric: tabular-nums; }
.tcl-debe strong { font-family: var(--fuente-titulo); font-weight: 600; font-size: 16px; white-space: nowrap; }
.tcl-al-dia { font-size: 13px; font-weight: 800; color: var(--pago-pagado); }
.ficha-cliente { display: grid; grid-template-columns: auto 1fr; gap: 12px 14px; align-items: center; }
.ficha-cliente > .btn, .ficha-cliente > .campo__error { grid-column: 1 / -1; justify-self: start; }
.ficha-cliente__telefono { font-weight: 800; font-size: 18px; }

/* ---------------------------------------------------------------------
   Papelera
   --------------------------------------------------------------------- */
.fila-papelera { display: grid; grid-template-columns: auto 1fr; gap: 10px 12px; align-items: center; padding: 12px; background: var(--superficie); border: 1px solid var(--borde); border-radius: var(--radio); }
.fila-papelera > .tp-miniatura { width: 48px; height: 48px; }
.fila-papelera__titulo { font-weight: 800; overflow-wrap: anywhere; }
.fila-papelera__detalle { font-size: 13px; color: var(--texto-2); }
.fila-papelera__acciones { grid-column: 1 / -1; display: flex; justify-content: flex-end; gap: 8px; align-items: center; }

/* ---------------------------------------------------------------------
   Recibo
   --------------------------------------------------------------------- */
.recibo { background: var(--superficie); border: 1px solid var(--borde); border-radius: var(--radio); box-shadow: var(--sombra); overflow: hidden; }
.recibo__cabecera { display: flex; gap: 14px; align-items: center; background: #F9D5E5; color: #3D3A3A; padding: 20px; }
.recibo__logo { width: 56px; height: 56px; border-radius: 50%; object-fit: cover; background: #fff; }
.recibo__negocio { font-family: var(--fuente-titulo); font-weight: 600; font-size: 22px; }
.recibo__sub { font-size: 14px; color: #5E5656; }
.recibo__cuerpo { padding: 16px 20px; display: flex; flex-direction: column; gap: 2px; }
.recibo__etiqueta { font-size: 12px; font-weight: 800; letter-spacing: .06em; text-transform: uppercase; color: var(--texto-2); margin-top: 4px; }
.recibo__fuerte { font-weight: 800; font-size: 17px; }
.recibo__linea { border: none; border-top: 1px solid var(--borde); margin: 12px 0 6px; width: 100%; }
.recibo__pie { text-align: center; padding: 4px 20px 20px; font-family: var(--fuente-titulo); font-weight: 600; font-size: 17px; }
.recibo__pie .texto-suave { font-family: var(--fuente); font-weight: 400; font-size: 14px; }
.acciones-recibo { margin-top: 4px; }

/* ---------------------------------------------------------------------
   PIN
   --------------------------------------------------------------------- */
.pin-pantalla { min-height: calc(100vh - 64px); min-height: calc(100dvh - 64px); display: grid; place-items: center; }
.pin { width: 100%; max-width: 360px; display: flex; flex-direction: column; align-items: center; gap: 10px; text-align: center; }
.pin__marca { display: flex; flex-direction: column; align-items: center; gap: 4px; margin-bottom: 8px; }
.pin__vela { width: 76px; height: 76px; background: var(--rosa); border-radius: 24px; }
.pin__negocio { font-weight: 800; color: var(--texto-2); }
.pin__titulo { font-size: 28px; }
.pin__texto { color: var(--texto-2); max-width: 300px; }
.pin__zona { width: 100%; display: flex; flex-direction: column; align-items: center; gap: 20px; margin-top: 10px; }
.pin__mensaje { min-height: 24px; font-weight: 700; color: var(--peligro); max-width: 320px; }
.pin__codigo { width: 100%; display: flex; flex-direction: column; gap: 10px; text-align: left; }
.pin__codigo .control { text-align: center; font-weight: 800; letter-spacing: .1em; font-size: 20px; }
.pin__codigo .enlace { align-self: center; }
.pin-puntos { display: flex; gap: 14px; }
.pin-punto { width: 16px; height: 16px; border-radius: 50%; border: 2px solid var(--texto-2); transition: background-color .12s ease, transform .12s ease; }
.pin-punto--lleno { background: var(--texto); border-color: var(--texto); transform: scale(1.1); }
.pin-puntos--error { animation: sacudir .4s ease; }
@keyframes sacudir { 20%, 60% { transform: translateX(-8px); } 40%, 80% { transform: translateX(8px); } }
.teclado { display: grid; grid-template-columns: repeat(3, 76px); gap: 14px 22px; }
.tecla { width: 76px; height: 76px; border-radius: 50%; border: none; background: var(--superficie); box-shadow: var(--sombra); font-family: var(--fuente-titulo); font-size: 30px; font-weight: 500; color: var(--texto); display: grid; place-items: center; }
.tecla:active { background: var(--rosa); }
.tecla--texto { font-family: var(--fuente); font-size: 13px; font-weight: 700; line-height: 1.15; background: transparent; box-shadow: none; color: var(--acento-tinta); padding: 4px; }
.tecla--icono { background: transparent; box-shadow: none; }
.tecla--icono .icono { width: 28px; height: 28px; }
.tecla--vacia { background: transparent; box-shadow: none; }
.pin--bloqueado .teclado { opacity: .4; pointer-events: none; }

/* ---------------------------------------------------------------------
   Navegación inferior
   --------------------------------------------------------------------- */
.nav-inferior {
  position: fixed; left: 0; right: 0; bottom: 0; z-index: 20;
  display: grid; grid-template-columns: repeat(4, 1fr); align-items: end;
  max-width: var(--ancho); margin: 0 auto;
  padding: 6px 8px max(8px, env(safe-area-inset-bottom));
  background: var(--superficie); border-top: 1px solid var(--borde); box-shadow: var(--sombra-alta);
}
@media (min-width: 560px) { .nav-inferior { border: 1px solid var(--borde); border-radius: 24px 24px 0 0; } }
.nav-item { display: flex; flex-direction: column; align-items: center; gap: 2px; min-height: 56px; justify-content: center; font-size: 12px; font-weight: 700; color: var(--texto-2); border-radius: 14px; }
.nav-item .icono { width: 24px; height: 24px; }
.nav-item--activo { color: var(--texto); }
.nav-item--activo:not(.nav-nuevo) .icono { color: var(--acento-tinta); }
.nav-nuevo { justify-content: flex-end; }
.nav-nuevo__circulo { display: grid; place-items: center; width: 58px; height: 58px; border-radius: 50%; background: var(--acento); color: #3D3A3A; margin-top: -26px; box-shadow: 0 6px 16px color-mix(in srgb, var(--acento) 45%, transparent); border: 4px solid var(--superficie); }
.nav-nuevo__circulo .icono { width: 28px; height: 28px; }

/* ---------------------------------------------------------------------
   Hoja inferior, visor y avisos breves
   --------------------------------------------------------------------- */
.hoja-fondo { position: fixed; inset: 0; z-index: 50; background: rgba(30, 25, 28, 0); display: flex; align-items: flex-end; justify-content: center; transition: background-color .2s ease; }
.hoja-fondo--visible { background: rgba(30, 25, 28, .45); }
.hoja { width: 100%; max-width: var(--ancho); max-height: 92vh; max-height: 92dvh; overflow-y: auto; background: var(--superficie); border-radius: 24px 24px 0 0; padding: 8px 20px max(20px, env(safe-area-inset-bottom)); transform: translateY(100%); transition: transform .22s ease; outline: none; }
.hoja-fondo--visible .hoja { transform: none; }
.hoja__asa { width: 40px; height: 5px; border-radius: 999px; background: var(--borde); margin: 4px auto 8px; }
.hoja__cabecera { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin-bottom: 8px; }
.hoja__titulo { font-size: 20px; }
.hoja__cuerpo { display: flex; flex-direction: column; gap: 12px; }
.hoja__acciones { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; margin-top: 20px; }
.visor { position: fixed; inset: 0; z-index: 60; background: rgba(20, 16, 18, .92); display: grid; place-items: center; padding: 16px; cursor: zoom-out; }
.visor img { max-height: 90vh; max-width: 100%; border-radius: 12px; object-fit: contain; }
.visor__cerrar { position: absolute; top: max(12px, env(safe-area-inset-top)); right: 12px; color: #fff; background: rgba(255, 255, 255, .12); }
.toast-zona { position: fixed; left: 50%; transform: translateX(-50%); bottom: calc(var(--nav-alto) + 24px + env(safe-area-inset-bottom)); z-index: 70; display: flex; flex-direction: column; gap: 8px; width: min(92vw, 420px); pointer-events: none; }
body:not(.con-nav) .toast-zona { bottom: calc(24px + env(safe-area-inset-bottom)); }
.toast { display: flex; gap: 10px; align-items: center; padding: 12px 16px; border-radius: 16px; background: var(--texto); color: var(--fondo); font-weight: 700; box-shadow: 0 8px 24px rgba(0, 0, 0, .2); animation: entrar .2s ease; }
.toast .icono { width: 20px; height: 20px; }
.toast--error { background: var(--peligro); color: #fff; }
:root[data-tema="oscuro"] .toast--error { color: #2A1414; }
.toast--saliendo { opacity: 0; transform: translateY(8px); transition: opacity .3s ease, transform .3s ease; }
@keyframes entrar { from { opacity: 0; transform: translateY(8px); } }

/* ---------------------------------------------------------------------
   Estados vacíos y de carga
   --------------------------------------------------------------------- */
.vacio { display: flex; flex-direction: column; align-items: center; gap: 8px; text-align: center; padding: 32px 16px; background: var(--superficie); border: 1px dashed var(--borde); border-radius: var(--radio); }
.vacio__icono { display: grid; place-items: center; width: 56px; height: 56px; border-radius: 18px; background: var(--rosa); color: var(--est-entregado-tinta); margin-bottom: 4px; }
.vacio__icono .icono { width: 28px; height: 28px; }
.vacio__titulo { font-family: var(--fuente-titulo); font-weight: 600; font-size: 19px; }
.vacio__texto { color: var(--texto-2); max-width: 300px; }
.vacio .btn { margin-top: 8px; }
.esqueleto { display: flex; flex-direction: column; gap: 10px; opacity: 0; animation: aparecer .2s ease .15s forwards; }
.esqueleto__fila { height: 84px; border-radius: var(--radio); background: linear-gradient(90deg, var(--superficie-2), var(--superficie), var(--superficie-2)); background-size: 200% 100%; animation: brillo 1.2s ease-in-out infinite; }
@keyframes aparecer { to { opacity: 1; } }
@keyframes brillo { to { background-position: -200% 0; } }
.pie-version { text-align: center; color: var(--texto-2); font-size: 13px; padding: 8px 0; }
.sin-js { padding: 24px; text-align: center; }

@media (max-width: 380px) {
  .kpi__valor--grande { font-size: 34px; }
  .detalle-cabecera { grid-template-columns: 104px 1fr; }
  .detalle-imagen { width: 104px; height: 104px; }
  .teclado { grid-template-columns: repeat(3, 68px); gap: 12px 18px; }
  .tecla { width: 68px; height: 68px; }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: .01ms !important; animation-iteration-count: 1 !important; transition-duration: .01ms !important; }
}

/* Usuario de consulta: sin botones para crear, editar, borrar, abonar ni avisar */
body.solo-consulta .solo-principal, body.solo-consulta .nav-nuevo { display: none !important; }
body.solo-consulta .nav-inferior { grid-template-columns: repeat(3, 1fr); }
body.solo-consulta .paso[disabled] { cursor: default; opacity: 1; }
.insignia-consulta { background: var(--celeste); color: var(--est-solicitado-tinta); }

/* Impresión: solo el recibo (Guardar como PDF) */
@media print {
  body { background: #fff; }
  .nav-inferior, .barra-superior, .acciones-recibo, .toast-zona { display: none !important; }
  .app { padding: 0; max-width: none; }
  .recibo { box-shadow: none; border: 1px solid #ddd; }
}
