/**
 * TIENDEX — tema visual según diseño de referencia
 * Sidebar iconográfica, header con búsqueda, tabs de categoría y panel de orden.
 */

:root {
  --pos-primary: #2563eb;
  --pos-primary-dark: #1d4ed8;
  --pos-primary-light: #3b82f6;
  --pos-accent: #2563eb;
  --pos-accent-soft: rgba(37, 99, 235, 0.1);
  --pos-sidebar: #f8fafc;
  --pos-sidebar-active: #2563eb;
  --pos-bg: #eef2f7;
  --pos-card: #ffffff;
  --pos-text: #0f172a;
  --pos-muted: #64748b;
  --pos-danger: #dc2626;
  --pos-success: #16a34a;
  --pos-warning: #d97706;
  --pos-border: #e2e8f0;
  --pos-radius: 12px;
  --pos-shadow: 0 4px 24px rgba(15, 23, 42, 0.06);
  --pos-sidebar-w: 72px;
  --pos-order-w: 380px;
}

body {
  font-family: 'Inter', 'Segoe UI', system-ui, -apple-system, sans-serif;
  background: var(--pos-bg);
  color: var(--pos-text);
  -webkit-font-smoothing: antialiased;
}

/* ── Login ── */
.login-screen {
  background: linear-gradient(135deg, #0f172a 0%, #1e3a5f 45%, #2563eb 100%);
}

.login-card {
  border-radius: 16px;
  box-shadow: 0 24px 60px rgba(0, 0, 0, 0.25);
  max-width: 420px;
}

.login-card h1 {
  font-weight: 800;
  letter-spacing: -0.02em;
  color: var(--pos-text);
}

.login-card .nex-login-logo {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  margin-bottom: 0.5rem;
}

.login-card .nex-login-logo-icon {
  width: 48px;
  height: 48px;
  border-radius: 12px;
  background: linear-gradient(135deg, #2563eb, #1d4ed8);
  color: #fff;
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 800;
  font-size: 1.1rem;
}

.btn-primary {
  background: var(--pos-primary);
  border-radius: 10px;
}

.btn-primary:hover {
  background: var(--pos-primary-dark);
}

/* ── App shell ── */
.app-shell {
  display: grid;
  grid-template-columns: var(--pos-sidebar-w) minmax(0, 1fr);
  min-height: 100vh;
}

/* ── Sidebar ── */
.nex-sidebar {
  background: var(--pos-sidebar);
  border-right: 1px solid var(--pos-border);
  display: flex;
  flex-direction: column;
  align-items: center;
  position: sticky;
  top: 0;
  height: 100vh;
  z-index: 130;
  padding: 0.75rem 0;
}

.nex-sidebar-nav {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0.35rem;
  flex: 1;
  width: 100%;
  padding: 0 0.5rem;
}

.nex-nav-item {
  width: 52px;
  height: 52px;
  border: none;
  border-radius: 14px;
  background: transparent;
  color: var(--pos-muted);
  cursor: pointer;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 0.15rem;
  font-size: 0.58rem;
  font-weight: 600;
  transition: background 0.15s, color 0.15s, box-shadow 0.15s;
  position: relative;
}

.nex-nav-item .nex-nav-icon {
  font-size: 1.35rem;
  line-height: 1;
}

.nex-nav-item:hover {
  background: rgba(37, 99, 235, 0.08);
  color: var(--pos-primary);
}

.nex-nav-item.active {
  background: var(--pos-primary);
  color: #fff;
  box-shadow: 0 6px 20px rgba(37, 99, 235, 0.35);
}

.nex-nav-item .badge {
  position: absolute;
  top: 4px;
  right: 4px;
  background: var(--pos-danger);
  color: #fff;
  font-size: 0.6rem;
  min-width: 16px;
  height: 16px;
  border-radius: 99px;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 0 4px;
}

.nex-sidebar-exit {
  margin-top: auto;
  padding-bottom: 0.5rem;
}

.nex-nav-item.nex-nav-exit {
  color: var(--pos-danger);
}

.nex-nav-item.nex-nav-exit:hover {
  background: rgba(220, 38, 38, 0.1);
  color: var(--pos-danger);
}

/* ── Workspace ── */
.nex-workspace {
  display: flex;
  flex-direction: column;
  min-width: 0;
  min-height: 100vh;
}

/* ── Header principal ── */
.nex-header {
  background: #fff;
  border-bottom: 1px solid var(--pos-border);
  padding: 0.6rem 1.25rem;
  display: flex;
  align-items: center;
  gap: 1rem;
  flex-wrap: wrap;
  position: sticky;
  top: 0;
  z-index: 110;
}

.nex-brand {
  display: flex;
  align-items: center;
  gap: 0.65rem;
  flex-shrink: 0;
}

.nex-brand-logo {
  width: 36px;
  height: 36px;
  border-radius: 10px;
  background: linear-gradient(135deg, #2563eb, #1d4ed8);
  color: #fff;
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 800;
  font-size: 0.75rem;
}

.nex-brand-text strong {
  display: block;
  font-size: 1rem;
  font-weight: 800;
  letter-spacing: -0.02em;
  line-height: 1.1;
}

.nex-brand-text span {
  font-size: 0.65rem;
  color: var(--pos-success);
  font-weight: 600;
  display: flex;
  align-items: center;
  gap: 0.25rem;
}

.nex-brand-text span::before {
  content: '';
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: var(--pos-success);
}

.nex-header-search {
  flex: 1 1 280px;
  max-width: 480px;
  position: relative;
}

.nex-header-search input {
  width: 100%;
  padding: 0.65rem 1rem 0.65rem 2.5rem;
  border: 1.5px solid var(--pos-border);
  border-radius: 10px;
  font-size: 0.9rem;
  background: #f8fafc;
}

.nex-header-search input:focus {
  outline: none;
  border-color: var(--pos-primary);
  background: #fff;
  box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.12);
}

.nex-header-search::before {
  content: '⌕';
  position: absolute;
  left: 0.85rem;
  top: 50%;
  transform: translateY(-50%);
  color: var(--pos-muted);
  font-size: 1.1rem;
}

.nex-header-meta {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  margin-left: auto;
  flex-wrap: wrap;
}

.nex-clock {
  font-size: 0.95rem;
  font-weight: 700;
  font-variant-numeric: tabular-nums;
  color: var(--pos-text);
}

.nex-user-chip {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  font-size: 0.85rem;
  font-weight: 600;
  border: 1.5px solid transparent;
  background: transparent;
  border-radius: 999px;
  padding: 0.2rem 0.65rem 0.2rem 0.2rem;
  cursor: pointer;
  color: var(--pos-text);
  font-family: inherit;
  transition: background 0.15s, border-color 0.15s;
}

.nex-user-chip:hover,
.nex-user-chip:focus-visible {
  background: #f1f5f9;
  border-color: var(--pos-border);
  outline: none;
}

.nex-user-chip-caret {
  font-size: 0.7rem;
  color: var(--pos-muted);
}

/* ── Perfil del comerciante ── */
.nex-profile-modal {
  max-width: 520px;
  padding: 0;
  overflow: hidden;
}

.nex-profile-head {
  display: flex;
  align-items: center;
  gap: 0.85rem;
  padding: 1.1rem 1.25rem;
  background: linear-gradient(135deg, #0f172a, #1e3a5f);
  color: #fff;
}

.nex-profile-avatar {
  width: 48px;
  height: 48px;
  border-radius: 50%;
  background: linear-gradient(135deg, #2563eb, #60a5fa);
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 800;
  font-size: 1.1rem;
  flex-shrink: 0;
}

.nex-profile-head-text {
  flex: 1;
  min-width: 0;
}

.nex-profile-head h2 {
  margin: 0;
  font-size: 1.05rem;
  font-weight: 800;
  color: #fff;
}

.nex-profile-subtitle {
  font-size: 0.78rem;
  opacity: 0.8;
  margin-top: 0.15rem;
}

.nex-profile-close {
  border: none;
  background: rgba(255, 255, 255, 0.12);
  color: #fff;
  width: 32px;
  height: 32px;
  border-radius: 8px;
  cursor: pointer;
  font-size: 0.9rem;
}

.nex-profile-close:hover {
  background: rgba(255, 255, 255, 0.25);
}

.nex-profile-body {
  padding: 1rem 1.25rem;
  max-height: 60vh;
  overflow-y: auto;
}

.nex-profile-loading {
  color: var(--pos-muted);
  text-align: center;
  padding: 1rem 0;
}

.nex-profile-section {
  margin-bottom: 1rem;
}

.nex-profile-section h3 {
  font-size: 0.68rem;
  font-weight: 700;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--pos-muted);
  margin: 0 0 0.45rem;
}

.nex-profile-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 0.5rem;
}

.nex-profile-item {
  background: #f8fafc;
  border: 1px solid var(--pos-border);
  border-radius: 10px;
  padding: 0.55rem 0.7rem;
  min-width: 0;
}

.nex-profile-item.wide {
  grid-column: 1 / -1;
}

.nex-profile-item .k {
  display: block;
  font-size: 0.66rem;
  color: var(--pos-muted);
  font-weight: 600;
  margin-bottom: 0.15rem;
}

.nex-profile-item .v {
  display: block;
  font-size: 0.88rem;
  font-weight: 700;
  color: var(--pos-text);
  word-break: break-word;
}

.nex-profile-item .v.money {
  color: var(--pos-primary);
}

.nex-status {
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
  font-size: 0.78rem;
  font-weight: 700;
  padding: 0.2rem 0.55rem;
  border-radius: 999px;
}

.nex-status::before {
  content: '';
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: currentColor;
}

.nex-status.ok { background: #dcfce7; color: #15803d; }
.nex-status.warn { background: #fef3c7; color: #b45309; }
.nex-status.off { background: #f1f5f9; color: var(--pos-muted); }

.nex-diag-errors {
  margin: 0;
  padding-left: 1rem;
  font-size: 0.75rem;
  line-height: 1.4;
  max-height: 140px;
  overflow-y: auto;
}

.nex-diag-errors li {
  margin-bottom: 0.3rem;
  word-break: break-word;
}

.nex-diag-errors code {
  background: #e2e8f0;
  border-radius: 4px;
  padding: 0 0.3rem;
  font-size: 0.7rem;
}

.nex-diag-errors small {
  color: var(--pos-muted);
}

.nex-diag-copy {
  margin-top: 0.5rem;
  border-radius: 8px;
}

.nex-panel-loading {
  color: var(--pos-muted);
  padding: 1.5rem;
  text-align: center;
}

.nex-panel-fallback {
  max-width: 560px;
  margin: 1rem auto;
}

.nex-panel-fallback-actions {
  display: flex;
  gap: 0.5rem;
  flex-wrap: wrap;
  margin-top: 0.75rem;
}

.nex-panel-fallback-actions .btn {
  border-radius: 10px;
}

.nex-profile-actions {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 0.45rem;
  padding: 0.85rem 1.25rem 1.1rem;
  border-top: 1px solid var(--pos-border);
  background: #fafbfc;
}

.nex-profile-actions .btn {
  border-radius: 10px;
  font-size: 0.8rem;
  font-weight: 600;
  padding: 0.6rem 0.5rem;
}

.nex-profile-actions .btn-danger {
  grid-column: 1 / -1;
}

@media (max-width: 520px) {
  .nex-profile-grid,
  .nex-profile-actions {
    grid-template-columns: 1fr;
  }
}

.nex-user-avatar {
  width: 32px;
  height: 32px;
  border-radius: 50%;
  background: linear-gradient(135deg, #2563eb, #1d4ed8);
  color: #fff;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 0.75rem;
  font-weight: 700;
}

.nex-header-badges {
  display: flex;
  gap: 0.4rem;
}

.nex-badge-pill {
  padding: 0.35rem 0.65rem;
  border-radius: 8px;
  font-size: 0.68rem;
  font-weight: 700;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  border: 1px solid var(--pos-border);
  background: #f8fafc;
  color: var(--pos-muted);
}

.nex-badge-pill.active {
  background: rgba(37, 99, 235, 0.1);
  border-color: rgba(37, 99, 235, 0.25);
  color: var(--pos-primary);
}

.nex-cash-balance {
  background: linear-gradient(135deg, #0f172a, #1e3a5f);
  color: #fff;
  padding: 0.5rem 1rem;
  border-radius: 10px;
  font-weight: 700;
  font-size: 0.95rem;
  white-space: nowrap;
}

.nex-cash-balance small {
  display: block;
  font-size: 0.6rem;
  font-weight: 600;
  opacity: 0.7;
  letter-spacing: 0.06em;
  text-transform: uppercase;
}

/* ── Sub-header ── */
.nex-subheader {
  background: #fff;
  border-bottom: 1px solid var(--pos-border);
  padding: 0.55rem 1.25rem;
  display: flex;
  align-items: center;
  gap: 1rem;
  flex-wrap: wrap;
}

.nex-quick-scan {
  flex: 1 1 300px;
  position: relative;
}

.nex-quick-scan input {
  width: 100%;
  padding: 0.6rem 1rem 0.6rem 2.25rem;
  border: 1.5px solid var(--pos-border);
  border-radius: 10px;
  font-size: 0.88rem;
  background: #fff;
}

.nex-quick-scan input:focus {
  outline: none;
  border-color: var(--pos-primary);
  box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.12);
}

.nex-quick-scan::before {
  content: '▦';
  position: absolute;
  left: 0.75rem;
  top: 50%;
  transform: translateY(-50%);
  color: var(--pos-muted);
  font-size: 0.95rem;
}

.nex-shortcuts {
  display: flex;
  gap: 0.5rem;
  flex-wrap: wrap;
}

.nex-shortcut {
  padding: 0.35rem 0.7rem;
  border-radius: 8px;
  font-size: 0.72rem;
  font-weight: 600;
  background: #f1f5f9;
  color: var(--pos-muted);
  border: 1px solid var(--pos-border);
}

.nex-shortcut kbd {
  background: #fff;
  border: 1px solid var(--pos-border);
  border-radius: 4px;
  padding: 0.1rem 0.35rem;
  font-size: 0.68rem;
  margin-right: 0.25rem;
}

.nex-online-status {
  margin-left: auto;
  font-size: 0.75rem;
  font-weight: 600;
  color: var(--pos-success);
  display: flex;
  align-items: center;
  gap: 0.35rem;
}

.nex-online-status::before {
  content: '';
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: var(--pos-success);
  box-shadow: 0 0 0 3px rgba(22, 163, 74, 0.2);
}

.nex-subheader.hidden {
  display: none;
}

/* Branch selector in header */
.nex-branch-wrap select {
  padding: 0.45rem 0.75rem;
  border: 1px solid var(--pos-border);
  border-radius: 8px;
  font-size: 0.82rem;
  font-weight: 500;
  background: #fff;
  max-width: 160px;
}

/* Hide legacy topbar/nav */
.topbar,
.nav-tabs:not(.nex-sidebar-nav) {
  display: none !important;
}

/* ── Main content ── */
.main-content {
  flex: 1;
  padding: 0;
  max-width: none;
  margin: 0;
  overflow: hidden;
}

.panel {
  display: none;
  height: calc(100vh - 110px);
  overflow-y: auto;
}

.panel.active {
  display: block;
}

.panel:not(#panel-venta) {
  padding: 1.25rem;
  height: auto;
  min-height: calc(100vh - 110px);
}

/* ── Venta layout ── */
#panel-venta {
  padding: 0;
  overflow: hidden;
}

.nex-pos-layout {
  display: grid;
  grid-template-columns: minmax(0, 1fr) var(--pos-order-w);
  height: calc(100vh - 110px);
}

.nex-catalog {
  display: flex;
  flex-direction: column;
  overflow: hidden;
  background: var(--pos-bg);
}

/* Category tabs */
.nex-category-tabs {
  display: flex;
  gap: 0.5rem;
  padding: 0.85rem 1.25rem;
  overflow-x: auto;
  flex-shrink: 0;
  background: var(--pos-bg);
  -webkit-overflow-scrolling: touch;
}

.nex-cat-tab {
  display: inline-flex;
  align-items: center;
  gap: 0.45rem;
  padding: 0.55rem 1rem;
  border: 1.5px solid var(--pos-border);
  border-radius: 999px;
  background: #fff;
  font-size: 0.82rem;
  font-weight: 600;
  color: var(--pos-muted);
  cursor: pointer;
  white-space: nowrap;
  transition: all 0.15s;
}

.nex-cat-tab:hover {
  border-color: rgba(37, 99, 235, 0.35);
  color: var(--pos-primary);
}

.nex-cat-tab.active {
  background: var(--pos-primary);
  border-color: var(--pos-primary);
  color: #fff;
  box-shadow: 0 4px 14px rgba(37, 99, 235, 0.3);
}

.nex-cat-tab .cat-count {
  background: rgba(255, 255, 255, 0.25);
  padding: 0.1rem 0.45rem;
  border-radius: 99px;
  font-size: 0.72rem;
}

.nex-cat-tab:not(.active) .cat-count {
  background: #f1f5f9;
  color: var(--pos-muted);
}

/* Scanner hidden in venta — use quick scan */
#venta-scanner {
  display: none;
}

/* Product grid */
#panel-venta .product-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(210px, 1fr));
  gap: 1rem;
  padding: 0 1.25rem 1.25rem;
  overflow-y: auto;
  flex: 1;
  max-height: none;
  align-content: start;
}

#panel-venta .product-chip {
  border: 1px solid var(--pos-border);
  border-radius: var(--pos-radius);
  padding: 0;
  cursor: pointer;
  text-align: left;
  background: #fff;
  overflow: hidden;
  box-shadow: var(--pos-shadow);
  transition: transform 0.15s, box-shadow 0.15s, border-color 0.15s;
  display: flex;
  flex-direction: column;
  min-height: 240px;
  position: relative;
}

#panel-venta .product-chip:hover {
  border-color: rgba(37, 99, 235, 0.4);
  box-shadow: 0 12px 32px rgba(37, 99, 235, 0.15);
  transform: translateY(-2px);
}

.product-chip-header {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  padding: 0.55rem 0.65rem 0;
  gap: 0.35rem;
}

.product-chip-tags {
  display: flex;
  flex-wrap: wrap;
  gap: 0.25rem;
}

.product-tag {
  font-size: 0.62rem;
  font-weight: 700;
  padding: 0.15rem 0.45rem;
  border-radius: 6px;
  text-transform: uppercase;
  letter-spacing: 0.03em;
}

.product-tag.top { background: #fef3c7; color: #b45309; }
.product-tag.stock { background: #dbeafe; color: #1d4ed8; }
.product-tag.new { background: #dcfce7; color: #15803d; }
.product-tag.rec { background: #ede9fe; color: #6d28d9; }

.product-chip-code {
  font-size: 0.65rem;
  color: var(--pos-muted);
  font-weight: 600;
}

#panel-venta .product-chip img {
  width: 100%;
  height: 120px;
  object-fit: contain;
  background: linear-gradient(180deg, #fafbfd 0%, #f1f5f9 100%);
  border-radius: 0;
  margin: 0;
  padding: 0.5rem;
}

.product-chip-placeholder {
  width: 100%;
  height: 120px;
  background: linear-gradient(180deg, #fafbfd 0%, #f1f5f9 100%);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 2.5rem;
  opacity: 0.35;
}

#panel-venta .product-chip .name {
  font-size: 0.88rem;
  font-weight: 700;
  color: var(--pos-text);
  padding: 0.5rem 0.75rem 0.15rem;
  line-height: 1.3;
}

#panel-venta .product-chip .desc {
  font-size: 0.72rem;
  color: var(--pos-muted);
  padding: 0 0.75rem;
  line-height: 1.35;
  flex: 1;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

#panel-venta .product-chip .price-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0.5rem 0.75rem 0.75rem;
}

#panel-venta .product-chip .price {
  font-size: 1.15rem;
  color: var(--pos-primary);
  font-weight: 800;
  padding: 0;
  letter-spacing: -0.02em;
}

.product-add-btn {
  width: 34px;
  height: 34px;
  border-radius: 10px;
  border: none;
  background: var(--pos-accent-soft);
  color: var(--pos-primary);
  font-size: 1.3rem;
  font-weight: 700;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: background 0.15s;
}

.product-add-btn:hover {
  background: var(--pos-primary);
  color: #fff;
}

/* ── Order panel ── */
.nex-order-panel {
  background: #fff;
  border-left: 1px solid var(--pos-border);
  display: flex;
  flex-direction: column;
  overflow: hidden;
  box-shadow: -4px 0 24px rgba(15, 23, 42, 0.04);
}

.nex-order-header {
  padding: 1rem 1.15rem 0.75rem;
  border-bottom: 1px solid var(--pos-border);
}

.nex-order-title-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.5rem;
  margin-bottom: 0.65rem;
}

.nex-order-title {
  font-size: 1.05rem;
  font-weight: 800;
}

.nex-order-status {
  font-size: 0.65rem;
  font-weight: 700;
  padding: 0.25rem 0.55rem;
  border-radius: 6px;
  background: #fef3c7;
  color: #b45309;
  text-transform: uppercase;
  letter-spacing: 0.05em;
}

.nex-order-type {
  display: flex;
  gap: 0.35rem;
}

.nex-order-type-btn {
  flex: 1;
  padding: 0.45rem 0.5rem;
  border: 1.5px solid var(--pos-border);
  border-radius: 8px;
  background: #fff;
  font-size: 0.75rem;
  font-weight: 600;
  cursor: pointer;
  color: var(--pos-muted);
  transition: all 0.15s;
}

.nex-order-type-btn.active {
  background: var(--pos-primary);
  border-color: var(--pos-primary);
  color: #fff;
}

.nex-order-customer {
  padding: 0.65rem 1.15rem;
  border-bottom: 1px solid var(--pos-border);
  display: flex;
  align-items: center;
  justify-content: space-between;
  font-size: 0.82rem;
}

.nex-order-customer strong {
  font-weight: 700;
}

.nex-order-customer a {
  color: var(--pos-primary);
  font-size: 0.75rem;
  font-weight: 600;
  text-decoration: none;
}

/* Cart items */
.nex-order-items {
  flex: 1;
  overflow-y: auto;
  padding: 0.5rem 1.15rem;
}

.nex-order-item {
  padding: 0.75rem 0;
  border-bottom: 1px dashed var(--pos-border);
}

.nex-order-item:last-child {
  border-bottom: none;
}

.nex-order-item-top {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 0.5rem;
}

.nex-order-item-name {
  font-size: 0.85rem;
  font-weight: 700;
  line-height: 1.3;
}

.nex-order-item-price {
  font-size: 0.85rem;
  font-weight: 700;
  color: var(--pos-primary);
  white-space: nowrap;
}

.nex-order-item-modifier {
  font-size: 0.72rem;
  color: var(--pos-muted);
  margin-top: 0.2rem;
}

.nex-order-item-controls {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  margin-top: 0.45rem;
}

.nex-qty-btn {
  width: 28px;
  height: 28px;
  border: 1px solid var(--pos-border);
  border-radius: 8px;
  background: #fff;
  font-size: 1rem;
  font-weight: 700;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--pos-text);
}

.nex-qty-btn:hover {
  border-color: var(--pos-primary);
  color: var(--pos-primary);
}

.nex-qty-value {
  font-size: 0.88rem;
  font-weight: 700;
  min-width: 24px;
  text-align: center;
}

.nex-order-item-remove {
  margin-left: auto;
  border: none;
  background: none;
  color: var(--pos-muted);
  cursor: pointer;
  font-size: 0.85rem;
  padding: 0.25rem;
}

.nex-order-item-remove:hover {
  color: var(--pos-danger);
}

.nex-order-empty {
  text-align: center;
  color: var(--pos-muted);
  padding: 2rem 1rem;
  font-size: 0.88rem;
}

/* Totals */
.nex-order-totals {
  padding: 0.75rem 1.15rem;
  border-top: 1px solid var(--pos-border);
  background: #fafbfc;
}

.nex-total-row {
  display: flex;
  justify-content: space-between;
  font-size: 0.82rem;
  padding: 0.25rem 0;
  color: var(--pos-muted);
}

.nex-total-row.discount {
  color: var(--pos-danger);
}

.nex-total-row.grand {
  margin-top: 0.5rem;
  padding-top: 0.65rem;
  border-top: 2px solid var(--pos-border);
}

.nex-total-row.grand .nex-total-label {
  font-size: 0.72rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--pos-muted);
}

.nex-total-row.grand .nex-total-value {
  font-size: 1.85rem;
  font-weight: 800;
  color: var(--pos-primary);
  letter-spacing: -0.03em;
}

/* Payment section */
.nex-order-payment {
  padding: 0.75rem 1.15rem 1rem;
  border-top: 1px solid var(--pos-border);
}

.nex-quick-cash {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 0.4rem;
  margin-bottom: 0.65rem;
}

.nex-quick-cash-btn {
  padding: 0.5rem 0.25rem;
  border: 1.5px solid var(--pos-border);
  border-radius: 8px;
  background: #fff;
  font-size: 0.78rem;
  font-weight: 700;
  cursor: pointer;
  color: var(--pos-text);
  transition: all 0.15s;
}

.nex-quick-cash-btn:hover,
.nex-quick-cash-btn.active {
  border-color: var(--pos-primary);
  background: var(--pos-accent-soft);
  color: var(--pos-primary);
}

.nex-pay-primary {
  width: 100%;
  padding: 0.95rem 1rem;
  border: none;
  border-radius: 12px;
  background: linear-gradient(180deg, #1e3a5f 0%, #0f172a 100%);
  color: #fff;
  font-size: 0.92rem;
  font-weight: 700;
  cursor: pointer;
  margin-bottom: 0.5rem;
  box-shadow: 0 8px 24px rgba(15, 23, 42, 0.25);
  transition: transform 0.1s;
}

.nex-pay-primary:hover {
  transform: translateY(-1px);
}

.nex-pay-primary small {
  display: block;
  font-size: 0.65rem;
  font-weight: 500;
  opacity: 0.75;
  margin-top: 0.15rem;
}

.nex-pay-secondary {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 0.4rem;
  margin-bottom: 0.5rem;
}

.nex-pay-secondary .btn {
  border-radius: 10px;
  font-size: 0.82rem;
  font-weight: 600;
  padding: 0.65rem;
}

.nex-pay-footer {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 0.4rem;
}

.nex-pay-footer .btn {
  border-radius: 10px;
  font-size: 0.78rem;
  font-weight: 600;
  padding: 0.55rem;
}

/* Hidden legacy cart elements inside order panel */
.nex-order-panel .cart-total,
.nex-order-panel > .form-group,
.nex-order-panel > #change-label,
.nex-order-panel > .cart-actions {
  display: none;
}

.nex-order-panel #payment-method,
.nex-order-panel #cash-wrap,
.nex-order-panel #mixed-wrap,
.nex-order-panel #customer-select-wrap,
.nex-order-panel #mp-terminal-checkout {
  display: none !important;
}

.nex-order-panel .cart-items {
  display: none;
}

/* Payment method sync — show cash input when efectivo selected */
.nex-cash-input-wrap {
  margin-bottom: 0.5rem;
}

.nex-cash-input-wrap input {
  width: 100%;
  padding: 0.6rem 0.85rem;
  border: 1.5px solid var(--pos-border);
  border-radius: 10px;
  font-size: 0.9rem;
  font-weight: 600;
}

.nex-change-label {
  font-size: 0.82rem;
  font-weight: 700;
  color: var(--pos-success);
  margin-bottom: 0.5rem;
  min-height: 1.2em;
}

/* Cards for other panels */
.card {
  border-radius: var(--pos-radius);
  box-shadow: var(--pos-shadow);
  border: 1px solid var(--pos-border);
}

.stat-box {
  background: linear-gradient(135deg, var(--pos-primary), var(--pos-primary-dark));
}

.stat-box.accent {
  background: linear-gradient(135deg, #d97706, #f59e0b);
}

/* CRM / tables */
.data-table th {
  color: var(--pos-muted);
  font-weight: 700;
}

.ops-tile:hover {
  border-color: var(--pos-primary);
}

.ops-tile--perfil {
  background: linear-gradient(135deg, #eff6ff, #dbeafe);
  border-color: rgba(37, 99, 235, 0.35);
}

.ops-tile--perfil .ops-label {
  color: var(--pos-primary);
  font-weight: 700;
}

.ops-tile:hover .ops-label {
  color: var(--pos-primary);
}

/* Modal */
.modal {
  border-radius: 16px;
  box-shadow: 0 24px 60px rgba(15, 23, 42, 0.2);
}

/* Responsive */
@media (max-width: 1100px) {
  .nex-pos-layout {
    grid-template-columns: 1fr;
    height: auto;
  }

  .nex-order-panel {
    border-left: none;
    border-top: 1px solid var(--pos-border);
    max-height: none;
  }

  #panel-venta {
    overflow-y: auto;
    height: auto;
  }

  #panel-venta .product-grid {
    max-height: none;
  }
}

@media (max-width: 768px) {
  .app-shell {
    grid-template-columns: 1fr;
  }

  .nex-sidebar {
    flex-direction: row;
    height: auto;
    position: relative;
    padding: 0.5rem;
    overflow-x: auto;
  }

  .nex-sidebar-nav {
    flex-direction: row;
    flex: 1;
  }

  .nex-sidebar-exit {
    margin-top: 0;
    padding: 0;
  }

  .nex-nav-item {
    width: 48px;
    height: 48px;
  }

  .nex-header-badges,
  .nex-shortcuts {
    display: none;
  }

  .nex-header {
    padding: 0.5rem 0.85rem;
  }

  .panel:not(#panel-venta) {
    padding: 0.85rem;
  }

  #panel-venta .product-grid {
    grid-template-columns: repeat(auto-fill, minmax(160px, 1fr));
    gap: 0.75rem;
    padding: 0 0.85rem 0.85rem;
  }
}
