/* ================================================================
   TPV Mascotas — hoja de estilos
   Paleta: pino #1E5C4F · caléndula #F2A33C · tinta #1B2B25
   Sin dependencias externas: funciona sin conexión a internet.
   ================================================================ */

:root {
  --pine: #1E5C4F;
  --pine-dark: #17493F;
  --pine-tint: #E7F0ED;
  --pine-tint-2: #D5E5E0;
  --marigold: #F2A33C;
  --marigold-dark: #DE8F25;
  --danger: #C44536;
  --danger-tint: #FBEAE7;
  --ok: #2E7D5B;
  --ok-tint: #E5F3EC;
  --warn-tint: #FDF3E2;
  --ink: #1B2B25;
  --muted: #5C6B64;
  --bg: #F4F4EF;
  --surface: #FFFFFF;
  --surface-alt: #FAFAF7;
  --border: #E4E4DC;
  --border-strong: #CFCFC2;
  --radius: 12px;
  --radius-sm: 8px;
  --shadow: 0 1px 2px rgba(27, 43, 37, .06), 0 4px 16px rgba(27, 43, 37, .07);
  --shadow-lg: 0 8px 40px rgba(27, 43, 37, .18);
  --font: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  --mono: ui-monospace, SFMono-Regular, "Cascadia Mono", "Courier New", monospace;
}

* { margin: 0; padding: 0; box-sizing: border-box; -webkit-tap-highlight-color: transparent; }
html { font-size: 16px; }
body {
  font-family: var(--font);
  background: var(--bg);
  color: var(--ink);
  -webkit-font-smoothing: antialiased;
  overflow: hidden;
}
button, input, select, textarea { font: inherit; color: inherit; }
button { touch-action: manipulation; }
img { max-width: 100%; }
a { color: var(--pine); }

.money, .mono { font-variant-numeric: tabular-nums; font-feature-settings: "tnum"; }

/* ---------------- arranque ---------------- */
.app-loading { height: 100vh; display: grid; place-items: center; color: var(--muted); }
.boot { text-align: center; font-size: 15px; }
.boot-paw { font-size: 44px; animation: bounce 1s infinite alternate ease-in-out; }
@keyframes bounce { from { transform: translateY(0); } to { transform: translateY(-8px); } }

/* ---------------- estructura general ---------------- */
.shell { display: grid; grid-template-rows: 56px 1fr; grid-template-columns: 216px 1fr; height: 100vh; }
.topbar {
  grid-column: 1 / -1;
  background: var(--pine);
  color: #fff;
  display: flex; align-items: center; gap: 14px;
  padding: 0 16px;
}
.brand { display: flex; align-items: center; gap: 10px; font-weight: 700; font-size: 17px; letter-spacing: .2px; }
.brand .paw { font-size: 22px; }
.topbar .spacer { flex: 1; }
.topbar select {
  background: rgba(255,255,255,.14); color: #fff; border: 1px solid rgba(255,255,255,.35);
  border-radius: var(--radius-sm); padding: 8px 10px; min-height: 40px;
}
.topbar select option { color: var(--ink); }
.chip-branch {
  background: rgba(255,255,255,.16); border: 1px solid rgba(255,255,255,.3);
  padding: 7px 12px; border-radius: 999px; font-size: 13.5px; white-space: nowrap;
}
.user-pill {
  display: flex; align-items: center; gap: 10px;
  background: rgba(255,255,255,.12); border: 1px solid rgba(255,255,255,.28);
  border-radius: 999px; padding: 5px 6px 5px 14px; cursor: pointer; min-height: 42px;
}
.user-pill:hover { background: rgba(255,255,255,.22); }
.user-pill .avatar {
  width: 32px; height: 32px; border-radius: 50%; background: var(--marigold);
  color: #4a2f06; display: grid; place-items: center; font-weight: 800; font-size: 14px;
}
.user-pill .uname { font-size: 13.5px; line-height: 1.15; text-align: left; }
.user-pill .uname small { display: block; opacity: .8; font-size: 11px; text-transform: capitalize; }

.sidebar {
  background: var(--surface);
  border-right: 1px solid var(--border);
  padding: 12px 10px;
  display: flex; flex-direction: column; gap: 4px;
  overflow-y: auto;
}
.nav-item {
  display: flex; align-items: center; gap: 12px;
  padding: 12px 14px; border-radius: var(--radius-sm);
  border: 0; background: transparent; cursor: pointer;
  color: var(--ink); text-align: left; font-size: 15px; font-weight: 500;
  min-height: 46px; width: 100%;
}
.nav-item .ico { font-size: 19px; width: 24px; text-align: center; }
.nav-item:hover { background: var(--surface-alt); }
.nav-item.active { background: var(--pine-tint); color: var(--pine-dark); font-weight: 700; }
.sidebar .nav-foot { margin-top: auto; font-size: 11.5px; color: var(--muted); padding: 10px 12px; line-height: 1.5; }

.main { overflow-y: auto; padding: 20px 22px 40px; }
.main.tpv-main { padding: 0; overflow: hidden; }

/* ---------------- componentes base ---------------- */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  border: 1px solid transparent; border-radius: var(--radius-sm);
  padding: 0 18px; min-height: 44px; font-size: 15px; font-weight: 600;
  cursor: pointer; transition: background .12s, transform .04s;
  background: var(--pine); color: #fff;
}
.btn:hover { background: var(--pine-dark); }
.btn:active { transform: scale(.98); }
.btn:disabled { opacity: .5; cursor: not-allowed; }
.btn.accent { background: var(--marigold); color: #3d2a05; }
.btn.accent:hover { background: var(--marigold-dark); }
.btn.ghost { background: var(--surface); color: var(--ink); border-color: var(--border-strong); }
.btn.ghost:hover { background: var(--surface-alt); }
.btn.danger { background: var(--danger); color: #fff; }
.btn.danger:hover { background: #A93425; }
.btn.sm { min-height: 36px; padding: 0 12px; font-size: 13.5px; }
.btn.big { min-height: 56px; font-size: 18px; border-radius: var(--radius); width: 100%; }
.btn.icon { padding: 0; width: 44px; }

.input, select.input, textarea.input {
  width: 100%; background: var(--surface);
  border: 1px solid var(--border-strong); border-radius: var(--radius-sm);
  padding: 10px 12px; min-height: 44px; font-size: 15px;
}
textarea.input { min-height: 80px; resize: vertical; }
.input:focus, .btn:focus-visible, .nav-item:focus-visible, select:focus, .prod-card:focus-visible {
  outline: 3px solid rgba(242, 163, 60, .55); outline-offset: 1px;
}
.field { margin-bottom: 14px; }
.field > label { display: block; font-size: 13.5px; font-weight: 600; color: var(--muted); margin-bottom: 6px; }
.field .hint { font-size: 12px; color: var(--muted); margin-top: 4px; }
.req::after { content: " *"; color: var(--danger); }

.grid2 { display: grid; grid-template-columns: 1fr 1fr; gap: 0 16px; }
.grid3 { display: grid; grid-template-columns: 1fr 1fr 1fr; gap: 0 16px; }
.row { display: flex; gap: 10px; align-items: center; }
.row.wrap { flex-wrap: wrap; }
.right { margin-left: auto; }

.card {
  background: var(--surface); border: 1px solid var(--border);
  border-radius: var(--radius); box-shadow: var(--shadow);
  padding: 18px;
}
.card + .card { margin-top: 16px; }
.card h2 { font-size: 17px; margin-bottom: 12px; }
.card h3 { font-size: 15px; margin: 14px 0 8px; }

.page-title { font-size: 22px; font-weight: 800; margin-bottom: 4px; }
.page-sub { color: var(--muted); font-size: 14px; margin-bottom: 18px; }

.badge {
  display: inline-block; font-size: 12px; font-weight: 700;
  padding: 3px 9px; border-radius: 999px; white-space: nowrap;
}
.badge.green { background: var(--ok-tint); color: var(--ok); }
.badge.red { background: var(--danger-tint); color: var(--danger); }
.badge.amber { background: var(--warn-tint); color: #9A6310; }
.badge.gray { background: #EEEEE8; color: var(--muted); }

.table-wrap { overflow-x: auto; border: 1px solid var(--border); border-radius: var(--radius); background: var(--surface); }
table.tbl { width: 100%; border-collapse: collapse; font-size: 14px; }
.tbl th {
  text-align: left; font-size: 12px; text-transform: uppercase; letter-spacing: .6px;
  color: var(--muted); background: var(--surface-alt);
  padding: 10px 12px; border-bottom: 1px solid var(--border); white-space: nowrap;
}
.tbl td { padding: 11px 12px; border-bottom: 1px solid var(--border); vertical-align: middle; }
.tbl tr:last-child td { border-bottom: 0; }
.tbl tr.clickable { cursor: pointer; }
.tbl tr.clickable:hover { background: var(--pine-tint); }
.tbl .num { text-align: right; }

.empty {
  text-align: center; color: var(--muted); padding: 36px 16px; font-size: 14.5px;
}
.empty .big-ico { font-size: 38px; display: block; margin-bottom: 8px; }

.banner {
  display: flex; gap: 10px; align-items: flex-start;
  border-radius: var(--radius-sm); padding: 12px 14px; font-size: 14px; margin-bottom: 14px;
}
.banner.warn { background: var(--warn-tint); border: 1px solid #F0D9AE; color: #7A4E0B; }
.banner.danger { background: var(--danger-tint); border: 1px solid #EFC3BC; color: #8C2F23; }
.banner.info { background: var(--pine-tint); border: 1px solid var(--pine-tint-2); color: var(--pine-dark); }

/* ---------------- login ---------------- */
.login-wrap {
  height: 100vh; display: grid; place-items: center;
  background:
    radial-gradient(1100px 500px at 85% -10%, rgba(242,163,60,.18), transparent 60%),
    radial-gradient(900px 600px at -10% 110%, rgba(30,92,79,.16), transparent 60%),
    var(--bg);
  padding: 20px;
}
.login-card {
  width: 100%; max-width: 400px; background: var(--surface);
  border: 1px solid var(--border); border-radius: 18px; box-shadow: var(--shadow-lg);
  padding: 34px 30px 28px;
}
.login-card .logo { text-align: center; margin-bottom: 22px; }
.login-card .logo .paw { font-size: 46px; display: block; }
.login-card .logo h1 { font-size: 22px; margin-top: 8px; }
.login-card .logo p { color: var(--muted); font-size: 13.5px; margin-top: 3px; }
.login-err { background: var(--danger-tint); color: #8C2F23; border-radius: var(--radius-sm); padding: 10px 12px; font-size: 13.5px; margin-bottom: 12px; }

/* ---------------- TPV (venta) ---------------- */
/* El panel protagonista es el ticket (derecha); la búsqueda queda compacta a la izquierda */
.tpv-layout { display: grid; grid-template-columns: 380px 1fr; height: 100%; }
.tpv-left { padding: 16px 18px; overflow-y: auto; -webkit-overflow-scrolling: touch; display: flex; flex-direction: column; gap: 14px; }

.tpv-search { position: relative; }
.tpv-search .input { padding-left: 44px; min-height: 52px; font-size: 17px; border-radius: var(--radius); }
.tpv-search .lens { position: absolute; left: 14px; top: 50%; transform: translateY(-50%); font-size: 20px; color: var(--muted); }

.cat-chips { display: flex; gap: 8px; flex-wrap: wrap; }
.chip {
  border: 1px solid var(--border-strong); background: var(--surface);
  border-radius: 999px; padding: 0 16px; min-height: 40px;
  display: inline-flex; align-items: center; cursor: pointer; font-size: 14px; font-weight: 600;
}
.chip:hover { background: var(--surface-alt); }
.chip.active { background: var(--pine); border-color: var(--pine); color: #fff; }

.prod-grid {
  display: grid; grid-template-columns: repeat(auto-fill, minmax(168px, 1fr));
  gap: 12px; align-content: start;
}
.prod-card {
  background: var(--surface); border: 1px solid var(--border);
  border-radius: var(--radius); padding: 12px;
  display: flex; flex-direction: column; gap: 8px; min-height: 116px;
  cursor: pointer; text-align: left; transition: transform .06s, box-shadow .12s, border-color .12s;
}
.prod-card:hover { border-color: var(--pine); box-shadow: var(--shadow); transform: translateY(-1px); }
.prod-card:active { transform: scale(.985); }
.prod-card .pname { font-weight: 600; font-size: 14.5px; line-height: 1.3; flex: 1; }
.prod-card .pmeta { display: flex; align-items: flex-end; justify-content: space-between; gap: 6px; }
.prod-card .pprice { font-size: 17px; font-weight: 800; color: var(--pine-dark); }
.prod-card .pstock { font-size: 11.5px; }
.prod-card .pcat { font-size: 11px; color: var(--muted); text-transform: uppercase; letter-spacing: .5px; }

/* --- resultados de búsqueda compactos (panel izquierdo) --- */
.prod-results { display: flex; flex-direction: column; gap: 6px; }
.prod-results .empty.pad-tall { padding: 56px 12px; text-align: center; line-height: 1.6; }
.prod-row {
  display: grid; grid-template-columns: 1fr auto auto; align-items: center; gap: 10px;
  background: var(--surface); border: 1px solid var(--border);
  border-radius: var(--radius-sm); padding: 10px 12px; cursor: pointer;
  text-align: left; font: inherit; min-height: 52px;
}
.prod-row:hover { border-color: var(--pine); background: var(--pine-tint); }
.prod-row .pr-name { font-size: 14px; font-weight: 600; line-height: 1.25; }
.prod-row .pr-name small { display: block; color: var(--muted); font-weight: 400; font-size: 11px; text-transform: uppercase; letter-spacing: .4px; }
.prod-row .pr-price { font-weight: 800; font-size: 15px; color: var(--pine-dark); white-space: nowrap; }
.prod-row .pr-stock { font-size: 11.5px; }

.select-toggle {
  display: flex; align-items: center; gap: 6px; justify-content: center;
  background: var(--surface); border: 1px dashed var(--border-strong);
  border-radius: var(--radius-sm); padding: 9px 12px; cursor: pointer;
  font: inherit; font-size: 13.5px; font-weight: 600; color: var(--muted);
}
.select-toggle small { font-weight: 400; }
.select-toggle.active { background: var(--pine); border-color: var(--pine); color: #fff; }
.select-toggle.active small { color: rgba(255,255,255,.8); }

/* ficha de producto del modo Seleccionar */
.pinfo {
  background: var(--surface); border: 1px solid var(--pine);
  border-radius: var(--radius); padding: 16px;
}
.pinfo-cat { font-size: 11px; color: var(--muted); text-transform: uppercase; letter-spacing: .5px; }
.pinfo-name { font-size: 17px; font-weight: 700; line-height: 1.3; margin: 4px 0 8px; }
.pinfo-price { font-size: 26px; font-weight: 800; color: var(--pine-dark); }
.pinfo-meta { display: flex; gap: 6px; flex-wrap: wrap; margin-top: 8px; }

/* --- carrito estilo ticket térmico --- */
.tpv-cart {
  background: #EDEDE6; border-left: 1px solid var(--border);
  display: flex; flex-direction: column; padding: 14px; overflow: hidden;
}
.ticket-panel {
  background: var(--surface); flex: 1; display: flex; flex-direction: column; min-height: 0;
  box-shadow: var(--shadow);
  --notch: 10px;
  clip-path: polygon(
    0 6px, 3% 0, 6% 6px, 9% 0, 12% 6px, 15% 0, 18% 6px, 21% 0, 24% 6px, 27% 0,
    30% 6px, 33% 0, 36% 6px, 39% 0, 42% 6px, 45% 0, 48% 6px, 51% 0, 54% 6px, 57% 0,
    60% 6px, 63% 0, 66% 6px, 69% 0, 72% 6px, 75% 0, 78% 6px, 81% 0, 84% 6px, 87% 0,
    90% 6px, 93% 0, 96% 6px, 100% 0,
    100% calc(100% - 6px), 97% 100%, 94% calc(100% - 6px), 91% 100%, 88% calc(100% - 6px), 85% 100%,
    82% calc(100% - 6px), 79% 100%, 76% calc(100% - 6px), 73% 100%, 70% calc(100% - 6px), 67% 100%,
    64% calc(100% - 6px), 61% 100%, 58% calc(100% - 6px), 55% 100%, 52% calc(100% - 6px), 49% 100%,
    46% calc(100% - 6px), 43% 100%, 40% calc(100% - 6px), 37% 100%, 34% calc(100% - 6px), 31% 100%,
    28% calc(100% - 6px), 25% 100%, 22% calc(100% - 6px), 19% 100%, 16% calc(100% - 6px), 13% 100%,
    10% calc(100% - 6px), 7% 100%, 4% calc(100% - 6px), 1% 100%, 0 calc(100% - 6px)
  );
}
.ticket-head { padding: 16px 16px 10px; border-bottom: 1px dashed var(--border-strong); }
.ticket-head .th-title { font-weight: 800; font-size: 15px; display: flex; align-items: center; gap: 8px; }
.ticket-client {
  margin-top: 10px; display: flex; align-items: center; gap: 8px;
  background: var(--surface-alt); border: 1px dashed var(--border-strong);
  border-radius: var(--radius-sm); padding: 8px 10px; cursor: pointer; min-height: 44px; width: 100%;
  font-size: 13.5px; text-align: left;
}
.ticket-client:hover { background: var(--pine-tint); }
.ticket-client .tc-x { margin-left: auto; color: var(--muted); font-size: 17px; padding: 4px 8px; }

.cart-lines { flex: 1; overflow-y: auto; -webkit-overflow-scrolling: touch; padding: 6px 10px; }
.cart-line {
  display: grid; grid-template-columns: 1fr auto; gap: 2px 10px;
  padding: 10px 6px; border-bottom: 1px dotted var(--border);
}
.cart-line .cl-name { font-size: 14px; font-weight: 600; line-height: 1.25; }
.cart-line .cl-total { font-family: var(--mono); font-weight: 700; font-size: 14.5px; align-self: start; }
.cart-line .cl-controls { grid-column: 1 / -1; display: flex; align-items: center; gap: 8px; margin-top: 4px; }
.qty-btn {
  width: 38px; height: 38px; border-radius: var(--radius-sm);
  border: 1px solid var(--border-strong); background: var(--surface);
  font-size: 19px; font-weight: 700; cursor: pointer; line-height: 1;
}
.qty-btn:hover { background: var(--pine-tint); }
.cl-qty { min-width: 30px; text-align: center; font-weight: 700; font-family: var(--mono); font-size: 15px; }
.cl-price {
  border: 1px dashed var(--border-strong); background: var(--surface-alt);
  border-radius: var(--radius-sm); padding: 6px 10px; font-family: var(--mono);
  font-size: 13.5px; cursor: pointer; min-height: 38px; display: inline-flex; align-items: center; gap: 6px;
}
.cl-price:hover { background: var(--warn-tint); border-color: var(--marigold); }
.cl-price.overridden { background: var(--warn-tint); border-color: var(--marigold); color: #7A4E0B; font-weight: 700; }
.cl-dto {
  border: 1px dashed var(--border-strong); background: var(--surface-alt);
  border-radius: var(--radius-sm); width: 38px; min-height: 38px; cursor: pointer;
  font-size: 14px; font-weight: 700; color: var(--muted);
}
.cl-dto:hover { background: var(--pine-tint); border-color: var(--pine); color: var(--pine-dark); }
.cl-dto.on { background: var(--pine-tint); border-color: var(--pine); color: var(--pine-dark); }
.cart-line .cl-disc { grid-column: 1 / -1; font-size: 12px; color: var(--pine-dark); font-weight: 600; }
.cl-del { margin-left: auto; background: none; border: 0; color: var(--muted); font-size: 18px; cursor: pointer; padding: 8px; }
.cl-del:hover { color: var(--danger); }

.cart-empty { text-align: center; color: var(--muted); padding: 40px 14px; font-size: 14px; }
.cart-empty .big-ico { font-size: 40px; display: block; margin-bottom: 8px; }

.ticket-totals { border-top: 1px dashed var(--border-strong); padding: 12px 16px 16px; }
.tt-row { display: flex; justify-content: space-between; font-size: 13.5px; color: var(--muted); padding: 2px 0; font-family: var(--mono); }
.tt-row.disc { color: var(--pine-dark); font-weight: 700; }
.tt-x { background: none; border: 0; color: var(--muted); cursor: pointer; font-size: 12px; padding: 0 4px; }
.tt-x:hover { color: var(--danger); }
.ticket-tools { display: flex; gap: 8px; margin: 8px 0 2px; }
.ticket-tools .btn { flex: 1; }
.inv-toggle { display: flex; align-items: center; gap: 10px; margin-bottom: 12px; padding: 10px 12px; background: var(--surface-alt); border: 1px dashed var(--border-strong); border-radius: var(--radius-sm); }
.tt-total { display: flex; justify-content: space-between; align-items: baseline; margin: 8px 0 12px; }
.tt-total .lbl { font-size: 15px; font-weight: 800; letter-spacing: 1px; }
.tt-total .val { font-size: 30px; font-weight: 800; font-family: var(--mono); color: var(--pine-dark); }
.cart-actions { display: flex; gap: 10px; }
.cart-actions .btn.big { flex: 1; }

/* ---------------- modales ---------------- */
.modal-back {
  position: fixed; inset: 0; background: rgba(20, 30, 26, .45);
  display: grid; place-items: center; z-index: 80; padding: 18px;
  animation: fadein .12s ease-out;
}
@keyframes fadein { from { opacity: 0; } to { opacity: 1; } }
.modal {
  background: var(--surface); border-radius: 16px; box-shadow: var(--shadow-lg);
  width: 100%; max-width: 540px; max-height: 92vh; display: flex; flex-direction: column;
  animation: pop .14s ease-out;
}
@keyframes pop { from { transform: scale(.97); opacity: .6; } to { transform: scale(1); opacity: 1; } }
.modal.wide { max-width: 760px; }
.modal.xl { max-width: 980px; }
.modal-h {
  display: flex; align-items: center; gap: 10px;
  padding: 16px 20px; border-bottom: 1px solid var(--border);
}
.modal-h h2 { font-size: 17px; flex: 1; }
.modal-x { background: none; border: 0; font-size: 22px; cursor: pointer; color: var(--muted); padding: 6px 10px; border-radius: 8px; }
.modal-x:hover { background: var(--surface-alt); color: var(--ink); }
.modal-b { padding: 18px 20px; overflow-y: auto; -webkit-overflow-scrolling: touch; }
.modal-f { padding: 14px 20px; border-top: 1px solid var(--border); display: flex; gap: 10px; justify-content: flex-end; }

/* cobro */
.pay-tabs { display: grid; grid-template-columns: repeat(5, 1fr); gap: 8px; margin-bottom: 16px; }
.pay-tab {
  border: 1.5px solid var(--border-strong); background: var(--surface);
  border-radius: var(--radius-sm); min-height: 56px; cursor: pointer;
  font-size: 13px; font-weight: 700; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 2px;
}
.pay-tab .ico { font-size: 20px; }
.pay-tab.active { border-color: var(--pine); background: var(--pine-tint); color: var(--pine-dark); }
.pay-total-line { display: flex; justify-content: space-between; align-items: baseline; margin-bottom: 14px; }
/* mixto multi-split */
.mx-row { display: flex; gap: 8px; align-items: center;
  padding: 8px 0; border-bottom: 1px solid var(--border); }
.mx-row:last-child { border-bottom: 0; }
.mx-row .input { font-size: 14px; }
.mx-row.mx-active { background: var(--pine-tint); border-radius: var(--radius-sm); padding: 8px; margin: 0 -8px; }
.mx-amt-col { display: flex; flex-direction: column; gap: 6px; flex: 1; }
.mx-eff-sub { display: flex; gap: 8px; align-items: center; font-size: 13px; color: var(--muted); }
.mx-eff-sub .input { flex: 1; }
.mx-chg-ok { font-weight: 700; color: var(--pine); white-space: nowrap; }
.mx-amt-btn {
  flex: 1; background: var(--surface-alt); border: 2px solid var(--border-strong);
  border-radius: var(--radius-sm); padding: 10px 14px; font-size: 18px; font-weight: 800;
  font-family: var(--mono); cursor: pointer; text-align: right;
  color: var(--ink); min-height: 52px; touch-action: manipulation;
}
.mx-row.mx-active .mx-amt-btn { border-color: var(--pine); background: #fff; }
.mx-amt-btn:hover { border-color: var(--pine); }
.mx-rm-btn {
  background: none; border: 1.5px solid var(--border); border-radius: var(--radius-sm);
  width: 34px; height: 34px; font-size: 16px; cursor: pointer; color: var(--muted);
  display: flex; align-items: center; justify-content: center; flex-shrink: 0;
}
.mx-rm-btn:hover { background: var(--danger-tint); border-color: var(--danger); color: var(--danger); }
.mx-remaining { display: flex; justify-content: space-between; align-items: baseline;
  padding: 8px 12px; border-radius: var(--radius-sm); font-size: 15px; font-weight: 700; }
.mx-remaining.pending { background: var(--warn-tint); color: var(--warn); }
.mx-remaining.over { background: var(--danger-tint); color: var(--danger); }
.mx-remaining.ok { background: var(--pine-tint); color: var(--pine-dark); }
.mx-np-label { font-size: 13px; color: var(--muted); font-weight: 600; margin-bottom: 8px; }
.numpad-preset { flex: 1; min-width: 80px; background: var(--surface-alt);
  border: 1.5px solid var(--border); border-radius: var(--radius-sm);
  padding: 12px 8px; font-size: 15px; font-weight: 700; cursor: pointer;
  touch-action: manipulation; line-height: 1.3; }
.numpad-preset:active, .numpad-preset:hover { background: var(--pine-tint); border-color: var(--pine); }
.numpad-preset.exact { background: var(--pine); color: #fff; border-color: var(--pine); }
.numpad-preset.exact:active { background: var(--pine-dark); }
.pay-coupon-banner {
  display: flex; align-items: center; gap: 10px; flex-wrap: wrap;
  background: var(--pine-tint); border: 1.5px solid var(--pine);
  border-radius: var(--radius-sm); padding: 8px 12px; margin-bottom: 12px;
}
.pay-coupon-banner .disc { font-weight: 800; color: var(--pine-dark); margin-left: auto; font-size: 16px; font-family: var(--mono); }
.pay-coupon-x { background: none; border: none; cursor: pointer; font-size: 16px; color: var(--muted); padding: 2px 4px; }
.pay-total-line .val { font-size: 28px; font-weight: 800; font-family: var(--mono); }
.quick-cash { display: flex; gap: 8px; flex-wrap: wrap; margin: 8px 0 4px; }
.change-box {
  margin-top: 12px; background: var(--ok-tint); border: 1px solid #BFE3D2;
  border-radius: var(--radius-sm); padding: 12px 14px;
  display: flex; justify-content: space-between; align-items: baseline;
}
.change-box.neg { background: var(--danger-tint); border-color: #EFC3BC; }
.change-box .val { font-size: 24px; font-weight: 800; font-family: var(--mono); }
.sale-done { text-align: center; padding: 8px 4px 4px; }
.sale-done .ok-ico { font-size: 52px; }
.sale-done h3 { font-size: 20px; margin: 8px 0 2px; }
.sale-done .change-big { font-size: 38px; font-weight: 800; font-family: var(--mono); color: var(--pine-dark); margin: 10px 0; }

/* ---------------- teclado numérico (cobro táctil) ---------------- */
.numpad-wrap { display: flex; gap: 18px; align-items: flex-start; }
.numpad-right { flex: 1; display: flex; flex-direction: column; gap: 12px; }
.numpad-display {
  background: var(--ink); color: #fff;
  border-radius: var(--radius); padding: 18px 22px;
  font-family: var(--mono); font-size: 44px; font-weight: 800;
  text-align: right; letter-spacing: 1px; min-height: 88px;
  display: flex; align-items: center; justify-content: flex-end;
  user-select: none;
}
.numpad-display.hint { color: #8BA89E; font-size: 28px; }
.numpad-grid {
  display: grid; grid-template-columns: repeat(3, 1fr); gap: 10px;
}
.numpad-key {
  background: var(--surface); border: 2px solid var(--border-strong);
  border-radius: var(--radius); font-size: 28px; font-weight: 700;
  min-height: 88px; min-width: 88px; cursor: pointer; display: flex; align-items: center;
  justify-content: center; transition: background .08s, transform .06s;
  touch-action: manipulation; user-select: none;
}
.numpad-key:active { transform: scale(.94); }
.numpad-key:active, .numpad-key:hover { background: var(--pine-tint); border-color: var(--pine); }
.numpad-key.numpad-back { font-size: 22px; color: var(--muted); }
.numpad-key.numpad-back:active { background: var(--danger-tint); border-color: var(--danger); color: var(--danger); }
.numpad-key.numpad-00 { font-size: 22px; }
.numpad-key.numpad-comma { font-size: 26px; font-weight: 900; color: var(--pine-dark); }
.numpad-presets { display: flex; gap: 8px; flex-wrap: wrap; }
.numpad-presets button {
  flex: 1; min-width: 80px; background: var(--surface-alt);
  border: 1.5px solid var(--border); border-radius: var(--radius-sm);
  padding: 12px 8px; font-size: 15px; font-weight: 700; cursor: pointer;
  touch-action: manipulation; line-height: 1.3;
}
.numpad-presets button:active, .numpad-presets button:hover { background: var(--pine-tint); border-color: var(--pine); }
.numpad-presets button.exact { background: var(--pine); color: #fff; border-color: var(--pine); }
.numpad-presets button.exact:active { background: var(--pine-dark); }


/* supervisor / override */
.sup-box {
  background: var(--warn-tint); border: 1px solid #F0D9AE;
  border-radius: var(--radius-sm); padding: 12px 14px; margin-top: 12px;
}
.sup-box h4 { font-size: 13.5px; color: #7A4E0B; margin-bottom: 8px; }

/* ---------------- devoluciones ---------------- */
.refund-lookup { display: flex; gap: 10px; }
.refund-lookup .input { font-size: 18px; min-height: 54px; text-transform: uppercase; font-family: var(--mono); letter-spacing: 1px; }
.strict-note { display: flex; gap: 10px; align-items: center; margin-top: 12px; color: var(--muted); font-size: 13.5px; }
.qty-stepper { display: inline-flex; align-items: center; gap: 6px; }

/* ---------------- informes ---------------- */
.kpis { display: grid; grid-template-columns: repeat(auto-fit, minmax(170px, 1fr)); gap: 12px; margin-bottom: 16px; }
.kpi { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); padding: 14px 16px; box-shadow: var(--shadow); }
.kpi .k-lbl { font-size: 12.5px; color: var(--muted); text-transform: uppercase; letter-spacing: .6px; }
.kpi .k-val { font-size: 24px; font-weight: 800; font-family: var(--mono); margin-top: 4px; }
.kpi.neg .k-val { color: var(--danger); }
.barchart { display: flex; align-items: flex-end; gap: 6px; height: 160px; padding: 8px 4px 0; }
.barchart .bar { flex: 1; background: var(--pine); border-radius: 4px 4px 0 0; min-width: 10px; position: relative; }
.barchart .bar.neg { background: var(--danger); }
.barchart .bar:hover::after {
  content: attr(data-tip); position: absolute; bottom: 100%; left: 50%; transform: translateX(-50%);
  background: var(--ink); color: #fff; font-size: 11.5px; padding: 4px 8px; border-radius: 6px;
  white-space: nowrap; margin-bottom: 4px; z-index: 5;
}
.bar-labels { display: flex; gap: 6px; padding: 4px 4px 0; }
.bar-labels span { flex: 1; text-align: center; font-size: 10.5px; color: var(--muted); overflow: hidden; }

/* ---------------- ajustes ---------------- */
.tabs { display: flex; gap: 6px; flex-wrap: wrap; border-bottom: 1px solid var(--border); margin-bottom: 18px; }
.tab {
  border: 0; background: none; padding: 12px 16px; cursor: pointer;
  font-size: 14.5px; font-weight: 600; color: var(--muted);
  border-bottom: 3px solid transparent; min-height: 46px;
}
.tab:hover { color: var(--ink); }
.tab.active { color: var(--pine-dark); border-bottom-color: var(--marigold); }

.switch { position: relative; display: inline-flex; align-items: center; gap: 10px; cursor: pointer; min-height: 44px; }
.switch input { position: absolute; opacity: 0; }
.switch .sl {
  width: 48px; height: 28px; border-radius: 999px; background: #D5D5CB; transition: background .15s; flex-shrink: 0;
}
.switch .sl::after {
  content: ""; position: absolute; width: 22px; height: 22px; border-radius: 50%;
  background: #fff; top: 50%; transform: translateY(-50%); left: 3px; transition: left .15s;
  box-shadow: 0 1px 3px rgba(0,0,0,.25);
}
.switch input:checked + .sl { background: var(--pine); }
.switch input:checked + .sl::after { left: 23px; }

/* ---------------- clientes ---------------- */
.clients-layout { display: grid; grid-template-columns: 330px 1fr; gap: 16px; align-items: start; }
.client-list { max-height: calc(100vh - 220px); overflow-y: auto; }
.client-item {
  width: 100%; text-align: left; border: 0; background: none; cursor: pointer;
  padding: 12px 14px; border-bottom: 1px solid var(--border); min-height: 56px;
}
.client-item:hover { background: var(--surface-alt); }
.client-item.active { background: var(--pine-tint); }
.client-item .ci-name { font-weight: 700; font-size: 14.5px; }
.client-item .ci-sub { font-size: 12.5px; color: var(--muted); margin-top: 2px; }
.pet-card {
  border: 1px solid var(--border); border-radius: var(--radius-sm);
  padding: 12px 14px; background: var(--surface-alt); margin-bottom: 10px;
}
.pet-card .ph { display: flex; align-items: center; gap: 8px; font-weight: 700; }
.pet-vals { font-size: 13px; color: var(--muted); margin-top: 6px; display: flex; flex-wrap: wrap; gap: 4px 14px; }

/* ---------------- caja ---------------- */
.cash-status { display: grid; grid-template-columns: repeat(auto-fit, minmax(160px, 1fr)); gap: 12px; margin: 12px 0; }
.diff-pos { color: var(--ok); font-weight: 800; }
.diff-neg { color: var(--danger); font-weight: 800; }

/* ---------------- toasts ---------------- */
#toasts { position: fixed; bottom: 18px; left: 50%; transform: translateX(-50%); z-index: 200; display: flex; flex-direction: column; gap: 8px; align-items: center; }
.toast {
  background: var(--ink); color: #fff; padding: 12px 18px; border-radius: 10px;
  box-shadow: var(--shadow-lg); font-size: 14.5px; max-width: 560px;
  animation: toast-in .18s ease-out;
}
.toast.err { background: var(--danger); }
.toast.ok { background: var(--ok); }
@keyframes toast-in { from { transform: translateY(12px); opacity: 0; } to { transform: translateY(0); opacity: 1; } }

/* ---------------- responsive ---------------- */
@media (max-width: 1060px) {
  .shell { grid-template-columns: 64px 1fr; }
  .nav-item span.txt { display: none; }
  .nav-item { justify-content: center; padding: 12px 6px; }
  .sidebar .nav-foot { display: none; }
  .tpv-layout { grid-template-columns: 320px 1fr; }
}
@media (max-width: 820px) {
  body { overflow: auto; }
  .shell { display: flex; flex-direction: column; height: auto; min-height: 100vh; }
  .sidebar { flex-direction: row; border-right: 0; border-bottom: 1px solid var(--border); overflow-x: auto; position: sticky; top: 0; z-index: 30; }
  .main { overflow: visible; }
  .main.tpv-main { overflow: visible; }
  .tpv-layout { grid-template-columns: 1fr; height: auto; }
  .tpv-cart { border-left: 0; }
  .cart-lines { max-height: 40vh; }
  .clients-layout { grid-template-columns: 1fr; }
  .grid2, .grid3 { grid-template-columns: 1fr; }
  .chip-branch { display: none; }
}

@media print { .shell, #toasts, #modal-root { display: none !important; } }

/* ---------- vistas de gestión (caja, fichaje, informes, ajustes) ---------- */
.view-pad h1 { margin: 2px 0 16px; font-size: 24px; }
.view-pad h2 { margin: 18px 0 10px; font-size: 17px; }
.toolbar { display: flex; gap: 10px; align-items: center; flex-wrap: wrap; margin-bottom: 14px; }
.card.narrow { max-width: 560px; }
.diff-ok { color: var(--pine); font-weight: 700; }
.row-off td { opacity: .45; }
.btn.mini { padding: 5px 10px; font-size: 13px; min-height: 0; }
.tabs.sub { margin: 4px 0 14px; }
.tbl.small td, .tbl.small th { padding: 6px 9px; font-size: 13px; }
.rp-grid { gap: 26px; margin-top: 24px; align-items: start; }
.bar.bar-neg { background: var(--danger); align-self: flex-end; }

/* fichaje */
.tc-card { max-width: 560px; }
.tc-status { display: flex; gap: 14px; align-items: center; margin-bottom: 6px; }
.tc-dot { width: 16px; height: 16px; border-radius: 50%; flex: 0 0 auto; }
.tc-on  .tc-dot { background: #2e9e5b; box-shadow: 0 0 0 5px rgba(46,158,91,.18); animation: tcpulse 2s infinite; }
.tc-off .tc-dot { background: #b9b9af; }
.tc-big { font-size: 20px; font-weight: 800; }
.tc-sub { color: var(--muted, #5d6b64); font-size: 14px; margin-top: 2px; }
.tc-card .btn.lg { width: 100%; margin-top: 12px; }
@keyframes tcpulse { 50% { box-shadow: 0 0 0 9px rgba(46,158,91,.07); } }

/* ---------- banner variante ok ---------- */
.banner.ok { background: #d4f0e0; border: 1px solid #8ecead; color: #1e5e3a; }

/* ---------- TPV: producto sin stock (cajero) ---------- */
.prod-no-stock { opacity: .45; cursor: not-allowed !important; position: relative; }
.prod-no-stock::after {
  content: "Sin stock";
  position: absolute; inset: 0;
  display: flex; align-items: center; justify-content: center;
  background: rgba(0,0,0,.38);
  color: #fff; font-size: 11px; font-weight: 700; letter-spacing: .05em;
  border-radius: inherit; pointer-events: none;
}

/* ---------- badge Rx (receta veterinaria) ---------- */
.rx-badge {
  display: inline-block;
  background: #c0392b; color: #fff;
  font-size: 10px; font-weight: 800; letter-spacing: .04em;
  padding: 1px 5px; border-radius: 4px;
  vertical-align: middle; margin-left: 4px;
}

/* ---------- sección receta en modal de cobro ---------- */
.rx-pay-section {
  background: #fffbf0;
  border: 1.5px solid #f0c050;
  border-radius: 10px;
  padding: 14px 16px;
  margin-bottom: 14px;
}
.rx-pay-header { font-size: 15px; margin-bottom: 4px; }
.rx-pay-hint { font-size: 13px; color: var(--muted); margin: 0 0 10px; }
.rx-pay-upload { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
.rx-pay-fname { font-size: 13px; color: var(--muted); }
.rx-pay-thumb {
  max-width: 200px; max-height: 140px;
  border-radius: 6px; border: 1px solid var(--border);
  object-fit: contain;
}
