/* Fiscal ORVILA · lenguaje visual (P0-9F). Solo presentacion: la logica y los ids no cambian.
   Tokens: tinta grafito, acento petroleo, neutros calidos; avisos en terracota (sin dorados). */
:root {
  --ink: #15181e; --ink-2: #2b313b; --muted: #5d6573; --line: #e2dfd8; --line-strong: #cfcbc2;
  --bg: #f3f2ee; --card: #ffffff; --soft: #f7f6f2;
  --accent: #0f6b70; --accent-dark: #0b5156; --accent-soft: #e2efef;
  --ok: #1f7a4d; --ok-soft: #e4f2ea; --warn: #9c421d; --warn-soft: #fbece4; --danger: #a12f2f; --danger-soft: #fbe9e9;
  --radius: 12px; --radius-s: 8px; --shadow: 0 1px 2px #15181e0d, 0 6px 20px #15181e0d;
  font-family: Inter, -apple-system, BlinkMacSystemFont, "Segoe UI", system-ui, sans-serif; color: var(--ink); background: var(--bg);
  font-size: 15px; line-height: 1.45; -webkit-font-smoothing: antialiased;
}
* { box-sizing: border-box; }
body { margin: 0; background: var(--bg); }
[hidden] { display: none !important; }
h1, h2, h3 { letter-spacing: -.01em; }
h1 { margin: 0; font-size: 1.15rem; font-weight: 650; }

/* Cabecera */
header { padding: 12px max(20px, 3vw); color: #fff; background: var(--ink); display: flex; justify-content: space-between; align-items: center; gap: 16px; flex-wrap: wrap; }
.brand { display: flex; align-items: center; gap: 12px; min-width: 0; }
.brand-mark { display: grid; place-items: center; width: 40px; height: 40px; border-radius: 10px; background: var(--accent); color: #fff; font-size: 1.2rem; flex: none; }
.eyebrow { margin: 0; text-transform: uppercase; letter-spacing: .14em; font-size: .68rem; color: #9fc9cb; font-weight: 600; }
.who { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; font-size: .9rem; color: #dfe3e8; }
.who button { margin: 0; }
.chip { display: inline-flex; align-items: center; gap: 4px; padding: 4px 11px; border-radius: 999px; background: #2b313b; color: #cfd5dc; font-size: .82rem; }
.chip.on { background: var(--accent-soft); color: var(--accent-dark); font-weight: 650; }

/* Aviso de entorno: franja fina integrada, siempre visible */
.warning { display: flex; align-items: center; gap: 10px; background: var(--warn-soft); color: var(--warn); border-bottom: 1px solid #efd3c3; padding: 8px max(20px, 3vw); margin: 0; font-size: .85rem; }
aside.warning::before { content: "ENSAYO"; flex: none; padding: 2px 8px; border-radius: 999px; background: var(--warn); color: #fff; font-size: .68rem; font-weight: 700; letter-spacing: .1em; }
aside.warning.pilot-banner::before { content: "PILOTO"; }
section.warning { display: block; margin: 0 0 16px; border: 1px solid #efd3c3; border-radius: var(--radius-s); padding: 12px 14px; }

/* Estructura */
main { max-width: 1440px; margin: 0 auto; padding: 0 max(20px, 3vw) 60px; }
.notice { max-width: 1440px; margin: 14px auto 0; padding: 11px 14px; border-radius: var(--radius-s); background: var(--ok-soft); color: #14502f; border: 1px solid #c5e2d1; width: calc(100% - 2 * max(20px, 3vw)); }
.notice.error, .error { color: #7a1f1f; }
.notice.error { background: var(--danger-soft); border-color: #efc4c4; }
.grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(340px, 1fr)); gap: 16px; align-items: start; }
.grid > *, article { min-width: 0; }
article, .card { background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); padding: 20px; box-shadow: var(--shadow); }
.card.narrow { max-width: 440px; margin: 48px auto; }
.card.wide { grid-column: 1 / -1; }
.card h2 { margin: 0 0 12px; padding-bottom: 10px; border-bottom: 1px solid var(--line); font-size: 1rem; font-weight: 650; }
.card h3 { font-size: .92rem; margin: 16px 0 6px; }
p.card { color: var(--muted); }

/* Navegacion principal y secundaria */
main > nav.tabs { position: sticky; top: 0; z-index: 5; margin: 0 calc(-1 * max(20px, 3vw)) 20px; padding: 0 max(20px, 3vw); background: var(--card); border-bottom: 1px solid var(--line); gap: 4px; }
main > nav.tabs button, main > nav.tabs button.secondary { margin: 0; padding: 14px 18px; border: 0; border-bottom: 3px solid transparent; border-radius: 0; background: none; color: var(--muted); font-weight: 600; }
main > nav.tabs button:not(.secondary), main > nav.tabs button:not(.secondary):hover:not(:disabled) { color: var(--accent-dark); border-bottom-color: var(--accent); }
main > nav.tabs button:hover:not(:disabled) { color: var(--ink); background: var(--soft); }
.tabs { display: flex; gap: 6px; flex-wrap: wrap; margin-bottom: 16px; }
#content > nav.tabs { padding: 4px; background: #e9e7e1; border-radius: 10px; width: fit-content; max-width: 100%; }
#content > nav.tabs button, #content > nav.tabs button.secondary { margin: 0; padding: 8px 16px; border: 0; background: none; color: var(--muted); border-radius: 7px; font-weight: 600; }
#content > nav.tabs button:not(.secondary), #content > nav.tabs button:not(.secondary):hover:not(:disabled) { background: var(--card); color: var(--ink); box-shadow: 0 1px 3px #15181e1f; }

/* Formularios */
.row { display: flex; gap: 12px; flex-wrap: wrap; }
label { display: grid; gap: 5px; flex: 1; min-width: 120px; margin: 8px 0; font-size: .84rem; font-weight: 600; color: var(--muted); }
input, select, button { font: inherit; }
input, select { padding: 10px 12px; border: 1px solid var(--line-strong); border-radius: var(--radius-s); background: #fff; color: var(--ink); max-width: 100%; text-transform: none; letter-spacing: 0; font-weight: 400; font-size: .95rem; }
label > input, label > select { min-width: 0; width: 100%; }
input:hover, select:hover { border-color: #aaa69b; }
input:focus-visible, select:focus-visible { outline: 3px solid #0f6b7040; outline-offset: 0; border-color: var(--accent); }

/* Botones */
button, .button { border: 0; background: var(--accent); color: #fff; font-weight: 650; margin: 8px 6px 8px 0; padding: 10px 16px; border-radius: var(--radius-s); cursor: pointer; text-decoration: none; transition: background .12s; }
button:hover:not(:disabled), .button:hover { background: var(--accent-dark); }
button.secondary, .button.secondary { background: #fff; color: var(--ink-2); border: 1px solid var(--line-strong); }
button.secondary:hover:not(:disabled), .button.secondary:hover { background: var(--soft); }
button.danger { background: var(--danger); }
button.danger:hover:not(:disabled) { background: #862424; }
button:disabled { opacity: .45; cursor: not-allowed; }
button.link { background: none; border: 0; color: var(--accent-dark); text-decoration: underline; padding: 6px 8px; min-height: 36px; margin: 0; font-weight: 600; }
header button.secondary { background: transparent; color: #dfe3e8; border-color: #4a525e; padding: 7px 12px; }
header button.secondary:hover:not(:disabled) { background: #2b313b; }
button:focus-visible, .button:focus-visible { outline: 3px solid #0f6b7066; outline-offset: 2px; }

/* Resultados, estados y listas */
.result { margin-top: 12px; padding: 12px 14px; background: var(--soft); border: 1px solid var(--line); border-radius: var(--radius-s); overflow-wrap: anywhere; font-size: .9rem; color: var(--ink-2); }
pre { white-space: pre-wrap; background: var(--ink); color: #dbe7e7; padding: 18px; border-radius: var(--radius); max-height: 320px; overflow: auto; }
.lines { list-style: none; padding: 0; margin: 10px 0; }
.lines li { display: flex; justify-content: space-between; gap: 10px; padding: 9px 0; border-bottom: 1px solid var(--line); font-variant-numeric: tabular-nums; }
.lines:empty, .lines li:only-child:empty { display: none; }
.entry { padding: 14px 0; border-bottom: 1px solid var(--line); }
.entry .row { align-items: flex-end; margin-top: 6px; }
.refund-line { padding: 8px 0; border-bottom: 1px solid var(--line); }

/* Tablas */
table { width: 100%; border-collapse: collapse; table-layout: fixed; font-size: .9rem; font-variant-numeric: tabular-nums; }
th { text-align: left; padding: 9px 8px; background: var(--soft); color: var(--muted); font-size: .8rem; font-weight: 700; border-bottom: 1px solid var(--line-strong); }
td { text-align: left; padding: 10px 8px; border-bottom: 1px solid var(--line); vertical-align: top; overflow-wrap: anywhere; }
tbody tr:hover td { background: #faf9f6; }
#cash-movements { overflow-x: auto; } #cash-movements table { min-width: 860px; }
.scroll-table { overflow-x: auto; } .scroll-table table { min-width: 820px; }

/* TPV: catalogo y cliente a la izquierda; ticket, impuestos y cobro en un panel fijo a la derecha */
.sale-grid { grid-template-columns: repeat(auto-fit, minmax(340px, 1fr)); }
.pos-layout { display: grid; grid-template-columns: minmax(0, 1fr) minmax(360px, 440px); gap: 10px; align-items: stretch; }
.checkout-panel { display: flex; flex-direction: column; gap: 10px; }
.aftersale { display: grid; gap: 10px; align-content: start; }
.empty-hint { margin: 8px 0; padding: 14px; border: 1px dashed var(--line-strong); border-radius: var(--radius-s); color: var(--muted); text-align: center; }
.pay-card { border-color: var(--accent); }
.pay-total { display: grid; gap: 2px; margin-bottom: 8px; padding: 8px 12px; border-radius: var(--radius-s); background: var(--accent-soft); color: var(--accent-dark); }
.pay-total small { font-size: .8rem; font-weight: 600; }
.pay-total strong { font-size: 1.7rem; font-variant-numeric: tabular-nums; line-height: 1.1; }
.method-choice { display: grid; grid-template-columns: repeat(3, 1fr); gap: 6px; margin-bottom: 6px; }
.method-choice button { margin: 0; padding: 8px 6px; }
.pay-body { display: grid; grid-template-columns: minmax(0, 1fr) 150px; gap: 8px; align-items: start; }
.pay-body .numeric-keypad { grid-template-columns: repeat(3, 1fr); gap: 4px; max-width: none; margin: 0; }
.pay-body .numeric-keypad button { min-height: 36px; font-size: 1rem; }
#pay-submit { width: 100%; padding: 12px 16px; font-size: 1.05rem; margin: 8px 0 0; }
.quick-pay-row { display: grid; grid-template-columns: 1fr 1fr 1fr; gap: 6px; margin: 8px 0 4px; }
.quick-pay-row button { margin: 0; padding: 12px 6px; font-size: .98rem; }
.tax-breakdown { margin-top: 6px; padding: 6px 10px; border: 1px solid var(--line); border-radius: var(--radius-s); background: #fff; font-size: .82rem; font-variant-numeric: tabular-nums; color: var(--ink-2); }
.customer-block { position: relative; display: flex; align-items: center; gap: 8px; margin-bottom: 8px; }
.customer-picked { white-space: nowrap; }
.customer-block input[type=search] { flex: 1; min-width: 0; }
.customer-results { position: absolute; top: 100%; left: 0; right: 0; z-index: 8; display: grid; gap: 4px; max-height: 240px; overflow-y: auto; padding: 6px; background: #fff; border: 1px solid var(--line-strong); border-radius: var(--radius-s); box-shadow: var(--shadow); }
.customer-results:empty { display: none; }
.search-row { display: flex; gap: 6px; margin-bottom: 6px; }
.search-row input { flex: 1; min-width: 0; }
.search-row button { margin: 0; }
.hold-row { display: flex; gap: 8px; align-items: flex-start; margin-top: 6px; }
.hold-row > label, .hold-row > input { flex: 1; min-width: 0; }
.free-line summary { cursor: pointer; padding: 7px 12px; border: 1px solid var(--line-strong); border-radius: var(--radius-s); background: #fff; font-weight: 600; white-space: nowrap; }
.setup-card { padding: 14px; border: 1px dashed var(--line-strong); border-radius: var(--radius-s); background: var(--soft); grid-column: 1 / -1; }
.setup-card.error { border-color: #efc4c4; background: var(--danger-soft); color: #7a1f1f; }
.setup-card ul { list-style: none; margin: 8px 0 0; padding: 0; display: grid; gap: 6px; }
.setup-card li { display: flex; align-items: center; justify-content: space-between; gap: 8px; }
.setup-card li.done { color: var(--ok); }
.setup-card li button, .setup-card > button { margin: 0; }
.recent-details { margin-top: 6px; }
.recent-details summary { cursor: pointer; font-weight: 600; padding: 6px 2px; color: var(--muted); }
#app.pos-mode .recent-details[open] { max-height: 38vh; overflow-y: auto; }
.small-screen-note { display: none; margin: 0 0 8px; padding: 8px 10px; border-radius: var(--radius-s); background: var(--warn-soft); color: var(--warn); font-size: .85rem; }

/* TPV de una sola pantalla (Venta): todo cabe en el alto de la ventana; solo la lista de articulos, el ticket y la zona posterior a la venta se desplazan por dentro. */
#app.pos-mode { height: 100vh; display: flex; flex-direction: column; overflow: hidden; }
#app.pos-mode > header { padding: 6px max(14px, 2vw); }
#app.pos-mode .brand-mark { width: 30px; height: 30px; font-size: 1rem; border-radius: 8px; }
#app.pos-mode h1 { font-size: 1rem; }
#app.pos-mode .eyebrow { display: none; }
#app.pos-mode > .warning { padding: 4px max(14px, 2vw); font-size: .78rem; }
#app.pos-mode > .notice { margin-top: 6px; padding: 6px 12px; }
#app.pos-mode > main { flex: 1; min-height: 0; max-width: none; width: 100%; display: flex; flex-direction: column; padding: 0 max(14px, 2vw) 10px; overflow: hidden; }
#app.pos-mode main > nav.tabs { position: static; margin: 0 calc(-1 * max(14px, 2vw)) 8px; flex: none; }
#app.pos-mode main > nav.tabs button, #app.pos-mode main > nav.tabs button.secondary { padding: 8px 14px; }
#app.pos-mode #content { flex: 1; min-height: 0; display: flex; flex-direction: column; gap: 8px; }
#app.pos-mode #content > nav.tabs { margin: 0; flex: none; }
#app.pos-mode #content > nav.tabs button, #app.pos-mode #content > nav.tabs button.secondary { padding: 7px 14px; min-height: 36px; }
#app.pos-mode #cash-selection { flex: none; padding: 6px 12px; display: flex; gap: 10px; align-items: center; box-shadow: none; }
#app.pos-mode #cash-selection h2 { margin: 0; padding: 0; border: 0; font-size: .85rem; white-space: nowrap; }
#app.pos-mode #cash-selection p { margin: 0; font-size: .85rem; }
#app.pos-mode .pos-layout { flex: 1; min-height: 0; }
#app.pos-mode .pos-layout > * { min-height: 0; }
#app.pos-mode .card { padding: 10px 12px; }
#app.pos-mode .summary-card > h2, #app.pos-mode .pay-card > h2 { display: none; }
#app.pos-mode input, #app.pos-mode select { padding: 6px 8px; font-size: .9rem; }
#app.pos-mode button, #app.pos-mode .button { padding: 7px 12px; margin: 0; }
#app.pos-mode label { margin: 4px 0; font-size: .78rem; }
#app.pos-mode .row { gap: 6px; }
#app.pos-mode .checkout-panel { overflow-y: auto; }
#app.pos-mode .summary-card { flex: 1 1 250px; min-height: 250px; display: flex; flex-direction: column; }
#app.pos-mode .summary-card .lines { flex: 1; min-height: 56px; overflow-y: auto; margin: 4px 0; }
#app.pos-mode .summary-card .lines li { padding: 6px 0; }
#app.pos-mode .summary-card .lines li > div { min-width: 0; font-size: .85rem; }
#app.pos-mode .summary-card .lines select, #app.pos-mode .summary-card .lines input { max-width: 150px; }
#app.pos-mode .summary-card .lines input { max-width: 70px; }
#app.pos-mode .summary-card .empty-hint { flex: 1; display: grid; place-items: center; margin: 4px 0; }
#app.pos-mode .totals-strip { margin-top: 4px; gap: 6px; }
#app.pos-mode .totals-strip > div { padding: 6px 10px; }
#app.pos-mode .totals-strip strong { font-size: 1.3rem; }
#app.pos-mode .totals-strip > div:not(:first-child) strong { font-size: 1rem; }
#app.pos-mode #sale-status { margin-top: 6px; padding: 6px 10px; font-size: .78rem; }
#app.pos-mode .summary-card .row { gap: 6px; margin-top: 6px; }
#app.pos-mode .pay-card { flex: none; position: sticky; bottom: 0; z-index: 2; background: var(--card); }
#app.pos-mode .catalog-card { display: flex; flex-direction: column; overflow: hidden; }
#app.pos-mode .counter-catalog { flex: 1; min-height: 0; display: flex; flex-direction: column; }
#app.pos-mode .category-tabs { flex: none; margin-bottom: 6px; padding: 0; }
#app.pos-mode .category-tabs button { min-height: 30px; padding: 3px 12px; }
#app.pos-mode .catalog-grid { flex: 1; min-height: 0; overflow-y: auto; align-content: start; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: 6px; margin: 0; }
#app.pos-mode button.catalog-item { min-height: 54px; padding: 6px 36px 6px 8px; gap: 2px; }
#app.pos-mode button.catalog-item span { font-size: .74rem; }
#app.pos-mode button.catalog-favorite { min-width: 30px; min-height: 30px; padding: 2px; font-size: 1rem; }
#app.pos-mode .aftersale { overflow-y: auto; }
#app.pos-mode .free-line[open] { max-height: 42vh; overflow-y: auto; }

/* Ajustes de densidad del TPV de una pantalla */
#app.pos-mode #content { position: relative; z-index: 6; display: grid; grid-template-columns: 600px minmax(0, 1fr) auto; grid-template-rows: 40px minmax(0, 1fr); gap: 6px; margin-top: -42px; pointer-events: none; }
#app.pos-mode #content > * { pointer-events: auto; }
/* "Venta actual / En espera" y la caja en uso comparten fila con las pestanas principales para ganar altura. */
#app.pos-mode #content > nav.tabs { grid-column: 3; grid-row: 1; align-self: center; position: relative; z-index: 6; }
#app.pos-mode #content > #cash-selection { grid-column: 2; grid-row: 1; justify-self: end; align-self: center; min-width: 0; max-width: 100%; overflow: hidden; position: relative; z-index: 6; }
#app.pos-mode #content > .pos-layout { grid-column: 1 / -1; grid-row: 2; }
#app.pos-mode #content > .warning, #app.pos-mode #content > #unknown-operations { grid-column: 1 / -1; }
#app.pos-mode .summary-card .lines .row { flex-wrap: nowrap; margin: 2px 0 0; }
#app.pos-mode .summary-card .lines label { margin: 0; font-size: .75rem; flex: 0 0 auto; min-width: 0; }
#app.pos-mode .summary-card .lines select { max-width: 130px; }
#app.pos-mode .summary-card .lines input { max-width: 56px; }
#app.pos-mode .summary-card > .row { flex-wrap: nowrap; }
#app.pos-mode .summary-card > .row button { font-size: .84rem; padding: 7px 8px; white-space: nowrap; }
#app.pos-mode #pay-cash-tendered .row { flex-wrap: nowrap; gap: 4px; margin: 4px 0; }
#app.pos-mode #pay-cash-tendered .row button { padding: 5px 7px; font-size: .78rem; white-space: nowrap; }
#app.pos-mode #pay-cash-tendered .result { margin-top: 4px; padding: 4px 8px; font-size: .75rem; }
#app.pos-mode .pay-total { padding: 4px 12px; margin-bottom: 6px; }
#app.pos-mode .pay-total strong { font-size: 1.5rem; }
#app.pos-mode .method-choice button { padding: 6px; }
#app.pos-mode #pay-submit { padding: 10px; margin-top: 6px; }
#app.pos-mode .pay-body .numeric-keypad button { min-height: 32px; }
#app.pos-mode .tax-breakdown { margin-top: 4px; padding: 4px 10px; font-size: .78rem; }

/* Ventanas poco altas (portatiles de 720 px): se compacta el cobro para que ticket, impuestos y botones sigan a la vista. */
@media (max-height: 880px) and (min-width: 1024px) {
  #app.pos-mode .summary-card { flex-basis: 215px; min-height: 215px; }
  #app.pos-mode .pay-card { padding: 8px 10px; }
  #app.pos-mode .pay-total { display: flex; align-items: baseline; gap: 10px; padding: 2px 10px; margin-bottom: 4px; }
  #app.pos-mode .pay-total strong { font-size: 1.25rem; }
  #app.pos-mode .method-choice { margin-bottom: 4px; }
  #app.pos-mode .method-choice button { padding: 4px 6px; }
  #app.pos-mode #pay-submit { padding: 8px; margin-top: 4px; }
  #app.pos-mode .pay-body .numeric-keypad button { min-height: 30px; }
  #app.pos-mode .checkout-panel { gap: 6px; }
  #app.pos-mode .summary-card { padding: 6px 10px; }
  #app.pos-mode .totals-strip > div { padding: 4px 8px; }
  #app.pos-mode .totals-strip strong { font-size: 1.15rem; }
  #app.pos-mode #sale-status { margin-top: 4px; padding: 3px 8px; }
  #app.pos-mode .pay-body .pay-fields .row { margin: 0; }
  #app.pos-mode #pay-cash-tendered .row { margin: 2px 0; }
}

/* Compactacion adicional del cobro y del ticket (se mantiene toda la informacion; solo se aprieta el espacio) */
#app.pos-mode .tax-breakdown { display: flex; flex-wrap: wrap; gap: 0 14px; }
#app.pos-mode #sale-status { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
#app.pos-mode #pay-mixed-hint { margin: 0 0 4px; padding: 3px 8px; font-size: .75rem; }
#app.pos-mode #cash-selection h2 { display: none; }
#app.pos-mode #cash-selection p { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
#app.pos-mode .summary-card .lines { min-height: 40px; }
@media (max-height: 880px) and (min-width: 1024px) { #app.pos-mode .pay-total { display: none; } }
@media (max-width: 1023px), (max-height: 639px) {
  /* Ventana demasiado pequena para una sola pantalla: columnas con desplazamiento normal y aviso explicito. */
  #app.pos-mode { height: auto; display: block; overflow: visible; }
  #app.pos-mode > main, #app.pos-mode #content { display: block; overflow: visible; }
  #app.pos-mode #content { margin-top: 0; pointer-events: auto; }
  #app.pos-mode #content > #cash-selection { margin: 8px 0; }
  #app.pos-mode .pos-layout { display: block; }
  #app.pos-mode .checkout-panel { margin-top: 10px; }
  #app.pos-mode .catalog-grid { max-height: 360px; flex: none; }
  #app.pos-mode .summary-card .lines { max-height: 320px; }
  .small-screen-note { display: block; }
}

.totals-strip { display: grid; grid-template-columns: 1.4fr 1fr 1fr; gap: 10px; margin-top: 14px; }
.totals-strip > div { padding: 12px 14px; border-radius: var(--radius-s); background: var(--soft); border: 1px solid var(--line); }
.totals-strip > div:first-child { background: var(--ink); border-color: var(--ink); color: #fff; }
.totals-strip small { display: block; font-size: .78rem; font-weight: 700; color: var(--muted); }
.totals-strip > div:first-child small { color: #9fc9cb; }
.totals-strip strong { font-size: 1.5rem; font-variant-numeric: tabular-nums; }
.totals-strip > div:not(:first-child) strong { font-size: 1.15rem; }
#sale-status { font-size: .88rem; }

.empty-state { max-width: 560px; margin: 32px auto; text-align: center; padding: 32px; }
.empty-state h2 { border: 0; font-size: 1.15rem; }
.empty-state p { color: var(--muted); }

.inline-check { display: flex; gap: 6px; align-items: center; margin: 6px 0 0; font-weight: 600; }
.inline-check input { width: auto; }
.customer-picked { display: flex; align-items: center; gap: 8px; margin: 4px 0 8px; }
.customer-results { display: grid; gap: 6px; margin-bottom: 8px; }
.customer-result { margin: 0; text-align: left; }
.customer-result small { font-weight: 400; color: var(--muted); }

/* Catalogo, teclado y dialogos */
.pin-dialog { border: 0; border-radius: 16px; padding: 24px; width: min(380px, 92vw); box-shadow: 0 24px 70px #15181e55; }
.pin-dialog::backdrop { background: #15181ecc; }
.employee-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(140px, 1fr)); gap: 8px; }
.employee-grid button { margin: 0; padding: 16px 10px; }
.pin-pad { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; margin: 12px 0; }
.pin-pad button { margin: 0; padding: 16px; font-size: 1.2rem; }
#pin-input { width: 100%; text-align: center; font-size: 1.4rem; letter-spacing: .4em; }
.catalog-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(170px, 1fr)); gap: 8px; margin: 10px 0; }
.category-tabs { display: flex; gap: 6px; overflow-x: auto; padding: 4px 0; scrollbar-width: thin; }
.category-tabs button { flex: 0 0 auto; min-height: 44px; border-radius: 999px; }
.catalog-tile { position: relative; min-width: 0; }
button.catalog-item { display: grid; gap: 5px; text-align: left; background: var(--soft); color: var(--ink); border: 1px solid var(--line-strong); width: 100%; min-height: 76px; padding-right: 44px; }
button.catalog-item:hover:not(:disabled) { background: var(--accent-soft); border-color: var(--accent); }
button.catalog-item span { font-weight: 500; font-size: .82rem; color: var(--accent-dark); }
button.catalog-favorite { position: absolute; right: 4px; top: 4px; min-width: 38px; min-height: 38px; margin: 0; padding: 6px; font-size: 1.2rem; }
.numeric-keypad { display: grid; grid-template-columns: repeat(3, minmax(54px, 1fr)); gap: 8px; max-width: 320px; margin: 10px 0; }
.numeric-keypad button { min-height: 48px; margin: 0; font-size: 1.15rem; }

/* Comprobante (la vista de impresion se define abajo y no cambia) */
.receipt-preview { border: 1px solid var(--ink); padding: 18px; margin-top: 12px; background: white; color: #111; border-radius: 4px; }
.receipt-preview table { table-layout: fixed; }
.receipt-preview th, .receipt-preview td { overflow-wrap: anywhere; }
.receipt-logo { font-size: 1.25rem; font-weight: 900; letter-spacing: .08em; text-align: center; text-transform: uppercase; overflow-wrap: anywhere; }
.receipt-emitter { text-align: center; line-height: 1.35; }
.receipt-preview .fiscal-warning { display: block; color: var(--warn); border: 2px solid var(--warn); padding: 8px; text-align: center; }

@media (max-width: 640px) { main { padding-inline: 12px; padding-bottom: 100px; } .grid, .sale-grid { grid-template-columns: minmax(0, 1fr); } .row > label { min-width: min(110px, 100%); } button, .button, input, select { min-height: 44px; } .catalog-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); } #sale-status { position: sticky; bottom: 8px; z-index: 4; box-shadow: 0 4px 20px #0004; font-weight: 700; } main > nav.tabs { overflow-x: auto; flex-wrap: nowrap; margin-inline: -12px; padding-inline: 12px; } .totals-strip { grid-template-columns: 1fr; } }

/* Impresion: solo el comprobante. Lo demas se retira del flujo (no solo se
   oculta), para que no queden paginas en blanco detras. */
@media print {
  @page { size: 80mm auto; margin: 4mm; }
  :root, body { background: white; }
  header, #app > aside, .notice, nav, dialog, main > label, .no-print { display: none !important; }
  main, #content { margin: 0; padding: 0; max-width: none; }
  .grid { display: block; }
  #app, #app > main, #content, .pos-layout, .aftersale { display: block !important; height: auto !important; overflow: visible !important; }
  .checkout-panel, #cash-selection, .aftersale > .card:not(.receipt-card) { display: none !important; }
  .grid > article:not(.receipt-card), .receipt-card > :not(.receipt-preview) { display: none !important; }
  .receipt-card { box-shadow: none; padding: 0; border-radius: 0; }
  .receipt-preview { border: 0; margin: 0; padding: 0; width: 72mm; max-width: 72mm; font: 9pt/1.25 ui-monospace, SFMono-Regular, Menlo, Consolas, monospace; overflow-wrap: anywhere; }
  .receipt-preview h2 { margin: 2mm 0; font-size: 12pt; text-align: center; }
  .receipt-preview h3 { margin: 2mm 0 1mm; font-size: 10pt; }
  .receipt-preview p, .receipt-preview ul { margin: 1.5mm 0; padding-left: 0; }
  .receipt-preview ul { list-style-position: inside; }
  .receipt-preview table { table-layout: fixed; font-size: 7pt; }
  .receipt-preview th, .receipt-preview td { padding: .8mm .4mm; overflow-wrap: anywhere; }
  .receipt-preview .fiscal-warning { border-width: .4mm; padding: 1mm; }
}

/* Estado inequivoco del cobro (primera palabra de la linea de estado) */
.registration { font-weight: 800; }
.registration.is-paid { color: #14612f; }
.registration.is-partial { color: #7a5200; }
.registration.is-unpaid { color: var(--ink-2); }
.registration.is-cancelled { color: #8a1c1c; }

/* Clientes: listado y ficha a todo el ancho */
.grid > .customers-wide { grid-column: 1 / -1; }
.customers-wide td button { white-space: nowrap; }

.grid > .orvila-wide { grid-column: 1 / -1; }

/* Cumplimiento y anticipos */
.compliance-list { list-style: none; padding: 0; margin: 0 0 1rem; }
.compliance-list li { padding: .55rem .75rem; margin: .35rem 0; border-left: 4px solid #8a8f98; background: #fff; border-radius: 4px; overflow-wrap: anywhere; }
.compliance-list li small { display: block; color: #5a6270; margin-top: .15rem; }
.compliance-ok { border-left-color: #2f7d4f !important; } .compliance-warn { border-left-color: #b7791f !important; } .compliance-bad { border-left-color: #b83232 !important; }
.qr svg { max-width: 100%; height: auto; }

/* Cumplimiento: acciones y enlaces de exportación con separación y ajuste en móvil */
#compliance-status .actions { display: flex; flex-wrap: wrap; gap: 0.75rem 1.25rem; align-items: center; margin-top: 1rem; }
.declaration-text { white-space: pre-wrap; word-break: break-word; font: inherit; font-size: 0.9rem; background: var(--surface-2, #f4f4f2); padding: 0.75rem; border-radius: 6px; max-width: 100%; overflow-x: hidden; }

#content.fiscal-books { display: grid; grid-template-columns: minmax(0, 1fr); gap: 12px; }
.fiscal-actions a { color: var(--accent-dark); }
.table-scroll { overflow-x: auto; margin-block: .8rem; }
.fiscal-actions { display: flex; flex-wrap: wrap; align-items: center; gap: .45rem .75rem; }
.fiscal-period-note { display: block; color: var(--muted, #425651); }
#fiscal-action { scroll-margin-top: 1rem; }
#fiscal-action .table-scroll input { min-width: 5rem; width: 8rem; }
