/* Capa visual premium. No cambia cálculos, sesiones ni consultas. */
:root {
  --saas-night: #0a0f1f;
  --saas-panel: #121a2b;
  --saas-line: rgba(34, 211, 238, 0.18);
  --saas-text: #e8eef8;
  --saas-muted: #93a4bd;
  --saas-violet: #8b5cf6;
  --saas-blue: #4f46e5;
  --saas-cyan: #22d3ee;
}

html[data-theme="dark"] body,
html:not([data-theme="light"]) body {
  background: var(--saas-night) !important;
  color: var(--saas-text) !important;
  font-family: "Segoe UI", system-ui, sans-serif !important;
}

aside.lp-sidebar {
  background:
    radial-gradient(120% 40% at 0% 100%, rgba(34, 211, 238, 0.16), transparent 42%),
    linear-gradient(180deg, #0b1224 0%, #0a1020 100%) !important;
  border-right: 1px solid rgba(34, 211, 238, 0.16) !important;
  box-shadow: 8px 0 30px rgba(0, 0, 0, 0.18);
}
.lp-brand-icon {
  background: linear-gradient(135deg, #22d3ee, #4f46e5) !important;
  box-shadow: 0 0 18px rgba(34, 211, 238, 0.45);
}
.lp-nav a {
  border: 1px solid transparent;
  transition: background 0.18s ease, border-color 0.18s ease, transform 0.18s ease;
}
.lp-nav a.active {
  background: linear-gradient(90deg, #2563eb, #22d3ee) !important;
  color: #fff !important;
  box-shadow: 0 10px 24px rgba(37, 99, 235, 0.35);
}
.lp-nav a:hover:not(.active):not(.lp-bloqueado) {
  background: rgba(34, 211, 238, 0.08) !important;
  border-color: rgba(34, 211, 238, 0.2);
}
.lp-nav .lp-nav-label { color: #7dd3fc !important; }

.header, .topbar, .page-header, .lp-page-head {
  background: rgba(10, 15, 31, 0.92) !important;
  border: 1px solid var(--saas-line) !important;
  border-radius: 18px !important;
  margin: 14px 16px 0 !important;
  min-height: 74px;
  backdrop-filter: blur(10px);
}
.header h1, .topbar h1, .page-header h1 { letter-spacing: -0.03em; }
.lp-titleblock { display: flex; align-items: center; gap: 12px; min-width: 0; }
.lp-title-ico {
  width: 42px; height: 42px; display: grid; place-items: center;
  border-radius: 12px; background: linear-gradient(135deg, #1d4ed8, #22d3ee); font-size: 20px;
}
.lp-header-tools { display: flex; align-items: center; gap: 8px; }
.lp-icon-btn, .lp-scan {
  width: 40px; height: 40px; border-radius: 12px; border: 1px solid var(--saas-line);
  background: #10182b; color: var(--saas-text); cursor: pointer;
}
.lp-cajon-btn {
  height: 40px; padding: 0 12px; border-radius: 12px; border: 1px solid var(--saas-line);
  background: #10182b; color: var(--saas-text); cursor: pointer; font: inherit; font-size: 13px;
  white-space: nowrap;
}
.lp-cajon-btn:disabled { opacity: 0.55; cursor: wait; }
.lp-cajon-aviso { max-width: 220px; font-size: 12px; line-height: 1.3; }
.lp-icon-btn[aria-pressed="true"] { background: #2563eb; border-color: #22d3ee; }

.app-shell .workspace { min-width: 0; }
.app-shell .main-content {
  align-items: start;
}
@media (min-width: 901px) {
  .app-shell .main-content { grid-template-columns: minmax(0, 1fr) 390px !important; }
  body:has(#lpCartMax:checked) .app-shell .main-content { grid-template-columns: minmax(0, 1fr) minmax(460px, 46vw) !important; }
}

.search-bar, .lp-cats, .cart, .product-card, .card, .stat-card, .summary-card, .lp-panel, .login-card {
  background: linear-gradient(180deg, rgba(18, 26, 43, 0.96), rgba(12, 18, 32, 0.96)) !important;
  border: 1px solid var(--saas-line) !important;
  border-radius: 16px !important;
  box-shadow: 0 10px 30px rgba(0, 0, 0, 0.18);
}
.search-bar { padding: 10px 12px !important; }
.search-bar input, input, select, textarea {
  color: var(--saas-text);
}
.search-bar input { font-size: 14px !important; }
.lp-cats {
  display: flex; gap: 8px; overflow-x: auto; padding: 8px !important;
  box-shadow: none !important;
}
.lp-cat {
  border: 1px solid transparent; background: #10182b; color: var(--saas-muted);
  border-radius: 999px; padding: 8px 12px; white-space: nowrap; cursor: pointer;
}
.lp-cat.is-active { background: linear-gradient(90deg, #2563eb, #22d3ee); color: #fff; }

.products-grid { grid-template-columns: repeat(auto-fill, minmax(190px, 1fr)) !important; }
.product-card { padding: 12px !important; display: flex; flex-direction: column; gap: 8px; min-width: 0; }
.product-card:hover { border-color: #22d3ee !important; transform: translateY(-3px); }
.product-image { height: 148px !important; background: radial-gradient(circle at 50% 40%, #1e293b, #0b1220) !important; }
.product-name { min-height: 0 !important; font-weight: 700 !important; }
.product-category, .product-stock { color: var(--saas-muted) !important; font-size: 12px !important; }
.product-price { color: #67e8f9 !important; font-size: 22px !important; }
.lp-add {
  margin-top: auto; text-align: center; border-radius: 999px; padding: 8px 10px;
  background: linear-gradient(90deg, #1d4ed8, #2563eb); color: #fff; font-weight: 700;
}

.cart { padding: 12px !important; }
.cart-header, .cart-title { color: #fff; }
.cart-count {
  min-width: 26px; height: 26px; border-radius: 999px; display: inline-grid; place-items: center;
  background: #2563eb; color: #fff; font-weight: 800;
}
.lp-cart-sizes label {
  border-radius: 999px !important; padding: 7px 12px !important; border: 1px solid var(--saas-line);
}
.cart-item { border-bottom: 1px solid rgba(148, 163, 184, 0.15); padding: 10px 0; }
.total-row.final {
  margin-top: 8px; padding: 12px 14px; border-radius: 14px;
  background: linear-gradient(90deg, #0284c7, #22d3ee); color: #fff;
}
.total-row.final .amount { color: #fff !important; font-size: 22px; }
.payment-methods { display: grid !important; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 8px; }
.payment-method {
  border-radius: 14px !important; border: 1px solid var(--saas-line) !important;
  background: #10182b !important; min-height: 64px;
}
.payment-method.active { border-color: #22d3ee !important; box-shadow: 0 0 0 1px #22d3ee inset; }
.cash-input, #cashInput {
  width: 100%; border-radius: 12px; border: 1px solid var(--saas-line);
  background: #0b1220; color: #fff; padding: 12px 14px; font-size: 18px;
}
.btn-checkout, .login-btn, .btn-submit, .btn-primary {
  border: 0 !important; border-radius: 14px !important; min-height: 48px;
  background: linear-gradient(90deg, #2563eb, #22d3ee) !important; color: #fff !important;
  font-weight: 800 !important;
}
.lp-statusbar {
  display: flex; flex-wrap: wrap; gap: 14px 22px; align-items: center;
  margin: 8px 16px 16px; padding: 10px 16px; border-radius: 16px;
  border: 1px solid var(--saas-line); color: var(--saas-muted); background: #0c1426;
}
.lp-statusbar i { width: 8px; height: 8px; border-radius: 50%; display: inline-block; background: #22c55e; margin-right: 6px; }
.lp-statusbar strong { color: #fff; }

table { width: 100%; border-collapse: collapse; }
th { color: var(--saas-muted); font-size: 12px; letter-spacing: 0.04em; text-align: left; }
th, td { padding: 10px 12px; border-bottom: 1px solid rgba(148, 163, 184, 0.16); }
input, select, textarea {
  border-radius: 12px; border: 1px solid var(--saas-line); background: #0b1220;
}
.login-card { max-width: 420px; margin: 8vh auto; padding: 28px; }

html[data-theme="light"] body { background: #f8fafc !important; color: #0f172a !important; }
html[data-theme="light"] aside.lp-sidebar { background: #fff !important; color: #0f172a !important; }
html[data-theme="light"] .lp-nav a { color: #0f172a !important; }
html[data-theme="light"] .header,
html[data-theme="light"] .topbar,
html[data-theme="light"] .search-bar,
html[data-theme="light"] .cart,
html[data-theme="light"] .product-card,
html[data-theme="light"] .card,
html[data-theme="light"] .lp-panel,
html[data-theme="light"] .login-card,
html[data-theme="light"] .lp-statusbar {
  background: #fff !important; color: #0f172a !important; border-color: #e2e8f0 !important;
}
html[data-theme="light"] .product-name,
html[data-theme="light"] .cart-title,
html[data-theme="light"] .lp-statusbar strong { color: #0f172a !important; }
html[data-theme="light"] input,
html[data-theme="light"] select,
html[data-theme="light"] textarea,
html[data-theme="light"] #cashInput { background: #fff !important; color: #0f172a !important; }

@media (max-width: 900px) {
  .header, .topbar { margin: 58px 10px 0 !important; }
  .payment-methods { grid-template-columns: repeat(2, minmax(0, 1fr)) !important; }
  .lp-statusbar { margin: 8px 10px 16px; }
}

/* Ajuste a la referencia del punto de venta. Solo presentación. */
aside.lp-sidebar { overflow: hidden; }
aside.lp-sidebar::after {
  content: "";
  position: absolute;
  left: -30%;
  right: -20%;
  bottom: -70px;
  height: 160px;
  background: radial-gradient(closest-side, rgba(34, 211, 238, 0.28), transparent 72%);
  pointer-events: none;
  z-index: 0;
}
.lp-brand, .lp-nav, .lp-nav-label { position: relative; z-index: 1; }
.lp-brand strong { letter-spacing: 0.08em; }
.lp-brand small { color: #67e8f9 !important; letter-spacing: 0.14em; }
.lp-nav .lp-nav-label::after { content: " 👑"; font-size: 11px; }
.lp-nav a { position: relative; }
.lp-nav a.active { border-radius: 12px !important; }
.lp-candado { opacity: 0.9; }

.app-shell .workspace { background: transparent !important; }
.app-shell .header {
  margin: 12px 16px 0 !important;
  padding: 12px 16px !important;
  min-height: 68px;
  box-shadow: none;
}
.app-shell .header h1 { font-size: 26px !important; font-weight: 750; }
.app-shell .header p { color: #93a4bd !important; margin-top: 2px; }
.app-shell .main-content { padding: 14px 16px 8px !important; gap: 14px !important; }
.app-shell .search-bar { border-radius: 16px !important; min-height: 52px; }
.app-shell .lp-scan {
  width: 42px; height: 42px; border-radius: 12px;
  background: #123; color: #67e8f9; font-size: 18px;
}
.app-shell .lp-cats { background: transparent !important; border: 0 !important; box-shadow: none !important; padding: 0 !important; }
.app-shell .lp-cat { background: #121a2f; border: 1px solid rgba(34, 211, 238, 0.16); }
.app-shell .products-grid { gap: 12px !important; }
.app-shell .product-card {
  border-radius: 18px !important;
  padding: 14px !important;
  gap: 6px;
}
.app-shell .product-card:hover {
  border-color: #22d3ee !important;
  box-shadow: 0 0 0 1px #22d3ee, 0 0 28px rgba(34, 211, 238, 0.28) !important;
}
.app-shell .product-image { height: 132px !important; border-radius: 14px; margin-bottom: 4px; }
.app-shell .product-price { margin: 2px 0 !important; }
.app-shell .lp-add { border-radius: 12px; padding: 9px 12px; box-shadow: 0 8px 18px rgba(37, 99, 235, 0.35); }

.app-shell .right-panel { height: auto !important; top: 12px; }
.app-shell .cart { border-radius: 18px !important; padding: 10px !important; }
.app-shell .cart-header { border-bottom: 0; padding: 6px 6px 10px; }
.app-shell .cart-item {
  background: rgba(8, 14, 28, 0.55) !important;
  border: 1px solid rgba(34, 211, 238, 0.12) !important;
  border-radius: 14px !important;
}
.app-shell .cart-item-total { color: #67e8f9 !important; font-weight: 800; }
.app-shell .qty-btn { color: #e2e8f0 !important; min-width: 22px; }
.app-shell .total-row.final { border-radius: 12px; background: linear-gradient(90deg, #0284c7, #22d3ee) !important; }
.app-shell .payment-method { color: #e2e8f0; text-align: center; }
.app-shell .payment-method .icon { font-size: 18px; }
.app-shell .change-display {
  margin-top: 8px; border-radius: 12px; padding: 10px 12px; text-align: center; font-weight: 800;
}
.app-shell .btn-checkout { width: 100%; font-size: 16px; letter-spacing: 0.01em; }
.app-shell .lp-statusbar { margin-top: 0; }

html[data-theme="light"] .app-shell .product-card,
html[data-theme="light"] .app-shell .cart,
html[data-theme="light"] .app-shell .search-bar,
html[data-theme="light"] .app-shell .header,
html[data-theme="light"] .app-shell .lp-statusbar,
html[data-theme="light"] aside.lp-sidebar {
  background: #fff !important;
  color: #0f172a !important;
  border-color: #e2e8f0 !important;
}
html[data-theme="light"] .app-shell .lp-cat,
html[data-theme="light"] .app-shell .cart-item,
html[data-theme="light"] .payment-method,
html[data-theme="light"] #cashInput {
  background: #f8fafc !important;
  color: #0f172a !important;
}
html[data-theme="light"] .lp-nav a.lp-bloqueado { opacity: 0.55 !important; }

.app-shell .lp-topbar {
  display: flex !important;
  align-items: center !important;
  gap: 14px !important;
  justify-content: space-between !important;
}
.lp-global-search {
  flex: 1;
  max-width: 420px;
  display: flex;
  align-items: center;
  gap: 8px;
  height: 42px;
  padding: 0 14px;
  border-radius: 999px;
  border: 1px solid rgba(34, 211, 238, 0.28);
  background: rgba(8, 14, 28, 0.72);
  color: #93a4bd;
}
.lp-global-search input {
  flex: 1;
  border: 0 !important;
  background: transparent !important;
  color: #e8eef8 !important;
  outline: none;
  font-size: 13px;
}
.lp-theme-switch {
  display: flex;
  padding: 3px;
  border-radius: 999px;
  border: 1px solid rgba(34, 211, 238, 0.28);
  background: #10182b;
}
.lp-theme-switch .lp-icon-btn { width: 34px; height: 34px; border: 0; background: transparent; }
.lp-userchip {
  display: flex;
  align-items: center;
  gap: 8px;
  min-width: 0;
}
.lp-userchip strong, .lp-userchip small { display: block; line-height: 1.15; }
.lp-userchip small { color: #93a4bd; font-size: 11px; }
.lp-avatar {
  width: 36px; height: 36px; border-radius: 50%;
  display: grid; place-items: center;
  background: #172033; border: 1px solid rgba(34, 211, 238, 0.3);
}
.app-shell .product-card { position: relative; }
.lp-fav {
  position: absolute; top: 12px; right: 12px; z-index: 2;
  width: 28px; height: 28px; border: 0; border-radius: 50%;
  background: rgba(8, 14, 28, 0.55); color: #cbd5e1; cursor: pointer;
}
.lp-fav.is-on { color: #fb7185; }
.app-shell .cart-title::before { content: "🛒 "; }
html[data-theme="light"] .lp-global-search,
html[data-theme="light"] .lp-theme-switch,
html[data-theme="light"] .lp-avatar {
  background: #fff !important;
  color: #0f172a !important;
  border-color: #cbd5e1 !important;
}
html[data-theme="light"] .lp-global-search input { color: #0f172a !important; }
@media (max-width: 900px) {
  .app-shell .lp-topbar { flex-wrap: wrap !important; }
  .lp-global-search { order: 3; max-width: none; width: 100%; }
  .lp-userchip small { display: none; }
}

/* El punto de venta cabe en la pantalla: la barra de estado no tapa el carrito. */
body:has(.app-shell) { overflow: hidden !important; }
.app-shell:has(> aside.lp-sidebar) {
  display: block !important;
  margin-left: 270px !important;
  width: calc(100vw - 270px) !important;
  height: 100vh !important;
  min-height: 0 !important;
  overflow: hidden !important;
}
.app-shell > .workspace {
  display: flex !important;
  flex-direction: column !important;
  height: 100vh !important;
  max-height: 100vh !important;
  overflow: hidden !important;
}
.app-shell .header,
.app-shell .lp-topbar {
  flex: 0 0 auto !important;
  height: auto !important;
  min-height: 72px !important;
  margin: 10px 12px 0 !important;
}
.app-shell .main-content {
  flex: 1 1 auto !important;
  min-height: 0 !important;
  height: auto !important;
  max-width: none !important;
  margin: 0 !important;
  overflow: hidden !important;
  display: grid !important;
  grid-template-columns: minmax(0, 1fr) 400px !important;
  align-items: stretch !important;
  padding: 12px !important;
  gap: 12px !important;
}
.app-shell .left-panel {
  min-width: 0 !important;
  min-height: 0 !important;
  height: 100% !important;
  overflow: auto !important;
  display: flex !important;
  flex-direction: column !important;
  gap: 10px !important;
}
.app-shell .products-grid {
  grid-template-columns: repeat(4, minmax(0, 1fr)) !important;
  align-content: start;
}
.app-shell .right-panel {
  height: 100% !important;
  min-height: 0 !important;
  max-height: 100% !important;
  overflow: hidden !important;
  position: relative !important;
  top: auto !important;
}
.app-shell .cart {
  height: 100% !important;
  min-height: 0 !important;
  display: flex !important;
  flex-direction: column !important;
  overflow: hidden !important;
}
.app-shell .cart-header { flex: 0 0 auto !important; }
.app-shell .cart-items {
  flex: 1 1 auto !important;
  min-height: 0 !important;
  overflow: auto !important;
}
.app-shell .cart-footer {
  flex: 0 0 auto !important;
  overflow: visible !important;
}
.app-shell .cart-item { padding: 8px !important; margin-bottom: 8px !important; }
.app-shell .lp-statusbar {
  position: relative !important;
  flex: 0 0 auto !important;
  z-index: 3;
  margin: 0 12px 10px !important;
}
@media (max-width: 1200px) {
  .app-shell .products-grid { grid-template-columns: repeat(3, minmax(0, 1fr)) !important; }
  .app-shell .main-content { grid-template-columns: minmax(0, 1fr) 340px !important; }
}
@media (max-width: 900px) {
  .app-shell:has(> aside.lp-sidebar) {
    margin-left: 0 !important;
    width: 100% !important;
    height: auto !important;
    overflow: visible !important;
  }
  body:has(.app-shell) { overflow: auto !important; }
  .app-shell > .workspace { height: auto !important; max-height: none !important; overflow: visible !important; }
  .app-shell .main-content {
    display: flex !important;
    flex-direction: column !important;
    overflow: visible !important;
    height: auto !important;
  }
  .app-shell .left-panel,
  .app-shell .right-panel,
  .app-shell .cart { height: auto !important; max-height: none !important; overflow: visible !important; }
  .app-shell .products-grid { grid-template-columns: repeat(2, minmax(0, 1fr)) !important; }
}
@media (max-width: 520px) {
  .app-shell .products-grid { grid-template-columns: 1fr !important; }
}
body:has(#lpCartMax:checked) .app-shell .main-content {
  grid-template-columns: minmax(0, 1fr) minmax(460px, 46vw) !important;
}
