/* ======================================================================== */
/* pos-v2 — brutalist monochrome (modeled on yeezy.com)                      */
/* ======================================================================== */
/*
 * Design intent
 * ──────────────
 * Pure black on pure white.  No color.  No radii.  No shadows.  No gradients.
 * Helvetica.  All-caps section labels.  Thin 1px black borders as the only
 * structural element.  Typography does every piece of heavy lifting.
 *
 * The POS shouldn't try to look friendly — it should look decisive.  A
 * cashier scans two numbers and presses Enter; the UI gets out of the way.
 *
 * Every class name stays pos-v2-native.  Only the visual tokens change.
 */

/* =======================  TOKENS  ======================================== */

:root {
  --bg:          #ffffff;
  --bg-sunken:   #f0f0f0;
  --surface:     #ffffff;
  --surface-2:   #fafafa;

  --ink:         #000000;
  --ink-soft:    #000000;
  --ink-muted:   #666666;
  --ink-faint:   #999999;
  --ink-subtle:  #cccccc;

  --line:        #000000;
  --line-soft:   #cccccc;

  --accent:      #000000;
  --accent-ink:  #ffffff;

  --primary:       #000000;
  --primary-hover: #1a1a1a;
  --primary-ink:   #ffffff;

  --ok:      #000000;
  --ok-soft: #f0f0f0;
  --warn:    #000000;
  --warn-soft:  #f0f0f0;
  --danger:     #d00000;
  --danger-soft:#ffeeee;

  --ring:      0 0 0 2px #000000;
  --shadow-sm: none;
  --shadow-md: none;
  --shadow-lg: none;
  --shadow-card: none;

  --radius:    0;
  --radius-sm: 0;
  --radius-lg: 0;

  /* Inter — loaded from Google Fonts via index.html.
     Helvetica Neue / Arial stay as fallbacks for the initial paint before
     Inter finishes loading, and for kiosks that are completely offline. */
  --font: "Inter", "Helvetica Neue", Helvetica, Arial, sans-serif;
  --font-mono: "Inter", "Helvetica Neue", Helvetica, Arial, sans-serif;
}

/* =======================  RESET + BASE  ================================== */

*, *::before, *::after { box-sizing: border-box; }
html, body { margin: 0; padding: 0; }
/* Don't pin html/body to a fixed 100% height — that made body the
   scrolling root in some browsers, defeating scrollbar-gutter on <html>.
   Letting content grow past the viewport and scroll from <html> keeps
   overflow-y: scroll + scrollbar-gutter: stable in charge of the gutter. */
html {
  -webkit-text-size-adjust: 100%;
  background: #ffffff;
  /* Reserve the vertical-scrollbar gutter permanently so viewport width
     stays constant whether the current tab's content overflows or not.
     Without this, switching to the Fiscal tab (whose content loads in
     stages) makes the scrollbar appear/disappear mid-load, which shrinks
     and re-expands the flexed topbar. The gutter must be reserved on
     both html and body because `html { height: 100% }` below forces
     body to be the actual scrolling root in some browsers. */
  scrollbar-gutter: stable;
  overflow-y: scroll;
}
body {
  color: #000;
  font-family: var(--font);
  font-size: 13px;
  line-height: 1.35;
  background: #ffffff;
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
  min-height: 100vh;
  min-height: 100dvh;
  font-weight: 400;
  letter-spacing: 0.01em;
}
button { font: inherit; color: inherit; cursor: pointer; }
input, select, textarea {
  font: inherit;
  color: #000;
  width: 100%;
  border: 1px solid #000;
  background: #fff;
  border-radius: 0;
  padding: 10px 12px;
  transition: none;
}
/* Checkboxes and radios must escape the textbox-style defaults above —
   otherwise they render as giant 100%-wide boxes with borders and padding. */
input[type="checkbox"], input[type="radio"] {
  width: 14px;
  height: 14px;
  min-width: 14px;
  padding: 0;
  margin: 0;
  border: 1px solid #000;
  accent-color: #000;
  cursor: pointer;
  flex-shrink: 0;
}
input:focus-visible, select:focus-visible, textarea:focus-visible,
button:focus-visible {
  outline: 2px solid #000;
  outline-offset: -1px;
  box-shadow: none;
}
h1, h2, h3, h4 {
  margin: 0;
  font-weight: 700;
  letter-spacing: 0;
  color: #000;
}

#root {
  min-height: 100vh;
  min-height: 100dvh;
  display: flex;
  flex-direction: column;
  background: #fff;
}

::selection { background: #000; color: #fff; }

/* =======================  APP SHELL  ===================================== */

.v2-shell {
  display: flex;
  flex-direction: column;
  min-height: 100vh;
  min-height: 100dvh;
}

/* "Nueva versión disponible" banner (updateCheck.js) — managers/admins only.
   Amber + black so it stands out against the monochrome chrome. Renders just
   below the sticky topbar, nagging until the manager taps Refrescar. */
.v2-update-banner {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 14px;
  flex-wrap: wrap;
  padding: 10px 16px;
  background: #ffe08a;
  color: #1a1300;
  border-bottom: 2px solid #000;
  font-weight: 700;
  font-size: 14px;
  text-align: center;
}
.v2-update-banner__text { line-height: 1.3; }
.v2-update-banner__btn {
  appearance: none;
  cursor: pointer;
  border: 2px solid #000;
  background: #000;
  color: #fff;
  font-weight: 800;
  padding: 7px 16px;
  border-radius: 8px;
  white-space: nowrap;
}
.v2-update-banner__btn:hover { background: #fff; color: #000; }

/* Manager announcement — red broadcast banner (dismissible). Bold RED text. */
.v2-announce-banner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 10px 16px;
  background: #fff5f5;
  border-bottom: 2px solid #d00000;
}
.v2-announce-banner__body { display: flex; align-items: baseline; gap: 8px; flex-wrap: wrap; }
.v2-announce-banner__icon { font-size: 16px; }
.v2-announce-banner__text { color: #d00000; font-weight: 800; font-size: 15px; line-height: 1.35; }
.v2-announce-banner__by { color: #a33; font-size: 12px; font-weight: 600; }
.v2-announce-banner__close {
  appearance: none; cursor: pointer; flex-shrink: 0;
  border: 2px solid #d00000; background: #fff; color: #d00000;
  font-weight: 800; width: 28px; height: 28px; border-radius: 8px; line-height: 1;
}
.v2-announce-banner__close:hover { background: #d00000; color: #fff; }
/* Ajustes announcement editor */
.ajustes__announce-input { width: 100%; resize: vertical; font: inherit; padding: 8px 10px; border: 1px solid #ccc; border-radius: 8px; margin: 6px 0; box-sizing: border-box; }
.ajustes__announce-active { color: #d00000; font-weight: 700; }
/* Terminales activas list */
.ajustes__terminals { display: flex; flex-direction: column; gap: 6px; margin-top: 8px; }
.ajustes__terminal-row {
  display: flex; align-items: center; justify-content: space-between; gap: 12px; flex-wrap: wrap;
  padding: 8px 10px; border: 1px solid #eee; border-radius: 8px;
}
.ajustes__terminal-main { display: flex; align-items: baseline; gap: 8px; flex-wrap: wrap; }
.ajustes__terminal-app { font-weight: 800; font-size: 11px; text-transform: uppercase; letter-spacing: 0.05em; background: #000; color: #fff; padding: 2px 6px; border-radius: 5px; }
.ajustes__terminal-who { font-weight: 700; }
.ajustes__terminal-id { color: #666; font-size: 12px; }
.ajustes__terminal-meta { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
.ajustes__terminal-ver { font-family: ui-monospace, monospace; font-size: 12px; color: #333; }
.ajustes__terminal-ver.is-stale { color: #d00000; font-weight: 700; }
.ajustes__terminal-stale { color: #d00000; font-weight: 800; font-size: 11px; text-transform: uppercase; }
.ajustes__terminal-seen { color: #888; font-size: 11px; }

.v2-topbar {
  position: sticky;
  top: 0;
  z-index: 15;
  display: flex;
  align-items: center;
  gap: 0;
  padding: 0;
  background: #fff;
  border-bottom: 1px solid #000;
}

.v2-topbar__brand {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 14px 20px;
  border-right: 1px solid #000;
  flex-shrink: 0;
  /* button reset — the brand is now a <button> so the cashier can click
     it to reload the current tab without switching away. */
  background: #fff;
  border-top: 0;
  border-left: 0;
  border-bottom: 0;
  border-radius: 0;
  font: inherit;
  color: inherit;
  cursor: pointer;
  transition: background 80ms;
}
.v2-topbar__brand:hover { background: #f0f0f0; }
.v2-topbar__brand-name {
  font-size: 14px;
  font-weight: 700;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: #000;
}
.v2-topbar__brand-badge {
  display: inline-block;
  padding: 2px 6px;
  background: #000;
  color: #fff;
  font-size: 10px;
  font-weight: 700;
  letter-spacing: 0.12em;
  text-transform: uppercase;
}
.v2-topbar__version {
  color: #666;
  font-size: 10px;
  font-variant-numeric: tabular-nums;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  padding: 14px 16px;
  border-right: 1px solid #000;
  flex-shrink: 0;
  /* Fixed width so a longer version string never reflows the nav. */
  width: 280px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.v2-topbar__nav {
  display: flex;
  margin-left: 0;
  flex: 1;
}
.v2-topbar__nav button {
  background: transparent;
  border: 0;
  border-right: 1px solid #000;
  border-radius: 0;
  padding: 14px 20px;
  color: #000;
  font-weight: 500;
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: 0.12em;
  transition: background 80ms;
  flex: 1;
  text-align: center;
}
.v2-topbar__nav button:hover { background: #f0f0f0; }
.v2-topbar__nav button[aria-current="page"] {
  background: #000;
  color: #fff;
}

.v2-topbar__weather {
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 8px 14px;
  /* No border-left: the last nav button already draws a border-right here,
     and two adjacent 1px rules render as one doubled/bolder line. The
     divider to the RIGHT comes from .v2-topbar__cashier's own border-left. */
  margin-left: auto;
  white-space: nowrap;
  line-height: 1;
}
/* When the weather chip is present it owns the auto margin, so the cashier
   block must not also push away from it. */
.v2-topbar__weather + .v2-topbar__cashier { margin-left: 0; }
.v2-topbar__weather-icon { font-size: 18px; }
.v2-topbar__weather-temp {
  font-size: 15px;
  font-weight: 700;
  letter-spacing: -0.01em;
}

.v2-topbar__cashier {
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  justify-content: center;
  gap: 2px;
  padding: 8px 16px;
  border-left: 1px solid #000;
  margin-left: auto;
  /* Locked width — the slot stays the same size regardless of whether
     the actor has loaded and regardless of how long the display name is.
     flex-shrink: 0 means tight containers won't compress it either. */
  width: 200px;
  min-height: 48px;
  flex-shrink: 0;
  overflow: hidden;
}
.v2-topbar__cashier-label,
.v2-topbar__cashier-name {
  max-width: 100%;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.v2-topbar__cashier-label {
  font-size: 9px;
  color: #666;
  text-transform: uppercase;
  letter-spacing: 0.14em;
  font-weight: 500;
}
.v2-topbar__cashier-name {
  font-weight: 700;
  font-size: 11px;
  color: #000;
  text-transform: uppercase;
  letter-spacing: 0.08em;
}

.v2-topbar__signout,
.v2-topbar__refresh {
  background: #fff;
  border: 0;
  border-left: 1px solid #000;
  border-radius: 0;
  padding: 14px 20px;
  font-size: 11px;
  font-weight: 500;
  color: #000;
  text-transform: uppercase;
  letter-spacing: 0.12em;
  cursor: pointer;
  flex-shrink: 0;
}
.v2-topbar__signout:hover,
.v2-topbar__refresh:hover { background: #000; color: #fff; }
.v2-topbar__refresh {
  font-size: 16px;
  letter-spacing: 0;
  padding: 14px 16px;
  width: 56px;
}
.v2-topbar__signout { width: 100px; }

.v2-main {
  flex: 1;
  padding: 0;
  display: flex;
  flex-direction: column;
  gap: 0;
  max-width: none;
  width: 100%;
  margin: 0;
}
.v2-main > * + * { border-top: 1px solid #000; }

/* =======================  LOGIN  ========================================= */

.v2-login {
  max-width: 420px;
  margin: 120px auto;
  background: #fff;
  border: 1px solid #000;
  border-radius: 0;
  padding: 40px;
}
.v2-login h1 {
  margin: 0 0 6px;
  font-size: 24px;
  text-transform: uppercase;
  letter-spacing: 0.04em;
}
.v2-login p { margin: 0 0 28px; color: #666; font-size: 12px; letter-spacing: 0.02em; }
.v2-login label {
  display: block;
  font-size: 10px;
  font-weight: 700;
  color: #000;
  text-transform: uppercase;
  letter-spacing: 0.12em;
  margin: 16px 0 6px;
}
.v2-login input { padding: 11px 12px; font-size: 13px; border: 1px solid #000; }
.v2-login button[type="submit"] {
  margin-top: 24px;
  width: 100%;
  padding: 14px;
  border: 1px solid #000;
  border-radius: 0;
  background: #000;
  color: #fff;
  font-weight: 700;
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: 0.16em;
  transition: background 80ms, color 80ms;
}
.v2-login button[type="submit"]:hover { background: #fff; color: #000; }
.v2-login button[type="submit"]:disabled { opacity: 0.4; cursor: wait; }
.v2-login__error {
  margin-top: 14px;
  padding: 10px 12px;
  border: 1px solid #d00000;
  background: #fff;
  color: #d00000;
  font-size: 11px;
  font-weight: 500;
  text-transform: uppercase;
  letter-spacing: 0.04em;
}

/* =======================  WARNINGS / BOOT  =============================== */

.v2-warning {
  background: #fff;
  border: 1px solid #000;
  color: #000;
  padding: 14px 20px;
  display: flex;
  align-items: flex-start;
  gap: 12px;
}
.v2-warning__icon { font-size: 14px; line-height: 1.3; color: #000; font-weight: 700; }
.v2-warning__title {
  font-weight: 700;
  font-size: 11px;
  margin-bottom: 2px;
  text-transform: uppercase;
  letter-spacing: 0.08em;
}
.v2-warning__body { font-size: 12px; line-height: 1.5; letter-spacing: 0.01em; }

.v2-boot-error {
  max-width: 640px;
  margin: 60px auto;
  padding: 24px;
  border: 1px solid #d00000;
  background: #fff;
  color: #d00000;
  font-size: 13px;
  font-weight: 500;
  text-transform: uppercase;
  letter-spacing: 0.04em;
}

.v2-loading {
  text-align: center;
  padding: 64px;
  color: #666;
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: 0.12em;
  font-weight: 500;
}

/* =======================  SHARED BUTTONS  ================================ */

.sale-btn {
  appearance: none;
  border: 1px solid #000;
  padding: 10px 16px;
  border-radius: 0;
  font-weight: 700;
  font-size: 11px;
  background: #fff;
  color: #000;
  transition: background 80ms, color 80ms;
  white-space: nowrap;
  text-transform: uppercase;
  letter-spacing: 0.1em;
}
.sale-btn:focus-visible { outline: 2px solid #000; outline-offset: 1px; }
.sale-btn:disabled { opacity: 0.35; cursor: not-allowed; }
.sale-btn:hover:not(:disabled) { background: #000; color: #fff; }

.sale-btn--primary {
  background: #000;
  color: #fff;
  border-color: #000;
}
.sale-btn--primary:hover:not(:disabled) { background: #fff; color: #000; }

.sale-btn--accent {
  background: #000;
  color: #fff;
  border-color: #000;
}
.sale-btn--accent:hover:not(:disabled) { background: #fff; color: #000; }

.sale-btn--ghost { background: #fff; color: #000; }

.sale-btn--danger {
  background: #fff;
  color: #d00000;
  border-color: #d00000;
}
.sale-btn--danger:hover:not(:disabled) { background: #d00000; color: #fff; }

.sale-btn--sm { padding: 6px 10px; font-size: 10px; letter-spacing: 0.08em; }
.sale-btn--lg {
  padding: 16px 24px;
  font-size: 13px;
  width: 100%;
  font-weight: 700;
  letter-spacing: 0.18em;
}

/* =======================  SALE SCREEN  =================================== */

.sale { display: flex; flex-direction: column; gap: 0; padding-bottom: 120px; }
.sale > * + * { border-top: 1px solid #000; }

.sale-banner {
  display: flex;
  gap: 0;
  align-items: stretch;
  flex-wrap: wrap;
  border: 0;
  border-radius: 0;
  padding: 0;
  background: #fff;
}
.sale-banner--warn {
  background: #fff;
  display: block;
  padding: 14px 20px;
}
.sale-banner__col {
  display: flex;
  flex-direction: column;
  gap: 3px;
  padding: 14px 20px;
  border-right: 1px solid #000;
}
.sale-banner__col:last-child { border-right: 0; }
.sale-banner__col--grow { flex: 1; }
.sale-banner__label {
  font-size: 9px;
  color: #666;
  text-transform: uppercase;
  letter-spacing: 0.14em;
  font-weight: 500;
}
.sale-banner__value {
  font-weight: 700;
  font-variant-numeric: tabular-nums;
  font-size: 13px;
  color: #000;
  text-transform: uppercase;
  letter-spacing: 0.04em;
}
.sale-banner__title { font-weight: 700; font-size: 13px; text-transform: uppercase; letter-spacing: 0.08em; }
.sale-banner__body { font-size: 12px; margin-top: 4px; line-height: 1.5; }

.sale-notice {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  padding: 12px 20px;
  border: 0;
  background: #fff;
  font-weight: 500;
  font-size: 12px;
  border-bottom: 1px solid #000;
  text-transform: uppercase;
  letter-spacing: 0.04em;
}
.sale-notice--ok    { background: #fff; color: #000; }
.sale-notice--warn  { background: #fff; color: #000; }
.sale-notice--error { background: #fff; color: #d00000; }
.sale-notice--error::before { content: "◆"; margin-right: 8px; }
.sale-notice__close {
  background: transparent;
  border: 0;
  color: inherit;
  opacity: 0.6;
  font-size: 14px;
  line-height: 1;
  padding: 0 4px;
  font-weight: 700;
}
.sale-notice__close:hover { opacity: 1; }

.sale-grid {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 360px;
  gap: 0;
  align-items: stretch;
}
@media (max-width: 1100px) { .sale-grid { grid-template-columns: 1fr; } }

.sale-panel {
  background: #fff;
  border: 0;
  border-right: 1px solid #000;
  border-radius: 0;
  padding: 20px 24px;
  display: flex;
  flex-direction: column;
  gap: 20px;
}
.sale-panel--right {
  border-right: 0;
  border-left: 1px solid #000;
}
@media (max-width: 1100px) {
  .sale-panel { border-right: 0; }
  .sale-panel--right { border-left: 0; border-top: 1px solid #000; }
}

/* Floating SKU code entry — anchored bottom-right, always reachable.
   Modeled on v1's versa-sku-pad-mirror-shell but restyled for the
   brutalist monochrome language. */
.sale-code-float {
  position: fixed;
  right: 20px;
  bottom: calc(20px + env(safe-area-inset-bottom, 0px));
  z-index: 30;
  width: 240px;
  background: #fff;
  border: 1px solid #000;
  padding: 10px 12px 12px;
  display: flex;
  flex-direction: column;
  gap: 8px;
  box-shadow: -2px -2px 0 #000, 4px 4px 0 rgba(0, 0, 0, 0.06);
}
.sale-code-float__label {
  font-size: 9px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.16em;
  color: #000;
}
.sale-code-float__row {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 46px;
  gap: 0;
  align-items: stretch;
}
.sale-code-input {
  height: 46px;
  border-radius: 0;
  background: #fff;
  font-size: 22px;
  font-weight: 700;
  text-align: center;
  font-variant-numeric: tabular-nums;
  padding: 4px 10px;
  border: 1px solid #000;
  border-right: 0;
  letter-spacing: 0.1em;
  min-width: 0;
}
.sale-code-input::placeholder {
  color: #ccc;
  font-weight: 500;
  letter-spacing: 0.2em;
}
.sale-code-input:focus {
  outline: 2px solid #000;
  outline-offset: -2px;
}
.sale-code-float__submit {
  height: 46px;
  border: 1px solid #000;
  background: #000;
  color: #fff;
  font-size: 18px;
  font-weight: 700;
  line-height: 1;
  padding: 0;
  border-radius: 0;
  transition: background 80ms, color 80ms;
}
.sale-code-float__submit:hover { background: #fff; color: #000; }
.sale-code-float__submit:focus-visible {
  outline: 2px solid #000;
  outline-offset: -2px;
}

/* On narrow screens drop the float to a full-width strip at the bottom so
   it doesn't cover anything important. */
@media (max-width: 720px) {
  .sale-code-float {
    right: 0;
    bottom: 0;
    width: 100%;
    border-left: 0;
    border-right: 0;
    border-bottom: 0;
    box-shadow: none;
    padding: 8px 12px 12px;
  }
}

/* Lines table */
.sale-lines { display: flex; flex-direction: column; gap: 10px; }
.sale-lines__header {
  display: flex;
  align-items: center;
  gap: 12px;
  justify-content: space-between;
}
.sale-lines__title {
  font-size: 11px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.14em;
  color: #000;
}
.sale-lines__badge {
  font-size: 10px;
  font-weight: 500;
  padding: 2px 8px;
  border: 1px solid #000;
  background: #fff;
  color: #000;
  text-transform: uppercase;
  letter-spacing: 0.08em;
}
.sale-lines__table {
  overflow: hidden;
  border: 1px solid #000;
  border-radius: 0;
  background: #fff;
}
.sale-lines__row {
  display: grid;
  grid-template-columns: minmax(220px, 2fr) minmax(160px, 1.4fr) 120px 140px 36px;
  gap: 14px;
  padding: 14px 16px;
  align-items: center;
  border-top: 1px solid #000;
}
.sale-lines__row:first-child { border-top: 0; }
.sale-lines__row--head {
  background: #000;
  color: #fff;
  font-size: 10px;
  font-weight: 700;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  padding: 10px 16px;
}
.sale-lines__row--head > div { color: #fff; }
.sale-lines__row--placeholder { color: #999; }
.sale-lines__row:hover:not(.sale-lines__row--head):not(.sale-lines__row--placeholder) {
  background: #fafafa;
}
.col-total {
  text-align: right;
  font-weight: 700;
  font-size: 18px;
  font-variant-numeric: tabular-nums;
  color: #000;
  letter-spacing: -0.01em;
}
.col-actions { display: flex; justify-content: flex-end; }

.sku-code {
  display: inline-block;
  margin-bottom: 4px;
  padding: 1px 6px;
  border: 1px solid #000;
  color: #000;
  font-size: 10px;
  font-weight: 500;
  letter-spacing: 0.1em;
  text-transform: uppercase;
}
.sku-name {
  font-size: 14px;
  font-weight: 700;
  color: #000;
  text-transform: uppercase;
  letter-spacing: 0.02em;
}
.sku-product { font-size: 11px; color: #666; margin-top: 1px; letter-spacing: 0.02em; }

.qty-pair { display: flex; align-items: center; gap: 6px; flex-wrap: wrap; }
.qty-input {
  width: 76px;
  padding: 8px 10px;
  border: 1px solid #000;
  border-radius: 0;
  background: #fff;
  font-variant-numeric: tabular-nums;
  text-align: right;
  font-weight: 500;
  font-size: 13px;
}
.qty-input:focus { outline: 2px solid #000; outline-offset: -1px; }
.qty-input--price { width: 100%; font-weight: 700; font-size: 15px; }
.qty-sub {
  font-size: 10px;
  color: #666;
  font-weight: 500;
  text-transform: uppercase;
  letter-spacing: 0.08em;
}

.sale-line-remove {
  background: #fff;
  border: 1px solid #000;
  color: #000;
  font-size: 14px;
  line-height: 1;
  width: 32px;
  height: 32px;
  border-radius: 0;
  padding: 0;
  font-weight: 700;
}
.sale-line-remove:hover { background: #000; color: #fff; }

.sale-line-discount {
  background: #fff;
  border: 1px solid #000;
  color: #000;
  font-size: 12px;
  line-height: 1;
  width: 32px;
  height: 32px;
  border-radius: 0;
  padding: 0;
  font-weight: 700;
  margin-right: 4px;
}
.sale-line-discount:hover { background: #000; color: #fff; }
.sale-line-discount--active { background: #000; color: #fff; }
.sale-line-discount--active:hover { background: #fff; color: #000; }
.col-actions { display: flex; align-items: center; justify-content: flex-end; }

/* Totals panel */
.sale-totals {
  display: flex;
  flex-direction: column;
  gap: 6px;
  padding-bottom: 18px;
  border-bottom: 1px solid #000;
}
.sale-totals__row {
  display: flex;
  justify-content: space-between;
  font-size: 11px;
  color: #666;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  font-weight: 500;
}
.sale-totals__value {
  font-variant-numeric: tabular-nums;
  color: #000;
  font-weight: 700;
  letter-spacing: 0.02em;
}
.sale-totals__divider { display: none; }
.sale-totals__grand {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  padding: 12px 0 0;
}
.sale-totals__grand-label {
  font-size: 10px;
  text-transform: uppercase;
  letter-spacing: 0.18em;
  color: #000;
  font-weight: 700;
  margin-bottom: 4px;
}
.sale-totals__grand-value {
  font-size: 56px;
  line-height: 0.92;
  font-weight: 700;
  font-variant-numeric: tabular-nums;
  color: #000;
  letter-spacing: -0.04em;
  align-self: flex-end;
}

/* Payment picker */
.sale-payment-picker { display: flex; flex-direction: column; gap: 8px; }
.sale-payment-picker__label {
  font-size: 10px;
  text-transform: uppercase;
  letter-spacing: 0.14em;
  color: #000;
  font-weight: 700;
}
.sale-payment-picker__buttons {
  /* 2x2 grid mirroring the cobrar modal: top row [Efectivo | Pendiente],
     bottom row [Credito | Transferencia]. Internal lines via per-cell
     borders, dropped on the right column and bottom row. */
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 0;
  border: 1px solid #000;
}
.sale-payment-btn {
  padding: 14px 8px;
  border: 0;
  border-right: 1px solid #000;
  border-bottom: 1px solid #000;
  border-radius: 0;
  background: #fff;
  color: #000;
  font-weight: 600;
  font-size: 12px;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  cursor: pointer;
  transition: background 80ms, color 80ms;
}
.sale-payment-btn:nth-child(2n) { border-right: 0; }
.sale-payment-btn:nth-last-child(-n+2) { border-bottom: 0; }
.sale-payment-btn:hover:not(.is-active) { background: #f4f4f4; }
.sale-payment-btn.is-active {
  background: #000;
  color: #fff;
}

/* Customer field */
.sale-customer { display: flex; flex-direction: column; gap: 6px; }
.sale-customer__label {
  font-size: 10px;
  text-transform: uppercase;
  letter-spacing: 0.14em;
  color: #000;
  font-weight: 700;
}
.sale-customer__picker { position: relative; }
.sale-customer__trigger {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  width: 100%;
  padding: 10px 12px;
  font-size: 13px;
  border: 1px solid #000;
  background: #fff;
  color: #000;
  font-weight: 700;
  cursor: pointer;
  text-align: left;
  border-radius: 0;
}
.sale-customer__trigger:hover { background: #000; color: #fff; }
.sale-customer__trigger.is-placeholder { font-weight: 500; color: #666; }
.sale-customer__trigger.is-placeholder:hover { color: #fff; }
.sale-customer__trigger-name {
  flex: 1;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.sale-customer__trigger-chevron { font-size: 10px; flex-shrink: 0; }
.sale-customer__backdrop {
  position: fixed;
  inset: 0;
  z-index: 39;
  background: transparent;
}
.sale-customer__dropdown {
  position: absolute;
  left: 0;
  right: 0;
  top: 100%;
  z-index: 40;
  background: #fff;
  border: 1px solid #000;
  border-top: 0;
  display: flex;
  flex-direction: column;
  max-height: 380px;
}
.sale-customer__search {
  padding: 10px 12px;
  font-size: 13px;
  border: 0;
  border-bottom: 1px solid #000;
  background: #fff;
  outline: none;
  width: 100%;
}
.sale-customer__options {
  overflow-y: auto;
  max-height: 320px;
  display: flex;
  flex-direction: column;
}
.sale-customer__option {
  display: block;
  width: 100%;
  text-align: left;
  padding: 10px 12px;
  border: 0;
  border-bottom: 1px solid #000;
  background: #fff;
  color: #000;
  cursor: pointer;
  border-radius: 0;
}
.sale-customer__option:last-child { border-bottom: 0; }
.sale-customer__option:hover { background: #000; color: #fff; }
.sale-customer__option.is-selected { background: #fff5d9; }
.sale-customer__option.is-selected:hover { background: #000; color: #fff; }
.sale-customer__option--create { background: #fff5d9; }
.sale-customer__option--create .sale-customer__option-name { color: #8a5a00; font-weight: 700; }
.sale-customer__option--create:hover { background: #000; color: #fff; }
.sale-customer__option--create:hover .sale-customer__option-name { color: #fff; }
.sale-customer__option--create:hover .sale-customer__option-meta { color: #bbb; }
.sale-customer__option-name {
  display: block;
  font-weight: 700;
  font-size: 13px;
}
.sale-customer__option-meta {
  display: block;
  color: #666;
  font-size: 11px;
  margin-top: 2px;
}
.sale-customer__option:hover .sale-customer__option-meta { color: #bbb; }
.sale-customer__empty {
  padding: 16px 12px;
  color: #666;
  font-size: 12px;
  text-align: center;
}

.fiscal-form__profile-row { display: flex; align-items: flex-end; gap: 6px; flex-wrap: wrap; }
.fiscal-form__profile-row > .modal__field { flex: 1; min-width: 260px; }
.fiscal-form__new-profile,
.fiscal-form__edit-profile,
.fiscal-form__delete-profile { white-space: nowrap; padding: 10px 12px; }
.fiscal-form__delete-profile:hover { background: #8a1f1f; color: #fff; border-color: #8a1f1f; }
.fiscal-form__delete-confirm { display: flex; gap: 4px; align-items: center; }
.fiscal-form__delete-confirm-btn { background: #8a1f1f; color: #fff; border-color: #8a1f1f; }
.fiscal-form__delete-confirm-btn:hover:not(:disabled) { background: #fff; color: #8a1f1f; }
.modal--new-profile { width: min(720px, 100%); }
.modal--cancel-cfdi { width: min(680px, 100%); }
.modal__field--full { grid-column: 1 / -1; }
.fiscal-doc__cancel-btn:hover { background: #8a1f1f; color: #fff; border-color: #8a1f1f; }

.sale-actions { display: flex; gap: 6px; margin-top: auto; align-items: stretch; }
/* Cobrar takes the room — Reimprimir hugs its content. Was 50/50; the
   Reimprimir label "Reimprimir #00123 (F2)" was so long it pushed the
   right pane outside the viewport on smaller screens. */
.sale-actions .sale-btn { flex: 0 0 auto; }
.sale-actions .sale-btn--primary { flex: 1 1 auto; }
.sale-actions .sale-btn--ghost { font-size: 11px; padding: 8px 10px; white-space: nowrap; }

/* =======================  CHECKOUT MODAL  ================================ */

.modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.6);
  display: flex;
  justify-content: center;
  align-items: flex-start;
  padding: 48px 16px;
  z-index: 50;
}
/* The 80ms fade-in was re-firing on every render pass (the whole .modal-overlay
   element is re-created by replaceChildren on each state change), so every
   keystroke inside an open modal flashed the overlay from opacity:0→1. Killed
   the animation; the modal simply appears. */
.modal {
  background: #fff;
  border-radius: 0;
  box-shadow: none;
  width: min(680px, 100%);
  max-height: calc(100vh - 96px);
  overflow: auto;
  display: flex;
  flex-direction: column;
  border: 1px solid #000;
}

.modal__header {
  display: flex;
  align-items: center;
  gap: 14px;
  padding: 18px 24px;
  border-bottom: 1px solid #000;
}
.modal__title {
  font-size: 14px;
  margin: 0;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.12em;
}
.modal__total { margin-left: auto; display: flex; flex-direction: column; align-items: flex-end; }
.modal__total-label {
  font-size: 9px;
  color: #666;
  text-transform: uppercase;
  letter-spacing: 0.14em;
  font-weight: 500;
}
.modal__total-value {
  font-size: 28px;
  font-weight: 700;
  color: #000;
  font-variant-numeric: tabular-nums;
  letter-spacing: -0.03em;
}
.modal__close {
  background: #fff;
  border: 1px solid #000;
  font-size: 16px;
  line-height: 1;
  color: #000;
  padding: 4px 10px;
  border-radius: 0;
  font-weight: 700;
}
.modal__close:hover { background: #000; color: #fff; }

.modal__body { padding: 20px 24px; display: flex; flex-direction: column; gap: 16px; }

.modal__tabs {
  /* 2x2 grid with proper internal lines so each payment method reads as a
     distinct cell rather than a flat strip. Works for the 4-option set
     (Contado / Credito / Transferencia / Pendiente). If a 5th option ever
     gets added, fall back to flex-wrap or bump to 3 columns. */
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 0;
  border: 1px solid #000;
  cursor: default;
}
.modal__tab {
  padding: 14px 10px;
  background: #fff;
  border: 0;
  border-right: 1px solid #000;
  border-bottom: 1px solid #000;
  border-radius: 0;
  font-weight: 600;
  color: #000;
  font-size: 12px;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  cursor: pointer;
  transition: background 80ms ease;
}
.modal__tab:hover:not(.is-active) { background: #f4f4f4; }
.modal__tab:nth-child(2n) { border-right: 0; }
/* Drop the bottom border on the bottom row (any tab in the last 2 of the
   list — covers the 4-option case, and stays correct if N is even). */
.modal__tab:nth-last-child(-n+2) { border-bottom: 0; }
.modal__tab.is-active { background: #000; color: #fff; }

.modal__section { display: flex; flex-direction: column; gap: 14px; }
.modal__grid { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.modal__field { display: flex; flex-direction: column; gap: 4px; }
.modal__label {
  font-size: 10px;
  text-transform: uppercase;
  letter-spacing: 0.14em;
  color: #000;
  font-weight: 700;
}
.modal__input {
  padding: 10px 12px;
  font-size: 13px;
  border: 1px solid #000;
  border-radius: 0;
  background: #fff;
  font-variant-numeric: tabular-nums;
}
.modal__input--lg {
  font-size: 24px;
  font-weight: 700;
  padding: 16px 18px;
  text-align: right;
  letter-spacing: -0.02em;
}

.modal__tender-picker {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 0;
  border: 1px solid #000;
}
.modal__tender-btn {
  padding: 10px;
  border: 0;
  border-right: 1px solid #000;
  border-radius: 0;
  background: #fff;
  color: #000;
  font-weight: 500;
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: 0.1em;
}
.modal__tender-btn:last-child { border-right: 0; }
.modal__tender-btn.is-active { background: #000; color: #fff; }

.modal__shortcuts {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 0;
  margin-top: 6px;
  border: 1px solid #000;
}
.modal__shortcut {
  padding: 10px 8px;
  border: 0;
  border-right: 1px solid #000;
  border-radius: 0;
  background: #fff;
  text-align: center;
  transition: background 80ms, color 80ms;
}
.modal__shortcut:last-child { border-right: 0; }
.modal__shortcut:hover { background: #000; color: #fff; }
.modal__shortcut:hover .modal__shortcut-label,
.modal__shortcut:hover .modal__shortcut-value { color: #fff; }
.modal__shortcut-label {
  font-size: 9px;
  color: #666;
  font-weight: 500;
  text-transform: uppercase;
  letter-spacing: 0.12em;
}
.modal__shortcut-value {
  font-weight: 700;
  font-variant-numeric: tabular-nums;
  font-size: 13px;
  margin-top: 2px;
  color: #000;
  letter-spacing: -0.01em;
}

.modal__summary {
  border: 1px solid #000;
  padding: 12px 16px;
  display: flex;
  flex-direction: column;
  gap: 4px;
  background: #fff;
}
.modal__summary-row {
  display: flex;
  justify-content: space-between;
  font-variant-numeric: tabular-nums;
  font-size: 12px;
  color: #000;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  font-weight: 500;
}
.modal__summary-row.is-warn { color: #d00000; font-weight: 700; }
.modal__summary-value { font-weight: 700; color: #000; letter-spacing: 0; }

.modal__help {
  font-size: 11px;
  color: #000;
  background: #f0f0f0;
  padding: 12px 14px;
  border-radius: 0;
  margin: 0;
  line-height: 1.5;
  border-left: 2px solid #000;
}

.modal__error {
  border: 1px solid #d00000;
  background: #fff;
  color: #d00000;
  padding: 10px 12px;
  font-weight: 500;
  font-size: 12px;
  text-transform: uppercase;
  letter-spacing: 0.04em;
}

.modal__footer {
  display: flex;
  justify-content: flex-end;
  gap: 8px;
  padding: 14px 24px;
  border-top: 1px solid #000;
  background: #fff;
  border-bottom-left-radius: 0;
  border-bottom-right-radius: 0;
}

/* =======================  CAPTURE MODAL  ================================= */

.modal--capture { width: min(640px, 100%); }
.capture__header { gap: 16px; align-items: flex-start; padding: 18px 24px; }
.capture__eyebrow {
  font-size: 9px;
  color: #666;
  font-weight: 500;
  letter-spacing: 0.16em;
  text-transform: uppercase;
  margin-bottom: 4px;
}
.capture__product { font-size: 11px; color: #666; margin-top: 2px; letter-spacing: 0.04em; text-transform: uppercase; }
.capture__pill {
  margin-left: auto;
  align-self: center;
  padding: 8px 14px;
  border: 1px solid #000;
  background: #000;
  color: #fff;
  font-weight: 700;
  font-size: 11px;
  letter-spacing: 0.1em;
  font-variant-numeric: tabular-nums;
  text-transform: uppercase;
}

.capture__body { padding: 20px 24px; gap: 14px; }

.capture__grid { display: grid; gap: 10px; }
.capture__grid--kg {
  grid-template-columns: 1fr 1fr;
  grid-template-areas: "weight price" "amount amount";
}
.capture__grid--box {
  grid-template-columns: 1fr 1fr 1fr;
  grid-template-areas: "boxes weight price" "amount amount amount";
}
.capture__grid--box > label:nth-of-type(1) { grid-area: boxes; }
.capture__grid--box > label:nth-of-type(2) { grid-area: weight; }
.capture__grid--box > label:nth-of-type(3) { grid-area: price; }
.capture__grid--kg > label:nth-of-type(1)  { grid-area: weight; }
.capture__grid--kg > label:nth-of-type(2)  { grid-area: price; }

.capture__field { display: flex; flex-direction: column; gap: 4px; }
.capture__label {
  font-size: 10px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.14em;
  color: #000;
}
.capture__input {
  padding: 14px 16px;
  font-size: 24px;
  font-weight: 700;
  font-variant-numeric: tabular-nums;
  text-align: right;
  border: 1px solid #000;
  border-radius: 0;
  background: #fff;
  letter-spacing: -0.02em;
}
.capture__input:focus { outline: 2px solid #000; outline-offset: -1px; }
.capture__helper {
  font-size: 10px;
  color: #666;
  text-transform: uppercase;
  letter-spacing: 0.08em;
}

/* g/kg unit toggle shown in the helper slot for gram-precision SKUs.
   Button is small/inline so it doesn't visually compete with the
   primary "Importe" tile. */
.capture__unit-row {
  display: inline-flex; align-items: center; gap: 8px;
}
.capture__unit-toggle {
  border: 1px solid #000; background: #000; color: #fff;
  padding: 2px 8px; font-size: 10px; font-weight: 700;
  text-transform: uppercase; letter-spacing: 0.12em; cursor: pointer;
  border-radius: 2px;
}
.capture__unit-toggle.is-kg { background: #fff; color: #000; }
.capture__unit-toggle:hover { background: #333; color: #fff; }
.capture__unit-toggle.is-kg:hover { background: #f0f0f0; color: #000; }
.capture__unit-hint { font-size: 10px; color: #666; text-transform: none; letter-spacing: 0; }

.capture__amount {
  grid-area: amount;
  background: #000;
  border: 1px solid #000;
  border-radius: 0;
  padding: 14px 18px;
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  color: #fff;
}
.capture__amount-label {
  font-size: 10px;
  text-transform: uppercase;
  letter-spacing: 0.18em;
  color: #fff;
  font-weight: 700;
}
.capture__amount-value {
  font-size: 32px;
  font-weight: 700;
  color: #fff;
  font-variant-numeric: tabular-nums;
  letter-spacing: -0.03em;
}
.capture__hint {
  font-size: 10px;
  color: #666;
  text-align: center;
  padding: 4px 0 0;
  text-transform: uppercase;
  letter-spacing: 0.12em;
}

/* =======================  APERTURA  ====================================== */

.apertura { display: flex; justify-content: center; padding: 32px; background: #fff; }
.apertura__card {
  background: #fff;
  border: 1px solid #000;
  border-radius: 0;
  padding: 32px;
  width: min(620px, 100%);
  display: flex;
  flex-direction: column;
  gap: 18px;
}
.apertura__title { font-size: 20px; text-transform: uppercase; letter-spacing: 0.04em; }
.apertura__subtitle { margin: 2px 0 0; color: #666; font-size: 12px; line-height: 1.55; }
.apertura__form { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.apertura__field { display: flex; flex-direction: column; gap: 4px; }
.apertura__field--wide { grid-column: 1 / -1; }
.apertura__label {
  font-size: 10px;
  text-transform: uppercase;
  letter-spacing: 0.14em;
  color: #000;
  font-weight: 700;
}
.apertura__input, .apertura__textarea {
  padding: 10px 12px;
  font-size: 13px;
  border: 1px solid #000;
  border-radius: 0;
  background: #fff;
  font-variant-numeric: tabular-nums;
}
.apertura__input[disabled] { color: #666; background: #f0f0f0; }
.apertura__textarea { resize: vertical; font-family: inherit; min-height: 60px; }
.apertura__actions { display: flex; justify-content: space-between; gap: 10px; flex-wrap: wrap; }
.apertura__error {
  border: 1px solid #d00000;
  background: #fff;
  color: #d00000;
  padding: 10px 12px;
  font-weight: 500;
  font-size: 12px;
  text-transform: uppercase;
  letter-spacing: 0.04em;
}

/* =======================  CAJA TAB  ====================================== */

.cash { display: flex; flex-direction: column; gap: 0; }
.cash > * + * { border-top: 1px solid #000; }

.cash-header {
  display: flex;
  flex-wrap: wrap;
  gap: 0;
  align-items: stretch;
  background: #fff;
  border: 0;
  border-radius: 0;
  padding: 0;
}
.cash-header__left {
  display: flex;
  flex-direction: column;
  gap: 4px;
  padding: 18px 24px;
  border-right: 1px solid #000;
}
.cash-header__label {
  font-size: 9px;
  text-transform: uppercase;
  letter-spacing: 0.16em;
  color: #666;
  font-weight: 500;
}
.cash-header__folio {
  font-size: 28px;
  font-weight: 700;
  letter-spacing: -0.03em;
  color: #000;
  font-variant-numeric: tabular-nums;
}
.cash-header__meta { color: #666; font-size: 11px; text-transform: uppercase; letter-spacing: 0.06em; }
/* Live-monitor indicator: pulsing green dot + last-refresh time. */
.cash-header__live {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  margin-top: 4px;
  color: #0a7d2c;
  font-size: 11px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.06em;
}
.cash-header__live-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: #16a34a;
  box-shadow: 0 0 0 0 rgba(22, 163, 74, 0.6);
  animation: cash-live-pulse 2s infinite;
}
@keyframes cash-live-pulse {
  0%   { box-shadow: 0 0 0 0 rgba(22, 163, 74, 0.55); }
  70%  { box-shadow: 0 0 0 6px rgba(22, 163, 74, 0); }
  100% { box-shadow: 0 0 0 0 rgba(22, 163, 74, 0); }
}
@media (prefers-reduced-motion: reduce) { .cash-header__live-dot { animation: none; } }
.cash-header__metrics {
  display: flex;
  flex-wrap: nowrap;
  gap: 0;
  align-items: stretch;
  /* Auto-size to content so the action buttons can sit flush against
     the rightmost metric cell. Previously this had flex:1 which
     stretched the block to fill available width and left a visible
     gap between Efectivo Esperado and the buttons. */
  flex: 0 0 auto;
}
.cash-header__actions {
  display: flex;
  gap: 0;
  align-items: stretch;
  border-left: 1px solid #000;
  /* Stretch the actions block across whatever row space is left after
     metrics so no white gap appears at the right edge of the row.
     Imprimir PDF en blanco keeps its natural padding-based width;
     Corte Z (the last child, see rule below) flex-grows into the
     remaining space. */
  flex: 1;
}
/* Employee mode: there's no metrics block, so flex:1 + lg button would
   blow up Corte Z to fill the entire row. Instead let both buttons
   size to content and push the pair to the right edge of the row. */
.cash-header__actions--compact {
  flex: 0 0 auto;
  margin-left: auto;
}
/* Make Corte Z noticeably larger for employees — it's the screen's main
   action and they have nothing else competing for visual weight in the
   header. Bigger padding + larger label so it stands out. */
.cash-header__actions--compact .sale-btn--primary {
  flex: 0 0 auto;
  padding: 22px 36px;
  font-size: 18px;
  letter-spacing: 0.06em;
}
.cash-header__actions .sale-btn {
  border: 0;
  border-left: 1px solid #000;
  /* Tightened horizontal padding so labels like "Imprimir PDF en
     blanco" fit inside the cell without spilling over. Same font
     size; the text just has less inset on each side. */
  padding: 14px 12px;
  height: auto;
  min-width: 0;
  text-align: center;
  white-space: nowrap;
}
.cash-header__actions .sale-btn:first-child { border-left: 0; }
/* sale-btn--lg ships with width: 100% (intended for stacked modal
   actions). Inside the flex .cash-header__actions row that caused an
   overlap with the sibling on its left. Lock width to auto so the
   button sizes to its label, then flex-grow within the actions row
   so it stretches to fill the remaining width — no blank space at
   the right edge of the bar. */
.cash-header__actions .sale-btn--lg {
  width: auto;
  padding: 16px 24px;
  flex: 1;
}

.cash-metric {
  display: flex;
  flex-direction: column;
  gap: 3px;
  padding: 18px 20px;
  border-right: 1px solid #000;
  min-width: 140px;
}
.cash-metric:last-child { border-right: 0; }
.cash-metric__label {
  font-size: 9px;
  text-transform: uppercase;
  letter-spacing: 0.16em;
  color: #666;
  font-weight: 500;
}
.cash-metric__value {
  font-weight: 700;
  font-variant-numeric: tabular-nums;
  font-size: 18px;
  color: #000;
  letter-spacing: -0.01em;
}
.cash-metric.is-accent { background: #000; color: #fff; }
.cash-metric.is-accent .cash-metric__label { color: #fff; }
.cash-metric.is-accent .cash-metric__value { color: #fff; font-size: 22px; }

.cash-grid {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(0, 1fr);
  gap: 0;
  align-items: stretch;
}
@media (max-width: 1100px) { .cash-grid { grid-template-columns: 1fr; } }

/* Employee Caja layout: only one column (Retiros + Abonos), so center it
   in the page rather than letting it stretch full-width or stick to the
   left. ~640px is comfortable for the form fields. */
.cash-grid--employee {
  grid-template-columns: minmax(0, 640px);
  justify-content: center;
}
.cash-col {
  display: flex;
  flex-direction: column;
  gap: 0;
  border-right: 1px solid #000;
}
.cash-col > * + * { border-top: 1px solid #000; }
.cash-col:last-child { border-right: 0; }
@media (max-width: 1100px) {
  .cash-col { border-right: 0; border-bottom: 1px solid #000; }
  .cash-col:last-child { border-bottom: 0; }
}

.cash-panel {
  background: #fff;
  border: 0;
  border-radius: 0;
  overflow: visible;
}
.cash-panel__header {
  padding: 12px 20px;
  border-bottom: 1px solid #000;
  background: #fff;
}
.cash-panel__header h3 {
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: 0.16em;
  color: #000;
  font-weight: 700;
}
.cash-panel__body { padding: 20px; display: flex; flex-direction: column; gap: 16px; }

/* Arqueo */
.cash-arqueo { display: flex; flex-direction: column; gap: 6px; }
.cash-arqueo__row {
  display: flex;
  justify-content: space-between;
  font-variant-numeric: tabular-nums;
  color: #000;
  font-size: 12px;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  font-weight: 500;
}
.cash-arqueo__value { font-weight: 700; color: #000; letter-spacing: 0; }
.cash-arqueo__divider { height: 1px; background: #000; margin: 6px 0; }
.cash-arqueo__grand { display: flex; justify-content: space-between; align-items: baseline; padding-top: 6px; border-top: 1px solid #000; margin-top: 6px; }
.cash-arqueo__grand > span:first-child {
  font-size: 10px;
  text-transform: uppercase;
  letter-spacing: 0.16em;
  color: #000;
  font-weight: 700;
}
.cash-arqueo__grand-value {
  font-size: 32px;
  font-weight: 700;
  font-variant-numeric: tabular-nums;
  color: #000;
  letter-spacing: -0.03em;
}
.cash-arqueo__note {
  margin-top: 8px;
  font-size: 11px;
  color: #666;
  padding: 10px 12px;
  border-left: 2px solid #000;
  background: #f0f0f0;
  line-height: 1.55;
}

/* Departments */
.cash-dept { display: flex; flex-direction: column; gap: 0; border: 1px solid #000; }
.cash-dept__row {
  display: grid;
  grid-template-columns: 1fr auto auto;
  gap: 12px;
  align-items: baseline;
  padding: 10px 14px;
  border-bottom: 1px solid #000;
}
.cash-dept__row:last-child { border-bottom: 0; }
.cash-dept__label { font-weight: 700; color: #000; font-size: 12px; text-transform: uppercase; letter-spacing: 0.04em; }
.cash-dept__meta { color: #666; font-size: 11px; font-variant-numeric: tabular-nums; text-transform: uppercase; letter-spacing: 0.04em; }
.cash-dept__value { font-variant-numeric: tabular-nums; font-weight: 700; font-size: 13px; color: #000; }

/* Forms */
.cash-form { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.cash-form__field { display: flex; flex-direction: column; gap: 4px; }
.cash-form__field--wide { grid-column: 1 / -1; }
.cash-form__field--readonly { background: #f7f7f7; padding: 8px 12px; border: 1px solid #000; }
.cash-form__readonly-value { font-size: 22px; font-weight: 700; font-variant-numeric: tabular-nums; color: #000; padding: 4px 0; }

.adjustment-confirm__summary {
  display: flex;
  flex-direction: column;
  gap: 4px;
  margin: 12px 0 0;
  border: 1px solid #000;
  padding: 10px 14px;
  font-size: 13px;
}
.adjustment-confirm__summary > div { display: flex; justify-content: space-between; gap: 12px; padding: 4px 0; border-bottom: 1px dashed rgba(0,0,0,0.15); }
.adjustment-confirm__summary > div:last-child { border-bottom: 0; }
.adjustment-confirm__summary dt { font-weight: 500; color: #555; text-transform: uppercase; letter-spacing: 0.06em; font-size: 11px; margin: 0; }
.adjustment-confirm__summary dd { font-weight: 700; color: #000; font-variant-numeric: tabular-nums; margin: 0; }

.adjustment-confirm__physical {
  display: flex;
  align-items: flex-start;
  gap: 10px;
  margin-top: 14px;
  padding: 12px 14px;
  border: 2px solid #8a1f1f;
  background: #fff5f5;
  cursor: pointer;
  font-weight: 700;
  color: #000;
  font-size: 13px;
  line-height: 1.4;
}
.adjustment-confirm__physical input { margin-top: 3px; flex-shrink: 0; }

.adjustment-confirm__autoprint {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-top: 8px;
  padding: 8px 12px;
  border: 1px solid #ccc;
  background: #fafafa;
  cursor: pointer;
  font-weight: 500;
  color: #333;
  font-size: 12px;
}
.adjustment-confirm__autoprint input { flex-shrink: 0; }

/* "Mostrar todos los documentos fiscales" modal */
.modal--all-fiscal-docs { width: 95vw; max-width: 1200px; max-height: 90vh; display: flex; flex-direction: column; }
.all-fiscal-docs__body { display: flex; flex-direction: column; gap: 12px; min-height: 0; flex: 1; overflow: hidden; padding: 14px 18px; }
.all-fiscal-docs__filters { display: grid; grid-template-columns: minmax(0, 2fr) minmax(0, 1fr) minmax(0, 1fr) auto; gap: 8px; }
.all-fiscal-docs__filters .modal__input { padding: 8px 10px; font-size: 12px; }
.all-fiscal-docs__list { flex: 1; min-height: 0; overflow-y: auto; border: 1px solid #000; scrollbar-gutter: stable; }
/* Shared grid template so the optional header row + every body row
   line up exactly. */
.all-fiscal-docs__row,
.all-fiscal-docs__head {
  display: grid;
  /* folio · cliente · type · status · timestamp · uuid · actions */
  grid-template-columns: 72px minmax(0, 1.3fr) 138px 126px 118px minmax(0, 0.6fr) 256px;
  gap: 10px;
  padding: 8px 12px;
  border-bottom: 1px solid #ccc;
  align-items: center;
  font-size: 12px;
}
.all-fiscal-docs__head {
  position: sticky; top: 0;
  background: #f3f3f3;
  border-bottom: 2px solid #000;
  font-weight: 700;
  font-size: 10px;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: #555;
  z-index: 1;
}
.all-fiscal-docs__head > div { text-align: center; }
.all-fiscal-docs__row:last-child { border-bottom: 0; }
.all-fiscal-docs__row:hover { background: #f7f7f7; }
/* Every body cell is center-aligned by default so the table reads
   uniformly. Long values (client name, UUID) ellipsize within their
   centered cell. Actions column anchors its buttons centered too. */
.all-fiscal-docs__cell {
  line-height: 1.3;
  text-align: center;
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.all-fiscal-docs__cell--folio {
  font-weight: 700; color: #000; font-variant-numeric: tabular-nums;
}
.all-fiscal-docs__cell--client {
  font-weight: 700; color: #000;
  text-transform: uppercase; letter-spacing: 0.02em;
}
.all-fiscal-docs__row > .all-fiscal-docs__cell:nth-child(3) {
  font-weight: 600;
}
.all-fiscal-docs__cell--status {
  font-weight: 700; text-transform: uppercase; font-size: 10px; letter-spacing: 0.06em;
}
.all-fiscal-docs__cell--status.is-stamped { color: #0a7a2f; }
.all-fiscal-docs__cell--status.is-canceled { color: #8a1f1f; }
.all-fiscal-docs__cell--status.is-stamp_error,
.all-fiscal-docs__cell--status.is-cancel_error { color: #c75b02; }
.all-fiscal-docs__cell--status.is-pending,
.all-fiscal-docs__cell--status.is-cancel_requested { color: #666; }
.all-fiscal-docs__cell--meta {
  color: #666; font-variant-numeric: tabular-nums; font-size: 11px;
}
.all-fiscal-docs__cell--uuid {
  color: #666; font-size: 10px;
}
.all-fiscal-docs__cell--actions {
  display: flex; flex-wrap: wrap; gap: 4px; row-gap: 4px;
  align-items: center; justify-content: center;
  white-space: normal; overflow: hidden;
}
.all-fiscal-docs__footnote { margin: 0; font-size: 10px; color: #666; text-align: right; }

/* Bulk regenerator modal --------------------------------------------------- */
.modal--bulk-regen { width: 90vw; max-width: 720px; max-height: 90vh; display: flex; flex-direction: column; }
.bulk-regen__body { display: flex; flex-direction: column; gap: 14px; min-height: 0; flex: 1; overflow: hidden; padding: 16px 20px; }
.bulk-regen__intro { margin: 0; font-size: 12px; color: #333; line-height: 1.4; }
.bulk-regen__force {
  display: flex; gap: 8px; align-items: flex-start;
  font-size: 12px; color: #333; line-height: 1.35;
  padding: 8px 10px; border: 1px dashed #c75b02; background: rgba(199, 91, 2, 0.06);
  cursor: pointer;
}
.bulk-regen__force input { margin-top: 2px; }
.bulk-regen__type-field { display: flex; flex-direction: column; gap: 4px; }
.bulk-regen__type-label {
  font-size: 10px; text-transform: uppercase; letter-spacing: 0.14em;
  color: #000; font-weight: 700;
}

/* XML upload modal -------------------------------------------------------- */
.modal--xml-upload { width: 90vw; max-width: 760px; max-height: 90vh; display: flex; flex-direction: column; }
.xml-upload__body { display: flex; flex-direction: column; gap: 14px; min-height: 0; flex: 1; overflow: hidden; padding: 16px 20px; }
.xml-upload__intro { margin: 0; font-size: 12px; color: #333; line-height: 1.4; }
.xml-upload__file-field { display: flex; flex-direction: column; gap: 6px; }
.xml-upload__file-label {
  font-size: 10px; text-transform: uppercase; letter-spacing: 0.14em;
  color: #000; font-weight: 700;
}
.xml-upload__file-field input[type="file"] {
  font: inherit; font-size: 12px;
  padding: 8px; border: 1px dashed #000; background: #fafafa;
}
.xml-upload__summary {
  font-size: 12px; font-weight: 600;
  font-family: ui-monospace, "SF Mono", Menlo, monospace;
}
.xml-upload__list {
  flex: 1; min-height: 100px; max-height: 50vh; overflow-y: auto;
  border: 1px solid #000; scrollbar-gutter: stable;
  display: flex; flex-direction: column;
}
.xml-upload__row {
  display: grid;
  grid-template-columns: minmax(0, 1.4fr) minmax(0, 1fr) minmax(140px, auto);
  gap: 12px; padding: 6px 10px; border-bottom: 1px solid #eee;
  font-size: 12px;
}
.xml-upload__row:last-child { border-bottom: 0; }
.xml-upload__row-name { font-weight: 600; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.xml-upload__row-meta { color: #555; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.xml-upload__row-status { text-align: right; font-family: ui-monospace, "SF Mono", Menlo, monospace; }
.xml-upload__row.is-ok .xml-upload__row-status { color: #0a7a2f; }
.xml-upload__row.is-err .xml-upload__row-status { color: #8a1f1f; }
.xml-upload__row.is-skip .xml-upload__row-status { color: #c75b02; }
.xml-upload__row.is-uploading .xml-upload__row-status,
.xml-upload__row.is-matched .xml-upload__row-status,
.xml-upload__row.is-queued .xml-upload__row-status { color: #888; }
.xml-upload__actions { display: flex; gap: 8px; justify-content: flex-end; }

/* Venta Pendiente — banner + list/settle modals --------------------------- */
.pendientes-banner {
  display: block; width: 100%; text-align: center;
  padding: 6px 12px; margin: 0 0 6px;
  background: #fff8e1; border: 1px solid #c75b02; cursor: pointer;
  font-family: inherit; font-size: 12px; font-weight: 700;
  color: #8a1f1f; line-height: 1.2;
  letter-spacing: 0.04em;
}
.pendientes-banner:hover { background: #fff3c4; }
.pendientes-banner.is-overdue { background: #ffe7e7; border-color: #8a1f1f; }
.pendientes-banner.pendientes-banner--idle {
  background: #f4f4f4; border-color: #ccc; color: #666;
  font-weight: 400; cursor: default;
}

.modal--pendientes-list { width: 90vw; max-width: 720px; max-height: 90vh; }
.pendientes-list__body { display: flex; flex-direction: column; gap: 8px; padding: 12px 16px; }
.pendientes-list { display: flex; flex-direction: column; }
.pendientes-list__row {
  display: grid; grid-template-columns: minmax(0, 2fr) 130px auto;
  gap: 12px; padding: 10px 12px; border-bottom: 1px solid #eee;
  align-items: center;
}
.pendientes-list__row.is-overdue { background: #fff3f3; }
.pendientes-list__row:last-child { border-bottom: 0; }
.pendientes-list__name { font-weight: 700; }
.pendientes-list__meta { font-size: 11px; color: #555; margin-top: 2px; }
.pendientes-list__overdue { color: #8a1f1f; font-weight: 700; }
.pendientes-list__total { text-align: right; font-weight: 700; }
.pendientes-list__actions { text-align: right; }

.modal--pendientes-settle { width: 90vw; max-width: 480px; }
.modal__value--lg { font-size: 24px; font-weight: 700; }
.modal__actions { display: flex; gap: 8px; justify-content: flex-end; padding-top: 12px; }

.modal__help--warn { color: #8a1f1f; font-weight: 600; }
.modal__help--ok { color: #0a7a2f; font-weight: 600; }
.modal__field--auth {
  border: 1px dashed #c75b02; background: rgba(199, 91, 2, 0.06);
  padding: 10px 12px;
}
.modal__pin-row { display: flex; gap: 6px; align-items: center; }
.modal__pin-row .modal__input { flex: 1; }
.bulk-regen__summary { font-size: 13px; font-weight: 600; }
.bulk-regen__progress { display: flex; flex-direction: column; gap: 6px; }
.bulk-regen__bar { width: 100%; height: 12px; border: 1px solid #000; background: #fff; }
.bulk-regen__bar-fill { height: 100%; background: #0a7a2f; transition: width 120ms linear; }
.bulk-regen__progress-text { font-size: 11px; font-family: ui-monospace, "SF Mono", Menlo, monospace; color: #333; }
.bulk-regen__actions { display: flex; gap: 8px; justify-content: flex-end; }
.bulk-regen__log {
  flex: 1; min-height: 120px; max-height: 50vh; overflow-y: auto;
  border: 1px solid #000; scrollbar-gutter: stable;
  display: flex; flex-direction: column;
}
.bulk-regen__log-row {
  display: grid; grid-template-columns: minmax(0, 1fr) minmax(160px, auto);
  gap: 12px; padding: 6px 10px; border-bottom: 1px solid #eee;
  font-size: 12px;
}
.bulk-regen__log-row:last-child { border-bottom: 0; }
.bulk-regen__log-label { font-weight: 600; }
.bulk-regen__log-status { text-align: right; font-family: ui-monospace, "SF Mono", Menlo, monospace; }
.bulk-regen__log-row.is-ok .bulk-regen__log-status { color: #0a7a2f; }
.bulk-regen__log-row.is-err .bulk-regen__log-status { color: #8a1f1f; }
.bulk-regen__log-row.is-pending .bulk-regen__log-status { color: #888; }
.bulk-regen__log-row.is-skip .bulk-regen__log-status { color: #c75b02; }
.cash-form__label {
  font-size: 10px;
  text-transform: uppercase;
  letter-spacing: 0.14em;
  color: #000;
  font-weight: 700;
}
.cash-form__input {
  padding: 9px 11px;
  border: 1px solid #000;
  border-radius: 0;
  background: #fff;
  font-variant-numeric: tabular-nums;
  font-size: 13px;
}
.cash-form__actions { display: flex; justify-content: flex-end; gap: 6px; }
.cash-form__actions--wide { grid-column: 1 / -1; }

/* Lists */
.cash-list { display: flex; flex-direction: column; background: #fff; border-radius: 0; overflow: hidden; border: 1px solid #000; }
.cash-list__header {
  display: flex;
  justify-content: space-between;
  font-size: 10px;
  font-weight: 700;
  color: #000;
  text-transform: uppercase;
  letter-spacing: 0.14em;
  padding: 10px 14px;
  background: #000;
  color: #fff;
}
.cash-list__total { font-variant-numeric: tabular-nums; color: #fff; }
.cash-list__row {
  display: grid;
  grid-template-columns: 1fr auto auto;
  gap: 12px;
  align-items: center;
  padding: 12px 14px;
  border-top: 1px solid #000;
}
.cash-list__primary { display: flex; flex-direction: column; gap: 2px; min-width: 0; }
.cash-list__label { font-weight: 700; color: #000; font-size: 12px; text-transform: uppercase; letter-spacing: 0.04em; }
.cash-list__meta { font-size: 11px; color: #666; }
.cash-list__amount { font-variant-numeric: tabular-nums; font-weight: 700; font-size: 14px; letter-spacing: -0.01em; }
.cash-list__amount.is-positive { color: #000; }
.cash-list__amount.is-negative { color: #d00000; }
.cash-list__remove {
  background: #fff;
  border: 1px solid #000;
  color: #000;
  font-size: 14px;
  line-height: 1;
  padding: 4px 8px;
  border-radius: 0;
  font-weight: 700;
}
.cash-list__remove:hover { background: #d00000; color: #fff; border-color: #d00000; }
.cash-list__reprint {
  background: #fff;
  border: 1px solid #000;
  color: #000;
  font-size: 14px;
  line-height: 1;
  padding: 4px 8px;
  border-radius: 0;
  font-weight: 700;
}
.cash-list__reprint:hover { background: #000; color: #fff; }

.cash-empty {
  margin: 0;
  padding: 20px;
  border: 1px solid #000;
  color: #666;
  text-align: center;
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: 0.12em;
}

/* Recent sessions */
.cash-history { display: flex; flex-direction: column; gap: 0; padding: 0; border: 1px solid #000; }
.cash-history__row {
  display: grid;
  grid-template-columns: auto 120px 1fr;
  gap: 12px;
  align-items: baseline;
  padding: 10px 14px;
  border-bottom: 1px solid #000;
  font-size: 12px;
}
.cash-history__row:last-child { border-bottom: 0; }
.cash-history__folio { font-weight: 700; font-variant-numeric: tabular-nums; color: #000; letter-spacing: -0.01em; }
.cash-history__date { color: #000; font-variant-numeric: tabular-nums; text-transform: uppercase; letter-spacing: 0.04em; }
.cash-history__status { color: #666; font-size: 11px; text-transform: uppercase; letter-spacing: 0.04em; }

/* Clickable closed rows — inverts to black on hover/select, matching the
   topbar + button treatments used elsewhere in v2. */
.cash-history__row--clickable { cursor: pointer; transition: background 0.08s ease, color 0.08s ease; }
.cash-history__row--clickable:hover,
.cash-history__row--selected { background: #000; }
.cash-history__row--clickable:hover .cash-history__folio,
.cash-history__row--clickable:hover .cash-history__date,
.cash-history__row--selected .cash-history__folio,
.cash-history__row--selected .cash-history__date { color: #fff; }
.cash-history__row--clickable:hover .cash-history__status,
.cash-history__row--selected .cash-history__status { color: #bbb; }
.cash-history__row--clickable:focus-visible { outline: 2px solid #000; outline-offset: -2px; }

/* Closed-session detail panel */
.cash-detail .cash-panel__header { display: flex; justify-content: space-between; align-items: center; gap: 12px; }
.cash-detail__header-actions { display: flex; gap: 4px; }
.cash-detail__body { gap: 16px; }
.cash-detail__meta {
  display: flex; flex-direction: column; gap: 4px;
  padding: 12px 14px; border: 1px solid #000; font-size: 12px; color: #000;
}
.cash-detail__observations { padding-top: 4px; font-style: italic; color: #666; }
.cash-detail__metrics {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
  border-top: 1px solid #000; border-left: 1px solid #000;
}
.cash-detail__metrics .cash-metric {
  border-right: 1px solid #000; border-bottom: 1px solid #000;
  min-width: 0; padding: 12px 14px;
}
.cash-detail__metrics .cash-metric.is-warn { background: #fff5d9; }
.cash-detail__metrics .cash-metric.is-warn .cash-metric__value { color: #8a5a00; }
.cash-detail__metrics .cash-metric.is-error { background: #fde6e6; }
.cash-detail__metrics .cash-metric.is-error .cash-metric__value { color: #d00000; }
.cash-detail__adjustments { display: flex; flex-direction: column; gap: 8px; }
.cash-detail__adjustments h4 {
  font-size: 11px; text-transform: uppercase; letter-spacing: 0.14em;
  font-weight: 700; color: #000; margin: 0;
}
.cash-detail__footnote { margin-top: 4px; font-size: 11px; color: #666; line-height: 1.5; }
.cash-detail__error { color: #d00000; font-size: 13px; margin-bottom: 8px; }

/* =======================  CORTE Z MODAL  ================================= */

.modal--cortez { width: min(960px, 100%); }

.cortez-summary {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 0;
  border: 1px solid #000;
}
.cortez-stat {
  display: flex;
  flex-direction: column;
  border: 0;
  border-right: 1px solid #000;
  border-bottom: 1px solid #000;
  border-radius: 0;
  padding: 10px 14px;
  gap: 2px;
  background: #fff;
}
.cortez-stat:nth-child(4n) { border-right: 0; }
.cortez-stat:nth-last-child(-n+4) { border-bottom: 0; }
.cortez-stat__label {
  font-size: 9px;
  text-transform: uppercase;
  letter-spacing: 0.14em;
  color: #666;
  font-weight: 500;
}
.cortez-stat__value { font-weight: 700; font-variant-numeric: tabular-nums; font-size: 14px; color: #000; letter-spacing: -0.01em; }
.cortez-stat.is-accent { background: #000; }
.cortez-stat.is-accent .cortez-stat__label { color: #fff; }
.cortez-stat.is-accent .cortez-stat__value { color: #fff; }
.cortez-stat.is-pos .cortez-stat__value { color: #000; }
.cortez-stat.is-neg .cortez-stat__value { color: #d00000; }
/* Empty filler cell — keeps the grid's last row visually closed even
   when the cell count isn't a multiple of 4. */
.cortez-stat--filler { background: #fafafa; }

.cortez-exchange { display: flex; gap: 12px; align-items: flex-end; max-width: 340px; }
.cortez-exchange .modal__label { min-width: 200px; }
.cortez-exchange .modal__input { flex: 1; }

.cortez-denoms {
  border: 1px solid #000;
  padding: 14px;
  display: flex;
  flex-direction: column;
  gap: 12px;
}
.cortez-denoms__header { display: flex; justify-content: space-between; align-items: baseline; }
.cortez-denoms__header h3 {
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: 0.14em;
  color: #000;
  font-weight: 700;
}
.cortez-denoms__total {
  font-size: 12px;
  font-weight: 700;
  font-variant-numeric: tabular-nums;
  color: #000;
  letter-spacing: -0.01em;
}
.cortez-denoms__grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(230px, 1fr));
  gap: 12px;
}
.cortez-denoms__col {
  border: 1px solid #000;
  padding: 10px;
  display: flex;
  flex-direction: column;
  gap: 2px;
  background: #fff;
}
.cortez-denoms__col-title {
  font-size: 10px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.14em;
  color: #000;
  padding: 4px 4px 8px;
  border-bottom: 1px solid #000;
  margin-bottom: 4px;
}
.cortez-denom-row {
  display: grid;
  grid-template-columns: 68px 78px 1fr;
  gap: 6px;
  align-items: center;
  padding: 4px;
  font-size: 12px;
}
.cortez-denom-row__denom { font-weight: 700; font-variant-numeric: tabular-nums; color: #000; }
.cortez-denom-row__qty {
  padding: 6px 8px;
  border: 1px solid #000;
  border-radius: 0;
  background: #fff;
  text-align: right;
  font-variant-numeric: tabular-nums;
  font-weight: 500;
  font-size: 12px;
}
.cortez-denom-row__line { text-align: right; color: #000; font-variant-numeric: tabular-nums; font-size: 12px; font-weight: 500; }
.cortez-handoff { display: flex; flex-direction: column; gap: 10px; }

/* =======================  HISTORY TAB  =================================== */

.history { display: flex; flex-direction: column; gap: 0; }
.history > * + * { border-top: 1px solid #000; }

.history-header {
  display: flex;
  gap: 0;
  align-items: stretch;
  background: #fff;
  border: 0;
  border-radius: 0;
  padding: 0;
  flex-wrap: wrap;
}
.history-header__left {
  display: flex;
  gap: 8px;
  align-items: center;
  flex-wrap: nowrap;
  padding: 14px 16px;
  border-right: 1px solid #000;
}
/* Lock each control to a fixed width so label swaps (Refrescar ↔
   Cargando…) and the conditional "Caja (YYYY-MM-DD)" button don't
   resize neighbors or trigger line wraps on every refresh.  Children
   order: [label, input, Hoy, Refrescar, Caja(always-rendered)]. */
.history-header__left .sale-btn {
  flex-shrink: 0;
  white-space: nowrap;
  text-align: center;
  padding: 6px 6px;         /* tighter than default --sm 10px so content fits */
}
.history-header__left > button:nth-child(3) { width: 56px; }    /* Hoy */
.history-header__left > button:nth-child(4) { width: 100px; }   /* Refrescar / Cargando… */
.history-header__left > button:nth-child(5) { width: 148px; }   /* Caja (YYYY-MM-DD) */
.history-header__left .history-header__date {
  flex-shrink: 0;
  width: 136px;
  padding: 7px 6px;
}
.history-header__label { flex-shrink: 0; white-space: nowrap; }
.history-header__label {
  font-size: 10px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.14em;
  color: #000;
}
.history-header__date {
  padding: 7px 10px;
  border: 1px solid #000;
  border-radius: 0;
  background: #fff;
  font-variant-numeric: tabular-nums;
  font-weight: 500;
  font-size: 13px;
}
.history-header__actions {
  margin-left: auto;
  display: flex;
  gap: 0;
  align-items: stretch;
}
.history-header__actions .sale-btn {
  border: 0;
  border-left: 1px solid #000;
  padding: 14px 20px;
  height: auto;
  /* Fixed width prevents the whole header from shifting when the label
     swaps between "Recargar" (8 chars) and "Recargando…" (12 chars). */
  min-width: 170px;
  text-align: center;
  white-space: nowrap;
}

.history-grid {
  display: grid;
  grid-template-columns: minmax(380px, 1fr) minmax(0, 1.4fr);
  gap: 0;
  align-items: stretch;
}
@media (max-width: 1080px) { .history-grid { grid-template-columns: 1fr; } }

.history-list {
  background: #fff;
  border: 0;
  border-right: 1px solid #000;
  border-radius: 0;
  max-height: 780px;
  overflow: auto;
  /* Reserve the inner scrollbar gutter so the row widths don't shift
     when the list grows past max-height and the scrollbar appears. */
  scrollbar-gutter: stable;
}
@media (max-width: 1080px) { .history-list { border-right: 0; border-bottom: 1px solid #000; } }
.history-list__header {
  display: flex;
  justify-content: space-between;
  padding: 10px 18px;
  border-bottom: 1px solid #000;
  background: #000;
  color: #fff;
  font-size: 10px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.14em;
  position: sticky;
  top: 0;
  z-index: 1;
}
.history-list__spinner { color: #fff; }
.history-list__rows { display: flex; flex-direction: column; }
.history-list__more {
  width: 100%;
  border-top: 1px solid #000;
  border-radius: 0;
}

.history-row {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto auto;
  gap: 8px;
  padding: 14px 18px;
  border: 0;
  border-top: 1px solid #000;
  background: #fff;
  text-align: left;
  cursor: pointer;
  transition: background 80ms;
  align-items: start;
}
.history-row__reprint {
  grid-column: 3; grid-row: 1;
  display: inline-flex; align-items: center; justify-content: center;
  width: 36px; height: 36px;
  border: 1px solid #000; background: #fff; color: #000;
  font-size: 16px; line-height: 1; cursor: pointer;
  border-radius: 4px;
  user-select: none;
}
.history-row__reprint:hover { background: #000; color: #fff; }
.history-row__reprint.is-busy { opacity: 0.55; cursor: progress; }
.history-row.is-selected .history-row__reprint { background: #fff; color: #000; }
.history-row:first-child { border-top: 0; }
.history-row:hover { background: #f0f0f0; }
.history-row.is-selected { background: #000; color: #fff; }
.history-row.is-selected .history-row__folio,
.history-row.is-selected .history-row__customer,
.history-row.is-selected .history-row__total,
.history-row.is-selected .history-row__meta { color: #fff; }
.history-row.is-selected .history-row__method { border-color: #fff; color: #fff; }
.history-row.is-cancelled { opacity: 0.45; }
.history-row__main { display: flex; flex-direction: column; gap: 2px; grid-column: 1 / 2; grid-row: 1; min-width: 0; }
.history-row__folio { font-weight: 700; font-variant-numeric: tabular-nums; font-size: 16px; color: #000; letter-spacing: -0.01em; }
.history-row__customer {
  font-size: 12px;
  color: #666;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  text-transform: uppercase;
  letter-spacing: 0.04em;
}
.history-row__total { font-weight: 700; font-variant-numeric: tabular-nums; font-size: 16px; grid-column: 2; grid-row: 1; color: #000; letter-spacing: -0.01em; }
.history-row__meta {
  grid-column: 1 / -1;
  grid-row: 2;
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  font-size: 10px;
  color: #666;
  margin-top: 6px;
  text-transform: uppercase;
  letter-spacing: 0.08em;
}
.history-row__method {
  padding: 1px 6px;
  border: 1px solid #000;
  color: #000;
  font-weight: 500;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  font-size: 9px;
}
.history-row__method.method-credit,
.history-row__method.method-transfer,
.history-row__method.method-pendiente { background: #000; color: #fff; }
.history-row__pendiente-badge {
  color: #c75b02; font-weight: 700;
  text-transform: uppercase; letter-spacing: 0.08em;
  border: 1px solid #c75b02; padding: 2px 6px;
  background: rgba(199, 91, 2, 0.08);
  font-size: 11px;
}
.history-row__time { font-variant-numeric: tabular-nums; }
.history-row__doc { font-weight: 700; letter-spacing: 0.08em; }
.history-row__doc.doc-stamped { color: #000; }
.history-row__doc.doc-stamp_error { color: #d00000; }
.history-row__needs { color: #000; font-weight: 700; }
.history-row__cancelled { color: #d00000; font-weight: 700; text-transform: uppercase; letter-spacing: 0.08em; }
/* Cancellation-request chip — solid-red filled badge so it pops against
   the rest of the row's grayscale meta line. The pulse animation tugs
   attention without being annoying (~1.6s cycle, very mild scale). */
.history-row__cancel-req {
  color: #fff;
  background: #c41818;
  font-weight: 800;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  border: 1px solid #c41818;
  padding: 3px 8px;
  font-size: 10px;
  border-radius: 3px;
  box-shadow: 0 0 0 0 rgba(196, 24, 24, 0.55);
  animation: history-cancel-req-pulse 1.6s ease-in-out infinite;
}
@keyframes history-cancel-req-pulse {
  0%, 100% { box-shadow: 0 0 0 0 rgba(196, 24, 24, 0.55); }
  50%      { box-shadow: 0 0 0 6px rgba(196, 24, 24, 0.0); }
}
/* When the row is selected (inverted black bg), keep the red chip
   distinctive — the white border picks up the inverted contrast and
   the chip still reads as "warning". */
.history-row.is-selected .history-row__cancel-req {
  background: #fff;
  color: #c41818;
  border-color: #fff;
}
@media (prefers-reduced-motion: reduce) {
  /* Respect the user's motion preference; box-shadow stays static. */
  .history-row__cancel-req { animation: none; }
}

.history-detail__cancel-request {
  border: 1px solid #8a1f1f;
  color: #8a1f1f;
  background: #fff;
  padding: 12px 14px;
  display: flex;
  flex-direction: column;
  gap: 4px;
}
.history-detail__cancel-request-title {
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.12em;
  font-size: 11px;
}
.history-detail__cancel-request-meta,
.history-detail__cancel-request-reason {
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  color: #8a1f1f;
}
.history-detail__cancel-request-reason { text-transform: none; letter-spacing: 0; }

.history-detail {
  background: #fff;
  border: 0;
  border-radius: 0;
  padding: 24px;
  display: flex;
  flex-direction: column;
  gap: 18px;
}
.history-detail--empty {
  align-items: center;
  justify-content: center;
  min-height: 280px;
  color: #999;
  font-size: 12px;
  text-transform: uppercase;
  letter-spacing: 0.12em;
}
.history-detail__header {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 12px;
  padding-bottom: 14px;
  border-bottom: 1px solid #000;
}
.history-detail__folio { font-size: 24px; font-weight: 700; font-variant-numeric: tabular-nums; color: #000; letter-spacing: -0.03em; }
.history-detail__date { color: #666; font-size: 11px; text-transform: uppercase; letter-spacing: 0.08em; }
.history-detail__status {
  padding: 4px 10px;
  border: 1px solid #000;
  font-size: 10px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.14em;
}
.history-detail__status.is-ok { background: #000; color: #fff; }
.history-detail__status.is-cancelled { background: #d00000; color: #fff; border-color: #d00000; }

.history-detail__meta {
  display: grid;
  /* minmax(0, 1fr) stops long dd values from pushing the column wider
     than its 50% share — without the explicit 0 minimum, grid defaults
     to minmax(auto, 1fr) and content can stretch the track. */
  grid-template-columns: minmax(0, 1fr) minmax(0, 1fr);
  gap: 0;
  margin: 0;
  border: 1px solid #000;
}
.history-detail__meta-row dt,
.history-detail__meta-row dd { min-width: 0; overflow: hidden; text-overflow: ellipsis; }
.history-detail__meta-row {
  display: flex;
  justify-content: space-between;
  gap: 8px;
  padding: 8px 12px;
  border-right: 1px solid #000;
  border-bottom: 1px solid #000;
}
.history-detail__meta-row:nth-child(2n) { border-right: 0; }
.history-detail__meta-row:nth-last-child(-n+2) { border-bottom: 0; }
.history-detail__meta-row dt {
  font-size: 9px;
  color: #666;
  font-weight: 500;
  text-transform: uppercase;
  letter-spacing: 0.14em;
}
.history-detail__meta-row dd { margin: 0; font-weight: 700; text-align: right; color: #000; font-size: 12px; }

.history-detail__lines { display: flex; flex-direction: column; gap: 0; border: 1px solid #000; }
.history-detail__lines-title {
  display: none;
}
.history-detail__line {
  display: grid;
  /* minmax(0, 1fr) prevents long SKU names from pushing the qty/total
     columns rightward and widening the whole detail pane. */
  grid-template-columns: minmax(0, 1fr) auto auto;
  gap: 10px;
  padding: 10px 14px;
  border-bottom: 1px solid #000;
  font-size: 12px;
  align-items: baseline;
}
.history-detail__line:last-child { border-bottom: 0; }
.history-detail__line-name { font-weight: 700; color: #000; text-transform: uppercase; letter-spacing: 0.02em; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.history-detail__line-qty { color: #666; font-variant-numeric: tabular-nums; font-size: 11px; text-transform: uppercase; letter-spacing: 0.04em; white-space: nowrap; }
.history-detail__line-total { font-weight: 700; font-variant-numeric: tabular-nums; white-space: nowrap; }

.history-detail__totals {
  display: flex;
  flex-direction: column;
  gap: 4px;
  padding-top: 12px;
  border-top: 1px solid #000;
}
.history-detail__total-row {
  display: flex;
  justify-content: space-between;
  font-variant-numeric: tabular-nums;
  font-size: 12px;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  font-weight: 500;
}
.history-detail__total-row.is-accent { color: #d00000; font-weight: 700; }
.history-detail__customer-credit-card {
  border: 1px solid #000;
  background: #fff;
  margin-top: 2px;
  display: flex;
  flex-direction: column;
  gap: 0;
}
.history-detail__customer-credit-head {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  padding: 10px 14px;
  background: #000;
  color: #fff;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.1em;
  font-size: 11px;
  font-variant-numeric: tabular-nums;
}
.history-detail__customer-credit-rows { display: flex; flex-direction: column; }
.history-detail__customer-credit-row {
  display: grid;
  grid-template-columns: 90px minmax(0, 1fr) auto;
  gap: 10px;
  padding: 8px 14px;
  border-top: 1px solid #000;
  font-size: 12px;
  font-variant-numeric: tabular-nums;
  align-items: baseline;
  cursor: pointer;
  background: #fff;
  transition: background 80ms;
}
.history-detail__customer-credit-row:hover:not(.is-current) { background: #f0f0f0; }
.history-detail__customer-credit-row.is-current { background: #fff8cc; cursor: default; }
.history-detail__customer-credit-receipt { font-weight: 700; color: #000; }
.history-detail__customer-credit-folio {
  color: #666;
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.history-detail__customer-credit-amount { font-weight: 700; color: #000; }
.history-detail__total-value { font-size: 28px; font-weight: 700; color: #000; letter-spacing: -0.03em; }

.history-detail__cancelled {
  border: 1px solid #d00000;
  color: #d00000;
  padding: 14px;
  background: #fff;
}
.history-detail__cancelled-title { font-weight: 700; text-transform: uppercase; letter-spacing: 0.14em; font-size: 11px; margin-bottom: 8px; }
.history-detail__cancelled .history-detail__meta-row dt { color: inherit; opacity: 0.75; }
.history-detail__cancelled .history-detail__meta-row dd { color: inherit; }

.history-detail__actions { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 0; border: 1px solid #000; }
.history-detail__actions .sale-btn { border: 0; border-right: 1px solid #000; border-bottom: 1px solid #000; padding: 12px; }
.history-detail__actions .sale-btn:nth-child(2n) { border-right: 0; }
.history-detail__actions .sale-btn:nth-last-child(-n+2) { border-bottom: 0; }
/* Placeholder cell paired with the manager-only Cancelar ticket button
   so the bottom-right grid corner isn't empty. Visually mute — no text,
   no hover, not focusable. */
.history-detail__actions .sale-btn--placeholder {
  background: #fff;
  color: transparent;
  cursor: default;
  pointer-events: none;
  opacity: 1;
}
.history-detail__actions .sale-btn--placeholder:hover { background: #fff; color: transparent; }

.history-sku-totals__grand {
  font-variant-numeric: tabular-nums;
  font-weight: 700;
  color: #000;
  font-size: 18px;
  text-transform: uppercase;
  letter-spacing: 0.04em;
}
/* Bump the "Totales por SKU del día" header (h3 inside cash-panel__header)
   specifically for this panel — the kg/cj/$ line next to it is the
   day-at-a-glance number the cashier scans most often. */
.history-sku-totals .cash-panel__header h3 {
  font-size: 15px;
  letter-spacing: 0.12em;
}
.history-sku-totals .cash-panel__header {
  padding: 16px 20px;
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  gap: 12px;
  flex-wrap: wrap;
}
.history-sku-totals__grid { display: grid; grid-template-columns: 1fr; gap: 0; border: 1px solid #000; }
.history-sku-totals__row {
  display: grid;
  grid-template-columns: 60px minmax(0, 1fr) auto auto;
  gap: 12px;
  padding: 10px 14px;
  border-bottom: 1px solid #000;
  align-items: baseline;
  font-size: 12px;
}
.history-sku-totals__row:last-child { border-bottom: 0; }
.history-sku-totals__code { font-weight: 500; font-variant-numeric: tabular-nums; color: #666; font-size: 11px; }
.history-sku-totals__name { font-weight: 700; color: #000; text-transform: uppercase; letter-spacing: 0.02em; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.history-sku-totals__qty { font-variant-numeric: tabular-nums; color: #666; font-size: 11px; text-transform: uppercase; letter-spacing: 0.04em; }
.history-sku-totals__amount { font-variant-numeric: tabular-nums; font-weight: 700; color: #000; }

/* Compact variant used in Caja's "Totales por SKU del día" — denser
   rows + wider code column so slash-joined pool codes like "102 / 103"
   fit on one line without ellipsis. Historial keeps the default sizing. */
.history-sku-totals--compact .history-sku-totals__row {
  grid-template-columns: 84px minmax(0, 1fr) auto auto;
  padding: 6px 12px;
  gap: 10px;
  font-size: 11px;
}
.history-sku-totals--compact .history-sku-totals__code { font-size: 11px; }
.history-sku-totals--compact .history-sku-totals__qty  { font-size: 10px; }

.modal__checkbox {
  display: flex;
  gap: 10px;
  align-items: flex-start;
  padding: 12px 14px;
  border: 1px solid #000;
  background: #fff;
  cursor: pointer;
  font-weight: 500;
  color: #000;
  font-size: 12px;
  text-transform: uppercase;
  letter-spacing: 0.04em;
}
.modal__checkbox input { margin-top: 2px; accent-color: #000; }

/* =======================  FISCAL TAB  ==================================== */

.fiscal { display: flex; flex-direction: column; gap: 0; }
.fiscal > * + * { border-top: 1px solid #000; }

.fiscal-readiness {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 12px;
  background: #fff;
  border: 0;
  border-radius: 0;
  padding: 14px 24px;
}

/* Workspace email-settings card — manager-only, just under the readiness bar.
   Holds the team_emails textarea + auto-send toggle + save button. Spans
   the full Fiscal tab width so the textarea is comfortable to type in. */
.fiscal-email-settings {
  background: #fff;
  border: 0;
  border-radius: 0;
  padding: 14px 24px;
}
.fiscal-email-settings__head { display: flex; flex-direction: column; gap: 4px; margin-bottom: 8px; }
.fiscal-email-settings__head h2 {
  font-size: 13px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  margin: 0;
}
.fiscal-email-settings__hint { font-size: 12px; color: #555; margin: 0; line-height: 1.4; }
.fiscal-email-settings__row { display: flex; flex-direction: column; gap: 6px; margin-top: 8px; }
.fiscal-email-settings__label { display: flex; flex-direction: column; gap: 4px; font-size: 11px; color: #444; }
.fiscal-email-settings__textarea {
  font-family: "SF Mono", Menlo, Consolas, monospace;
  font-size: 13px;
  padding: 8px 10px;
  border: 1px solid #ccc;
  border-radius: 4px;
  width: 100%;
  max-width: 520px;
  resize: vertical;
  box-sizing: border-box;
  background: #fff;
}
.fiscal-email-settings__textarea:focus { outline: 2px solid #000; outline-offset: -1px; border-color: #000; }
.fiscal-email-settings__checkbox {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  font-size: 12px;
  cursor: pointer;
}
.fiscal-email-settings__checkbox input { width: 16px; height: 16px; cursor: pointer; }
.fiscal-email-settings__actions { display: flex; gap: 8px; margin-top: 10px; }

/* Cloud archive settings card. Same column-layout DNA as the email
   card it replaces; the meta dl + status pill carry the kill-switch
   state at a glance. */
.fiscal-cloud-settings {
  background: #fff;
  border: 0;
  border-radius: 0;
  padding: 14px 24px;
}
.fiscal-cloud-settings__head { display: flex; flex-direction: column; gap: 4px; margin-bottom: 8px; }
.fiscal-cloud-settings__head h2 {
  font-size: 13px; font-weight: 700; text-transform: uppercase;
  letter-spacing: 0.08em; margin: 0;
}
.fiscal-cloud-settings__hint { font-size: 12px; color: #555; margin: 0; line-height: 1.4; max-width: 660px; }
.fiscal-cloud-settings__error { font-size: 12px; color: #8a1f1f; margin: 4px 0 0; }

/* Purchase-order reprint card (employee Fiscal tab, patch #67) */
.fiscal-po-reprint__actions { margin: 8px 0 4px; }
.fiscal-po-reprint__list { list-style: none; margin: 8px 0 0; padding: 0; display: flex; flex-direction: column; gap: 8px; }
.fiscal-po-reprint__item { display: flex; align-items: center; justify-content: space-between; gap: 12px; flex-wrap: wrap; padding: 8px 10px; border: 1px solid #e2e2e2; border-radius: 10px; }
.fiscal-po-reprint__info { display: flex; flex-direction: column; gap: 2px; min-width: 0; }
.fiscal-po-reprint__info strong { font-size: 13px; }
.fiscal-po-reprint__meta { font-size: 11px; color: #555; }
.fiscal-po-reprint__btns { display: flex; gap: 6px; flex-wrap: wrap; justify-content: flex-end; }

.fiscal-cloud-settings__meta { display: grid; grid-template-columns: repeat(auto-fit, minmax(180px, 1fr)); gap: 16px; margin: 12px 0 8px; max-width: 520px; }
.fiscal-cloud-settings__meta > div { display: flex; flex-direction: column; gap: 2px; }
.fiscal-cloud-settings__meta dt { font-size: 9px; font-weight: 600; text-transform: uppercase; letter-spacing: 0.12em; color: #777; margin: 0; }
.fiscal-cloud-settings__meta dd { margin: 0; font-size: 13px; color: #000; font-weight: 500; }
.fiscal-cloud-settings__pill {
  display: inline-flex; align-items: center; padding: 2px 10px;
  border-radius: 999px; font-size: 11px; font-weight: 700;
  text-transform: uppercase; letter-spacing: 0.06em;
}
.fiscal-cloud-settings__pill--on { background: rgba(10, 122, 47, 0.12); color: #0a7a2f; }
.fiscal-cloud-settings__pill--off { background: rgba(138, 31, 31, 0.12); color: #8a1f1f; }
.fiscal-cloud-settings__actions { display: flex; gap: 8px; margin-top: 8px; flex-wrap: wrap; }
.sale-btn--danger { color: #8a1f1f; border-color: rgba(138, 31, 31, 0.4); }
.fiscal-cloud-settings__progress { margin-top: 10px; max-width: 520px; display: flex; flex-direction: column; gap: 6px; }
.fiscal-cloud-settings__log { margin: 0; padding: 0 0 0 16px; font-size: 11px; line-height: 1.4; max-height: 160px; overflow: auto; }
.fiscal-cloud-settings__log li { margin: 1px 0; font-family: "SF Mono", Menlo, Consolas, monospace; }
.fiscal-cloud-settings__log-ok { color: #0a7a2f; }
.fiscal-cloud-settings__log-skip { color: #777; }
.fiscal-cloud-settings__log-err { color: #8a1f1f; }
.fiscal-readiness__left { display: flex; flex-direction: column; gap: 2px; }
.fiscal-readiness__label {
  font-size: 9px;
  text-transform: uppercase;
  letter-spacing: 0.16em;
  color: #666;
  font-weight: 500;
}
.fiscal-readiness__body { font-size: 12px; text-transform: uppercase; letter-spacing: 0.04em; }
.fiscal-readiness__ok { color: #000; font-weight: 700; }
.fiscal-readiness__err { color: #d00000; font-weight: 500; }
.fiscal-readiness__providers { color: #666; font-variant-numeric: tabular-nums; }

.fiscal-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(420px, 1fr));
  gap: 0;
  align-items: stretch;
}
.fiscal-panel {
  background: #fff;
  border: 0;
  border-right: 1px solid #000;
  border-radius: 0;
  overflow: hidden;
}
.fiscal-panel:last-child { border-right: 0; }
@media (max-width: 1100px) {
  .fiscal-panel { border-right: 0; border-bottom: 1px solid #000; }
  .fiscal-panel:last-child { border-bottom: 0; }
}
.fiscal-panel__header {
  padding: 12px 20px;
  border-bottom: 1px solid #000;
  background: #fff;
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 12px;
}
.fiscal-panel__header h3 {
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: 0.16em;
  color: #000;
  font-weight: 700;
}
.fiscal-panel__body { padding: 20px; display: flex; flex-direction: column; gap: 14px; }

.fiscal-find { display: flex; gap: 0; }
.fiscal-find__input {
  flex: 1;
  padding: 12px 14px;
  border: 1px solid #000;
  border-right: 0;
  border-radius: 0;
  background: #fff;
  font-variant-numeric: tabular-nums;
  font-weight: 700;
  font-size: 14px;
  letter-spacing: 0.04em;
}
.fiscal-find .sale-btn { border-radius: 0; }

/* Client picker — sits below .fiscal-find in the Buscar venta panel.
   Clickable input that opens a filterable, scrollable list of registered
   pos_customer_fiscal_profiles. */
.fiscal-client-picker {
  display: flex;
  flex-direction: column;
  gap: 0;
  position: relative;
}
.fiscal-client-picker__input {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  padding: 12px 14px;
  border: 1px solid #000;
  background: #fff;
  cursor: pointer;
  font-size: 14px;
  font-weight: 700;
  letter-spacing: 0.04em;
  transition: background 80ms;
}
.fiscal-client-picker__input:hover { background: #f0f0f0; }
.fiscal-client-picker__input.is-selected { background: #000; color: #fff; }
.fiscal-client-picker__input.is-selected:hover { background: #111; }
.fiscal-client-picker__display {
  flex: 1;
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  text-transform: uppercase;
}
.fiscal-client-picker__caret { font-size: 10px; color: #666; }
.fiscal-client-picker__input.is-selected .fiscal-client-picker__caret { color: #ccc; }
.fiscal-client-picker__clear {
  background: transparent;
  border: 1px solid currentColor;
  color: inherit;
  padding: 0 6px;
  font-size: 14px;
  line-height: 1.2;
  cursor: pointer;
}
.fiscal-client-picker__dropdown {
  border: 1px solid #000;
  border-top: 0;
  background: #fff;
  display: flex;
  flex-direction: column;
  max-height: 360px;
  overflow: hidden;
}
.fiscal-client-picker__search {
  border: 0;
  border-bottom: 1px solid #000;
  border-radius: 0;
  padding: 10px 14px;
  font-size: 13px;
  font-weight: 500;
  letter-spacing: 0.02em;
}
.fiscal-client-picker__list {
  overflow-y: auto;
  max-height: 300px;
  scrollbar-gutter: stable;
}
.fiscal-client-picker__row {
  width: 100%;
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 8px;
  align-items: baseline;
  padding: 10px 14px;
  border: 0;
  border-top: 1px solid #000;
  background: #fff;
  text-align: left;
  cursor: pointer;
  font-size: 12px;
  transition: background 80ms;
}
.fiscal-client-picker__row:first-child { border-top: 0; }
.fiscal-client-picker__row:hover { background: #f0f0f0; }
.fiscal-client-picker__row-name {
  font-weight: 700;
  color: #000;
  text-transform: uppercase;
  letter-spacing: 0.02em;
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.fiscal-client-picker__row-rfc {
  font-size: 11px;
  color: #666;
  font-variant-numeric: tabular-nums;
  font-weight: 500;
  white-space: nowrap;
}
.fiscal-client-picker__empty {
  padding: 14px;
  text-align: center;
  color: #666;
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: 0.08em;
}

.fiscal-client-breakdown {
  display: flex;
  flex-direction: column;
  gap: 12px;
}

/* Credit-balance block shown above "Ventas recientes" when the selected
   client has outstanding credit tickets. Red-accented so the cashier
   sees it first. */
.fiscal-client-credit {
  display: flex;
  flex-direction: column;
  border: 1px solid #8a1f1f;
  background: #fff;
}
.fiscal-client-credit__header {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  padding: 10px 14px;
  background: #8a1f1f;
  color: #fff;
  font-size: 11px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.14em;
  font-variant-numeric: tabular-nums;
}
.fiscal-client-credit__list {
  display: flex;
  flex-direction: column;
  max-height: 240px;
  overflow-y: auto;
  scrollbar-gutter: stable;
}
.fiscal-client-credit__row {
  display: grid;
  grid-template-columns: 80px minmax(0, 1fr) auto;
  gap: 10px;
  padding: 10px 14px;
  border: 0;
  border-top: 1px solid rgba(138, 31, 31, 0.4);
  background: #fff;
  text-align: left;
  cursor: pointer;
  font-size: 12px;
  align-items: baseline;
  transition: background 80ms;
}
.fiscal-client-credit__row:first-child { border-top: 0; }
.fiscal-client-credit__row:hover { background: rgba(138, 31, 31, 0.06); }
.fiscal-client-credit__receipt { font-weight: 700; color: #000; font-variant-numeric: tabular-nums; }
.fiscal-client-credit__folio {
  font-size: 11px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.fiscal-client-credit__folio.is-stamped { color: #000; }
.fiscal-client-credit__folio.is-missing { color: #8a1f1f; font-weight: 500; }
.fiscal-client-credit__folio.is-error,
.fiscal-client-credit__folio.is-cancelled { color: #d00000; }
.fiscal-client-credit__folio.is-pending { color: #666; font-weight: 500; }
.fiscal-client-credit__balance { font-weight: 700; font-variant-numeric: tabular-nums; color: #8a1f1f; }

.fiscal-client-sales {
  display: flex;
  flex-direction: column;
  border: 1px solid #000;
  background: #fff;
}
.fiscal-client-sales__header {
  padding: 10px 14px;
  background: #000;
  color: #fff;
  font-size: 11px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.14em;
}
.fiscal-client-sales__list {
  display: flex;
  flex-direction: column;
  max-height: 320px;
  overflow-y: auto;
  scrollbar-gutter: stable;
}
.fiscal-client-sales__row {
  display: grid;
  grid-template-columns: 70px minmax(0, 1fr) auto auto;
  gap: 10px;
  padding: 10px 14px;
  border: 0;
  border-top: 1px solid #000;
  background: #fff;
  text-align: left;
  cursor: pointer;
  font-size: 12px;
  align-items: baseline;
  transition: background 80ms;
}
.fiscal-client-sales__row:hover { background: #f0f0f0; }
.fiscal-client-sales__receipt { font-weight: 700; color: #000; font-variant-numeric: tabular-nums; }
.fiscal-client-sales__folio {
  font-size: 11px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.fiscal-client-sales__folio.is-stamped { color: #000; }
.fiscal-client-sales__folio.is-missing { color: #999; font-weight: 500; }
.fiscal-client-sales__folio.is-error,
.fiscal-client-sales__folio.is-cancelled { color: #d00000; }
.fiscal-client-sales__folio.is-pending { color: #666; font-weight: 500; }
.fiscal-client-sales__meta {
  color: #666;
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.fiscal-client-sales__amount { font-weight: 700; font-variant-numeric: tabular-nums; color: #000; }

/* Placeholder shown in the middle "Timbrar CFDI" panel before a sale is
   selected. Sized to match .fiscal-find exactly — same border, same
   padding, same 14px font — so the two panels line up visually across
   the Fiscal tab. */
.fiscal-placeholder {
  margin: 0;
  padding: 12px 14px;
  border: 1px solid #000;
  background: #fff;
  color: #666;
  text-align: center;
  font-size: 14px;
  font-weight: 700;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: 44px;
}

.fiscal-sale {
  display: flex;
  flex-direction: column;
  gap: 6px;
  padding: 14px;
  border: 1px solid #000;
  background: #fff;
}
.fiscal-sale__primary { display: flex; justify-content: space-between; align-items: baseline; gap: 8px; }
.fiscal-sale__folio { font-size: 20px; font-weight: 700; font-variant-numeric: tabular-nums; color: #000; letter-spacing: -0.02em; }
.fiscal-sale__customer { font-weight: 700; color: #000; font-size: 12px; text-transform: uppercase; letter-spacing: 0.04em; }
.fiscal-sale__meta { font-size: 11px; color: #666; font-variant-numeric: tabular-nums; text-transform: uppercase; letter-spacing: 0.06em; }

.fiscal-docs { display: flex; flex-direction: column; gap: 0; margin-top: 6px; border: 1px solid #000; }
.fiscal-docs__title {
  font-size: 10px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.14em;
  color: #fff;
  background: #000;
  padding: 8px 14px;
}
.fiscal-doc {
  display: flex;
  flex-direction: column;
  align-items: stretch;
  gap: 8px;
  padding: 12px 14px;
  background: #fff;
  border: 0;
  border-top: 1px solid #000;
  border-radius: 0;
}
.fiscal-doc__left { display: flex; flex-direction: column; gap: 2px; }
.fiscal-doc:first-of-type { border-top: 0; }
.fiscal-doc.doc-stamped { background: #fff; }
.fiscal-doc.doc-stamp_error { background: #fde6e6; color: #8a1f1f; }
.fiscal-doc__label { font-weight: 700; color: inherit; font-size: 12px; text-transform: uppercase; letter-spacing: 0.04em; }
.fiscal-doc__uuid { font-size: 10px; color: #666; font-variant-numeric: tabular-nums; letter-spacing: 0.02em; }
.fiscal-doc__error {
  margin-top: 6px;
  padding: 6px 8px;
  background: #fff;
  border: 1px solid #8a1f1f;
  font-size: 11px;
  line-height: 1.4;
}
.fiscal-doc__error-code { font-weight: 700; color: #8a1f1f; margin-bottom: 2px; }
.fiscal-doc__error-message { color: #8a1f1f; word-break: break-word; }
.fiscal-doc__links { display: flex; gap: 4px; row-gap: 6px; flex-wrap: wrap; justify-content: flex-start; }
.fiscal-doc__links .sale-btn { flex-shrink: 0; white-space: nowrap; }

.fiscal-form { display: grid; grid-template-columns: 1fr; gap: 10px; }
.fiscal-form__actions { display: flex; justify-content: space-between; gap: 8px; margin-top: 6px; }
.fiscal-form__hint {
  font-size: 11px;
  color: #000;
  background: #fff5d9;
  border: 1px solid #000;
  padding: 6px 8px;
  margin-top: -6px;
  font-weight: 500;
}
.complement-mode {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 0;
}
.complement-mode .sale-btn { border-radius: 0; }
.complement-mode .sale-btn:first-child { border-right: 0; }

/* =======================  PLACEHOLDERS  ================================== */

.v2-placeholder {
  background: #fff;
  border: 1px dashed #000;
  border-radius: 0;
  padding: 72px 32px;
  text-align: center;
  color: #666;
}
.v2-placeholder h2 {
  color: #000;
  margin: 0 0 6px;
  font-size: 14px;
  text-transform: uppercase;
  letter-spacing: 0.14em;
}
.v2-placeholder p { margin: 0; font-size: 12px; text-transform: uppercase; letter-spacing: 0.04em; }

/* ==========================================================================
   Ajustes / Configuración tab
   ========================================================================== */
.ajustes {
  display: flex;
  flex-direction: column;
  gap: 16px;
  padding: 20px 24px 40px;
  max-width: 1100px;
  width: 100%;
  margin: 0 auto;
}
.ajustes__card {
  border: 1px solid #000;
  background: #fff;
  padding: 20px 24px;
  display: flex;
  flex-direction: column;
  gap: 16px;
}
.ajustes__card--muted { background: #f7f7f7; }
.ajustes__card-header { display: flex; flex-direction: column; gap: 4px; }
.ajustes__card-title {
  margin: 0;
  font-size: 16px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.08em;
}
.ajustes__card-subtitle {
  margin: 0;
  font-size: 12px;
  color: #555;
}
.ajustes__grid2 {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
}
.ajustes__kv {
  border: 1px solid #000;
  padding: 10px 14px;
  display: flex;
  flex-direction: column;
  gap: 4px;
  background: #fafafa;
}
.ajustes__kv-label {
  font-size: 10px;
  text-transform: uppercase;
  letter-spacing: 0.12em;
  color: #666;
}
.ajustes__kv-value { font-size: 13px; }
.ajustes__kv-value.mono {
  font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  font-size: 11px;
}
.ajustes__toolbar {
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
}
.ajustes__field {
  display: flex;
  flex-direction: column;
  gap: 6px;
}
.ajustes__field-label {
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: 0.12em;
  color: #555;
}
.ajustes__notice {
  padding: 10px 12px;
  border: 1px solid #000;
  font-size: 12px;
  line-height: 1.4;
}
.ajustes__notice--ok { background: #eafbe7; }
.ajustes__notice--warn { background: #fff7d6; }
.ajustes__notice--error { background: #fde7e7; }
.ajustes__notice--info { background: #e9f0fb; }

/* Employee access gate (patch #49) */
.ajustes__access-gates { display: flex; flex-direction: column; gap: 10px; margin: 12px 0 18px; }
.ajustes__access-gate-row {
  display: flex; align-items: center; justify-content: space-between; gap: 14px;
  padding: 12px; border: 1px solid #000; background: #fafafa;
}
.ajustes__access-gate-app { font-weight: 600; font-size: 13px; }
.ajustes__access-gate-state { font-size: 11px; color: #666; margin-top: 3px; }
.ajustes__access-gate-state--on { color: #0a7a2f; font-weight: 600; }
.ajustes__access-gate-caution { font-size: 11px; color: #8a1f1f; margin-top: 4px; max-width: 460px; }
.ajustes__access-pending-head {
  display: flex; align-items: center; justify-content: space-between; gap: 12px; margin-bottom: 8px;
}
.ajustes__access-pending-head h3 { margin: 0; font-size: 13px; }
.ajustes__access-list { display: flex; flex-direction: column; gap: 8px; }
.ajustes__access-item {
  display: flex; align-items: center; justify-content: space-between; gap: 12px;
  padding: 10px 12px; border: 1px solid #000;
}
.ajustes__access-item-name { font-weight: 600; font-size: 13px; }
.ajustes__access-item-email { font-weight: 400; color: #666; }
.ajustes__access-item-meta { font-size: 11px; color: #666; margin-top: 3px; }
.ajustes__access-item-actions { display: flex; gap: 6px; flex-shrink: 0; }
.ajustes__empty {
  padding: 20px;
  border: 1px dashed #aaa;
  text-align: center;
  font-size: 12px;
  color: #666;
}

/* Price rows ------------------------------------------------------------ */
.ajustes__price-list {
  display: flex;
  flex-direction: column;
  gap: 4px;
  max-height: 60vh;
  overflow-y: auto;
  border: 1px solid #000;
}
.ajustes__price-row {
  display: grid;
  grid-template-columns: 80px 1fr 180px 120px;
  align-items: center;
  gap: 12px;
  padding: 10px 14px;
  border-bottom: 1px solid #eee;
  background: #fff;
}
.ajustes__price-row:last-child { border-bottom: 0; }
.ajustes__price-code {
  font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  font-size: 12px;
  font-weight: 600;
}
.ajustes__price-main { display: flex; flex-direction: column; gap: 2px; min-width: 0; }
.ajustes__price-name {
  font-size: 13px;
  font-weight: 600;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.ajustes__price-meta {
  font-size: 11px;
  color: #666;
}
.ajustes__price-input { display: flex; flex-direction: column; gap: 4px; }
.ajustes__price-input .ajustes__field-label { font-size: 10px; }
.ajustes__price-actions { display: flex; justify-content: flex-end; gap: 8px; flex-wrap: wrap; }
.ajustes__plu-export {
  display: flex; gap: 12px; align-items: center; flex-wrap: wrap;
  padding: 8px 0 0;
}

.inventario__lowstock {
  display: flex; gap: 12px; align-items: center; flex-wrap: wrap;
  padding: 10px 18px; border-bottom: 1px solid #000; background: #fafafa;
}
.inventario__lowstock-threshold {
  display: flex; gap: 6px; align-items: center;
  font-size: 11px; font-weight: 700; text-transform: uppercase; letter-spacing: 0.08em;
}
.inventario__lowstock-input {
  width: 80px; text-align: right; padding: 4px 8px;
}

/* Audit log table (Ajustes → Bitácora). Manager-only, append-only —
   the rows render dense + tabular so a quick scan reveals patterns
   (lots of cancellations on date X, etc.). */
.ajustes__audit { display: flex; flex-direction: column; gap: 12px; }
.ajustes__audit-list {
  display: flex; flex-direction: column;
  border: 1px solid #000;
  max-height: 480px; overflow-y: auto;
}
.ajustes__audit-row {
  display: grid;
  grid-template-columns: minmax(200px, 1.4fr) minmax(0, 2fr) auto;
  gap: 12px;
  padding: 8px 12px;
  border-bottom: 1px solid #e0e0e0;
  font-size: 12px;
  align-items: start;
}
.ajustes__audit-row:last-child { border-bottom: 0; }
.ajustes__audit-row:hover { background: #fafafa; }
.ajustes__audit-row.is-failed { background: #fff5f5; }
.ajustes__audit-row.is-failed:hover { background: #ffe8e8; }
.ajustes__audit-event { font-weight: 700; text-transform: uppercase; letter-spacing: 0.04em; font-size: 11px; }
.ajustes__audit-actor { font-size: 11px; color: #666; margin-top: 2px; }
.ajustes__audit-cell--target { color: #333; word-break: break-word; }
.ajustes__audit-cell--ts { font-variant-numeric: tabular-nums; font-size: 11px; color: #666; white-space: nowrap; }
.ajustes__plu-hint {
  font-size: 11px; color: #666; font-style: italic;
}

/* Ownership help list --------------------------------------------------- */
.ajustes__help-list { display: flex; flex-direction: column; gap: 10px; }
.ajustes__help-item {
  border-left: 3px solid #000;
  padding: 8px 12px;
  background: #fafafa;
}
.ajustes__help-title {
  font-size: 12px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  margin-bottom: 2px;
}
.ajustes__help-body { font-size: 12px; color: #333; line-height: 1.4; }

@media (max-width: 800px) {
  .ajustes__grid2 { grid-template-columns: 1fr; }
  .ajustes__price-row {
    grid-template-columns: 1fr;
    gap: 6px;
  }
  .ajustes__price-code { font-size: 14px; }
  .ajustes__price-actions { justify-content: flex-start; }
}

/* Ajustes bridge card — checkbox row + helper copy */
.ajustes__checkbox {
  display: flex;
  align-items: center;
  gap: 10px;
  border: 1px solid #000;
  padding: 10px 14px;
  background: #fafafa;
  font-size: 13px;
  line-height: 1.4;
  cursor: pointer;
}
.ajustes__field-helper {
  font-size: 11px;
  color: #666;
  line-height: 1.4;
}
.ajustes__card code {
  font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  font-size: 11px;
  background: #fff;
  border: 1px solid #ddd;
  padding: 1px 4px;
  border-radius: 2px;
}

/* Corte Z PIN confirmation pane (renders inside the Corte Z modal after
   the cashier clicks "Solicitar cierre Corte Z") */
.cortez-pin-pane {
  border-top: 2px solid #000;
  padding-top: 14px;
  margin-top: 14px;
  display: flex;
  flex-direction: column;
  gap: 10px;
}
.cortez-pin-pane__banner {
  padding: 10px 14px;
  background: #fff7d6;
  border: 1px solid #000;
  font-size: 13px;
  line-height: 1.4;
}
.cortez-pin-pane__actions {
  display: flex;
  gap: 10px;
  justify-content: flex-end;
  flex-wrap: wrap;
}

/* Fiscal documents card in the history detail (invoices + complements) */
.history-detail__fiscal {
  border-top: 1px solid #000;
  padding-top: 10px;
  margin-top: 10px;
  display: flex;
  flex-direction: column;
  gap: 8px;
}
.history-detail__fiscal-title {
  font-size: 11px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.08em;
}
.history-detail__fiscal-empty {
  font-size: 12px;
  color: #666;
}
.history-detail__fiscal-error {
  font-size: 12px;
  color: #8a1f1f;
  padding: 6px 8px;
  background: #fde7e7;
  border: 1px solid #000;
}
.history-detail__fiscal-list {
  display: flex;
  flex-direction: column;
  gap: 6px;
}
.history-detail__fiscal-row {
  padding: 8px 10px;
  border: 1px solid #000;
  background: #fafafa;
  display: flex;
  flex-direction: column;
  gap: 6px;
}
.history-detail__fiscal-line {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  align-items: center;
  font-size: 12px;
}
.history-detail__fiscal-kind {
  padding: 2px 6px;
  font-size: 10px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  border: 1px solid #000;
  background: #fff;
}
.history-detail__fiscal-kind--ok { background: #eafbe7; }
.history-detail__fiscal-kind--warn { background: #fff7d6; }
.history-detail__fiscal-kind--error { background: #fde7e7; }
.history-detail__fiscal-meta { color: #333; }
.history-detail__fiscal-uuid {
  font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  font-size: 10px;
  color: #666;
}
.history-detail__fiscal-status {
  margin-left: auto;
  font-size: 10px;
  font-weight: 700;
  text-transform: uppercase;
  padding: 2px 6px;
  border: 1px solid #000;
}
.history-detail__fiscal-status--ok { background: #eafbe7; }
.history-detail__fiscal-status--warn { background: #fff7d6; }
.history-detail__fiscal-status--error { background: #fde7e7; }
.history-detail__fiscal-actions {
  display: flex;
  gap: 6px;
  flex-wrap: wrap;
}

/* =======================  DISCOUNT MODAL  ================================ */
.modal--discount { width: min(640px, 100%); }
.discount-body { display: flex; flex-direction: column; gap: 14px; }
.discount-field { display: flex; flex-direction: column; gap: 4px; }
.discount-preview {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  border-top: 1px solid #000;
  border-left: 1px solid #000;
  margin-top: 4px;
}
.discount-cell {
  border-right: 1px solid #000;
  border-bottom: 1px solid #000;
  padding: 10px 14px;
  display: flex;
  flex-direction: column;
  gap: 2px;
  background: #fff;
  min-width: 0;
}
.discount-cell__label {
  font-size: 9px;
  text-transform: uppercase;
  letter-spacing: 0.14em;
  color: #666;
  font-weight: 500;
}
.discount-cell__value {
  font-size: 16px;
  font-weight: 700;
  font-variant-numeric: tabular-nums;
  color: #000;
  letter-spacing: -0.01em;
}
.discount-cell.is-accent { background: #000; }
.discount-cell.is-accent .discount-cell__label { color: #fff; }
.discount-cell.is-accent .discount-cell__value { color: #fff; }
.modal__hint { font-size: 11px; color: #666; font-style: italic; }

/* Inventario screen (manager-only) ----------------------------------------- */
.inventario { padding: 18px 22px; max-width: 1200px; margin: 0 auto; }
.inventario__card {
  border: 1px solid #000; background: #fff;
  display: flex; flex-direction: column;
}
.inventario__header { padding: 16px 18px; border-bottom: 1px solid #000; }
.inventario__title { margin: 0; font-size: 16px; font-weight: 700; letter-spacing: 0.04em; text-transform: uppercase; }
.inventario__subtitle { margin: 6px 0 0; font-size: 12px; color: #444; line-height: 1.4; }
.inventario__empty { padding: 32px; text-align: center; color: #666; font-size: 13px; }
.inventario__table-wrap { overflow-x: auto; }
.inventario__table { display: flex; flex-direction: column; min-width: 720px; }
.inventario__row {
  display: grid;
  grid-template-columns: 80px minmax(0, 2fr) minmax(0, 1.6fr) 160px 130px;
  border-bottom: 1px solid #eee;
  align-items: center;
}
.inventario__row:last-child { border-bottom: 0; }
.inventario__row:hover:not(.inventario__row--head) { background: #f7f7f7; }
/* Out-of-stock rows render greyed out so the table reads as
   "available" first, "informational" second. Price still renders so
   the manager can see the configured price even when stock is 0. */
.inventario__row--empty { background: #fafafa; color: #888; }
.inventario__row--empty .inventario__cell--stock { color: #999; }
.inventario__row--empty .inventario__price-amount { color: #888; }
.inventario__row--head {
  background: #000; color: #fff;
  font-size: 11px; text-transform: uppercase; letter-spacing: 0.08em; font-weight: 700;
  position: sticky; top: 0; z-index: 1;
}
.inventario__cell { padding: 10px 12px; font-size: 13px; min-width: 0; }
.inventario__cell--code { text-align: center; font-weight: 600; }
.inventario__cell--name { font-weight: 600; }
.inventario__cell--product { color: #555; font-size: 12px; }
.inventario__cell--price { text-align: right; }
.inventario__cell--stock { text-align: right; font-weight: 600; }
.inventario__price-amount { font-weight: 700; }
.inventario__price-model { font-size: 11px; color: #666; text-transform: lowercase; }

/* Hide-SKU dropdown + chips ----------------------------------------------- */
.inventario__controls {
  padding: 12px 18px; border-bottom: 1px solid #000;
  display: flex; flex-direction: column; gap: 10px; background: #fafafa;
}
.inventario__hide-field { display: flex; flex-direction: column; gap: 6px; max-width: 600px; }
.inventario__hide-label {
  font-size: 10px; text-transform: uppercase; letter-spacing: 0.14em;
  color: #000; font-weight: 700;
}
.inventario__hide-select {
  width: 100%; padding: 4px; border: 1px solid #000; background: #fff;
  font: inherit; font-size: 12px; line-height: 1.3;
}
.inventario__hide-select option { padding: 4px 8px; }
.inventario__hide-select option:checked {
  background: #000 linear-gradient(0deg, #000, #000); color: #fff;
}
.inventario__hide-actions { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; }
.inventario__hidden-list {
  display: flex; flex-wrap: wrap; gap: 6px; align-items: center;
  font-size: 12px;
}
.inventario__hidden-label {
  font-size: 11px; color: #444; font-weight: 600;
  text-transform: uppercase; letter-spacing: 0.06em;
  margin-right: 4px;
}
.inventario__chip {
  display: inline-flex; align-items: center; gap: 6px;
  padding: 4px 8px; border: 1px solid #000; background: #fff;
  font-size: 12px; cursor: pointer;
}
.inventario__chip:hover { background: #f0f0f0; }
.inventario__chip-code { font-weight: 700; }
.inventario__chip-name { color: #333; }
.inventario__chip-x { color: #8a1f1f; font-weight: 700; margin-left: 2px; }

/* ===========================================================================
   Bucket snapshot view (ported from inventory-v2)
   --------------------------------------------------------------------------- */
.inventario__view-toggle {
  display: flex; gap: 6px; padding: 10px 18px;
  border-bottom: 1px solid #000; background: #fafafa;
}
.inventario__snapshot-controls {
  /* Tighter than the SKU view's controls block — fits the datetime input
     + Ver / Ahora buttons on one row most of the time. */
  background: #fff;
}
.inventario__snapshot-controls .modal__input { max-width: 280px; }
.inventario__toggle { display: inline-flex; gap: 8px; align-items: center; font-size: 12px; }
.inventario__toggle input { accent-color: #000; }
/* Bucket-mode table is 4 columns: SKU(s) / Producto / Calidad / kg */
.inventario__table--bucket .inventario__row {
  grid-template-columns: minmax(110px, 0.8fr) minmax(180px, 1.8fr) minmax(140px, 1.2fr) minmax(100px, 0.6fr);
}
.inventario__cell--bucket-sku { font-weight: 600; }
.inventario__row--negative .inventario__cell--stock { color: #8a1f1f; }
.inventario__row--bucket.inventario__row--empty { background: #fafafa; color: #888; }
.inventario__row--foot {
  background: #f0f0f0; font-weight: 700; border-top: 2px solid #000;
}
.inventario__sort-btn {
  display: block; width: 100%; box-sizing: border-box;
  background: transparent; border: 0; color: inherit; font: inherit;
  cursor: pointer; padding: 10px 12px;
  text-align: left;
  text-transform: inherit; letter-spacing: inherit; font-weight: inherit;
}
.inventario__sort-btn.inventario__cell--stock { text-align: right; }
.inventario__sort-btn:hover { background: rgba(255,255,255,0.12); }
.inventario__sort-btn.is-active { color: #fff; }

/* -------------------------------------------------------------------------- */
/* Purchase Orders (Compras) — patch #60                                      */
/* -------------------------------------------------------------------------- */
.purchase-orders { padding: 24px; display: flex; flex-direction: column; gap: 24px; }
.purchase-orders__hero { display: flex; flex-direction: column; gap: 8px; }
.purchase-orders__title { font-size: 28px; font-weight: 700; margin: 0; color: #fff; }
.purchase-orders__subtitle { font-size: 13px; color: rgba(255,255,255,0.7); margin: 0; max-width: 800px; line-height: 1.45; }
.purchase-orders__layout { display: grid; grid-template-columns: minmax(360px, 480px) 1fr; gap: 24px; align-items: flex-start; }
@media (max-width: 1100px) { .purchase-orders__layout { grid-template-columns: 1fr; } }
.purchase-orders__col { display: flex; flex-direction: column; gap: 16px; }
.purchase-orders__form { display: flex; flex-direction: column; gap: 14px; padding: 16px; }
/* div-scoped: the Compras LIST <tr> also carries .purchase-orders__row but must
   keep its native 7-column table-row layout — only the form's <div> rows get
   the 2-col grid. (Without `div`, the <tr> cells flowed 2-wide, misaligned from
   the headers.) */
div.purchase-orders__row { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.purchase-orders__field { display: flex; flex-direction: column; gap: 4px; }
.purchase-orders__hint { color: rgba(0,0,0,0.5); font-weight: 400; font-size: 11px; text-transform: none; letter-spacing: 0; }
.purchase-orders__divider { border: none; border-top: 1px dashed rgba(0,0,0,0.18); margin: 4px 0; }
.purchase-orders__radio-row { display: flex; gap: 12px; }
.purchase-orders__radio {
  display: inline-flex; align-items: center; gap: 6px; padding: 8px 14px;
  border: 1px solid rgba(0,0,0,0.25); border-radius: 6px; cursor: pointer;
  background: #fff; font-weight: 600; font-size: 13px;
}
.purchase-orders__radio.is-selected { background: #000; color: #fff; border-color: #000; }
.purchase-orders__radio input { accent-color: currentColor; }
.purchase-orders__preview {
  display: flex; align-items: center; gap: 10px; margin-top: 6px;
  border: 1px solid rgba(0,0,0,0.15); padding: 8px; background: #fafafa;
}
.purchase-orders__preview-img {
  max-width: 140px; max-height: 90px; object-fit: cover; display: block;
  border: 1px solid rgba(0,0,0,0.1);
}
.purchase-orders__form-footer { display: flex; justify-content: space-between; gap: 12px; padding-top: 8px; }
.purchase-orders__filters {
  display: grid; grid-template-columns: 1fr 140px; gap: 12px; padding: 0 16px 12px;
}
.purchase-orders__table { width: 100%; border-collapse: collapse; font-size: 13px; }
.purchase-orders__table th, .purchase-orders__table td {
  padding: 8px 10px; text-align: left; border-bottom: 1px solid rgba(0,0,0,0.08);
}
.purchase-orders__table th { font-weight: 600; color: rgba(0,0,0,0.65); font-size: 11px; text-transform: uppercase; letter-spacing: 0.04em; }
.purchase-orders__table td.is-right, .purchase-orders__table th.is-right { text-align: right; font-variant-numeric: tabular-nums; }
/* Center the whole Compras list — every header + cell (matches the archive
   Compras tab). Placed after the rules above so it overrides the base td
   (left) and is-right (right) by source order at equal specificity. */
.purchase-orders__table th, .purchase-orders__table td { text-align: center; }
.purchase-orders__table th.is-right, .purchase-orders__table td.is-right { text-align: center; }
.purchase-orders__row { cursor: pointer; }
.purchase-orders__row:hover { background: rgba(0,0,0,0.04); }
.purchase-orders__row.is-selected { background: rgba(0,0,0,0.08); font-weight: 600; }
.purchase-orders__detail-actions { display: flex; gap: 8px; flex-wrap: wrap; align-items: center; }
/* --- Cancelación de órdenes de compra ------------------------------------ */
/* A cancelled row must survive a fast scan of a dense table: red left rule +
   struck folio, but only a LIGHT mute — a heavily grayed row reads as
   "still loading". */
.purchase-orders__row.is-cancelled {
  border-inline-start: 3px solid #dc2626;
  background: rgba(220, 38, 38, 0.04);
}
.purchase-orders__row.is-cancelled td { opacity: 0.85; }
.purchase-orders__readonly-tag {
  display: inline-block;
  padding: 2px 8px;
  border: 1px solid rgba(0, 0, 0, 0.25);
  border-radius: 999px;
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.03em;
  opacity: 0.7;
  white-space: nowrap;
}
.purchase-orders__cancelled-tag {
  display: inline-block;
  padding: 2px 8px;
  border: 1px solid #dc2626;
  border-radius: 999px;
  color: #dc2626;
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.03em;
  white-space: nowrap;
}
.purchase-orders__cancel-banner {
  margin: 12px 0;
  padding: 12px 14px;
  border: 1px solid #dc2626;
  border-inline-start-width: 5px;
  border-radius: 8px;
  background: rgba(220, 38, 38, 0.06);
}
.purchase-orders__cancel-banner-title {
  font-weight: 800;
  letter-spacing: 0.04em;
  color: #b91c1c;
}
.purchase-orders__cancel-banner-meta { font-size: 12px; opacity: 0.8; margin-top: 2px; }
.purchase-orders__cancel-banner-reason { font-size: 13px; margin-top: 6px; }
.purchase-orders__cancel-banner-warn {
  margin-top: 8px;
  font-size: 12px;
  font-weight: 600;
  color: #b91c1c;
}
.purchase-orders__cancel-block {
  margin-top: 16px;
  padding-top: 12px;
  border-top: 1px solid rgba(0, 0, 0, 0.12);
}
.purchase-orders__cancel-hint { font-size: 12px; opacity: 0.75; margin-bottom: 6px; }
.purchase-orders__cancel-actions {
  display: flex;
  gap: 8px;
  align-items: center;
  margin-top: 8px;
  flex-wrap: wrap;
}

.purchase-orders__locked { font-size: 11px; font-weight: 700; color: #8a1f1f; letter-spacing: 0.04em; }
.purchase-orders__edit { margin-top: 8px; }
.purchase-orders__factura-quick { margin: 12px 0 4px; padding: 10px 12px; border: 1px solid #e2e2e2; border-radius: 10px; background: #fafafa; }
.purchase-orders__factura-row { display: flex; gap: 8px; align-items: center; margin-top: 4px; }
.purchase-orders__factura-row .modal__input { flex: 1 1 auto; }
.purchase-orders__factura-row .sale-btn { flex: 0 0 auto; }
.purchase-orders__factura-err { font-size: 12px; color: #8a1f1f; margin: 6px 0 0; }
.purchase-orders__detail-grid {
  display: grid; grid-template-columns: 1fr 1fr; gap: 12px 24px; padding: 16px; margin: 0;
}
.purchase-orders__kv { display: flex; flex-direction: column; gap: 2px; }
.purchase-orders__kv dt { font-size: 11px; color: rgba(0,0,0,0.55); text-transform: uppercase; letter-spacing: 0.04em; font-weight: 600; margin: 0; }
.purchase-orders__kv dd { margin: 0; font-size: 14px; color: #000; }
.purchase-orders__photo { padding: 0 16px 16px; display: flex; flex-direction: column; gap: 8px; }
.purchase-orders__photo h3 { margin: 0; font-size: 13px; color: rgba(0,0,0,0.65); text-transform: uppercase; letter-spacing: 0.04em; }
.purchase-orders__photo-img { max-width: 100%; max-height: 320px; object-fit: contain; border: 1px solid rgba(0,0,0,0.12); }

/* v39 — selected-files summary on the create form (multi-select) */
.purchase-orders__files { display: flex; flex-direction: column; gap: 6px; margin-top: 4px; align-items: flex-start; }
.purchase-orders__files-count { margin: 0; font-size: 12px; color: rgba(0,0,0,0.6); }
.purchase-orders__files-list { margin: 0; padding-left: 18px; font-size: 13px; display: flex; flex-direction: column; gap: 2px; }
.purchase-orders__files-list li { overflow-wrap: anywhere; min-width: 0; }

/* v39 — extra attachments block on the PO detail */
.purchase-orders__attachments { padding: 0 16px 16px; display: flex; flex-direction: column; gap: 8px; }
.purchase-orders__attachments h3 { margin: 0; font-size: 13px; color: rgba(0,0,0,0.65); text-transform: uppercase; letter-spacing: 0.04em; }
.purchase-orders__attach-list { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 6px; }
.purchase-orders__attach-row { display: flex; align-items: center; gap: 10px; padding: 6px 10px; border: 1px solid rgba(0,0,0,0.1); border-radius: 8px; background: #fafafa; min-width: 0; }
.purchase-orders__attach-name { flex: 1 1 auto; min-width: 0; overflow-wrap: anywhere; font-size: 13px; }
.purchase-orders__attach-size { flex: 0 0 auto; font-size: 11px; color: rgba(0,0,0,0.55); font-variant-numeric: tabular-nums; }
.purchase-orders__attach-add { display: flex; flex-direction: column; gap: 4px; max-width: 480px; }
.purchase-orders__attach-progress { margin: 0; font-size: 12px; color: rgba(0,0,0,0.6); }
.purchase-orders__attach-err { margin: 0; font-size: 12px; color: #8a1f1f; }
.purchase-orders__attach-delete--armed { color: #8a1f1f; border-color: #8a1f1f; font-weight: 700; }

/* Patch #61 — retiro auth threshold editor inside the access-gate card */
.ajustes__threshold-row {
  display: grid; grid-template-columns: 1fr auto; gap: 16px; align-items: end;
  padding: 12px 16px; border-top: 1px dashed rgba(0,0,0,0.18); background: #fafafa;
}
.ajustes__threshold-meta { display: flex; flex-direction: column; gap: 4px; }
.ajustes__threshold-input { display: flex; gap: 8px; align-items: center; }
.ajustes__threshold-input input { width: 140px; }


/* =============================================================================
   MOBILE RESPONSIVE — @media (max-width: 640px)   v4
   iPhone Air / phone. Designed to feel native-compact, not desktop-squished.
   Kiosk terminals never hit this breakpoint — desktop layout untouched.
   ============================================================================= */
@media (max-width: 640px) {

  /* ── No page-level horizontal scroll ───────────────────────────────────── */
  html, body { overflow-x: hidden; }
  .v2-main { overflow-x: hidden; }

  /* ── Topbar ──────────────────────────────────────────────────────────────── */
  /* Row 1: brand | [cashier grows] | refresh | signout
     Row 2: nav tabs full-width scrollable
     Safe-area padding prevents SALIR from touching the rounded screen edge. */
  .v2-topbar {
    flex-wrap: wrap;
    padding-right: env(safe-area-inset-right, 0px);
  }

  .v2-topbar__brand {
    flex: 0 0 auto; order: 1;
    padding: 7px 10px; border-right: 0;
  }
  .v2-topbar__brand-name { font-size: 11px; }
  .v2-topbar__brand-badge { font-size: 9px; padding: 1px 4px; }

  .v2-topbar__version { display: none; order: 0; }

  .v2-topbar__weather { order: 2; padding: 6px 10px; margin-left: 0; }
  .v2-topbar__weather-icon { font-size: 15px; }
  .v2-topbar__weather-temp { font-size: 13px; }
  .v2-topbar__cashier {
    flex: 1 1 0; order: 3; width: auto; min-width: 0;
    padding: 5px 8px; border-left: 1px solid #000; align-items: flex-end;
    overflow: hidden;
  }
  .v2-topbar__cashier-label {
    font-size: 8px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; max-width: 100%;
  }
  .v2-topbar__cashier-name {
    font-size: 10px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; max-width: 100%;
  }

  .v2-topbar__refresh {
    order: 4; flex: 0 0 auto;
    padding: 7px 10px; width: 36px; font-size: 14px; letter-spacing: 0;
  }
  .v2-topbar__signout {
    order: 5; flex: 0 0 auto;
    padding: 7px 10px; width: auto; font-size: 9px; letter-spacing: 0.04em;
    /* Ensure last button never clips behind rounded screen corners */
    padding-right: max(10px, env(safe-area-inset-right, 10px));
  }

  /* Nav — pushed to its own full-width row via order */
  .v2-topbar__nav {
    order: 99; flex: 0 0 100%; width: 100%;
    border-top: 1px solid #000;
    overflow-x: auto; -webkit-overflow-scrolling: touch; scrollbar-width: none;
    /* Right-side fade gradient hints that more tabs are to the right */
    -webkit-mask-image: linear-gradient(to right, #000 85%, transparent 100%);
    mask-image: linear-gradient(to right, #000 85%, transparent 100%);
  }
  .v2-topbar__nav::-webkit-scrollbar { display: none; }
  .v2-topbar__nav button {
    padding: 9px 14px; font-size: 10px; flex: 0 0 auto; white-space: nowrap;
  }
  /* Remove the fade when the active tab is near the right end so its
     selected state (black bg) isn't clipped by the mask. */
  .v2-topbar__nav button[aria-current="page"]:last-child ~ * {
    -webkit-mask-image: none; mask-image: none;
  }

  /* ── Sale screen ─────────────────────────────────────────────────────────── */
  .sale-grid { grid-template-columns: 1fr; }
  .sale-panel { padding: 10px 12px; gap: 12px; overflow: hidden; }
  .sale-panel--right { border-left: 0; border-top: 1px solid #000; }

  /* Lines table — horizontally scrollable */
  .sale-lines__table { overflow-x: auto; -webkit-overflow-scrolling: touch; }
  .sale-lines__row {
    grid-template-columns: minmax(110px, 2fr) minmax(90px, 1.4fr) 76px 84px 30px;
    gap: 6px; padding: 8px 10px;
  }
  .sale-lines__row--head { padding: 6px 10px; }
  .sale-lines__title { font-size: 10px; }
  .sku-name { font-size: 12px; }
  .qty-input { width: 56px; font-size: 12px; padding: 6px 8px; }

  /* Grand total — compact */
  .sale-totals__grand-value { font-size: 36px; }
  .sale-totals { padding-bottom: 12px; gap: 4px; }
  .sale-totals__grand { padding-top: 8px; }

  /* Payment picker — 4 buttons in one horizontal row */
  .sale-payment-picker__buttons {
    grid-template-columns: 1fr 1fr 1fr 1fr !important;
  }
  .sale-payment-btn {
    padding: 10px 4px; font-size: 10px; letter-spacing: 0.03em;
    border-right: 1px solid #000 !important;
    border-bottom: 0 !important;
    white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
  }
  .sale-payment-btn:last-child { border-right: 0 !important; }

  /* SKU code float — full-width strip */
  .sale-code-float {
    right: 0; bottom: 0; left: 0; width: 100%;
    border-left: 0; border-right: 0; border-bottom: 0; box-shadow: none;
    padding: 6px 12px max(10px, env(safe-area-inset-bottom, 10px));
  }

  /* ── Caja screen ─────────────────────────────────────────────────────────── */
  .cash-header { flex-direction: column; padding: 0; }
  .cash-header__left { padding: 8px 12px; }
  .cash-header__label { font-size: 8px; white-space: nowrap; }
  .cash-header__folio { font-size: 16px; }

  .cash-header__metrics {
    overflow-x: auto; -webkit-overflow-scrolling: touch;
    scrollbar-width: none; flex-wrap: nowrap; border-top: 1px solid #000;
  }
  .cash-header__metrics::-webkit-scrollbar { display: none; }
  .cash-metric {
    min-width: 80px; flex-shrink: 0; padding: 8px 10px; gap: 2px;
  }
  .cash-metric__label {
    font-size: 8px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
  }
  .cash-metric__value { font-size: 13px; }
  .cash-metric.is-accent .cash-metric__value { font-size: 15px; }

  .cash-header__actions {
    overflow-x: auto; -webkit-overflow-scrolling: touch;
    scrollbar-width: none; flex-wrap: nowrap; border-top: 1px solid #000;
  }
  .cash-header__actions::-webkit-scrollbar { display: none; }
  .cash-header__actions .sale-btn {
    flex: 0 0 auto; white-space: nowrap; font-size: 10px; padding: 10px 12px;
  }
  .cash-grid { grid-template-columns: 1fr; }

  /* ── History screen ──────────────────────────────────────────────────────── */
  .history-header { flex-direction: column; padding: 0; }
  .history-header__left { padding: 8px 12px; flex-wrap: wrap; gap: 6px; }
  .history-header__actions {
    padding: 6px 12px; flex-wrap: wrap; gap: 6px; border-top: 1px solid #000;
  }
  .history-grid { grid-template-columns: 1fr; }
  .history-list {
    border-right: 0; border-bottom: 1px solid #000;
    max-height: 38dvh; overflow-y: auto; -webkit-overflow-scrolling: touch;
  }
  .history-detail { padding: 12px; }

  /* ── Modals — bottom sheet ───────────────────────────────────────────────── */
  .modal-overlay { align-items: flex-end; padding: 0; }
  .modal {
    width: 100% !important; max-width: 100% !important; min-width: 0 !important;
    border-radius: 16px 16px 0 0; margin: 0;
    max-height: 92dvh; overflow-y: auto; -webkit-overflow-scrolling: touch;
  }
  .modal__body { padding: 12px 14px; }
  .modal__header { padding: 10px 14px; }
  .modal__footer { padding: 10px 14px; flex-wrap: wrap; gap: 8px; }
  .modal__footer .sale-btn { flex: 1 1 auto; min-width: 0; }
  .modal__fields { grid-template-columns: 1fr !important; }

  /* ── Buttons ─────────────────────────────────────────────────────────────── */
  .sale-btn { min-height: 42px; }
  .sale-btn--sm { min-height: 34px; font-size: 11px; }

  /* ── Ajustes ─────────────────────────────────────────────────────────────── */
  .ajustes__grid { grid-template-columns: 1fr !important; }
  .ajustes__card { padding: 12px; }

  /* ── Compras (purchase orders) ───────────────────────────────────────────── */
  .purchase-orders { padding: 12px; gap: 12px; min-width: 0; }
  /* Hero title is white (built for a dark section) → invisible on the white
     mobile background, leaving a big empty gap. Make it dark + compact and drop
     the verbose subtitle so the form starts near the top. */
  .purchase-orders__title { color: #000; font-size: 18px; }
  .purchase-orders__subtitle { display: none; }
  .purchase-orders__layout { gap: 12px; }
  .purchase-orders__col { min-width: 0; gap: 12px; }
  .purchase-orders__form { padding: 12px; gap: 10px; min-width: 0; }
  /* Stack the paired form fields (peso/cajas, precio/importe, cotizó/autorizó)
     into one column so the second field stops being clipped off the right edge.
     Form-scoped, so it never touches the list table's <tr>. */
  .purchase-orders__form .purchase-orders__row { grid-template-columns: 1fr; }
  .purchase-orders__radio-row { flex-wrap: wrap; }
  .purchase-orders__form-footer { flex-direction: column-reverse; gap: 8px; }
  .purchase-orders__form-footer .sale-btn { width: 100%; }
  .purchase-orders__detail-grid { grid-template-columns: 1fr !important; padding: 12px; }
  .purchase-orders__detail-actions .sale-btn { flex: 1 1 auto; }
  .purchase-orders__filters { grid-template-columns: 1fr !important; }
  .purchase-orders__table { display: block; overflow-x: auto; white-space: nowrap; }
  .purchase-orders__photo-img { max-height: 220px; }
  /* v39 — attachment rows wrap instead of overflowing the narrow card */
  .purchase-orders__attachments { padding: 0 12px 12px; }
  .purchase-orders__attach-row { flex-wrap: wrap; }
  .purchase-orders__attach-row .sale-btn { flex: 1 1 100%; }
  .purchase-orders__attach-add { max-width: 100%; }

  /* ── Floating chips ──────────────────────────────────────────────────────── */
  .v2-floating-chips {
    left: 8px !important; right: 8px !important;
    width: auto !important; max-width: none !important;
    bottom: max(14px, env(safe-area-inset-bottom, 14px)) !important;
  }

  /* ── Fiscal ──────────────────────────────────────────────────────────────── */
  .fiscal-form__profile-row { flex-direction: column; }

  /* PAC readiness bar — stack vertically so status + button each get full width */
  .fiscal-readiness {
    flex-direction: column; align-items: flex-start; gap: 10px; padding: 12px 14px;
  }
  .fiscal-readiness__left { width: 100%; }

  /* Fiscal panels */
  .fiscal-panel__body { padding: 12px 14px; gap: 10px; }
  .fiscal-panel__header { padding: 10px 14px; }

  /* fiscal-card: unstyled wrapper used by the Complemento multi-factura section —
     add padding so the heading and content don't sit at the raw screen edge. */
  .fiscal-card { padding: 12px 14px; border-bottom: 1px solid #000; }
  .fiscal-card__header {
    display: flex; justify-content: space-between; align-items: center;
    gap: 10px; margin-bottom: 8px;
  }
  .fiscal-card__header h3 { margin: 0; font-size: 14px; flex: 1 1 auto; }

  /* Standalone action buttons inside fiscal panels/cards — full width on mobile
     so they're easy to tap and don't look like orphaned inline elements. */
  .fiscal-panel__body > .sale-btn,
  .fiscal-card > .sale-btn,
  .fiscal-cloud-settings > .sale-btn,
  .fiscal-cloud-settings__actions .sale-btn { width: 100%; }

  /* All-fiscal-docs modal filters — 2-column on mobile (4 is too tight) */
  .all-fiscal-docs__filters { grid-template-columns: 1fr 1fr !important; }

  /* ── Inventario tab ──────────────────────────────────────────────────────── */
  .inventario__card { max-width: 100%; overflow: hidden; }
  .inventario__header { padding: 12px 14px; }
  .inventario__subtitle { word-break: break-word; overflow-wrap: break-word; }
  .inventario__controls { padding: 10px 14px; }
  .inventario__hide-label { white-space: normal; word-break: break-word; }
  .inventario__hide-field { max-width: 100%; }

  /* SKU table: hide PRODUCTO → 4-column (code | name | precio | stock).
     Compact fixed widths so all 4 fit on a 390px screen. */
  .inventario__table-wrap { overflow-x: visible; max-width: 100%; }
  .inventario__table { min-width: 0; }
  .inventario__row {
    grid-template-columns: 42px 1fr 60px 82px;
  }
  /* Reset letter-spacing on head cells so "INVENTARIO (KG)" fits in 82px */
  .inventario__row--head .inventario__cell,
  .inventario__row--head .inventario__sort-btn {
    letter-spacing: 0; font-size: 10px; padding: 7px 5px;
  }
  .inventario__cell--product { display: none; }
  .inventario__cell { padding: 7px 5px; font-size: 11px; min-width: 0; }
  .inventario__cell--name {
    font-size: 12px;
    white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
  }
  .inventario__cell--code { padding-left: 8px; }
  .inventario__cell--price { text-align: right; }
  .inventario__cell--stock { text-align: right; font-weight: 700; }
  .inventario__price-amount { font-size: 11px; }
  .inventario__price-model { display: none; }

  /* Bucket table: 3 columns (product | quality | stock), hide price */
  .inventario__table--bucket .inventario__row {
    grid-template-columns: minmax(0, 1.2fr) minmax(0, 1.2fr) 72px;
  }
  .inventario__table--bucket .inventario__row > :nth-child(4) { display: none; }

  /* ── History detail ──────────────────────────────────────────────────────── */
  /* Action buttons: single column so long labels like "MARCAR FACTURA
     PENDIENTE" and "SOLICITAR DEVOLUCIÓN/CAMBIO" never get clipped. */
  .history-detail__actions {
    grid-template-columns: 1fr !important;
  }
  .history-detail__actions .sale-btn {
    border-right: 0 !important;
    border-bottom: 1px solid #000 !important;
    text-align: left;
    font-size: 12px;
    padding: 11px 14px;
    white-space: normal;
  }
  .history-detail__actions .sale-btn:last-child { border-bottom: 0 !important; }
  .history-detail__actions .sale-btn:nth-child(2n) { border-right: 0; }

  /* Sale info strip: 2-column grid (one pair per row) instead of 4-column
     so "CLIENTE / PÚBLICO EN GENERAL" has room to breathe. */
  .history-detail__meta {
    grid-template-columns: 1fr !important;
  }
  .history-detail__meta-row {
    border-right: 0 !important;
    border-bottom: 1px solid #000 !important;
  }
  .history-detail__meta-row:last-child { border-bottom: 0 !important; }

} /* end @media (max-width: 640px) */
