/* Arousa Gestión — herramienta de recepción. */
:root {
  --bg: #f3f5f4; --surface: #ffffff; --surface-2: #eaeeec; --fg: #17201c; --muted: #5d6a64; --line: #d5dcd8;
  --accent: #0f6b52; --accent-fg: #ffffff; --accent-soft: #dcefe8;
  --ok: #1d7a3e; --ok-soft: #e1f3e6; --warn: #a15c00; --warn-soft: #fbeed8; --bad: #b3261e; --bad-soft: #fbe3e1;
  --f-ui: "Public Sans", system-ui, -apple-system, "Segoe UI", sans-serif;
  --f-num: "JetBrains Mono", ui-monospace, "SFMono-Regular", Menlo, Consolas, monospace;
  color-scheme: light;
}
@media (prefers-color-scheme: dark) {
  :root {
    --bg: #111715; --surface: #19211e; --surface-2: #222c28; --fg: #e6ece9; --muted: #9aa8a1; --line: #2f3a36;
    --accent: #4cc39a; --accent-fg: #0c1512; --accent-soft: #1d3a30;
    --ok: #6fd38f; --ok-soft: #1c3324; --warn: #f0b35a; --warn-soft: #3a2c14; --bad: #f28b82; --bad-soft: #3d1f1d;
    color-scheme: dark;
  }
}
* { box-sizing: border-box; }
html, body { margin: 0; }
body { background: var(--bg); color: var(--fg); font: 15px/1.45 var(--f-ui); }
[hidden] { display: none !important; }
a { color: var(--accent); }
button:focus-visible, input:focus-visible, select:focus-visible, textarea:focus-visible, a:focus-visible {
  outline: 2px solid var(--accent); outline-offset: 2px;
}
.cargando { padding: 40px 20px; color: var(--muted); text-align: center; }

/* Cabecera */
.top { background: var(--surface); border-bottom: 1px solid var(--line); position: sticky; top: 0; z-index: 5; }
.top-in { max-width: 1240px; margin: 0 auto; display: flex; flex-wrap: wrap; gap: 8px 20px; align-items: center;
  padding: 10px max(16px, env(safe-area-inset-right)) 10px max(16px, env(safe-area-inset-left)); }
.marca { font-weight: 700; font-size: 17px; letter-spacing: -.01em; margin-right: auto; }
.marca small { display: block; font-weight: 500; font-size: 12px; color: var(--muted); }
nav.menu { display: flex; gap: 4px; flex-wrap: wrap; background: var(--surface-2); padding: 4px; border-radius: 10px; }
nav.menu a { color: var(--muted); font-weight: 600; font-size: 14px; padding: 7px 12px; border-radius: 7px; text-decoration: none; }
nav.menu a.on { background: var(--surface); color: var(--fg); box-shadow: 0 1px 2px rgba(0,0,0,.12); }
.yo { display: flex; gap: 10px; align-items: center; font-size: 13px; color: var(--muted); }
.yo strong { color: var(--fg); }

main { max-width: 1240px; margin: 0 auto; padding: 18px max(16px, env(safe-area-inset-right)) 60px max(16px, env(safe-area-inset-left)); }
h1 { font-size: 22px; margin: 0; letter-spacing: -.01em; }
.cabecera { display: flex; flex-wrap: wrap; gap: 10px 16px; align-items: center; justify-content: space-between; margin-bottom: 6px; }
.sub { color: var(--muted); font-size: 13px; margin: 4px 0 16px; }

/* Paneles y rejillas */
.grid { display: grid; grid-template-columns: minmax(0, 1.6fr) minmax(0, 1fr); gap: 18px; align-items: start; }
.grid.una { grid-template-columns: minmax(0, 1fr); }
@media (max-width: 900px) { .grid { grid-template-columns: minmax(0, 1fr); } }
.stack { display: flex; flex-direction: column; gap: 18px; min-width: 0; }
.panel { background: var(--surface); border: 1px solid var(--line); border-radius: 12px; padding: 16px; min-width: 0; }
.panel h2 { font-size: 12px; text-transform: uppercase; letter-spacing: .07em; color: var(--muted); margin: 0 0 12px; font-weight: 700; }
.panel h2 .der { float: right; text-transform: none; letter-spacing: 0; }

.totals { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 10px; margin-bottom: 18px; }
.totals.tres { grid-template-columns: repeat(3, minmax(0, 1fr)); }
@media (max-width: 720px) { .totals, .totals.tres { grid-template-columns: repeat(2, minmax(0, 1fr)); } }
.tot { background: var(--surface); border: 1px solid var(--line); border-radius: 10px; padding: 12px; min-width: 0; }
.tot .k { font-size: 12px; color: var(--muted); font-weight: 600; }
.tot .v { font: 600 20px var(--f-num); font-variant-numeric: tabular-nums; margin-top: 4px; }
.tot .n { font-size: 12px; color: var(--muted); }
.tot.dest { border-color: var(--accent); background: var(--accent-soft); }

/* Formularios */
.form { display: grid; grid-template-columns: repeat(12, minmax(0, 1fr)); gap: 10px; align-items: end; }
.form > * { grid-column: span 12; }
.c2 { grid-column: span 2 !important; } .c3 { grid-column: span 3 !important; } .c4 { grid-column: span 4 !important; }
.c5 { grid-column: span 5 !important; } .c6 { grid-column: span 6 !important; } .c8 { grid-column: span 8 !important; }
@media (max-width: 760px) {
  .c2, .c3, .c4 { grid-column: span 6 !important; }
  .c5, .c6, .c8 { grid-column: span 12 !important; }
}
label { display: flex; flex-direction: column; gap: 4px; font-size: 12px; color: var(--muted); font-weight: 600; min-width: 0; }
label.check { flex-direction: row; align-items: center; gap: 8px; font-size: 14px; color: var(--fg); font-weight: 500; }
label.check input { width: auto; }
input, select, textarea {
  font: 15px var(--f-ui); color: var(--fg); background: var(--bg); border: 1px solid var(--line);
  border-radius: 8px; padding: 8px 10px; width: 100%; min-width: 0;
}
textarea { min-height: 70px; resize: vertical; }
input:disabled, select:disabled, textarea:disabled { opacity: .75; }
input.num { font-family: var(--f-num); text-align: right; font-variant-numeric: tabular-nums; }
.req::after { content: " *"; color: var(--bad); }
fieldset { border: 0; padding: 0; margin: 0; min-width: 0; }
.seccion { font-size: 13px; font-weight: 700; color: var(--fg); margin-top: 6px; padding-top: 10px; border-top: 1px solid var(--line); }
.nota { font-size: 12px; color: var(--muted); margin: 8px 0 0; }

.btn { border: 0; background: var(--accent); color: var(--accent-fg); font: 600 14px var(--f-ui); padding: 9px 16px;
  border-radius: 8px; cursor: pointer; white-space: nowrap; text-decoration: none; display: inline-block; text-align: center; }
.btn.ghost { background: transparent; color: var(--fg); border: 1px solid var(--line); }
.btn.danger { background: var(--bad); color: #fff; }
.btn.wide { width: 100%; }
.btn:disabled { opacity: .45; cursor: not-allowed; }
.link { border: 0; background: none; color: var(--accent); font: 600 13px var(--f-ui); cursor: pointer; padding: 2px 4px; }
.link.bad { color: var(--bad); }
.acciones { display: flex; gap: 8px; flex-wrap: wrap; align-items: center; }

/* Tablas */
.tbl { overflow-x: auto; }
table { width: 100%; border-collapse: collapse; font-size: 14px; }
th { text-align: left; font-size: 12px; color: var(--muted); font-weight: 600; padding: 8px; border-bottom: 1px solid var(--line); white-space: nowrap; }
td { padding: 9px 8px; border-bottom: 1px solid var(--line); vertical-align: middle; }
td.m, th.m { text-align: right; font-family: var(--f-num); font-variant-numeric: tabular-nums; white-space: nowrap; }
tr.void td { color: var(--muted); }
tr.void td.tach { text-decoration: line-through; }
tr.clic { cursor: pointer; }
tr.clic:hover td { background: var(--surface-2); }
.vacio { color: var(--muted); font-size: 14px; padding: 14px 8px; }

.pill { display: inline-block; font-size: 12px; font-weight: 600; padding: 2px 8px; border-radius: 999px; white-space: nowrap; }
.p-efectivo { background: var(--ok-soft); color: var(--ok); }
.p-tpv { background: var(--accent-soft); color: var(--accent); }
.p-sepa, .p-tarjeta, .p-neutro { background: var(--surface-2); color: var(--muted); }
.s-ok { background: var(--ok-soft); color: var(--ok); }
.s-pend { background: var(--warn-soft); color: var(--warn); }
.s-dev { background: var(--bad-soft); color: var(--bad); }

/* Cierre */
.lineas { display: flex; flex-direction: column; gap: 6px; font-size: 14px; }
.linea { display: flex; justify-content: space-between; gap: 12px; }
.linea span:last-child { font-family: var(--f-num); font-variant-numeric: tabular-nums; }
.linea.total { border-top: 1px solid var(--line); padding-top: 8px; font-weight: 700; }
.denoms { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 6px 14px; margin: 10px 0; }
.denoms label { flex-direction: row; align-items: center; justify-content: space-between; font: 400 14px var(--f-num); color: var(--fg); }
.denoms input { width: 76px; text-align: right; font-family: var(--f-num); padding: 6px 8px; }
.diff { margin-top: 12px; padding: 10px 12px; border-radius: 8px; font-weight: 600; display: flex; justify-content: space-between; gap: 8px; }
.diff span:last-child { font-family: var(--f-num); }
.diff.cero { background: var(--ok-soft); color: var(--ok); }
.diff.mal { background: var(--bad-soft); color: var(--bad); }
.diff.espera { background: var(--surface-2); color: var(--muted); }

.aviso { padding: 12px 14px; border-radius: 10px; font-weight: 600; margin-bottom: 16px; display: flex; flex-wrap: wrap; gap: 8px 14px; align-items: center; }
.aviso.ok { background: var(--ok-soft); color: var(--ok); }
.aviso.warn { background: var(--warn-soft); color: var(--warn); }
.aviso.bad { background: var(--bad-soft); color: var(--bad); }
.confirmar { margin-top: 12px; padding: 12px; border-radius: 8px; background: var(--warn-soft); color: var(--fg);
  display: flex; flex-direction: column; gap: 10px; }

.toast { position: fixed; left: 50%; transform: translateX(-50%); bottom: calc(18px + env(safe-area-inset-bottom, 0px));
  background: var(--fg); color: var(--bg); padding: 10px 16px; border-radius: 8px; font-weight: 600; font-size: 14px;
  max-width: min(92vw, 560px); z-index: 20; box-shadow: 0 6px 20px rgba(0,0,0,.2); }
.toast.error { background: var(--bad); color: #fff; }

/* Acceso */
.acceso { min-height: 100vh; display: grid; place-items: center; padding: 20px 16px; }
.acceso .panel { width: 100%; max-width: 380px; padding: 24px; }
.acceso h1 { margin-bottom: 4px; }
.acceso form { display: flex; flex-direction: column; gap: 12px; margin-top: 18px; }

.filtros { display: flex; flex-wrap: wrap; gap: 10px; align-items: end; margin-bottom: 14px; }
.filtros input[type=search] { max-width: 340px; }
.filtros select { width: auto; }
.fila-edicion td { background: var(--surface-2); }

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