/* ============ Vitrify — estilos base compartidos ============ */
:root {
  --ink: #0b1220;
  --ink-2: #334155;
  --muted: #64748b;
  --line: #e5e7eb;
  --line-2: #f1f5f9;
  --bg: #f7f8f5;
  --card: #ffffff;
  --page: #ffffff;
  --soft: #fafaf9;
  --input-bg: #ffffff;
  --input-bd: #d6dae1;
  --hover: #e2e8f0;
  --night: #0b1220;
  --brand: #10b981;
  --brand-600: #059669;
  --brand-50: #ecfdf5;
  --sun: #38bdf8; /* color de acento (celeste): subrayados, íconos y botones destacados */
  --sun-600: #0ea5e9;
  --danger: #ef4444;
  --warn: #0ea5e9;
  --wa: #22c55e;
  --radius: 14px;
  --radius-lg: 22px;
  --shadow-sm: 0 1px 2px rgba(15, 23, 42, .06);
  --shadow: 0 8px 30px rgba(15, 23, 42, .08);
  --shadow-lg: 0 24px 60px rgba(15, 23, 42, .16);
  --font: 'Plus Jakarta Sans', system-ui, -apple-system, 'Segoe UI', Roboto, sans-serif;
  color-scheme: light;
}
/* ---- Modo oscuro (html[data-theme="dark"]) ---- */
:root[data-theme="dark"] {
  --ink: #f1f5f9;
  --ink-2: #cbd5e1;
  --muted: #94a3b8;
  --line: #243044;
  --line-2: #1a2436;
  --bg: #0a0f1a;
  --card: #111827;
  --page: #0a0f1a;
  --soft: #0f1626;
  --input-bg: #0d1424;
  --input-bd: #2a3850;
  --hover: #253247;
  --night: #1c2740;
  --brand-50: rgba(16, 185, 129, .14);
  --shadow-sm: 0 1px 2px rgba(0, 0, 0, .4);
  --shadow: 0 8px 30px rgba(0, 0, 0, .45);
  --shadow-lg: 0 24px 60px rgba(0, 0, 0, .6);
  color-scheme: dark;
}
*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; scroll-behavior: smooth; }
body { transition: background-color .25s, color .25s; margin: 0; font-family: var(--font); color: var(--ink); background: var(--bg); line-height: 1.5; -webkit-font-smoothing: antialiased; }
img, video { max-width: 100%; display: block; }
a { color: inherit; }
button, input, select, textarea { font: inherit; color: inherit; }
h1, h2, h3, h4 { line-height: 1.15; margin: 0; letter-spacing: -.02em; }
p { margin: 0; }
.sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
.container { width: 100%; max-width: 1180px; margin: 0 auto; padding: 0 20px; }
.ico { display: inline-block; vertical-align: middle; flex: none; }
.hidden { display: none !important; }
.muted { color: var(--muted); }
.small { font-size: .85rem; }

/* ---- Botones ---- */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  padding: 11px 18px; border-radius: 12px; border: 1px solid transparent;
  font-weight: 700; font-size: .95rem; cursor: pointer; text-decoration: none;
  transition: transform .15s ease, background .15s ease, box-shadow .15s ease, border-color .15s; white-space: nowrap;
}
.btn:active { transform: translateY(1px) scale(.99); }
.btn:disabled { opacity: .55; cursor: not-allowed; }
.btn-primary { background: var(--brand); color: #fff; box-shadow: 0 6px 18px rgba(16, 185, 129, .3); }
.btn-primary:hover { background: var(--brand-600); }
.btn-dark { background: var(--ink); color: #fff; }
.btn-dark:hover { background: #1e293b; }
.btn-sun { background: var(--sun); color: #0b1220; box-shadow: 0 8px 22px rgba(14, 165, 233, .35); }
.btn-sun:hover { background: var(--sun-600); }
.btn-ghost { background: transparent; color: var(--ink); border-color: var(--line); }
.btn-ghost:hover { background: var(--card); border-color: var(--input-bd); }
.btn-light { background: var(--line-2); color: var(--ink); }
.btn-light:hover { background: var(--hover); }
.btn-wa { background: var(--wa); color: #fff; box-shadow: 0 6px 18px rgba(34, 197, 94, .3); }
.btn-wa:hover { background: #16a34a; }
.btn-danger { background: #fef2f2; color: #b91c1c; }
.btn-danger:hover { background: #fee2e2; }
.btn-sm { padding: 7px 12px; font-size: .85rem; border-radius: 10px; }
.btn-lg { padding: 15px 24px; font-size: 1.05rem; border-radius: 14px; }
.btn-block { width: 100%; }
.btn-icon { padding: 8px; border-radius: 10px; }

/* ---- Formularios ---- */
.field { display: flex; flex-direction: column; gap: 6px; margin-bottom: 14px; }
.field > label, .label { font-size: .85rem; font-weight: 600; color: var(--ink-2); }
.hint { font-size: .78rem; color: var(--muted); }
.input, .select, .textarea {
  width: 100%; padding: 11px 13px; border: 1px solid var(--input-bd); border-radius: 11px; background: var(--input-bg);
  font-size: .95rem; transition: border-color .15s, box-shadow .15s; outline: none;
}
.input:focus, .select:focus, .textarea:focus { border-color: var(--brand); box-shadow: 0 0 0 4px rgba(16, 185, 129, .15); }
.textarea { resize: vertical; min-height: 90px; }
.input-group { display: flex; align-items: stretch; border: 1px solid var(--input-bd); border-radius: 11px; overflow: hidden; background: var(--input-bg); }
.input-group:focus-within { border-color: var(--brand); box-shadow: 0 0 0 4px rgba(16, 185, 129, .15); }
.input-group .addon { display: flex; align-items: center; padding: 0 12px; background: var(--line-2); color: var(--muted); font-size: .9rem; white-space: nowrap; }
.input-group .input { border: 0; box-shadow: none !important; border-radius: 0; }
.row { display: grid; gap: 12px; grid-template-columns: 1fr 1fr; }
@media (max-width: 560px) { .row { grid-template-columns: 1fr; } }
.check { display: flex; align-items: center; gap: 10px; cursor: pointer; font-size: .93rem; }
.check input { width: 18px; height: 18px; accent-color: var(--brand); }

/* Interruptor */
.switch { position: relative; display: inline-flex; width: 42px; height: 24px; flex: none; }
.switch input { opacity: 0; width: 0; height: 0; }
.switch span { position: absolute; inset: 0; background: #cbd5e1; border-radius: 99px; transition: .2s; cursor: pointer; }
.switch span::before { content: ''; position: absolute; width: 18px; height: 18px; left: 3px; top: 3px; background: #fff; border-radius: 50%; transition: .2s; box-shadow: var(--shadow-sm); }
.switch input:checked + span { background: var(--brand); }
.switch input:checked + span::before { transform: translateX(18px); }

/* ---- Tarjetas, insignias ---- */
.card { background: var(--card); border: 1px solid var(--line); border-radius: var(--radius-lg); padding: 22px; box-shadow: var(--shadow-sm); }
.badge { display: inline-flex; align-items: center; gap: 5px; padding: 3px 9px; border-radius: 99px; font-size: .75rem; font-weight: 700; background: var(--line-2); color: var(--ink-2); white-space: nowrap; }
.badge-green { background: #dcfce7; color: #15803d; }
.badge-yellow { background: #e0f2fe; color: #0369a1; } /* avisos de estado (Enviado, Stock bajo): ahora en celeste */
.badge-blue { background: #dbeafe; color: #1d4ed8; }
.badge-sky { background: #e0f2fe; color: #0369a1; }
.badge-red { background: #fee2e2; color: #b91c1c; }
.badge-purple { background: #ede9fe; color: #6d28d9; }
.badge-dark { background: var(--ink); color: #fff; }

/* ---- Modal ---- */
.modal-backdrop {
  position: fixed; inset: 0; background: rgba(15, 23, 42, .5); backdrop-filter: blur(3px);
  display: flex; align-items: center; justify-content: center; padding: 16px; z-index: 100;
  animation: fade .18s ease;
}
.modal {
  background: var(--card); color: var(--ink); border-radius: 22px; width: 100%; max-width: 560px; max-height: calc(100vh - 32px);
  display: flex; flex-direction: column; box-shadow: var(--shadow-lg); animation: pop .22s cubic-bezier(.2, .9, .3, 1.2);
}
.modal.lg { max-width: 780px; }
.modal-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 18px 22px; border-bottom: 1px solid var(--line); }
.modal-head h3 { font-size: 1.1rem; }
.modal-body { padding: 22px; overflow-y: auto; }
.modal-foot { display: flex; justify-content: flex-end; gap: 10px; padding: 16px 22px; border-top: 1px solid var(--line); }
@media (max-width: 560px) {
  .modal-backdrop { align-items: flex-end; padding: 0; }
  .modal { border-radius: 22px 22px 0 0; max-height: 94vh; animation: up .25s ease; }
}
@keyframes fade { from { opacity: 0; } }
@keyframes pop { from { opacity: 0; transform: scale(.96) translateY(8px); } }
@keyframes up { from { transform: translateY(100%); } }

/* ---- Toast ---- */
.toasts { position: fixed; left: 50%; bottom: 22px; transform: translateX(-50%); display: flex; flex-direction: column; gap: 8px; z-index: 200; width: max-content; max-width: calc(100vw - 32px); }
.toast { background: var(--night); color: #fff; padding: 12px 16px; border-radius: 12px; box-shadow: var(--shadow-lg); font-size: .92rem; font-weight: 600; display: flex; align-items: center; gap: 10px; animation: pop .2s ease; }
.toast.error { background: #b91c1c; }
.toast.success .ico { color: #4ade80; }

/* ---- Varios ---- */
.empty { text-align: center; padding: 48px 20px; color: var(--muted); }
.empty .empty-ico { width: 72px; height: 72px; margin: 0 auto 14px; border-radius: 50%; display: grid; place-items: center; background: var(--brand-50); color: var(--brand); }
.spinner { width: 22px; height: 22px; border: 3px solid rgba(0, 0, 0, .1); border-top-color: var(--brand); border-radius: 50%; animation: spin .7s linear infinite; }
.page-loading { min-height: 60vh; display: grid; place-items: center; }
@keyframes spin { to { transform: rotate(360deg); } }
.logo { display: inline-flex; align-items: center; gap: 10px; font-weight: 800; font-size: 1.25rem; text-decoration: none; letter-spacing: -.03em; }
.logo-mark { width: 34px; height: 34px; border-radius: 10px; background: var(--night); display: grid; place-items: center; color: var(--sun); position: relative; }
.logo-mark::after { content: ''; position: absolute; right: -3px; top: -3px; width: 11px; height: 11px; border-radius: 50%; background: var(--brand); border: 2px solid var(--bg); }

/* ---- Botón de tema ---- */
.theme-toggle { width: 38px; height: 38px; padding: 0; border-radius: 11px; border: 1px solid var(--line); background: var(--card); color: var(--ink); display: inline-grid; place-items: center; cursor: pointer; flex: none; transition: background .15s, border-color .15s, transform .15s; }
.theme-toggle:hover { border-color: var(--input-bd); background: var(--line-2); }
.theme-toggle:active { transform: scale(.94); }
.theme-toggle .ico-sun { display: none; color: var(--sun); }
:root[data-theme="dark"] .theme-toggle .ico-moon { display: none; }
:root[data-theme="dark"] .theme-toggle .ico-sun { display: block; }

/* ---- Ajustes de componentes en oscuro ---- */
:root[data-theme="dark"] .btn-dark, :root[data-theme="dark"] .badge-dark { background: #f1f5f9; color: #0b1220; }
:root[data-theme="dark"] .btn-dark:hover { background: #ffffff; }
:root[data-theme="dark"] .btn-danger { background: rgba(239, 68, 68, .14); color: #fca5a5; }
:root[data-theme="dark"] .btn-danger:hover { background: rgba(239, 68, 68, .22); }
:root[data-theme="dark"] .badge-green { background: rgba(34, 197, 94, .16); color: #86efac; }
:root[data-theme="dark"] .badge-yellow { background: rgba(56, 189, 248, .16); color: #7dd3fc; }
:root[data-theme="dark"] .badge-sky { background: rgba(56, 189, 248, .16); color: #7dd3fc; }
:root[data-theme="dark"] .badge-blue { background: rgba(59, 130, 246, .18); color: #93c5fd; }
:root[data-theme="dark"] .badge-red { background: rgba(239, 68, 68, .16); color: #fca5a5; }
:root[data-theme="dark"] .badge-purple { background: rgba(139, 92, 246, .18); color: #c4b5fd; }
:root[data-theme="dark"] .switch span { background: #334155; }
:root[data-theme="dark"] .spinner { border-color: rgba(255, 255, 255, .12); border-top-color: var(--brand); }
:root[data-theme="dark"] .toast { border: 1px solid var(--line); }
:root[data-theme="dark"] .modal-backdrop { background: rgba(0, 0, 0, .65); }
:root[data-theme="dark"] .logo-mark { box-shadow: inset 0 0 0 1px rgba(255, 255, 255, .1); }
:root[data-theme="dark"] .input::placeholder, :root[data-theme="dark"] .textarea::placeholder { color: #64748b; }

/* Selector de país para números de WhatsApp: un rótulo compacto ("PY +595") con el <select> nativo encima, invisible */
.cc-pick { position: relative; display: flex; align-items: center; gap: 6px; padding: 0 30px 0 12px; background: var(--line-2); color: var(--ink-2); font-size: .9rem; font-weight: 700; white-space: nowrap; cursor: pointer; }
.cc-pick::after { content: ''; position: absolute; right: 12px; top: 50%; width: 7px; height: 7px; border-right: 2px solid currentColor; border-bottom: 2px solid currentColor; transform: translateY(-70%) rotate(45deg); opacity: .6; }
.cc-pick select { position: absolute; inset: 0; width: 100%; opacity: 0; cursor: pointer; font-size: 16px; }
.input-group:focus-within .cc-pick { color: var(--ink); }
.cc-pick:has(select:focus-visible) { outline: 2px solid var(--brand); outline-offset: -2px; }
