* { box-sizing: border-box; }

/* El atributo hidden manda siempre (algunas clases fijan display). */
[hidden] { display: none !important; }

html {
  background-color: #0f172a;
}

body {
  margin: 0;
  min-height: 100vh;
  display: grid;
  place-items: center;
  padding: 1.25rem;
  font-family: system-ui, -apple-system, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
  background: linear-gradient(135deg, #1e293b 0%, #0f172a 60%, #020617 100%);
  background-color: #0f172a;
  color: #0f172a;
}

.container { width: 100%; max-width: 430px; }
.container-wide { max-width: 920px; }
.container-repair { max-width: 960px; }

.card {
  background: #ffffff;
  border-radius: 16px;
  padding: 2rem;
  box-shadow: 0 24px 60px rgba(0, 0, 0, 0.45);
}

.container-wide .card { padding: 2rem 2.25rem; }

h1 { margin: 0.6rem 0 0.35rem; font-size: 1.45rem; letter-spacing: -0.01em; }

.subtitle { margin: 0 0 1.4rem; color: #64748b; font-size: 0.95rem; line-height: 1.45; }

.badge {
  display: inline-block;
  background: #2563eb;
  color: #fff;
  padding: 0.2rem 0.6rem;
  border-radius: 999px;
  font-size: 0.72rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.06em;
}

label {
  display: block;
  margin: 0.9rem 0 0.3rem;
  font-size: 0.85rem;
  font-weight: 600;
  color: #334155;
}

input {
  width: 100%;
  padding: 0.65rem 0.75rem;
  border: 1px solid #cbd5e1;
  border-radius: 8px;
  font-size: 1rem;
  background: #f8fafc;
  color: #0f172a;
}
input:focus {
  outline: none;
  border-color: #3b82f6;
  box-shadow: 0 0 0 3px rgba(59, 130, 246, 0.25);
  background: #fff;
}

button {
  display: block;
  width: 100%;
  margin-top: 1.4rem;
  padding: 0.75rem 1rem;
  border: 0;
  border-radius: 8px;
  background: #2563eb;
  color: #fff;
  font-size: 1rem;
  font-weight: 600;
  cursor: pointer;
  transition: background 0.15s ease;
}
button:hover { background: #1d4ed8; }
button.secondary { background: #e2e8f0; color: #0f172a; }
button.secondary:hover { background: #cbd5e1; }

.flash {
  padding: 0.7rem 0.9rem;
  border-radius: 8px;
  margin-bottom: 1rem;
  font-size: 0.92rem;
  line-height: 1.4;
}
.flash-success { background: #dcfce7; color: #166534; border: 1px solid #86efac; }
.flash-error { background: #fee2e2; color: #991b1b; border: 1px solid #fca5a5; }
.flash-info { background: #e0f2fe; color: #075985; border: 1px solid #7dd3fc; }
.flash-warning { background: #fef3c7; color: #92400e; border: 1px solid #fcd34d; }

/* ------------------------------------------------ lanzador de aplicaciones */

.head {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 1rem;
}
.head .subtitle { margin-bottom: 0; }
.head form { flex-shrink: 0; }

button.small {
  width: auto;
  margin-top: 0;
  padding: 0.5rem 0.9rem;
  font-size: 0.85rem;
}

.apps {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(150px, 1fr));
  gap: 0.9rem;
  margin-top: 1.6rem;
}

.app-tile {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0.4rem;
  padding: 1rem 0.6rem 0.9rem;
  text-align: center;
  text-decoration: none;
  color: inherit;
  background: #f8fafc;
  border: 1px solid #e2e8f0;
  border-radius: 14px;
  transition: transform 0.12s ease, box-shadow 0.12s ease,
    border-color 0.12s ease, background 0.12s ease;
}
.app-tile:hover {
  transform: translateY(-3px);
  background: #ffffff;
  border-color: #cbd5e1;
  box-shadow: 0 12px 26px rgba(15, 23, 42, 0.14);
}
.app-tile:active { transform: translateY(-1px); }
.app-tile:focus-visible {
  outline: none;
  border-color: #2563eb;
  box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.3);
}

.app-icon {
  display: grid;
  place-items: center;
  width: 54px;
  height: 54px;
  border-radius: 15px;
  font-size: 1.6rem;
  line-height: 1;
  background: #f1f5f9;
  background: color-mix(in srgb, var(--tile) 16%, #ffffff);
  border-bottom: 3px solid var(--tile);
  box-shadow: 0 4px 10px rgba(15, 23, 42, 0.1);
}

.app-name {
  font-size: 0.95rem;
  font-weight: 650;
  color: #0f172a;
  letter-spacing: -0.01em;
}

.app-desc {
  font-size: 0.74rem;
  line-height: 1.35;
  color: #64748b;
}

/* Inicio: más amplio, pero ajustado para caber en pantalla */
.container-wide .head h1 { font-size: 1.7rem; }
.container-wide .head .subtitle { font-size: 1rem; margin-top: 0.15rem; }
.container-wide .apps {
  grid-template-columns: repeat(auto-fill, minmax(190px, 1fr));
  gap: 1rem;
  margin-top: 1.5rem;
}
.container-wide .app-tile {
  gap: 0.45rem;
  padding: 1.15rem 0.8rem 1rem;
  border-radius: 16px;
  min-height: 150px;
  justify-content: center;
}
.container-wide .app-icon {
  width: 64px;
  height: 64px;
  border-radius: 18px;
  font-size: 1.9rem;
  border-bottom-width: 3px;
}
.container-wide .app-name { font-size: 1.05rem; }
.container-wide .app-desc { font-size: 0.86rem; line-height: 1.3; }

.toast {
  position: fixed;
  left: 50%;
  bottom: 1.5rem;
  transform: translateX(-50%);
  padding: 0.7rem 1.1rem;
  border-radius: 999px;
  background: #0f172a;
  color: #f1f5f9;
  font-size: 0.85rem;
  box-shadow: 0 14px 30px rgba(0, 0, 0, 0.4);
  z-index: 10;
}

/* ------------------------------------------------------- módulos (tablas) */

.muted { display: block; font-size: 0.76rem; color: #94a3b8; font-weight: 400; }

.toolbar {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 0.7rem;
  margin-top: 1.4rem;
}

.search {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  flex: 1 1 260px;
}
.search input { flex: 1; margin: 0; }

.search.search-filtros {
  flex-direction: column;
  align-items: stretch;
  gap: 0.55rem;
}
.search-row {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  flex-wrap: wrap;
}
.search-row input[type="search"] { flex: 1 1 220px; margin: 0; }
.search-row button, .search-row .link { flex: 0 0 auto; margin: 0; }

.filtros-panel {
  border: 1px solid #e2e8f0;
  border-radius: 10px;
  background: #f8fafc;
  padding: 0.1rem 0.7rem;
}
.filtros-panel summary {
  cursor: pointer;
  font-size: 0.85rem;
  font-weight: 600;
  color: #334155;
  padding: 0.45rem 0.1rem;
  user-select: none;
}
.filtros-panel[open] summary { margin-bottom: 0.35rem; }
.filtros-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
  gap: 0.55rem 0.8rem;
  padding-bottom: 0.55rem;
}
.filtros-grid .field { margin: 0; }
.filtros-grid .field label { margin: 0 0 0.2rem; font-size: 0.78rem; }
.filtros-grid .field input,
.filtros-grid .field select { font-size: 0.88rem; padding: 0.45rem 0.55rem; }
.filtros-grid .field textarea { font-size: 0.88rem; }

.button,
a.button {
  display: inline-block;
  width: auto;
  margin: 0;
  padding: 0.6rem 1rem;
  border: 0;
  border-radius: 8px;
  background: #2563eb;
  color: #fff;
  font-size: 0.9rem;
  font-weight: 600;
  text-decoration: none;
  cursor: pointer;
  transition: background 0.15s ease;
}
.button:hover { background: #1d4ed8; }
/* Variante clara: también para <a class="button"> (un selector de elemento
   como `a.button` ganaría a `.button-quiet` por especificidad). */
.button.button-quiet,
a.button.button-quiet { background: #e2e8f0; color: #0f172a; }
.button.button-quiet:hover,
a.button.button-quiet:hover { background: #cbd5e1; }

.btn-ghost {
  flex-shrink: 0;
  padding: 0.5rem 0.9rem;
  border: 1px solid #cbd5e1;
  border-radius: 8px;
  background: #fff;
  color: #334155;
  font-size: 0.85rem;
  font-weight: 600;
  text-decoration: none;
}
.btn-ghost:hover { background: #f1f5f9; }

.link {
  display: inline;
  width: auto;
  margin: 0;
  padding: 0;
  border: 0;
  background: none;
  color: #2563eb;
  font-size: 0.85rem;
  font-weight: 600;
  text-decoration: none;
  cursor: pointer;
}
.link:hover { text-decoration: underline; }
.link-danger { color: #dc2626; }

.table-wrap { overflow-x: auto; margin-top: 1.2rem; }

.table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.88rem;
}
.table th {
  text-align: left;
  padding: 0.55rem 0.6rem;
  border-bottom: 2px solid #e2e8f0;
  color: #64748b;
  font-size: 0.74rem;
  text-transform: uppercase;
  letter-spacing: 0.05em;
}
.table td {
  padding: 0.7rem 0.6rem;
  border-bottom: 1px solid #f1f5f9;
  color: #334155;
  vertical-align: top;
}
.table tbody tr:hover { background: #f8fafc; }
.col-acciones { text-align: right; white-space: nowrap; }
.table td form { display: inline; margin-left: 0.7rem; }
.table-foot {
  margin: 0.9rem 0 0;
  font-size: 0.78rem;
  color: #94a3b8;
  text-align: right;
}

.chip {
  display: inline-block;
  padding: 0.15rem 0.55rem;
  border-radius: 999px;
  font-size: 0.74rem;
  font-weight: 700;
}
.chip-on { background: #dcfce7; color: #166534; border: 1px solid #86efac; }
.chip-off { background: #f1f5f9; color: #64748b; border: 1px solid #e2e8f0; }

.empty {
  margin-top: 1.3rem;
  padding: 2rem 1rem;
  text-align: center;
  border: 1px dashed #cbd5e1;
  border-radius: 12px;
  background: #f8fafc;
}
.empty p { margin: 0 0 1rem; color: #64748b; }

/* ------------------------------------------------------------ formularios */

.form { margin-top: 1.4rem; }

.field { margin-bottom: 1rem; }
.field label {
  display: block;
  margin: 0 0 0.3rem;
  font-size: 0.85rem;
  font-weight: 600;
  color: #334155;
}
.field input,
.field textarea,
.field select {
  width: 100%;
  padding: 0.6rem 0.7rem;
  border: 1px solid #cbd5e1;
  border-radius: 8px;
  font-size: 0.95rem;
  font-family: inherit;
  background: #f8fafc;
  color: #0f172a;
}
.field textarea { resize: vertical; }
.field input:focus,
.field textarea:focus,
.field select:focus {
  outline: none;
  border-color: #3b82f6;
  box-shadow: 0 0 0 3px rgba(59, 130, 246, 0.25);
  background: #fff;
}
.field input.invalid,
.field textarea.invalid { border-color: #dc2626; background: #fef2f2; }

.field-row {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 0.9rem;
}

.field-error {
  display: block;
  margin-top: 0.25rem;
  font-size: 0.78rem;
  color: #b91c1c;
}

.check {
  display: flex;
  align-items: flex-start;
  gap: 0.55rem;
  margin: 0.4rem 0 1rem;
  font-size: 0.88rem;
  color: #334155;
  cursor: pointer;
}
.check input { width: 1.05rem; height: 1.05rem; margin-top: 0.15rem; accent-color: #2563eb; }

.form-actions {
  display: flex;
  align-items: center;
  gap: 0.8rem;
  margin-top: 1.4rem;
  padding-top: 1.1rem;
  border-top: 1px solid #f1f5f9;
}
.form-actions button { width: auto; margin-top: 0; padding: 0.7rem 1.4rem; }

/* ------------------------------------------------------- productos / catálogos */

.head-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
  flex-shrink: 0;
}

.section-title {
  margin: 1.8rem 0 0.2rem;
  padding-bottom: 0.4rem;
  border-bottom: 1px solid #e2e8f0;
  font-size: 0.78rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: #64748b;
}
.section-title:first-of-type { margin-top: 1.4rem; }

.section-lead {
  margin: 0.6rem 0 1rem;
  font-size: 0.86rem;
  color: #64748b;
}

.toolbar-note {
  margin: 0;
  font-size: 0.82rem;
  color: #94a3b8;
}

.prod {
  display: flex;
  align-items: center;
  gap: 0.6rem;
}
.thumb {
  width: 40px;
  height: 40px;
  flex-shrink: 0;
  border-radius: 8px;
  border: 1px solid #e2e8f0;
  object-fit: cover;
  background: #f8fafc;
}
.thumb-empty {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-size: 1.1rem;
}

.chip-neutral { background: #f1f5f9; color: #334155; border: 1px solid #e2e8f0; }
.chip-disponible { background: #dcfce7; color: #166534; border: 1px solid #86efac; }
.chip-reservado { background: #fef3c7; color: #92400e; border: 1px solid #fcd34d; }
.chip-vendido { background: #dbeafe; color: #1e40af; border: 1px solid #93c5fd; }
.chip-baja { background: #fee2e2; color: #991b1b; border: 1px solid #fca5a5; }

.field-hint {
  display: block;
  margin-top: 0.3rem;
  font-size: 0.76rem;
  color: #94a3b8;
}

.campo-oculto { display: none; }

.foto-preview {
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: 96px;
  padding: 0.5rem;
  border: 1px dashed #cbd5e1;
  border-radius: 10px;
  background: #f8fafc;
}
.foto-preview img {
  max-width: 160px;
  max-height: 120px;
  border-radius: 8px;
  object-fit: contain;
}
.foto-vacia { font-size: 0.8rem; color: #94a3b8; }

.check-small { margin: 0.5rem 0 0; font-size: 0.8rem; }
.check-inline { margin: 0; align-items: center; min-width: 150px; }

.variante-row {
  display: flex;
  align-items: center;
  gap: 0.9rem;
  padding: 0.6rem 0.8rem;
  margin-bottom: 0.5rem;
  border: 1px solid #e2e8f0;
  border-radius: 10px;
  background: #f8fafc;
  opacity: 0.65;
}
.variante-row.activa {
  border-color: #93c5fd;
  background: #eff6ff;
  opacity: 1;
}
.field-inline { flex: 1; margin: 0; }

.form-inline-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
  gap: 0.8rem;
  align-items: end;
}
.form-inline-grid .field { margin-bottom: 0; }
.field-btn { display: flex; align-items: flex-end; }
.field-btn button { width: 100%; margin: 0; }

.form-estado { display: inline; margin-right: 0.6rem; }
.form-estado select {
  padding: 0.25rem 0.4rem;
  border: 1px solid #cbd5e1;
  border-radius: 6px;
  font-size: 0.8rem;
  background: #fff;
}
.form-rename { display: flex; gap: 0.5rem; align-items: center; }
.form-rename input[type="text"] {
  padding: 0.4rem 0.55rem;
  border: 1px solid #cbd5e1;
  border-radius: 8px;
  font-size: 0.88rem;
  background: #fff;
  min-width: 160px;
}
button.small:hover { background: #1d4ed8; }

/* --------------------------------------------------------- diálogo propio */

.modal-overlay {
  position: fixed;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 1rem;
  background: rgba(15, 23, 42, 0.55);
  z-index: 50;
}
.modal-overlay[hidden] { display: none; }

.modal {
  width: min(430px, 100%);
  /* En ventanas bajas (sin F11) el modal puede ser más alto que el viewport:
     entonces se encoge y scrollea por dentro, y los botones de abajo
     (Cancelar / Confirmar cobro) siguen alcanzables. */
  max-height: calc(100dvh - 1.5rem);
  overflow-y: auto;
  overscroll-behavior: contain;
  padding: 1.3rem 1.4rem;
  border-radius: 14px;
  background: #fff;
  box-shadow: 0 24px 60px rgba(0, 0, 0, 0.35);
}
/* Los botones de acción quedan siempre visibles, fijos al borde inferior
   del modal aunque el contenido haga scroll. (Van dentro del <form> de cada
   modal, no como hijo directo.) */
.modal .modal-actions {
  position: sticky;
  bottom: 0;
  margin-top: 1rem;
  padding: 0.6rem 0 0.2rem;
  background: #fff;
}
.modal-texto {
  margin: 0 0 1.2rem;
  font-size: 0.95rem;
  line-height: 1.55;
  color: #0f172a;
}
.modal-actions {
  display: flex;
  justify-content: flex-end;
  align-items: center;
  flex-wrap: wrap;
  gap: 0.6rem;
}
.modal-actions .button { width: auto; margin: 0; padding: 0.6rem 1.1rem; flex: 0 1 auto; }

/* ------------------------------------------------------------------- POS */

.container-pos { max-width: 1120px; }

/* Barra de navegación superior del POS */
.pos-nav {
  display: flex;
  align-items: center;
  gap: 1rem;
  flex-wrap: wrap;
  margin-bottom: 1.2rem;
  padding: 0.7rem 0.9rem;
  border-radius: 12px;
  background: #0f172a;
}
.pos-brand {
  font-weight: 700;
  color: #fff;
  text-decoration: none;
  font-size: 1.05rem;
}
.pos-tabs {
  display: flex;
  gap: 0.3rem;
  flex-wrap: wrap;
  flex: 1;
}
.pos-tabs a {
  padding: 0.42rem 0.8rem;
  border-radius: 8px;
  color: #cbd5e1;
  text-decoration: none;
  font-size: 0.87rem;
  font-weight: 500;
}
.pos-tabs a:hover { background: rgba(255, 255, 255, 0.1); color: #fff; }
.pos-usuario {
  display: flex;
  align-items: center;
  gap: 0.6rem;
}
.pos-usuario form { margin: 0; }
.pos-usuario .link { color: #93c5fd; font-size: 0.82rem; background: none; border: 0; padding: 0; }

/* Rejilla de paneles */
.pos-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
  gap: 1rem;
  margin-top: 1rem;
}
.pos-panel {
  padding: 1.1rem;
  border: 1px solid #e2e8f0;
  border-radius: 12px;
  background: #f8fafc;
}
.pos-panel-venta { background: #fff; border-color: #bfdbfe; }
.pos-lista { list-style: none; margin: 0; padding: 0; }
.pos-lista li {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 0.6rem;
  padding: 0.5rem 0;
  border-bottom: 1px dashed #e2e8f0;
  font-size: 0.9rem;
}
.pos-lista li:last-child { border-bottom: 0; }

/* Botón grande «continuar venta» */
.pos-continuar {
  display: flex;
  align-items: center;
  gap: 0.9rem;
  padding: 1rem;
  margin: 0.8rem 0;
  border-radius: 12px;
  background: #16a34a;
  color: #fff;
  text-decoration: none;
}
.pos-continuar:hover { background: #15803d; }
.pos-continuar-icono {
  display: grid;
  place-items: center;
  width: 42px;
  height: 42px;
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.2);
  font-size: 1.1rem;
}
.pos-continuar strong { display: block; font-size: 1.05rem; }
.pos-continuar small { opacity: 0.9; }

/* Cajas de dato (resúmenes) */
.pos-resumen {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(130px, 1fr));
  gap: 0.7rem;
  margin: 1rem 0;
}
.pos-dato {
  padding: 0.7rem 0.8rem;
  border: 1px solid #e2e8f0;
  border-radius: 10px;
  background: #fff;
}
.pos-dato span {
  display: block;
  font-size: 0.74rem;
  text-transform: uppercase;
  letter-spacing: 0.03em;
  color: #64748b;
}
.pos-dato strong { font-size: 1.05rem; color: #0f172a; }

/* PIN */
.pin-input {
  letter-spacing: 0.4em;
  font-size: 1.2rem !important;
  text-align: center;
  font-family: ui-monospace, monospace;
}
.field-pin { min-width: 130px; }
.field-checks {
  border: 1px solid #e2e8f0;
  border-radius: 10px;
  padding: 0.7rem 0.9rem;
  margin: 0 0 1rem;
}
.field-checks legend { font-size: 0.78rem; color: #64748b; padding: 0 0.3rem; }
.field-checks .check { margin: 0.3rem 0; }
.field-check { margin-bottom: 1rem; }

/* ------------------------------- pantalla de venta (tipo Odoo) */

/* En la pantalla de venta los avisos flotan: no empujan el layout y el
   teclado/Validar siguen cabiendo en el viewport. */
body.body-venta .flash {
  position: fixed;
  top: 0.6rem;
  right: 0.8rem;
  left: auto;
  z-index: 60;
  max-width: min(46vw, 430px);
  margin: 0;
  box-shadow: 0 12px 32px rgba(15, 23, 42, 0.35);
}

/* A sangre: la venta ocupa todo el ancho disponible. */
/* Altura fija al viewport: la pantalla de venta nunca hace scroll de
   página; solo scrollean dentro de su caja las líneas y el catálogo. */
body.body-venta { display: block; padding: 0; height: 100vh; overflow: hidden; }
.container-bleed {
  max-width: none;
  width: 100%;
  height: 100vh;
  padding: 0.5rem 0.7rem 1.1rem;   /* margen inferior: usable sin F11 */
}

.pos-app {
  display: flex;
  flex-direction: column;
  gap: 0.55rem;
  height: 100%;
  min-height: 0;
}

/* El `button` global mete margin-top: 1.4rem (22 px). Dentro del POS se
   anula: cada bloque ya tiene su espaciado y ese margen hacía que cada tecla
   y cada pestaña gastara 22 px de más (y en pantallas bajas se salía el
   botón "Validar"). */
.pos-app button,
.modal button { margin-top: 0; }

/* Barra superior (~10 % de la altura): pedidos en curso + volver. */
.pos-topbar {
  position: sticky;
  top: -0.6rem;
  z-index: 20;
  display: flex;
  align-items: center;
  gap: 0.9rem;
  flex: 0 0 auto;
  min-height: 9vh;
  padding: 0.45rem 0.8rem;
  border-radius: 12px;
  background: #0f172a;
}
.pos-volver {
  flex: 0 0 auto;
  width: auto;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 0.5rem 0.9rem;
  margin: 0;
  border: 1px solid #334155;
  border-radius: 8px;
  background: transparent;
  color: #e2e8f0;
  text-decoration: none;
  font-size: 0.88rem;
  font-weight: 600;
  cursor: pointer;
}
.pos-volver:hover { background: #1e293b; }

.pos-pedidos {
  display: flex;
  align-items: stretch;
  gap: 0.5rem;
  flex: 1;
  min-width: 0;
  overflow-x: auto;
  padding-bottom: 0.15rem;
}
.pos-pedido-form { margin: 0; flex-shrink: 0; }
.pos-pedido {
  display: flex;
  flex-direction: column;
  gap: 0.1rem;
  min-width: 132px;
  padding: 0.45rem 0.75rem;
  border: 1px solid #334155;
  border-radius: 10px;
  background: #1e293b;
  color: #cbd5e1;
  text-align: left;
  cursor: pointer;
}
.pos-pedido strong { font-size: 0.88rem; color: #fff; }
.pos-pedido small { font-size: 0.72rem; opacity: 0.8; }
.pos-pedido:hover { background: #273449; }
.pos-pedido.activo {
  background: #2563eb;
  border-color: #60a5fa;
  box-shadow: 0 0 0 2px rgba(96, 165, 250, 0.35);
}
.pos-pedido-nuevo {
  min-width: 46px;
  align-items: center;
  justify-content: center;
  font-size: 1.3rem;
  font-weight: 700;
  color: #86efac;
}
.pos-topbar-caja {
  flex-shrink: 0;
  color: #94a3b8;
  font-size: 0.82rem;
}
.pos-topbar-caja strong { color: #fff; }

/* Cuerpo: 30 % ticket + 70 % catálogo */
.pos-layout {
  display: flex;
  gap: 0.8rem;
  align-items: stretch;
  flex: 1;
  min-height: 0;   /* clave: los hijos pueden encoger y scrollear dentro */
}
.pos-ticket {
  flex: 0 0 30%;
  max-width: 30%;
  min-width: 300px;
  min-height: 0;
  overflow: hidden;
  display: flex;
  flex-direction: column;
  gap: 0.55rem;
  padding: 0.7rem 0.8rem;
  border: 1px solid #e2e8f0;
  border-radius: 12px;
  background: #f8fafc;
}
.pos-catalogo {
  flex: 1 1 70%;
  min-width: 0;
  min-height: 0;
  display: flex;
  flex-direction: column;
  gap: 0.55rem;
}
@media (max-width: 900px) {
  /* Pantallas estrechas: se apila y aquí sí se permite scroll de página
     (es el único caso en el que no cabe todo en viewport). */
  body.body-venta { overflow: auto; }
  .container-bleed, .pos-app { height: auto; min-height: 100vh; }
  .pos-layout { flex-direction: column; }
  .pos-ticket { flex-basis: auto; max-width: none; min-width: 0; overflow: visible; }
}

/* Cabecera del ticket */
.pos-ticket-cab {
  flex: 0 0 auto;
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 0.6rem;
  flex-wrap: wrap;
}
.pos-ticket-cab .section-title { margin-top: 0; }
.pos-ticket-acciones { display: flex; gap: 0.4rem; flex-wrap: wrap; }
.pos-ticket-acciones form { margin: 0; }
.pos-ticket-acciones .button {
  width: auto;
  margin: 0;
  padding: 0.45rem 0.75rem;
  font-size: 0.8rem;
}
.pos-vacio { flex: 4 1 auto; min-height: 0; padding: 0.9rem 0.6rem; }
.pos-vacio p { margin: 0 0 0.5rem; }
.pos-vacio p:last-child { margin-bottom: 0; }

/* Líneas del pedido: scrolla solo dentro de su caja (nunca la página).
   Encoge antes que el teclado (flex-shrink 4): primero se reduce la lista
   y solo después las teclas, para que "Validar" nunca se salga. */
.pos-lineas {
  list-style: none;
  margin: 0;
  padding: 0;
  flex: 4 1 auto;
  min-height: 40px;
  overflow-y: auto;
  scrollbar-width: thin;
  overscroll-behavior: contain;
  border: 1px solid #e2e8f0;
  border-radius: 10px;
  background: #fff;
}
.pos-linea {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 0.6rem;
  padding: 0.55rem 0.7rem;
  border-bottom: 1px solid #f1f5f9;
  cursor: pointer;
}
.pos-linea:last-child { border-bottom: 0; }
.pos-linea:hover { background: #f8fafc; }
.pos-linea.activa {
  background: #eff6ff;
  box-shadow: inset 3px 0 0 #2563eb;
}
.pos-linea-info { min-width: 0; font-size: 0.88rem; }
.pos-linea-info strong { display: block; }
.pos-linea-info small { display: block; font-size: 0.72rem; }
.pos-linea-total {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  flex-shrink: 0;
}
.pos-linea-total strong { font-size: 0.95rem; white-space: nowrap; }
.pos-linea-total form { margin: 0; }
/* Quitar línea: la ✕ centrada. Ojo: el `button` global mete
   display:block, width:100%, margin-top y padding; hay que resetearlos. */
.icon-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 28px;
  height: 28px;
  margin: 0;
  padding: 0;
  border: 1px solid #fecaca;
  border-radius: 8px;
  background: #fff;
  color: #dc2626;
  font-size: 1rem;
  line-height: 1;
  cursor: pointer;
}
.icon-btn:hover { background: #fee2e2; }

/* Validar/cobrar: botón único con el total, bajo el teclado */
.pos-validar {
  flex: 0 0 auto;
  width: 100%;
  padding: 0.8rem;
  border: 0;
  border-radius: 12px;
  background: #16a34a;
  color: #fff;
  font-size: 1.05rem;
  font-weight: 700;
  cursor: pointer;
}
.pos-validar:hover:not(:disabled) { background: #15803d; }
.pos-validar:disabled { background: #334155; color: #64748b; cursor: not-allowed; }

/* Teclado numérico (cantidad / precio / descuento).
   Por defecto es COMPACTO: cabe en cualquier ventana y el botón "Validar"
   nunca se sale. Solo cuando sobra altura (min-height: 761px) se muestra
   la línea de estado y las teclas más grandes.
   El teclado puede encoger (flex-shrink) cuando la pantalla es baja: las
   teclas absorben la reducción (grid con filas 1fr y overflow oculto). */
.pos-teclado {
  flex: 0 1 auto;
  min-height: 0;
  display: flex;
  flex-direction: column;
  padding: 0.4rem 0.5rem 0.45rem;
  border: 1px solid #cbd5e1;
  border-radius: 12px;
  background: #f1f5f9;
}
.pos-teclado-estado {
  display: none;   /* se recupera con @media (min-height: 761px) */
  flex: 0 0 auto;
  margin: 0 0 0.3rem;
  font-size: 0.7rem;
  color: #64748b;
  min-height: 1em;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.pos-teclado-modos {
  flex: 0 0 auto;
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 0.25rem;
  margin-bottom: 0.25rem;
}
.pos-teclado-modos button {
  padding: 0.25rem 0.2rem;
  border: 1px solid #cbd5e1;
  border-radius: 8px;
  background: #fff;
  font-size: 0.72rem;
  font-weight: 600;
  color: #334155;
  cursor: pointer;
}
.pos-teclado-modos button:hover:not(:disabled) { border-color: #93c5fd; }
.pos-teclado-modos button.activo {
  background: #2563eb;
  border-color: #2563eb;
  color: #fff;
}
.pos-teclado-modos button:disabled { opacity: 0.45; cursor: not-allowed; }
.pos-teclado-pantalla {
  flex: 0 0 auto;
  padding: 0.15rem 0.5rem;
  margin-bottom: 0.25rem;
  border: 1px solid #cbd5e1;
  border-radius: 8px;
  background: #fff;
  text-align: right;
  font-family: ui-monospace, "SF Mono", monospace;
  font-size: 1rem;
  font-weight: 700;
  color: #0f172a;
  min-height: 1.5rem;
}
.pos-teclado-teclas {
  flex: 1 1 auto;
  min-height: 0;
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  grid-auto-rows: minmax(0, 1fr);
  gap: 0.25rem;
  overflow: hidden;   /* si no cabe, las teclas se comprimen en vez de empujar "Validar" */
}
.pos-teclado-teclas button {
  min-height: 0;
  overflow: hidden;
  padding: 0.3rem 0;
  border: 1px solid #cbd5e1;
  border-radius: 10px;
  background: #fff;
  font-size: 0.9rem;
  font-weight: 600;
  color: #0f172a;
  cursor: pointer;
}
.pos-teclado-teclas button:hover { background: #eff6ff; border-color: #93c5fd; }
.pos-teclado-teclas button:active { background: #dbeafe; }
.pos-teclado-teclas .tecla-cero { grid-column: span 1; }
.pos-teclado-teclas .tecla-aplicar {
  background: #16a34a;
  border-color: #16a34a;
  color: #fff;
}
.pos-teclado-teclas .tecla-aplicar:hover { background: #15803d; }

/* Buscador y rejilla de productos (70 %) */
.pos-buscador { position: relative; }
.pos-buscador-campo { position: relative; }
.pos-buscador-campo input {
  width: 100%;
  padding: 0.85rem 2.6rem 0.85rem 1rem;
  font-size: 1.05rem;
  border: 2px solid #93c5fd;
  border-radius: 12px;
  background: #fff;
}
.pos-buscador-campo input:focus {
  outline: none;
  border-color: #2563eb;
  background: #fff;
}
.pos-buscador-lupa {
  position: absolute;
  right: 0.9rem;
  top: 50%;
  transform: translateY(-50%);
  opacity: 0.6;
}

.pos-catalogo-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(160px, 1fr));
  gap: 0.6rem;
  align-content: start;
  flex: 1 1 auto;
  min-height: 0;
  overflow-y: auto;   /* único scroll junto con la lista de líneas */
  scrollbar-width: thin;
  overscroll-behavior: contain;
  padding-bottom: 0.4rem;
}
.pos-prod {
  display: flex;
  flex-direction: column;
  gap: 0.25rem;
  padding: 0.75rem 0.8rem;
  border: 1px solid #e2e8f0;
  border-radius: 12px;
  background: #fff;
  text-align: left;
  cursor: pointer;
  min-height: 168px;
}
.pos-prod:hover { border-color: #93c5fd; background: #eff6ff; }
.pos-prod:active { transform: translateY(1px); }
/* Foto del producto en la tarjeta del POS */
.pos-prod-foto {
  flex: 0 0 auto;   /* si no, la tarjeta (flex) la aplasta hasta dejarla en 9 px */
  width: 100%;
  height: 72px;
  object-fit: contain;
  border: 1px solid #e2e8f0;
  border-radius: 8px;
  background: #f8fafc;
  margin-bottom: 0.15rem;
}
.pos-prod strong {
  font-size: 0.92rem;
  color: #0f172a;
  line-height: 1.25;
  overflow: hidden;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
}
.pos-prod small { font-size: 0.74rem; color: #94a3b8; }
.pos-prod-precio {
  margin-top: auto;
  font-size: 1rem;
  font-weight: 800;
  color: #2563eb;
}
.pos-prod.agotado { opacity: 0.55; }
.pos-prod.agotado:hover { opacity: 0.85; }
.pos-prod.agotado .pos-prod-precio { color: #94a3b8; }
.pos-grid-vacio { grid-column: 1 / -1; padding: 1.5rem; text-align: center; }

/* Pantallas bajas (p. ej. 1366×768): todo el POS sigue cabiendo en el
   viewport sin scroll — se comprime barra, ticket y teclado. */
@media (max-height: 880px) {
  .container-bleed { padding-top: 0.35rem; padding-bottom: 0.35rem; }
  .pos-app { gap: 0.35rem; }
  .pos-topbar { min-height: 7vh; padding: 0.3rem 0.7rem; }
  .pos-ticket { gap: 0.35rem; padding: 0.5rem 0.6rem; }
  .pos-ticket-cab .section-title { font-size: 0.92rem; margin-bottom: 0.1rem; }
  .pos-ticket-cab .subtitle { font-size: 0.76rem; margin-bottom: 0; }
  .pos-ticket-acciones .button { padding: 0.35rem 0.6rem; font-size: 0.74rem; }
  .pos-vacio { padding: 0.55rem; font-size: 0.82rem; }
  .pos-vacio p { margin: 0 0 0.3rem; }
  .pos-linea { padding: 0.4rem 0.6rem; }
  .pos-validar { margin-top: 0.15rem; padding: 0.55rem; font-size: 0.95rem; }
}

/* Pantallas muy bajas (p. ej. navegador sin F11 en un portátil pequeño):
   se comprime aún más para que el botón "Validar" siga visible y las teclas
   no se aplasten. */
@media (max-height: 660px) {
  .container-bleed { padding-top: 0.3rem; padding-bottom: 0.45rem; }
  .pos-app { gap: 0.3rem; }
  .pos-topbar { min-height: 0; padding: 0.25rem 0.6rem; }
  .pos-pedido { padding: 0.3rem 0.6rem; min-width: 120px; }
  .pos-ticket { gap: 0.3rem; padding: 0.45rem 0.55rem; }
  .pos-ticket-cab { align-items: center; }
  .pos-ticket-cab .section-title { font-size: 0.86rem; margin-bottom: 0; }
  .pos-ticket-cab .subtitle { font-size: 0.7rem; margin-top: 0.1rem; }
  .pos-ticket-acciones .button { padding: 0.22rem 0.5rem; font-size: 0.7rem; }
  .pos-lineas { min-height: 24px; }
  .pos-linea { padding: 0.3rem 0.5rem; }
  .pos-validar { padding: 0.45rem; font-size: 0.92rem; }
  .pos-teclado { padding: 0.35rem 0.45rem 0.4rem; }
  .pos-teclado-modos { margin-bottom: 0.2rem; gap: 0.2rem; }
  .pos-teclado-modos button { padding: 0.15rem 0.1rem; font-size: 0.68rem; }
  .pos-teclado-pantalla {
    min-height: 1.15rem;
    padding: 0.05rem 0.45rem;
    margin-bottom: 0.15rem;
    font-size: 0.9rem;
  }
  .pos-teclado-teclas { gap: 0.2rem; }
  .pos-teclado-teclas button { padding: 0.2rem 0; font-size: 0.85rem; }
}

/* Con altura de sobra se muestra la línea de estado y teclas más grandes. */
@media (min-height: 761px) {
  .pos-teclado { padding: 0.55rem 0.6rem 0.6rem; }
  .pos-teclado-estado { display: block; }
  .pos-teclado-modos { margin-bottom: 0.4rem; gap: 0.3rem; }
  .pos-teclado-modos button { padding: 0.38rem 0.3rem; font-size: 0.78rem; }
  .pos-teclado-pantalla {
    min-height: 2rem;
    padding: 0.35rem 0.6rem;
    margin-bottom: 0.4rem;
    font-size: 1.15rem;
  }
  .pos-teclado-teclas { gap: 0.3rem; }
  .pos-teclado-teclas button { padding: 0.5rem 0; font-size: 0.98rem; }
}

/* ------------------------------- modales del POS */

.modal-ancha { width: min(560px, 100%); }
.modal-titulo { margin: 0 0 0.9rem; font-size: 1.1rem; color: #0f172a; }

.modal-pestanas { display: flex; gap: 0.4rem; margin-bottom: 1rem; }
.pestana {
  flex: 1;
  padding: 0.55rem;
  border: 1px solid #e2e8f0;
  border-radius: 8px;
  background: #f8fafc;
  color: #475569;
  font-size: 0.88rem;
  cursor: pointer;
}
.pestana.activa {
  background: #2563eb;
  border-color: #2563eb;
  color: #fff;
  font-weight: 600;
}

.lista-clientes, .lista-series {
  list-style: none;
  margin: 0.8rem 0 0;
  padding: 0;
  max-height: 260px;
  overflow-y: auto;
  border: 1px solid #e2e8f0;
  border-radius: 10px;
}
.lista-clientes li, .lista-series li { border-bottom: 1px solid #f1f5f9; }
.lista-clientes li:last-child, .lista-series li:last-child { border-bottom: 0; }
.lista-cliente-opcion, .lista-serie-opcion {
  display: flex;
  flex-direction: column;
  gap: 0.15rem;
  width: 100%;
  margin: 0;
  padding: 0.65rem 0.8rem;
  border: 0;
  background: none;
  color: #0f172a;   /* el `button` global pone color blanco: hay que forzar el oscuro */
  text-align: left;
  cursor: pointer;
  font-size: 0.9rem;
}
.lista-cliente-opcion:hover, .lista-serie-opcion:hover { background: #eff6ff; }
/* IMEI / número de serie en el modal de elección de unidad */
.serie-numero { font-size: 0.98rem; letter-spacing: 0.02em; }
.lista-clientes input[type="search"], .pestana-contenido input[type="search"] {
  width: 100%;
  padding: 0.6rem 0.8rem;
  border: 1px solid #cbd5e1;
  border-radius: 10px;
}
.lista-clientes .muted { padding: 0.7rem 0.8rem; }

/* Cobro */
.cobro-total {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 0.9rem 1rem;
  margin-bottom: 1rem;
  border-radius: 12px;
  background: #eff6ff;
  border: 1px solid #bfdbfe;
}
.cobro-total span { color: #1e40af; font-size: 0.9rem; }
.cobro-total strong { font-size: 1.5rem; color: #1e3a8a; }

/* Rejillas de botones: nunca se solapan (cada uno en su celda). */
.cobro-metodos {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(140px, 1fr));
  gap: 0.5rem;
  margin-bottom: 1rem;
}
.cobro-metodo {
  padding: 0.7rem 0.6rem;
  border: 2px solid #e2e8f0;
  border-radius: 10px;
  background: #fff;
  font-size: 0.95rem;
  font-weight: 600;
  color: #334155;
  text-align: center;
  cursor: pointer;
  overflow-wrap: anywhere;
}
.cobro-metodo:hover { border-color: #93c5fd; }
.cobro-metodo.activo {
  border-color: #2563eb;
  background: #2563eb;
  color: #fff;
}

.cobro-rapido {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(114px, 1fr));
  gap: 0.4rem;
  margin-top: 0.5rem;
}
.chip-boton {
  padding: 0.45rem 0.5rem;
  border: 1px solid #cbd5e1;
  border-radius: 999px;
  background: #fff;
  font-size: 0.8rem;
  text-align: center;
  cursor: pointer;
  color: #0f172a;
  overflow-wrap: anywhere;
}
.chip-boton:hover { background: #eff6ff; border-color: #93c5fd; }
.chip-justo { background: #dcfce7; border-color: #86efac; color: #166534; font-weight: 600; }

.cobro-cambio {
  margin-top: 0.6rem;
  padding: 0.6rem 0.8rem;
  border-radius: 10px;
  background: #dcfce7;
  border: 1px solid #86efac;
  color: #166534;
  font-size: 0.95rem;
}
.cobro-cambio.insuficiente { background: #fee2e2; border-color: #fca5a5; color: #991b1b; }
.pos-confirmar-cobro {
  width: auto;
  margin: 0;
  padding: 0.7rem 1.3rem;
  background: #16a34a;
  color: #fff;
  border: 0;
  border-radius: 10px;
  font-weight: 700;
  cursor: pointer;
}
.pos-confirmar-cobro:hover { background: #15803d; }

/* Arqueo del cierre */
.arqueo-vista {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 0.6rem;
  margin: 0.4rem 0 1rem;
}
.arqueo-vista .pos-dato strong { font-size: 0.98rem; }
#arqueo-diferencia.sobra { color: #16a34a; }
#arqueo-diferencia.falta { color: #dc2626; }

/* Tickets */
.fila-total td { background: #f1f5f9; }
.pos-anular { margin-top: 1.2rem; border-top: 1px solid #e2e8f0; padding-top: 0.8rem; }
.pos-anular summary {
  cursor: pointer;
  color: #dc2626;
  font-weight: 600;
  font-size: 0.9rem;
}
.pos-anular .form { margin-top: 0.9rem; }
.pos-anular .button-danger {
  background: #dc2626;
  color: #fff;
  width: auto;
  margin: 0;
  padding: 0.65rem 1.3rem;
}
.pos-anular .button-danger:hover { background: #b91c1c; }
.button-danger-quiet {
  background: #fee2e2;
  color: #991b1b;
  width: auto;
  margin: 0;
  padding: 0.5rem 0.9rem;
  font-size: 0.85rem;
}
.button-danger-quiet:hover { background: #fecaca; }

/* Detalle de fila (editar cajero / método) */
.row-detalle { display: inline-block; margin-right: 0.7rem; }
.row-detalle summary { list-style: none; cursor: pointer; }
.row-detalle summary::-webkit-details-marker { display: none; }
.form-inline-detalle {
  margin: 0.6rem 0;
  padding: 0.9rem;
  border: 1px solid #bfdbfe;
  border-radius: 10px;
  background: #eff6ff;
  text-align: left;
  min-width: 300px;
}
.form-inline-detalle .field-row { grid-template-columns: 1fr 1fr; }

/* Formulario de rango de fechas */
.form-rango { max-width: 560px; }
.form-rango .field-row { grid-template-columns: 1fr 1fr auto; align-items: end; }

@media (max-width: 560px) {
  .field-row { grid-template-columns: 1fr; }
  .head { flex-direction: column; }
  .variante-row { flex-direction: column; align-items: stretch; }
}


/* ------------------------------- ticket 80 mm (plantilla de impresión) */

@page { size: 80mm auto; margin: 0; }

body.body-ticket {
  display: block;
  min-height: 100vh;
  margin: 0;
  padding: 1rem 0;
  background: #475569;
  font-family: ui-monospace, "SF Mono", "Courier New", monospace;
  color: #000;
}
.ticket-hoja {
  width: 76mm;
  margin: 0 auto;
  padding: 4mm;
  background: #fff;
  color: #000;
  font-size: 11px;
  line-height: 1.4;
  box-shadow: 0 10px 30px rgba(0, 0, 0, 0.35);
}

.ticket-cabecera { text-align: center; }
.ticket-logo { width: 22mm; height: 22mm; object-fit: contain; }
.ticket-cabecera h1 {
  margin: 2mm 0 0.5mm;
  font-size: 14px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.04em;
}
.ticket-eslogan { margin: 0; font-size: 10px; }
.ticket-datos { margin: 1.5mm 0 0; font-size: 10px; }
.ticket-anulado {
  margin: 2mm 0 0;
  font-size: 12px;
  font-weight: 700;
  text-transform: uppercase;
}

.ticket-corte {
  margin: 2.5mm 0;
  border: 0;
  border-top: 1px dashed #000;
}

.ticket-productos {
  list-style: none;
  margin: 0;
  padding: 0;
}
.ticket-productos li { padding: 1mm 0; }
.tp-fila {
  display: flex;
  justify-content: space-between;
  gap: 2mm;
}
.tp-nombre { flex: 1; overflow-wrap: anywhere; }
.tp-importe { font-weight: 700; white-space: nowrap; }
.tp-detalle { display: block; font-size: 10px; color: #333; }
/* Atributos (color, capacidad...) y número de serie / IMEI de la unidad */
.tp-atributos {
  display: block;
  font-size: 10px;
  font-weight: 700;
  color: #0f172a;
  overflow-wrap: anywhere;
}
.tp-vacio { text-align: center; font-size: 10px; }

.ticket-resumen { margin: 0; }
.ticket-resumen > div {
  display: flex;
  justify-content: space-between;
  gap: 2mm;
  padding: 0.5mm 0;
  font-size: 11px;
}
.ticket-resumen dd { margin: 0; }
.ticket-total {
  margin-top: 1.5mm;
  padding-top: 1.5mm !important;
  border-top: 1px solid #000;
  font-size: 14px !important;
  font-weight: 700;
}
.ticket-total dt, .ticket-total dd { font-weight: 700; }
.ticket-pago { text-align: center; font-size: 10px; }
.ticket-gracias { text-align: center; font-size: 10px; margin-top: 2mm; }

/* Pie bajo la hoja, solo en pantalla: volver a la venta y enviar el ticket
   por correo. Lleva .no-print: nunca entra en el papel. */
.ticket-pie { width: min(560px, 100%); margin: 1.2rem auto 2rem; }
.ticket-pie-fila {
  display: flex;
  gap: 0.6rem;
  align-items: stretch;
  flex-wrap: wrap;
}
.ticket-pie .button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  flex: 0 0 auto;
  margin: 0;
  padding: 0.7rem 1.3rem;
  text-align: center;
}
.ticket-enviar { display: flex; gap: 0.5rem; flex: 1 1 320px; margin: 0; }
.ticket-enviar input {
  flex: 1 1 auto;
  min-width: 0;
  margin: 0;
  padding: 0.65rem 0.75rem;
  font-size: 0.95rem;
}
.ticket-enviar button {
  flex: 0 0 auto;
  width: auto;
  margin: 0;
  padding: 0.65rem 1.1rem;
  font-size: 0.92rem;
}
.ticket-aviso {
  margin: 0 0 0.7rem;
  padding: 0.6rem 0.8rem;
  border-radius: 8px;
  font-size: 0.92rem;
  text-align: center;
}
.ticket-ok { background: #dcfce7; color: #166534; border: 1px solid #86efac; }
.ticket-fallo { background: #fee2e2; color: #991b1b; border: 1px solid #fca5a5; }

@media print {
  body.body-ticket { background: #fff; padding: 0; }
  .ticket-hoja {
    width: 76mm;
    margin: 0;
    padding: 2mm;
    box-shadow: none;
  }
  .no-print, .ticket-pie { display: none !important; }
}

/* ============================================================ factura A4 */

body.body-factura {
  background: #e2e8f0;
  padding: 1.2rem;
}
.factura-hoja {
  width: 100%;
  max-width: 210mm;
  margin: 0 auto;
  padding: 14mm 14mm 12mm;
  background: #fff;
  box-shadow: 0 8px 30px rgba(15, 23, 42, 0.18);
  font-size: 13px;
  line-height: 1.45;
}
.factura-cab {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 1rem;
  padding-bottom: 5mm;
  border-bottom: 2px solid #0f172a;
}
.factura-empresa h1 {
  margin: 0.35rem 0 0.1rem;
  font-size: 0.95rem;
  letter-spacing: 0.05em;
  text-transform: uppercase;
}
.factura-empresa p { margin: 0; color: #475569; font-size: 0.78rem; }
.factura-logo { width: 44px; height: 44px; object-fit: contain; }
.factura-empresa-datos {
  text-align: right;
  font-size: 0.8rem;
  color: #334155;
  display: flex;
  flex-direction: column;
  gap: 1px;
}
.factura-empresa-datos strong { color: #0f172a; font-size: 0.86rem; }

.factura-titulo {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  margin: 7mm 0 4mm;
}
.factura-titulo h2 {
  margin: 0;
  font-size: 1.15rem;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}
.factura-numero { color: #475569; font-weight: 700; font-size: 0.9rem; }

.factura-partes {
  display: flex;
  justify-content: space-between;
  gap: 2rem;
  margin-bottom: 6mm;
  flex-wrap: wrap;
}
.factura-partes h3, .factura-subtitulo {
  margin: 0 0 0.4rem;
  font-size: 0.72rem;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: #64748b;
}
.factura-cliente p { margin: 0 0 0.15rem; font-size: 0.85rem; }
.factura-cliente-nombre { font-size: 1rem; }
.factura-meta { border-collapse: collapse; font-size: 0.82rem; }
.factura-meta th {
  text-align: right;
  color: #64748b;
  font-weight: 600;
  padding: 0.1rem 0.6rem 0.1rem 0;
  white-space: nowrap;
}
.factura-meta td { padding: 0.1rem 0; }

.factura-lineas {
  width: 100%;
  border-collapse: collapse;
  table-layout: fixed;
  font-size: 0.84rem;
  margin-bottom: 6mm;
}
.factura-lineas th {
  border-bottom: 1.5px solid #0f172a;
  text-align: left;
  font-size: 0.7rem;
  letter-spacing: 0.05em;
  text-transform: uppercase;
  color: #475569;
  padding: 0.25rem 0.4rem 0.25rem 0;
}
.factura-lineas td {
  border-bottom: 1px solid #e2e8f0;
  padding: 0.4rem 0.4rem 0.4rem 0;
  vertical-align: top;
}
.factura-lineas th:nth-child(1),
.factura-lineas td:nth-child(1) { width: 46%; }
.factura-lineas th:nth-child(2),
.factura-lineas td:nth-child(2) { width: 10%; text-align: right; white-space: nowrap; }
.factura-lineas th:nth-child(3),
.factura-lineas td:nth-child(3) { width: 18%; text-align: right; white-space: nowrap; }
.factura-lineas th:nth-child(4),
.factura-lineas td:nth-child(4) { width: 8%; text-align: right; white-space: nowrap; }
.factura-lineas th:nth-child(5),
.factura-lineas td:nth-child(5),
.factura-lineas .f-importe { width: 18%; text-align: right; white-space: nowrap; }
.factura-lineas .f-linea-nombre,
.factura-lineas td:first-child {
  white-space: normal;
  overflow-wrap: anywhere;
  word-break: break-word;
}
.f-linea-nombre small { color: #475569; }

.factura-totales {
  width: 62%;
  margin-left: auto;
  font-size: 0.85rem;
}
.factura-totales > div {
  display: flex;
  justify-content: space-between;
  gap: 0.6rem;
  padding: 0.2rem 0;
}
.factura-totales span { color: #475569; }
.factura-totales strong { white-space: nowrap; }
.factura-totales .f-total {
  margin-top: 0.3rem;
  padding-top: 0.4rem;
  border-top: 1.5px solid #0f172a;
  font-size: 1rem;
}
.factura-totales .f-total span { color: #0f172a; font-weight: 700; }
.factura-gracias {
  margin: 8mm 0 0;
  text-align: center;
  color: #64748b;
  font-size: 0.8rem;
}

/* Pie de la factura (solo pantalla) y modal de cliente */
.factura-pie { width: min(760px, 100%); margin: 1.2rem auto 2rem; }
.factura-buscar { margin-bottom: 0.6rem; }
.factura-subtitulo { margin-top: 1.2rem; }
.factura-form .field { margin-bottom: 0.6rem; }
.factura-form label { font-size: 0.8rem; }

@media print {
  body.body-factura { background: #fff; padding: 0; }
  .factura-hoja {
    max-width: none;
    margin: 0;
    padding: 0;
    box-shadow: none;
    font-size: 12px;
    zoom: 1 !important;   /* al imprimir, la factura se ve entera (A4) */
  }
  .no-print, .factura-pie, .modal-overlay { display: none !important; }
  @page { size: A4; margin: 12mm; }
}

/* ----- Ficha de reparación: dos columnas ----- */
.ficha-topbar {
  display: grid;
  grid-template-columns: 1fr auto 1fr;
  align-items: center;
  gap: 0.75rem;
  margin-bottom: 1rem;
}
.ficha-topbar-center { text-align: center; }
.ficha-topbar-right { text-align: right; }
.ficha-topbar .button,
.ficha-topbar button {
  display: inline-block;
  width: auto;
  margin-top: 0;
  min-width: 140px;
}
.ficha-topbar a.button {
  text-decoration: none;
  text-align: center;
}

.reparacion-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 1.25rem;
  align-items: start;
}
.reparacion-col {
  min-width: 0;
}
.reparacion-col h3 {
  margin: 0.8rem 0 0.2rem;
  font-size: 1rem;
  color: #334155;
}
.reparacion-col h3:first-child { margin-top: 0; }

.reparacion-pago {
  margin-top: 1.5rem;
  padding-top: 1rem;
  border-top: 1px solid #e2e8f0;
  text-align: center;
  max-width: 520px;
  margin-left: auto;
  margin-right: auto;
}
.reparacion-pago .field {
  text-align: left;
}
.reparacion-pago .field > label {
  text-align: center;
  display: block;
}
.reparacion-pago button {
  display: inline-block;
  width: auto;
  margin-top: 0.5rem;
  min-width: 180px;
}
.reparacion-pago input[type="text"] {
  max-width: 280px;
  margin: 0 auto;
  display: block;
}

@media (max-width: 900px) {
  .reparacion-grid { grid-template-columns: 1fr; }
  .ficha-topbar { grid-template-columns: 1fr; }
  .ficha-topbar-center, .ficha-topbar-right { text-align: center; }
}

/* Barra de acciones en línea (estado + imprimir + volver + guardar) */
.ficha-acciones-linea {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.5rem;
  margin-bottom: 1rem;
}
.ficha-acciones-linea form {
  display: inline-flex;
  margin: 0;
}
.ficha-acciones-linea .button,
.ficha-acciones-linea button {
  display: inline-block;
  width: auto;
  margin-top: 0;
}
.ficha-acciones-linea a.button {
  text-decoration: none;
  text-align: center;
}
.ficha-acciones-sep {
  flex: 1 1 auto;
}

/* ----- Selector de cliente en nueva reparación ----- */
.cliente-seleccionado {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.5rem;
  padding: 0.4rem 0.1rem 0.2rem;
  font-size: 0.95rem;
}
#cliente-buscar {
  margin-bottom: 0.4rem;
}
#cliente-lista {
  max-height: 260px;
  overflow-y: auto;
  border: 1px solid #e2e8f0;
  border-radius: 10px;
  background: #fff;
  margin: 0 0 0.2rem;
  padding: 0;
}
#cliente-lista .lista-cliente-opcion.seleccionado {
  background: #dbeafe;
}
#cliente-lista .lista-cliente-opcion.seleccionado strong {
  color: #1d4ed8;
}
.cliente-crear-item {
  position: sticky;
  bottom: 0;
  background: #f8fafc;
}
.cliente-crear-btn {
  color: #2563eb;
}
.cliente-crear-btn strong {
  color: #2563eb;
}

/* ----- Ficha reparación: layout con chatter (dos tarjetas) ----- */
.container-reparacion-ficha { max-width: 1380px; }

.ficha-layout {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 420px;
  gap: 1.25rem;
  align-items: start;
}
.ficha-card-main,
.ficha-card-chatter {
  margin: 0;
}

.chatter-head h2 {
  margin: 0 0 0.2rem;
  font-size: 1.1rem;
}
.chatter-head p { margin: 0 0 1rem; font-size: 0.85rem; }

.chatter-lista {
  display: flex;
  flex-direction: column;
  gap: 0.85rem;
  max-height: calc(100vh - 220px);
  overflow-y: auto;
  padding-right: 0.2rem;
}
.chatter-vacio { margin: 0.5rem 0; }

.chatter-msg {
  border: 1px solid #e2e8f0;
  border-left: 4px solid #94a3b8;
  border-radius: 10px;
  padding: 0.7rem 0.8rem;
  background: #f8fafc;
}
.chatter-msg.chatter-enviado { border-left-color: #16a34a; }
.chatter-msg.chatter-pendiente { border-left-color: #f59e0b; }
.chatter-msg.chatter-error { border-left-color: #dc2626; }

.chatter-msg-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 0.5rem;
  margin-bottom: 0.25rem;
}
.chatter-msg-head strong {
  font-size: 0.9rem;
  color: #0f172a;
  line-height: 1.3;
}
.chatter-estado {
  flex: 0 0 auto;
  font-size: 0.72rem;
  font-weight: 700;
  text-transform: uppercase;
  padding: 0.15rem 0.45rem;
  border-radius: 999px;
  background: #e2e8f0;
  color: #334155;
}
.chatter-estado-enviado { background: #dcfce7; color: #166534; }
.chatter-estado-pendiente { background: #fef3c7; color: #92400e; }
.chatter-estado-error { background: #fee2e2; color: #991b1b; }

.chatter-meta { font-size: 0.78rem; margin-bottom: 0.4rem; }

.chatter-cuerpo {
  margin: 0;
  white-space: pre-wrap;
  word-break: break-word;
  font-family: inherit;
  font-size: 0.86rem;
  line-height: 1.45;
  color: #334155;
  background: #fff;
  border: 1px solid #e2e8f0;
  border-radius: 8px;
  padding: 0.55rem 0.65rem;
}
.chatter-error {
  margin-top: 0.4rem;
  font-size: 0.8rem;
  color: #b91c1c;
}

@media (max-width: 1100px) {
  .ficha-layout { grid-template-columns: 1fr; }
  .chatter-lista { max-height: none; }
}

/* ----- Selector de cliente (desplegable con marcos) ----- */
.cliente-picker { position: relative; }
.cliente-trigger {
  display: flex;
  align-items: center;
  justify-content: space-between;
  width: 100%;
  margin-top: 0;
  padding: 0.7rem 0.85rem;
  border: 1px solid #cbd5e1;
  border-radius: 10px;
  background: #fff;
  color: #0f172a;
  font-size: 0.95rem;
  font-weight: 500;
  cursor: pointer;
  text-align: left;
}
.cliente-trigger:hover { border-color: #93c5fd; background: #f8fafc; }
.cliente-trigger.invalid { border-color: #ef4444; }
.cliente-trigger-flecha { color: #64748b; font-size: 0.8rem; margin-left: 0.5rem; }
.cliente-seleccionado-acciones {
  margin-top: 0.3rem;
  font-size: 0.9rem;
  min-height: 1.2em;
}

.cliente-desplegable {
  position: absolute;
  z-index: 40;
  left: 0;
  right: 0;
  top: calc(100% + 4px);
  background: #fff;
  border: 1px solid #e2e8f0;
  border-radius: 12px;
  box-shadow: 0 12px 30px rgba(15, 23, 42, 0.18);
  padding: 0.6rem;
}
.cliente-desplegable #cliente-buscar {
  margin-bottom: 0.5rem;
}
.cliente-desplegable #cliente-lista {
  max-height: 280px;
  overflow-y: auto;
  border: none;
  border-radius: 0;
  background: transparent;
  margin: 0;
  padding: 0;
  display: flex;
  flex-direction: column;
  gap: 0.4rem;
}

/* Marcos para diferenciar clientes */
#cliente-lista li {
  flex: 0 0 auto;
  border: 1px solid #e2e8f0;
  border-radius: 10px;
  overflow: hidden;
  background: #fff;
}
#cliente-lista li:hover { border-color: #93c5fd; }
#cliente-lista .lista-cliente-opcion {
  margin: 0;
  border-radius: 0;
}
#cliente-lista .lista-cliente-opcion.seleccionado {
  background: #dbeafe;
}
#cliente-lista .lista-cliente-opcion.seleccionado strong {
  color: #1d4ed8;
}

#cliente-lista .cliente-crear-item {
  position: sticky;
  bottom: 0;
  background: #eff6ff;
  border-color: #93c5fd;
  z-index: 1;
}
.cliente-crear-btn,
.cliente-crear-btn strong {
  color: #2563eb;
}

/* ----------------------------------------------------------- cobros (POS) */
.modal-cobros { width: min(980px, 100%); }
.cobros-head { display: flex; align-items: center; justify-content: space-between; gap: 0.6rem; }
.cobros-head .modal-titulo { margin: 0; }
.cobros-lista { display: flex; flex-direction: column; gap: 0.7rem; margin-top: 0.4rem; }
.cobro-item { border: 1px solid #e2e8f0; border-radius: 12px; padding: 0.75rem 0.85rem; background: #f8fafc; }
.cobro-item-head { display: flex; justify-content: space-between; gap: 0.8rem; align-items: flex-start; }
.cobro-item-head .muted { margin-top: 0.15rem; }
.cobro-item-total { text-align: right; flex: 0 0 auto; }
.cobro-item-cliente { margin: 0.25rem 0 0.1rem; font-size: 0.9rem; }
.cobro-motivo { font-size: 0.8rem; margin-top: 0.2rem; color: #b91c1c; }
.cobro-acciones { margin-top: 0.55rem; display: flex; flex-direction: column; gap: 0.45rem; }
.cobro-acciones-bloque { display: flex; flex-wrap: wrap; gap: 0.4rem; align-items: center; }
.cobro-form { display: flex; flex-wrap: wrap; gap: 0.35rem; align-items: center; margin: 0; }
.cobro-form label { font-size: 0.78rem; font-weight: 600; color: #475569; margin: 0; }
.cobro-form select,
.cobro-form input[type="email"] { padding: 0.35rem 0.45rem; border: 1px solid #cbd5e1; border-radius: 8px; font-size: 0.85rem; background: #fff; color: #0f172a; }
.cobro-form input[type="email"] { min-width: 170px; flex: 1 1 170px; }
.cobro-form .button { width: auto; margin: 0; padding: 0.4rem 0.7rem; font-size: 0.82rem; }
.cobro-acciones-envio { flex-direction: column; align-items: stretch; gap: 0.35rem; }
.cobro-msg { font-size: 0.82rem; min-height: 1.1em; margin-top: 0.15rem; }
.cobro-msg-ok { color: #166534; font-weight: 600; }
.cobro-msg-error { color: #b91c1c; font-weight: 600; }
.button.button-danger, button.button-danger { background: #dc2626; color: #fff; }
.button.button-danger:hover, button.button-danger:hover { background: #b91c1c; }

/* ------------------------------------------------- filtros avanzados */
.af-builder { display: flex; flex-direction: column; gap: 0.5rem; }
.af-controls { display: flex; flex-wrap: wrap; align-items: center; gap: 0.5rem 0.7rem; }
.af-controls label { margin: 0; font-size: 0.82rem; font-weight: 600; color: #334155; }
.af-controls select { width: auto; margin: 0; padding: 0.35rem 0.5rem; font-size: 0.85rem; }
.af-rows { display: flex; flex-direction: column; gap: 0.45rem; }
.af-row { display: flex; flex-wrap: wrap; align-items: center; gap: 0.4rem; }
.af-row select, .af-row input { margin: 0; padding: 0.4rem 0.5rem; font-size: 0.85rem; border: 1px solid #cbd5e1; border-radius: 8px; background: #fff; color: #0f172a; }
.af-row .af-field { flex: 1 1 170px; min-width: 140px; }
.af-row .af-op { flex: 1 1 150px; min-width: 130px; }
.af-row .af-value { flex: 2 1 220px; min-width: 160px; display: flex; align-items: center; gap: 0.35rem; }
.af-row .af-value .af-v, .af-row .af-value .af-v1, .af-row .af-value .af-v2 { flex: 1 1 0; width: 100%; }
.af-row .af-sep { font-size: 0.8rem; color: #64748b; flex: 0 0 auto; }
.af-remove { flex: 0 0 auto; width: 32px; height: 32px; padding: 0; margin: 0; border: 1px solid #e2e8f0; border-radius: 8px; background: #fff; color: #64748b; font-size: 0.95rem; line-height: 1; cursor: pointer; display: inline-flex; align-items: center; justify-content: center; }
.af-remove:hover { background: #fef2f2; color: #dc2626; border-color: #fecaca; }
.af-add { width: auto; margin: 0; }
.af-hint { font-size: 0.78rem; color: #94a3b8; margin: 0; }
