:root {
  --fondo: #f6f6f4; --tarjeta: #fff; --texto: #1b1b1b; --suave: #6b6b6b; --borde: #e2e2de;
  --acento: #f5b800; --acento-texto: #111; --rojo: #c62828; --verde: #2e7d32; --azul: #1565c0;
  --radio: 12px;
}
* { box-sizing: border-box; }
[hidden] { display: none !important; }
body { margin: 0; font-family: system-ui, -apple-system, "Segoe UI", Roboto, sans-serif; background: var(--fondo); color: var(--texto); font-size: 16px; }
button, input, select, textarea { font: inherit; }
.barra { position: sticky; top: 0; z-index: 5; display: flex; gap: 12px; align-items: center; padding: 10px 16px; background: #111; color: #fff; flex-wrap: wrap; }
.barra a { color: #fff; text-decoration: none; }
.marca { font-weight: 800; color: var(--acento) !important; margin-right: 8px; }
.barra nav { display: flex; gap: 14px; flex: 1; flex-wrap: wrap; }
.barra nav a { opacity: .8; } .barra nav a.activo { opacity: 1; border-bottom: 2px solid var(--acento); }
.enlace { background: none; border: 0; color: inherit; cursor: pointer; text-decoration: underline; padding: 0; }
main { max-width: 980px; margin: 0 auto; padding: 16px; }
h1 { font-size: 1.4rem; margin: 4px 0 14px; } h2 { font-size: 1.1rem; margin: 18px 0 8px; }
.tarjeta { background: var(--tarjeta); border: 1px solid var(--borde); border-radius: var(--radio); padding: 14px; margin-bottom: 12px; overflow-x: auto; }
#btnSalir { margin-left: auto; order: 2; }
.fila { display: flex; gap: 10px; align-items: center; flex-wrap: wrap; }
.fila > .crece { flex: 1; min-width: 180px; }
label { display: block; font-size: .85rem; color: var(--suave); margin-bottom: 4px; }
label.fila { display: flex; flex-wrap: nowrap; gap: 8px; align-items: center; font-size: .95rem; }
label.fila input[type=checkbox] { flex: none; width: 20px !important; height: 20px; margin: 0; }
input, select, textarea { width: 100%; padding: 10px 12px; border: 1px solid var(--borde); border-radius: 10px; background: #fff; color: var(--texto); }
input:focus, select:focus { outline: 2px solid var(--acento); border-color: transparent; }
.btn { display: inline-block; text-decoration: none; border: 0; border-radius: 10px; padding: 10px 16px; cursor: pointer; background: #e9e9e5; color: var(--texto); font-weight: 600; }
.btn.principal { background: var(--acento); color: var(--acento-texto); }
.btn.peligro { background: #fbe9e9; color: var(--rojo); }
.btn.chico { padding: 6px 10px; font-size: .85rem; }
.btn:disabled { opacity: .5; cursor: default; }
.segmento { display: inline-flex; border: 1px solid var(--borde); border-radius: 10px; overflow: hidden; }
.segmento button { border: 0; background: #fff; padding: 9px 14px; cursor: pointer; font-weight: 600; }
.segmento button.activo { background: #111; color: #fff; }
.lista-busqueda { border: 1px solid var(--borde); border-radius: 10px; margin-top: 6px; max-height: 280px; overflow: auto; background: #fff; }
.lista-busqueda button { display: flex; justify-content: space-between; gap: 8px; width: 100%; text-align: left; padding: 10px 12px; border: 0; border-bottom: 1px solid var(--borde); background: #fff; cursor: pointer; }
.lista-busqueda button:hover { background: #fafaf5; }
.suave { color: var(--suave); font-size: .85rem; }
.linea { border-top: 1px solid var(--borde); padding: 12px 0; }
.linea:first-child { border-top: 0; }
.linea-cab { display: flex; justify-content: space-between; gap: 8px; align-items: baseline; }
.linea-campos { display: grid; grid-template-columns: auto 90px 120px auto; gap: 8px; align-items: end; margin-top: 8px; }
.chips { display: flex; gap: 6px; flex-wrap: wrap; margin-top: 6px; }
.chip { border: 1px solid var(--borde); background: #fff; border-radius: 999px; padding: 4px 10px; font-size: .85rem; cursor: pointer; }
.alerta { color: var(--rojo); font-size: .85rem; font-weight: 600; }
.total { display: flex; justify-content: space-between; font-size: 1.4rem; font-weight: 800; margin: 8px 0 12px; }
table { width: 100%; border-collapse: collapse; }
th, td { text-align: left; padding: 8px 6px; border-bottom: 1px solid var(--borde); vertical-align: top; }
th { font-size: .8rem; color: var(--suave); font-weight: 600; }
td.num, th.num { text-align: right; white-space: nowrap; }
.etiqueta { display: inline-block; padding: 2px 8px; border-radius: 999px; font-size: .75rem; font-weight: 700; }
.e-cotizacion { background: #fff4d6; color: #8a6300; } .e-pagada { background: #e3f3e4; color: var(--verde); } .e-anulada { background: #eee; color: #777; }
.recibo { background: #fff; max-width: 640px; margin: 0 auto; padding: 24px; border: 1px solid var(--borde); border-radius: var(--radio); }
.recibo-cab { display: flex; gap: 14px; align-items: center; border-bottom: 1px solid var(--borde); padding-bottom: 14px; margin-bottom: 10px; }
.recibo-logo { width: 64px; height: 64px; border-radius: 50%; background: #111; color: var(--acento); display: grid; place-items: center; font-weight: 800; flex: none; }
.recibo-datos div { display: flex; justify-content: space-between; padding: 5px 0; font-size: .92rem; }
.recibo-datos b { text-align: right; }
.recibo-total { display: flex; justify-content: space-between; font-size: 1.5rem; font-weight: 800; margin-top: 16px; }
.solo-dueno { background: #f2f7ff; border: 1px dashed var(--azul); border-radius: 10px; padding: 10px 12px; margin-top: 12px; font-size: .9rem; }
.acciones { display: flex; gap: 8px; flex-wrap: wrap; justify-content: center; margin: 14px 0; }
.modal { position: fixed; inset: 0; background: rgba(0,0,0,.45); display: grid; place-items: center; padding: 16px; z-index: 20; }
.modal-caja { background: #fff; border-radius: var(--radio); padding: 18px; width: 100%; max-width: 560px; max-height: calc(100vh - 32px); overflow: auto; }
.modal-caja table td, .modal-caja table th { font-size: .85rem; padding: 6px 4px; }
.modal-caja .fila { margin-top: 12px; justify-content: flex-end; }
.aviso { position: fixed; left: 50%; bottom: 20px; transform: translateX(-50%); background: #111; color: #fff; padding: 10px 16px; border-radius: 10px; z-index: 30; max-width: calc(100% - 32px); }
.aviso.error { background: var(--rojo); }
.cargando { color: var(--suave); }
.entrar { max-width: 360px; margin: 40px auto; }
.entrar .tarjeta > * + * { margin-top: 10px; }
@media (max-width: 600px) {
  .linea-campos { grid-template-columns: 1fr 1fr; }
  .barra nav { order: 3; width: 100%; flex: none; }
  th, td { padding: 8px 4px; font-size: .9rem; }
  .recibo { padding: 16px; border: 0; }
}
@media print {
  body { background: #fff; }
  .barra, .acciones, .solo-dueno, .no-imprimir { display: none !important; }
  main { padding: 0; } .recibo { border: 0; }
}
