/* ==========================================================
   Interpebol — Estilo FinTech premium (negro puro + rojo)
   Paleta: vino tinto (marca) + rojo Ferrari (acciones)
   ========================================================== */

:root {
  --bg-0: #000000;
  --bg-1: #0C0C0E;
  --bg-2: #141416;
  --bg-3: #1D1D21;
  --border: #26262B;
  --border-strong: #36363D;

  --text-primary: #F7F7F8;
  --text-secondary: #A3A3AB;
  --text-muted: #6E6E76;

  /* Acento de marca — carmesí legible sobre negro */
  --accent: #E8414D;
  --accent-bright: #F25864;
  --accent-dark: #7E0E1B;     /* vino tinto profundo (gradientes, bordes) */
  --accent-soft: rgba(226, 55, 68, 0.12);
  --accent-glow: rgba(226, 55, 68, 0.35);

  /* CTA — rojo Ferrari para acciones principales */
  --cta: #DC1C2E;
  --cta-bright: #EF3543;
  --cta-deep: #A90E1E;

  --success: #2EBD85;
  --danger:  #FF7A7A;
  --warning: #F97316;

  --radius-sm: 8px;
  --radius-md: 12px;
  --radius-lg: 18px;

  --shadow-card: 0 8px 30px rgba(0, 0, 0, 0.55);
  --shadow-accent: 0 6px 24px rgba(220, 28, 46, 0.22);
}

* { box-sizing: border-box; }

html {
  -webkit-text-size-adjust: 100%;
  text-size-adjust: 100%;
}

html, body {
  margin: 0;
  padding: 0;
  background: var(--bg-0);
  color: var(--text-primary);
  font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
  font-size: 15px;
  line-height: 1.55;
  -webkit-font-smoothing: antialiased;
  min-height: 100vh;
  /* Soporte para safe-area en iPhones con notch / Dynamic Island */
  padding-bottom: env(safe-area-inset-bottom);
}

body {
  background:
    radial-gradient(1200px 600px at 80% -10%, rgba(226, 55, 68, 0.07), transparent 60%),
    radial-gradient(900px 500px at -10% 110%, rgba(226, 55, 68, 0.05), transparent 60%),
    var(--bg-0);
}

a { color: var(--accent); text-decoration: none; }
a:hover { color: var(--accent-bright); }

/* ===== Layout helpers ===== */
.container        { max-width: 1180px; margin: 0 auto; padding: 0 24px; }
.container-narrow { max-width: 460px;  margin: 0 auto; padding: 0 24px; }

.center-screen {
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 32px 16px;
}

/* ===== Brand ===== */
.brand {
  display: inline-flex;
  align-items: center;
  gap: 12px;
  font-weight: 700;
  font-size: 22px;
  letter-spacing: 0.5px;
}
.brand-mark {
  width: 38px; height: 38px;
  border-radius: 10px;
  display: grid; place-items: center;
  background: linear-gradient(135deg, var(--accent), var(--accent-dark));
  color: #fff;
  font-weight: 800;
  box-shadow: var(--shadow-accent);
}
.brand-name { color: var(--text-primary); }
.brand-name span { color: var(--accent); }

/* ===== Cards ===== */
.card {
  background: linear-gradient(180deg, var(--bg-2), var(--bg-1));
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 32px;
  box-shadow: var(--shadow-card);
}
.card-tight { padding: 22px; border-radius: var(--radius-md); }

.card h1, .card h2 { margin-top: 0; }

/* ===== Typography ===== */
h1 { font-size: 28px; letter-spacing: -0.01em; margin: 0 0 6px; }
h2 { font-size: 20px; margin: 0 0 8px; }
h3 { font-size: 16px; margin: 0 0 6px; color: var(--text-secondary); font-weight: 600; }
.muted { color: var(--text-secondary); }
.tiny  { font-size: 12px; color: var(--text-muted); }

.accent { color: var(--accent); }
.divider {
  height: 1px;
  background: linear-gradient(90deg, transparent, var(--border), transparent);
  margin: 22px 0;
}

/* ===== Forms ===== */
.field { margin-bottom: 16px; }
.field label {
  display: block;
  font-size: 13px;
  color: var(--text-secondary);
  margin-bottom: 6px;
  letter-spacing: 0.02em;
}
.field-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 6px;
  gap: 8px;
}
.field-head label { margin-bottom: 0; }

/* ===== Botón Copiar (pequeño, junto al label) ===== */
.btn-copy {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  background: var(--accent-soft);
  border: 1px solid rgba(226, 55, 68, 0.3);
  color: var(--accent-bright);
  padding: 4px 10px;
  border-radius: 999px;
  font-size: 11px;
  font-weight: 600;
  letter-spacing: 0.04em;
  cursor: pointer;
  font-family: inherit;
  transition: all 0.15s ease;
}
.btn-copy:hover {
  background: rgba(226, 55, 68, 0.2);
  border-color: var(--accent);
  transform: translateY(-1px);
}
.btn-copy:active { transform: translateY(0); }
.btn-copy.copied {
  background: rgba(46, 189, 133, 0.15);
  border-color: rgba(46, 189, 133, 0.4);
  color: var(--success);
}
.btn-copy .copy-icon { font-size: 13px; line-height: 1; }

.input, select, textarea {
  width: 100%;
  background: var(--bg-1);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  padding: 12px 14px;
  color: var(--text-primary);
  font-size: 15px;
  font-family: inherit;
  transition: border-color 0.15s ease, box-shadow 0.15s ease, background 0.15s ease;
  outline: none;
}
.input:focus, select:focus, textarea:focus {
  border-color: var(--accent);
  box-shadow: 0 0 0 3px var(--accent-soft);
  background: var(--bg-2);
}
.input::placeholder { color: var(--text-muted); }
.input[readonly] { background: var(--bg-0); color: var(--accent-bright); font-weight: 600; }
.input.large {
  font-size: 22px;
  font-weight: 600;
  padding: 16px 18px;
  letter-spacing: 0.5px;
}

select {
  appearance: none;
  -webkit-appearance: none;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='14' height='14' viewBox='0 0 24 24' fill='none' stroke='%23E8414D' stroke-width='2.5' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpolyline points='6 9 12 15 18 9'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 14px center;
  padding-right: 40px;
}

/* ===== Buttons ===== */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 12px 20px;
  border-radius: var(--radius-md);
  border: 1px solid transparent;
  font-size: 14px;
  font-weight: 600;
  letter-spacing: 0.02em;
  cursor: pointer;
  transition: all 0.15s ease;
  font-family: inherit;
  text-decoration: none;
}
.btn:disabled { opacity: 0.55; cursor: not-allowed; }

.btn-primary {
  background: linear-gradient(180deg, var(--cta-bright), var(--cta-deep));
  color: #fff;
  box-shadow: var(--shadow-accent);
}
.btn-primary:hover:not(:disabled) {
  transform: translateY(-1px);
  background: linear-gradient(180deg, var(--cta-bright), var(--cta));
  box-shadow: 0 10px 28px rgba(220, 28, 46, 0.32);
}

/* CTA WhatsApp — para "Realizar envío" */
.btn-whatsapp {
  background: linear-gradient(180deg, #2EBD85, #1E9A6A);
  color: #fff;
  box-shadow: 0 6px 24px rgba(46, 189, 133, 0.22);
}
.btn-whatsapp:hover:not(:disabled) {
  transform: translateY(-1px);
  box-shadow: 0 10px 28px rgba(46, 189, 133, 0.3);
}

.btn-ghost {
  background: transparent;
  color: var(--text-primary);
  border-color: var(--border-strong);
}
.btn-ghost:hover:not(:disabled) {
  border-color: var(--accent);
  color: var(--accent);
}

.btn-danger {
  background: rgba(229, 83, 83, 0.1);
  color: var(--danger);
  border-color: rgba(229, 83, 83, 0.35);
}
.btn-danger:hover:not(:disabled) {
  background: rgba(229, 83, 83, 0.2);
}

.btn-success {
  background: rgba(46, 189, 133, 0.12);
  color: var(--success);
  border-color: rgba(46, 189, 133, 0.4);
}
.btn-success:hover:not(:disabled) {
  background: rgba(46, 189, 133, 0.22);
}

.btn-block { width: 100%; }
.btn-sm    { padding: 7px 12px; font-size: 13px; }

/* ===== Badges ===== */
.badge {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-size: 11px;
  padding: 4px 10px;
  border-radius: 999px;
  font-weight: 600;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  border: 1px solid transparent;
}
.badge::before {
  content: '';
  width: 6px; height: 6px;
  border-radius: 50%;
  background: currentColor;
}
.badge-pending    { color: var(--warning); background: rgba(240, 180, 41, 0.1); border-color: rgba(240, 180, 41, 0.3); }
.badge-approved   { color: var(--success); background: rgba(46, 189, 133, 0.1); border-color: rgba(46, 189, 133, 0.3); }
.badge-rejected   { color: var(--danger);  background: rgba(229, 83, 83, 0.1);  border-color: rgba(229, 83, 83, 0.3); }
.badge-admin      { color: var(--accent);    background: var(--accent-soft);        border-color: rgba(226, 55, 68, 0.3); }
.badge-superadmin { color: #fff;           background: linear-gradient(135deg,#7c3aed,#4f46e5); border-color: rgba(124,58,237,.4); font-weight: 700; }
.badge-user       { color: #60a5fa;        background: rgba(96,165,250,.1);      border-color: rgba(96,165,250,.3); }

/* Permission chips en modal */
.perm-chip:hover { background: var(--surface-3, #26262B) !important; }

/* Modal actions footer (compartido con admin.html) */
.modal-actions {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 14px 24px;
  border-top: 1px solid var(--border);
  gap: 8px;
}

/* Modal backdrop compartido (alias — el CSS principal está en book.css) */
.modal-backdrop.hidden { display: none !important; }

/* ===== Topbar ===== */
.topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 18px 24px;
  border-bottom: 1px solid var(--border);
  background: rgba(10, 10, 10, 0.65);
  backdrop-filter: blur(10px);
  position: sticky; top: 0; z-index: 10;
}
.topbar .user-chip {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  padding: 8px 14px;
  border-radius: 999px;
  border: 1px solid var(--border);
  background: var(--bg-1);
  font-size: 13px;
}
.avatar {
  width: 30px; height: 30px;
  border-radius: 50%;
  background: linear-gradient(135deg, var(--accent), var(--accent-dark));
  color: #fff;
  font-weight: 800;
  display: grid; place-items: center;
  font-size: 12px;
}

/* ===== Grid ===== */
.grid { display: grid; gap: 24px; }
.grid-2 { grid-template-columns: 1fr 1fr; }
.grid-3 { grid-template-columns: repeat(3, 1fr); }
.grid-dash { grid-template-columns: 1.1fr 1fr; }
@media (max-width: 900px) {
  .grid-2, .grid-3, .grid-dash { grid-template-columns: 1fr; }
}

.stat {
  background: var(--bg-2);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  padding: 18px 20px;
}
.stat .label { font-size: 12px; text-transform: uppercase; letter-spacing: 0.08em; color: var(--text-muted); }
.stat .value { font-size: 24px; font-weight: 700; color: var(--accent); margin-top: 4px; }

/* ===== Calculator ===== */
.calc-arrow {
  display: grid; place-items: center;
  height: 36px;
  color: var(--accent);
  font-size: 18px;
}
.calc-rate-pill {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 6px 12px;
  border-radius: 999px;
  background: var(--accent-soft);
  border: 1px solid rgba(226, 55, 68, 0.25);
  color: var(--accent-bright);
  font-size: 12px;
  font-weight: 600;
}

/* ===== Tables ===== */
.table-wrap {
  background: var(--bg-2);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  overflow: hidden;
}
table {
  width: 100%;
  border-collapse: collapse;
  font-size: 14px;
}
th, td {
  padding: 14px 16px;
  text-align: left;
  border-bottom: 1px solid var(--border);
}
th {
  background: var(--bg-3);
  color: var(--text-secondary);
  font-weight: 600;
  font-size: 12px;
  text-transform: uppercase;
  letter-spacing: 0.06em;
}
tbody tr:last-child td { border-bottom: none; }
tbody tr:hover { background: rgba(255, 255, 255, 0.02); }

/* ===== Toast ===== */
.toast-container {
  position: fixed;
  bottom: 24px; right: 24px;
  display: flex; flex-direction: column; gap: 10px;
  z-index: 1000;
}
.toast {
  padding: 14px 18px;
  background: var(--bg-2);
  border: 1px solid var(--border);
  border-left: 4px solid var(--accent);
  border-radius: var(--radius-md);
  min-width: 280px;
  max-width: 380px;
  box-shadow: var(--shadow-card);
  animation: slideIn 0.25s ease;
  font-size: 14px;
}
.toast-success { border-left-color: var(--success); }
.toast-error   { border-left-color: var(--danger); }
.toast-info    { border-left-color: var(--accent); }
@keyframes slideIn {
  from { transform: translateX(20px); opacity: 0; }
  to   { transform: translateX(0); opacity: 1; }
}

/* ===== Auth pages ===== */
.auth-card { width: 100%; max-width: 440px; }
.auth-header { text-align: center; margin-bottom: 24px; }
.auth-footer { text-align: center; margin-top: 18px; font-size: 14px; color: var(--text-secondary); }

/* ===== Utils ===== */
.row { display: flex; align-items: center; gap: 12px; }
.row-between { display: flex; align-items: center; justify-content: space-between; }
.gap-sm { gap: 8px; }
.mt-12 { margin-top: 12px; }
.mt-16 { margin-top: 16px; }
.mt-24 { margin-top: 24px; }
.mb-8  { margin-bottom: 8px; }
.mb-16 { margin-bottom: 16px; }
.hidden { display: none !important; }
.text-center { text-align: center; }
.fw-700 { font-weight: 700; }

.error-text {
  color: var(--danger);
  font-size: 13px;
  margin-top: 6px;
  min-height: 18px;
}

/* ===== Transitions ===== */
[x-cloak] { display: none !important; }
.fade-enter { opacity: 0; transform: translateY(4px); }
.fade-enter-active { transition: all 0.2s ease; opacity: 1; transform: none; }

/* =================================================================
   LANDING PÚBLICA — calculadora de acceso libre
   ================================================================= */
.landing-main {
  max-width: 720px;
  margin: 0 auto;
  padding: 40px 24px 80px;
}
.landing-hero {
  text-align: center;
  margin-bottom: 28px;
}
.landing-hero h1 {
  font-size: 34px;
  font-weight: 800;
  letter-spacing: -0.02em;
  margin-bottom: 8px;
}
.landing-hero h1 .accent-grad {
  background: linear-gradient(120deg, var(--accent-bright), var(--accent));
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
}
.landing-hero p {
  color: var(--text-secondary);
  font-size: 16px;
  margin: 0 auto;
  max-width: 480px;
}
.landing-rates {
  display: flex;
  justify-content: center;
  gap: 12px;
  flex-wrap: wrap;
  margin: 20px 0 26px;
}
.landing-card {
  padding: 30px 32px;
  border: 1px solid var(--border);
  background:
    linear-gradient(180deg, rgba(226, 55, 68, 0.05), transparent 30%),
    linear-gradient(180deg, var(--bg-2), var(--bg-1));
}
.landing-cta-note {
  text-align: center;
  color: var(--text-muted);
  font-size: 13px;
  margin-top: 14px;
}
.landing-footer {
  text-align: center;
  color: var(--text-muted);
  font-size: 13px;
  padding: 26px 16px 40px;
  border-top: 1px solid var(--border);
  margin-top: 40px;
}
.topbar-actions { display: flex; align-items: center; gap: 10px; }

@media (max-width: 600px) {
  .landing-main { padding: 22px 14px 60px; }
  .landing-hero h1 { font-size: 25px; }
  .landing-hero p { font-size: 14px; }
  .landing-card { padding: 20px 18px; }
  .topbar-actions .btn-sm { padding: 6px 10px; font-size: 12px; }
}

/* =================================================================
   MOBILE — optimizaciones específicas (≤ 600px)
   ================================================================= */
@media (max-width: 600px) {

  /* --- Layout base --- */
  body {
    background:
      radial-gradient(800px 400px at 80% -10%, rgba(226, 55, 68, 0.06), transparent 60%),
      var(--bg-0);
  }
  .container        { padding: 0 14px; }
  .container-narrow { padding: 0 14px; }
  .center-screen    { padding: 16px 12px; min-height: 100dvh; }

  /* --- Tipografía --- */
  h1 { font-size: 24px; }
  h2 { font-size: 18px; }
  h3 { font-size: 14px; }

  /* --- Cards --- */
  .card       { padding: 20px 18px; border-radius: 14px; }
  .card-tight { padding: 16px; border-radius: 12px; }

  /* --- Inputs: 16px mínimo evita el zoom-in automático de iOS --- */
  .input, select, textarea { font-size: 16px; padding: 11px 13px; }
  .input.large {
    font-size: 19px;
    padding: 13px 15px;
    letter-spacing: 0.3px;
  }

  /* --- Topbar compacto --- */
  .topbar {
    padding: 12px 14px;
    gap: 8px;
  }
  .topbar .user-chip {
    padding: 4px 4px;
    gap: 0;
  }
  .topbar .user-chip span { display: none; }   /* esconde nombre, deja avatar */
  .brand-name { font-size: 17px; }
  .brand-mark { width: 32px; height: 32px; border-radius: 8px; font-size: 14px; }
  .topbar .btn-sm {
    padding: 6px 10px;
    font-size: 12px;
  }
  /* En admin: el badge ADMIN dentro del brand-name */
  .brand-name .badge { font-size: 9px; padding: 3px 7px; margin-left: 4px !important; }

  /* --- Brand de los formularios de login/register --- */
  .auth-header { margin-bottom: 18px; }
  .auth-card .brand-mark { width: 42px; height: 42px; }

  /* --- Stat cards: más compactas --- */
  .stat { padding: 14px 16px; }
  .stat .label { font-size: 10px; }
  .stat .value { font-size: 20px; }

  /* --- Grids --- */
  .grid { gap: 14px; }
  .grid-2, .grid-3 { gap: 12px; }

  /* Stats del dashboard: 2 por fila, la última centrada full-width si es impar */
  .grid-3 { grid-template-columns: 1fr 1fr; }
  .grid-3 > :last-child:nth-child(odd) { grid-column: 1 / -1; }

  /* --- Sección "tasas + actualizado": apila el timestamp debajo --- */
  .row-between {
    flex-wrap: wrap;
    gap: 8px;
  }

  /* --- Pill de "tasa activa" en calculadora: full-width abajo del título --- */
  .calc-rate-pill {
    width: 100%;
    justify-content: center;
    font-size: 11px;
    padding: 7px 12px;
  }

  /* --- Botones Guardar/Limpiar: ancho completo apilados --- */
  .row.gap-sm.mt-16 {
    flex-direction: column;
    align-items: stretch;
  }
  .row.gap-sm.mt-16 .btn { width: 100%; }

  /* --- Calculadora: arrow más sutil --- */
  .calc-arrow { height: 28px; font-size: 16px; }

  /* --- Field-head (label + Copiar): copy más touch-friendly --- */
  .field-head { gap: 6px; }
  .btn-copy   { padding: 5px 11px; font-size: 11px; }

  /* --- Tablas → tarjetas en mobile --- */
  .table-wrap { background: transparent; border: none; }
  .table-wrap table,
  .table-wrap thead,
  .table-wrap tbody,
  .table-wrap th,
  .table-wrap td,
  .table-wrap tr { display: block; width: 100%; }
  .table-wrap thead { display: none; }
  .table-wrap tr {
    margin-bottom: 12px;
    padding: 14px 16px;
    border: 1px solid var(--border);
    border-radius: 12px;
    background: var(--bg-2);
  }
  .table-wrap tr:hover { background: var(--bg-2); }
  .table-wrap td {
    padding: 6px 0;
    border: none;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    font-size: 14px;
  }
  .table-wrap td::before {
    content: attr(data-label);
    color: var(--text-secondary);
    font-size: 11px;
    text-transform: uppercase;
    letter-spacing: 0.06em;
    font-weight: 600;
    flex-shrink: 0;
  }
  .table-wrap td[data-label=""]::before,
  .table-wrap td:not([data-label])::before { content: none; }
  /* Fila con un solo texto centrado (loading/empty) */
  .table-wrap td[colspan] {
    text-align: center;
    justify-content: center;
  }
  /* Botones dentro de fila card: alineados a la derecha */
  .table-wrap td .btn { margin-left: auto; }
  /* En la fila de acciones de admin: si hay 2 botones, los apilamos cuando es muy estrecho */
  .table-wrap td .row.gap-sm { width: 100%; }

  /* --- Admin: filtros + buscador apilados a ancho completo --- */
  .row.gap-sm {
    flex-wrap: wrap;
  }
  /* Override de inline styles para los filtros del admin */
  #statusFilter,
  #searchInput {
    width: 100% !important;
  }

  /* --- Tasas en admin: el grid-2 ya colapsa a 1col por la regla de 900px --- */

  /* --- Toast: relativo al viewport, no se desborda --- */
  .toast-container {
    left: 12px;
    right: 12px;
    bottom: 12px;
  }
  .toast {
    min-width: 0;
    max-width: 100%;
    padding: 12px 14px;
    font-size: 13px;
  }

  /* --- Card de perfil: status badge en línea separada cuando es estrecho --- */
  #profileName + .muted, #profileEmail { word-break: break-all; }
}

/* =================================================================
   EXTRA-NARROW (≤ 360px) — iPhone SE, Galaxy Fold cerrado, etc.
   ================================================================= */
@media (max-width: 360px) {
  .container { padding: 0 10px; }
  .topbar    { padding: 10px 10px; }
  .card      { padding: 16px 14px; }
  .input.large { font-size: 18px; padding: 12px 13px; }
  .brand-name { font-size: 15px; }
  .topbar .btn-sm { padding: 5px 8px; font-size: 11px; }
  .stat .value { font-size: 17px; }
  /* En esta franja, apila también los pares de botones Aprobar/Rechazar */
  .table-wrap td .row.gap-sm {
    flex-direction: column;
    align-items: stretch;
  }
  .table-wrap td .row.gap-sm .btn { width: 100%; }
}

/* =================================================================
   TABLET (601–900px) — el grid-dash sigue siendo 1col por la regla
   existente; aquí solo afinamos algunos paddings.
   ================================================================= */
@media (min-width: 601px) and (max-width: 900px) {
  .container { padding: 0 20px; }
  .card { padding: 26px; }
}

/* =================================================================
   ADMIN SIDEBAR — layout con columna izquierda (solo panel admin)
   ================================================================= */
body.with-sidebar { display: flex; min-height: 100vh; }

.admin-sidebar {
  width: 248px;
  min-width: 248px;
  background: linear-gradient(180deg, var(--bg-1), var(--bg-0));
  border-right: 1px solid var(--border);
  display: flex;
  flex-direction: column;
  position: sticky;
  top: 0;
  height: 100vh;
  overflow-y: auto;
  z-index: 50;
}
.admin-sidebar .sb-brand {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 20px 18px 16px;
  border-bottom: 1px solid var(--border);
}
.admin-sidebar nav { flex: 1; padding: 14px 10px; }

.sb-item {
  display: flex;
  align-items: center;
  gap: 10px;
  width: 100%;
  padding: 11px 14px;
  margin-bottom: 2px;
  border-radius: 10px;
  border: 1px solid transparent;
  background: transparent;
  color: var(--text-secondary);
  font: inherit;
  font-size: 14px;
  font-weight: 600;
  text-align: left;
  cursor: pointer;
  text-decoration: none;
  transition: all 0.15s ease;
}
.sb-item:hover { color: var(--text-primary); background: var(--bg-2); }
.sb-item.active {
  color: var(--accent);
  background: var(--accent-soft);
  border-color: rgba(226, 55, 68, 0.25);
}
.sb-item .sb-icon { width: 20px; text-align: center; font-size: 15px; }
.sb-item .sb-caret { margin-left: auto; font-size: 11px; transition: transform 0.15s ease; }
.sb-item.open .sb-caret { transform: rotate(90deg); }

.sb-group { overflow: hidden; max-height: 0; transition: max-height 0.2s ease; }
.sb-group.open { max-height: 320px; }
.sb-sub {
  display: block;
  padding: 8px 14px 8px 44px;
  margin-bottom: 1px;
  border-radius: 8px;
  color: var(--text-muted);
  font-size: 13px;
  font-weight: 500;
  text-decoration: none;
  transition: all 0.15s ease;
}
.sb-sub:hover { color: var(--text-primary); background: var(--bg-2); }
.sb-sub.active { color: var(--accent); background: var(--accent-soft); }

.admin-sidebar .sb-footer {
  padding: 14px;
  border-top: 1px solid var(--border);
  display: flex;
  align-items: center;
  gap: 10px;
}
.admin-sidebar .sb-footer .sb-user { flex: 1; min-width: 0; }
.admin-sidebar .sb-footer .sb-user .name {
  font-size: 13px; font-weight: 600;
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.admin-sidebar .sb-footer .sb-user .role { font-size: 11px; color: var(--text-muted); }

.admin-main { flex: 1; min-width: 0; }
.admin-main > .container { padding-top: 28px; padding-bottom: 70px; }

/* Botón hamburguesa (solo móvil) */
.sb-hamburger {
  display: none;
  position: fixed;
  top: 12px; left: 12px;
  z-index: 60;
  width: 42px; height: 42px;
  border-radius: 10px;
  border: 1px solid var(--border-strong);
  background: var(--bg-1);
  color: var(--text-primary);
  font-size: 18px;
  cursor: pointer;
}
.sb-backdrop {
  display: none;
  position: fixed; inset: 0;
  background: rgba(0,0,0,0.6);
  z-index: 49;
}

@media (max-width: 900px) {
  .sb-hamburger { display: grid; place-items: center; }
  .admin-sidebar {
    position: fixed;
    left: 0; top: 0;
    height: 100dvh;
    transform: translateX(-100%);
    transition: transform 0.2s ease;
    box-shadow: 8px 0 30px rgba(0,0,0,0.5);
  }
  body.sb-open .admin-sidebar { transform: translateX(0); }
  body.sb-open .sb-backdrop { display: block; }
  .admin-main > .container { padding-top: 64px; }
}

/* Dashboard admin */
.chart-card { min-height: 300px; }
.chart-card .chart-container { position: relative; height: 240px; margin-top: 12px; }
.chart-empty {
  display: grid; place-items: center;
  height: 240px;
  color: var(--text-muted);
  font-size: 13px;
  border: 1px dashed var(--border);
  border-radius: var(--radius-md);
}

/* Con sidebar, la barra de pestañas interna del libro se oculta (la reemplaza el menú) */
body.with-sidebar .book-tabs { display: none; }
