/* Theme tokens (classic + beta). */
:root {
  --bg: #f5f5f5;
  --text: #111;
  --muted: #64748b;
  --header-bg: #111;
  --header-text: #fff;
  --surface: #ffffff;
  --surface-alt: #f8fafc;
  --surface-row: #f9fafb;
  --surface-hover: #eef2ff;
  --border: #ddd;
  --border-soft: #e5e7eb;
  --btn-bg: #f3f4f6;
  --btn-border: #d1d5db;
  --btn-text: #111;
  --input-bg: #fff;
  --input-border: #d1d5db;
  --focus-ring: rgba(96,165,250,0.25);
  --modal-bg: #fff;
  --notif-new-bg: #eff6ff;
  --notif-new-border: #93c5fd;
  --accent: #2563eb;
  --accent-strong: #1f6fff;
  --accent-contrast: #fff;
  --danger: #ef4444;
  --danger-contrast: #fff;
  --success: #16a34a;
  --success-contrast: #fff;
  --success-bg: #dcfce7;
  --success-text: #166534;
  --warn-bg: #fef3c7;
  --warn-text: #92400e;
  --danger-bg: #fee2e2;
  --danger-text: #991b1b;
  --info-bg: #e0f2fe;
  --info-text: #0f172a;
  --shadow-1: rgba(0,0,0,0.06);
  --shadow-2: rgba(0,0,0,0.12);
  --shadow-3: rgba(0,0,0,0.2);

  --pos-bg: #eceff3;
  --pos-panel: #f7f8fb;
  --pos-panel-strong: #ffffff;
  --pos-panel-alt: #f4f6fb;
  --pos-panel-hover: #e9ecf7;
  --pos-border: #dcdfe6;
  --pos-border-soft: #e5e7eb;
  --pos-muted: #64748b;
  --pos-ink: #111827;
  --pos-ink-hover: #1f2937;
  --pos-accent: #1f6fff;
  --pos-accent-strong: #1f6fff;
  --pos-accent-contrast: #fff;
  --pos-danger-bg: #ffebeb;
  --pos-danger: #c0392b;
  --pos-success-bg: #ecfdf3;
  --pos-success: #166534;
  --pos-warn-bg: #fef3c7;
  --pos-warn: #92400e;
  --pos-scan-bg: #0f172a;
  --pos-scan-ring: rgba(255,255,255,0.9);
  --pos-scan-mask: rgba(0,0,0,0.25);
  --pos-scan-toast: rgba(16, 185, 129, 0.95);

  --client-bg: #050505;
  --client-text: #fff;
  --client-muted: #a1a1aa;
  --client-border: #222;
  --client-border-strong: #111;
  --client-total: #22c55e;
  --client-change: #eab308;

  --login-bg: #111;
  --login-card: #1e1e1e;
  --login-text: #fff;
  --login-border: #2a2a2a;
  --login-btn-bg: #fff;
  --login-btn-text: #111;
  --login-overlay: #0b0b0b;

  --paper-bg: #fff;
  --paper-text: #111;
  --paper-muted: #444;
  --paper-border: #aaa;
  --paper-soft: #bbb;
  --paper-accent: #333;
  --paper-surface: #f6f7fb;
}

html[data-theme="beta"] {
  --bg: #f6f3ee;
  --text: #1e1a15;
  --muted: #6a6056;
  --header-bg: #1a2622;
  --header-text: #fefbf7;
  --surface: #fffcf8;
  --surface-alt: #f7f1e8;
  --surface-row: #f2ece2;
  --surface-hover: #e8f0ea;
  --border: #d6cfc5;
  --border-soft: #e6ded3;
  --btn-bg: #f2ebe1;
  --btn-border: #d6cfc5;
  --btn-text: #1e1a15;
  --input-bg: #fffcf8;
  --input-border: #d6cfc5;
  --focus-ring: rgba(15, 118, 110, 0.25);
  --modal-bg: #fffaf5;
  --notif-new-bg: #e8f3ef;
  --notif-new-border: #7fbfb0;
  --accent: #0f766e;
  --accent-strong: #0b5f59;
  --accent-contrast: #fff;
  --danger: #b91c1c;
  --danger-contrast: #fff;
  --success: #15803d;
  --success-contrast: #fff;
  --success-bg: #dcf6e5;
  --success-text: #14532d;
  --warn-bg: #fff1d6;
  --warn-text: #92400e;
  --danger-bg: #fde8e8;
  --danger-text: #7f1d1d;
  --info-bg: #e0f2f1;
  --info-text: #0f172a;
  --shadow-1: rgba(24, 16, 8, 0.08);
  --shadow-2: rgba(24, 16, 8, 0.16);
  --shadow-3: rgba(24, 16, 8, 0.28);

  --pos-bg: #f3eee7;
  --pos-panel: #fcf8f2;
  --pos-panel-strong: #fffdf9;
  --pos-panel-alt: #f4ede3;
  --pos-panel-hover: #e9e2d8;
  --pos-border: #d6cfc5;
  --pos-border-soft: #e6ded3;
  --pos-muted: #6a6056;
  --pos-ink: #1a221f;
  --pos-ink-hover: #242f2b;
  --pos-accent: #0f766e;
  --pos-accent-strong: #0b5f59;
  --pos-accent-contrast: #fff;
  --pos-danger-bg: #f9e2e0;
  --pos-danger: #b42318;
  --pos-success-bg: #e3f2e8;
  --pos-success: #166534;
  --pos-warn-bg: #fff1d6;
  --pos-warn: #92400e;
  --pos-scan-bg: #13201e;
  --pos-scan-ring: rgba(255,255,255,0.85);
  --pos-scan-mask: rgba(0,0,0,0.3);
  --pos-scan-toast: rgba(16, 185, 129, 0.95);

  --client-bg: #0c1412;
  --client-text: #f8faf4;
  --client-muted: #9ea6a0;
  --client-border: #1f2a28;
  --client-border-strong: #16201f;
  --client-total: #34d399;
  --client-change: #f59e0b;

  --login-bg: #121917;
  --login-card: #1a2421;
  --login-text: #fefcf8;
  --login-border: #2a3430;
  --login-btn-bg: #fefcf8;
  --login-btn-text: #1a2421;
  --login-overlay: #0d1412;

  --paper-bg: #fffdf8;
  --paper-text: #1e1a15;
  --paper-muted: #5b534a;
  --paper-border: #b9b2a8;
  --paper-soft: #c9c1b7;
  --paper-accent: #4d463e;
  --paper-surface: #f3eee6;
}

/* Beta layout tweaks (theme-scoped). */
html[data-theme="beta"] body {
  background: radial-gradient(1200px 800px at 20% -10%, #fff8ef 0%, #f6f2ea 45%, #f1ede6 100%);
}

html[data-theme="beta"] header {
  box-shadow: 0 8px 20px var(--shadow-1);
}

html[data-theme="beta"] .card {
  border-radius: 14px;
  border-color: var(--border-soft);
  box-shadow: 0 10px 24px var(--shadow-1);
}

html[data-theme="beta"] body:not(.caja-no-scroll) main input,
html[data-theme="beta"] body:not(.caja-no-scroll) main select,
html[data-theme="beta"] body:not(.caja-no-scroll) main textarea {
  border-radius: 12px;
}

html[data-theme="beta"] body:not(.caja-no-scroll) main button {
  border-radius: 12px;
  box-shadow: 0 6px 14px var(--shadow-1);
}

html[data-theme="experimental"] {
  --bg: #0f1b1d;
  --text: #f8faf7;
  --muted: #a6b0aa;
  --header-bg: #0b1416;
  --header-text: #f8faf7;
  --surface: #142124;
  --surface-alt: #182a2d;
  --surface-row: #1a2f33;
  --surface-hover: #1f3a36;
  --border: #2a3a3b;
  --border-soft: #1f2e30;
  --btn-bg: #1b2b2e;
  --btn-border: #2a3a3b;
  --btn-text: #f8faf7;
  --input-bg: #121f21;
  --input-border: #2a3a3b;
  --focus-ring: rgba(69, 206, 187, 0.25);
  --modal-bg: #142124;
  --notif-new-bg: #193032;
  --notif-new-border: #2d6b68;
  --accent: #45cebb;
  --accent-strong: #2fb3a2;
  --accent-contrast: #0a1213;
  --danger: #ef4444;
  --danger-contrast: #fff;
  --success: #22c55e;
  --success-contrast: #0b1416;
  --success-bg: #1b3a2a;
  --success-text: #c7f7d4;
  --warn-bg: #3b2f1a;
  --warn-text: #fcd34d;
  --danger-bg: #3b1f1f;
  --danger-text: #fecaca;
  --info-bg: #113439;
  --info-text: #d1f7f4;
  --shadow-1: rgba(0,0,0,0.25);
  --shadow-2: rgba(0,0,0,0.35);
  --shadow-3: rgba(0,0,0,0.5);

  --pos-bg: #0f1b1d;
  --pos-panel: #152527;
  --pos-panel-strong: #182b2e;
  --pos-panel-alt: #1a2f32;
  --pos-panel-hover: #203b3a;
  --pos-border: #2a3a3b;
  --pos-border-soft: #1f2e30;
  --pos-muted: #a6b0aa;
  --pos-ink: #0b1416;
  --pos-ink-hover: #0f1b1d;
  --pos-accent: #45cebb;
  --pos-accent-strong: #2fb3a2;
  --pos-accent-contrast: #0a1213;
  --pos-danger-bg: #3b1f1f;
  --pos-danger: #fecaca;
  --pos-success-bg: #1b3a2a;
  --pos-success: #c7f7d4;
  --pos-warn-bg: #3b2f1a;
  --pos-warn: #fcd34d;
  --pos-scan-bg: #0a1213;
  --pos-scan-ring: rgba(255,255,255,0.85);
  --pos-scan-mask: rgba(0,0,0,0.45);
  --pos-scan-toast: rgba(34, 197, 94, 0.9);

  --client-bg: #0b1416;
  --client-text: #f8faf7;
  --client-muted: #98a6a1;
  --client-border: #1f2e30;
  --client-border-strong: #162326;
  --client-total: #34d399;
  --client-change: #f59e0b;

  --login-bg: #0b1416;
  --login-card: #111e20;
  --login-text: #f8faf7;
  --login-border: #203033;
  --login-btn-bg: #45cebb;
  --login-btn-text: #0a1213;
  --login-overlay: #090f10;

  --paper-bg: #0d1516;
  --paper-text: #f3f4f6;
  --paper-muted: #a1a1aa;
  --paper-border: #2a3a3b;
  --paper-soft: #2f4244;
  --paper-accent: #cbd5e1;
  --paper-surface: #0b1416;
}

/* Experimental layout tweaks (theme-scoped). */
html[data-theme="experimental"] body {
  font-size: 15px;
  background: linear-gradient(180deg, #0f1b1d 0%, #0b1416 100%);
}

html[data-theme="experimental"] header {
  padding: 16px 18px;
}

html[data-theme="experimental"] .layout {
  height: calc(100vh - 64px);
}

html[data-theme="experimental"] main {
  padding: 20px;
}

html[data-theme="experimental"] .card {
  padding: 16px;
  border-radius: 14px;
  box-shadow: 0 14px 30px var(--shadow-2);
}

html[data-theme="experimental"] aside {
  width: 240px;
}

html[data-theme="experimental"] body.sidebar-collapsed aside {
  width: 64px;
}

html[data-theme="experimental"] aside a {
  padding: 12px 10px;
}

html[data-theme="experimental"] table th,
html[data-theme="experimental"] table td {
  padding: 10px;
}

html[data-theme="experimental"] .cmdk-panel {
  width: 680px;
}

html[data-theme="experimental"] .cmd-modal-content {
  width: 760px;
}

html[data-theme="experimental"] .caja-container {
  grid-template-columns: 1fr 440px;
  gap: 20px;
  padding: 20px;
}

html[data-theme="experimental"] #productsGrid {
  --product-row: 80px;
  grid-template-columns: repeat(auto-fill, minmax(160px, 1fr));
  gap: 14px;
  padding: 12px;
}

html[data-theme="experimental"] .product-card {
  padding: 12px;
  border-radius: 14px;
  font-size: 15px;
}

html[data-theme="experimental"] .cart-item {
  gap: 8px;
  padding: 10px 12px;
  border-radius: 14px;
}

html[data-theme="experimental"] .big-total {
  font-size: 32px;
  padding: 14px 16px;
}

html[data-theme="experimental"] #payBtn {
  font-size: 21px;
  padding: 16px;
}

html[data-theme="experimental"] .caja-left,
html[data-theme="experimental"] .caja-right {
  border: 1px solid var(--pos-border-soft);
  box-shadow: 0 16px 30px var(--shadow-1);
}

html[data-theme="experimental"] .caja-left h2,
html[data-theme="experimental"] .caja-right h2 {
  font-size: 22px;
  letter-spacing: 0.2px;
}

html[data-theme="experimental"] #buscadorProductos {
  padding: 14px 44px 14px 40px;
  font-size: 17px;
  border-radius: 16px;
}

html[data-theme="experimental"] .search-icon {
  font-size: 16px;
}

html[data-theme="experimental"] .search-scope {
  gap: 10px;
}

html[data-theme="experimental"] .scope-btn {
  padding: 9px 14px;
  font-size: 14px;
}

html[data-theme="experimental"] .scan-btn {
  padding: 10px 14px;
  font-size: 15px;
  border-radius: 12px;
}

html[data-theme="experimental"] #cartActionsToggle {
  display: none;
}

html[data-theme="experimental"] .cart-actions-panel {
  position: static;
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  padding: 12px;
  border-radius: 14px;
  background: var(--surface);
  border: 1px solid var(--pos-border-soft);
  box-shadow: none;
}

html[data-theme="experimental"] .cart-actions-panel[hidden] {
  display: flex;
}

html[data-theme="experimental"] .pos-action,
html[data-theme="experimental"] .pos-action-group button {
  padding: 12px 14px;
  border-radius: 14px;
}

html[data-theme="experimental"] .pos-action-group select {
  height: 42px;
  border-radius: 14px;
}

html[data-theme="experimental"] .qty-btn,
html[data-theme="experimental"] .remove-btn {
  padding: 8px 12px;
  border-radius: 12px;
}

html[data-theme="experimental"] .product-card,
html[data-theme="experimental"] .cart-item,
html[data-theme="experimental"] .pos-action,
html[data-theme="experimental"] .scope-btn,
html[data-theme="experimental"] .qty-btn,
html[data-theme="experimental"] .remove-btn {
  transition: transform 0.12s ease, box-shadow 0.12s ease, background 0.12s ease;
}

html[data-theme="experimental"] .product-card:hover,
html[data-theme="experimental"] .cart-item:hover,
html[data-theme="experimental"] .pos-action:hover,
html[data-theme="experimental"] .scope-btn:hover {
  transform: translateY(-1px);
  box-shadow: 0 8px 20px var(--shadow-1);
}

html[data-theme="experimental"] .cart-row {
  background: var(--surface);
  border: 1px solid var(--pos-border-soft);
  border-radius: 14px;
  padding: 10px 12px;
  margin-bottom: 10px;
  align-items: center;
  gap: 10px;
}

html[data-theme="experimental"] .cart-name {
  font-size: 15px;
}

html[data-theme="experimental"] .cart-qty-line {
  font-size: 13px;
}

html[data-theme="experimental"] .cart-discount input {
  width: 64px;
  padding: 6px 8px;
  border-radius: 10px;
}

html[data-theme="experimental"] .actions-block {
  gap: 10px;
}

html[data-theme="experimental"] .actions-block #payBtn,
html[data-theme="experimental"] .actions-block #cancelBtn {
  width: 100%;
}

html[data-theme="experimental"] .caja-mobile-toggle {
  padding: 8px 12px calc(8px + env(safe-area-inset-bottom, 0px));
  box-shadow: 0 -10px 24px var(--shadow-2);
}

@media (max-width: 900px) {
  html[data-theme="experimental"] .caja-container {
    padding: 12px;
    padding-bottom: 76px;
  }
}

@media (max-width: 720px) {
  html[data-theme="experimental"] .cart-row {
    display: grid;
    grid-template-columns: 1fr auto;
    row-gap: 8px;
  }

  html[data-theme="experimental"] .cart-qty,
  html[data-theme="experimental"] .cart-discount {
    justify-self: start;
  }

  html[data-theme="experimental"] .cart-remove {
    justify-self: end;
  }
}

.theme-toggle {
  border: 1px solid var(--border-soft);
  background: var(--surface);
  color: var(--text);
  border-radius: 999px;
  padding: 6px 12px;
  font-size: 12px;
  cursor: pointer;
}

.theme-toggle:hover {
  background: var(--surface-hover);
}

/* Mobile-exclusive theme overrides. */
html[data-mobile="1"] {
  --bg: #f8fafc;
  --surface: #ffffff;
  --surface-alt: #f1f5f9;
  --surface-row: #f8fafc;
  --surface-hover: #e2e8f0;
  --border: #e2e8f0;
  --border-soft: #e5e7eb;
  --accent: #0ea5e9;
  --accent-strong: #0284c7;
  --accent-contrast: #ffffff;
  --focus-ring: rgba(14, 165, 233, 0.28);
  --shadow-1: rgba(15, 23, 42, 0.08);
  --shadow-2: rgba(15, 23, 42, 0.16);
}

html[data-mobile="1"] body.app-shell {
  font-size: 15px;
  background: linear-gradient(180deg, #f8fafc 0%, #eef2f6 100%);
}

html[data-mobile="1"] body.app-shell .card {
  border-radius: 14px;
  box-shadow: 0 10px 22px var(--shadow-1);
}
