/* ==========================================================================
   Pharmafy POS · aplicación (estilo macOS: limpio, plano y minimalista)
   Orden de carga: estilos base de index.html → tokens.css → app.css.
   Reglas: colores y medidas solo desde tokens.css; sin degradados, sin 3D;
   desenfoque solo en barras, menús y avisos. Guía: docs/DISENO.md
   ========================================================================== */

/* ---------- Base ---------- */
html { background: var(--bg); }
body { background: var(--bg); color: var(--text); font-size: var(--fs-body); line-height: var(--lh-body); text-rendering: optimizeLegibility; }
body::before { content: none; }
h1, h2, h3 { letter-spacing: var(--tracking-title); font-weight: var(--fw-bold); }
* { scrollbar-width: thin; scrollbar-color: var(--fill-strong) transparent; }
::-webkit-scrollbar { width: 10px; height: 10px; }
::-webkit-scrollbar-thumb { background: var(--fill-strong); border-radius: 99px; border: 3px solid transparent; background-clip: padding-box; }
::-webkit-scrollbar-thumb:hover { background-color: var(--border-strong); }
::-webkit-scrollbar-track { background: transparent; }
option, optgroup { background: var(--panel-solid); color: var(--text); }
:focus-visible { outline: none; box-shadow: var(--ring); border-radius: var(--r-sm); }

kbd {
  display: inline-flex; align-items: center; justify-content: center; min-width: 20px; height: 20px; padding: 0 5px; border-radius: 5px;
  font: var(--fw-medium) 11px/1 var(--font); white-space: nowrap;
  color: var(--muted); background: var(--fill); border: .5px solid var(--border);
}

/* ---------- Superficies ---------- */
.card {
  background: var(--surface); border: 1px solid var(--border); border-radius: var(--r-lg);
  box-shadow: var(--sh-1); padding: var(--sp-5);
}
.card .card { background: var(--surface-2); border-color: var(--border); box-shadow: none; }
.card-head { margin-bottom: var(--sp-4); }
.card-head h2 { font-size: var(--fs-title3); font-weight: var(--fw-semibold); letter-spacing: var(--tracking-title); }
.card-head p { font-size: var(--fs-subhead); line-height: var(--lh-snug); }
.page-head { margin-bottom: var(--sp-6); }
.page-head h1 { font-size: var(--fs-large); font-weight: var(--fw-bold); letter-spacing: var(--tracking-tight); line-height: var(--lh-tight); }
.page-head p { font-size: var(--fs-callout); line-height: var(--lh-body); }
.eyebrow { font-size: var(--fs-footnote); font-weight: var(--fw-semibold); letter-spacing: 0; text-transform: none; color: var(--accent-600); }
.hint { color: var(--muted); }

.list-item, .dl > div, .peek-block, .peek-grid > div, .branch-stats > div, .band-box, .doc-card, .rline, .psec, .role-cols .field.check, .cart-line, .order-card, .kanban .col, .lot-opt, .pick-item {
  background: var(--surface-2); border: 1px solid var(--border); box-shadow: none;
}
.list-item { border-radius: var(--r-md); transition: background var(--dur-2) var(--ease), border-color var(--dur-2) var(--ease); }
.check-item:hover, button.list-item:hover, .lot-opt:hover, .pick-item:hover, .doc-item:hover { background: var(--fill-hover); border-color: var(--border-strong); }
.check-item:disabled:hover { border-color: var(--border); background: var(--surface-2); }
.dl small, .branch-pill small { text-transform: none; letter-spacing: 0; font-weight: var(--fw-medium); font-size: var(--fs-footnote); }
.note-box { background: var(--warn-soft); border: 0; border-radius: var(--r-md); box-shadow: none; }
.note-box.info { background: var(--info-soft); }
[data-theme="dark"] .note-box { background: var(--warn-soft); border: 0; }
[data-theme="dark"] .note-box.info { background: var(--info-soft); border: 0; }
.empty, .empty-state { color: var(--muted); }

.ico-tile, .kpi .ico, .cust-ico { background: var(--accent-soft); color: var(--accent-600); border: 0; box-shadow: none; border-radius: var(--r-md); }
.ico-tile.warn, .kpi.alert .ico { background: var(--warn-soft); color: var(--warn); }
.ico-tile.bad, .kpi.alert-danger .ico { background: var(--danger-soft); color: var(--danger); }
.avatar { background: var(--accent-soft); color: var(--accent-600); box-shadow: none; font-weight: var(--fw-semibold); }

/* ---------- Botones ---------- */
.btn, .icon-btn {
  background: var(--control-bg); border: .5px solid var(--border-strong); color: var(--text); box-shadow: var(--sh-1);
  transition: background var(--dur-1) var(--ease), border-color var(--dur-1) var(--ease), color var(--dur-1) var(--ease), opacity var(--dur-1) var(--ease);
}
.btn { min-height: 38px; padding: 0 var(--sp-4); border-radius: var(--r-md); font-weight: var(--fw-medium); font-size: var(--fs-body); letter-spacing: 0; }
.btn.sm { min-height: 30px; padding: 0 var(--sp-3); font-size: var(--fs-subhead); border-radius: var(--r-sm); }
.btn.lg { min-height: 46px; font-size: var(--fs-callout); border-radius: var(--r-lg); }
.icon-btn { width: 38px; height: 38px; border-radius: var(--r-md); }
.btn:hover, .icon-btn:hover { background: var(--control-bg); background-image: linear-gradient(var(--fill), var(--fill)); border-color: var(--border-strong); color: var(--text); transform: none; box-shadow: var(--sh-1); }
.btn:active, .icon-btn:active { background-image: linear-gradient(var(--fill-strong), var(--fill-strong)); transform: none; }
.btn.primary { background: var(--accent); color: var(--accent-ink); border-color: transparent; box-shadow: var(--sh-1); font-weight: var(--fw-semibold); }
.btn.primary:hover { background: var(--accent-hover); background-image: none; color: var(--accent-ink); border-color: transparent; filter: none; }
.btn.primary:active { background: var(--accent-hover); filter: brightness(.94); }
[data-theme="dark"] .btn.primary { box-shadow: none; }
.btn.danger { color: var(--danger); }
.btn.danger:hover { color: var(--danger); border-color: var(--border-strong); }
form .btn.danger[type="submit"] { color: #fff; background: var(--danger-fill); border-color: transparent; }
form .btn.danger[type="submit"]:hover { background: var(--danger-fill); filter: brightness(.94); }
.btn.ghost { background: transparent; border-color: transparent; box-shadow: none; }
.btn.ghost:hover { background: var(--fill-hover); background-image: none; border-color: transparent; box-shadow: none; }
.btn:disabled, .btn.primary:disabled { opacity: .4; filter: none; box-shadow: none; cursor: not-allowed; }
.btn kbd { margin-left: 2px; }
.btn.primary kbd { background: rgba(255, 255, 255, .2); color: var(--accent-ink); border-color: rgba(255, 255, 255, .25); }
.link-btn { color: var(--accent-600); font-weight: var(--fw-medium); text-decoration: none; }
.link-btn:hover { text-decoration: underline; }

/* ---------- Campos ---------- */
.field { font-size: var(--fs-subhead); font-weight: var(--fw-medium); color: var(--muted); }
.field-label { text-transform: none; letter-spacing: 0; font-size: var(--fs-subhead); font-weight: var(--fw-medium); }
.field input, .field select, .field textarea, .search input, .select, .pay-row select, .pay-row input, .picker input, .pick-select, .pick-input, .qty-input {
  background: var(--field-bg); border: 1px solid var(--border-strong); border-radius: var(--r-sm); color: var(--text); box-shadow: none;
  transition: box-shadow var(--dur-1) var(--ease), border-color var(--dur-1) var(--ease);
}
.field input, .field select, .select { min-height: 38px; }
.field input::placeholder, .field textarea::placeholder, .search input::placeholder { color: var(--text-3); }
.field input:focus, .field select:focus, .field textarea:focus, .search input:focus, .pay-row input:focus, .pay-row select:focus, .picker input:focus, .select:focus, .qty-input:focus, .pick-select:focus, .pick-input:focus {
  outline: none; border-color: var(--accent); background: var(--field-bg); box-shadow: var(--ring);
}
.search input { min-height: 42px; border-radius: var(--r-md); padding-right: 54px; font-weight: var(--fw-regular); background: var(--field-bg); }
.search svg { top: 11px; color: var(--muted); }
.search .search-kbd { position: absolute; right: 10px; top: 50%; transform: translateY(-50%); pointer-events: none; }
.field.check input, .psec-head input[type="checkbox"] { accent-color: var(--accent); }
.check-chip, .fchip, .chips button { background: var(--fill); border: 1px solid transparent; color: var(--text); box-shadow: none; font-weight: var(--fw-medium); transition: background var(--dur-1) var(--ease), color var(--dur-1) var(--ease); }
.check-chip:hover, .fchip:hover, .chips button:hover { background: var(--fill-hover); border-color: transparent; color: var(--text); }
.check-chip:has(input:checked), .fchip.on, .chips button.on { background: var(--accent); color: var(--accent-ink); border-color: transparent; box-shadow: none; }
.tag-chip { background: var(--accent-soft); border: 0; color: var(--accent-600); }
.tag-chip button { background: var(--control-bg); }

/* ---------- Pestañas y control segmentado ---------- */
.tabs, .seg { background: var(--fill); border: 0; border-radius: var(--r-md); padding: 3px; box-shadow: none; gap: 2px; }
.tab, .seg button { border-radius: 7px; min-height: 32px; font-weight: var(--fw-medium); color: var(--text); transition: background var(--dur-1) var(--ease), box-shadow var(--dur-1) var(--ease); }
.tab:hover { background: var(--fill-hover); color: var(--text); }
.tab.on, .seg button.on { background: var(--surface); color: var(--text); font-weight: var(--fw-semibold); box-shadow: 0 0 0 .5px rgba(0, 0, 0, .06), 0 1px 3px rgba(0, 0, 0, .12); }
[data-theme="dark"] .tab.on, [data-theme="dark"] .seg button.on { background: rgba(255, 255, 255, .16); box-shadow: none; }
.tab.on .tab-count { background: var(--accent); color: var(--accent-ink); }
.tab:not(.on) .tab-count { background: var(--fill); border: 0; color: var(--muted); }

/* ---------- Etiquetas de estado ---------- */
.chip { background: var(--fill); border: 0; color: var(--muted); font-weight: var(--fw-medium); }
.chip.ok { background: var(--accent-soft); color: var(--accent-600); }
.chip.warn { background: var(--warn-soft); color: var(--warn); }
.chip.bad { background: var(--danger-soft); color: var(--danger); }
.demo-pill { background: var(--warn-soft); color: var(--warn); border: 0; box-shadow: none; font-weight: var(--fw-semibold); }
.sync { background: var(--control-bg); border: .5px solid var(--border-strong); box-shadow: var(--sh-1); font-weight: var(--fw-medium); }
.sync i { box-shadow: none; }
.tag-rx, .tag-cold, .tag-lots, .tag-soon, .tag-promo { font-weight: var(--fw-semibold); letter-spacing: 0; border-radius: 5px; }

/* ---------- Tablas ---------- */
.table-wrap { border-radius: var(--r-md); }
th { color: var(--muted); border-bottom: 1px solid var(--border); background: transparent; font-size: var(--fs-footnote); font-weight: var(--fw-semibold); text-transform: none; letter-spacing: 0; }
td { border-bottom: 1px solid var(--border); }
tbody tr { transition: background var(--dur-1) var(--ease); }
tbody tr:hover td { background: var(--fill); }
.pl-table tr.sub td { background: var(--surface-2); }

/* ---------- Bento (inicio) ---------- */
.bento { display: grid; grid-template-columns: repeat(12, minmax(0, 1fr)); gap: var(--sp-4); align-items: stretch; }
.bento > * { min-width: 0; margin: 0; }
.tile { display: flex; flex-direction: column; overflow: hidden; position: relative; }
.tile .card-head { margin-bottom: var(--sp-3); }
.tile-label { font-size: var(--fs-subhead); font-weight: var(--fw-medium); letter-spacing: 0; text-transform: none; color: var(--muted); display: flex; align-items: center; justify-content: space-between; gap: 10px; }
.tile-value { font-size: 28px; font-weight: var(--fw-semibold); letter-spacing: var(--tracking-tight); font-variant-numeric: tabular-nums; line-height: var(--lh-tight); margin-top: var(--sp-2); overflow-wrap: anywhere; }
.tile-note { font-size: var(--fs-subhead); color: var(--muted); margin-top: 6px; line-height: var(--lh-snug); }
.tile-foot { margin-top: auto; padding-top: var(--sp-4); display: flex; gap: var(--sp-2); flex-wrap: wrap; align-items: center; }
.tile-link { cursor: pointer; text-align: left; font: inherit; color: inherit; transition: border-color var(--dur-2) var(--ease), box-shadow var(--dur-2) var(--ease); }
.tile-link:hover { border-color: var(--border-strong); box-shadow: var(--sh-2); }
.tile-link:disabled { cursor: default; }
.bento-dash {
  grid-template-areas:
    "hero hero hero hero chart chart chart chart chart profit profit profit"
    "hero hero hero hero chart chart chart chart chart shift shift shift"
    "alerts alerts alerts alerts alerts top top top top cof cof cof"
    "alerts alerts alerts alerts alerts recent recent recent recent recent recent recent";
}
.t-hero { grid-area: hero; } .t-chart { grid-area: chart; } .t-profit { grid-area: profit; } .t-shift { grid-area: shift; }
.t-alerts { grid-area: alerts; } .t-top { grid-area: top; } .t-cof { grid-area: cof; } .t-recent { grid-area: recent; }
.t-hero { min-height: 300px; }
.t-hero .tile-value { font-size: clamp(36px, 4vw, 52px); font-weight: var(--fw-bold); }
.t-hero .hero-stats { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: var(--sp-2); margin-top: var(--sp-4); }
.t-hero .hero-stats > div { padding: 10px 12px; border-radius: var(--r-md); background: var(--surface-2); border: 1px solid var(--border); }
.t-hero .hero-stats small { display: block; font-size: var(--fs-footnote); font-weight: var(--fw-medium); color: var(--muted); }
.t-hero .hero-stats strong { display: block; font-size: var(--fs-title3); margin-top: 2px; font-variant-numeric: tabular-nums; }
.t-hero .delta-chip { display: inline-flex; align-items: center; gap: 4px; padding: 3px 9px; border-radius: var(--r-pill); font-size: var(--fs-footnote); font-weight: var(--fw-semibold); background: var(--accent-soft); color: var(--accent-600); }
.t-hero::after { content: none; }
.t-chart .bars { flex: 1; min-height: 170px; height: auto; }
.t-alerts .list, .t-top .hbars { flex: 1; }
.t-recent .table-wrap { margin: 0 -6px; }
.t-recent td small { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; max-width: 180px; }
.bar-value { overflow: visible; }
@media (max-width: 1180px) {
  .bento { grid-template-columns: repeat(6, minmax(0, 1fr)); }
  .bento-dash {
    grid-template-areas:
      "hero hero hero hero shift shift"
      "hero hero hero hero profit profit"
      "chart chart chart chart chart chart"
      "alerts alerts alerts top top top"
      "cof cof cof cof cof cof"
      "recent recent recent recent recent recent";
  }
}
@media (max-width: 760px) {
  .bento { grid-template-columns: minmax(0, 1fr); gap: var(--sp-3); }
  .bento-dash { grid-template-areas: "hero" "shift" "profit" "chart" "alerts" "top" "cof" "recent"; }
  .t-hero { min-height: 0; }
}

/* ---------- Indicadores ---------- */
.kpis { gap: var(--sp-3); margin-bottom: var(--sp-4); }
.kpi { transition: box-shadow var(--dur-2) var(--ease); }
.kpi .label { font-weight: var(--fw-medium); }
.kpi .value { font-size: 26px; font-weight: var(--fw-semibold); letter-spacing: var(--tracking-tight); overflow-wrap: anywhere; }
.kpi .note { line-height: var(--lh-snug); }
.progress, .hbar-track, .legend-row .bar-track { background: var(--fill-strong); box-shadow: none; height: 6px; }
.progress > i, .hbar-track i, .legend-row .bar-track i { background: var(--accent); }
.bar-fill { background: var(--accent); border-radius: 5px 5px 2px 2px; box-shadow: none; }
.bar-fill.zero { background: var(--fill-strong); }
.donut { box-shadow: none; }
.donut::after { background: var(--surface); }

/* ---------- Armazón ---------- */
.sidebar { background: var(--sidebar-bg); border-right: 1px solid var(--border); box-shadow: none; z-index: 9; padding: var(--sp-4) var(--sp-3); gap: var(--sp-3); }
.sidebar .brand strong { font-size: var(--fs-title3); font-weight: var(--fw-bold); letter-spacing: var(--tracking-title); }
.brand small { font-size: 10px; font-weight: var(--fw-semibold); letter-spacing: .08em; }
.logo { background: var(--brand); color: var(--brand-ink); border-radius: 10px; box-shadow: none; text-shadow: none; transform: none; font-weight: var(--fw-bold); }
.logo.has-img { background: #fff; }
.branch-pill { background: var(--surface); border: 1px solid var(--border); border-radius: var(--r-md); box-shadow: var(--sh-1); }
.nav-label { font-size: var(--fs-caption); font-weight: var(--fw-semibold); letter-spacing: 0; text-transform: none; color: var(--muted); padding: 10px 10px 2px; }
.nav { gap: 1px; }
.nav-btn { min-height: 34px; padding: 0 10px; border-radius: 7px; position: relative; color: var(--text); font-weight: var(--fw-medium); font-size: var(--fs-body); transition: background var(--dur-1) var(--ease); }
.nav-btn svg { color: var(--accent-600); width: 18px; height: 18px; }
.nav-btn:hover { background: var(--fill); color: var(--text); }
.nav-btn.active { background: var(--fill-strong); color: var(--text); font-weight: var(--fw-semibold); box-shadow: none; }
[data-theme="dark"] .nav-btn.active { background: rgba(255, 255, 255, .12); }
.nav-btn.active::before { content: none; }
.nav-btn .kbd { border: 0; background: transparent; opacity: 0; transition: opacity var(--dur-2) var(--ease); font-size: var(--fs-caption); padding: 0; color: var(--muted); }
.sidebar:hover .nav-btn .kbd, .nav-btn.active .kbd { opacity: .7; }
.nav-btn .count { background: var(--warn-soft); color: var(--warn); border: 0; font-weight: var(--fw-semibold); }
.side-foot { border-top: 1px solid var(--border); }
.me strong { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; max-width: 168px; }
.me > div { min-width: 0; }
.topbar { height: 56px; background: var(--material-bar); -webkit-backdrop-filter: var(--blur); backdrop-filter: var(--blur); border-bottom: 1px solid var(--border); }
.crumb { font-size: var(--fs-callout); font-weight: var(--fw-semibold); }
.crumb .crumb-biz { font-weight: var(--fw-regular); }
.crumb .crumb-module { color: var(--text); font-weight: var(--fw-semibold); }
.powered-by { background: var(--accent-soft); color: var(--accent-600); box-shadow: none; font-weight: var(--fw-semibold); letter-spacing: 0; }
.powered-by .pb-logo { background: var(--brand); color: var(--brand-ink); }
.content { padding: var(--sp-6) var(--sp-8) var(--sp-12); animation: page-in var(--dur-3) var(--ease-out); }
@keyframes page-in { from { opacity: 0; transform: translateY(4px); } to { opacity: 1; transform: none; } }
.hide-touch { display: grid; }
@media (hover: none), (pointer: coarse) { .hide-touch { display: none !important; } }

/* ---------- Punto de venta ---------- */
/* ".pos" también es la clase de cifras positivas (verde): el contenedor del punto de venta no debe heredarlo. */
div.pos { gap: var(--sp-4); color: var(--text); }
.pos-grid { gap: var(--sp-3); }
.prod {
  background: var(--surface); border: 1px solid var(--border); border-radius: var(--r-lg); box-shadow: var(--sh-1);
  transition: border-color var(--dur-1) var(--ease), box-shadow var(--dur-2) var(--ease);
}
.prod:hover { border-color: var(--border-strong); box-shadow: var(--sh-2); transform: none; }
.prod:active { background-image: linear-gradient(var(--fill), var(--fill)); transform: none; }
.prod:focus-visible { box-shadow: var(--ring); border-color: var(--accent); }
.prod.is-disabled:hover { box-shadow: var(--sh-1); border-color: var(--border); }
.prod .cat { font-size: var(--fs-caption); font-weight: var(--fw-semibold); letter-spacing: 0; text-transform: none; color: var(--accent-600); }
.prod .name { font-size: var(--fs-body); font-weight: var(--fw-semibold); overflow-wrap: anywhere; }
.prod .price { font-size: var(--fs-title3); font-weight: var(--fw-semibold); color: var(--text); font-variant-numeric: tabular-nums; }
.prod .stock { font-weight: var(--fw-medium); }
.prod-img { border-radius: var(--r-md); }
.prod-img.ph { background: var(--fill); border: 0; color: var(--text-3); }
.prod-img.ph svg { filter: none; transform: none; }
.peek-btn { background: var(--control-bg); border: .5px solid var(--border-strong); box-shadow: var(--sh-1); }
.cart { box-shadow: var(--sh-2); border-radius: var(--r-xl); top: 76px; }
.cart-lines { max-height: 360px; padding: 2px; margin: -2px; }
.cart-line { border-radius: var(--r-md); animation: line-in var(--dur-2) var(--ease-out); }
@keyframes line-in { from { opacity: 0; } to { opacity: 1; } }
.cart-line strong { overflow-wrap: anywhere; font-weight: var(--fw-semibold); }
.qty { gap: 2px; padding: 2px; border-radius: var(--r-sm); background: var(--fill); border: 0; }
.qty button { background: var(--surface); border: 0; border-radius: 6px; box-shadow: 0 0 0 .5px rgba(0, 0, 0, .06), 0 1px 2px rgba(0, 0, 0, .1); font-weight: var(--fw-semibold); }
[data-theme="dark"] .qty button { background: rgba(255, 255, 255, .14); box-shadow: none; }
.qty button:hover { color: var(--accent-600); }
.qty-input { width: 46px; min-height: 30px; padding: 0 2px; text-align: center; font-weight: var(--fw-semibold); border-radius: 6px; font-variant-numeric: tabular-nums; -moz-appearance: textfield; appearance: textfield; border-color: transparent; background: transparent; }
.qty-input::-webkit-outer-spin-button, .qty-input::-webkit-inner-spin-button { -webkit-appearance: none; margin: 0; }
.totals { border-top: 1px solid var(--border); padding-top: var(--sp-3); }
.totals .grand { font-size: 22px; font-weight: var(--fw-bold); letter-spacing: var(--tracking-tight); }
.totals .grand span:last-child { color: var(--text); }
.checkout-btn { justify-content: space-between; padding: 0 var(--sp-5); font-size: var(--fs-title3); min-height: 52px; border-radius: var(--r-lg); }
.cart-aux { display: grid; grid-template-columns: 1fr 1fr; gap: var(--sp-2); }
.cart-aux .btn { justify-content: center; white-space: normal; line-height: 1.15; min-height: 38px; padding: 6px 8px; }
.cart-aux .btn svg { width: 16px; height: 16px; }
.cart-aux kbd { display: none; }
@media (min-width: 1280px) { .cart-aux kbd { display: inline-flex; } }
.cust-bar { background: var(--surface-2); border: 1px solid var(--border); border-radius: var(--r-md); }
.cart-empty .ico-tile { width: 56px; height: 56px; border-radius: var(--r-lg); animation: none; background: var(--fill); color: var(--text-3); }
.points-est { background: var(--accent-soft); border: 0; }

/* ---------- Cobro ---------- */
.pay-hero { border-radius: var(--r-lg); position: relative; overflow: hidden; color: var(--accent-ink); background: var(--accent); box-shadow: none; }
.pay-hero strong { text-shadow: none; font-variant-numeric: tabular-nums; }
.pay-quick { display: flex; gap: var(--sp-2); flex-wrap: wrap; margin: 2px 0 10px; }
.pay-quick .btn { flex: 1 1 auto; font-variant-numeric: tabular-nums; }
.pay-quick-label { flex: 1 0 100%; font-size: var(--fs-footnote); font-weight: var(--fw-medium); color: var(--muted); }
.pay-msg { border-radius: var(--r-md); border: 0; }
.pay-msg:not(.change) { display: block; line-height: var(--lh-body); }
.pay-msg.change { background: var(--accent-soft); color: var(--accent-600); box-shadow: none; }
.pay-grid span { background: var(--surface-2); border: 1px solid var(--border); border-radius: var(--r-md); font-weight: var(--fw-medium); }
.pay-grid input:checked + span, .pay-grid.two input:checked + span { background: var(--accent-soft); border-color: var(--accent); box-shadow: none; color: var(--text); font-weight: var(--fw-semibold); }
.lot-opt.sug { border-color: var(--accent); box-shadow: none; }
.picked { background: var(--accent-soft); border: 0; }
.sale-done { display: grid; grid-template-columns: auto 1fr auto; gap: var(--sp-3); align-items: center; padding: var(--sp-4); margin-bottom: var(--sp-3); border-radius: var(--r-lg); color: var(--text); background: var(--accent-soft); box-shadow: none; }
.sale-done .ok-ico { width: 40px; height: 40px; border-radius: 50%; display: grid; place-items: center; background: var(--accent); color: var(--accent-ink); border: 0; }
.sale-done strong { display: block; font-size: var(--fs-callout); }
.sale-done small { color: var(--muted); font-size: var(--fs-subhead); }
.sale-done .change { text-align: right; }
.sale-done .change b { display: block; font-size: 26px; font-weight: var(--fw-bold); letter-spacing: var(--tracking-tight); font-variant-numeric: tabular-nums; color: var(--accent-600); }
@media (max-width: 600px) { .sale-done { grid-template-columns: auto 1fr; } .sale-done .change { grid-column: 1 / -1; text-align: left; } }
.receipt .ok-badge { background: var(--accent); color: var(--accent-ink); }
.big-total { color: var(--text); font-weight: var(--fw-bold); }

/* ---------- Ventanas y avisos ---------- */
.modal-backdrop { background: rgba(0, 0, 0, .28); -webkit-backdrop-filter: none; backdrop-filter: none; animation: fade var(--dur-2) var(--ease); }
[data-theme="dark"] .modal-backdrop { background: rgba(0, 0, 0, .5); }
.modal { background: var(--surface-raised); border: 0; border-radius: var(--r-xl); box-shadow: var(--sh-3); animation: modal-in var(--dur-3) var(--ease-out); padding: var(--sp-6); }
@keyframes modal-in { from { opacity: 0; transform: scale(.97); } to { opacity: 1; transform: none; } }
.modal h2 { font-size: var(--fs-title2); font-weight: var(--fw-bold); letter-spacing: var(--tracking-title); }
.modal-close { border-radius: 50%; width: 30px; height: 30px; background: var(--fill); border: 0; box-shadow: none; }
.modal-close:hover { background: var(--fill-hover); background-image: none; }
.modal-close svg { width: 16px; height: 16px; }
.toasts { z-index: 70; bottom: 24px; }
.toast {
  background: var(--material-pop); color: var(--text); border: .5px solid var(--border); border-left: .5px solid var(--border); border-radius: var(--r-lg);
  -webkit-backdrop-filter: var(--blur); backdrop-filter: var(--blur);
  box-shadow: var(--sh-3); padding: 12px 16px 12px 40px; position: relative; animation: toast-up var(--dur-3) var(--ease-out); line-height: var(--lh-snug); font-weight: var(--fw-medium);
}
.toast::before { content: ""; position: absolute; left: 16px; top: 50%; width: 10px; height: 10px; margin-top: -5px; border-radius: 50%; background: var(--sys-green); }
.toast.error { border-left-color: var(--border); }
.toast.error::before { background: var(--sys-red); }
@keyframes toast-up { from { opacity: 0; transform: translateY(8px); } to { opacity: 1; transform: none; } }
.sc-list { display: grid; gap: 6px; }
.sc-row { display: grid; grid-template-columns: minmax(150px, auto) 1fr; gap: var(--sp-3); align-items: center; padding: 10px 12px; border-radius: var(--r-md); background: var(--surface-2); border: 1px solid var(--border); font-size: var(--fs-body); }
.sc-keys { display: inline-flex; gap: 4px; align-items: center; flex-wrap: wrap; }
.sc-keys kbd { height: 24px; min-width: 26px; font-size: var(--fs-footnote); color: var(--text); }
.sc-sep { color: var(--muted); font-weight: var(--fw-semibold); font-size: var(--fs-footnote); }
@media (max-width: 600px) { .sc-row { grid-template-columns: 1fr; gap: 6px; } }
.pres-newtype { background: var(--surface-2); }

/* ---------- Acceso interno y ticket ---------- */
.login-hero { background: var(--deep); color: #F5F5F7; }
.login-hero .logo { background: var(--brand); color: var(--brand-ink); }
.features li { background: rgba(255, 255, 255, .06); backdrop-filter: none; border-radius: var(--r-md); font-weight: var(--fw-medium); }
.login-card { border-radius: var(--r-xl); box-shadow: var(--sh-3); }
.ticket-preview { background: var(--surface-2); border: 1px solid var(--border); border-radius: var(--r-lg); }
.ticket { box-shadow: var(--sh-2); }

/* ---------- Herramientas flotantes (plegables) ---------- */
#ph-fab-row { bottom: 22px !important; right: 22px !important; gap: 10px !important; align-items: center; }
#ph-fab-row button {
  width: 44px !important; height: 44px !important; border-radius: 50% !important; font-size: 18px !important;
  background: var(--material-pop) !important; border: .5px solid var(--border-strong) !important; box-shadow: var(--sh-2) !important;
  -webkit-backdrop-filter: var(--blur); backdrop-filter: var(--blur); color: var(--text);
  transition: transform var(--dur-3) var(--ease-out), opacity var(--dur-2) var(--ease) !important;
}
#ph-fab-row #ph-fab-wa { background: var(--sys-green) !important; color: #fff; border-color: transparent !important; }
#ph-fab-row .ph-fab-item { opacity: 0; transform: translateY(10px) scale(.8); pointer-events: none; }
#ph-fab-row.open .ph-fab-item { opacity: 1; transform: none; pointer-events: auto; }
#ph-fab-row.open .ph-fab-item:nth-last-child(2) { transition-delay: .03s !important; }
#ph-fab-row.open .ph-fab-item:nth-last-child(3) { transition-delay: .06s !important; }
#ph-fab-row.open .ph-fab-item:nth-last-child(4) { transition-delay: .09s !important; }
#ph-fab-row #ph-fab-toggle { color: var(--accent-600); font-size: 22px !important; font-weight: var(--fw-semibold); }
#ph-fab-row.open #ph-fab-toggle { transform: rotate(45deg); }

/* ---------- Tableta y celular ---------- */
@media (max-width: 1180px) {
  .content { padding: var(--sp-5) var(--sp-6) var(--sp-12); }
}
@media (max-width: 960px) {
  /* El panel va encima del fondo oscuro (35) y de la barra inferior (30), debajo de las ventanas (50). */
  .sidebar { background: var(--sidebar-bg); box-shadow: var(--sh-3); z-index: 45; overscroll-behavior: contain; padding-bottom: calc(var(--sp-4) + env(safe-area-inset-bottom)); }
  .app.nav-open .scrim { background: rgba(0, 0, 0, .3); }
  body:has(.app.nav-open) #ph-fab-row { display: none !important; }
  .sidebar .nav-btn .kbd { display: none; } /* atajos de teclado: no aplican en celular */
  .topbar { height: 52px; padding: 0 var(--sp-3); }
  .content { padding: var(--sp-4) var(--sp-4) 110px; }
  .bottom-nav { background: var(--material-bar); -webkit-backdrop-filter: var(--blur); backdrop-filter: var(--blur); border-top: 1px solid var(--border); }
  .bottom-nav button { font-weight: var(--fw-medium); font-size: 10.5px; }
  .bottom-nav button.on { background: transparent; color: var(--accent-600); }
  .modal { border-radius: var(--r-xl) var(--r-xl) 0 0; animation: sheet-in var(--dur-3) var(--ease-out); padding: var(--sp-5) var(--sp-4) calc(var(--sp-5) + env(safe-area-inset-bottom)); }
  .modal::before { content: ""; display: block; width: 36px; height: 5px; border-radius: 3px; background: var(--fill-strong); margin: -8px auto 12px; }
  @keyframes sheet-in { from { transform: translateY(32px); opacity: .6; } to { transform: none; opacity: 1; } }
  .cart { position: static; }
  .page-head h1 { font-size: var(--fs-title1); }
  #ph-fab-row { bottom: 88px !important; right: 14px !important; }
  .toasts { bottom: 150px; }
}
@media (max-width: 600px) {
  .card { padding: var(--sp-4); border-radius: var(--r-lg); }
  .pos-grid { gap: var(--sp-2); }
  .search .search-kbd { display: none; }
  .search input { padding-right: 14px; }
  .tile-value { font-size: 24px; }
  .page-head { margin-bottom: var(--sp-4); }
  .page-head h1 { font-size: 22px; }
  .page-head p { font-size: var(--fs-body); }
  .btn, .icon-btn { min-height: 40px; }
  .icon-btn { width: 40px; height: 40px; }
  .field input, .field select, .select, .search input { font-size: 16px; } /* evita el zoom automático en iOS */
}

/* ---------- Accesibilidad e impresión ---------- */
@media print {
  .card, .modal, .btn, .prod { box-shadow: none !important; -webkit-backdrop-filter: none !important; backdrop-filter: none !important; }
}

/* ---------- Calculadora y notas flotantes ---------- */
#ph-calc, #ph-notes {
  background: var(--surface-raised) !important; border: 0 !important; border-radius: var(--r-xl) !important; color: var(--text);
  box-shadow: var(--sh-3) !important;
}
#ph-calc #ph-calc-display, #ph-notes textarea { background: var(--fill) !important; border: 1px solid var(--border) !important; color: var(--text); border-radius: 12px !important; }
#ph-calc .ph-calc-grid button { background: var(--glass-strong); border: 1px solid var(--border); color: var(--text); }
#ph-calc .ph-calc-grid button:hover { background: var(--fill-hover); }
#ph-calc .ph-calc-grid button.op { background: var(--accent); color: var(--accent-ink); border-color: transparent; }
#ph-calc .ph-calc-grid button.clear { background: var(--danger-soft); color: var(--danger); border-color: color-mix(in srgb, var(--danger) 30%, transparent); }

/* Ajustes finos */
.t-alerts .list { align-content: start; }
.sale-done { margin-right: 52px; }
@media (max-width: 600px) { .sale-done { margin-right: 44px; } }

/* ---------- Tiras desplazables: se ve que hay más y se puede llegar ---------- */
.tabs, .chips, .filter-bar { scrollbar-width: none; overscroll-behavior-x: contain; scroll-behavior: auto; }
.tabs.can-scroll, .chips.can-scroll, .filter-bar.can-scroll { cursor: grab; -webkit-mask-image: linear-gradient(90deg, transparent 0, #000 28px, #000 calc(100% - 28px), transparent 100%); mask-image: linear-gradient(90deg, transparent 0, #000 28px, #000 calc(100% - 28px), transparent 100%); }
.can-scroll.at-start { -webkit-mask-image: linear-gradient(90deg, #000 calc(100% - 36px), transparent 100%); mask-image: linear-gradient(90deg, #000 calc(100% - 36px), transparent 100%); }
.can-scroll.at-end { -webkit-mask-image: linear-gradient(90deg, transparent 0, #000 36px); mask-image: linear-gradient(90deg, transparent 0, #000 36px); }
.can-scroll.at-start.at-end { -webkit-mask-image: none; mask-image: none; }
.tabs.can-scroll:active, .chips.can-scroll:active { cursor: grabbing; }
.tab, .chips button, .fchip { -webkit-user-select: none; user-select: none; }

/* ---------- Selección múltiple en chips (especialidades, etc.) ---------- */
.spec-box { padding: 14px; border-radius: 16px; background: var(--fill); border: 1px solid var(--border); }
.spec-box[hidden] { display: none; }
.chips-check { gap: 8px; }
.check-chip { position: relative; min-height: 36px; padding: 0 14px; font-size: 13px; font-weight: 700; color: var(--muted); -webkit-user-select: none; user-select: none; }
.check-chip:has(input:checked) { color: var(--accent-ink); padding-left: 30px; }
.check-chip:has(input:checked)::before { content: "✓"; position: absolute; left: 12px; font-weight: 700; font-size: 12px; }
.check-chip:has(input:focus-visible) { outline: 2px solid var(--accent); outline-offset: 2px; }
/* Las casillas no heredan el tamaño de los campos de texto */
.field input[type="checkbox"], .field input[type="radio"] { min-height: 0; width: 18px; height: 18px; padding: 0; flex: 0 0 18px; box-shadow: none; accent-color: var(--accent-600); }

/* ---------- Estado de archivo elegido ---------- */
.file-status { display: flex; align-items: center; gap: 6px; margin-top: 8px; font-size: 13px; color: var(--accent-600); font-weight: 600; }
.file-status:empty { display: none; }
.file-status svg { width: 16px; height: 16px; }

/* ---------- Ficha del producto por renglones ---------- */
.specs { display: grid; gap: 3px; margin-top: 2px; min-width: 0; }
.spec { display: grid; grid-template-columns: 84px minmax(0, 1fr); gap: 8px; align-items: baseline; font-size: 12px; line-height: 1.35; }
.spec i { font-style: normal; font-size: var(--fs-caption); font-weight: var(--fw-regular); letter-spacing: 0; text-transform: none; color: var(--muted); }
.spec b { font-weight: var(--fw-medium); color: var(--text); overflow-wrap: anywhere; }
.prod .specs { padding: 8px 0 2px; border-top: 1px solid var(--border); margin-top: 4px; }
.prod .spec { grid-template-columns: 1fr; gap: 0; }
/* El contenido (sustancias activas) se muestra completo: es información sanitaria, no se recorta. */
.prod .spec b { display: block; overflow: visible; }
td .specs { margin-top: 4px; }
td .spec b { color: var(--muted); }
.peek-specs { display: grid; gap: 3px; margin: 6px 0 12px; padding: 12px 14px; border-radius: 14px; background: var(--fill); border: 1px solid var(--border); }
.peek-specs .spec { font-size: 13.5px; grid-template-columns: 110px minmax(0, 1fr); }
.btn.sm.ghost.danger:hover { background: var(--danger-soft); }

/* ---------- Correcciones de tablas ---------- */
/* "pos" (cifra positiva) chocaba con ".pos" (cuadrícula del punto de venta): la celda dejaba de ser celda. */
td.pos, th.pos, td.neg, th.neg { display: table-cell; }
span.pos, strong.pos, b.pos, small.pos, span.neg, strong.neg, b.neg, small.neg { display: inline; gap: 0; }
/* Botones de acción de una fila: misma altura y alineados al centro, con o sin ícono. */
td .btn, td .icon-btn { vertical-align: middle; }
td .btn.sm { min-height: 34px; }
td .btn + .btn { margin-left: 4px; }

/* ---------- Menú lateral contraíble (versión vertical de íconos) ---------- */
.sidebar { transition: padding .25s var(--ease); }
.app { transition: grid-template-columns .25s var(--ease); }
.sidebar .brand { padding-right: 44px; }
.nav-collapse { position: absolute; top: 22px; right: 12px; width: 32px; height: 32px; border-radius: 10px; z-index: 2; }
@media (min-width: 961px) { .sidebar { position: sticky; } } /* en celular el menú es un panel fijo que se desliza */
.nav-collapse svg { width: 16px; height: 16px; }
@media (min-width: 961px) {
  .app.nav-mini { grid-template-columns: 76px minmax(0, 1fr); }
  .nav-mini .sidebar { padding: 16px 10px; align-items: center; overflow-x: hidden; }
  .nav-mini .sidebar .brand { padding: 0; justify-content: center; }
  .nav-mini .sidebar .brand > div, .nav-mini .branch-pill, .nav-mini .nav-label, .nav-mini .nav-btn > span:not(.count), .nav-mini .nav-btn .kbd, .nav-mini .me > div, .nav-mini .side-foot .btn span { display: none; }
  .nav-mini .nav-collapse { position: static; margin: 2px 0 4px; }
  .nav-mini .nav { width: 100%; gap: 6px; justify-items: center; }
  .nav-mini .nav-btn { width: 48px; height: 46px; padding: 0; justify-content: center; }
  .nav-mini .nav-btn svg { width: 21px; height: 21px; }
  .nav-mini .nav-btn.active::before { left: -10px; }
  .nav-mini .nav-btn .count { position: absolute; top: 3px; right: 2px; margin: 0; padding: 0 5px; min-width: 16px; height: 16px; font-size: 10px; line-height: 16px; text-align: center; background: var(--warn); color: #fff; border: 0; }
  .nav-mini .side-foot { width: 100%; justify-items: center; }
  .nav-mini .me { justify-content: center; }
  .nav-mini .side-foot .btn { width: 46px; min-height: 42px; padding: 0; }
}
@media (max-width: 960px) { .nav-collapse { display: none; } .sidebar .brand { padding-right: 0; } }
.nav-collapse { flex: 0 0 32px; min-height: 32px; }
.nav-mini .sidebar .logo { flex: 0 0 auto; }

/* ---------- Cuadrícula de venta: tarjetas alineadas y columnas ajustables ---------- */
.grid-ctl { display: flex; align-items: center; justify-content: flex-end; gap: 10px; margin: 4px 0 2px; font-size: 12px; font-weight: 700; color: var(--muted); flex-wrap: wrap; }
.grid-ctl .seg { flex-wrap: nowrap; }
.grid-ctl .seg button { min-width: 34px; padding: 0 8px; }
.pos-grid.fixed-cols { grid-template-columns: repeat(var(--cols), minmax(0, 1fr)); }
/* Misma altura para imagen, categoría y nombre: la línea divisoria arranca alineada en toda la fila. */
.prod-img, .prod-img.ph { aspect-ratio: 4 / 3; }
.prod .cat { min-height: 1.3em; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; display: block; }
.prod .name { display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; min-height: calc(2 * 1.3em); line-height: 1.3; }
.prod .specs { margin-top: 6px; }
.prod .foot { flex-wrap: wrap; gap: 4px 8px; }
@media (max-width: 1180px) { .pos-grid.fixed-cols { grid-template-columns: repeat(min(var(--cols), 4), minmax(0, 1fr)); } }
@media (max-width: 960px) { .pos-grid.fixed-cols { grid-template-columns: repeat(min(var(--cols), 3), minmax(0, 1fr)); } }
@media (max-width: 600px) { .pos-grid.fixed-cols { grid-template-columns: repeat(min(var(--cols), 2), minmax(0, 1fr)); } .grid-ctl { justify-content: space-between; } }
/* Con muchas columnas la tarjeta se compacta */
.pos-grid.fixed-cols[style*="--cols:6"] .prod, .pos-grid.fixed-cols[style*="--cols:8"] .prod { padding: 10px; }
.pos-grid.fixed-cols[style*="--cols:8"] .prod .name { font-size: 13px; }
.pos-grid.fixed-cols[style*="--cols:8"] .prod .price { font-size: 15px; }

/* ---------- Acciones de fila: siempre en una línea ---------- */
td:last-child:has(> .btn) { white-space: nowrap; }
td:last-child:has(> .btn) .btn { display: inline-flex; }
@media (max-width: 600px) {
  .peek-specs .spec { grid-template-columns: 1fr; gap: 0; }
  .peek-block { overflow-x: auto; }
  .peek-price small { display: block; margin-left: 0; }
  .peek-info, .peek-media { min-width: 0; }
  .peek-badges .chip { white-space: normal; }
}

/* Selector "por fila": discreto, máximo 4 tarjetas */
.grid-ctl { gap: 6px; margin: 0 0 -4px; font-size: 11px; font-weight: 600; opacity: .6; transition: opacity .2s ease; }
.grid-ctl:hover, .grid-ctl:focus-within { opacity: 1; }
.grid-ctl .seg { padding: 2px; border-radius: 9px; background: transparent; border-color: transparent; gap: 1px; }
.grid-ctl .seg button { min-height: 22px; min-width: 24px; padding: 0 6px; font-size: 11px; border-radius: 7px; }
.pos-grid:not(.fixed-cols) { grid-template-columns: repeat(auto-fill, minmax(max(168px, calc((100% - 42px) / 4)), 1fr)); }

/* ---------- Sucursal activa: botón para cambiar ---------- */
button.branch-pill { display: flex; align-items: center; justify-content: space-between; gap: 8px; width: calc(100% - 8px); text-align: left; font: inherit; color: inherit; cursor: pointer; transition: border-color .2s, background .2s; }
button.branch-pill:hover { border-color: var(--accent); background: var(--fill-hover); }
button.branch-pill > span { min-width: 0; }
button.branch-pill strong { display: block; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
button.branch-pill svg { width: 16px; height: 16px; color: var(--muted); flex: 0 0 auto; }
.branch-card .actions { flex-wrap: wrap; gap: 8px; }
/* ---------- Usuarios ---------- */
.cred-box { display: grid; gap: 8px; padding: 14px; border-radius: 16px; background: var(--fill); border: 1px solid var(--border); font-family: ui-monospace, "Cascadia Mono", monospace; font-size: 13.5px; overflow-wrap: anywhere; }
.cred-box div { display: grid; grid-template-columns: 96px minmax(0, 1fr); gap: 8px; }
.cred-box small { font-family: var(--font); color: var(--muted); font-weight: 700; }
.pass-row { display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: 8px; }
.role-hint { margin-top: 2px; }
.user-cell { display: flex; align-items: center; gap: 10px; min-width: 0; }
.user-cell .avatar { width: 34px; height: 34px; font-size: 12px; }
.user-cell > div { min-width: 0; }
.row-off td { opacity: .6; }
.row-off td .btn { opacity: 1; }


/* ==========================================================================
   Herramientas de mostrador, etiquetas y agenda
   ========================================================================== */
.pos-tools { display: flex; gap: 6px; flex-wrap: wrap; margin-top: 12px; padding-top: 12px; border-top: 1px dashed var(--border); }
.pos-tools .btn { flex: 1 1 0; min-width: 72px; justify-content: center; }
.dose-out { display: grid; grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); gap: 10px; margin-top: 14px; }
.dose-main { background: var(--fill); border: 1px solid var(--border); border-radius: 16px; padding: 12px 14px; display: flex; flex-direction: column; gap: 2px; min-width: 0; }
.dose-main small { color: var(--muted); font-size: 12px; }
.dose-main strong { font-size: 20px; letter-spacing: -.01em; }
.dose-main span { font-size: 12px; color: var(--muted); }
.dose-main.hl { background: color-mix(in srgb, var(--accent) 12%, transparent); border-color: color-mix(in srgb, var(--accent) 35%, transparent); }
.dose-main.hl strong { color: var(--accent-600); }
.field.check { flex-direction: row; align-items: center; gap: 8px; }
.lbl-stage { display: flex; justify-content: center; padding: 18px; background: var(--fill); border: 1px dashed var(--border); border-radius: 16px; overflow: auto; }
.lbl { background: #fff; color: #111; border: 1px solid #111; border-radius: 2mm; padding: 2.5mm 3mm; display: flex; flex-direction: column; justify-content: space-between; overflow: hidden; box-sizing: border-box; font-family: Arial, Helvetica, sans-serif; flex: none; }
.lbl-name { font-weight: 700; font-size: 11pt; line-height: 1.12; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
.lbl-detail { font-size: 7.5pt; color: #333; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.lbl-row { display: flex; align-items: flex-end; justify-content: space-between; gap: 2mm; }
.lbl-price { font-weight: 700; font-size: 22pt; line-height: 1; letter-spacing: -.02em; white-space: nowrap; }
.lbl-code { display: flex; flex-direction: column; align-items: center; font-size: 6pt; min-width: 0; }
.lbl-bars { width: 26mm; height: 8mm; display: block; fill: #000; }
.lbl-note { font-size: 8pt; font-weight: 700; border-top: 1px solid #111; padding-top: 1mm; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.lbl-text { justify-content: center; align-items: center; text-align: center; }
.lbl-free { font-weight: 700; font-size: 15pt; line-height: 1.15; overflow-wrap: anywhere; }
#label-print { display: none; }

.agenda-grid { align-items: start; grid-template-columns: minmax(0, 1.5fr) minmax(0, 1fr); }
.cal { display: grid; grid-template-columns: repeat(7, minmax(0, 1fr)); gap: 6px; margin-top: 12px; }
.cal-head { text-align: center; font-size: 11px; font-weight: 700; color: var(--muted); text-transform: uppercase; letter-spacing: .06em; padding: 2px 0; }
.cal-day { position: relative; min-height: 78px; border: 1px solid var(--border); background: var(--fill); border-radius: 14px; padding: 6px 7px; display: flex; flex-direction: column; align-items: flex-start; gap: 3px; text-align: left; cursor: pointer; color: inherit; font-family: inherit; min-width: 0; overflow: hidden; transition: border-color .15s ease, background .15s ease, transform .15s ease; }
.cal-day:hover { border-color: color-mix(in srgb, var(--accent) 45%, transparent); transform: translateY(-1px); }
.cal-day.out { opacity: .42; }
.cal-day.today .cal-num { background: var(--accent); color: #fff; }
.cal-day.sel { border-color: var(--accent); background: color-mix(in srgb, var(--accent) 10%, transparent); box-shadow: 0 0 0 2px color-mix(in srgb, var(--accent) 22%, transparent); }
.cal-num { font-size: 12px; font-weight: 700; min-width: 22px; height: 22px; border-radius: 999px; display: inline-flex; align-items: center; justify-content: center; }
.cal-dots { display: flex; gap: 3px; min-height: 7px; }
.cal-dots i, .legend-inline i { width: 7px; height: 7px; border-radius: 50%; background: var(--muted); display: inline-block; flex: none; }
.cal-dots i.done { opacity: .3; }
i.dot-pago { background: #d1435b; } i.dot-compra { background: #3b82f6; } i.dot-resurtido { background: var(--accent); } i.dot-tramite { background: #e0a100; } i.dot-recordatorio { background: #8b7fd6; }
.cal-first { font-size: 10.5px; line-height: 1.2; color: var(--muted); max-width: 100%; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.cal-more { position: absolute; top: 7px; right: 7px; font-size: 10px; font-weight: 700; color: var(--muted); }
.legend-inline { display: flex; flex-wrap: wrap; gap: 6px 14px; margin-top: 12px; font-size: 12px; color: var(--muted); }
.legend-inline span { display: inline-flex; align-items: center; gap: 6px; }
.ag-item { align-items: center; }
.ag-item.is-done strong { text-decoration: line-through; opacity: .55; }
.ag-check { width: 26px; height: 26px; border-radius: 9px; border: 2px solid var(--muted); background: transparent; display: inline-flex; align-items: center; justify-content: center; cursor: pointer; color: #fff; flex: none; padding: 0; }
.ag-check svg { width: 15px; height: 15px; }
.ag-check.on { background: var(--accent); border-color: var(--accent); }
.ag-check:hover { border-color: var(--accent); }
@media (max-width: 980px) { .agenda-grid { grid-template-columns: minmax(0, 1fr); } }
@media (max-width: 560px) { .cal { gap: 3px; } .cal-day { min-height: 54px; padding: 4px; border-radius: 10px; align-items: center; } .cal-first, .cal-more { display: none; } .cal-head { font-size: 9.5px; letter-spacing: 0; } }

@media print {
  body.printing-label.printing-label #root, body.printing-label.printing-label .modal-backdrop, body.printing-label.printing-label #ticket-print { display: none !important; }
  body.printing-label.printing-label * { visibility: hidden !important; }
  body.printing-label.printing-label #label-print, body.printing-label.printing-label #label-print * { visibility: visible !important; }
  body.printing-label.printing-label #label-print { display: block !important; position: absolute; left: 0; top: 0; margin: 0; padding: 0; background: #fff; }
  body.printing-label.printing-label { background: #fff !important; }
  #label-print.as-labels .lbl { border: 0; border-radius: 0; break-after: page; page-break-after: always; }
  #label-print.as-labels .lbl:last-child { break-after: auto; page-break-after: auto; }
  #label-print.as-ticket .ticket { margin: 0; box-shadow: none; }
}

/* ==========================================================================
   v6 · grupos, promociones, multifiltro, recepciones en captura,
   control de cajeros, reportes de auditoría y manual
   ========================================================================== */
.check-chips { display: flex; flex-wrap: wrap; gap: 6px; }
.check-chips .check-chip small { color: var(--muted); font-weight: 500; margin-left: 2px; }
.pt-list { max-height: 220px; overflow: auto; padding: 2px; }
.pt-find { width: 100%; margin-bottom: 8px; }
.promo-presets { grid-template-columns: repeat(4, minmax(0, 1fr)); }
@media (max-width: 720px) { .promo-presets { grid-template-columns: repeat(2, minmax(0, 1fr)); } }

/* Etiqueta de promoción */
.tag-promo { display: inline-flex; align-items: center; font-size: 10px; font-weight: 700; padding: 3px 7px; border-radius: 6px; letter-spacing: .04em; background: var(--danger-soft); color: var(--danger); white-space: nowrap; }
.cart-promo { display: flex; align-items: center; gap: 6px; margin-top: 2px; color: var(--danger); font-weight: 600; }
.cart-promo.muted { color: var(--muted); font-weight: 500; }
.totals .promo-row span:last-child { color: var(--danger); font-weight: 700; }
.totals .promo-row span:first-child { display: inline-flex; align-items: center; gap: 6px; }

/* Multifiltro del punto de venta */
.pf-bar { display: flex; flex-wrap: wrap; gap: 6px; align-items: center; margin-bottom: 6px; }
.pf-dd { position: relative; }
.pf-dd > summary { list-style: none; cursor: pointer; display: inline-flex; align-items: center; gap: 5px; padding: 7px 11px; white-space: nowrap; border-radius: 999px; border: 1px solid var(--border); background: var(--glass-soft); font-size: 13px; font-weight: 600; color: var(--text); user-select: none; transition: border-color .2s, background .2s; }
.pf-dd > summary::-webkit-details-marker { display: none; }
.pf-dd > summary::after { content: ""; width: 7px; height: 7px; border-right: 2px solid currentColor; border-bottom: 2px solid currentColor; transform: rotate(45deg) translateY(-2px); opacity: .55; margin-left: 2px; }
.pf-dd[open] > summary::after { transform: rotate(225deg) translateY(-1px); }
.pf-dd > summary:hover, .pf-dd[open] > summary { border-color: var(--accent); }
.pf-dd.has > summary { border-color: var(--accent); background: var(--accent-soft); }
.pf-dd > summary b { display: inline-grid; place-items: center; min-width: 18px; height: 18px; padding: 0 5px; border-radius: 999px; background: var(--accent); color: var(--accent-ink); font-size: 11px; }
.pf-pop { position: absolute; z-index: 40; top: calc(100% + 6px); left: 0; width: 280px; max-width: calc(100vw - 32px); padding: 10px; border-radius: 14px; border: 1px solid var(--border); background: var(--panel-solid); box-shadow: var(--shadow); display: grid; gap: 8px; }
.pf-pop.wide { width: 320px; }
.pf-find { width: 100%; padding: 8px 10px; border-radius: 10px; border: 1px solid var(--border); background: var(--surface); color: var(--text); font: inherit; font-size: 13px; }
.pf-opts, .pf-flags { display: grid; gap: 2px; max-height: 260px; overflow: auto; }
.pf-opt { display: grid; grid-template-columns: auto 1fr auto; align-items: center; gap: 8px; padding: 6px 8px; border-radius: 8px; font-size: 13px; cursor: pointer; }
.pf-opt:hover { background: var(--fill-hover); }
.pf-opt input { margin: 0; accent-color: var(--accent); }
.pf-opt span { min-width: 0; overflow-wrap: anywhere; color: var(--text); font-weight: 500; }
.pf-opt i { font-style: normal; font-size: 11px; font-weight: 700; color: var(--muted); background: var(--fill); padding: 1px 7px; border-radius: 999px; }
.pf-opt.zero { opacity: .5; }
.pf-price { display: flex; align-items: center; gap: 6px; font-size: 13px; color: var(--muted); border-top: 1px solid var(--border); padding-top: 8px; }
.pf-price input { width: 0; flex: 1; min-width: 0; padding: 7px 8px; border-radius: 10px; border: 1px solid var(--border); background: var(--surface); color: var(--text); font: inherit; }
.pf-bar > .pf-dd > summary { height: 38px; box-sizing: border-box; }
.pf-sortwrap { margin-left: auto; display: inline-flex; align-items: center; gap: 8px; font-size: 13px; color: var(--muted); font-weight: 600; }
.pf-sort { height: 34px; padding: 0 30px 0 12px; border-radius: 999px; border: 1px solid var(--border); background-color: var(--glass-soft); color: var(--text); font: inherit; font-size: 13px; font-weight: 600; cursor: pointer; appearance: none; -webkit-appearance: none;
  background-image: linear-gradient(45deg, transparent 50%, currentColor 50%), linear-gradient(135deg, currentColor 50%, transparent 50%); background-position: calc(100% - 15px) 52%, calc(100% - 10px) 52%; background-size: 5px 5px; background-repeat: no-repeat; }
.pf-sort:hover, .pf-sort:focus { border-color: var(--accent); outline: none; }
.pf-sort option { background: var(--panel-solid); color: var(--text); }
.pf-active { display: flex; flex-wrap: wrap; align-items: center; gap: 6px; min-height: 26px; margin-bottom: 8px; font-size: 13px; }
.pf-count { color: var(--muted); margin-right: 4px; }
.pf-count b { color: var(--text); }
.pf-chip { display: inline-flex; align-items: center; gap: 4px; padding: 4px 6px 4px 10px; border-radius: 999px; border: 1px solid var(--accent); background: var(--accent-soft); color: var(--text); font: inherit; font-size: 12px; font-weight: 600; cursor: pointer; }
.pf-chip svg { width: 12px; height: 12px; }
.pf-chip:hover { background: var(--danger-soft); border-color: var(--danger); }
.chips button small { font-size: 11px; opacity: .7; margin-left: 3px; font-weight: 600; }
@media (max-width: 720px) {
  .pf-sortwrap { margin-left: 0; width: 100%; }
  .pf-sortwrap .pf-sort { flex: 1; }
  .pf-bar { position: relative; }
  .pf-dd { position: static; }
  .pf-pop, .pf-pop.wide { left: 0; right: 0; width: auto; max-width: none; }
}

/* Recepciones en captura */
.rdraft-status { display: flex; flex-wrap: wrap; align-items: center; gap: 6px; font-size: 13px; color: var(--muted); margin: 0 0 10px; }

/* Control de cajeros y auditoría */
.field.inline { display: inline-flex; flex-direction: row; align-items: center; gap: 6px; margin: 0; }
.field.inline input { width: auto; }
.row-actions { display: flex; flex-wrap: wrap; gap: 6px; }
.cc-bar, .aud-bar { display: flex; flex-wrap: wrap; align-items: center; gap: 10px; margin-bottom: 12px; }
.cc-tol { display: inline-flex; align-items: center; gap: 6px; margin-left: auto; }
.aud-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(260px, 1fr)); gap: 12px; margin-top: 12px; }
.aud-card { display: grid; gap: 12px; align-content: space-between; padding: 14px; border-radius: 16px; border: 1px solid var(--border); background: var(--glass-soft); }
.aud-card .doc-head { display: flex; gap: 10px; align-items: flex-start; }
.aud-card .doc-head small { display: block; color: var(--muted); font-size: 12px; margin-top: 2px; line-height: 1.4; }
.aud-foot { display: flex; align-items: center; justify-content: space-between; gap: 8px; }
code.hash { font-size: 11px; padding: 2px 6px; border-radius: 6px; background: var(--fill); color: var(--muted); }

/* Puntos por grupo */
.pts-table td, .pts-table th { padding-top: 6px; padding-bottom: 6px; }
.pts-pct { width: 84px; padding: 6px 8px; border-radius: 8px; border: 1px solid var(--border); background: var(--surface); color: var(--text); font: inherit; text-align: right; }

/* Manual de uso */
.man-wrap { display: grid; grid-template-columns: 260px minmax(0, 1fr); gap: 16px; align-items: start; }
.man-toc { position: sticky; top: 16px; display: grid; gap: 10px; }
.man-toc ol { margin: 0; padding-left: 20px; display: grid; gap: 4px; font-size: 13px; }
.man-toc .link-btn { text-align: left; }
.man-main { display: grid; gap: 16px; min-width: 0; }
.man-list { margin: 0; display: grid; gap: 12px; }
.man-list > div { display: grid; grid-template-columns: 220px minmax(0, 1fr); gap: 12px; padding-top: 12px; border-top: 1px solid var(--border); }
.man-list > div:first-child { border-top: 0; padding-top: 0; }
.man-list dt { font-weight: 700; color: var(--text); }
.man-list dd { margin: 0; color: var(--muted); line-height: 1.55; }
@media (max-width: 960px) {
  .man-wrap { grid-template-columns: 1fr; }
  .man-toc { position: static; }
  .man-list > div { grid-template-columns: 1fr; gap: 4px; }
}

/* Retiro de seguridad */
.ticket .t-sign { margin: 34px 12px 0; border-top: 1px solid #151515; padding-top: 4px; text-align: center; font-size: 11px; }
.drop-alert { border-color: var(--warn); }

/* Cancelación parcial */
.pc-qty { display: inline-flex; align-items: center; gap: 6px; justify-content: flex-end; }
.pc-qty input { width: 70px; padding: 6px 8px; border-radius: 8px; border: 1px solid var(--border); background: var(--surface); color: var(--text); font: inherit; text-align: right; }
.ticket tr.t-returned td { text-decoration: line-through; opacity: .6; }

/* ---------- Celular: dos tarjetas por fila en el punto de venta (va al final para ganar a las reglas de columnas) ---------- */
@media (max-width: 600px) {
  .pos-grid:not(.fixed-cols) { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .prod { padding: 10px; min-height: 0; gap: 4px; }
  .prod-img, .prod-img.ph { aspect-ratio: 16 / 10; }
  .prod .name { font-size: var(--fs-subhead); }
  .prod .price { font-size: var(--fs-callout); }
  .grid-ctl { display: none; }
}
/* ---------- Pantallas táctiles (tablets de mostrador) ----------
   Con dedo, 38 px y los botones ± de 30 px provocan toques erróneos.
   Se sube a 44 px (mínimo recomendado por Apple HIG / WCAG 2.5.5) solo con puntero grueso,
   así el escritorio conserva su densidad. */
@media (pointer: coarse) {
  .btn, .icon-btn { min-height: 44px; }
  .icon-btn { width: 44px; height: 44px; }
  .btn.sm { min-height: 40px; padding: 0 var(--sp-3); }
  .nav-btn { min-height: 44px; }
  .qty { gap: 4px; }
  .qty button { min-width: 40px; min-height: 40px; font-size: 18px; }
  .qty-input { width: 52px; min-height: 40px; font-size: 16px; }
  .checkout-btn { min-height: 56px; }
  .cart-aux { gap: var(--sp-3); }
  .field input, .field select, .select, .search input { min-height: 44px; font-size: 16px; }
}

/* Acción destructiva junto a la venta: rojo al pasar el cursor para que no se confunda. */
.icon-btn.danger-soft:hover, .icon-btn.danger-soft:focus-visible { color: var(--danger); background-image: linear-gradient(var(--danger-soft), var(--danger-soft)); }

/* Deshabilitado: se ve claramente inactivo pero el texto sigue legible (antes .4 quedaba ilegible en modo oscuro). */
.btn:disabled, .btn.primary:disabled, .icon-btn:disabled { opacity: .5; cursor: not-allowed; }

/* Foco visible también en enlaces-botón y chips (navegación con teclado o lector de código). */
.link-btn:focus-visible, .nav-btn:focus-visible, .chip:focus-visible { box-shadow: var(--ring); outline: none; border-radius: var(--r-sm); }

/* Íconos alineados con el texto en botones e insignias, sin importar el tamaño de letra. */
.btn svg, .icon-btn svg, .chip svg, .link-btn svg { flex: none; vertical-align: middle; }

/* Cifras de dinero con ancho fijo: los totales no "bailan" al cambiar cantidades. */
.totals, .cart-line, .kpi .value, .num, .pay-row input { font-variant-numeric: tabular-nums; }

/* Ninguna página del POS debe desplazarse a lo ancho en celular o tablet.
   "clip" (no "hidden") para no convertir body en contenedor de scroll y no romper el menú/encabezado fijos. */
body { overflow-x: clip; }


/* ---------- Importar catálogo (catalogimport.js) ---------- */
.import-steps { margin: 14px 0 8px; padding-left: 22px; display: grid; gap: 14px; }
.import-steps li { line-height: 1.5; }
.import-steps li b { display: block; }
.import-dl { display: flex; gap: 8px; flex-wrap: wrap; margin-top: 8px; }
.import-drop { display: grid; place-items: center; text-align: center; margin-top: 8px; padding: 26px 16px; border: 1.5px dashed var(--border-strong); border-radius: var(--r-md); cursor: pointer; background: var(--fill); transition: border-color .15s, background .15s; }
.import-drop:hover, .import-drop.over { border-color: var(--accent); background: var(--accent-soft); }
.import-drop.busy { opacity: .6; pointer-events: none; }
.import-drop input { position: absolute; width: 1px; height: 1px; opacity: 0; }
.import-drop span { display: grid; gap: 4px; justify-items: center; }
.import-drop svg { width: 26px; height: 26px; color: var(--muted); }
.import-drop small { color: var(--muted); }
.import-mode { display: flex; gap: 8px; flex-wrap: wrap; margin-top: 6px; }
.import-pill { display: inline-flex; align-items: center; gap: 8px; padding: 8px 12px; border-radius: var(--r-md); background: var(--fill); cursor: pointer; font-weight: var(--fw-medium); }
.import-pill input { accent-color: var(--accent-600); }
.import-err { color: var(--danger); display: block; }
