/* Estilos específicos de la vista: venta */
/* Prefijo .pos-*  ·  Usa los tokens de styles.css (papel, tinta, latón). */

/* ───────── Layout ───────── */
.pos-layout { display: grid; grid-template-columns: minmax(0, 1fr) minmax(340px, 400px); gap: 22px; align-items: start; }
.pos-ticket-wrap { position: sticky; top: 24px; min-width: 0; }
.pos-panel { padding: 22px 24px 24px; min-width: 0; }

.pos-atajo { display: inline-flex; align-items: center; gap: 8px; }
.pos-atajo svg { width: 16px; height: 16px; color: var(--brass); flex: none; }
.pos-atajo kbd { font: 600 .74rem var(--font-body); padding: 1px 6px; border-radius: 5px; border: 1px solid var(--line-2); border-bottom-width: 2px; background: var(--card); color: var(--ink-2); }
@media (pointer: coarse) { .pos-atajo { display: none; } }

/* ───────── Selector de modo ───────── */
.pos-modos { display: flex; width: 100%; padding: 4px; margin-bottom: 22px; }
.pos-modos button { flex: 1 1 0; justify-content: center; padding: 11px 12px; font-size: .92rem; min-width: 0; }
.pos-modos button svg { width: 18px; height: 18px; flex: none; }
.pos-modos button.active svg { color: var(--brass); }
.pos-corto { display: none; }

/* ───────── Pasos ───────── */
.pos-paso + .pos-paso { margin-top: 22px; padding-top: 20px; border-top: 1px dashed var(--line-2); }
.pos-paso-head { display: flex; align-items: center; gap: 10px; margin-bottom: 12px; }
.pos-paso-head h3 { font-size: 1.08rem; }
.pos-paso-extra { margin-left: auto; text-align: right; }
.pos-num {
  flex: none; width: 26px; height: 26px; border-radius: 50%; display: grid; place-items: center;
  border: 1px solid var(--brass-2); color: var(--brass); background: var(--brass-soft);
  font: italic 500 .9rem/1 var(--font-display);
}
.pos-panel input[type="search"] { -webkit-appearance: none; appearance: none; }
.pos-error { margin-top: 8px; font-size: .8rem; color: var(--oxblood); }

/* ───────── Lista de productos ───────── */
.pos-lista {
  position: relative; display: grid; grid-template-columns: repeat(auto-fill, minmax(190px, 1fr)); gap: 8px;
  max-height: 318px; overflow-y: auto; margin-top: 12px; padding: 3px; border-radius: 12px;
  overscroll-behavior: contain; scrollbar-width: thin; scrollbar-color: var(--line-2) transparent;
}
.pos-lista.is-invalid, .pos-frascos.is-invalid { outline: 2px solid rgba(122, 38, 51, .3); outline-offset: 3px; border-radius: 12px; }
.pos-lista-vacia {
  grid-column: 1 / -1; display: flex; align-items: center; justify-content: center; gap: 10px; padding: 22px 16px;
  color: var(--muted); font-size: .9rem; text-align: center; border: 1px dashed var(--line-2); border-radius: var(--radius-sm);
}
.pos-lista-vacia svg { width: 20px; height: 20px; flex: none; color: var(--line-2); }

/* Tarjetas seleccionables (fragancias, productos y frascos) */
.pos-item, .pos-frasco {
  position: relative; text-align: left; font: inherit; color: var(--ink); cursor: pointer;
  border: 1px solid var(--line); border-radius: var(--radius-sm); background: #fffdf9;
  transition: border-color .15s, box-shadow .2s, transform .15s var(--ease), background .2s;
}
.pos-item:hover:not(:disabled), .pos-frasco:hover:not(:disabled) { border-color: var(--line-2); box-shadow: var(--shadow); transform: translateY(-1px); }
.pos-item:focus-visible, .pos-frasco:focus-visible, .pos-chip:focus-visible, .pos-step-btn:focus-visible { outline: 2px solid var(--brass); outline-offset: 2px; }
.pos-item.is-selected, .pos-frasco.is-selected {
  border-color: var(--brass); background: linear-gradient(180deg, #fffaf0 0%, var(--brass-soft) 100%);
  box-shadow: 0 0 0 3px rgba(168, 121, 47, .18);
}
.pos-item:disabled, .pos-frasco:disabled { opacity: .5; cursor: not-allowed; background: transparent; }

.pos-item { display: flex; flex-direction: column; gap: 3px; padding: 11px 12px 10px; min-width: 0; }
.pos-item-nombre { font-weight: 600; font-size: .92rem; line-height: 1.25; padding-right: 24px; overflow-wrap: anywhere; }
.pos-item-meta { display: flex; justify-content: space-between; gap: 8px; font-size: .78rem; color: var(--muted); }
.pos-item-meta > span:first-child { min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.pos-item-precio { flex: none; font-weight: 600; color: var(--ink-2); font-variant-numeric: tabular-nums; }
.pos-item-pie { display: flex; justify-content: space-between; align-items: center; gap: 8px; margin-top: 5px; }
.pos-item-disp { font-size: .82rem; font-weight: 700; color: var(--ink-2); }
.pos-item-pie .badge { font-size: .66rem; padding: 2px 7px; }
.pos-item-check {
  position: absolute; top: 9px; right: 9px; width: 20px; height: 20px; border-radius: 50%;
  display: grid; place-items: center; background: var(--brass); color: #fff;
  transform: scale(0); transition: transform .22s var(--ease);
}
.pos-item-check svg { width: 12px; height: 12px; stroke-width: 2.6; }
.pos-item.is-selected .pos-item-check { transform: scale(1); }

/* ───────── Campos ───────── */
.pos-campos { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 16px 18px; align-items: start; }
.pos-campos .field .hint b { color: var(--ink-2); font-weight: 700; }
.pos-campos .input-lg { font-weight: 600; }
.pos-chips { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 4px; }
.pos-chip {
  height: 30px; padding: 0 11px; border-radius: 999px; border: 1px solid var(--line-2); background: transparent;
  font: 600 .8rem var(--font-body); color: var(--ink-2); cursor: pointer; font-variant-numeric: tabular-nums;
  transition: background .15s, border-color .15s, color .15s;
}
.pos-chip:hover:not(:disabled) { border-color: var(--brass); color: var(--brass); }
.pos-chip.active { background: var(--ink); border-color: var(--ink); color: #f8efe0; }
.pos-chip:disabled { opacity: .35; cursor: not-allowed; }
.pos-link {
  border: 0; background: none; padding: 0; font: inherit; font-weight: 700; color: var(--brass); cursor: pointer;
  text-decoration: underline; text-underline-offset: 2px;
}
.pos-link:hover { color: var(--ink); }

/* Stepper de cantidad */
.pos-stepper .input { text-align: center; }
.pos-step-btn {
  flex: none; width: 50px; border: 0; background: transparent; color: var(--ink-2); cursor: pointer;
  display: grid; place-items: center; transition: background .15s, color .15s;
}
.pos-step-btn:first-child { border-right: 1px solid var(--line); border-radius: 10px 0 0 10px; }
.pos-step-btn:last-child { border-left: 1px solid var(--line); border-radius: 0 10px 10px 0; }
.pos-step-btn:hover:not(:disabled) { background: var(--paper-2); color: var(--ink); }
.pos-step-btn:disabled { opacity: .3; cursor: not-allowed; }
.pos-step-btn svg { width: 18px; height: 18px; }

/* ───────── Frascos ───────── */
.pos-frascos { display: grid; grid-template-columns: repeat(auto-fill, minmax(220px, 1fr)); gap: 8px; padding: 3px; margin: -3px; }
.pos-frasco { display: flex; align-items: center; gap: 11px; padding: 9px 12px 9px 9px; min-width: 0; }
.pos-frasco-cap {
  flex: none; width: 42px; height: 42px; border-radius: 50%; display: flex; flex-direction: column;
  align-items: center; justify-content: center; line-height: 1;
  background: var(--c-frasco-soft); color: var(--c-frasco);
}
.pos-frasco-cap b { font: 600 .98rem/1 var(--font-display); }
.pos-frasco-cap small { font-size: .56rem; font-weight: 700; letter-spacing: .08em; text-transform: uppercase; margin-top: 2px; }
.pos-frasco-cap svg { width: 18px; height: 18px; }
.pos-frasco-ninguno .pos-frasco-cap { background: var(--paper-2); color: var(--muted); }
.pos-frasco.is-selected .pos-frasco-cap { background: var(--ink); color: var(--brass-2); }
.pos-frasco-info { display: flex; flex-direction: column; min-width: 0; }
.pos-frasco-nombre { font-weight: 600; font-size: .88rem; line-height: 1.25; overflow-wrap: anywhere; }
.pos-frasco-meta { font-size: .78rem; color: var(--muted); font-variant-numeric: tabular-nums; }
.pos-frasco-flag { display: none; margin-left: auto; flex: none; color: var(--amber); }
.pos-frasco-flag svg { width: 16px; height: 16px; }
.pos-frasco.is-small .pos-frasco-flag { display: block; }
.pos-aviso { margin-top: 12px; padding: 9px 12px; font-size: .84rem; }

/* Cobro del frasco */
.pos-cobro {
  margin-top: 14px; padding: 14px 16px; border-radius: 12px;
  background: rgba(239, 230, 214, .55); border: 1px solid var(--line);
  animation: rise .3s var(--ease) both;
}
.pos-cobro-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; flex-wrap: wrap; }
.pos-cobro-titulo { display: flex; flex-direction: column; gap: 1px; min-width: 0; }
.pos-cobro-precio { margin-top: 12px; max-width: 300px; }
.pos-cobro-nota { margin: 10px 0 0; display: flex; gap: 8px; align-items: center; font-size: .82rem; color: var(--sage); }
.pos-cobro-nota svg { width: 15px; height: 15px; flex: none; }

/* ───────── Barra "Agregar" ───────── */
.pos-agregar {
  position: relative; overflow: hidden; margin-top: 24px; padding: 16px 18px 16px 20px; border-radius: 14px;
  display: flex; align-items: center; justify-content: space-between; gap: 16px;
  background: linear-gradient(150deg, #241d16 0%, #15110d 100%); color: var(--side-ink); border: 1px solid #000;
}
.pos-agregar::after {
  content: ""; position: absolute; left: -50px; bottom: -70px; width: 150px; height: 150px; border-radius: 50%;
  border: 1px solid rgba(201, 154, 75, .3); box-shadow: 0 0 0 18px rgba(201, 154, 75, .05); pointer-events: none;
}
.pos-agregar-info { position: relative; z-index: 1; display: flex; flex-direction: column; min-width: 0; }
.pos-agregar-label { font-size: .7rem; letter-spacing: .16em; text-transform: uppercase; color: #a39581; font-weight: 600; }
.pos-agregar-total { font-family: var(--font-display); font-size: 1.9rem; line-height: 1.15; color: #f6e9d2; }
.pos-agregar-desc { font-size: .84rem; color: #c9bca9; overflow-wrap: anywhere; }
.pos-agregar .btn { position: relative; z-index: 1; flex: none; }
.pos-agregar.is-ready .btn { box-shadow: 0 0 0 4px rgba(201, 154, 75, .22), 0 10px 24px -12px rgba(201, 154, 75, .8); }

@keyframes pos-shake { 0%, 100% { transform: none; } 20% { transform: translateX(-5px); } 40% { transform: translateX(5px); } 60% { transform: translateX(-3px); } 80% { transform: translateX(3px); } }
.pos-shake { animation: pos-shake .4s var(--ease); }

/* ───────── Ticket ───────── */
.pos-ticket {
  padding: 0; overflow: hidden auto; display: flex; flex-direction: column;
  max-height: calc(100vh - 48px); scrollbar-width: thin; scrollbar-color: var(--line-2) transparent;
}
.pos-ticket > * { flex: none; }
.pos-ticket::before { content: ""; display: block; flex: none; height: 4px; background: linear-gradient(90deg, var(--brass), var(--brass-2), var(--brass)); }
.pos-ticket-head { display: flex; align-items: flex-end; justify-content: space-between; gap: 12px; padding: 18px 22px 14px; border-bottom: 1px dashed var(--line-2); }
.pos-ticket-head h2 { font-size: 1.45rem; }
.pos-count { font-size: .74rem; font-weight: 700; padding: 3px 10px; border-radius: 999px; background: var(--ink); color: #f8efe0; white-space: nowrap; font-variant-numeric: tabular-nums; }
.pos-vacio .empty { padding: 34px 22px 26px; }

.pos-lineas {
  list-style: none; margin: 0; padding: 4px 22px; max-height: max(170px, calc(100vh - 700px)); overflow-y: auto;
  scrollbar-width: thin; scrollbar-color: var(--line-2) transparent;
}
.pos-linea {
  display: grid; grid-template-columns: 30px minmax(0, 1fr) auto auto; align-items: center; gap: 10px;
  margin: 0 -22px; padding: 12px 14px 12px 22px; border-bottom: 1px dashed var(--line);
  transition: opacity .18s var(--ease), transform .18s var(--ease);
}
.pos-linea:last-child { border-bottom: 0; }
.pos-linea.is-new { animation: pos-entra 1s var(--ease) both; }
.pos-linea.is-leaving { opacity: 0; transform: translateX(14px); }
@keyframes pos-entra {
  0% { opacity: 0; transform: translateY(-6px); background: var(--brass-soft); }
  25% { opacity: 1; transform: none; background: var(--brass-soft); }
  100% { background: transparent; }
}
.pos-linea-ico { width: 30px; height: 30px; border-radius: 50%; display: grid; place-items: center; }
.pos-linea-ico svg { width: 16px; height: 16px; }
.pos-ico-fragancia { background: var(--c-fragancia-soft); color: var(--c-fragancia); }
.pos-ico-frasco { background: var(--c-frasco-soft); color: var(--c-frasco); }
.pos-ico-tercero { background: var(--c-tercero-soft); color: var(--c-tercero); }
.pos-linea-info { min-width: 0; }
.pos-linea-titulo { font-weight: 600; font-size: .93rem; line-height: 1.3; overflow-wrap: anywhere; }
.pos-linea-cant { color: var(--muted); font-weight: 600; font-variant-numeric: tabular-nums; }
.pos-linea-sub { display: flex; flex-wrap: wrap; align-items: center; gap: 4px 8px; margin-top: 3px; font-size: .8rem; color: var(--muted); }
.pos-linea-sub .badge { font-size: .7rem; padding: 2px 8px; }
.pos-linea-sub .badge svg { width: 12px; height: 12px; }
.pos-badge-cobrado { background: var(--brass-soft); color: #6e4f1c; }
.pos-linea-precio { font-size: .95rem; }
.pos-quitar { color: var(--muted); opacity: .65; }
.pos-quitar:hover { color: var(--oxblood); opacity: 1; }
.pos-linea:hover .pos-quitar { opacity: 1; }

.pos-avisos { padding: 10px 22px 0; }
.pos-resumen { padding: 12px 22px 2px; border-top: 1px dashed var(--line-2); background: rgba(239, 230, 214, .3); }
.pos-fila { display: flex; justify-content: space-between; align-items: center; gap: 10px; padding: 3px 0; font-size: .88rem; color: var(--ink-2); }
.pos-fila > span:first-child { display: inline-flex; align-items: center; gap: 6px; }
.pos-fila svg { width: 14px; height: 14px; color: var(--sage); }
.pos-fila.is-cero { color: var(--muted); }
.pos-fila.is-cero .money { font-weight: 500; }

.pos-total { display: flex; align-items: baseline; justify-content: space-between; gap: 12px; margin: 0 22px; padding: 14px 0 16px; border-top: 1px solid var(--ink); }
.pos-resumen + .pos-total { margin-top: 10px; }
.pos-total-label { font-size: .74rem; letter-spacing: .18em; text-transform: uppercase; font-weight: 700; color: var(--ink-2); }
.pos-total-valor { font-family: var(--font-display); font-size: 2.4rem; line-height: 1; font-variation-settings: "opsz" 144, "SOFT" 50; letter-spacing: -.01em; }

.pos-checkout { display: flex; flex-direction: column; gap: 14px; padding: 16px 22px 22px; border-top: 1px solid var(--line); background: rgba(239, 230, 214, .22); }
.pos-pagos { display: flex; flex-wrap: wrap; width: 100%; }
.pos-pagos button { flex: 1 1 auto; justify-content: center; padding: 8px 10px; }
.pos-registrar { height: 56px; font-size: 1.02rem; gap: 8px; }
.pos-registrar-total { font-variant-numeric: tabular-nums; color: var(--brass-2); }
.pos-registrar:disabled .pos-registrar-total { color: inherit; }

/* ───────── Píldora flotante (pantallas angostas) ───────── */
.pos-mini { display: none; }

/* ───────── Responsive ───────── */
@media (max-width: 1180px) {
  .pos-layout { grid-template-columns: minmax(0, 1fr) 340px; gap: 18px; }
  .pos-panel { padding: 20px; }
}
@media (max-width: 1024px) {
  .pos-layout { grid-template-columns: 1fr; }
  .pos-ticket-wrap { position: static; }
  .pos-ticket { max-height: none; overflow: visible; }
  .pos-lineas { overflow: visible; max-height: none; }
  .pos-mini {
    position: fixed; left: 50%; bottom: calc(20px + env(safe-area-inset-bottom)); z-index: 35;
    display: flex; align-items: center; gap: 12px; width: min(440px, calc(100% - 32px)); height: 52px; padding: 0 18px;
    border: 1px solid #000; border-radius: 14px; background: var(--ink); color: #f8efe0; box-shadow: var(--shadow-lg);
    font: 600 .92rem var(--font-body); cursor: pointer;
    opacity: 0; pointer-events: none; transform: translate(-50%, 16px); transition: opacity .25s var(--ease), transform .25s var(--ease);
  }
  .pos-mini.is-visible { opacity: 1; pointer-events: auto; transform: translate(-50%, 0); }
  .pos-mini svg { width: 18px; height: 18px; color: var(--brass-2); flex: none; }
  .pos-mini-total { font-family: var(--font-display); font-size: 1.15rem; }
  .pos-mini-ver { margin-left: auto; color: var(--brass-2); font-size: .84rem; }
  .pos-mini.is-bump { animation: pos-bump .45s var(--ease); }
  @keyframes pos-bump { 40% { transform: translate(-50%, 0) scale(1.04); } }
}
@media (max-width: 860px) {
  .pos-mini { bottom: calc(76px + env(safe-area-inset-bottom)); }
}
@media (max-width: 600px) {
  .pos-panel { padding: 16px 14px 18px; }
  .pos-largo { display: none; }
  .pos-corto { display: inline; }
  .pos-modos button { padding: 10px 6px; font-size: .86rem; gap: 5px; }
  .pos-campos { grid-template-columns: 1fr; }
  .pos-lista { grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); max-height: 296px; }
  .pos-frascos { grid-template-columns: 1fr; }
  .pos-paso-extra { display: none; }
  .pos-agregar { flex-direction: column; align-items: stretch; gap: 12px; padding: 16px; }
  .pos-agregar .btn { width: 100%; }
  .pos-ticket-head, .pos-checkout { padding-left: 16px; padding-right: 16px; }
  .pos-lineas { padding: 4px 16px; }
  .pos-linea { margin: 0 -16px; padding: 12px 8px 12px 16px; }
  .pos-resumen, .pos-avisos { padding-left: 16px; padding-right: 16px; }
  .pos-total { margin: 0 16px; }
  .pos-resumen + .pos-total { margin-top: 10px; }
  .pos-total-valor { font-size: 2rem; }
}
