/* ===== Panel cliente — neutral backoffice ===== */

:root {
  --p-bg: #f7f8fa;
  --p-paper: #ffffff;
  --p-ink: #0e1320;
  --p-ink-2: #1f2937;
  --p-mute: #5f6878;
  --p-mute-2: #9aa3b3;
  --p-line: #e6e8ee;
  --p-line-2: #eff1f5;
  --p-primary: #2a3656;
  --p-primary-2: #3e4d72;
  --p-accent: #4f63ad;
  --p-accent-bg: #ecefff;
  --p-success: #0d8a5e;
  --p-success-bg: #e0f3eb;
  --p-warning: #b35d12;
  --p-warning-bg: #fbeacf;
  --p-danger: #b3261e;
  --p-danger-bg: #fde7e7;
  --p-yellow: #c79a18;
}

* { box-sizing: border-box; }
body {
  margin: 0;
  font-family: "Plus Jakarta Sans", ui-sans-serif, system-ui, -apple-system, "Helvetica Neue", Arial, sans-serif;
  color: var(--p-ink);
  background: var(--p-bg);
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
  font-size: 14px;
}
a { color: inherit; }
img { display: block; max-width: 100%; }

/* Layout */
.app {
  display: grid;
  grid-template-columns: 248px 1fr;
  min-height: 100vh;
}
/* Sidebar */
.sidebar {
  background: var(--p-paper);
  border-right: 1px solid var(--p-line);
  display: flex;
  flex-direction: column;
  position: sticky;
  top: 0;
  height: 100vh;
  overflow-y: auto;
}
.sb-brand {
  padding: 22px 22px 20px;
  display: flex;
  gap: 10px;
  align-items: center;
  border-bottom: 1px solid var(--p-line);
}
.sb-brand .mark {
  width: 32px; height: 32px;
  background: var(--p-primary);
  color: #fff;
  border-radius: 8px;
  display: grid; place-items: center;
  font-weight: 800;
  font-size: 14px;
  letter-spacing: -0.03em;
}
.sb-brand .mark::after { content: "DR"; }
.sb-brand .lbl { display: flex; flex-direction: column; gap: 2px; }
.sb-brand .lbl b { font-size: 14px; font-weight: 700; letter-spacing: -0.01em; }
.sb-brand .lbl span { font-size: 11px; color: var(--p-mute); letter-spacing: 0.02em; }

.sb-account {
  padding: 14px 18px;
  border-bottom: 1px solid var(--p-line);
  display: flex;
  gap: 10px;
  align-items: center;
  cursor: pointer;
}
.sb-account:hover { background: var(--p-bg); }
.sb-account .av {
  width: 32px; height: 32px;
  background: var(--p-accent);
  color: #fff;
  border-radius: 50%;
  display: grid; place-items: center;
  font-weight: 700;
  font-size: 13px;
  flex-shrink: 0;
}
.sb-account .info { flex: 1; min-width: 0; }
.sb-account .info b { display: block; font-size: 13px; font-weight: 700; line-height: 1.2; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.sb-account .info span { display: block; font-size: 11px; color: var(--p-mute); margin-top: 2px; }
.sb-account .chevron { color: var(--p-mute-2); font-size: 12px; }

.sb-nav { padding: 14px 12px; flex: 1; }
.sb-section { font-size: 10px; letter-spacing: 0.14em; text-transform: uppercase; color: var(--p-mute-2); font-weight: 700; padding: 12px 10px 6px; }
.sb-link {
  display: flex;
  gap: 12px;
  align-items: center;
  padding: 9px 10px;
  border-radius: 6px;
  text-decoration: none;
  color: var(--p-ink-2);
  font-size: 13.5px;
  font-weight: 500;
  margin-bottom: 1px;
}
.sb-link:hover { background: var(--p-line-2); }
.sb-link.active { background: var(--p-accent-bg); color: var(--p-accent); font-weight: 600; }
.sb-link .ic { font-size: 16px; width: 18px; text-align: center; }
.sb-link .count { margin-left: auto; background: var(--p-line); color: var(--p-ink-2); font-size: 11px; padding: 1px 7px; border-radius: 99px; font-weight: 700; }
.sb-link.active .count { background: var(--p-accent); color: #fff; }
.sb-link.danger { color: var(--p-danger); }
.sb-link.danger .count { background: var(--p-danger-bg); color: var(--p-danger); }

.sb-foot {
  padding: 16px 22px;
  border-top: 1px solid var(--p-line);
  font-size: 12px;
  color: var(--p-mute);
}
.sb-foot .plan-mini {
  background: linear-gradient(135deg, var(--p-primary) 0%, var(--p-accent) 100%);
  color: #fff;
  border-radius: 10px;
  padding: 14px;
  margin-bottom: 12px;
}
.sb-foot .plan-mini b { display: block; font-size: 13px; font-weight: 700; }
.sb-foot .plan-mini span { font-size: 11px; color: rgba(255,255,255,0.7); margin-top: 2px; display: block; }
.sb-foot .plan-mini a { display: inline-block; margin-top: 8px; font-size: 12px; color: #fff; font-weight: 700; border-bottom: 1px solid rgba(255,255,255,0.4); text-decoration: none; padding-bottom: 1px; }

/* Main */
.main { padding: 28px 32px 56px; min-width: 0; }
.main-head {
  display: flex;
  justify-content: space-between;
  align-items: end;
  margin-bottom: 28px;
  gap: 16px;
  flex-wrap: wrap;
}
.main-head .eyebrow { font-size: 11px; letter-spacing: 0.12em; text-transform: uppercase; color: var(--p-mute); font-weight: 700; margin-bottom: 6px; }
.main-head h1 { font-size: 28px; font-weight: 700; letter-spacing: -0.02em; margin: 0; }
.main-head .sub { color: var(--p-mute); font-size: 14px; margin-top: 4px; max-width: 60ch; }
.main-head .actions { display: flex; gap: 8px; }

/* Buttons */
.btn {
  display: inline-flex; align-items: center; gap: 6px;
  padding: 9px 14px;
  border-radius: 8px;
  font-size: 13px;
  font-weight: 600;
  text-decoration: none;
  border: 1px solid transparent;
  cursor: pointer;
  font-family: inherit;
  line-height: 1.2;
  transition: background .12s, border-color .12s;
}
.btn-primary { background: var(--p-primary); color: #fff; }
.btn-primary:hover { background: var(--p-primary-2); }
.btn-ghost { background: var(--p-paper); color: var(--p-ink); border-color: var(--p-line); }
.btn-ghost:hover { background: var(--p-bg); border-color: var(--p-mute-2); }
.btn-accent { background: var(--p-accent); color: #fff; }
.btn-accent:hover { background: #3f5290; }
.btn-link { color: var(--p-accent); font-weight: 600; text-decoration: none; }
.btn-link:hover { text-decoration: underline; }

/* Cards */
.card {
  background: var(--p-paper);
  border: 1px solid var(--p-line);
  border-radius: 10px;
}
.card-pad { padding: 20px 22px; }
.card h3 { font-size: 14px; font-weight: 700; margin: 0 0 14px; letter-spacing: -0.005em; }
.card h3 .ic { color: var(--p-mute); margin-right: 6px; }

/* Stats row */
.stats-row {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 14px;
  margin-bottom: 24px;
}
@media (max-width: 900px) { .stats-row { grid-template-columns: 1fr 1fr; } }
.stat-card {
  background: var(--p-paper);
  border: 1px solid var(--p-line);
  border-radius: 10px;
  padding: 18px 20px;
}
.stat-card .lbl { font-size: 11px; letter-spacing: 0.1em; text-transform: uppercase; color: var(--p-mute); font-weight: 700; margin-bottom: 8px; }
.stat-card .val { font-size: 28px; font-weight: 800; letter-spacing: -0.02em; line-height: 1; color: var(--p-ink); }
.stat-card .delta { font-size: 12px; margin-top: 6px; display: flex; gap: 4px; align-items: center; color: var(--p-mute); }
.stat-card .delta.up { color: var(--p-success); }
.stat-card .delta.down { color: var(--p-danger); }

/* Badges */
.badge {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  padding: 3px 9px;
  border-radius: 99px;
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.01em;
}
.badge::before { content: "●"; font-size: 8px; }
.badge-active { background: var(--p-success-bg); color: var(--p-success); }
.badge-pending { background: var(--p-warning-bg); color: var(--p-warning); }
.badge-locked { background: var(--p-line); color: var(--p-mute); }
.badge-danger { background: var(--p-danger-bg); color: var(--p-danger); }
.badge-info { background: var(--p-accent-bg); color: var(--p-accent); }
.badge-yellow { background: #fdf5d8; color: var(--p-yellow); }
.badge-plain { background: var(--p-line-2); color: var(--p-ink-2); }

/* Tables */
.tbl {
  width: 100%;
  border-collapse: collapse;
  font-size: 13px;
}
.tbl th {
  text-align: left;
  font-size: 11px;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--p-mute);
  font-weight: 700;
  padding: 12px 14px;
  border-bottom: 1px solid var(--p-line);
  background: var(--p-bg);
}
.tbl td {
  padding: 14px;
  border-bottom: 1px solid var(--p-line);
  vertical-align: top;
}
.tbl tr:last-child td { border-bottom: 0; }
.tbl tr:hover td { background: var(--p-line-2); }
.tbl a { color: var(--p-accent); text-decoration: none; font-weight: 600; }
.tbl a:hover { text-decoration: underline; }

/* Forms */
.input, .select, textarea.input {
  width: 100%;
  padding: 9px 12px;
  border: 1px solid var(--p-line);
  border-radius: 7px;
  font-size: 13px;
  background: #fff;
  font-family: inherit;
  color: var(--p-ink);
}
.input:focus, .select:focus { outline: none; border-color: var(--p-accent); box-shadow: 0 0 0 3px var(--p-accent-bg); }
.label { font-size: 12px; font-weight: 700; color: var(--p-ink); margin-bottom: 5px; display: block; }
.help { font-size: 11px; color: var(--p-mute); margin-top: 4px; }

/* Tabs */
.tabs {
  display: flex;
  gap: 4px;
  border-bottom: 1px solid var(--p-line);
  margin-bottom: 20px;
}
.tabs a {
  padding: 9px 14px;
  text-decoration: none;
  color: var(--p-mute);
  font-size: 13px;
  font-weight: 600;
  border-bottom: 2px solid transparent;
  margin-bottom: -1px;
  border-radius: 6px 6px 0 0;
}
.tabs a.on { color: var(--p-accent); border-color: var(--p-accent); }
.tabs a:hover { color: var(--p-ink); }
.tabs .count { background: var(--p-line); color: var(--p-mute); font-size: 11px; padding: 1px 7px; border-radius: 99px; margin-left: 5px; font-weight: 700; }
.tabs a.on .count { background: var(--p-accent); color: #fff; }

/* Empty */
.empty {
  text-align: center;
  padding: 56px 24px;
  color: var(--p-mute);
}
.empty .ic { font-size: 36px; margin-bottom: 12px; opacity: 0.5; }
.empty h4 { font-size: 16px; color: var(--p-ink); margin-bottom: 6px; font-weight: 700; }

/* Misc */
.divider { height: 1px; background: var(--p-line); margin: 16px 0; }
.row { display: flex; gap: 14px; align-items: center; }
.muted { color: var(--p-mute); }
.kpi-num { font-variant-numeric: tabular-nums; }

/* Tablas simples */
.tbl-simple {
  width: 100%;
  border-collapse: collapse;
}
.tbl-simple th {
  text-align: left;
  font-size: 11px;
  color: var(--p-mute);
  font-weight: 700;
  letter-spacing: 0.05em;
  text-transform: uppercase;
  padding: 10px 12px;
  border-bottom: 1px solid var(--p-line);
}
.tbl-simple td {
  padding: 12px 12px;
  border-bottom: 1px solid var(--p-line-2);
  font-size: 13px;
  color: var(--p-ink-2);
}
.tbl-simple tr:last-child td { border-bottom: 0; }
.tbl-simple th.shrink, .tbl-simple td.shrink { width: 1%; white-space: nowrap; }
.tbl-simple .mono { font-family: ui-monospace, "SF Mono", Menlo, monospace; font-size: 12px; }

/* Checkbox rows (cuenta.html) */
.checkbox-row {
  display: flex;
  gap: 12px;
  align-items: start;
  padding: 12px;
  border-radius: 6px;
  cursor: pointer;
  transition: background .15s;
}
.checkbox-row:hover { background: var(--p-line-2); }
.checkbox-row input[type="checkbox"] {
  margin-top: 2px;
  flex-shrink: 0;
  cursor: pointer;
}
.checkbox-row > div { flex: 1; }
.checkbox-row b {
  display: block;
  font-size: 14px;
  font-weight: 600;
  color: var(--p-ink);
  margin-bottom: 2px;
}
.checkbox-row small {
  display: block;
  font-size: 12px;
  color: var(--p-mute);
  line-height: 1.4;
}

/* Form grid (cuenta.html) */
.form-grid {
  display: grid;
  gap: 18px;
}
.field {
  display: flex;
  flex-direction: column;
  gap: 6px;
}
.field label {
  font-size: 13px;
  font-weight: 600;
  color: var(--p-ink);
}
.field input[type="text"],
.field input[type="email"],
.field input[type="password"] {
  padding: 10px 12px;
  border: 1px solid var(--p-line);
  border-radius: 6px;
  font-size: 14px;
  color: var(--p-ink);
  background: var(--p-paper);
  font-family: inherit;
}
.field input:focus {
  outline: none;
  border-color: var(--p-accent);
}
.field input:disabled {
  background: var(--p-line-2);
  color: var(--p-mute);
  cursor: not-allowed;
}
.field .hint {
  font-size: 12px;
  color: var(--p-mute);
}

/* Cards con variantes */
.card.danger {
  border-color: var(--p-danger);
  background: var(--p-danger-bg);
}

/* ===== Compat: clases usadas por páginas nuevas (articulos/justificantes/cuenta/soporte) ===== */
.page-head {
  display: flex;
  justify-content: space-between;
  align-items: end;
  gap: 16px;
  flex-wrap: wrap;
  margin-bottom: 24px;
}
.page-head h1 { font-size: 28px; font-weight: 700; letter-spacing: -0.02em; margin: 0; }
.page-head .lede { color: var(--p-mute); font-size: 14px; margin: 6px 0 0; max-width: 64ch; line-height: 1.55; }
.page-head .eyebrow { font-size: 11px; letter-spacing: 0.12em; text-transform: uppercase; color: var(--p-mute); font-weight: 700; margin-bottom: 6px; }
.page-head .actions { display: flex; gap: 8px; flex-wrap: wrap; }

.lede { color: var(--p-mute); font-size: 14px; line-height: 1.55; }
.w-full { width: 100%; justify-content: center; }

/* Card head/body para páginas nuevas */
.card-head {
  padding: 18px 22px;
  border-bottom: 1px solid var(--p-line);
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 12px;
  flex-wrap: wrap;
}
.card-head h3 { margin: 0; font-size: 15px; font-weight: 700; }
.card-head .meta { font-size: 12px; color: var(--p-mute); }
.card-body { padding: 20px 22px; }

/* Botones: sintaxis .btn.primary / .btn.sm / .btn.danger (además de .btn-primary) */
.btn.primary { background: var(--p-primary); color: #fff; }
.btn.primary:hover { background: var(--p-primary-2); }
.btn.sm { padding: 7px 11px; font-size: 12px; }
.btn.danger { background: var(--p-danger); color: #fff; border-color: var(--p-danger); }
.btn.danger:hover { filter: brightness(1.08); }

/* Empty state genérico */
.empty-state {
  text-align: center;
  padding: 48px 24px;
  background: var(--p-paper);
  border: 1px dashed var(--p-line);
  border-radius: 12px;
}
.empty-state .ic { font-size: 32px; opacity: 0.4; margin-bottom: 12px; }
.empty-state p { margin: 0 0 6px; color: var(--p-mute); font-size: 14px; line-height: 1.55; max-width: 52ch; margin-left: auto; margin-right: auto; }
.empty-state p b { color: var(--p-ink); }
.empty-state p:last-of-type { margin-bottom: 16px; }
.empty-state button, .empty-state .btn { margin: 0 auto; }

/* Tag (chips de estado pequeños) */
.tag {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  padding: 3px 9px;
  border-radius: 99px;
  font-size: 11px;
  font-weight: 700;
  background: var(--p-line-2);
  color: var(--p-ink-2);
}

/* ===== Onboarding checklist (dashboard primer minuto) ===== */
.onboarding {
  background: var(--p-paper);
  border: 1px solid var(--p-line);
  border-radius: 12px;
  padding: 20px 22px;
  margin-bottom: 18px;
}
.onb-head { display: flex; justify-content: space-between; align-items: start; gap: 14px; margin-bottom: 12px; }
.onb-head b { font-size: 15px; font-weight: 700; display: block; }
.onb-head span { font-size: 12.5px; color: var(--p-mute); display: block; margin-top: 2px; }
.onb-pct { font-size: 22px; font-weight: 800; color: var(--p-accent); letter-spacing: -0.02em; font-variant-numeric: tabular-nums; }
.onb-bar { height: 6px; background: var(--p-line-2); border-radius: 99px; overflow: hidden; margin-bottom: 16px; }
.onb-bar .fill { height: 100%; background: var(--p-accent); border-radius: 99px; transition: width .4s ease; }
.onb-steps { display: flex; flex-direction: column; gap: 4px; }
.onb-step {
  display: flex; align-items: center; gap: 12px;
  padding: 11px 12px; border-radius: 8px;
}
.onb-step:hover { background: var(--p-line-2); }
.onb-step.done { opacity: 0.6; }
.onb-check {
  width: 24px; height: 24px; border-radius: 50%;
  display: grid; place-items: center; flex-shrink: 0;
  font-size: 13px; font-weight: 700;
  background: var(--p-line-2); color: var(--p-mute);
}
.onb-step.done .onb-check { background: var(--p-success-bg); color: var(--p-success); }
.onb-info { flex: 1; min-width: 0; }
.onb-info b { font-size: 13.5px; font-weight: 600; display: block; }
.onb-info span { font-size: 12px; color: var(--p-mute); display: block; margin-top: 1px; }
.onb-step.done .onb-info b { text-decoration: line-through; }
.onb-cta { padding: 7px 13px !important; font-size: 12.5px !important; white-space: nowrap; }
.onb-ok { font-size: 12px; color: var(--p-success); font-weight: 700; }

/* ===== Empty states con CTA (leads vacíos, etc) ===== */
.empty-cta {
  text-align: center;
  padding: 44px 24px;
  border: 1px dashed var(--p-line);
  border-radius: 12px;
  background: var(--p-paper);
}
.empty-cta .ic {
  width: 56px; height: 56px; border-radius: 14px;
  background: var(--p-accent-bg); color: var(--p-accent);
  display: grid; place-items: center; font-size: 26px;
  margin: 0 auto 16px;
}
.empty-cta h3 { font-size: 17px; margin: 0 0 8px; }
.empty-cta p { font-size: 13.5px; color: var(--p-mute); line-height: 1.6; max-width: 46ch; margin: 0 auto 18px; }

/* ===== Banner de aviso (pago fallido, ficha en revisión) ===== */
.banner {
  display: flex; gap: 14px; align-items: center;
  padding: 14px 18px; border-radius: 10px; margin-bottom: 18px;
}
.banner .b-ic { font-size: 22px; flex-shrink: 0; }
.banner .b-body { flex: 1; }
.banner .b-body b { display: block; font-size: 13.5px; margin-bottom: 2px; }
.banner .b-body span { font-size: 12.5px; line-height: 1.5; }
.banner.danger { background: var(--p-danger-bg); border: 1px solid #f2c4c0; }
.banner.danger b { color: var(--p-danger); }
.banner.danger span { color: #7a2722; }
.banner.warn { background: var(--p-warning-bg); border: 1px solid #f0dcae; }
.banner.warn b { color: var(--p-warning); }
.banner.warn span { color: #6b4a16; }
.banner .btn { white-space: nowrap; }

/* ─────────────────────────────────────────────────────────────────────────
   Responsive del chrome (barra lateral → barra superior scrollable).

   VA AL FINAL DEL FICHERO A PROPÓSITO. Estaba arriba, ANTES de las reglas
   base de `.sidebar`, así que la cascada lo anulaba entero: con la misma
   especificidad gana la última regla. Resultado, comprobado en navegador a
   390px: `flex-direction` seguía en `column`, `.sb-account` seguía visible y
   la barra ocupaba los 844px de alto — el contenido de la página quedaba por
   debajo del pliegue en TODAS las pantallas del panel.
   Si añades más reglas responsive del chrome, ponlas aquí debajo.
   ───────────────────────────────────────────────────────────────────────── */
@media (max-width: 900px) {
  .app { grid-template-columns: 1fr; }
  /* Sidebar → barra superior horizontal scrollable (navegación siempre accesible) */
  .sidebar {
    flex-direction: row;
    align-items: center;
    height: auto;
    position: sticky;
    top: 0;
    z-index: 60;
    overflow-x: auto;
    overflow-y: hidden;
    border-right: 0;
    border-bottom: 1px solid var(--p-line);
    gap: 4px;
    padding: 0 8px;
    -webkit-overflow-scrolling: touch;
  }
  .sidebar::-webkit-scrollbar { display: none; }
  .sb-brand {
    border-bottom: 0;
    padding: 10px 8px 10px 4px;
    flex-shrink: 0;
  }
  .sb-brand .lbl { display: none; }
  .sb-account, .sb-section, .sb-foot { display: none; }
  .sb-nav {
    display: flex;
    flex-direction: row;
    align-items: center;
    padding: 6px 0;
    gap: 2px;
    flex: 0 0 auto;
  }
  .sb-link {
    flex-shrink: 0;
    white-space: nowrap;
    margin-bottom: 0;
    padding: 8px 12px;
  }
  .sb-link .count { margin-left: 6px; }
  .main { padding: 20px 18px 56px; }
}
@media (max-width: 480px) {
  .sb-link .ic { font-size: 18px; }
  .main { padding: 16px 14px 48px; }
}
