:root {
  --fondo: #0a1310; --sup: #12201a; --sup2: #192c24; --linea: #26392f;
  --texto: #eaf2ec; --muted: #93a79b; --verde: #17b095; --verde2: #7be0c9; --rosa: #f4a9ae;
  --ok: #2fbf71; --medio: #e0b341; --falta: #e5646b;
  color-scheme: dark;
}
* { box-sizing: border-box; }
body { margin: 0; background: radial-gradient(1200px 600px at 80% -10%, #14372c 0%, transparent 60%), var(--fondo);
  background-attachment: fixed; color: var(--texto); font: 16px/1.5 system-ui, "Segoe UI", Roboto, sans-serif; }
a { color: var(--verde2); }
h1, h2, h3 { line-height: 1.15; margin: 0; }
h2 { font-size: 1.1rem; } h3 { font-size: 1rem; margin-top: 16px; }
main { max-width: 1100px; margin: 0 auto; padding: 20px 16px 80px; display: grid; gap: 16px; }
.muted { color: var(--muted); } .chica { font-size: .85rem; margin: 2px 0; } .der { text-align: right; }
.sobre { color: var(--verde); font-size: .75rem; letter-spacing: .14em; font-weight: 700; margin: 0; text-transform: uppercase; }
.titulo { font-size: clamp(1.6rem, 4vw, 2.2rem); font-weight: 800; letter-spacing: -.02em; }
.cat { margin-top: 12px; color: var(--rosa); text-transform: uppercase; letter-spacing: .1em; font-size: .9rem; }

/* Navegación */
nav { position: sticky; top: 0; z-index: 5; display: flex; align-items: center; gap: 12px; padding: 10px 16px;
  background: #0a1310e6; backdrop-filter: blur(8px); border-bottom: 1px solid var(--linea); }
nav:empty { display: none; }
.marca { font-weight: 800; letter-spacing: .08em; color: var(--texto); text-decoration: none; white-space: nowrap; }
.marca b { color: var(--verde); }
.links { display: flex; gap: 4px; overflow-x: auto; flex: 1; scrollbar-width: none; }
.links a { padding: 6px 12px; border-radius: 99px; color: var(--muted); text-decoration: none; white-space: nowrap; font-size: .92rem; }
.links a.on { background: var(--sup2); color: var(--texto); }

/* Piezas */
.tarjeta { background: var(--sup); border: 1px solid var(--linea); border-radius: 16px; padding: 16px; display: grid; gap: 10px; }
.tarjeta.alerta { border-color: #6b5a1e; background: #2a2510; }
.tarjeta.demo { border-style: dashed; }
.btn { display: inline-flex; align-items: center; justify-content: center; gap: 6px; padding: 10px 16px; border-radius: 99px;
  border: 1px solid var(--linea); background: var(--sup2); color: var(--texto); font: inherit; font-weight: 600;
  cursor: pointer; text-decoration: none; width: fit-content; }
.btn:hover { border-color: var(--verde); }
.btn.primario { background: var(--verde); border-color: var(--verde); color: #04201a; }
.btn.wsp { background: #25d366; border-color: #25d366; color: #052e16; }
.btn.peligro { color: var(--falta); }
.btn.chico { padding: 6px 12px; font-size: .85rem; }
.btn.grande { width: 100%; padding: 14px; font-size: 1.05rem; }
.btn:disabled { opacity: .5; cursor: default; }
.fila { display: flex; flex-wrap: wrap; gap: 10px; align-items: center; }
.fila.entre { justify-content: space-between; }
.barra { display: flex; flex-wrap: wrap; gap: 10px; align-items: center; }
.barra .titulo { flex: 1; }
.renglon { padding: 8px 0; border-top: 1px solid var(--linea); }
.chip { display: inline-block; padding: 2px 10px; border-radius: 99px; font-size: .75rem; font-weight: 700;
  background: var(--sup2); color: var(--muted); white-space: nowrap; }
.chip.ok { background: #123b26; color: #7ee2a8; } .chip.medio { background: #3d3212; color: #f0cf6b; } .chip.falta { background: #43191c; color: #f59aa0; }

/* Formularios */
.grilla { display: grid; grid-template-columns: repeat(auto-fit, minmax(220px, 1fr)); gap: 12px; align-items: end; }
.ancho { grid-column: 1 / -1; }
.campo { display: grid; gap: 4px; font-size: .85rem; color: var(--muted); }
input, select, textarea { font: inherit; color: var(--texto); background: var(--fondo); border: 1px solid var(--linea);
  border-radius: 10px; padding: 10px 12px; width: 100%; min-width: 0; }
input:focus, select:focus, textarea:focus { outline: 2px solid var(--verde); outline-offset: 0; border-color: transparent; }
.barra input[type=search] { flex: 1; min-width: 200px; } .barra select, .fila select { width: auto; }
.check { display: inline-flex; gap: 8px; align-items: center; color: var(--texto); }
.check input { width: 18px; height: 18px; accent-color: var(--verde); }
.pestanas { display: grid; grid-template-columns: 1fr 1fr; background: var(--fondo); border-radius: 99px; padding: 4px; }
.pestanas button { border: 0; background: none; color: var(--muted); font: inherit; font-weight: 600; padding: 8px; border-radius: 99px; cursor: pointer; }
.pestanas .on { background: var(--sup2); color: var(--texto); }

/* Portada */
.portada { max-width: 440px; margin: 4vh auto 0; display: grid; gap: 14px; }
.portada h1 { font-size: clamp(3rem, 14vw, 4.6rem); font-weight: 900; letter-spacing: -.04em; line-height: .95; }

/* Pasos del alta */
.paso header { display: flex; align-items: center; gap: 10px; }
.paso header h2 { flex: 1; }
.paso .n { width: 28px; height: 28px; border-radius: 50%; background: var(--verde); color: #04201a; font-weight: 800;
  display: grid; place-items: center; flex: none; }
.fotos { display: grid; grid-template-columns: repeat(auto-fit, minmax(160px, 1fr)); gap: 12px; }
.foto { display: grid; gap: 6px; justify-items: start; }
.marco { width: 100%; aspect-ratio: 1.58; border: 1px dashed var(--linea); border-radius: 12px; display: grid; place-items: center;
  overflow: hidden; background: var(--fondo); }
.marco img { width: 100%; height: 100%; object-fit: cover; display: block; }
#firma { width: 100%; max-width: 700px; height: auto; background: #fff; border-radius: 12px; touch-action: none; cursor: crosshair; }

/* Catálogo */
.catalogo { display: grid; grid-template-columns: repeat(auto-fill, minmax(240px, 1fr)); gap: 14px; }
.producto { background: var(--sup); border: 1px solid var(--linea); border-radius: 18px; overflow: hidden; display: flex; flex-direction: column; }
.producto .img { aspect-ratio: 4 / 5; background: linear-gradient(135deg, #1d4034, #0d1f19 60%), var(--sup2); }
.producto .img img { width: 100%; height: 100%; object-fit: cover; display: block; }
.producto .info { padding: 14px; display: grid; gap: 6px; flex: 1; align-content: start; }
.producto h3 { margin: 0; font-size: 1.25rem; text-transform: uppercase; letter-spacing: -.01em; }
.cant { display: inline-flex; align-items: center; gap: 4px; background: var(--fondo); border-radius: 99px; padding: 3px; }
.cant button { width: 34px; height: 34px; border-radius: 50%; border: 0; background: var(--sup2); color: var(--texto); font-size: 1.2rem; cursor: pointer; }
.cant output { min-width: 28px; text-align: center; font-weight: 700; }
.pedido { position: sticky; bottom: 10px; border-color: var(--verde); box-shadow: 0 10px 30px #000a; }

/* Tablas */
.scroll { overflow-x: auto; border: 1px solid var(--linea); border-radius: 14px; background: var(--sup); }
table { border-collapse: collapse; width: 100%; font-size: .9rem; }
th, td { padding: 9px 10px; text-align: left; border-bottom: 1px solid var(--linea); white-space: nowrap; }
th { color: var(--muted); font-size: .72rem; text-transform: uppercase; letter-spacing: .06em; }
tr:last-child td { border-bottom: 0; }
tr.clic { cursor: pointer; } tr.clic:hover { background: var(--sup2); }
.grillaAportes td.pago { color: #7ee2a8; text-align: center; font-weight: 800; background: #123b2655; }
.grillaAportes td.nopago { color: var(--muted); text-align: center; }
.grillaAportes th:nth-child(n+3) { text-align: center; }
tr.total td { font-weight: 700; background: var(--sup2); }

dialog { background: var(--sup); color: var(--texto); border: 1px solid var(--linea); border-radius: 18px; padding: 20px;
  width: min(720px, calc(100vw - 24px)); }
dialog[open] { display: grid; gap: 12px; }
dialog::backdrop { background: #000a; }
.aviso { position: fixed; left: 50%; bottom: 20px; transform: translate(-50%, 80px); background: var(--verde); color: #04201a;
  padding: 10px 18px; border-radius: 99px; font-weight: 700; transition: transform .2s; z-index: 20; max-width: calc(100vw - 24px); }
.aviso.ver { transform: translate(-50%, 0); } .aviso.mal { background: var(--falta); color: #fff; }

/* La hoja (carta / nota) */
.hoja { background: #fff; color: #111; font: 12pt/1.5 Georgia, "Times New Roman", serif; padding: 40px clamp(20px, 6vw, 60px);
  border-radius: 6px; max-width: 800px; width: 100%; margin: 0 auto; }
.hoja h1 { font-size: 12pt; text-align: center; margin-bottom: 18px; }
.hoja p { margin: 0 0 12px; text-align: justify; }
.hoja .fecha { text-align: right; } .hoja .destinatario { font-weight: 700; text-align: left; margin: 20px 0; }
.hoja .sangria { text-indent: 2.5em; }
.hoja .firmas { margin-top: 28px; display: grid; gap: 14px; }
.hoja .firmas img { display: block; height: 80px; }
.hoja .raya { display: inline-block; width: 240px; border-bottom: 1px solid #111; }
.hoja .raya.alta { height: 70px; }
.hoja .pie { margin-top: 26px; font-size: 10pt; font-weight: 700; }

@media print {
  @page { size: A4; margin: 18mm; }
  body { background: #fff; }
  .noimp, nav, .aviso { display: none !important; }
  main { padding: 0; max-width: none; display: block; }
  .hoja { padding: 0; max-width: none; border-radius: 0; }
}
