/* ==========================================================================
   LEDYVAS — Distribuidores · estilos del tablero (panel.html + admin.html)
   Páginas privadas, app-like. Paleta oficial de Ledyvas, autocontenido
   (no depende de style.css del sitio de marketing).
   ========================================================================== */

:root {
  color-scheme: light only;
  --navy: #0B1F3A;
  --royal: #1E4FAF;
  --royal-light: #4472D6;
  --gold: #C89B3C;
  --gray-900: #0B1F3A;
  --gray-700: #3A4356;
  --gray-500: #5F6368;
  --gray-300: #C7CDD6;
  --gray-200: #E4E8EE;
  --gray-100: #F4F6F9;
  --gray-50: #FAFBFC;
  --white: #FFFFFF;
  --good: #1F7A4D;
  --good-bg: #E6F4EC;
  --warn: #9A6212;
  --warn-bg: #FBF0DC;
  --bad: #A23A2E;
  --bad-bg: #F8E7E4;
  --font-sans: "Inter", -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
  --radius-sm: 8px;
  --radius-md: 14px;
  --shadow-sm: 0 1px 2px rgba(11,31,58,.06), 0 1px 1px rgba(11,31,58,.04);
  --shadow-md: 0 8px 24px rgba(11,31,58,.08);
}

* { box-sizing: border-box; }

body {
  margin: 0;
  font-family: var(--font-sans);
  color: var(--gray-900);
  background: var(--gray-100);
  font-size: 15px;
  line-height: 1.55;
  -webkit-font-smoothing: antialiased;
}

a { color: var(--royal); }

.d-wrap { max-width: 1120px; margin: 0 auto; padding: 0 20px 72px; }

/* ---- Preview banner ---- */
.d-preview {
  background: var(--warn-bg);
  color: var(--warn);
  font-size: 13px;
  font-weight: 600;
  text-align: center;
  padding: 9px 16px;
  border-bottom: 1px solid color-mix(in srgb, var(--warn) 25%, transparent);
}

/* ---- Header ---- */
.d-header {
  background: var(--navy);
  color: var(--white);
  padding: 20px 0 22px;
}
.d-header .d-wrap { padding-bottom: 0; display: flex; align-items: flex-start; justify-content: space-between; gap: 20px; flex-wrap: wrap; }
.d-brand { display: flex; align-items: center; gap: 12px; }
.d-brand img { height: 30px; width: auto; }
.d-brand-txt { font-weight: 700; font-size: 15px; letter-spacing: .01em; }
.d-brand-txt span { display: block; font-weight: 500; font-size: 12.5px; color: rgba(255,255,255,.6); }
.d-header h1 { margin: 16px 0 4px; font-size: 22px; font-weight: 800; letter-spacing: -.01em; }
.d-header .d-sub { margin: 0; color: rgba(255,255,255,.72); font-size: 14px; }
.d-header .d-code {
  display: inline-block; margin-top: 10px;
  font-size: 12.5px; font-weight: 600;
  background: rgba(255,255,255,.1); border: 1px solid rgba(255,255,255,.16);
  padding: 4px 12px; border-radius: 999px;
}
.d-header .d-code b { color: var(--gold-light, #E8C66A); font-family: ui-monospace, "SF Mono", Menlo, monospace; }

/* ---- Language switch ---- */
.d-lang { display: flex; gap: 4px; align-items: center; }
.d-lang button {
  border: 1px solid rgba(255,255,255,.22); background: transparent;
  color: rgba(255,255,255,.78); font: inherit; font-size: 12px; font-weight: 600;
  padding: 5px 9px; border-radius: 7px; cursor: pointer; text-transform: uppercase;
}
.d-lang button:hover { border-color: rgba(255,255,255,.5); color: var(--white); }
.d-lang button[aria-current="true"] { background: var(--royal); border-color: var(--royal); color: var(--white); }

/* ---- KPI grid ---- */
.d-kpis {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
  gap: 14px;
  margin-top: -28px;
}
.d-kpi {
  background: var(--white);
  border: 1px solid var(--gray-200);
  border-radius: var(--radius-md);
  padding: 16px 18px 18px;
  box-shadow: var(--shadow-sm);
}
.d-kpi .k-label { font-size: 12px; font-weight: 600; color: var(--gray-500); letter-spacing: .01em; }
.d-kpi .k-value { font-size: 26px; font-weight: 800; letter-spacing: -.02em; margin-top: 4px; color: var(--navy); font-variant-numeric: tabular-nums; }
.d-kpi.accent .k-value { color: var(--royal); }
.d-kpi.good .k-value { color: var(--good); }
.d-kpi.warn .k-value { color: var(--warn); }

/* ---- Section card ---- */
.d-card {
  background: var(--white);
  border: 1px solid var(--gray-200);
  border-radius: var(--radius-md);
  box-shadow: var(--shadow-sm);
  margin-top: 26px;
  overflow: hidden;
}
.d-card-head {
  display: flex; align-items: center; justify-content: space-between; gap: 14px; flex-wrap: wrap;
  padding: 18px 20px;
  border-bottom: 1px solid var(--gray-200);
}
.d-card-head h2 { margin: 0; font-size: 16px; font-weight: 700; }
.d-card-actions { display: flex; gap: 8px; flex-wrap: wrap; }
.d-card-note { padding: 12px 20px 16px; font-size: 12.5px; color: var(--gray-500); }

/* ---- Table ---- */
.d-table-scroll { overflow-x: auto; }
table.d-table { width: 100%; border-collapse: collapse; font-size: 13.5px; min-width: 620px; }
table.d-table th {
  text-align: left; font-weight: 600; font-size: 11.5px; text-transform: uppercase; letter-spacing: .04em;
  color: var(--gray-500); padding: 12px 16px; border-bottom: 1px solid var(--gray-200); white-space: nowrap;
}
table.d-table td { padding: 13px 16px; border-bottom: 1px solid var(--gray-100); vertical-align: middle; }
table.d-table tr:last-child td { border-bottom: none; }
table.d-table td.num, table.d-table th.num { text-align: right; font-variant-numeric: tabular-nums; white-space: nowrap; }
table.d-table tbody tr:hover { background: var(--gray-50); }
.d-empty { padding: 34px 20px; text-align: center; color: var(--gray-500); font-size: 14px; }

/* ---- Status badge ---- */
.d-badge {
  display: inline-block; font-size: 12px; font-weight: 600;
  padding: 3px 10px; border-radius: 999px; white-space: nowrap;
}
.d-badge.trial { background: var(--warn-bg); color: var(--warn); }
.d-badge.active { background: var(--good-bg); color: var(--good); }
.d-badge.expired { background: var(--bad-bg); color: var(--bad); }
.d-badge.never { background: var(--gray-100); color: var(--gray-500); }
.d-badge.paused { background: var(--gray-100); color: var(--gray-500); }

/* ---- Buttons ---- */
.d-btn {
  display: inline-flex; align-items: center; gap: 6px;
  font: inherit; font-size: 13px; font-weight: 600;
  padding: 8px 14px; border-radius: 8px; cursor: pointer;
  border: 1px solid var(--gray-300); background: var(--white); color: var(--navy);
  text-decoration: none;
}
.d-btn:hover { border-color: var(--royal); color: var(--royal); }
.d-btn.primary { background: var(--royal); border-color: var(--royal); color: var(--white); }
.d-btn.primary:hover { background: var(--navy); border-color: var(--navy); color: var(--white); }
.d-btn.small { padding: 5px 10px; font-size: 12px; }
.d-btn.link { border: none; background: none; padding: 4px 6px; color: var(--royal); }
.d-btn.link:hover { text-decoration: underline; }

/* ---- Quick nav (jump links, sticky under the site header) ---- */
.d-quicknav {
  position: sticky; top: var(--header-h, 88px); z-index: 20;
  display: flex; flex-wrap: nowrap; gap: 8px; overflow-x: auto;
  margin: 0 -20px 22px; padding: 10px 20px;
  background: var(--white); border-bottom: 1px solid var(--gray-300);
  box-shadow: 0 2px 6px rgba(11,31,58,.06);
  -webkit-overflow-scrolling: touch; scrollbar-width: thin;
}
/* Anchor targets: keep them clear of the sticky header + quick nav when jumped to */
#oferta, #como-funciona, #demo, #panel, #condiciones, #faq {
  scroll-margin-top: calc(var(--header-h, 88px) + 54px);
}
.d-quicknav a {
  flex: none; font-size: 12.5px; font-weight: 600; white-space: nowrap;
  padding: 6px 12px; border-radius: 999px;
  border: 1px solid var(--gray-300); color: var(--navy); text-decoration: none;
}
.d-quicknav a:hover { border-color: var(--royal); color: var(--royal); }
.d-quicknav a.d-quicknav-apply {
  background: var(--royal); border-color: var(--royal); color: var(--white); margin-left: 4px;
}
.d-quicknav a.d-quicknav-apply:hover { background: var(--navy); border-color: var(--navy); color: var(--white); }

/* ---- Modal / form ---- */
.d-modal-bg {
  position: fixed; inset: 0; background: rgba(11,31,58,.45);
  display: none; align-items: flex-start; justify-content: center; padding: 40px 16px; z-index: 50;
}
.d-modal-bg.open { display: flex; }
.d-modal {
  background: var(--white); border-radius: var(--radius-md); box-shadow: var(--shadow-md);
  width: 100%; max-width: 420px; padding: 24px;
}
.d-modal h3 { margin: 0 0 16px; font-size: 17px; }
.d-field { margin-bottom: 14px; }
.d-field label { display: block; font-size: 12.5px; font-weight: 600; color: var(--gray-700); margin-bottom: 5px; }
.d-field input, .d-field select {
  width: 100%; font: inherit; font-size: 14px; padding: 9px 11px;
  border: 1px solid var(--gray-300); border-radius: 8px; background: var(--white); color: var(--navy);
}
.d-field input:focus, .d-field select:focus { outline: 2px solid color-mix(in srgb, var(--royal) 40%, transparent); border-color: var(--royal); }
.d-modal-actions { display: flex; gap: 10px; justify-content: flex-end; margin-top: 8px; }

/* ---- Toast ---- */
.d-toast {
  position: fixed; left: 50%; bottom: 24px; transform: translateX(-50%) translateY(20px);
  background: var(--navy); color: var(--white); font-size: 13.5px; font-weight: 600;
  padding: 12px 20px; border-radius: 10px; box-shadow: var(--shadow-md);
  opacity: 0; pointer-events: none; transition: opacity .2s, transform .2s; z-index: 60; max-width: 90vw; text-align: center;
}
.d-toast.show { opacity: 1; transform: translateX(-50%) translateY(0); }

.d-foot { margin-top: 40px; text-align: center; font-size: 12.5px; color: var(--gray-500); }
.d-foot a { color: var(--gray-500); }

@media (max-width: 640px) {
  .d-header .d-wrap { flex-direction: column; }
  .d-kpis { margin-top: -20px; }
  .d-kpi .k-value { font-size: 22px; }
}

/* ==========================================================================
   Public recruitment page + application forms + contract signing
   (distribuidores.html, contrato.html)
   ========================================================================== */

.d-lead { font-size: 16px; color: var(--gray-700); max-width: 720px; margin: 24px 0 0; }

.d-roles { display: grid; grid-template-columns: repeat(auto-fit, minmax(280px, 1fr)); gap: 18px; margin-top: 28px; }
.d-role-card {
  background: var(--white); border: 1px solid var(--gray-200); border-radius: var(--radius-md);
  box-shadow: var(--shadow-sm); padding: 22px; display: flex; flex-direction: column;
}
.d-role-card h3 { margin: 0 0 8px; font-size: 18px; color: var(--navy); }
.d-role-card p { margin: 0 0 18px; font-size: 14px; color: var(--gray-700); flex: 1; }

.d-steps { counter-reset: s; list-style: none; padding: 0; margin: 20px 0 0; display: grid; gap: 12px; }
.d-steps li {
  counter-increment: s; position: relative; padding-left: 42px; font-size: 14.5px; color: var(--gray-700);
}
.d-steps li::before {
  content: counter(s); position: absolute; left: 0; top: -1px;
  width: 28px; height: 28px; border-radius: 999px; background: var(--royal); color: var(--white);
  font-weight: 700; font-size: 13px; display: flex; align-items: center; justify-content: center;
}

.d-faq { margin-top: 12px; }
.d-faq details {
  border-bottom: 1px solid var(--gray-200); padding: 14px 0;
}
.d-faq summary { font-weight: 600; font-size: 14.5px; cursor: pointer; color: var(--navy); }
.d-faq details p { margin: 10px 0 0; font-size: 14px; color: var(--gray-700); }

/* ---- Form ---- */
.d-form { max-width: 760px; }
.d-form-sec {
  background: var(--white); border: 1px solid var(--gray-200); border-radius: var(--radius-md);
  box-shadow: var(--shadow-sm); padding: 20px 22px; margin-top: 18px;
}
.d-form-sec h3 { margin: 0 0 4px; font-size: 15px; color: var(--navy); }
.d-form-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(230px, 1fr)); gap: 14px 18px; margin-top: 14px; }
.d-form-grid .d-field.wide { grid-column: 1 / -1; }
.d-field textarea {
  width: 100%; font: inherit; font-size: 14px; padding: 9px 11px; min-height: 78px; resize: vertical;
  border: 1px solid var(--gray-300); border-radius: 8px; background: var(--white); color: var(--navy);
}
.d-field textarea:focus { outline: 2px solid color-mix(in srgb, var(--royal) 40%, transparent); border-color: var(--royal); }
.d-req { color: var(--bad); margin-left: 2px; }
.d-hint { display: block; font-size: 11.5px; color: var(--gray-500); margin-top: 4px; font-weight: 400; }
.d-consent { display: flex; gap: 10px; align-items: flex-start; font-size: 13.5px; color: var(--gray-700); margin-top: 8px; }
.d-consent input { margin-top: 2px; }
.d-form-foot { margin-top: 20px; display: flex; align-items: center; gap: 16px; flex-wrap: wrap; }
.d-privacy { font-size: 12px; color: var(--gray-500); }
.d-form-error { color: var(--bad); font-size: 13px; font-weight: 600; margin-top: 10px; }

/* ---- Success / info panels ---- */
.d-success {
  background: var(--good-bg); border: 1px solid color-mix(in srgb, var(--good) 30%, transparent);
  border-radius: var(--radius-md); padding: 26px; margin-top: 24px; max-width: 620px;
}
.d-success h2 { margin: 0 0 8px; font-size: 19px; color: var(--good); }
.d-success p { margin: 0; font-size: 14.5px; color: var(--gray-700); }
.d-note {
  background: var(--gray-100); border-left: 3px solid var(--gray-300);
  padding: 10px 14px; font-size: 12.5px; color: var(--gray-500); margin-top: 16px; border-radius: 4px;
}

/* ---- Contract ---- */
.d-contract { max-width: 760px; }
.d-contract-draft {
  background: var(--warn-bg); color: var(--warn); font-size: 12.5px; font-weight: 600;
  padding: 12px 16px; border-radius: var(--radius-sm); margin-top: 18px;
}
.d-contract-body {
  background: var(--white); border: 1px solid var(--gray-200); border-radius: var(--radius-md);
  box-shadow: var(--shadow-sm); padding: 26px 28px; margin-top: 16px;
}
.d-contract-body h2 { margin: 0 0 6px; font-size: 20px; color: var(--navy); }
.d-parties { font-size: 13.5px; color: var(--gray-700); margin: 0 0 18px; padding-bottom: 16px; border-bottom: 1px solid var(--gray-200); }
.d-clause { margin-top: 16px; }
.d-clause h4 { margin: 0 0 4px; font-size: 14px; color: var(--navy); }
.d-clause p { margin: 0; font-size: 13.5px; color: var(--gray-700); }
.d-governs { font-size: 12px; color: var(--gray-500); margin-top: 20px; font-style: italic; }
.d-sign-box {
  background: var(--white); border: 1px solid var(--gray-200); border-radius: var(--radius-md);
  box-shadow: var(--shadow-sm); padding: 22px; margin-top: 18px; max-width: 760px;
}
.d-sign-box h3 { margin: 0 0 4px; font-size: 16px; }
.d-sign-box .d-sub { margin: 0 0 16px; font-size: 13px; color: var(--gray-500); }

/* ==========================================================================
   Chat del programa de socios (socios-chat.js)
   ========================================================================== */
.sc-root { position: fixed; right: 18px; bottom: 18px; z-index: 80; font-family: var(--font-sans); }
.sc-fab {
  display: inline-flex; align-items: center; gap: 8px;
  background: var(--royal); color: var(--white); border: none; cursor: pointer;
  font: inherit; font-size: 13.5px; font-weight: 600;
  padding: 11px 16px; border-radius: 999px; box-shadow: var(--shadow-md);
}
.sc-fab:hover { background: var(--navy); }
.sc-panel {
  position: absolute; right: 0; bottom: 54px;
  width: min(360px, calc(100vw - 36px));
  background: var(--white); border: 1px solid var(--gray-200);
  border-radius: var(--radius-md); box-shadow: var(--shadow-md);
  display: none; flex-direction: column; overflow: hidden;
}
.sc-root.sc-open .sc-panel { display: flex; }
.sc-head {
  display: flex; align-items: center; justify-content: space-between;
  padding: 12px 14px; background: var(--navy); color: var(--white);
}
.sc-title { font-size: 13.5px; font-weight: 600; }
.sc-close { background: none; border: none; color: rgba(255,255,255,.8); font-size: 22px; line-height: 1; cursor: pointer; padding: 0 4px; }
.sc-close:hover { color: var(--white); }
.sc-log {
  padding: 14px; display: flex; flex-direction: column; gap: 10px;
  height: 340px; overflow-y: auto; background: var(--gray-50);
}
.sc-msg { font-size: 13.5px; line-height: 1.5; padding: 9px 12px; border-radius: 12px; max-width: 88%; white-space: pre-wrap; word-wrap: break-word; }
.sc-user { align-self: flex-end; background: var(--royal); color: var(--white); border-bottom-right-radius: 4px; }
.sc-bot { align-self: flex-start; background: var(--white); border: 1px solid var(--gray-200); color: var(--gray-900); border-bottom-left-radius: 4px; }
.sc-form { display: flex; gap: 8px; padding: 10px; border-top: 1px solid var(--gray-200); }
.sc-input { flex: 1; font: inherit; font-size: 13.5px; padding: 9px 11px; border: 1px solid var(--gray-300); border-radius: 8px; }
.sc-input:focus { outline: 2px solid color-mix(in srgb, var(--royal) 40%, transparent); border-color: var(--royal); }
.sc-send { font: inherit; font-size: 13px; font-weight: 600; padding: 8px 14px; border-radius: 8px; border: none; background: var(--royal); color: var(--white); cursor: pointer; }
.sc-send:hover { background: var(--navy); }
.sc-send:disabled { opacity: .5; cursor: default; }
.sc-disclaimer { margin: 0; padding: 0 12px 12px; font-size: 11px; color: var(--gray-500); background: var(--white); }

@media (max-width: 640px) {
  .sc-root { right: 12px; bottom: 12px; }
  .sc-fab-label { display: none; }
  .sc-fab { padding: 12px; }
}

/* ==========================================================================
   Arabe (RTL) — 2026-09-21. distribuidores-i18n.js pone <html dir="rtl"> cuando el idioma es "ar".
   ========================================================================== */
html[dir="rtl"] body { font-family: "Noto Sans Arabic", var(--font-sans); }
html[dir="rtl"] table.d-table th { text-align: right; }
html[dir="rtl"] table.d-table td.num, html[dir="rtl"] table.d-table th.num { text-align: left; }
html[dir="rtl"] .d-steps li { padding-left: 0; padding-right: 42px; }
html[dir="rtl"] .d-steps li::before { left: auto; right: 0; }
html[dir="rtl"] .d-req { margin-left: 0; margin-right: 2px; }
html[dir="rtl"] .d-note { border-left: none; border-right: 3px solid var(--gray-300); }
html[dir="rtl"] .d-note[style*="border-left-color"] { border-right-color: var(--royal); }
html[dir="rtl"] [style*="margin-left:8px"] { margin-left: 0 !important; margin-right: 8px !important; }
html[dir="rtl"] [style*="padding-left:20px"] { padding-left: 0 !important; padding-right: 20px !important; }
html[dir="rtl"] .sc-user { border-bottom-right-radius: 12px; border-bottom-left-radius: 4px; }
html[dir="rtl"] .sc-bot { border-bottom-left-radius: 12px; border-bottom-right-radius: 4px; }
html[dir="rtl"] input[type="email"], html[dir="rtl"] input[type="url"], html[dir="rtl"] input[type="tel"] { direction: ltr; text-align: right; }
html[dir="rtl"] .d-quicknav a.d-quicknav-apply { margin-left: 0; margin-right: 4px; }
