:root {
  --bg: #f6f0e8;
  --surface: rgba(255, 250, 244, 0.9);
  --surface-strong: #fffdfa;
  --surface-soft: rgba(255, 249, 242, 0.72);
  --text: #2f2723;
  --text-soft: #6f625a;
  --accent: #c2a188;
  --accent-strong: #9d7155;
  --line: rgba(86, 69, 58, 0.14);
  --shadow: 0 24px 60px rgba(58, 43, 33, 0.12);
  --shadow-soft: 0 12px 30px rgba(58, 43, 33, 0.08);
  --radius-xl: 28px;
  --radius-lg: 22px;
  --radius-md: 16px;
  --radius-sm: 6px; /* M2: definida para uso en TPV */
  --sidebar-w: 248px;
}

*, *::before, *::after { box-sizing: border-box; }

html { font-size: 16px; }

body {
  margin: 0;
  color: var(--text);
  font-family: "Inter", system-ui, -apple-system, sans-serif;
  line-height: 1.55;
  background:
    radial-gradient(circle at top left, rgba(210, 182, 157, 0.18), transparent 30%),
    linear-gradient(180deg, #fffdfa 0%, var(--bg) 60%, #f1e8dd 100%);
  min-height: 100vh;
}

h1, h2, h3 { font-family: "Inter", sans-serif; margin: 0; line-height: 1.18; font-weight: 700; letter-spacing: -0.01em; }

a { color: inherit; text-decoration: none; }
img { display: block; max-width: 100%; }
.muted { color: var(--text-soft); }
.ta-right { text-align: right; }

/* ---------- Botones / campos ---------- */
.button-primary {
  display: inline-flex; align-items: center; justify-content: center;
  padding: 0.85rem 1.4rem; border: 0; border-radius: 999px; cursor: pointer;
  font: inherit; font-weight: 600; color: #fffdfa;
  background: linear-gradient(135deg, #b79378 0%, #9a6d50 100%);
  box-shadow: 0 16px 30px rgba(154, 109, 80, 0.22);
  transition: transform 160ms ease, box-shadow 160ms ease;
}
.button-primary:hover { transform: translateY(-1px); box-shadow: 0 20px 38px rgba(154, 109, 80, 0.28); }

.button-link {
  border: 0; background: none; cursor: pointer; font: inherit; font-weight: 600;
  color: var(--accent-strong); padding: 0;
}
.button-link:hover { text-decoration: underline; }

label { display: grid; gap: 0.45rem; color: var(--text-soft); text-align: left; }
.field-label-text { font-size: 0.9rem; font-weight: 600; }
.field-label-text-wrap { display: flex; align-items: center; gap: 0.3rem; }
input, select, textarea {
  width: 100%; padding: 0.85rem 1rem; font: inherit; color: var(--text);
  border: 1px solid var(--line); border-radius: 14px;
  background: rgba(255, 255, 255, 0.88);
  transition: border-color 160ms ease, box-shadow 160ms ease;
}
input:focus-visible, select:focus-visible, textarea:focus-visible {
  outline: none; border-color: rgba(157, 113, 85, 0.5);
  box-shadow: 0 0 0 3px rgba(194, 161, 136, 0.2);
}

.flash { padding: 0.85rem 1.05rem; border-radius: 14px; border: 1px solid var(--line); margin-bottom: 1rem; }
.flash-error { background: rgba(248, 227, 225, 0.9); color: #8d4a3c; }
.flash-success { background: rgba(221, 242, 227, 0.9); color: #3c6b4f; }

/* ---------- Login ---------- */
.tpv-auth { display: grid; place-items: center; padding: 1.5rem; }
.auth-wrap { width: min(26rem, 100%); }
.auth-card {
  display: grid; gap: 1rem; padding: 2rem 1.8rem; text-align: center;
  background: var(--surface); border: 1px solid var(--line);
  border-radius: var(--radius-xl); box-shadow: var(--shadow); backdrop-filter: blur(12px);
}
.auth-brand { font-family: "Inter", sans-serif; font-weight: 800; font-size: 2rem; letter-spacing: 0.02em; color: var(--accent-strong); }
.auth-logo { width: 116px; height: auto; margin: 0 auto 0.2rem; }
.auth-sub { margin: -0.4rem 0 0.6rem; color: var(--text-soft); letter-spacing: 0.16em; text-transform: uppercase; font-size: 0.72rem; }

/* ---------- Shell ---------- */
.shell-grid { display: grid; grid-template-columns: var(--sidebar-w) 1fr; min-height: 100vh; }
.shell-main { min-width: 0; display: flex; flex-direction: column; }

.tpv-sidebar {
  position: sticky; top: 0; align-self: start; height: 100vh;
  display: flex; flex-direction: column; gap: 0.9rem; padding: 1rem 0.8rem;
  background: var(--surface); border-right: 1px solid var(--line); backdrop-filter: blur(12px);
}
.sidebar-brand { display: flex; flex-direction: column; align-items: center; gap: 0.25rem; padding: 0.2rem 0 0.4rem; }
.sidebar-brand img { width: 78px; height: auto; }
.sidebar-brand span { font-size: 0.68rem; letter-spacing: 0.22em; text-transform: uppercase; color: var(--text-soft); font-weight: 700; }
.sidebar-nav { display: flex; flex-direction: column; gap: 0.85rem; overflow-y: auto; flex: 1; }
.sidebar-group { display: flex; flex-direction: column; gap: 0.35rem; }
/* Separación explícita entre grupos (TPV / GESTIÓN) */
.sidebar-group + .sidebar-group { margin-top: 0.55rem; padding-top: 1rem; border-top: 1px solid rgba(86, 69, 58, 0.2); }
.sidebar-group-label { display: flex; align-items: center; gap: 0.4rem; margin: 0 0.3rem 0.2rem; font-size: 0.68rem; letter-spacing: 0.16em; text-transform: uppercase; color: var(--text-soft); }
.nav-icon { width: 18px; height: 18px; flex: 0 0 auto; }
.sidebar-group-label .nav-icon { width: 15px; height: 15px; }
.sidebar-nav a {
  display: flex; align-items: center; justify-content: flex-start; gap: 0.65rem; text-align: left;
  padding: 0.55rem 0.9rem 0.55rem 1.05rem; border-radius: 11px; border: 1px solid var(--line);
  background: rgba(255, 255, 255, 0.55); color: var(--text-soft); font-weight: 500; font-size: 0.95rem;
  transition: background-color 150ms ease, color 150ms ease, border-color 150ms ease;
}
.sidebar-nav a:hover { background: rgba(194, 161, 136, 0.16); color: var(--text); border-color: rgba(157, 113, 85, 0.32); }
.sidebar-nav a.is-active { background: rgba(194, 161, 136, 0.24); color: var(--text); font-weight: 700; border-color: rgba(157, 113, 85, 0.5); }
/* Tonalidad distinta para opciones exclusivas de administrador (Libreta de direcciones) */
.sidebar-nav a.tone-admin { background: rgba(31, 122, 134, 0.08); border-color: rgba(31, 122, 134, 0.35); color: #1f6f7d; }
.sidebar-nav a.tone-admin:hover { background: rgba(31, 122, 134, 0.15); border-color: rgba(31, 122, 134, 0.55); color: #185d68; }
.sidebar-nav a.tone-admin.is-active { background: rgba(31, 122, 134, 0.2); border-color: rgba(31, 122, 134, 0.65); color: #134c56; font-weight: 700; }
.sidebar-foot { display: flex; align-items: center; justify-content: space-between; gap: 0.5rem; padding-top: 0.8rem; border-top: 1px solid var(--line); font-size: 0.9rem; color: var(--text-soft); }

/* ---------- Topbar ---------- */
.tpv-topbar {
  position: sticky; top: 0; z-index: 20;
  display: flex; align-items: center; gap: 0.9rem; padding: 1rem 1.4rem;
  background: rgba(255, 251, 246, 0.85); backdrop-filter: blur(12px); border-bottom: 1px solid var(--line);
}
.tpv-topbar h1 { font-size: clamp(1.35rem, 3vw, 1.9rem); }
.tpv-topbar .head-title { flex: 1; }
.topbar-icon { display: grid; place-items: center; width: 40px; height: 40px; border-radius: 12px; background: rgba(194, 161, 136, 0.18); color: var(--accent-strong); flex: 0 0 auto; }
.topbar-icon .nav-icon { width: 22px; height: 22px; }
.topbar-meta { color: var(--text-soft); font-size: 0.85rem; }
.nav-toggle { display: none; flex-direction: column; gap: 5px; width: 44px; height: 44px; align-items: center; justify-content: center; border: 1px solid var(--line); border-radius: 12px; background: rgba(255,255,255,0.7); cursor: pointer; }
.nav-toggle span { width: 20px; height: 2px; background: var(--text); border-radius: 2px; }

/* Botón plegar/desplegar menú (escritorio) */
.sidebar-collapse {
  display: inline-flex; align-items: center; justify-content: center;
  width: 40px; height: 40px; flex: 0 0 auto;
  border: 1px solid var(--line); border-radius: 12px;
  background: rgba(255,255,255,0.7); color: var(--text); cursor: pointer;
  transition: background-color 150ms ease, color 150ms ease;
}
.sidebar-collapse:hover { background: rgba(194,161,136,0.18); color: var(--accent-strong); }
.sidebar-collapse .sc-arrow { transition: transform 160ms ease; transform-origin: center; }
body.sidebar-collapsed .sidebar-collapse .sc-arrow { transform: rotate(180deg); }
/* Estado plegado: la barra colapsa a 0 (sigue siendo ítem del grid) y el contenido ocupa todo el ancho */
body.sidebar-collapsed .shell-grid { grid-template-columns: 0 1fr; }
body.sidebar-collapsed .tpv-sidebar { overflow: hidden; min-width: 0; padding-left: 0; padding-right: 0; border-right: 0; }
@media (max-width: 979px) { .sidebar-collapse { display: none; } }

.tpv-content { padding: 1.7rem; display: grid; gap: 1.5rem; align-content: start; }

/* ---------- Componentes ---------- */
.panel-card {
  padding: 1.6rem 1.7rem; background: var(--surface); border: 1px solid var(--line);
  border-radius: var(--radius-xl); box-shadow: var(--shadow-soft);
}
.panel-head { display: flex; align-items: center; justify-content: space-between; gap: 1rem; margin-bottom: 1.4rem; }
.panel-head h2 { font-size: 1.35rem; }

.kpi-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(190px, 1fr)); gap: 1rem; }
.kpi-card {
  padding: 1.15rem 1.25rem; background: var(--surface); border: 1px solid var(--line);
  border-radius: var(--radius-lg); box-shadow: var(--shadow-soft);
}
.kpi-label { margin: 0; font-size: 0.8rem; letter-spacing: 0.08em; text-transform: uppercase; color: var(--text-soft); }
.kpi-value { margin: 0.35rem 0 0.15rem; font-family: "Inter", sans-serif; font-weight: 700; font-size: 1.9rem; font-variant-numeric: tabular-nums; letter-spacing: -0.02em; }
.kpi-meta { margin: 0; color: var(--text-soft); font-size: 0.85rem; }

/* ---------- Inicio: acción principal ---------- */
.big-action {
  display: flex; align-items: center; gap: 1rem; padding: 1.25rem 1.4rem;
  border-radius: var(--radius-xl); color: #fffdfa; text-decoration: none;
  background: linear-gradient(135deg, #b79378 0%, #9a6d50 100%);
  box-shadow: 0 18px 40px rgba(154, 109, 80, 0.28);
  transition: transform 160ms ease, box-shadow 160ms ease;
}
.big-action:hover { transform: translateY(-2px); box-shadow: 0 24px 52px rgba(154, 109, 80, 0.34); }
.big-action-icon { display: grid; place-items: center; width: 54px; height: 54px; border-radius: 16px; background: rgba(255, 255, 255, 0.18); flex: 0 0 auto; }
.big-action-icon .nav-icon { width: 30px; height: 30px; }
.big-action-text { display: flex; flex-direction: column; flex: 1; min-width: 0; }
.big-action-text strong { font-size: 1.5rem; font-weight: 800; line-height: 1.1; }
.big-action-text span { opacity: 0.92; font-size: 0.95rem; }
.big-action-go { font-size: 1.7rem; opacity: 0.85; flex: 0 0 auto; }

/* ---------- Inicio: rejilla de accesos (agrupada como el menú) ---------- */
.access-group + .access-group { margin-top: 1rem; padding-top: 1rem; border-top: 1px solid var(--line); }
.access-group-label { display: flex; align-items: center; gap: 0.45rem; margin: 0 0.1rem 0.7rem; font-size: 0.72rem; letter-spacing: 0.16em; text-transform: uppercase; color: var(--text-soft); }
.access-group-label .nav-icon { width: 16px; height: 16px; }
.tiles-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(138px, 1fr)); gap: 0.8rem; }
.tile {
  display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 0.55rem;
  padding: 1.1rem 0.8rem; border: 1px solid var(--line); border-radius: var(--radius-md);
  background: rgba(255, 255, 255, 0.6); color: var(--text); text-align: center;
  transition: transform 150ms ease, background-color 150ms ease, border-color 150ms ease, box-shadow 150ms ease;
}
.tile:hover { transform: translateY(-2px); background: rgba(194, 161, 136, 0.14); border-color: rgba(157, 113, 85, 0.35); box-shadow: var(--shadow-soft); }
.tile-icon { display: grid; place-items: center; width: 46px; height: 46px; border-radius: 14px; background: rgba(194, 161, 136, 0.18); color: var(--accent-strong); }
.tile-icon .nav-icon { width: 24px; height: 24px; }
.tile-label { font-weight: 600; font-size: 0.92rem; }
.tile.tone-admin { border-color: rgba(31, 122, 134, 0.3); background: rgba(31, 122, 134, 0.06); }
.tile.tone-admin:hover { background: rgba(31, 122, 134, 0.12); border-color: rgba(31, 122, 134, 0.5); }
.tile.tone-admin .tile-icon { background: rgba(31, 122, 134, 0.16); color: #1f7a86; }

.table-wrap { overflow-x: auto; }
table { width: 100%; border-collapse: collapse; }
th, td { padding: 0.75rem 0.6rem; border-bottom: 1px solid var(--line); text-align: left; }
th { font-size: 0.8rem; letter-spacing: 0.04em; text-transform: uppercase; color: var(--text-soft); }
tbody tr:hover td { background: rgba(194, 161, 136, 0.07); }

/* ---------- Botón secundario / iconos ---------- */
.button-secondary {
  display: inline-flex; align-items: center; justify-content: center;
  padding: 0.7rem 1rem; border: 1px solid var(--line); border-radius: 999px; cursor: pointer;
  font: inherit; font-weight: 600; color: var(--text); background: rgba(255,255,255,0.9);
  transition: background-color 150ms ease, border-color 150ms ease;
}
.button-secondary:hover { background: rgba(194,161,136,0.16); border-color: rgba(157,113,85,0.4); }
.icon-btn {
  flex: 0 0 auto; width: 38px; height: 38px; border: 1px solid var(--line); border-radius: 10px;
  background: rgba(255,255,255,0.9); cursor: pointer; font-size: 1.1rem; line-height: 1; color: var(--accent-strong);
  display: inline-flex; align-items: center; justify-content: center;
  transition: background-color 150ms ease, color 150ms ease, border-color 150ms ease;
}
.icon-btn:hover { background: rgba(194,161,136,0.18); }
.icon-btn:focus-visible { outline: 2px solid var(--accent-strong); outline-offset: 2px; }
.icon-btn .nav-icon { width: 18px; height: 18px; }
.icon-btn-danger { color: #a4503f; }
.icon-btn-danger:hover { background: rgba(248,227,225,0.9); border-color: rgba(146,78,62,0.3); }
/* variante pequeña para filas de tabla */
.icon-btn-sm { width: 32px; height: 32px; border-radius: 8px; }
.icon-btn-sm .nav-icon { width: 16px; height: 16px; }
.venta-row-acciones { display: inline-flex; gap: .35rem; justify-content: flex-end; align-items: center; }
.venta-fuera-plazo { display: inline-flex; align-items: center; justify-content: center; width: 32px; color: var(--text-soft); opacity: .5; cursor: help; user-select: none; }

/* Paginación pro (modales de venta) */
.venta-pag {
  display: flex; flex-wrap: wrap; gap: .3rem; justify-content: center; align-items: center;
  margin-top: 1rem;
}
.venta-pag-btn {
  min-width: 34px; height: 34px; padding: 0 .55rem;
  display: inline-flex; align-items: center; justify-content: center;
  border: 1px solid var(--line); border-radius: 8px; background: rgba(255,255,255,0.9);
  color: var(--text); font: inherit; font-size: .88rem; font-weight: 600; cursor: pointer;
  transition: background-color 140ms ease, color 140ms ease, border-color 140ms ease;
}
.venta-pag-btn:hover { background: rgba(194,161,136,0.18); border-color: rgba(157,113,85,0.35); }
.venta-pag-btn.is-active {
  background: var(--accent-strong); color: #fffdfa; border-color: var(--accent-strong); cursor: default;
}
.venta-pag-btn.is-disabled {
  opacity: .4; cursor: not-allowed; background: rgba(255,255,255,0.5); color: var(--text-soft);
}
.venta-pag-ellipsis { padding: 0 .25rem; color: var(--text-soft); user-select: none; }

/* ---------- Formularios / rejillas ---------- */
.field-grid { display: grid; gap: 1rem; align-items: start; }
.field-grid.two-cols { grid-template-columns: repeat(auto-fit, minmax(220px, 1fr)); }
.field-grid .span-2 { grid-column: 1 / -1; }
/* Cada campo se ajusta a su contenido (no estira el input al alto de la fila):
   inputs a su altura natural y alineados arriba en toda la fila. */
.field-grid label { align-content: start; }
.field-grid label > input,
.field-grid label > select,
.field-grid label > textarea { align-self: start; }
.form-actions { display: flex; justify-content: flex-end; }

/* ---------- Maestros ---------- */
.maestros-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(340px, 1fr)); gap: 1rem; margin-top: 0.5rem; }
.maestro-card { padding: 1rem 1.1rem; border: 1px solid var(--line); border-radius: var(--radius-lg); background: var(--surface-soft); }
.maestro-card h3 { font-size: 1.15rem; margin-bottom: 0.6rem; }
.maestro-add { display: flex; gap: 0.5rem; margin-bottom: 0.7rem; }
.maestro-add input { flex: 1; }
.maestro-list { list-style: none; margin: 0; padding: 0; display: grid; gap: 0.4rem; max-height: 320px; overflow-y: auto; }
.maestro-row { display: flex; gap: 0.4rem; align-items: center; }
.maestro-count {
  flex: 0 0 auto; min-width: 2.5rem; padding: 0.42rem 0.45rem; text-align: center;
  border-radius: 9px; background: rgba(194,161,136,0.2); color: var(--text);
  font-weight: 700; font-size: 0.85rem; font-variant-numeric: tabular-nums;
}
.maestro-count.is-zero { background: rgba(86,69,58,0.06); color: var(--text-soft); font-weight: 600; }
.maestro-edit { display: flex; gap: 0.4rem; flex: 1; }
.maestro-edit input { flex: 1; padding: 0.5rem 0.7rem; }
.maestro-del { flex: 0 0 auto; }

/* ---------- Botón de borrado ---------- */
.button-danger {
  display: inline-flex; align-items: center; justify-content: center;
  padding: 0.7rem 1rem; border: 1px solid rgba(146, 78, 62, 0.25); border-radius: 999px; cursor: pointer;
  font: inherit; font-weight: 600; color: #8d4a3c; background: rgba(248, 227, 225, 0.7);
  transition: background-color 150ms ease, border-color 150ms ease;
}
.button-danger:hover { background: rgba(248, 227, 225, 1); border-color: rgba(146, 78, 62, 0.45); }

/* ---------- Usuarios ---------- */
.users-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(300px, 1fr)); gap: 1rem; }
.user-card { display: flex; flex-direction: column; gap: 0.7rem; padding: 1.1rem 1.2rem; border: 1px solid var(--line); border-radius: var(--radius-lg); background: var(--surface-soft); }
.user-head { display: flex; align-items: center; gap: 0.7rem; }
.user-avatar { display: grid; place-items: center; width: 44px; height: 44px; border-radius: 50%; background: rgba(194, 161, 136, 0.2); color: var(--accent-strong); flex: 0 0 auto; }
.user-avatar .nav-icon { width: 22px; height: 22px; }
.user-id { display: flex; flex-direction: column; flex: 1; min-width: 0; }
.user-id strong { font-size: 1.02rem; }
.role-badge { padding: 0.28rem 0.6rem; border-radius: 999px; font-size: 0.72rem; font-weight: 700; text-transform: uppercase; letter-spacing: 0.04em; white-space: nowrap; flex: 0 0 auto; }
.role-111 { background: rgba(31, 122, 134, 0.16); color: #1f6f7d; }
.role-110 { background: rgba(157, 113, 85, 0.18); color: var(--accent-strong); }
.role-101 { background: rgba(86, 69, 58, 0.1); color: var(--text-soft); }
.user-meta { margin: 0; font-size: 0.85rem; }
.user-actions { display: flex; flex-wrap: wrap; gap: 0.45rem; }
.user-actions form { display: inline; }
.user-actions .button-secondary, .user-actions .button-danger { padding: 0.5rem 0.8rem; font-size: 0.85rem; }

/* ---------- Ayuda (i) ---------- */
.head-title { display: flex; align-items: center; gap: 0.5rem; }
.tpv-topbar .head-title { flex: 1; }
.help-popover { position: relative; display: inline-block; }
.help-popover summary {
  display: grid; place-items: center; width: 1.5rem; height: 1.5rem;
  border-radius: 999px; border: 1px solid var(--line); background: rgba(255,255,255,0.9);
  color: var(--accent-strong); font: 800 0.8rem/1 "Inter", sans-serif; cursor: pointer; list-style: none;
}
.help-popover summary::-webkit-details-marker { display: none; }
.help-popover[open] summary { background: var(--accent-strong); color: #fffdfa; border-color: var(--accent-strong); }
.help-popover-card {
  position: absolute; top: calc(100% + 0.5rem); left: 0; z-index: 40;
  width: min(20rem, calc(100vw - 3rem)); padding: 0.9rem 1rem; border-radius: 16px;
  border: 1px solid var(--line); background: rgba(255,252,248,0.99);
  box-shadow: 0 18px 34px rgba(47,39,35,0.18); font-family: "Inter", sans-serif;
}
.help-popover-card strong { display: block; margin-bottom: 0.3rem; color: var(--text); font-size: 0.95rem; }
.help-popover-card p { margin: 0; color: var(--text-soft); font-size: 0.88rem; line-height: 1.45; }
.help-popover-card .help-note { margin-top: 0.55rem; padding-top: 0.55rem; border-top: 1px solid var(--line); color: var(--text); font-weight: 600; }

/* ---------- Artículos: listado ---------- */
.article-toolbar { display: flex; flex-wrap: wrap; gap: 0.6rem; align-items: center; margin-bottom: 1.5rem; }
.article-toolbar .article-search { flex: 1 1 220px; min-width: 200px; }
.article-toolbar select { width: auto; min-width: 132px; flex: 0 1 auto; padding: 0.6rem 0.7rem; }
.article-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(205px, 1fr)); gap: 1.3rem; }
.article-card { display: flex; flex-direction: column; gap: 0.45rem; padding: 0.85rem; border: 1px solid var(--line); border-radius: var(--radius-md); background: rgba(255, 255, 255, 0.6); color: var(--text); transition: transform 150ms ease, box-shadow 150ms ease, border-color 150ms ease; }
.article-card:hover { transform: translateY(-2px); box-shadow: var(--shadow-soft); border-color: rgba(157, 113, 85, 0.3); }
.article-thumb { position: relative; aspect-ratio: 1; border-radius: 12px; overflow: hidden; background: rgba(86, 69, 58, 0.06); display: grid; place-items: center; }
.article-thumb img { width: 100%; height: 100%; object-fit: cover; }
.stock-badge { position: absolute; top: 6px; right: 6px; min-width: 1.5rem; text-align: center; padding: 0.15rem 0.4rem; border-radius: 999px; font-size: 0.75rem; font-weight: 700; background: rgba(255, 255, 255, 0.92); color: var(--text); box-shadow: 0 2px 6px rgba(47, 39, 35, 0.18); }
.stock-badge.is-out { background: #c0392b; color: #fff; }
.article-name { font-weight: 600; font-size: 0.92rem; line-height: 1.25; }
.article-meta { font-size: 0.78rem; }
.article-prov { display: flex; align-items: center; gap: 0.3rem; font-size: 0.76rem; }
.article-prov .nav-icon { width: 13px; height: 13px; flex: 0 0 auto; }
.article-foot { display: flex; align-items: baseline; justify-content: space-between; gap: 0.4rem; margin-top: auto; padding-top: 0.15rem; }
.article-price { font-weight: 800; font-size: 1.02rem; }
.article-id { font-size: 0.72rem; color: var(--text-soft); font-weight: 600; }
.pager { display: flex; align-items: center; justify-content: center; gap: 1rem; margin-top: 1.2rem; }

/* ---------- Artículos: formulario ---------- */
.article-form { display: grid; grid-template-columns: 220px 1fr; gap: 1.4rem; align-items: start; }
.article-form-photo { display: flex; flex-direction: column; gap: 0.6rem; }
.article-photo-preview { position: relative; display: block; aspect-ratio: 1; border-radius: var(--radius-md); border: 1.5px dashed rgba(157, 113, 85, 0.45); background: rgba(86, 69, 58, 0.06); overflow: hidden; cursor: pointer; transition: border-color 150ms ease, background-color 150ms ease; }
.article-photo-preview:hover { border-color: rgba(157, 113, 85, 0.7); background: rgba(194, 161, 136, 0.12); }
.photo-visual { display: grid; place-items: center; width: 100%; height: 100%; }
.photo-visual img { width: 100%; height: 100%; object-fit: cover; display: block; }
.photo-empty { text-align: center; font-size: 0.85rem; line-height: 1.6; }
.photo-overlay { position: absolute; left: 0; right: 0; bottom: 0; padding: 0.4rem; text-align: center; font-size: 0.8rem; font-weight: 600; color: #fffdfa; background: rgba(47, 39, 35, 0.55); }
.article-form-photo.is-dragover .article-photo-preview { border-color: var(--accent-strong); background: rgba(194, 161, 136, 0.24); }
.dropzone-hint { font-size: 0.78rem; text-align: center; margin: 0; }
@media (max-width: 640px) {
  .article-form { grid-template-columns: 1fr; }
  .article-form-photo { max-width: 240px; }
}

/* ---------- Proveedores ---------- */
.prov-toolbar { display: flex; flex-wrap: wrap; gap: 0.6rem; align-items: center; margin-bottom: 1.5rem; }
.prov-search { flex: 1 1 260px; min-width: 200px; }
.prov-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(300px, 1fr)); gap: 1rem; }
.prov-card { display: flex; flex-direction: column; gap: 0.7rem; padding: 1.1rem 1.2rem; border: 1px solid var(--line); border-radius: var(--radius-lg); background: var(--surface-soft); }
.prov-head { display: flex; align-items: flex-start; gap: 0.7rem; }
.prov-icon { display: grid; place-items: center; width: 44px; height: 44px; border-radius: 50%; background: rgba(194, 161, 136, 0.2); color: var(--accent-strong); flex: 0 0 auto; }
.prov-icon .nav-icon { width: 22px; height: 22px; }
.prov-id { display: flex; flex-direction: column; flex: 1; min-width: 0; }
.prov-id strong { font-size: 1.02rem; }
.prov-id span { font-size: 0.85rem; }
.prov-art-badge { flex: 0 0 auto; padding: 0.28rem 0.6rem; border-radius: 999px; font-size: 0.72rem; font-weight: 700; background: rgba(157, 113, 85, 0.18); color: var(--accent-strong); white-space: nowrap; }
.prov-art-badge.is-zero { background: rgba(86, 69, 58, 0.08); color: var(--text-soft); font-weight: 600; }
.prov-meta { margin: 0; padding: 0; list-style: none; display: flex; flex-direction: column; gap: 0.3rem; font-size: 0.85rem; }
.prov-meta li { display: flex; align-items: center; gap: 0.35rem; }
.prov-meta li .nav-icon { width: 14px; height: 14px; flex: 0 0 auto; }
.prov-actions { display: flex; flex-wrap: wrap; gap: 0.45rem; margin-top: auto; }
.prov-actions form { display: inline; }
.prov-actions .button-secondary, .prov-actions .button-danger { padding: 0.5rem 0.8rem; font-size: 0.85rem; }

/* ---------- Foto artículo: botones de acción ---------- */
.photo-actions { display: flex; align-items: center; gap: 0.6rem; flex-wrap: wrap; }
.photo-action-btn { padding: 0.5rem 0.9rem; font-size: 0.85rem; }
.photo-action-btn:disabled { opacity: 0.45; cursor: not-allowed; pointer-events: none; }

/* ---------- Modal del editor de foto (Cropper.js) ---------- */
.tpv-modal--crop { display: flex; flex-direction: column; }
.tpv-modal--crop .tpv-modal-body { flex: 1; display: flex; flex-direction: column; gap: 1rem; padding: 0; }
.cropper-wrap {
  position: relative; width: 100%; max-height: 60vh; overflow: hidden;
  background: #2f2723; border-radius: var(--radius-md);
}
.cropper-wrap img { display: block; max-width: 100%; max-height: 60vh; margin: 0 auto; }
.cropper-tools {
  display: flex; flex-wrap: wrap; gap: 0.5rem; align-items: center;
  padding: 0.2rem 0;
}
.cropper-tools .button-secondary {
  padding: 0.45rem 0.8rem; font-size: 0.82rem; flex: 0 0 auto;
}

.sidebar-backdrop { display: none; }

/* ---------- Modal propio (tpvConfirm / tpvModalHTML) ---------- */
.tpv-modal-overlay{position:fixed;inset:0;z-index:200;display:flex;align-items:center;justify-content:center;padding:1.2rem;background:rgba(47,39,35,.45);backdrop-filter:blur(4px);opacity:0;visibility:hidden;transition:opacity 180ms ease,visibility 0s linear 180ms;}
.tpv-modal-overlay.is-open{opacity:1;visibility:visible;transition:opacity 180ms ease;}
.tpv-modal{width:min(34rem,100%);max-height:85vh;overflow:auto;background:var(--surface-strong);border:1px solid var(--line);border-radius:var(--radius-xl);box-shadow:var(--shadow);padding:1.6rem 1.7rem;transform:translateY(10px) scale(.98);transition:transform 200ms ease;}
.tpv-modal-overlay.is-open .tpv-modal{transform:none;}
.tpv-modal--wide{width:min(52rem,100%);}
/* Modal de cobro: más grande, ocupa más pantalla */
.tpv-modal--cobro{width:min(72rem,96vw);max-height:92vh;}
.tpv-modal--cobro .cobro-pago-importe{width:140px !important;font-size:1.15rem;font-weight:700;text-align:right;}
.tpv-modal-title{font-size:1.4rem;font-weight:700;margin:0 0 .5rem;}
.tpv-modal-body{color:var(--text-soft);line-height:1.5;}
.tpv-modal-actions{display:flex;justify-content:flex-end;gap:.6rem;margin-top:1.4rem;}

/* ---------- Select buscable (ss = select-search) ---------- */
.ss { position: relative; }
.ss-control {
  width: 100%; padding: 0.85rem 2.2rem 0.85rem 1rem; font: inherit; color: var(--text);
  border: 1px solid var(--line); border-radius: 14px;
  background: rgba(255, 255, 255, 0.88);
  transition: border-color 160ms ease, box-shadow 160ms ease;
  text-align: left; cursor: pointer; position: relative;
  display: flex; align-items: center; justify-content: space-between; gap: 0.4rem;
}
.ss-control:focus-visible {
  outline: none; border-color: rgba(157, 113, 85, 0.5);
  box-shadow: 0 0 0 3px rgba(194, 161, 136, 0.2);
}
.ss.is-open .ss-control {
  border-color: rgba(157, 113, 85, 0.5);
  box-shadow: 0 0 0 3px rgba(194, 161, 136, 0.2);
}
.ss-caret { flex: 0 0 auto; font-size: 0.7rem; color: var(--text-soft); transition: transform 160ms ease; }
.ss.is-open .ss-caret { transform: rotate(180deg); }
.ss-panel {
  display: none; position: absolute; z-index: 50; top: calc(100% + 4px); left: 0; width: 100%;
  background: var(--surface-strong); border: 1px solid var(--line);
  border-radius: 14px; box-shadow: var(--shadow); padding: 0.5rem;
  max-height: 260px; overflow: auto;
}
.ss.is-open .ss-panel { display: block; }
.ss-input {
  width: 100%; margin-bottom: 0.4rem; padding: 0.6rem 0.8rem; font: inherit; color: var(--text);
  border: 1px solid var(--line); border-radius: 10px;
  background: rgba(255, 255, 255, 0.88);
  transition: border-color 160ms ease, box-shadow 160ms ease;
}
.ss-input:focus-visible {
  outline: none; border-color: rgba(157, 113, 85, 0.5);
  box-shadow: 0 0 0 3px rgba(194, 161, 136, 0.2);
}
.ss-list { list-style: none; margin: 0; padding: 0; }
.ss-opt {
  padding: 0.5rem 0.6rem; border-radius: 8px; cursor: pointer;
  font: inherit; color: var(--text);
  transition: background-color 120ms ease;
}
.ss-opt:hover { background: rgba(194, 161, 136, 0.16); }
.ss-opt.is-selected { background: rgba(194, 161, 136, 0.28); font-weight: 600; }
.ss-opt.is-focused { background: rgba(45, 134, 120, 0.12); outline: 2px solid rgba(45, 134, 120, 0.35); outline-offset: -2px; }
.ss-opt.is-hidden { display: none; }
.ss-no-results { padding: 0.5rem 0.6rem; color: var(--text-soft); font-size: 0.9rem; font-style: italic; }

/* ---------- enTienda toggle ---------- */
.toggle-field { display: flex; flex-direction: column; gap: 0.45rem; }
.toggle-row { display: flex; align-items: center; gap: 0.75rem; padding: 0.85rem 1rem; border: 1px solid var(--line); border-radius: 14px; background: rgba(255, 255, 255, 0.88); cursor: pointer; }
.toggle-switch { position: relative; flex: 0 0 auto; width: 44px; height: 24px; }
.toggle-switch input { opacity: 0; width: 0; height: 0; position: absolute; }
.toggle-track {
  position: absolute; inset: 0; border-radius: 999px;
  background: rgba(86, 69, 58, 0.15); transition: background-color 200ms ease;
}
.toggle-switch input:checked + .toggle-track { background: var(--accent-strong); }
.toggle-track::after {
  content: ''; position: absolute; top: 2px; left: 2px; width: 20px; height: 20px;
  border-radius: 50%; background: #fff;
  box-shadow: 0 1px 4px rgba(47,39,35,0.22);
  transition: transform 200ms ease;
}
.toggle-switch input:checked + .toggle-track::after { transform: translateX(20px); }
.toggle-label { display: flex; flex-direction: column; gap: 0.1rem; }
.toggle-label strong { font-weight: 600; color: var(--text); font-size: 0.95rem; }
.toggle-label small { color: var(--text-soft); font-size: 0.8rem; line-height: 1.35; }

/* Pill "Online" en tarjeta de artículo */
.online-pill {
  display: inline-flex; align-items: center; gap: 0.2rem;
  padding: 0.15rem 0.45rem; border-radius: 999px; font-size: 0.7rem; font-weight: 700;
  background: rgba(31, 122, 134, 0.16); color: #1f6f7d; white-space: nowrap;
}

/* ---------- Responsive ---------- */
@media (max-width: 979px) {
  .shell-grid { grid-template-columns: 1fr; }
  .nav-toggle { display: flex; }
  .tpv-sidebar {
    position: fixed; top: 0; left: 0; z-index: 60; width: min(82vw, var(--sidebar-w)); height: 100dvh;
    transform: translateX(-100%); transition: transform 240ms ease; box-shadow: var(--shadow);
  }
  body.nav-open .tpv-sidebar { transform: translateX(0); }
  body.nav-open .sidebar-backdrop { display: block; position: fixed; inset: 0; z-index: 50; background: rgba(47, 39, 35, 0.32); }
}

/* ---------- Artículos: bloque económico ---------- */
.econ-block {
  background: var(--surface-2, #f7f5f2); border: 1px solid var(--line);
  border-radius: 14px; padding: 1.1rem 1.2rem;
  display: flex; flex-direction: column; gap: 1rem;
}
.econ-block-head {
  display: flex; align-items: center; gap: 0.5rem;
}
.econ-block-head .nav-icon { width: 16px; height: 16px; flex: 0 0 auto; color: var(--text-soft); }
.econ-block-title {
  font-size: 0.72rem; letter-spacing: 0.16em; text-transform: uppercase;
  color: var(--text-soft); font-weight: 700;
}
.econ-fields {
  display: grid; grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 1rem; align-items: start;
}
@media (max-width: 920px) { .econ-fields { grid-template-columns: repeat(2, minmax(0, 1fr)); } }
@media (max-width: 520px) { .econ-fields { grid-template-columns: 1fr; } }
.econ-results {
  display: grid; grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
  gap: 0.8rem;
}
.econ-chip {
  background: var(--surface); border: 1px solid var(--line); border-radius: 12px;
  padding: 0.7rem 0.9rem; display: flex; flex-direction: column; gap: 0.15rem;
}
.econ-chip-label {
  font-size: 0.72rem; letter-spacing: 0.06em; text-transform: uppercase;
  color: var(--text-soft); font-weight: 600;
}
.econ-chip-value {
  font-family: "Inter", sans-serif; font-weight: 700; font-size: 1.45rem;
  font-variant-numeric: tabular-nums; letter-spacing: -0.01em; line-height: 1.1;
  color: var(--text);
}

/* ---- Dropzone de archivo adjunto ---- */
.file-dropzone { display:flex; align-items:center; gap:.7rem; flex-wrap:wrap; padding:1rem 1.1rem; border:2px dashed var(--line); border-radius:14px; background:rgba(255,255,255,.5); cursor:pointer; transition:border-color .15s ease, background .15s ease; }
.file-dropzone:hover, .file-dropzone:focus-visible { border-color:var(--accent-strong); background:rgba(194,161,136,.12); outline:none; }
.file-dropzone.is-dragover { border-color:var(--accent-strong); background:rgba(194,161,136,.22); }
.file-dropzone.has-file { border-style:solid; }
.file-drop-icon { display:grid; place-items:center; color:var(--accent-strong); flex:0 0 auto; }
.file-drop-icon .nav-icon { width:22px; height:22px; }
.file-drop-text { color:var(--text-soft); font-size:.92rem; flex:1 1 auto; min-width:0; overflow:hidden; text-overflow:ellipsis; white-space:nowrap; }
.file-drop-clear { flex:0 0 auto; margin-left:auto; }
.econ-chip small { font-size: 0.74rem; }

/* ========================================================
   TICKET DE VENTA — panel de configuración + vista previa
   ======================================================== */

/* Cuadrícula de dos columnas: form + preview */
.ticket-config-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 2rem;
  align-items: start;
}
@media (max-width: 860px) {
  .ticket-config-grid { grid-template-columns: 1fr; }
}

/* Columna del formulario */
.ticket-config-form { display: flex; flex-direction: column; gap: 0; }
.ticket-config-form form { display: flex; flex-direction: column; gap: 1rem; }

/* Campo genérico dentro del form de ticket */
.ticket-field { display: flex; flex-direction: column; gap: 0.4rem; }
.ticket-field select,
.ticket-field input[type="text"],
.ticket-field textarea { width: 100%; }

/* Toggles del ticket */
.tk-toggles { display: flex; flex-direction: column; gap: 0.4rem; }
.tk-toggle-row {
  display: flex; align-items: center; gap: 0.65rem;
  padding: 0.6rem 0.85rem;
  border: 1px solid var(--line); border-radius: 12px;
  background: rgba(255,255,255,0.75); cursor: pointer;
  transition: background 150ms ease;
}
.tk-toggle-row:hover { background: rgba(194,161,136,0.1); }
.tk-toggle-text strong { font-size: 0.9rem; font-weight: 600; color: var(--text); }

/* Zona gris que simula el mostrador de caja */
.ticket-counter {
  background: rgba(86,69,58,0.06);
  border: 1px solid var(--line);
  border-radius: 18px;
  padding: 1.5rem 1.25rem;
  display: flex; flex-direction: column; align-items: center; gap: 0.75rem;
  /* Se queda fija mientras se hace scroll por el formulario, para ver los cambios en vivo */
  position: sticky;
  top: 88px;
  align-self: start;
  max-height: calc(100vh - 108px);
  overflow: auto;
}
@media (max-width: 860px) {
  .ticket-counter { position: static; max-height: none; overflow: visible; }
}
.tk-preview-label {
  font-size: 0.7rem; letter-spacing: 0.14em; text-transform: uppercase;
  font-weight: 700; color: var(--text-soft);
}

/* El recibo térmico */
.ticket-preview {
  font-family: ui-monospace, "SFMono-Regular", Menlo, "Courier New", monospace;
  font-size: 0.82rem;
  line-height: 1.32;
  letter-spacing: -0.2px;
  background: #fffdf8;
  color: #1a1a1a;
  padding: 1.1rem 0.6rem 1rem;
  position: relative;
  margin: 0 auto;
  width: 320px; /* default 80 mm */
  transition: width 220ms ease;
  overflow: visible;
  /* Drop shadow simulating paper on a counter */
  filter: drop-shadow(0 6px 20px rgba(0,0,0,0.18)) drop-shadow(0 1px 3px rgba(0,0,0,0.09));
}
/* Torn/sawtooth top edge */
.ticket-preview::before {
  content: '';
  display: block;
  position: absolute;
  top: -8px; left: 0; right: 0;
  height: 9px;
  background:
    radial-gradient(circle at 50% 0%, #fffdf8 5px, transparent 5px),
    radial-gradient(circle at 50% 0%, rgba(86,69,58,0.12) 6px, transparent 6px);
  background-size: 12px 9px;
  background-position: 0 0;
}
/* Torn/sawtooth bottom edge */
.ticket-preview::after {
  content: '';
  display: block;
  position: absolute;
  bottom: -8px; left: 0; right: 0;
  height: 9px;
  background:
    radial-gradient(circle at 50% 100%, #fffdf8 5px, transparent 5px),
    radial-gradient(circle at 50% 100%, rgba(86,69,58,0.12) 6px, transparent 6px);
  background-size: 12px 9px;
  background-position: 0 100%;
}
.ticket-preview.is-58 { width: 248px; }
.ticket-preview.is-80 { width: 320px; }

/* --- Font family classes --- */
.ticket-preview.font-mono { font-family: ui-monospace, "SFMono-Regular", Menlo, Consolas, "Courier New", monospace; }
.ticket-preview.font-sans { font-family: system-ui, -apple-system, Arial, sans-serif; }
.ticket-preview.font-cond { font-family: "Arial Narrow", "Roboto Condensed", Arial, sans-serif; }

/* --- Font size classes --- */
.ticket-preview.tam-s { font-size: 0.72rem; }
.ticket-preview.tam-n { font-size: 0.82rem; }
.ticket-preview.tam-l { font-size: 0.94rem; }

/* Separador a rayas */
/* Separadores: sin línea, solo espacio limpio entre secciones */
.tk-sep {
  border: none;
  margin: 0.55rem 0;
}
/* Variante con línea continua (sólida) */
.tk-sep--line { border-top: 1px solid #9a9a9a; }

/* Logo placeholder */
.tk-logo {
  text-align: center;
  border: 1px dashed #ccc;
  border-radius: 4px;
  padding: 0.35rem 0;
  font-size: 0.72rem;
  color: #aaa;
  letter-spacing: 0.1em;
  margin-bottom: 0.3rem;
}
.tk-logo.has-img { border: 0; padding: 0; }
.tk-logo-img { display: block; width: 100%; max-width: 100%; max-height: 90px; height: auto; margin: 0 auto 0.2rem; object-fit: contain; }

/* Helpers de alineación y estilo */
.tk-center   { text-align: center; }
.tk-bold     { font-weight: 700; }
.tk-italic   { font-style: italic; }
.tk-small    { font-size: 0.72rem; line-height: 1.45; }
.tk-muted    { color: #888; }
.tk-name     { font-size: 0.92rem; font-weight: 700; margin-bottom: 0.15rem; }
.tk-cabecera { font-size: 0.8rem; color: #555; margin-bottom: 0.25rem; }

/* Líneas de venta */
.tk-lines { margin: 0.2rem 0; }
.tk-line {
  display: flex; justify-content: space-between; gap: 0.4rem;
}
.tk-line-desc { flex: 1; min-width: 0; white-space: normal; overflow-wrap: break-word; }
.tk-line-price { flex: 0 0 auto; text-align: right; font-variant-numeric: tabular-nums; }

/* Total */
.tk-total {
  font-weight: 700;
  font-size: 0.95rem;
  margin: 0.15rem 0;
}

/* Pie y legal */
.tk-pie   { font-size: 1.15em; font-weight: 700; text-align: center; margin: .6rem 0 .3rem; letter-spacing: .02em; }
.tk-legal { font-size: 0.68rem; line-height: 1.45; color: #999; margin: 0.3rem 0; text-align: left; padding-left: 0.6rem; }

/* IVA incluido (debajo del total) */
.tk-iva-incluido { text-align: right; font-size: .85em; color: #555; margin: -.1rem 0 .15rem; }

/* Bloque contacto en el pie */
/* Bloque de contacto: grupo centrado en el ticket, pero con los iconos alineados
   en columna y el texto arrancando a la misma altura (look profesional, no escalonado). */
.tk-contacto { margin: .7rem auto .15rem; width: fit-content; display: flex; flex-direction: column; gap: .4rem; text-align: left; }
.tk-contacto-line { display: grid; grid-template-columns: 14px 1fr; align-items: center; gap: .55rem; font-size: 0.78rem; color: #333; }
.tk-contacto svg { width: 13px; height: 13px; justify-self: center; flex: 0 0 auto; }

/* Etiqueta "ejemplo" */
.tk-sample-label {
  text-align: center;
  font-size: 0.65rem;
  color: #bbb;
  letter-spacing: 0.1em;
  margin: 0.1rem 0 0.2rem;
}

/* ============================================================
   TICKET CONFIG — EXTENSIONES (grupos, cuerpo, pie avanzado)
   ============================================================ */

/* Subtítulo de grupo dentro del form de ticket */
.tk-group-title {
  font-size: 0.68rem;
  font-weight: 700;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--text-soft, #9e8c80);
  margin: 1.1rem 0 0.45rem;
  padding-bottom: 0.25rem;
  border-bottom: 1px solid var(--line, #e8ddd6);
}
.tk-group-title:first-child { margin-top: 0; }

/* Nota muted dentro del form */
.tk-field-note {
  font-size: 0.78rem;
  color: var(--text-soft, #9e8c80);
  line-height: 1.45;
  margin: 0 0 0.3rem;
}

/* Fila de artículo (descripción … precio) */
.tk-row {
  display: flex;
  gap: 0.3rem;
  align-items: baseline;
}
/* Artículo en 2 líneas: nombre completo arriba, cálculo indentado debajo */
.tk-item { margin: 0 0 0.4rem; }
.tk-item-name { white-space: normal; overflow-wrap: break-word; }
.tk-item-calc { display: flex; justify-content: space-between; align-items: baseline; gap: 0.4rem; padding-left: 1rem; color: #555; }
.tk-calc-left { display: inline-flex; align-items: baseline; gap: 0.3rem; }
.tk-x { color: #999; }
/* Ocultar la "×" si se oculta cantidad o precio unitario */
.ticket-preview.hide-cantidad .tk-x,
.ticket-preview.hide-precio   .tk-x { display: none; }
/* Espaciador entre concepto e importe (sin línea de puntos) */
.tk-dots {
  flex: 1;
  min-width: 8px;
}
.tk-qty  { flex: 0 0 auto; min-width: 1.2rem; color: #555; }
.tk-uprice { flex: 0 0 auto; min-width: 2.8rem; text-align: right; color: #666; }
.tk-amt  { flex: 0 0 auto; min-width: 3rem; text-align: right; font-variant-numeric: tabular-nums; }

/* Ocultar columnas según toggles */
.ticket-preview.hide-cantidad .tk-qty   { display: none; }
.ticket-preview.hide-precio   .tk-uprice { display: none; }

/* Bloque IVA desglose */
.tk-iva-block {
  margin: 0.25rem 0;
  padding: 0.3rem 0;
  border-top: 1px dashed #ccc;
  border-bottom: 1px dashed #ccc;
}
.tk-iva-row {
  display: flex;
  justify-content: space-between;
  font-size: 0.72rem;
  color: #666;
}

/* Total grande */
.tk-total-row {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  font-weight: 700;
  font-size: 1.05rem;
  margin: 0.35rem 0 0.15rem;
  letter-spacing: 0.01em;
}
.tk-total-row.negrita-total { font-weight: 800; }

/* Líneas pie (metodo, vendedor, numero, fecha) */
.tk-footer-line {
  display: flex;
  justify-content: space-between;
  font-size: 0.75rem;
  color: #444;
  margin: 0.05rem 0;
}

/* Código de barras CSS puro */
.tk-barcode-wrap {
  text-align: center;
  margin: 0.55rem 0 0.2rem;
}
.tk-barcode {
  display: inline-block;
  width: 80%;
  max-width: 200px;
  height: 38px;
  background: repeating-linear-gradient(
    90deg,
    #1a1a1a 0px   2px,
    #fff    2px   4px,
    #1a1a1a 4px   6px,
    #fff    6px  10px,
    #1a1a1a 10px 11px,
    #fff   11px  14px,
    #1a1a1a 14px 16px,
    #fff   16px  20px,
    #1a1a1a 20px 22px,
    #fff   22px  23px,
    #1a1a1a 23px 25px,
    #fff   25px  28px,
    #1a1a1a 28px 30px,
    #fff   30px  34px,
    #1a1a1a 34px 36px,
    #fff   36px  38px,
    #1a1a1a 38px 39px,
    #fff   39px  42px,
    #1a1a1a 42px 44px,
    #fff   44px  48px
  );
}
.tk-barcode-num {
  display: block;
  font-size: 0.62rem;
  color: #555;
  letter-spacing: 0.08em;
  margin-top: 0.2rem;
}

/* QR code block */
.tk-qr {
  text-align: center;
  margin: 0.15rem 0 0.1rem;
}
.tk-qr svg,
.tk-qr img {
  width: 96px;
  height: 96px;
  display: block;
  margin: 0 auto;
}
.tk-qr-caption {
  display: block;
  font-size: 0.6rem;
  color: #888;
  text-align: center;
  margin-top: 0.15rem;
  letter-spacing: 0.04em;
}

/* ============================================================
   TICKET LOCATE — botón "señalar en el ticket" + highlight
   ============================================================ */

/* Botón lupa/ojo pequeño junto a cada control */
.tk-locate {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 24px;
  height: 24px;
  border: 1px solid transparent;
  border-radius: 50%;
  background: none;
  cursor: pointer;
  color: var(--text-soft);
  vertical-align: middle;
  margin-left: 0.15rem;
  padding: 0;
  flex-shrink: 0;
  transition: color 140ms ease, background 140ms ease, border-color 140ms ease;
}
.tk-locate svg {
  width: 15px;
  height: 15px;
  flex-shrink: 0;
}
.tk-locate:hover,
.tk-locate:focus-visible {
  color: var(--accent-strong);
  background: rgba(157, 113, 85, 0.1);
  border-color: rgba(157, 113, 85, 0.2);
  outline: none;
}

/* Resaltado pulsante en el elemento de la vista previa */
.tk-highlight {
  outline: 2px solid #b4643c;
  outline-offset: 2px;
  border-radius: 3px;
  background: rgba(180, 100, 60, 0.15);
  animation: tkPulse 1s ease-in-out 2;
}

@keyframes tkPulse {
  0%,
  100% { box-shadow: 0 0 0 0 rgba(180, 100, 60, 0.5); }
  50%   { box-shadow: 0 0 0 6px rgba(180, 100, 60, 0); }
}

/* Halo en el recibo entero cuando el objetivo está oculto */
.ticket-preview.tk-locating {
  box-shadow: 0 0 0 3px rgba(180, 100, 60, 0.4);
}

/* ===================== Logo del ticket ===================== */
.tk-logo-gallery { display: flex; flex-wrap: wrap; gap: .5rem; margin-top: .35rem; }
.tk-logo-thumb {
  width: 56px; height: 56px; padding: 4px;
  border: 1px solid var(--line); border-radius: 10px;
  background: #fff; cursor: pointer;
  display: grid; place-items: center;
  transition: border-color .15s, box-shadow .15s;
}
.tk-logo-thumb img { max-width: 100%; max-height: 100%; object-fit: contain; }
.tk-logo-thumb.is-sel {
  border-color: var(--accent-strong);
  box-shadow: 0 0 0 2px rgba(157,113,85,.35);
}
.tk-logo-thumb:hover { border-color: var(--accent-strong); }

/* Monochrome filter for B/W thermal preview */
.tk-logo-img.tk-mono { filter: grayscale(1) contrast(1.25) brightness(.96); }

/* Estado de auto-guardado del ticket */
.tk-save-status { display:inline-flex; align-items:center; gap:.4rem; font-size:.85rem; color:var(--text-soft); }
.tk-save-status .nav-icon { width:15px; height:15px; }
.tk-save-status[data-state="saving"]  { color:#9d7155; }
.tk-save-status[data-state="saved"]   { color:#3c6b4f; font-weight:600; }
.tk-save-status[data-state="pending"] { color:var(--text-soft); }
.tk-save-status[data-state="error"]   { color:#b3403c; font-weight:600; }

/* Camino inverso: zonas del ticket clicables → opción */
.ticket-preview .tk-clickable { cursor: pointer; border-radius: 3px; transition: background-color 120ms ease, box-shadow 120ms ease; }
.ticket-preview .tk-clickable:hover { background: rgba(45,134,120,0.10); box-shadow: 0 0 0 3px rgba(45,134,120,0.10); }
/* Resalte del control destino al saltar desde el ticket */
.tk-jump { border-radius: 12px; animation: tkJump 1.6s ease; box-shadow: 0 0 0 2px rgba(157,113,85,.55); }
@keyframes tkJump {
  0%   { box-shadow: 0 0 0 0 rgba(157,113,85,.55); background: rgba(194,161,136,.22); }
  60%  { box-shadow: 0 0 0 6px rgba(157,113,85,0); background: rgba(194,161,136,.10); }
  100% { box-shadow: 0 0 0 2px rgba(157,113,85,.40); background: transparent; }
}

/* ============================================================
   MÓDULO VENTA (Fase A)
   ============================================================ */

/* Layout 2 columnas */
.venta-layout {
  display: grid;
  grid-template-columns: 1fr 480px;
  gap: 1.4rem;
  align-items: stretch;
  min-height: calc(100vh - 8.5rem);
}

/* Columna buscador */
.venta-panel-busca {
  display: flex; flex-direction: column; gap: 1rem;
  background: var(--surface); border: 1px solid var(--line);
  border-radius: var(--radius-xl); box-shadow: var(--shadow-soft);
  padding: 1.4rem 1.5rem;
  min-height: 0;
}

/* Tabs de modo de búsqueda */
.venta-busca-tabs {
  display: flex; flex-wrap: wrap; gap: .4rem;
}
.venta-tab {
  display: inline-flex; align-items: center; gap: .35rem;
  padding: .5rem .85rem; border: 1px solid var(--line); border-radius: 999px;
  background: rgba(255,255,255,.8); color: var(--text-soft); font: inherit; font-size: .88rem; font-weight: 600;
  cursor: pointer; transition: background-color 140ms ease, color 140ms ease, border-color 140ms ease;
}
.venta-tab:hover { background: rgba(194,161,136,.16); color: var(--text); border-color: rgba(157,113,85,.35); }
.venta-tab.is-active { background: var(--accent-strong); color: #fffdfa; border-color: var(--accent-strong); }
.venta-tab .nav-icon { width: 15px; height: 15px; }
.venta-tab--libre { background: rgba(31,122,134,.09); color: #1f6f7d; border-color: rgba(31,122,134,.35); }
.venta-tab--libre:hover { background: rgba(31,122,134,.16); }
.venta-tab--libre.is-active { background: #1f7a86; color: #fff; border-color: #1f7a86; }

/* Input de búsqueda */
.venta-search-input { font-size: 1rem; padding: .75rem 1rem; flex: 1; }

/* Grid de resultados — se adapta al ANCHO REAL del panel (no al del viewport):
   pone tantas columnas como quepan con un mínimo legible. Así nunca se aprietan. */
.venta-res-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(160px, 1fr));
  gap: .8rem;
}
.venta-res-card {
  display: flex; flex-direction: column; border: 1px solid var(--line);
  border-radius: var(--radius-md); background: rgba(255,255,255,.65);
  overflow: hidden; cursor: pointer;
  transition: transform 130ms ease, box-shadow 130ms ease, border-color 130ms ease;
}
.venta-res-card:hover { transform: translateY(-2px); box-shadow: var(--shadow-soft); border-color: rgba(157,113,85,.35); }
.venta-res-card:focus-visible { outline: 2px solid var(--accent-strong); outline-offset: 2px; }
.venta-res-card.is-disabled { opacity: .5; cursor: not-allowed; pointer-events: none; }
.venta-res-foto { position: relative; aspect-ratio: 1; background: rgba(86,69,58,.06); overflow: hidden; display: grid; place-items: center; }
.venta-res-img { width: 100%; height: 100%; object-fit: cover; }
.venta-res-noimg { color: var(--accent); display: grid; place-items: center; width: 100%; height: 100%; }
.venta-res-noimg .nav-icon { width: 36px; height: 36px; }
.venta-res-stock {
  position: absolute; bottom: 4px; right: 4px;
  padding: .12rem .35rem; border-radius: 999px; font-size: .7rem; font-weight: 700;
  background: rgba(255,255,255,.92); color: var(--text); box-shadow: 0 1px 4px rgba(47,39,35,.16);
}
.venta-res-stock--out { background: #c0392b; color: #fff; }
.venta-res-body { display: flex; flex-direction: column; gap: .3rem; padding: .65rem .7rem .7rem; flex: 1; }
.venta-res-nombre { font-weight: 700; font-size: .88rem; line-height: 1.2; color: var(--text); }
.venta-res-meta { font-size: .72rem; color: var(--text-soft); }
.venta-res-foot { display: flex; flex-direction: column; align-items: stretch; gap: .4rem; margin-top: auto; padding-top: .4rem; }
.venta-res-precio { font-weight: 800; font-size: 1rem; color: var(--text); white-space: nowrap; }
.venta-res-precio-wrap { display: flex; flex-direction: column; gap: .2rem; width: 100%; }
.venta-res-precio-label { font-size: .72rem; font-weight: 600; color: var(--text-soft); }
.venta-res-precio-edit { padding: .4rem .6rem; font-size: .9rem; width: 100%; }
.venta-res-add-btn { width: 100%; padding: .4rem .6rem; font-size: .8rem; border-radius: 999px; flex: 0 0 auto; text-align: center; }

.venta-resultados-hint { color: var(--text-soft); font-size: .9rem; margin: 0; }
.venta-resultados { flex: 1 1 auto; min-height: 80px; overflow-y: auto; }

/* Barra de orden de resultados */
.venta-orden-bar { display: flex; align-items: center; justify-content: flex-end; gap: .5rem; }
.venta-orden-bar[hidden] { display: none; }
.venta-orden-label { font-size: .8rem; font-weight: 600; color: var(--text-soft); }
.venta-orden-select {
  padding: .4rem .7rem; font: inherit; font-size: .85rem; font-weight: 600;
  border: 1px solid var(--line); border-radius: 999px; background: rgba(255,255,255,.9);
  color: var(--text); cursor: pointer;
}
.venta-orden-select:hover { border-color: rgba(157,113,85,.4); }
.venta-orden-select:focus-visible { outline: 2px solid var(--accent-strong); outline-offset: 1px; }

/* Venta libre */
.venta-libre-panel { margin-top: .5rem; }
.venta-libre-card {
  padding: 1.1rem 1.2rem; border: 1px solid rgba(31,122,134,.35); border-radius: var(--radius-lg);
  background: rgba(31,122,134,.06); display: flex; flex-direction: column; gap: .8rem;
}
.venta-libre-head { display: flex; align-items: center; gap: .5rem; font-weight: 700; color: #1f6f7d; }
.venta-libre-head .nav-icon { width: 18px; height: 18px; }

/* Apertura de caja */
.venta-caja-apertura { max-width: 540px; }
.venta-nocaja-info p { margin: 0; }

/* ── Panel ticket ─────────────────────── */
.venta-panel-ticket {
  display: flex; flex-direction: column; gap: 0;
  background: var(--surface); border: 1px solid var(--line);
  border-radius: var(--radius-xl); box-shadow: var(--shadow-soft);
  overflow: hidden; position: sticky; top: 5rem;
  max-height: calc(100vh - 8.5rem);
}
.venta-ticket-head {
  display: flex; align-items: center; justify-content: space-between; gap: .7rem;
  padding: 1.1rem 1.3rem; border-bottom: 1px solid var(--line);
}
.venta-ticket-head h2 { font-size: 1.1rem; display: flex; align-items: center; gap: .4rem; }
.venta-ticket-head .nav-icon { width: 18px; height: 18px; }

/* Acciones del ticket: Aparcar · Limpiar (solo con artículos) */
.venta-ticket-acciones { display: flex; align-items: center; gap: .45rem; }
.venta-ticket-acciones[hidden] { display: none; }
.venta-ticket-acciones form { display: inline; margin: 0; }
.venta-ticket-accion-btn {
  display: inline-flex; align-items: center; gap: .3rem;
  padding: .4rem .7rem; font: inherit; font-size: .8rem; font-weight: 600;
  border: 1px solid var(--line); border-radius: 999px; background: rgba(255,255,255,.9);
  color: var(--text-soft); cursor: pointer;
  transition: background-color 140ms ease, color 140ms ease, border-color 140ms ease;
}
.venta-ticket-accion-btn:hover { background: rgba(194,161,136,.16); color: var(--text); border-color: rgba(157,113,85,.35); }
.venta-ticket-accion-btn .nav-icon { width: 15px; height: 15px; }
.venta-ticket-accion-btn--danger { color: #a4503f; }
.venta-ticket-accion-btn--danger:hover { background: rgba(248,227,225,.9); color: #8d3a2c; border-color: rgba(146,78,62,.3); }

/* Lista de líneas */
.venta-lineas {
  display: flex; flex-direction: column; gap: 0;
  overflow-y: auto; flex: 1 1 auto; min-height: 0;
  padding: .5rem 0;
}
.venta-lineas-empty {
  display: flex; flex-direction: column; align-items: center; justify-content: center;
  gap: .6rem; padding: 2.5rem 1rem; color: var(--text-soft); text-align: center; font-size: .9rem;
}
.venta-lineas-empty svg { width: 40px; height: 40px; opacity: .35; }
.venta-lineas-empty p { margin: 0; line-height: 1.4; }

.venta-linea {
  padding: .8rem 1rem; border-bottom: 1px solid var(--line);
  transition: background-color 120ms ease;
}
.venta-linea:last-child { border-bottom: 0; }
.venta-linea:hover { background: rgba(194,161,136,.06); }

/* Cabecera de línea: foto + nombre + badge dto + borrar */
.venta-linea-top { display: flex; align-items: center; gap: .6rem; }
.venta-linea-thumb {
  flex: 0 0 40px; width: 40px; height: 40px; border-radius: 8px;
  overflow: hidden; background: rgba(86,69,58,.07); display: grid; place-items: center;
}
.venta-linea-thumb img { width: 100%; height: 100%; object-fit: cover; display: block; }
.venta-thumb-empty { color: var(--accent); display: grid; place-items: center; }
.venta-thumb-empty .nav-icon { width: 18px; height: 18px; }
.venta-linea-nombre {
  flex: 1; min-width: 0; font-weight: 600; font-size: .9rem; line-height: 1.25;
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.venta-linea-dto {
  flex: 0 0 auto; font-size: .7rem; font-weight: 700; color: #3c6b4f;
  background: rgba(60,107,79,.12); padding: .12rem .4rem; border-radius: 999px;
}
.venta-linea-del { flex: 0 0 auto; }

/* Controles de línea: precio · descuento · cantidad · subtotal */
.venta-linea-ctrls {
  display: grid; grid-template-columns: auto auto 1fr auto;
  align-items: end; gap: .5rem .7rem; margin-top: .55rem; padding-left: calc(40px + .6rem);
}
.vl-field { display: flex; flex-direction: column; gap: .2rem; min-width: 0; }
.vl-lbl {
  font-size: .64rem; font-weight: 600; letter-spacing: .03em; text-transform: uppercase;
  color: var(--text-soft);
}
.vl-field--sub { align-items: flex-end; margin-left: auto; text-align: right; }

/* Input precio con sufijo € */
.vl-eur, .vl-dto { display: inline-flex; align-items: center; gap: .2rem; }
.vl-eur input {
  width: 4.6em; padding: .3rem .4rem; font-size: .85rem; font-weight: 600; text-align: right;
  border: 1px solid var(--line); border-radius: var(--radius-sm);
  background: rgba(255,255,255,.9); color: var(--text); font-family: inherit; -moz-appearance: textfield;
}
.vl-eur i { font-style: normal; font-size: .72rem; color: var(--text-soft); }

/* Descuento: input + selector %/€ */
.vl-dto input {
  width: 3.2em; padding: .3rem .35rem; font-size: .85rem; text-align: right;
  border: 1px solid var(--line); border-radius: var(--radius-sm) 0 0 var(--radius-sm);
  background: rgba(255,255,255,.9); color: var(--text); font-family: inherit; -moz-appearance: textfield;
}
.vl-dto select {
  padding: .3rem .25rem; font-size: .8rem; font-family: inherit; cursor: pointer;
  border: 1px solid var(--line); border-left: 0; border-radius: 0 var(--radius-sm) var(--radius-sm) 0;
  background: rgba(247,242,236,.9); color: var(--text);
}
.venta-linea-precio-input:hover, .vl-dto input:hover { border-color: rgba(157,113,85,.45); }
.venta-linea-precio-input:focus, .vl-dto input:focus, .vl-dto select:focus {
  outline: 2px solid var(--accent-strong); outline-offset: 1px; background: #fff;
}
.vl-eur input::-webkit-outer-spin-button, .vl-eur input::-webkit-inner-spin-button,
.vl-dto input::-webkit-outer-spin-button, .vl-dto input::-webkit-inner-spin-button { -webkit-appearance: none; margin: 0; }

/* Cantidad */
.venta-linea-qty { display: flex; align-items: center; gap: .25rem; }
.venta-qty-btn {
  width: 28px; height: 28px; border: 1px solid var(--line); border-radius: 8px;
  background: rgba(255,255,255,.8); color: var(--text); font: 600 1.05rem/1 "Inter", sans-serif;
  cursor: pointer; display: grid; place-items: center;
  transition: background-color 120ms ease, border-color 120ms ease;
}
.venta-qty-btn:hover { background: rgba(194,161,136,.2); border-color: rgba(157,113,85,.4); }
.venta-qty-input {
  width: 40px; text-align: center; padding: .3rem .2rem; font-size: .9rem; font-weight: 600;
  border: 1px solid var(--line); border-radius: 8px; background: rgba(255,255,255,.85);
  -moz-appearance: textfield;
}
.venta-qty-input::-webkit-outer-spin-button, .venta-qty-input::-webkit-inner-spin-button { -webkit-appearance: none; margin: 0; }
.venta-qty-input:focus-visible { outline: none; border-color: rgba(157,113,85,.5); box-shadow: 0 0 0 3px rgba(194,161,136,.2); }

.venta-linea-subtotal { font-weight: 800; font-size: 1.02rem; white-space: nowrap; color: var(--text); }

@media (max-width: 480px) {
  .venta-linea-ctrls { grid-template-columns: 1fr 1fr; padding-left: 0; }
  .vl-field--sub { grid-column: 2; }
}

/* Total + cobrar */
.venta-total-wrap {
  padding: 1rem 1.3rem 1.3rem;
  border-top: 2px solid var(--line);
  display: flex; flex-direction: column; gap: .35rem;
}
.venta-total-row { display: flex; align-items: baseline; justify-content: space-between; }
.venta-total-label { font-size: .8rem; letter-spacing: .1em; text-transform: uppercase; color: var(--text-soft); font-weight: 700; }
.venta-total-valor { font-size: 2rem; font-weight: 800; font-variant-numeric: tabular-nums; letter-spacing: -.02em; color: var(--text); }
.venta-total-meta { font-size: .82rem; color: var(--text-soft); margin-bottom: .3rem; }

.venta-cobrar-btn {
  display: flex; align-items: center; justify-content: center; gap: .5rem;
  width: 100%; padding: 1.05rem 1.4rem; border: 0; border-radius: var(--radius-lg);
  font: 700 1.25rem/1 "Inter", sans-serif; color: #fffdfa; cursor: pointer;
  background: linear-gradient(135deg, #2d8678 0%, #1f6f7d 100%);
  box-shadow: 0 16px 32px rgba(31,110,125,.28);
  transition: transform 150ms ease, box-shadow 150ms ease, opacity 150ms ease;
}
.venta-cobrar-btn:hover:not(:disabled):not(.is-disabled) {
  transform: translateY(-1px); box-shadow: 0 20px 40px rgba(31,110,125,.36);
}
.venta-cobrar-btn:disabled, .venta-cobrar-btn.is-disabled {
  opacity: .45; cursor: not-allowed; box-shadow: none;
  background: linear-gradient(135deg, #9dbfba 0%, #7ca8af 100%);
}
.venta-cobrar-btn .nav-icon { width: 22px; height: 22px; }

/* Toast */
.venta-toast {
  position: fixed; bottom: 1.4rem; left: 50%; transform: translateX(-50%) translateY(12px);
  z-index: 300; padding: .65rem 1.2rem; border-radius: 999px;
  background: #2f2723; color: #fffdfa; font-size: .9rem; font-weight: 600;
  box-shadow: 0 8px 24px rgba(47,39,35,.35);
  opacity: 0; visibility: hidden; transition: opacity 200ms ease, transform 200ms ease, visibility 0s linear 200ms;
  white-space: nowrap; max-width: calc(100vw - 2rem);
}
.venta-toast.is-visible {
  opacity: 1; visibility: visible; transform: translateX(-50%) translateY(0);
  transition: opacity 200ms ease, transform 200ms ease;
}
.venta-toast--err { background: #8d4a3c; }

/* Responsive venta */
/* El grid de resultados NO necesita media queries: auto-fill se adapta al
   ancho real del panel buscador (que cambia según sidebar y panel ticket). */
@media (max-width: 900px) {
  .venta-layout { grid-template-columns: 1fr; min-height: 0; align-items: start; }
  .venta-panel-ticket { position: static; max-height: none; }
  .venta-lineas { flex: 0 1 auto; max-height: 35vh; }
  .venta-resultados { flex: 0 1 auto; overflow-y: visible; }
}
@media (max-width: 480px) {
  .venta-total-valor { font-size: 1.6rem; }
  /* en móviles muy estrechos, bajar el mínimo para que quepan 2 columnas */
  .venta-res-grid { grid-template-columns: repeat(auto-fill, minmax(140px, 1fr)); }
}

/* ================================================================
   COBRO MODAL — Fase B
   ================================================================ */
.cobro-modal {
  display: flex; flex-direction: column; gap: 1rem;
}

/* Total grande en cabecera del modal */
.cobro-total-wrap {
  display: flex; align-items: center; justify-content: center; gap: .8rem;
  background: linear-gradient(135deg, #3d7a72 0%, #2a5e58 100%);
  color: #fff; border-radius: .7rem; padding: 1.1rem 1.4rem;
}
.cobro-total-label {
  font-size: 1rem; font-weight: 700; letter-spacing: .08em; opacity: .85;
}
.cobro-total-valor {
  font-size: 2.6rem; font-weight: 800; line-height: 1;
}

/* Grid de dos columnas */
.cobro-grid {
  display: grid; grid-template-columns: 1fr 1fr; gap: 1.2rem;
}
@media (max-width: 640px) {
  .cobro-grid { grid-template-columns: 1fr; }
  .cobro-total-valor { font-size: 2rem; }
}

.cobro-col { display: flex; flex-direction: column; gap: .5rem; }

.cobro-field-label {
  display: flex; flex-direction: column; gap: .25rem;
  font-size: .85rem; font-weight: 600; color: var(--text);
}

.cobro-select, .cobro-input {
  padding: .45rem .65rem; border: 1.5px solid var(--line);
  border-radius: .45rem; font-size: .9rem; width: 100%;
  background: var(--surface); color: var(--text);
  transition: border-color 160ms;
}
.cobro-select:focus, .cobro-input:focus {
  outline: none; border-color: var(--accent);
}
textarea.cobro-input { resize: vertical; }

/* Pagos */
.cobro-pagos-head {
  display: flex; align-items: center; justify-content: space-between;
  font-weight: 600; font-size: .88rem;
}
.cobro-pago-row {
  display: flex; align-items: center; gap: .5rem; margin-bottom: .4rem;
}
.cobro-pago-row .cobro-select { flex: 1 1 auto; }
.cobro-pago-row .cobro-input  { flex: 0 0 100px; }

/* Summary entregado/cambio */
.cobro-sum-row {
  display: flex; justify-content: space-between; align-items: center;
  font-size: .88rem; padding: .2rem 0;
}
.cobro-cambio span:last-child { font-size: 1.1rem; }

/* Nuevo cliente inline */
.cobro-nuevo-cliente-form {
  background: var(--surface-alt); border: 1.5px solid var(--line);
  border-radius: .5rem; padding: .8rem .8rem .6rem; margin-top: .25rem;
  display: flex; flex-direction: column; gap: .25rem;
}
.cobro-nuevo-cliente-btn { color: var(--accent); font-size: .82rem; }

/* Footer del modal */
.cobro-footer {
  display: flex; align-items: center; gap: .8rem;
  padding: .9rem 0 .2rem; margin-top: .8rem;
  border-top: 1px solid var(--line);
  /* Siempre visible al fondo del modal aunque haya scroll */
  position: sticky; bottom: -1.6rem;
  background: linear-gradient(to top, var(--surface-strong) 70%, rgba(255,255,255,0));
}
.cobro-finalizar-btn {
  padding: .85rem 1.6rem; font-size: 1.1rem; font-weight: 800; margin-left: auto;
  min-width: 220px;
}
.cobro-finalizar-btn:disabled {
  opacity: .45; cursor: not-allowed;
  background: linear-gradient(135deg, #9dbfba 0%, #7ca8af 100%);
}

/* Ticket preview en modal post-venta */
.venta-ticket-modal-btns { margin-bottom: .5rem; }

/* M11: print solo aplica si hay .ticket-preview visible (p.ej. ventana de ticket)
   Si no hay .ticket-preview, no ocultar nada para no dejar en blanco al imprimir el TPV */
@media print {
  body:has(.ticket-preview) > *:not(.ticket-preview) { display: none !important; }
  .ticket-preview { position: fixed; top: 0; left: 0; right: 0; }
}

/* ── Fase C: barra superior venta ── */
.venta-topbar {
  display: flex; flex-wrap: wrap; gap: .45rem; align-items: center;
  padding: .55rem .9rem; background: var(--card-bg);
  border-bottom: 1px solid var(--line); margin-bottom: .5rem;
}
.venta-topbar-btn {
  display: inline-flex; align-items: center; gap: .35rem;
  padding: .35rem .75rem; font-size: .82rem; font-weight: 600;
  border: 1px solid var(--line); border-radius: 6px;
  background: var(--bg); color: var(--text); cursor: pointer;
  transition: background .15s, border-color .15s;
  position: relative;
}
.venta-topbar-btn:hover {
  background: var(--accent-light); border-color: var(--accent);
}
.venta-badge {
  display: inline-flex; align-items: center; justify-content: center;
  min-width: 18px; height: 18px; padding: 0 4px;
  background: #8d4a3c; color: #fff; border-radius: 9px;
  font-size: .72rem; font-weight: 700; line-height: 1;
}
/* Input referencia pago (vale / tarjeta regalo) */
.cobro-pago-ref {
  border: 1px solid #8d4a3c; border-radius: 6px;
  padding: .3rem .5rem; font-size: .9rem;
}
.cobro-pago-ref::placeholder { color: #c09070; }
/* Modal body (para reload parcial en finalizados) */
.tpv-modal-body { max-height: 70vh; overflow-y: auto; }

/* Galería multifoto de artículos */
.art-galeria-head { display:flex; align-items:center; gap:.6rem; margin:.4rem 0 .6rem; flex-wrap:wrap; }
.art-galeria-grid { display:grid; grid-template-columns:repeat(auto-fill,minmax(110px,1fr)); gap:.6rem; }
.art-foto { position:relative; margin:0; border:1px solid var(--line); border-radius:8px; overflow:hidden; background:#fff; }
.art-foto img { display:block; width:100%; height:110px; object-fit:cover; }
.art-foto.is-principal { outline:2px solid var(--accent); }
.art-foto-badge { position:absolute; top:4px; left:4px; background:var(--accent); color:#fff; font-size:.68rem; font-weight:700; padding:1px 6px; border-radius:6px; }
.art-foto-acc { position:absolute; top:4px; right:4px; display:flex; gap:4px; }
.art-foto-acc button { width:26px; height:26px; border:none; border-radius:6px; background:rgba(0,0,0,.55); color:#fff; cursor:pointer; font-size:.95rem; line-height:1; }
.art-foto-acc button:hover { background:rgba(0,0,0,.8); }
.art-galeria-aviso { color:var(--text-soft); font-size:.9rem; }
