* {
  box-sizing: border-box;
}

html,
body {
  width: 100%;
  height: 100%;
  margin: 0;
  overflow: hidden;
}

body {
  min-width: 880px;
  color: var(--page-text);
  background: var(--page-bg);
}

button,
input,
select {
  font: inherit;
}

button {
  color: inherit;
}

button:focus-visible,
input:focus-visible,
select:focus-visible {
  outline: none;
  box-shadow: var(--focus-ring);
}

[hidden] {
  display: none;
}

.visually-hidden {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}

.app-shell {
  --sidebar-width: 248px;
  display: grid;
  grid-template-columns: var(--sidebar-width) minmax(0, 1fr);
  width: 100%;
  height: 100dvh;
  overflow: hidden;
  transition: grid-template-columns 200ms ease;
}

/* El cliente pidió poder achicar el menú lateral con un clic para ganar
   ancho para el ticket, manteniendo el menú tal cual se ve hoy cuando está
   abierto. Colapsado, el aside queda como una tira angosta: todo su
   contenido se oculta salvo el botón .sidebar__toggle, que sigue visible
   (medio afuera del borde) para poder reabrirlo. */
.app-shell.is-sidebar-collapsed {
  --sidebar-width: 14px;
}

.app-shell.is-sidebar-collapsed .brand,
.app-shell.is-sidebar-collapsed .module-nav,
.app-shell.is-sidebar-collapsed .sidebar__footer,
.app-shell.is-sidebar-collapsed .sidebar__shutdown-button {
  display: none;
}

.app-shell.is-sidebar-collapsed .sidebar__toggle {
  transform: rotate(180deg);
}

.sidebar {
  position: relative;
  display: flex;
  min-height: 0;
  flex-direction: column;
  color: var(--sidebar-text);
  background: var(--sidebar-bg);
  border-right: 1px solid var(--sidebar-border);
  box-shadow: 8px 0 24px rgba(4, 15, 23, 0.22), inset -1px 0 rgba(255, 255, 255, 0.08);
  z-index: 2;
}

.sidebar__toggle {
  position: absolute;
  top: 32px;
  right: -14px;
  z-index: 3;
  display: grid;
  width: 28px;
  height: 28px;
  place-items: center;
  color: #eef6fa;
  font-size: 18px;
  font-weight: 800;
  background: var(--sidebar-bg);
  border: 1px solid var(--sidebar-border);
  border-radius: 50%;
  box-shadow: 0 2px 6px rgba(4, 15, 23, 0.35);
  cursor: pointer;
  transition: background 120ms ease, border-color 120ms ease, transform 200ms ease;
}

.sidebar__toggle:hover {
  background: var(--nav-hover);
  border-color: rgba(115, 189, 255, 0.42);
}

.brand {
  display: grid;
  grid-template-columns: 54px minmax(0, 1fr);
  gap: 10px;
  align-items: center;
  min-height: 84px;
  padding: 12px 14px;
  border-bottom: 1px solid rgba(185, 213, 229, 0.2);
}

.brand__mark {
  width: 54px;
  height: 54px;
  object-fit: contain;
  filter: drop-shadow(0 6px 8px rgba(0, 7, 13, 0.48));
}

.brand__words {
  min-width: 0;
}

.brand__words strong {
  display: block;
  overflow: hidden;
  color: #73bdff;
  font-size: 30px;
  line-height: 1;
  letter-spacing: 0.055em;
  text-overflow: ellipsis;
  text-shadow: 0 2px 0 #082f58, 0 0 12px rgba(62, 168, 255, 0.28);
}

.brand__words span {
  display: block;
  margin-top: 7px;
  color: #dce9f0;
  font-size: 10px;
  letter-spacing: 0.14em;
  white-space: nowrap;
}

.module-nav {
  display: flex;
  min-height: 0;
  flex: 1;
  flex-direction: column;
  gap: 7px;
  padding: 16px 12px;
  overflow-y: auto;
}

.module-nav__item {
  display: grid;
  grid-template-columns: 34px minmax(0, 1fr);
  gap: 9px;
  align-items: center;
  width: 100%;
  min-height: 49px;
  padding: 7px 10px;
  color: #eef6fa;
  text-align: left;
  background: linear-gradient(180deg, rgba(255, 255, 255, 0.075), rgba(0, 0, 0, 0.08));
  border: 1px solid rgba(171, 205, 224, 0.18);
  border-radius: 11px;
  box-shadow: inset 0 1px rgba(255, 255, 255, 0.08);
  cursor: pointer;
  transition: transform 120ms ease, background 120ms ease, border-color 120ms ease;
}

.module-nav__item:hover {
  background: var(--nav-hover);
  border-color: rgba(115, 189, 255, 0.42);
  transform: translateX(2px);
}

.module-nav__item.is-active {
  color: #ffffff;
  background: linear-gradient(180deg, var(--green-500), var(--green-600));
  border-color: #49be7b;
  box-shadow: 0 8px 17px rgba(4, 34, 20, 0.34), inset 0 1px rgba(255, 255, 255, 0.23);
}

.module-nav__icon {
  display: grid;
  width: 31px;
  height: 31px;
  place-items: center;
  color: #b9dcf3;
  font-size: 16px;
  font-weight: 800;
  background: rgba(4, 19, 29, 0.34);
  border: 1px solid rgba(144, 196, 227, 0.28);
  border-radius: 9px;
}

.is-active .module-nav__icon {
  color: #ffffff;
  background: rgba(5, 52, 29, 0.28);
  border-color: rgba(255, 255, 255, 0.26);
}

.module-nav__label {
  overflow: hidden;
  min-width: 0;
  line-height: 1.2;
}

.sidebar__footer {
  display: flex;
  gap: 8px;
  align-items: center;
  min-height: 45px;
  padding: 10px 15px;
  color: #bfd0da;
  font-size: 16px;
  border-top: 1px solid rgba(185, 213, 229, 0.16);
}

.sidebar__footer-mark {
  width: 18px;
  height: 18px;
  object-fit: contain;
  opacity: 0.85;
}

.status-dot {
  width: 9px;
  height: 9px;
  background: var(--green-500);
  border: 1px solid #8aefb4;
  border-radius: 50%;
  box-shadow: 0 0 9px var(--green-glow);
}

.sidebar__shutdown-button {
  min-height: 40px;
  margin: 0 12px 12px;
  color: #f3c6cb;
  font-size: 16px;
  font-weight: 800;
  letter-spacing: 0.02em;
  background: rgba(144, 41, 52, 0.22);
  border: 1px solid rgba(223, 106, 118, 0.4);
  border-radius: 10px;
  cursor: pointer;
  transition: background 120ms ease, border-color 120ms ease;
}

.sidebar__shutdown-button:hover {
  background: rgba(144, 41, 52, 0.34);
  border-color: rgba(223, 106, 118, 0.62);
}

.shutdown-dialog .shutdown-warning {
  margin: 14px 20px 0;
  padding: 9px 11px;
  color: var(--amber-500);
  font-size: 16px;
  font-weight: 800;
  background: color-mix(in srgb, var(--amber-500), transparent 90%);
  border: 1px solid color-mix(in srgb, var(--amber-500), var(--panel-border) 52%);
  border-radius: 9px;
}

.shutdown-dialog .shutdown-note {
  margin: 14px 20px 0;
  color: var(--muted-text);
  font-size: 17px;
}

.shutdown-dialog .dialog-state {
  min-height: 18px;
  margin: 10px 20px 0;
}

.shutdown-screen:not([hidden]) {
  position: fixed;
  inset: 0;
  z-index: 999;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 14px;
  padding: 24px;
  color: #eef6fa;
  text-align: center;
  background: var(--sidebar-bg);
}

.shutdown-screen__logo {
  width: 96px;
  height: 96px;
  object-fit: contain;
  filter: drop-shadow(0 6px 8px rgba(0, 7, 13, 0.48));
}

.shutdown-screen h1 {
  margin: 0;
  font-size: clamp(26px, 3.12vw, 36px);
}

.shutdown-screen p {
  margin: 0;
  color: #bfd0da;
  font-size: 18px;
}

.workspace {
  display: grid;
  min-width: 0;
  min-height: 0;
  grid-template-rows: 76px minmax(0, 1fr);
  background: var(--workspace-bg);
}

.workspace-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 10px 24px;
  background: var(--header-bg);
  border-bottom: 1px solid var(--panel-border);
  box-shadow: 0 6px 18px rgba(22, 42, 57, 0.12);
}

.workspace-header h1,
.panel h2,
.intro-panel h2 {
  margin: 0;
}

.workspace-header h1 {
  font-size: clamp(32px, 2.93vw, 44px);
  line-height: 1.05;
  letter-spacing: -0.025em;
}

.workspace-header__status {
  display: flex;
  gap: 10px;
  align-items: center;
  color: var(--muted-text);
  font-size: 17px;
}

.version {
  padding: 6px 9px;
  color: var(--page-text);
  background: var(--input-bg);
  border: 1px solid var(--line);
  border-radius: 999px;
}

.eyebrow {
  margin: 0 0 5px;
  color: var(--blue-500);
  font-size: 13px;
  font-weight: 800;
  letter-spacing: 0.15em;
}

.workspace-scroll {
  min-height: 0;
  padding: 18px 22px 24px;
  overflow-y: auto;
}

.screen {
  min-height: 100%;
}

.screen--products {
  height: 100%;
  min-height: 540px;
}

.intro-panel,
.panel {
  background: var(--panel-bg);
  border: 1px solid var(--panel-border);
  box-shadow: var(--shadow-raised);
}

.intro-panel {
  display: flex;
  gap: 28px;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 16px;
  padding: 17px 20px;
  border-radius: var(--radius-lg);
}

.intro-panel h2 {
  font-size: 26px;
}

.intro-panel p:not(.eyebrow) {
  max-width: 820px;
  margin: 7px 0 0;
  color: var(--muted-text);
  font-size: 17px;
  line-height: 1.45;
}

.integrity-badge {
  display: grid;
  flex: 0 0 170px;
  grid-template-columns: 13px minmax(0, 1fr);
  gap: 2px 8px;
  align-items: center;
  padding: 11px 13px;
  background: var(--input-bg);
  border: 1px solid var(--line);
  border-radius: var(--radius-md);
}

.integrity-badge__light {
  grid-row: 1 / 3;
  width: 12px;
  height: 12px;
  background: var(--green-500);
  border-radius: 50%;
  box-shadow: 0 0 10px var(--green-glow);
}

.integrity-badge strong {
  font-size: 17px;
}

.integrity-badge small {
  color: var(--muted-text);
  font-size: 14px;
}

.settings-grid {
  display: grid;
  grid-template-columns: minmax(0, 1.4fr) minmax(300px, 0.8fr);
  gap: 16px;
}

.panel {
  min-width: 0;
  padding: 18px;
  border-radius: var(--radius-lg);
}

.panel--business {
  grid-row: span 2;
}

.panel__heading {
  padding-bottom: 13px;
  border-bottom: 1px solid var(--line);
}

.panel__heading--action {
  display: flex;
  gap: 18px;
  align-items: center;
  justify-content: space-between;
}

.panel h2 {
  font-size: 23px;
}

.panel__description {
  margin: 12px 0;
  color: var(--muted-text);
  font-size: 16px;
  line-height: 1.45;
}

.form-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 14px;
  margin-top: 16px;
}

.settings-tool-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  align-items: center;
}

.ai-key-row,
.ai-feature-row:not([hidden]) {
  display: flex;
  flex-wrap: wrap;
  gap: 14px;
  align-items: flex-end;
  margin-top: 14px;
}

.ai-key-row .field,
.ai-feature-row .field {
  flex: 1 1 220px;
}

.ai-feature-row .field-hint,
.ai-feature-row .ai-fingerprint-box {
  flex: 1 1 100%;
}

.ai-fingerprint-box {
  display: flex;
  flex-wrap: wrap;
  gap: 8px 14px;
  align-items: center;
  padding: 9px 12px;
  color: var(--page-text);
  font-size: 17px;
  background: var(--input-bg);
  border: 1px dashed var(--panel-border);
  border-radius: 10px;
}

.ai-fingerprint-box strong {
  flex: 1;
  font-family: monospace;
  font-size: 18px;
  letter-spacing: 0.05em;
}

.field:not([hidden]) {
  display: grid;
  gap: 6px;
}

.field--wide {
  grid-column: 1 / -1;
}

.field span {
  color: var(--muted-text);
  font-size: 16px;
  font-weight: 700;
}

.field input,
.field select {
  width: 100%;
  min-height: 42px;
  padding: 9px 11px;
  color: var(--page-text);
  background: var(--input-bg);
  border: 1px solid var(--input-border);
  border-radius: var(--radius-sm);
  box-shadow: inset 0 2px 4px rgba(25, 49, 66, 0.08);
}

.field select,
.product-search select,
.stock-action select,
.stock-action input {
  color: var(--page-text);
  background: var(--input-bg);
  border: 1px solid var(--input-border);
  border-radius: var(--radius-sm);
}

.theme-options {
  display: grid;
  gap: 10px;
  margin-top: 15px;
}

.theme-card {
  display: grid;
  grid-template-columns: 18px 74px minmax(0, 1fr);
  gap: 10px;
  align-items: center;
  min-height: 65px;
  padding: 9px 11px;
  background: var(--input-bg);
  border: 1px solid var(--line);
  border-radius: var(--radius-md);
  cursor: pointer;
}

.theme-card:has(input:checked) {
  border-color: var(--green-500);
  box-shadow: 0 0 0 2px var(--green-glow), var(--shadow-control);
}

.theme-card input {
  accent-color: var(--green-500);
}

.theme-card__preview {
  display: grid;
  grid-template-columns: 19px 1fr;
  grid-template-rows: 1fr 1fr;
  width: 72px;
  height: 44px;
  overflow: hidden;
  border: 1px solid #668093;
  border-radius: 7px;
  box-shadow: var(--shadow-control);
}

.theme-card__preview i:first-child {
  grid-row: 1 / 3;
}

.theme-card--gray .theme-card__preview i:first-child {
  background: #43525e;
}

.theme-card--gray .theme-card__preview i:nth-child(2) {
  background: #e5eaec;
}

.theme-card--gray .theme-card__preview i:nth-child(3) {
  background: #bdc8ce;
}

.theme-card--blue .theme-card__preview i:first-child {
  background: #182b39;
}

.theme-card--blue .theme-card__preview i:nth-child(2) {
  background: #24485f;
}

.theme-card--blue .theme-card__preview i:nth-child(3) {
  background: #0d2230;
}

.theme-card strong,
.theme-card small {
  display: block;
}

.theme-card strong {
  font-size: 17px;
}

.theme-card small {
  margin-top: 3px;
  color: var(--muted-text);
  font-size: 14px;
}

.backup-list {
  max-height: 108px;
  overflow-y: auto;
  border-top: 1px solid var(--line);
}

.backup-item {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 10px;
  align-items: center;
  padding: 8px 2px;
  font-size: 14px;
  border-bottom: 1px solid var(--line);
}

.backup-item span {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.empty-state {
  margin: 10px 0;
  color: var(--muted-text);
  font-size: 16px;
}

.form-actions {
  display: flex;
  grid-column: 1 / -1;
  gap: 16px;
  align-items: center;
  justify-content: flex-end;
  min-height: 48px;
}

#save-state {
  color: var(--muted-text);
  font-size: 16px;
}

.button {
  min-height: 40px;
  padding: 9px 15px;
  font-weight: 800;
  border-radius: 10px;
  box-shadow: var(--shadow-control);
  cursor: pointer;
}

.button:disabled {
  cursor: not-allowed;
  opacity: 0.62;
}

.button--primary {
  min-width: 184px;
  color: #ffffff;
  background: linear-gradient(180deg, #26ad67, var(--green-600));
  border: 1px solid #4fc283;
}

.button--secondary {
  color: var(--page-text);
  background: linear-gradient(180deg, color-mix(in srgb, var(--input-bg), white 10%), var(--input-bg));
  border: 1px solid var(--input-border);
}

.button--search {
  color: #ffffff;
  background: linear-gradient(180deg, #258ed9, #116cad);
  border: 1px solid #59ace6;
}

.button--quiet {
  color: var(--page-text);
  background: transparent;
  border: 1px solid var(--line);
  box-shadow: none;
}

.button--danger {
  min-width: 170px;
  color: #ffffff;
  background: linear-gradient(180deg, #c34b58, #902934);
  border: 1px solid #df6a76;
}

.button--small {
  min-height: 28px;
  padding: 4px 8px;
  color: var(--page-text);
  font-size: 13px;
  background: var(--input-bg);
  border: 1px solid var(--input-border);
  border-radius: 7px;
  cursor: pointer;
}

.toast {
  position: fixed;
  right: 22px;
  bottom: 22px;
  max-width: 380px;
  padding: 12px 15px;
  color: #ffffff;
  font-size: 17px;
  background: #12354b;
  border: 1px solid #4085ae;
  border-radius: 11px;
  box-shadow: 0 14px 35px rgba(0, 8, 14, 0.38);
  z-index: 10;
}

.toast[data-kind="error"] {
  background: #65252d;
  border-color: #de6874;
}

/* Vender: tres zonas fijas; solo las listas internas pueden desplazarse. */
.workspace-scroll.is-fixed {
  overflow: hidden;
}

.screen--sell {
  height: 100%;
  min-height: 0;
}

/* El Ticket actual es el protagonista de Vender: ocupa todo el ancho que
   el panel "Producto reconocido" no esté usando. Por eso sale-layout es un
   flex row en vez de una grilla de columnas fijas: sale-finder y last-product
   piden un ancho propio (flex-basis) y sale-ticket (flex: 1 1 auto) se queda
   con todo lo que sobra, sin medidas atadas a un monitor en particular. */
.sale-layout {
  position: relative;
  display: flex;
  gap: 12px;
  height: 100%;
  min-height: 0;
}

.sale-finder,
.sale-ticket,
.last-product {
  display: flex;
  min-height: 0;
  flex-direction: column;
  overflow: hidden;
}

.sale-finder {
  flex: 0 0 clamp(255px, 21vw, 320px);
  min-width: 0;
}

.sale-ticket {
  flex: 1 1 auto;
  min-width: 0;
}

.sale-section-heading {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  align-items: center;
  justify-content: space-between;
  min-height: 50px;
  padding-bottom: 12px;
  border-bottom: 1px solid var(--line);
}

.sale-section-heading > :last-child {
  flex-shrink: 0;
}

.sale-section-heading h2 {
  font-size: 23px;
}

.scanner-state {
  display: flex;
  gap: 5px;
  align-items: center;
  color: var(--green-500);
  font-size: 12px;
  font-weight: 900;
  letter-spacing: 0.1em;
}

.scanner-state i {
  width: 7px;
  height: 7px;
  background: var(--green-500);
  border-radius: 50%;
  box-shadow: 0 0 8px var(--green-glow);
}

.sale-search {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 42px;
  gap: 7px;
  padding: 13px 0 5px;
}

.sale-search input {
  width: 100%;
  height: 44px;
  padding: 9px 12px;
  color: var(--page-text);
  background: var(--input-bg);
  border: 1px solid var(--input-border);
  border-radius: 11px;
  box-shadow: inset 0 2px 5px rgba(18, 39, 54, 0.11), 0 0 0 1px transparent;
}

.sale-search input:focus {
  border-color: var(--green-500);
  box-shadow: inset 0 2px 5px rgba(18, 39, 54, 0.11), 0 0 0 3px var(--green-glow);
}

.sale-search__button {
  color: #fff;
  font-size: 31px;
  background: linear-gradient(180deg, #2cac69, #137a45);
  border: 1px solid #54c88a;
  border-radius: 11px;
  box-shadow: var(--shadow-control);
  cursor: pointer;
}

.sale-search-help {
  margin: 2px 0 10px;
  color: var(--muted-text);
  font-size: 13px;
  line-height: 1.35;
}

.sale-suggestions {
  min-height: 120px;
  flex: 1;
  overflow-y: auto;
  background: color-mix(in srgb, var(--input-bg), transparent 15%);
  border: 1px solid var(--line);
  border-radius: 12px;
}

.sale-finder-empty {
  display: grid;
  min-height: 170px;
  place-content: center;
  justify-items: center;
  padding: 20px;
  color: var(--muted-text);
  text-align: center;
}

.sale-finder-empty > span {
  color: var(--blue-400);
  font-size: 49px;
}

.sale-finder-empty strong {
  color: var(--page-text);
  font-size: 16px;
}

.sale-finder-empty small {
  margin-top: 5px;
  font-size: 13px;
}

.sale-suggestion {
  display: grid;
  grid-template-columns: 44px minmax(0, 1fr) auto;
  gap: 9px;
  align-items: center;
  width: 100%;
  padding: 9px;
  color: var(--page-text);
  text-align: left;
  background: transparent;
  border: 0;
  border-bottom: 1px solid var(--line);
  cursor: pointer;
}

.sale-suggestion:hover,
.sale-suggestion:focus-visible {
  background: color-mix(in srgb, var(--green-500), transparent 88%);
}

.sale-suggestion__visual,
.ticket-line__visual {
  display: grid;
  place-items: center;
  overflow: hidden;
  color: #73bdff;
  font-weight: 900;
  background: radial-gradient(circle at 35% 25%, #315f7e, #112d40 70%);
  border: 1px solid #477c9e;
  border-radius: 10px;
}

.sale-suggestion__visual {
  width: 44px;
  height: 44px;
}

.sale-suggestion__visual img,
.ticket-line__visual img {
  width: 100%;
  height: 100%;
  object-fit: contain;
  background: var(--input-bg);
}

.sale-suggestion__copy strong,
.sale-suggestion__copy small {
  display: block;
}

.sale-suggestion__copy strong {
  /* Antes se cortaba con "..." en una sola línea, así que un nombre largo
     quedaba ilegible. Ahora se acomoda en hasta 2 líneas (y recién ahí, si
     hiciera falta, se corta) para poder leer el nombre completo sin tener
     que agregar una pantalla aparte. */
  display: -webkit-box;
  overflow: hidden;
  font-size: 14px;
  line-height: 1.25;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
}

.sale-suggestion__copy small {
  margin-top: 3px;
  color: var(--muted-text);
  font-size: 12px;
}

.sale-suggestion__price {
  color: var(--green-500);
  font-size: 14px;
}

.sale-shortcuts {
  display: grid;
  gap: 6px;
  margin-top: 9px;
}

.sale-fold-button {
  display: flex;
  min-height: 34px;
  align-items: center;
  justify-content: space-between;
  padding: 6px 10px;
  color: var(--page-text);
  font-size: 14px;
  font-weight: 800;
  background: var(--input-bg);
  border: 1px solid var(--line);
  border-radius: 9px;
  cursor: pointer;
}

.sale-fold-content {
  max-height: 92px;
  padding: 5px;
  overflow-y: auto;
  background: color-mix(in srgb, var(--input-bg), transparent 15%);
  border: 1px solid var(--line);
  border-radius: 9px;
}

.sale-category-chip {
  margin: 3px;
  padding: 5px 8px;
  color: var(--page-text);
  font-size: 12px;
  background: transparent;
  border: 1px solid var(--input-border);
  border-radius: 999px;
  cursor: pointer;
}

.button--compact {
  min-width: 0;
  min-height: 32px;
  padding: 5px 9px;
  font-size: 13px;
}

.sale-ticket__heading {
  flex: 0 0 auto;
}

.sale-ticket__customer {
  flex: 0 0 auto;
  margin: 8px 0 0;
}

.sale-ticket__customer input {
  min-height: 36px;
  padding: 7px 10px;
  font-size: 16px;
}

.sale-ticket-lines {
  min-height: 0;
  flex: 1;
  margin: 10px 0;
  overflow-y: auto;
  background: color-mix(in srgb, var(--input-bg), transparent 14%);
  border: 1px solid var(--line);
  border-radius: 13px;
  /* Las fotos de renglón se miden en cqw (ver .ticket-density--*) para que
     se acomoden solas al ancho real disponible: el mismo ancho de pantalla
     rinde fotos más chicas cuando el panel "Producto reconocido" está
     abierto y más grandes cuando está cerrado, sin JavaScript de por medio. */
  container-type: inline-size;
  container-name: ticket-lines;
}

.ticket-empty {
  display: grid;
  min-height: 100%;
  place-content: center;
  gap: 5px;
  padding: 24px;
  color: var(--muted-text);
  text-align: center;
}

.ticket-empty strong {
  color: var(--page-text);
}

.ticket-empty span {
  font-size: 14px;
}

.ticket-line {
  display: grid;
  grid-template-columns: var(--ticket-image-size) minmax(0, 1fr) auto;
  gap: 10px;
  align-items: center;
  min-height: calc(var(--ticket-image-size) + 16px);
  padding: 8px 9px;
  border-bottom: 1px solid var(--line);
  border-radius: 10px;
}

/* Tres tamaños automáticos según la cantidad de renglones (1-2 grande,
   3-5 mediana, 6+ chica): el cliente pidió que se achique antes para que
   entren más renglones sin tener que desplazarse con la rueda del mouse.
   La clase la decide app.js contando renglones; el tamaño real lo decide
   acá el ancho disponible del contenedor (cqw), así entran siempre sin
   producir scroll horizontal, tanto con el panel lateral cerrado (más
   ancho) como abierto (menos ancho). */
.ticket-density--large {
  --ticket-image-size: clamp(120px, 18cqw, 200px);
}

.ticket-density--medium {
  --ticket-image-size: clamp(88px, 13cqw, 144px);
}

.ticket-density--small {
  --ticket-image-size: clamp(60px, 9cqw, 100px);
}

.ticket-line.is-recent {
  animation: ticket-line-recognized 900ms ease-out;
}

@keyframes ticket-line-recognized {
  0% { background: color-mix(in srgb, var(--green-500), transparent 55%); }
  100% { background: transparent; }
}

.ticket-line__visual {
  width: var(--ticket-image-size);
  height: var(--ticket-image-size);
  border-radius: clamp(8px, calc(var(--ticket-image-size) / 5), 14px);
}

.ticket-line__copy {
  min-width: 0;
}

.ticket-line__copy strong,
.ticket-line__copy small {
  display: block;
}

.ticket-line__copy strong {
  overflow: hidden;
  font-size: 16px;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.ticket-line__copy small {
  margin-top: 3px;
  color: var(--muted-text);
  font-size: 12px;
}

.ticket-line__controls {
  display: grid;
  justify-items: end;
  gap: 7px;
}

.ticket-line__controls > strong {
  color: var(--green-500);
  font-size: 20px;
  font-variant-numeric: tabular-nums;
}

.quantity-controls {
  display: flex;
  gap: 6px;
  align-items: center;
}

.quantity-controls button {
  display: grid;
  place-items: center;
  width: 38px;
  height: 38px;
  padding: 0;
  color: var(--page-text);
  background: var(--input-bg);
  border: 1px solid var(--input-border);
  border-radius: 50%;
  box-shadow: var(--shadow-control);
  font-size: 23px;
  font-weight: 800;
  line-height: 1;
  cursor: pointer;
}

.quantity-controls button[data-line-action="plus"] {
  color: #fff;
  background: linear-gradient(160deg, var(--green-500), var(--green-600));
  border-color: var(--green-600);
}

.quantity-controls button[data-line-action="minus"] {
  color: var(--page-text);
}

.quantity-controls button[data-line-action="remove"] {
  width: 28px;
  height: 28px;
  color: var(--red-500);
  font-size: 18px;
  opacity: 0.75;
}

.quantity-controls span {
  min-width: 54px;
  color: var(--blue-500);
  font-weight: 800;
  font-size: 38px;
  font-variant-numeric: tabular-nums;
  text-align: center;
}

.sale-ticket-total {
  display: grid;
  grid-template-columns: 0.55fr 1fr;
  gap: 9px;
  flex: 0 0 auto;
}

.sale-ticket-total > div {
  display: grid;
  padding: 10px 12px;
  background: var(--input-bg);
  border: 1px solid var(--line);
  border-radius: 12px;
}

.sale-ticket-total span {
  color: var(--muted-text);
  font-size: 12px;
  font-weight: 800;
  letter-spacing: 0.09em;
}

.sale-ticket-total strong {
  font-size: 26px;
  font-variant-numeric: tabular-nums;
}

.sale-ticket-total .sale-total-main {
  color: #fff;
  background: linear-gradient(150deg, #176f45, #0b4a2e);
  border-color: #31a967;
  box-shadow: 0 8px 18px rgba(4, 61, 34, 0.25), inset 0 1px rgba(255, 255, 255, 0.18);
}

.sale-total-main span {
  color: #bdebd0;
}

.sale-total-main strong {
  font-size: 32px;
}

.recognition-signal {
  color: var(--green-500);
  text-shadow: 0 0 10px var(--green-glow);
}

.recognition-signal.is-flashing {
  animation: recognized 560ms ease-out;
}

@keyframes recognized {
  0% { transform: scale(0.7); filter: brightness(2.2); }
  65% { transform: scale(1.35); }
  100% { transform: scale(1); }
}

/* Panel "Producto reconocido": franja angosta (pestaña) siempre visible
   más un detalle desplegable. row-reverse deja la pestaña fija del lado
   derecho y el detalle se despliega hacia la izquierda, creciendo desde
   ahí sin mover la pestaña ni depender de hover (todo funciona a
   clic/toque). Arranca siempre abierto (clase .is-open puesta por defecto
   en el HTML, para que se vea grande desde el primer momento sin esperar a
   que cargue el JS); el cliente lo puede achicar con un clic a la franja
   angosta de 55 a 65px, y ARIANA recuerda esa preferencia. El ancho abierto
   es una variable que la media query de abajo ajusta. */
.last-product {
  --last-product-tab-width: 60px;
  --last-product-open-width: clamp(300px, 27vw, 380px);
  flex: 0 0 var(--last-product-tab-width);
  flex-direction: row-reverse;
  align-items: stretch;
  padding: 0;
  overflow: hidden;
  transition: flex-basis 220ms ease;
}

.last-product.is-open {
  flex-basis: var(--last-product-open-width);
}

.last-product-tab {
  display: flex;
  flex: 0 0 var(--last-product-tab-width);
  flex-direction: column;
  align-items: center;
  justify-content: flex-start;
  gap: 10px;
  width: var(--last-product-tab-width);
  padding: 16px 6px 12px;
  color: var(--page-text);
  text-align: center;
  background: transparent;
  border: 0;
  border-left: 1px solid var(--line);
  cursor: pointer;
}

.last-product.is-open .last-product-tab {
  border-left-color: var(--panel-border);
}

.last-product-tab__visual {
  position: relative;
  display: grid;
  width: 40px;
  height: 40px;
  flex: 0 0 auto;
  place-items: center;
  overflow: hidden;
  color: #73bdff;
  font-weight: 900;
  background: radial-gradient(circle at 35% 25%, #315f7e, #112d40 70%);
  border: 1px solid #477c9e;
  border-radius: 10px;
}

.last-product-tab__visual img {
  width: 100%;
  height: 100%;
  object-fit: contain;
  background: var(--input-bg);
}

.last-product-tab__placeholder {
  font-size: 23px;
}

.recognition-signal--tab {
  position: absolute;
  top: -5px;
  right: -5px;
  font-size: 17px;
  background: var(--panel-bg);
  border-radius: 50%;
}

.last-product-tab__label {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 3px;
  color: var(--muted-text);
  font-size: 12px;
  font-weight: 800;
  letter-spacing: 0.04em;
  line-height: 1.2;
}

.last-product-tab__arrow {
  font-size: 20px;
  color: var(--blue-500);
  transition: transform 180ms ease;
}

.last-product-tab[aria-expanded="true"] .last-product-tab__arrow {
  transform: rotate(180deg);
}

.last-product-detail {
  display: flex;
  min-width: 0;
  flex: 1 1 auto;
  flex-direction: column;
  padding: 18px;
  overflow-y: auto;
  border-right: 1px solid var(--line);
}

.last-product-detail__actions {
  display: flex;
  gap: 8px;
  align-items: center;
  flex: 0 0 auto;
}

.last-product-empty,
.last-product-content {
  min-height: 0;
  flex: 1;
}

.last-product-empty {
  display: grid;
  place-content: center;
  justify-items: center;
  padding: 20px;
  text-align: center;
}

.last-product-empty p {
  max-width: 220px;
  margin: 7px 0 0;
  color: var(--muted-text);
  font-size: 14px;
}

.last-product-placeholder,
.last-product-visual img {
  display: grid;
  width: clamp(112px, 10vw, 154px);
  height: clamp(112px, 10vw, 154px);
  place-items: center;
  color: #78c0ff;
  font-size: 94px;
  font-weight: 900;
  font-style: italic;
  object-fit: contain;
  background: radial-gradient(circle at 36% 24%, #2d668e, #102f45 62%, #081821);
  border: 2px solid #438abb;
  border-radius: 28px;
  box-shadow: inset 0 2px rgba(255, 255, 255, 0.18), 0 15px 30px rgba(4, 17, 27, 0.26), 0 0 18px var(--green-glow);
  text-shadow: 0 3px 0 #08284b;
}

.last-product-content {
  display: flex;
  align-items: center;
  flex-direction: column;
  padding: 14px 0 8px;
  overflow: hidden;
  text-align: center;
}

.last-product-visual {
  display: grid;
  min-height: 0;
  flex: 1;
  place-items: center;
}

.last-product-visual img {
  padding: 5px;
  background: var(--input-bg);
}

.last-product-content .eyebrow {
  margin-top: 8px;
}

.last-product-content h3 {
  max-width: 100%;
  margin: 0;
  overflow: hidden;
  font-size: 25px;
  line-height: 1.12;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.last-product-brand {
  margin: 5px 0 10px;
  color: var(--muted-text);
  font-size: 13px;
}

.last-product-numbers {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 8px;
  width: 100%;
}

.last-product-numbers div {
  display: grid;
  padding: 8px;
  background: var(--input-bg);
  border: 1px solid var(--line);
  border-radius: 10px;
}

.last-product-numbers span {
  color: var(--muted-text);
  font-size: 12px;
}

.last-product-numbers strong {
  font-size: 17px;
}

.sale-primary-actions {
  display: grid;
  gap: 7px;
  flex: 0 0 auto;
  padding-top: 10px;
  border-top: 1px solid var(--line);
}

.sale-charge-button {
  display: flex;
  min-height: 55px;
  align-items: center;
  justify-content: space-between;
  color: #fff;
  background: linear-gradient(180deg, #28b66b, #117b43);
  border: 1px solid #58cf8e;
  box-shadow: 0 8px 18px rgba(8, 75, 42, 0.3), inset 0 1px rgba(255, 255, 255, 0.24);
}

.sale-charge-button strong {
  font-size: 23px;
}

.sale-primary-actions .button--secondary {
  min-height: 48px;
  padding-block: 10px;
  font-size: 17px;
  font-weight: 800;
}

.sale-dialog {
  width: min(780px, calc(100vw - 34px));
}

.sale-payment-body {
  display: grid;
  gap: 14px;
  padding: 16px 20px;
}

.payment-due,
.payment-change,
.combined-balance {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 10px 12px;
  background: color-mix(in srgb, var(--green-500), transparent 88%);
  border: 1px solid color-mix(in srgb, var(--green-500), var(--panel-border) 50%);
  border-radius: 11px;
}

.payment-due strong {
  color: var(--green-500);
  font-size: 34px;
}

.payment-methods {
  display: grid;
  grid-template-columns: repeat(5, minmax(0, 1fr));
  gap: 7px;
}

.payment-methods button {
  min-height: 58px;
  padding: 7px;
  color: var(--page-text);
  font-size: 13px;
  font-weight: 800;
  background: var(--input-bg);
  border: 1px solid var(--input-border);
  border-radius: 10px;
  box-shadow: var(--shadow-control);
  cursor: pointer;
}

.payment-methods button.is-selected {
  color: #fff;
  background: linear-gradient(180deg, #258ed9, #116cad);
  border-color: #59ace6;
}

.payment-methods button.is-pending {
  opacity: 0.66;
}

.payment-methods small {
  display: block;
  margin-top: 3px;
}

.single-payment-fields {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(180px, 0.65fr);
  gap: 12px;
}

.payment-change {
  align-self: end;
  min-height: 42px;
}

.combined-payment-fields {
  display: grid;
  gap: 8px;
}

.combined-payment-row {
  display: grid;
  grid-template-columns: minmax(130px, 0.7fr) minmax(150px, 1fr) 32px;
  gap: 7px;
}

.combined-payment-row select,
.combined-payment-row input {
  min-width: 0;
  height: 38px;
  padding: 7px 9px;
  color: var(--page-text);
  background: var(--input-bg);
  border: 1px solid var(--input-border);
  border-radius: 8px;
}

.combined-payment-row .combined-payment-account {
  grid-column: 1 / -1;
}

.combined-payment-row button {
  color: var(--red-500);
  background: transparent;
  border: 1px solid var(--line);
  border-radius: 8px;
  cursor: pointer;
}

.dialog-state {
  min-height: 18px;
  margin: 0;
  color: var(--muted-text);
  font-size: 14px;
}

.weight-dialog {
  width: min(470px, calc(100vw - 34px));
}

.confirm-dialog {
  width: min(460px, calc(100vw - 34px));
}

.confirm-dialog-message {
  margin: 0;
  padding: 18px 20px;
  color: var(--page-text);
  font-size: 18px;
  line-height: 1.5;
}

.weight-entry {
  padding: 20px;
}

.weight-entry p {
  margin: 12px 0 0;
  color: var(--muted-text);
  font-size: 14px;
  line-height: 1.45;
}

.held-dialog {
  width: min(620px, calc(100vw - 34px));
}

.held-dialog__search {
  margin: 0 20px;
}

.held-dialog__search input {
  min-height: 38px;
  padding: 8px 11px;
}

.held-ticket-list {
  min-height: 180px;
  max-height: 420px;
  padding: 14px 20px;
  overflow-y: auto;
}

.last-product-empty[hidden],
.last-product-content[hidden],
.last-product-detail[hidden],
.last-product-placeholder[hidden],
#last-product-image[hidden],
.last-product-tab__placeholder[hidden],
#last-product-tab-image[hidden],
.single-payment-fields[hidden],
.combined-payment-fields[hidden],
.sale-fold-content[hidden],
#cash-received-field[hidden],
#payment-reference-field[hidden],
#payment-account-field[hidden],
.payment-change[hidden] {
  display: none;
}

.held-ticket-row {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto auto;
  gap: 9px;
  align-items: center;
  padding: 10px;
  border-bottom: 1px solid var(--line);
}

.held-ticket-row strong,
.held-ticket-row small {
  display: block;
}

.sale-history-row {
  grid-template-columns: minmax(0, 1fr) auto;
}

.sale-history-row > strong {
  color: var(--green-500);
  font-size: 18px;
}

.held-ticket-row small {
  margin-top: 3px;
  color: var(--muted-text);
}

.sale-return-lines {
  display: flex;
  flex-direction: column;
  gap: 8px;
  max-height: 260px;
  overflow-y: auto;
  margin: 10px 0;
}

.sale-return-line {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  padding: 8px 10px;
  border: 1px solid var(--line);
  border-radius: 8px;
}

.sale-return-line strong {
  display: block;
}

.sale-return-line small {
  display: block;
  margin-top: 2px;
  color: var(--muted-text);
}

.sale-return-line__qty {
  width: 90px;
  flex: 0 0 auto;
}

.sale-return-line.is-fully-returned {
  opacity: 0.55;
}

.sale-return-line__controls {
  display: flex;
  align-items: center;
  gap: 8px;
  flex: 0 0 auto;
}

.sale-history-row__copy {
  cursor: pointer;
}

.held-ticket-row.is-expanded {
  border-bottom-color: transparent;
}

.sale-return-panel {
  padding: 12px 10px 16px;
  margin-bottom: 4px;
  border-bottom: 1px solid var(--line);
  background: var(--input-bg);
  border-radius: 0 0 8px 8px;
}

.sale-return-panel__hint {
  margin: 4px 0 10px;
  color: var(--muted-text);
  font-size: 17px;
}

@media (max-width: 1180px) {
  .sale-finder {
    flex-basis: clamp(225px, 22vw, 280px);
  }

  .last-product {
    --last-product-open-width: clamp(270px, 30vw, 340px);
  }

  .sale-layout > .sale-finder,
  .sale-layout > .sale-ticket {
    padding: 12px;
  }

  .last-product-detail {
    padding: 12px;
  }

  .last-product-content h3 {
    font-size: 21px;
  }
}

/* Por debajo de este ancho, achicar el Ticket actual para hacerle lugar al
   panel abierto ya lo dejaría poco legible. En vez de eso, el panel pasa a
   ser un cajón superpuesto (position: absolute) que flota por encima sin
   robarle ancho al ticket ni producir scroll horizontal. Ninguna de las
   resoluciones de validación pedidas (1366×768 en adelante) llega a este
   punto; queda como resguardo para ventanas más angostas. */
@media (max-width: 1040px) {
  .last-product.is-open {
    position: absolute;
    inset: 0 0 0 auto;
    z-index: 5;
    flex-basis: min(320px, 82vw);
    box-shadow: -18px 0 34px rgba(4, 17, 27, 0.35), var(--shadow-raised);
  }
}

@media (max-height: 760px) {
  .sale-section-heading {
    min-height: 42px;
    padding-bottom: 8px;
  }

  .sale-search {
    padding-top: 9px;
  }

  .sale-search-help {
    margin-bottom: 6px;
  }

  .last-product-placeholder,
  .last-product-visual img {
    width: 104px;
    height: 104px;
    font-size: 75px;
  }

  .sale-charge-button {
    min-height: 48px;
  }
}

.products-layout {
  display: grid;
  grid-template-columns: minmax(620px, 1fr) minmax(305px, 0.36fr);
  gap: 16px;
  height: 100%;
  min-height: 0;
}

.products-catalog,
.product-detail {
  display: flex;
  min-height: 0;
  flex-direction: column;
  overflow: hidden;
}

.products-toolbar {
  display: flex;
  flex-wrap: wrap;
  gap: 12px 18px;
  align-items: center;
  justify-content: space-between;
  padding-bottom: 14px;
  border-bottom: 1px solid var(--line);
}

.products-toolbar h2 {
  font-size: 30px;
}

.products-toolbar__actions {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  align-items: center;
  justify-content: flex-end;
}

.products-toolbar__actions .button {
  min-width: 0;
  white-space: nowrap;
}

.product-search {
  display: grid;
  grid-template-columns: minmax(230px, 1fr) minmax(165px, 0.45fr) auto auto;
  gap: 9px;
  padding: 13px 0;
}

.product-search input,
.product-search select {
  width: 100%;
  height: 42px;
  padding: 8px 11px;
  color: var(--page-text);
  background: var(--input-bg);
  border: 1px solid var(--input-border);
  border-radius: 10px;
  box-shadow: inset 0 2px 4px rgba(25, 49, 66, 0.08);
}

.product-search .button {
  min-height: 42px;
  padding-block: 8px;
}

.products-table-frame {
  position: relative;
  min-height: 260px;
  flex: 1;
  overflow: auto;
  background: color-mix(in srgb, var(--input-bg), transparent 18%);
  border: 1px solid var(--line);
  border-radius: 12px;
}

.products-table {
  width: 100%;
  border-collapse: separate;
  border-spacing: 0;
  font-size: 16px;
}

.products-table th,
.products-table td {
  padding: 11px 10px;
  text-align: left;
  border-bottom: 1px solid var(--line);
}

.products-table th {
  position: sticky;
  top: 0;
  color: var(--muted-text);
  font-size: 13px;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  background: var(--header-bg);
  z-index: 1;
}

.products-table tr[data-product-id] {
  cursor: pointer;
}

.products-table tr[data-product-id]:hover,
.products-table tr.is-selected {
  background: color-mix(in srgb, var(--green-500), transparent 86%);
}

.products-table .product-cell strong,
.products-table .product-cell small {
  display: block;
}

.products-table .product-cell small {
  margin-top: 3px;
  color: var(--muted-text);
}

.numeric {
  text-align: right;
  font-variant-numeric: tabular-nums;
}

.stock-low {
  color: var(--red-500);
  font-weight: 800;
}

.product-expiration {
  display: block;
  margin-top: 2px;
  color: var(--amber-500);
}

.product-expiration.is-expired {
  color: var(--red-500);
  font-weight: 800;
}

.expiration-alert-banner {
  margin-bottom: 14px;
  padding: 10px 14px;
  color: var(--amber-500);
  font-size: 17px;
  font-weight: 700;
  background: color-mix(in srgb, var(--amber-500), transparent 90%);
  border: 1px solid color-mix(in srgb, var(--amber-500), var(--panel-border) 52%);
  border-radius: 9px;
}

.expiration-alert-list {
  display: flex;
  flex-wrap: wrap;
  gap: 6px 14px;
  margin: 8px 0 0;
  padding: 0;
  list-style: none;
  font-weight: 500;
}

.expiration-alert-list li {
  cursor: pointer;
  text-decoration: underline dotted;
}

.expiration-alert-list li.is-expired {
  color: var(--red-500);
  font-weight: 800;
}

.catalog-empty {
  position: absolute;
  inset: 0;
  display: grid;
  align-content: center;
  justify-items: center;
  padding: 30px;
  color: var(--muted-text);
  text-align: center;
}

.catalog-empty[hidden] {
  display: none;
}

.catalog-empty__icon {
  display: grid;
  width: 58px;
  height: 58px;
  place-items: center;
  margin-bottom: 10px;
  color: var(--blue-400);
  font-size: 46px;
  background: var(--input-bg);
  border: 1px solid var(--line);
  border-radius: 18px;
}

.catalog-empty strong {
  color: var(--page-text);
}

.catalog-empty p {
  max-width: 390px;
  margin: 6px 0 0;
  font-size: 16px;
  line-height: 1.45;
}

.pagination {
  display: flex;
  align-items: center;
  justify-content: space-between;
  min-height: 43px;
  color: var(--muted-text);
  font-size: 14px;
}

.pagination div {
  display: flex;
  gap: 9px;
  align-items: center;
}

.detail-empty {
  display: grid;
  flex: 1;
  align-content: center;
  justify-items: center;
  color: var(--muted-text);
  text-align: center;
}

.detail-empty p {
  max-width: 230px;
  font-size: 16px;
  line-height: 1.45;
}

.product-placeholder {
  display: grid;
  width: 98px;
  height: 98px;
  place-items: center;
  margin-bottom: 14px;
  color: #78c0ff;
  font-size: 75px;
  font-weight: 900;
  font-style: italic;
  background: radial-gradient(circle at 38% 26%, #265f8a, #102d42 58%, #081821);
  border: 2px solid #3f89bd;
  border-radius: 27px;
  box-shadow: inset 0 2px rgba(255, 255, 255, 0.2), 0 12px 25px rgba(4, 17, 27, 0.28);
  text-shadow: 0 3px 0 #08284b;
}

.product-placeholder--small {
  width: 67px;
  height: 67px;
  margin: 0;
  font-size: 51px;
  border-radius: 19px;
}

.product-image {
  width: 67px;
  height: 67px;
  padding: 3px;
  object-fit: contain;
  background: var(--input-bg);
  border: 1px solid var(--line);
  border-radius: 19px;
}

/* Tramo 43: .detail-empty define su propio "display: grid" más abajo en
   el archivo que la regla general [hidden] del principio, y como las dos
   pesan lo mismo, ganaba la de .detail-empty: el cartel "Seleccioná un
   producto" (con la A grande) seguía visible arriba de los datos aunque ya
   hubiera un producto elegido, y empujaba todo el panel hacia abajo (foto
   de Natalia). Mismo arreglo que ya tenían los paneles de "último
   producto" (ver .last-product-empty[hidden]). */
.detail-empty[hidden],
.product-placeholder[hidden],
.product-image[hidden] {
  display: none;
}

#product-detail-content {
  min-height: 0;
  flex: 1;
  overflow-y: auto;
  /* Tramo 43: el panel mide su propio ancho para acomodar la fila de
     "Registrar movimiento" (ver @container product-detail más abajo). */
  container: product-detail / inline-size;
}

.product-hero {
  display: grid;
  grid-template-columns: 67px minmax(0, 1fr);
  gap: 13px;
  align-items: center;
  padding-bottom: 14px;
  border-bottom: 1px solid var(--line);
}

.product-hero h2 {
  font-size: 25px;
  line-height: 1.15;
}

.detail-category {
  display: inline-block;
  margin-top: 6px;
  color: var(--muted-text);
  font-size: 14px;
}

.product-photo-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin-top: 8px;
}

.product-photo-button {
  display: block;
  margin-top: 0;
  padding: 4px 10px;
  min-height: 0;
  font-size: 13px;
}

.product-photo-state {
  margin: -6px 0 14px;
  color: var(--muted-text);
  font-size: 14px;
}

.product-photo-state:empty {
  display: none;
}

.stock-summary {
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 3px 12px;
  align-items: end;
  margin: 14px 0;
  padding: 13px;
  background: color-mix(in srgb, var(--green-500), transparent 88%);
  border: 1px solid color-mix(in srgb, var(--green-500), var(--panel-border) 42%);
  border-radius: 13px;
}

.stock-summary span,
.stock-summary small {
  color: var(--muted-text);
  font-size: 14px;
}

.stock-summary strong {
  grid-row: 1 / 3;
  grid-column: 2;
  color: var(--green-500);
  font-size: 36px;
  font-variant-numeric: tabular-nums;
}

.price-summary {
  display: grid;
  /* Tramo 43: antes eran 3 columnas fijas que no se podían achicar por
     debajo del ancho de su contenido ("$ 1.790,00" con la letra agrandada
     del Tramo 27), y la tercera tarjeta (Stock mínimo) quedaba cortada
     fuera del panel. Ahora entran 3 si hay lugar; si no, la que no entra
     pasa a una segunda línea entera. */
  grid-template-columns: repeat(auto-fit, minmax(min(100%, 112px), 1fr));
  gap: 7px;
  margin: 0 0 14px;
}

.price-summary div {
  padding: 9px;
  background: var(--input-bg);
  border: 1px solid var(--line);
  border-radius: 10px;
}

.price-summary dt {
  color: var(--muted-text);
  font-size: 12px;
  text-transform: uppercase;
}

.price-summary dd {
  margin: 4px 0 0;
  overflow-wrap: anywhere;
  font-size: 17px;
  font-weight: 800;
  font-variant-numeric: tabular-nums;
}

.product-edit-price-button {
  width: 100%;
  margin: 0 0 14px;
}

.price-edit-product-name {
  margin: -6px 0 14px;
  font-weight: 700;
}

.stock-action {
  padding: 12px;
  background: var(--input-bg);
  border: 1px solid var(--line);
  border-radius: 13px;
}

/* Tramo 43: con el panel angosto, el tipo de movimiento, la cantidad y el
   botón no entraban en una sola fila ("Reposic", "Cantida", el botón
   pegado al borde). Por defecto ahora van tipo y cantidad juntos y
   "Registrar" abajo, a todo el ancho; si el panel es ancho, vuelven a una
   sola fila como antes. */
.stock-action__row {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(0, 1fr);
  gap: 6px;
  margin-bottom: 7px;
}

.stock-action__row .button {
  grid-column: 1 / -1;
}

@container product-detail (min-width: 430px) {
  .stock-action__row {
    grid-template-columns: minmax(0, 0.8fr) minmax(0, 0.6fr) auto;
  }

  .stock-action__row .button {
    grid-column: auto;
  }
}

.stock-action select,
.stock-action input {
  min-width: 0;
  height: 36px;
  padding: 6px 8px;
}

.stock-action .button {
  min-width: 0;
  min-height: 36px;
  padding: 6px 10px;
  font-size: 14px;
}

.stock-action > input {
  width: 100%;
}

.stock-action__hint {
  display: block;
  margin: 0 0 7px;
  color: var(--muted-text);
}

.movement-history {
  margin-top: 14px;
}

.product-delete-button {
  width: 100%;
  margin-top: 14px;
  color: var(--red-500);
  border-color: var(--red-500);
}

.batch-photo-tray-section {
  padding: 6px 20px 4px;
}

.batch-photo-hint {
  margin: 0 0 12px;
  color: var(--muted-text);
  font-size: 16px;
  line-height: 1.45;
  text-align: center;
}

.batch-photo-tray {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(72px, 1fr));
  gap: 10px;
  max-height: 260px;
  overflow-y: auto;
}

.batch-photo-tray-item {
  display: grid;
  gap: 4px;
  justify-items: center;
}

.batch-photo-tray-item img {
  width: 72px;
  height: 72px;
  object-fit: cover;
  border: 1px solid var(--input-border);
  border-radius: 10px;
}

.batch-photo-tray-item small {
  color: var(--muted-text);
  font-size: 12px;
}

.batch-photo-tray-empty {
  margin: 10px 0 0;
  color: var(--muted-text);
  font-size: 16px;
  text-align: center;
}

.batch-photo-tray-empty:empty {
  display: none;
}

#batch-photo-button {
  position: relative;
}

.batch-photo-badge {
  position: absolute;
  top: -7px;
  right: -7px;
  display: grid;
  place-items: center;
  min-width: 18px;
  height: 18px;
  padding: 0 4px;
  color: #fff;
  background: var(--green-500);
  border-radius: 999px;
  font-size: 13px;
  font-weight: 800;
}

.movement-history__heading {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding-bottom: 8px;
}

.movement-history__heading h3 {
  margin: 0;
  font-size: 17px;
}

.movement-history__heading span {
  color: var(--muted-text);
  font-size: 12px;
}

.movement-list {
  max-height: 165px;
  overflow-y: auto;
  border-top: 1px solid var(--line);
}

.movement-item {
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 4px 10px;
  padding: 8px 2px;
  border-bottom: 1px solid var(--line);
}

.movement-item strong,
.movement-item b {
  font-size: 14px;
}

.movement-item small {
  color: var(--muted-text);
  font-size: 12px;
}

.movement-item b {
  grid-row: 1 / 3;
  grid-column: 2;
  align-self: center;
  font-variant-numeric: tabular-nums;
}

.movement-item b.is-positive {
  color: var(--green-500);
}

.movement-item b.is-negative {
  color: var(--red-500);
}

.product-dialog {
  width: min(720px, calc(100vw - 40px));
  max-height: calc(100dvh - 40px);
  padding: 0;
  color: var(--page-text);
  background: var(--panel-bg);
  border: 1px solid var(--panel-border);
  border-radius: 20px;
  box-shadow: 0 28px 80px rgba(0, 8, 14, 0.52);
}

.product-dialog::backdrop {
  background: rgba(3, 13, 20, 0.7);
  backdrop-filter: blur(3px);
}

.product-dialog form {
  display: flex;
  max-height: calc(100dvh - 42px);
  flex-direction: column;
}

.dialog-heading {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 18px 20px 13px;
  border-bottom: 1px solid var(--line);
}

.dialog-heading h2 {
  margin: 0;
}

.dialog-close {
  display: grid;
  width: 35px;
  height: 35px;
  place-items: center;
  color: var(--muted-text);
  background: var(--input-bg);
  border: 1px solid var(--line);
  border-radius: 10px;
  cursor: pointer;
}

/* El caracter de texto "×" trae un colchón invisible arriba y abajo propio
   de la tipografía (para acentos, etc.), distinto en cada fuente, que
   "place-items: center" centraba como si fuera parte del símbolo — por eso
   se veía corrida del centro real del cuadrado que lo rodea. Un primer
   intento (Tramo 28) lo arregló con la propiedad CSS "text-box", pero esa
   propiedad es muy nueva: ARIANA abre el Edge o Chrome que la computadora
   del cliente ya tenga instalado (ver run.py), no una versión fija empotrada
   en el instalador, así que en una computadora con el navegador desactualizado
   esa línea no hace nada y el problema seguía - exactamente lo que reportó
   Natalia después de instalar esa versión. En vez de depender de qué tan al
   día esté el navegador de cada cliente, el símbolo ahora es un dibujo
   (SVG) de dos líneas en diagonal de esquina a esquina: su centro es
   geométrico, no depende de ninguna fuente ni de qué tan nueva sea una
   propiedad CSS, así que se ve igual en cualquier version de Edge o Chrome. */
.dialog-close__icon {
  width: 16px;
  height: 16px;
  stroke: currentColor;
  stroke-width: 2;
  stroke-linecap: round;
  pointer-events: none;
}

.dialog-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 12px;
  padding: 17px 20px;
  overflow-y: auto;
}

.field-hint {
  margin: 0;
  color: var(--muted-text);
  font-size: 14px;
  font-weight: 500;
  line-height: 1.35;
}

/* Aviso de "precio sugerido" que aparece en los diálogos de alta y edición
   de producto apenas hay costo y % (propio o heredado de la categoría)
   como para calcular algo: muestra el precio ya redondeado al múltiplo de
   100 más cercano, con un botón para volcarlo al campo de precio sin
   tener que escribirlo a mano. */
.field.suggested-price-hint:not([hidden]) {
  display: flex;
  flex-wrap: wrap;
  gap: 8px 14px;
  align-items: center;
  justify-content: space-between;
  padding: 9px 12px;
  color: var(--page-text);
  font-size: 17px;
  font-weight: 700;
  background: var(--input-bg);
  border: 1px dashed var(--panel-border);
  border-radius: 10px;
}

.dialog-actions {
  display: flex;
  gap: 10px;
  align-items: center;
  justify-content: flex-end;
  padding: 12px 20px 16px;
  border-top: 1px solid var(--line);
}

#product-form-state {
  margin-right: auto;
  color: var(--muted-text);
  font-size: 14px;
}

.import-dialog {
  width: min(960px, calc(100vw - 40px));
}

.import-body {
  min-height: 0;
  padding: 16px 20px;
  overflow-y: auto;
}

.import-file-step {
  display: grid;
  grid-template-columns: minmax(230px, 1fr) minmax(250px, 0.75fr) auto;
  gap: 14px;
  align-items: end;
  padding: 13px;
  background: var(--input-bg);
  border: 1px solid var(--line);
  border-radius: 13px;
}

.import-file-step h3,
.import-section-heading h3 {
  margin: 0;
  font-size: 20px;
}

.import-file-step p,
.import-note {
  margin: 5px 0 0;
  color: var(--muted-text);
  font-size: 14px;
  line-height: 1.45;
}

.file-picker {
  display: grid;
  gap: 6px;
  color: var(--muted-text);
  font-size: 13px;
  font-weight: 800;
  letter-spacing: 0.05em;
  text-transform: uppercase;
}

.file-picker input {
  min-width: 0;
  height: 40px;
  padding: 7px;
  color: var(--page-text);
  background: var(--panel-bg);
  border: 1px solid var(--input-border);
  border-radius: 9px;
}

.import-state {
  min-height: 18px;
  margin: 9px 0 0;
  color: var(--muted-text);
  font-size: 14px;
}

.import-preview {
  padding-top: 5px;
}

.import-section-heading {
  display: flex;
  gap: 14px;
  align-items: center;
  justify-content: space-between;
}

.import-counters {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 8px;
  margin: 12px 0;
}

.import-counters div {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  padding: 10px 12px;
  background: var(--input-bg);
  border: 1px solid var(--line);
  border-radius: 10px;
}

.import-counters span {
  color: var(--muted-text);
  font-size: 13px;
  text-transform: uppercase;
}

.import-counters strong {
  color: var(--green-500);
  font-size: 26px;
  font-variant-numeric: tabular-nums;
}

.import-counters .is-warning strong {
  color: var(--red-500);
}

.import-table-frame {
  max-height: 210px;
  overflow: auto;
  border: 1px solid var(--line);
  border-radius: 11px;
}

.import-table td:last-child {
  max-width: 300px;
}

.import-status {
  color: var(--green-500);
  font-weight: 800;
}

.import-status.is-existing {
  color: var(--blue-400);
}

.import-status.is-error {
  color: var(--red-500);
}

.import-policies {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 12px;
  margin-top: 12px;
}

.confirmation-check {
  display: flex;
  gap: 9px;
  align-items: center;
  margin-top: 12px;
  padding: 10px 12px;
  color: var(--page-text);
  font-size: 14px;
  font-weight: 700;
  background: color-mix(in srgb, var(--green-500), transparent 91%);
  border: 1px solid color-mix(in srgb, var(--green-500), var(--panel-border) 55%);
  border-radius: 10px;
}

.confirmation-check input {
  width: 17px;
  height: 17px;
  accent-color: var(--green-500);
}

@media (max-width: 900px) {
  .import-file-step {
    grid-template-columns: 1fr;
  }

  .import-counters {
    grid-template-columns: repeat(2, 1fr);
  }

  .import-policies {
    grid-template-columns: 1fr;
  }
}

@media (max-height: 760px) {
  .workspace {
    grid-template-rows: 68px minmax(0, 1fr);
  }

  .workspace-scroll {
    padding-top: 13px;
  }

  .intro-panel {
    padding-block: 12px;
  }

  /* :not(.last-product) porque ese panel maneja su propio padding interno
     (pestaña + detalle) para poder colapsar a una franja de 60px. */
  .panel:not(.last-product) {
    padding: 14px;
  }

  .form-grid {
    gap: 10px;
    margin-top: 12px;
  }

  .field input {
    min-height: 38px;
  }
}

@media (max-width: 1080px) {
  .app-shell {
    grid-template-columns: 178px minmax(0, 1fr);
  }

  .brand {
    grid-template-columns: 45px minmax(0, 1fr);
    padding-inline: 10px;
  }

  .brand__mark {
    width: 45px;
    height: 45px;
  }

  .brand__words strong {
    font-size: 25px;
  }

  .brand__words span {
    font-size: 8px;
  }

  .module-nav__item {
    grid-template-columns: 27px minmax(0, 1fr);
    gap: 7px;
    padding-inline: 7px;
    font-size: 16px;
  }

  .module-nav__icon {
    width: 27px;
    height: 27px;
  }

  .settings-grid {
    grid-template-columns: minmax(0, 1.25fr) minmax(270px, 0.75fr);
  }

  .products-layout {
    grid-template-columns: minmax(560px, 1fr) minmax(275px, 0.34fr);
  }

  .products-toolbar__actions .button {
    padding-inline: 9px;
    font-size: 14px;
  }
}

/* Tramo 48.1: aviso de vencimiento de la licencia (dentro del encabezado,
   para no cambiar la grilla de la pantalla). */
.license-banner {
  display: flex;
  flex: 1 1 auto;
  align-items: center;
  gap: 12px;
  min-width: 0;
  margin: 0 18px;
  padding: 6px 8px 6px 14px;
  color: var(--amber-500);
  font-size: 14px;
  font-weight: 700;
  line-height: 1.3;
  background: color-mix(in srgb, var(--amber-500), transparent 90%);
  border: 1px solid color-mix(in srgb, var(--amber-500), var(--panel-border) 52%);
  border-radius: 9px;
}
.license-banner > span { flex: 1 1 auto; min-width: 0; }
.license-banner > button { flex: 0 0 auto; }
.license-banner[hidden] { display: none; }
.license-banner--blocked {
  color: var(--red-500);
  background: color-mix(in srgb, var(--red-500), transparent 90%);
  border-color: color-mix(in srgb, var(--red-500), var(--panel-border) 52%);
}
.license-renew-body {
  display: grid;
  gap: 12px;
  padding: 16px 20px 8px;
}

/* Tramo 48.2: asistente de primer uso. */
.setup-dialog { width: min(640px, calc(100vw - 34px)); }
.setup-progress {
  display: flex;
  gap: 6px;
  margin: 0;
  padding: 12px 20px 0;
  list-style: none;
}
.setup-progress li {
  flex: 1 1 0;
  height: 5px;
  background: var(--panel-border);
  border-radius: 3px;
}
.setup-progress li.is-done { background: color-mix(in srgb, var(--green-600, #1f9d55), transparent 35%); }
.setup-progress li.is-current { background: var(--green-600, #1f9d55); }
.setup-body { padding: 16px 20px 4px; }
.setup-step { display: grid; gap: 14px; justify-items: start; }
.setup-step[hidden] { display: none; }
.setup-step .form-grid { width: 100%; }
.setup-lead {
  margin: 0;
  color: var(--page-text);
  font-size: 17px;
  line-height: 1.45;
}
.setup-state {
  margin: 0;
  min-height: 1.4em;
  color: var(--page-text);
  font-weight: 700;
}
.setup-step > .field { width: 100%; }
.workspace-header__status { flex-shrink: 0; white-space: nowrap; }
.diagnostics-box { display: grid; gap: 8px; justify-items: start; margin-top: 14px; }
.central-card-box { display: grid; gap: 8px; justify-items: start; margin: 12px 0; }
.central-card-text { width: 100%; font-family: ui-monospace, Consolas, monospace; font-size: 12px; word-break: break-all; }
.central-card-text[hidden] { display: none; }
#diagnostics-download { text-decoration: none; }

/* Tramo ARCA-1: factura electrónica en Configuración. */
.panel--arca .panel__heading { align-items: center; }
.arca-badge {
  padding: 4px 10px;
  border-radius: 999px;
  font-size: 12px;
  font-weight: 800;
  letter-spacing: 0.06em;
  color: var(--amber-500);
  border: 1px solid currentColor;
}
.arca-badge.is-real { color: var(--green-600); }
.arca-next-step {
  margin: 0 0 12px;
  padding: 10px 14px;
  border-radius: var(--radius-sm);
  font-weight: 700;
  border: 1px solid var(--panel-border);
  background: color-mix(in srgb, var(--blue-500), transparent 90%);
}
.arca-next-step.is-ready { background: color-mix(in srgb, var(--green-500), transparent 85%); }
.arca-problems {
  margin: 0 0 12px;
  padding: 10px 14px 10px 30px;
  border-radius: var(--radius-sm);
  color: var(--red-500);
  background: color-mix(in srgb, var(--red-500), transparent 90%);
}
[data-theme="metal-blue"] .arca-problems { color: #ff9a9a; }
.arca-step {
  margin: 0 0 12px;
  padding: 12px 14px;
  border-radius: var(--radius-md);
  border: 1px solid var(--line);
}
.arca-step.is-current { border-color: var(--blue-500); box-shadow: var(--focus-ring); }
.arca-step h3 { display: flex; align-items: center; gap: 8px; margin: 0 0 10px; font-size: 16px; }
.arca-step__number {
  display: inline-grid;
  place-items: center;
  width: 24px;
  height: 24px;
  border-radius: 50%;
  font-size: 13px;
  color: #fff;
  background: var(--muted-text);
}
.arca-step.is-current .arca-step__number { background: var(--blue-500); }
.arca-step.is-done .arca-step__number { background: var(--green-500); }
.arca-cert-row { display: flex; flex-wrap: wrap; align-items: center; gap: 10px; margin-bottom: 10px; }
.arca-certs { display: grid; grid-template-columns: max-content 1fr; gap: 4px 14px; margin: 0; }
.arca-certs dt { font-weight: 700; }
.arca-certs dd { margin: 0; }
#arca-message.is-ok { color: var(--green-600); }
.arca-checks { margin: 10px 0 4px; padding: 0; list-style: none; display: grid; gap: 6px; }
.arca-checks li { padding: 8px 12px; border-radius: var(--radius-sm); border: 1px solid var(--line); }
.arca-checks li.is-ok { background: color-mix(in srgb, var(--green-500), transparent 88%); }
.arca-checks li.is-bad { color: var(--red-500); background: color-mix(in srgb, var(--red-500), transparent 90%); }
[data-theme="metal-blue"] .arca-checks li.is-bad { color: #ff9a9a; }
.arca-step-message { margin: 10px 0 0; font-weight: 700; }
.arca-step-message:empty { display: none; }
.arca-step-message.is-ok { color: var(--green-600); }
.arca-switch { display: flex; align-items: center; gap: 10px; margin: 0 0 10px; font-weight: 700; cursor: pointer; }
.arca-switch input { width: 20px; height: 20px; }
.arca-invoice-counts { margin: 10px 0 6px; font-weight: 700; }

/* Tramo 49.3: botón "Elegir carpeta…". */
.folder-pick-actions { display: flex; align-items: flex-end; padding-bottom: 2px; }
.setup-step [data-pick-folder] { margin: 0 0 10px; }
.arca-checks[hidden], .arca-problems[hidden] { display: none; }

/* 0.56.0: Últimas ventas simple (número del turno, productos, total) y
   detalle grande al tocar un ticket. Devolver/anular en "Más opciones". */
.sale-history-item {
  display: grid;
  grid-template-columns: auto minmax(0, 1fr) auto auto;
  align-items: center;
  gap: 14px;
  width: 100%;
  padding: 10px 12px;
  color: var(--page-text);
  text-align: left;
  font: inherit;
  background: var(--input-bg);
  border: 1px solid var(--line);
  border-radius: 12px;
  cursor: pointer;
}
.sale-history-item + .sale-history-item { margin-top: 8px; }
.sale-history-item:hover,
.sale-history-item:focus-visible { border-color: var(--green-500); outline: none; }
.sale-history-item__number {
  display: grid;
  place-items: center;
  min-width: 52px;
  height: 52px;
  padding: 0 8px;
  color: #fff;
  font-size: 24px;
  font-weight: 900;
  background: var(--green-500);
  border-radius: 12px;
}
.sale-history-item__copy { display: grid; gap: 3px; min-width: 0; }
.sale-history-item__copy strong { font-size: 19px; }
.sale-history-item__copy small { color: var(--muted-text); font-size: 15px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.sale-history-item__total { color: var(--green-500); font-size: 22px; white-space: nowrap; }
.sale-history-item > b { color: var(--muted-text); font-size: 26px; }

.sale-detail { display: grid; gap: 12px; }
.sale-detail__back { justify-self: start; }
.sale-detail__meta { margin: 0; color: var(--muted-text); font-size: 16px; }
.sale-detail__lines {
  display: grid;
  gap: 0;
  max-height: min(42vh, 420px);
  margin: 0;
  padding: 0;
  overflow-y: auto;
  list-style: none;
  border: 1px solid var(--line);
  border-radius: 12px;
}
.sale-detail__lines li {
  display: grid;
  grid-template-columns: auto minmax(0, 1fr) auto;
  align-items: baseline;
  gap: 12px;
  padding: 11px 14px;
  border-bottom: 1px solid var(--line);
}
.sale-detail__lines li:last-child { border-bottom: 0; }
.sale-detail__qty { font-size: 20px; font-weight: 800; white-space: nowrap; }
.sale-detail__name { display: grid; gap: 2px; font-size: 20px; font-weight: 700; overflow-wrap: anywhere; }
.sale-detail__name small { color: var(--muted-text); font-size: 14px; font-weight: 500; }
.sale-detail__lines li.has-return .sale-detail__name small { color: var(--amber-500); }
.sale-detail__subtotal { font-size: 20px; white-space: nowrap; }
.sale-detail__total {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 12px;
  padding: 12px 16px;
  background: color-mix(in srgb, var(--green-500) 14%, var(--input-bg));
  border: 1px solid color-mix(in srgb, var(--green-500) 50%, var(--line));
  border-radius: 12px;
}
.sale-detail__total span { color: var(--muted-text); font-size: 15px; font-weight: 800; letter-spacing: 0.06em; }
.sale-detail__total strong { color: var(--green-500); font-size: clamp(30px, 3vw, 42px); }
.sale-detail__print { justify-self: stretch; min-height: 48px; font-size: 18px; }
.sale-detail__more { border-top: 1px solid var(--line); padding-top: 10px; }
.sale-detail__more summary { cursor: pointer; color: var(--muted-text); font-size: 16px; font-weight: 700; }
.sale-detail__options { display: flex; flex-wrap: wrap; gap: 10px; margin-top: 12px; }
.sale-detail__cancel { color: var(--red-500); }
.sale-detail__anchor { margin-top: 10px; }
.held-ticket-list:has(.sale-detail) { max-height: min(76vh, 720px); }

/* 0.57.0: en cada venta, CON o SIN factura — dos botones grandes. */
.invoice-choice { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; margin: 12px 0 6px; }
.invoice-choice[hidden] { display: none; }
.invoice-choice__option {
  display: grid;
  gap: 4px;
  padding: 14px 12px;
  color: var(--page-text);
  text-align: center;
  font: inherit;
  background: var(--input-bg);
  border: 2px solid var(--line);
  border-radius: 12px;
  cursor: pointer;
}
.invoice-choice__option b { font-size: 21px; letter-spacing: 0.04em; }
.invoice-choice__option small { color: var(--muted-text); font-size: 14px; }
.invoice-choice__option.is-selected[data-invoice-choice="yes"] {
  color: #fff;
  background: var(--green-500);
  border-color: var(--green-500);
}
.invoice-choice__option.is-selected[data-invoice-choice="no"] {
  color: #fff;
  background: #c47a12;
  border-color: #c47a12;
}
.invoice-choice__option.is-selected small { color: rgba(255, 255, 255, 0.9); }

/* 0.57.0: Últimas ventas agrupadas — turno actual abierto, el resto cerrado. */
.sale-history-group { margin-bottom: 12px; border: 1px solid var(--line); border-radius: 14px; overflow: hidden; }
.sale-history-group.is-current { border: 2px solid var(--green-500); }
.sale-history-group__heading {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 12px;
  padding: 12px 14px;
  cursor: pointer;
  background: color-mix(in srgb, var(--input-bg) 70%, transparent);
}
.sale-history-group.is-current > .sale-history-group__heading {
  cursor: default;
  color: #fff;
  background: var(--green-500);
}
.sale-history-group__heading strong { font-size: 18px; }
.sale-history-group__heading span { font-size: 15px; font-weight: 700; opacity: 0.85; }
details.sale-history-group > summary { list-style: none; }
details.sale-history-group > summary::-webkit-details-marker { display: none; }
details.sale-history-group > summary strong::before { content: "▸ "; }
details.sale-history-group[open] > summary strong::before { content: "▾ "; }
.sale-history-group__body { padding: 10px; }
.sale-history-note { margin: 0 0 12px; padding: 10px 14px; color: var(--muted-text); border: 1px dashed var(--line); border-radius: 12px; }

/* 0.57.1: lista de categorías con "Editar" en la ventana Categorías. */
.category-list { display: grid; gap: 6px; max-height: min(34vh, 300px); margin: 14px 20px 12px; overflow-y: auto; }
.category-list__row {
  display: grid;
  grid-template-columns: minmax(0, 1.2fr) auto minmax(0, 1.6fr) auto;
  align-items: center;
  gap: 12px;
  padding: 9px 12px;
  color: var(--page-text);
  text-align: left;
  font: inherit;
  background: var(--input-bg);
  border: 1px solid var(--line);
  border-radius: 10px;
  cursor: pointer;
}
.category-list__row strong { font-size: 17px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.category-list__row span { color: var(--muted-text); font-size: 14px; }
.category-list__row span.has-days { color: var(--amber-500); font-weight: 700; }
.category-list__row b { color: var(--blue-500, #2f7fd1); font-size: 14px; }
.category-list__row:hover,
.category-list__row.is-editing { border-color: var(--green-500); }

/* 0.58.0: etiquetas con código de balanza (Configuración → Balanza). */
.scale-labels-box { display: grid; gap: 10px; margin-top: 18px; padding-top: 16px; border-top: 1px solid var(--line); }
.scale-labels-box h3 { margin: 0; font-size: 19px; }
.scale-labels-box .button { justify-self: start; }
.scale-labels-test { display: flex; flex-wrap: wrap; align-items: end; gap: 10px; }
.scale-labels-test .field { flex: 1 1 260px; }
#scale-labels-state.is-ok { color: var(--green-500); font-weight: 700; }
/* 0.60.0: revisión de PLU */
.scale-plu-report { display: grid; gap: 8px; }
.scale-plu-report > .button { justify-self: start; }
.scale-plu-result { display: grid; gap: 6px; padding: 10px 12px; border: 1px solid var(--line); border-radius: 10px; }
.scale-plu-result h4 { margin: 6px 0 0; font-size: 15px; }
.scale-plu-result ul { margin: 0; padding-left: 20px; max-height: 220px; overflow-y: auto; }
.scale-plu-result .button { justify-self: start; }
.scale-plu-ok { margin: 0; font-weight: 600; color: var(--green-600, var(--green-500)); }

/* 0.60.1: ticket de Vender angosto (pantallas de 1366 px con el panel
   "Producto reconocido" abierto): la foto y los botones ocupaban todo y el
   nombre quedaba en 3 letras ("Yer…"), y "0,25 kg" se montaba sobre el ×.
   Por debajo de 520 px de ancho: foto chica, nombre en hasta 2 renglones y
   cantidad más chica. En pantallas grandes no cambia nada. */
@container ticket-lines (max-width: 520px) {
  .ticket-line {
    --ticket-image-size: clamp(44px, 14cqw, 64px);
    gap: 8px;
    padding: 7px 8px;
  }
  .ticket-line__copy strong {
    display: -webkit-box;
    overflow: hidden;
    font-size: 15px;
    line-height: 1.2;
    white-space: normal;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
  }
  .ticket-line__controls > strong { font-size: 17px; }
  .quantity-controls { gap: 4px; }
  .quantity-controls button { width: 32px; height: 32px; font-size: 19px; }
  .quantity-controls button[data-line-action="remove"] { width: 26px; height: 26px; font-size: 16px; }
  .quantity-controls span { min-width: 34px; font-size: 26px; white-space: nowrap; }
}
