/* Tema: color y luminosidad son dos preferencias independientes. */
body {
  --focus: #6d5595;
  --button-ink: #27323c;
}

/* Cada color cambia la atmósfera completa: fondo, tarjetas, líneas y acento. */
body.theme-default {
  --bg: #f2effb; --panel: #fff; --ink: #302842; --muted: #756e83; --line: #ded7ed; --sand: #ebe6f6;
  --accent: #8068b0; --accent-strong: #5d478d; --accent-pale: #e8e0f7; --ring: #b7a8d7;
  --pink: #d986a6; --pink-pale: #f9e8ee; --sage: #78a98f; --sage-pale: #e6f3eb;
  --theme-sidebar: linear-gradient(180deg, #fbfaff 0%, #eee8fa 100%);
  --theme-glow: rgba(152, 126, 204, .16);
}
body.theme-pink {
  --bg: #fff0f5; --panel: #fffafd; --ink: #48283b; --muted: #846674; --line: #f1cfdd; --sand: #fae3ec;
  --accent: #da6f9b; --accent-strong: #a63f6b; --accent-pale: #f9dce8; --ring: #ed9fba;
  --pink: #d95f8c; --pink-pale: #f9dce8; --sage: #73a894; --sage-pale: #e4f3ed;
  --theme-sidebar: linear-gradient(180deg, #fff9fc 0%, #f9dfeb 100%);
  --theme-glow: rgba(232, 113, 160, .18);
}
body.theme-sage {
  --bg: #eff8f3; --panel: #fbfffc; --ink: #25483a; --muted: #637b6f; --line: #cfe5d8; --sand: #e1f0e7;
  --accent: #5c9a79; --accent-strong: #2f7253; --accent-pale: #dcefe4; --ring: #91c2a7;
  --pink: #d7869d; --pink-pale: #f8e4ea; --sage: #5c9a79; --sage-pale: #dcefe4;
  --theme-sidebar: linear-gradient(180deg, #fbfffc 0%, #dff0e6 100%);
  --theme-glow: rgba(96, 168, 124, .18);
}
body.theme-ocean {
  --bg: #eef7ff; --panel: #fbfdff; --ink: #203f5b; --muted: #64798c; --line: #cee2f1; --sand: #e1eff9;
  --accent: #4b91c6; --accent-strong: #23699f; --accent-pale: #dcecf9; --ring: #8fc2e7;
  --pink: #d481a0; --pink-pale: #f9e5ec; --sage: #5c9f91; --sage-pale: #e1f2ed;
  --theme-sidebar: linear-gradient(180deg, #fbfdff 0%, #dceefa 100%);
  --theme-glow: rgba(75, 145, 198, .19);
}

body.theme-default, body.theme-pink, body.theme-sage, body.theme-ocean {
  --lilac: var(--ring);
  --lilac-pale: var(--accent-pale);
  background: radial-gradient(circle at 87% -12%, var(--theme-glow), transparent 30rem), var(--bg);
}
body.theme-default .sidebar, body.theme-pink .sidebar, body.theme-sage .sidebar, body.theme-ocean .sidebar {
  background: var(--theme-sidebar);
  border-right-color: var(--line);
}
body.theme-default .new-sale, body.theme-default .checkout,
body.theme-pink .new-sale, body.theme-pink .checkout,
body.theme-sage .new-sale, body.theme-sage .checkout,
body.theme-ocean .new-sale, body.theme-ocean .checkout {
  background: var(--accent-strong);
  color: #fff;
  box-shadow: 0 7px 18px color-mix(in srgb, var(--accent-strong) 24%, transparent);
}
body.theme-default .new-sale:hover, body.theme-default .checkout:hover,
body.theme-pink .new-sale:hover, body.theme-pink .checkout:hover,
body.theme-sage .new-sale:hover, body.theme-sage .checkout:hover,
body.theme-ocean .new-sale:hover, body.theme-ocean .checkout:hover { background: var(--accent); }

body.dark {
  --ink: #f6f3f8; --muted: #c1bbc7; --shadow: 0 16px 38px rgba(0, 0, 0, .25);
  --focus: #fff; --button-ink: #f6f3f8;
}
body.dark.theme-default {
  --bg: #211d31; --panel: #2a253d; --sand: #342e49; --line: #49415e; --accent: #a78bd8; --accent-strong: #c4a9ed; --accent-pale: #403653; --ring: #c9b8e9;
  --pink-pale: #4a3344; --sage-pale: #2e473d; --theme-sidebar: linear-gradient(180deg, #2e2844 0%, #211d31 100%); --theme-glow: rgba(181, 145, 235, .17);
}
body.dark.theme-pink {
  --bg: #371e2a; --panel: #432634; --sand: #513241; --line: #684354; --accent: #eb8fb4; --accent-strong: #ffb4ce; --accent-pale: #5a3343; --ring: #f5a8c4;
  --pink-pale: #5a3343; --sage-pale: #31473f; --theme-sidebar: linear-gradient(180deg, #4c2a3a 0%, #371e2a 100%); --theme-glow: rgba(246, 130, 177, .18);
}
body.dark.theme-sage {
  --bg: #182e27; --panel: #213b32; --sand: #2a4a3f; --line: #3f6254; --accent: #77bd95; --accent-strong: #a7e0bc; --accent-pale: #294d40; --ring: #a7d1ba;
  --pink-pale: #523642; --sage-pale: #294d40; --theme-sidebar: linear-gradient(180deg, #26483c 0%, #182e27 100%); --theme-glow: rgba(112, 192, 147, .17);
}
body.dark.theme-ocean {
  --bg: #172b40; --panel: #203950; --sand: #294862; --line: #3c617e; --accent: #72b7e7; --accent-strong: #a9d7f7; --accent-pale: #294c67; --ring: #9ed0f0;
  --pink-pale: #513845; --sage-pale: #284b4b; --theme-sidebar: linear-gradient(180deg, #294a65 0%, #172b40 100%); --theme-glow: rgba(104, 185, 234, .18);
}
body.dark.theme-default, body.dark.theme-pink, body.dark.theme-sage, body.dark.theme-ocean { --lilac-pale: var(--accent-pale); --lilac: var(--ring); }

body.dark .sidebar, body.dark .pos-item, body.dark .search, body.dark .date-chip,
body.dark .filter, body.dark .secondary-button, body.dark .tax-field select,
body.dark .money-input, body.dark .mapping-row select, body.dark .schedule-grid select {
  background: var(--panel);
  color: var(--ink);
}
body.dark .profile:hover, body.dark .sidebar-toggle:hover { background: var(--sand); }
body.dark .new-sale, body.dark .checkout { background: var(--ring); color: #1d2025; }
body.dark .settings-editor, body.dark .sale-dialog, body.dark .competitor-dialog { background: var(--panel); color: var(--ink); }
body.dark .recommendation { background: linear-gradient(130deg, var(--panel) 0%, var(--panel) 58%, var(--accent-pale) 100%); }
body.dark .seller-script, body.dark .loyalty-inline { background: var(--accent-pale); }
body.dark .seller-script p, body.dark .preference-tags span, body.dark .quick-client.active { color: var(--ink); }
body.dark .loyalty-card { background: linear-gradient(135deg, var(--accent-pale), var(--panel)); }
body.dark .loyalty-card footer { border-top-color: var(--line); }
body.dark .price-high td { background: color-mix(in srgb, var(--pink-pale) 80%, var(--panel)); }
body.dark .price-low td { background: color-mix(in srgb, var(--sage-pale) 80%, var(--panel)); }
body.dark.theme-default .sidebar, body.dark.theme-pink .sidebar, body.dark.theme-sage .sidebar, body.dark.theme-ocean .sidebar { background: var(--theme-sidebar); }
body.dark.theme-default .new-sale, body.dark.theme-default .checkout,
body.dark.theme-pink .new-sale, body.dark.theme-pink .checkout,
body.dark.theme-sage .new-sale, body.dark.theme-sage .checkout,
body.dark.theme-ocean .new-sale, body.dark.theme-ocean .checkout { background: var(--accent-strong); color: #1d2730; }

.settings-nav { width: 100%; }
.sidebar-mode {
  position: relative;
  min-height: 47px;
  padding: 8px 11px;
  gap: 8px;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: var(--panel);
  color: var(--ink);
}
.theme-mode-label { display: grid; gap: 1px; margin-right: auto; }
.theme-mode-label b { font-size: 11px; }
.theme-mode-label small { color: var(--muted); font-size: 9px; }
.theme-mode-state { font-size: 10px; font-weight: 700; color: var(--accent-strong); min-width: 32px; }
.sidebar-mode .switch { position: relative; top: auto; right: auto; flex: 0 0 40px; }
.sidebar-mode .switch input {
  display: block;
  position: absolute;
  opacity: 0;
  inline-size: 40px;
  block-size: 24px;
  inset: 0;
  margin: 0;
  cursor: pointer;
  z-index: 1;
}
.sidebar-mode .switch span { width: 40px; height: 24px; background: #d4d9d7; border: 1px solid #bdc5c1; }
.sidebar-mode .switch span:before { content: "☀"; position: absolute; left: 5px; top: 4px; font-size: 10px; color: #877038; }
.sidebar-mode .switch span:after { width: 18px; height: 18px; left: 2px; top: 2px; box-shadow: 0 1px 3px rgba(0,0,0,.2); }
.sidebar-mode .switch input:checked + span { background: var(--accent-strong); border-color: var(--accent-strong); }
.sidebar-mode .switch input:checked + span:before { content: "☾"; left: auto; right: 6px; top: 4px; color: #fff; }
.sidebar-mode .switch input:checked + span:after { left: 18px; }
.sidebar-mode .switch input:focus-visible + span, .theme-dot:focus-visible, button:focus-visible, input:focus-visible, select:focus-visible {
  outline: 3px solid color-mix(in srgb, var(--focus) 55%, transparent);
  outline-offset: 3px;
}

.theme-popover { background: var(--panel); }
.theme-dot { position: relative; }
.theme-dot.ocean { background: #77b6df; }
.theme-dot::after { content: attr(aria-label); position: absolute; top: 42px; left: 50%; transform: translateX(-50%); font-size: 9px; color: var(--muted); white-space: nowrap; opacity: 0; pointer-events: none; }
.theme-dot:hover::after, .theme-dot:focus-visible::after { opacity: 1; }
.theme-options { padding-bottom: 10px; }

.settings-status { min-height: 19px; margin: -14px 0 16px; color: var(--muted); font-size: 11px; }
.settings-status.is-dirty { color: var(--accent-strong); font-weight: 700; }
.settings-save:disabled { cursor: not-allowed; opacity: .48; transform: none; }
.settings-editor { background: var(--panel); border-radius: 22px; padding: 27px; position: relative; box-shadow: 0 25px 70px rgba(0,0,0,.2); }
.settings-editor h2 { font: 700 22px "Playfair Display", serif; margin: 0; }
.settings-editor > p:not(.eyebrow):not(.settings-editor-note) { color: var(--muted); font-size: 12px; line-height: 1.5; margin: 8px 0 18px; }
.settings-fields { display: grid; gap: 13px; }
.settings-fields label { display: grid; gap: 6px; color: var(--ink); font-size: 11px; font-weight: 700; }
.settings-fields input, .settings-fields select { width: 100%; border: 1px solid var(--line); border-radius: 9px; padding: 10px; font: 13px inherit; color: var(--ink); background: var(--bg); }
.settings-fields .form-check { display: flex; align-items: center; gap: 8px; font-weight: 500; }
.settings-fields .form-check input { width: auto; accent-color: var(--accent-strong); }
.settings-editor-note { min-height: 16px; color: var(--muted); font-size: 10px; line-height: 1.4; margin: 13px 0 0; }
.settings-editor-note.secure { color: var(--accent-strong); font-weight: 700; }
.settings-editor-actions { display: flex; justify-content: flex-end; gap: 9px; margin-top: 18px; }

@media (max-width: 1000px) {
  .sidebar-mode { display: flex; padding: 7px; min-height: 40px; justify-content: center; }
  .sidebar-mode .theme-mode-label, .sidebar-mode .theme-mode-state { display: none; }
  .sidebar-mode .switch { flex-basis: 40px; }
  .theme-popover { left: 8px; right: 8px; bottom: 58px; }
  .profile { display: flex; justify-content: center; padding: 14px 0 2px; }
  .profile > .avatar { display: grid; margin: 0; }
  .profile > span:nth-child(2), .profile > span:last-child { display: none; }
}

@media (max-width: 650px) {
  .sidebar-mode { display: flex; padding: 8px 11px; }
  .sidebar-mode .theme-mode-label, .sidebar-mode .theme-mode-state { display: grid; }
  .sidebar-mode .theme-mode-state { display: block; }
}
