:root {
  --bg: #eef3fb;
  --card: rgba(255, 255, 255, 0.92);
  --card-strong: #ffffff;
  --text: #10233f;
  --muted: #667991;
  --line: #dce6f4;
  --primary: #2563eb;
  --primary-strong: #1d4ed8;
  --primary-soft: #eaf2ff;
  --danger: #e11d48;
  --danger-soft: #fff1f3;
  --success: #15803d;
  --success-soft: #eaf8ef;
  --shadow: 0 24px 50px rgba(15, 35, 68, 0.08);
  --radius-xl: 28px;
  --radius-lg: 22px;
  --radius-md: 16px;
  --radius-sm: 12px;
  font-family: Inter, system-ui, -apple-system, Segoe UI, Arial, sans-serif;
}

* {
  box-sizing: border-box;
}

html,
body {
  margin: 0;
  min-height: 100%;
  background:
    radial-gradient(circle at top left, rgba(37, 99, 235, 0.09), transparent 28%),
    radial-gradient(circle at top right, rgba(14, 165, 233, 0.08), transparent 22%),
    var(--bg);
  color: var(--text);
}

body {
  min-height: 100vh;
}

button,
input,
textarea {
  font: inherit;
}

.hidden {
  display: none !important;
}

.app-shell {
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}

.topbar {
  width: min(1280px, calc(100% - 28px));
  margin: 18px auto 0;
  padding: 18px 24px;
  border: 1px solid rgba(255, 255, 255, 0.6);
  border-radius: 24px;
  background: rgba(255, 255, 255, 0.82);
  backdrop-filter: blur(14px);
  box-shadow: var(--shadow);
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
}

.brand {
  display: flex;
  align-items: center;
  gap: 14px;
}

.brand-icon {
  width: 56px;
  height: 56px;
  border-radius: 18px;
  display: grid;
  place-items: center;
  font-size: 28px;
  color: #fff;
  background: linear-gradient(135deg, #2563eb, #1e40af 65%, #0ea5e9);
  box-shadow: 0 16px 30px rgba(37, 99, 235, 0.26);
}

.brand strong,
.brand small {
  display: block;
}

.brand strong {
  font-size: 1.2rem;
  font-weight: 800;
}

.brand small {
  margin-top: 4px;
  color: var(--muted);
}

.container {
  width: min(1280px, calc(100% - 28px));
  margin: 22px auto 26px;
  flex: 1;
}

.card {
  border: 1px solid rgba(220, 230, 244, 0.85);
  background: var(--card);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow);
}

.eyebrow {
  display: inline-block;
  margin-bottom: 12px;
  color: var(--primary);
  font-size: 0.72rem;
  letter-spacing: 1.8px;
  font-weight: 800;
}

.eyebrow-light {
  color: rgba(255, 255, 255, 0.8);
}

h1,
 h2,
 h3,
 p {
  margin: 0;
}

h1 {
  font-size: clamp(2rem, 3vw, 2.8rem);
  line-height: 1.08;
}

h2 {
  font-size: 1.35rem;
  line-height: 1.2;
}

.muted {
  color: var(--muted);
  line-height: 1.6;
}

.login-layout {
  padding: 16px 0 8px;
}

.hero-card {
  display: grid;
  grid-template-columns: 1.15fr 420px;
  gap: 24px;
  padding: 28px;
}

.hero-copy {
  min-height: 100%;
  padding: 18px;
  border-radius: 24px;
  background:
    linear-gradient(135deg, rgba(16, 35, 63, 0.96), rgba(37, 99, 235, 0.94));
  color: #fff;
  display: flex;
  flex-direction: column;
  justify-content: center;
}

.hero-text {
  max-width: 52ch;
  margin-top: 14px;
  color: rgba(255, 255, 255, 0.82);
}

.hero-badges {
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
  margin-top: 20px;
}

.pill {
  display: inline-flex;
  align-items: center;
  padding: 10px 14px;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.12);
  border: 1px solid rgba(255, 255, 255, 0.16);
  font-size: 0.88rem;
  font-weight: 600;
}

.login-card {
  padding: 28px;
}

.login-title {
  margin-bottom: 10px;
}

.admin-layout {
  display: grid;
  gap: 22px;
}

.hero-banner {
  display: flex;
  justify-content: space-between;
  gap: 18px;
  align-items: flex-start;
  padding: 30px;
  border-radius: var(--radius-xl);
  background: linear-gradient(135deg, #10233f, #163766 58%, #2563eb);
  box-shadow: var(--shadow);
  color: white;
}

.hero-banner p {
  margin-top: 10px;
  max-width: 62ch;
  color: rgba(255, 255, 255, 0.78);
}

.banner-status {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  padding: 12px 16px;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.14);
  border: 1px solid rgba(255, 255, 255, 0.18);
  font-size: 0.93rem;
  font-weight: 700;
  white-space: nowrap;
}

.status-dot {
  width: 10px;
  height: 10px;
  border-radius: 50%;
  background: #22c55e;
  box-shadow: 0 0 0 6px rgba(34, 197, 94, 0.16);
}

.stats-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 18px;
}

.stat-card {
  padding: 24px 26px;
  border-radius: var(--radius-lg);
  background: var(--card-strong);
  border: 1px solid var(--line);
  box-shadow: var(--shadow);
}

.stat-card-primary {
  background: linear-gradient(135deg, #2563eb, #1d4ed8);
  color: #fff;
}

.stat-label,
.stat-card small {
  display: block;
}

.stat-label {
  color: inherit;
  opacity: 0.82;
  font-size: 0.92rem;
}

.stat-card strong {
  display: block;
  margin: 10px 0 8px;
  font-size: clamp(2rem, 4vw, 2.8rem);
  line-height: 1;
}

.stat-card:not(.stat-card-primary) .stat-label,
.stat-card:not(.stat-card-primary) small {
  color: var(--muted);
}

.dashboard-grid {
  display: grid;
  grid-template-columns: minmax(320px, 430px) minmax(0, 1fr);
  gap: 22px;
  align-items: start;
}

.panel-column {
  display: grid;
  gap: 22px;
}

.panel-card {
  padding: 24px;
}

.card-head,
.section-heading {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 16px;
}

.icon-chip {
  width: 42px;
  height: 42px;
  display: grid;
  place-items: center;
  border-radius: 14px;
  background: var(--primary-soft);
  font-size: 1.2rem;
}

.stack-form label,
.history-field label {
  display: block;
  margin: 15px 0 8px;
  font-size: 0.92rem;
  font-weight: 700;
}

input,
textarea {
  width: 100%;
  border: 1px solid var(--line);
  border-radius: 14px;
  padding: 13px 15px;
  background: rgba(255, 255, 255, 0.95);
  color: var(--text);
  outline: none;
  transition: border-color 0.18s ease, box-shadow 0.18s ease, transform 0.18s ease;
}

textarea {
  resize: vertical;
  min-height: 110px;
}

input[type='file'] {
  padding: 11px;
  font-size: 0.92rem;
}

input:focus,
textarea:focus {
  border-color: var(--primary);
  box-shadow: 0 0 0 4px rgba(37, 99, 235, 0.12);
}

.button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  border: 0;
  border-radius: 14px;
  padding: 12px 16px;
  cursor: pointer;
  transition: transform 0.18s ease, box-shadow 0.18s ease, opacity 0.18s ease,
    background 0.18s ease;
  font-weight: 700;
}

.button:hover {
  transform: translateY(-1px);
}

.button:disabled {
  opacity: 0.72;
  cursor: wait;
}

.button-primary {
  color: white;
  background: linear-gradient(135deg, var(--primary), var(--primary-strong));
  box-shadow: 0 14px 26px rgba(37, 99, 235, 0.2);
}

.button-outline {
  background: white;
  color: var(--text);
  border: 1px solid var(--line);
}

.button-light {
  background: var(--primary-soft);
  color: var(--primary);
}

.button-danger {
  background: var(--danger-soft);
  color: var(--danger);
}

.full {
  width: 100%;
  margin-top: 18px;
}

.book-list {
  display: grid;
  gap: 14px;
  margin-top: 18px;
}

.book {
  display: flex;
  align-items: center;
  gap: 15px;
  padding: 16px;
  background: linear-gradient(180deg, #ffffff, #f8fbff);
  border: 1px solid var(--line);
  border-radius: 18px;
}

.book-cover {
  width: 70px;
  height: 96px;
  flex-shrink: 0;
  display: grid;
  place-items: center;
  border-radius: 18px;
  background: linear-gradient(135deg, #2563eb, #1d4ed8 65%, #0ea5e9);
  color: white;
  font-size: 2rem;
  box-shadow: 0 14px 24px rgba(37, 99, 235, 0.18);
}

.book-info {
  flex: 1;
  min-width: 0;
}

.book-info strong,
.book-info small {
  display: block;
}

.book-info strong {
  font-size: 1rem;
  margin-bottom: 6px;
}

.book-info small {
  color: var(--muted);
  margin-top: 4px;
}

.book-actions {
  display: flex;
  flex-wrap: wrap;
  justify-content: flex-end;
  gap: 8px;
  margin-left: auto;
}

.history-card {
  overflow: hidden;
}

.history-toolbar {
  display: flex;
  align-items: end;
  justify-content: space-between;
  gap: 16px;
  flex-wrap: wrap;
  margin-top: 18px;
  margin-bottom: 18px;
}

.history-field {
  min-width: 220px;
}

.history-scroll {
  overflow: auto;
  border: 1px solid var(--line);
  border-radius: 18px;
}

.history-table {
  width: 100%;
  min-width: 860px;
  border-collapse: collapse;
  font-size: 0.93rem;
  background: white;
}

.history-table thead th {
  text-align: left;
  padding: 14px 16px;
  background: #f6f9ff;
  color: #49607d;
  border-bottom: 1px solid var(--line);
}

.history-table td {
  padding: 14px 16px;
  border-bottom: 1px solid #edf2f8;
  vertical-align: top;
}

.history-table tbody tr:hover {
  background: #f9fbff;
}

.history-complete {
  color: var(--success);
  font-weight: 800;
}

.history-progress {
  color: var(--primary);
  font-weight: 700;
}

.message-bar {
  min-height: 24px;
  margin: 18px 2px 0;
  font-weight: 700;
}

.message-bar.ok {
  color: var(--success);
}

.message-bar.bad {
  color: var(--danger);
}

.footer {
  width: min(1280px, calc(100% - 28px));
  margin: 0 auto 24px;
  padding: 10px 4px;
  text-align: center;
  color: #8193aa;
  font-size: 0.92rem;
}

.reader-modal {
  position: fixed;
  inset: 0;
  z-index: 2000;
  background: rgba(8, 15, 28, 0.75);
  backdrop-filter: blur(4px);
  padding: 16px;
}

.reader-modal.hidden {
  display: none;
}

.reader-shell {
  max-width: 1240px;
  height: 100%;
  margin: auto;
  background: white;
  border-radius: 26px;
  display: flex;
  flex-direction: column;
  overflow: hidden;
  box-shadow: 0 30px 60px rgba(0, 0, 0, 0.18);
}

.reader-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 12px;
  padding: 16px 20px;
  border-bottom: 1px solid var(--line);
}

.reader-heading {
  display: flex;
  flex-direction: column;
  min-width: 0;
}

.reader-heading strong {
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.reader-heading small {
  margin-top: 4px;
  color: var(--muted);
}

.reader-toolbar {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 10px;
  padding: 12px 18px;
  background: #f7faff;
  border-bottom: 1px solid var(--line);
}

.reader-toolbar .button {
  padding: 9px 12px;
}

.reader-page-label {
  margin: 0;
  font-size: 0.9rem;
  font-weight: 700;
}

#readerPage {
  width: 72px;
  padding: 10px;
}

.reader-spacer {
  flex: 1;
}

#readerZoom {
  min-width: 56px;
  text-align: center;
  font-size: 0.9rem;
}

.reader-canvas-container {
  flex: 1;
  min-height: 0;
  overflow: auto;
  padding: 20px;
  text-align: center;
  background: #dfe8f2;
}

#readerCanvas {
  display: block;
  margin: 0 auto;
  background: #fff;
  box-shadow: 0 16px 32px rgba(15, 23, 42, 0.14);
}

.reader-error {
  padding: 14px 18px 18px;
  color: var(--danger);
}

@media (max-width: 1080px) {
  .hero-card,
  .dashboard-grid {
    grid-template-columns: 1fr;
  }

  .hero-copy {
    min-height: auto;
  }
}

@media (max-width: 760px) {
  .topbar,
  .container,
  .footer {
    width: min(100% - 18px, 1280px);
  }

  .topbar {
    padding: 16px 18px;
    border-radius: 20px;
  }

  .hero-card,
  .login-card,
  .panel-card,
  .hero-banner {
    padding: 20px;
  }

  .hero-banner {
    border-radius: 22px;
  }

  .stats-grid {
    grid-template-columns: 1fr;
  }

  .book {
    flex-wrap: wrap;
  }

  .book-actions {
    width: 100%;
    justify-content: flex-start;
    margin-left: 0;
  }

  .reader-modal {
    padding: 0;
  }

  .reader-shell {
    border-radius: 0;
    height: 100vh;
    max-width: none;
  }

  .reader-canvas-container {
    padding: 10px;
  }
}

/* Vista amplia: libros e historial a todo el ancho */
.dashboard-grid { grid-template-columns: minmax(0,1fr); }
.panel-column { min-width: 0; }
.section-actions { display:flex; gap:10px; flex-wrap:wrap; }
.history-toolbar { justify-content:flex-start; align-items:end; }
.history-field { min-width: 165px; flex:1 1 175px; }
.history-limit { flex:0 0 100px; min-width:100px; }
.history-field select { width:100%; border:1px solid var(--line); border-radius:14px; padding:13px 15px; background:white; color:var(--text); }
.history-scroll { width:100%; }
.history-table { width:100%; min-width:0; table-layout:fixed; font-size:.85rem; }
.history-table th,.history-table td { padding:12px 10px; overflow-wrap:anywhere; }
.history-table th:nth-child(1) {width:18%}
.history-table th:nth-child(2) {width:22%}
.history-table th:nth-child(3) {width:18%}
.history-table th:nth-child(4) {width:14%}
.history-table th:nth-child(5) {width:12%}
.history-table th:nth-child(6) {width:16%}
.history-date {font-weight:700;white-space:normal}
.history-sub {display:block;color:var(--muted);font-size:.77rem;margin-top:3px}
.history-state {display:inline-block;padding:6px 9px;border-radius:999px;font-weight:800;font-size:.75rem;line-height:1.3}
.history-state.complete {background:#e7f8ed;color:#147638}
.history-state.progress {background:#eaf2ff;color:#2459ce}
.history-track {height:6px;border-radius:999px;background:#e7ecf6;margin-top:8px;overflow:hidden}
.history-fill {height:100%;border-radius:999px;background:#2563eb}
.history-fill.complete {background:#16a34a}
.history-pagination {display:flex;gap:12px;justify-content:space-between;align-items:center;flex-wrap:wrap;margin-top:16px;color:var(--muted);font-size:.87rem}
.pagination-buttons {display:flex;align-items:center;gap:10px;flex-wrap:wrap}
.pagination-buttons .button {padding:9px 12px}
.upload-modal {position:fixed;inset:0;z-index:2300;background:rgba(9,18,32,.68);backdrop-filter:blur(5px);display:flex;align-items:center;justify-content:center;padding:18px}
.upload-modal-shell {width:min(800px,100%);max-height:calc(100dvh - 36px);display:flex;flex-direction:column;background:white;border-radius:24px;box-shadow:0 32px 70px #08152b44;overflow:hidden}
.upload-modal-header {padding:22px 26px;border-bottom:1px solid var(--line);display:flex;justify-content:space-between;gap:16px;align-items:flex-start}
.upload-modal-header h2 {margin-bottom:7px}
.upload-modal-body {padding:18px 26px 28px;overflow:auto}
.upload-modal-body .stack-form {display:grid;grid-template-columns:repeat(2,minmax(0,1fr));gap:0 16px}
.upload-modal-body .stack-form label {grid-column:span 1}
.upload-modal-body .stack-form label, .upload-modal-body .stack-form input, .upload-modal-body .stack-form textarea {grid-column:1/-1}
.upload-modal-body .stack-form .full {grid-column:1/-1}
body.modal-open {overflow:hidden}
@media(max-width:850px){.history-table {min-width:780px;table-layout:auto}.history-table th:nth-child(n){width:auto}.history-scroll{overflow-x:auto}}
@media(max-width:600px){.upload-modal{padding:0}.upload-modal-shell{max-height:100dvh;height:100dvh;border-radius:0}.upload-modal-header,.upload-modal-body{padding:18px}.section-heading{flex-wrap:wrap}.history-toolbar{align-items:stretch}.history-field{flex:1 1 100%}}


/* Conductores */
.driver-toolbar { display:flex; gap:12px; margin:20px 0 12px; }
.driver-toolbar input { flex:1; min-width:120px; }
.driver-count { margin:0 0 12px; font-size:13px; }
.driver-list { display:grid; gap:10px; max-height:430px; overflow-y:auto; }
.driver-item { display:flex; gap:14px; justify-content:space-between; align-items:center; padding:15px 17px; border:1px solid var(--line); border-radius:16px; background:#f9fbff; }
.driver-item strong,.driver-item small { display:block; }
.driver-item small { margin-top:5px; color:var(--muted); }
.driver-actions { display:flex; gap:8px; flex-wrap:wrap; }
.driver-actions .button { font-size:12px; padding:9px 12px; }
.driver-modal-shell { max-width:620px; height:auto; max-height:92vh; }
.driver-modal-shell .upload-modal-body { padding-bottom:28px; }
@media(max-width:670px) {
  .driver-item { align-items:flex-start; flex-direction:column; }
  .driver-toolbar { flex-wrap:wrap; }
  .driver-modal-shell { max-height:100vh; height:100vh; }
}

/* Seguimiento de cumplimiento de lectura */
.pending-card { min-width: 0; }
.pending-metrics { background: #eef5ff; color: #1c498d; border-radius: 14px; padding: 13px 16px; margin: 18px 0; font-weight: 700; }
.pending-filters { display: grid; grid-template-columns: repeat(4,minmax(0,1fr)); gap: 12px; margin: 18px 0; }
.pending-filters label { display: grid; gap: 8px; font-weight: 700; font-size: 13px; min-width: 0; }
.pending-filters select { min-width: 0; width: 100%; border: 1px solid #d7e2f3; border-radius: 12px; padding: 12px; color: #10233f; background: #fff; }
.pending-table-wrap { width: 100%; overflow-x: auto; border: 1px solid #dbe6f5; border-radius: 16px; }
.pending-table { width: 100%; min-width: 740px; border-collapse: collapse; font-size: 13px; }
.pending-table th { text-align: left; background: #f5f8fe; color: #506380; padding: 13px; }
.pending-table td { padding: 14px 13px; border-top: 1px solid #e6edf6; }
.pending-completado { color: #15803d; font-weight: 800; }
.pending-vencido { color: #c2410c; font-weight: 800; }
.pending-no_iniciado { color: #b45309; font-weight: 800; }
.pending-en_progreso { color: #2563eb; font-weight: 800; }
.pending-page { display:flex; align-items:center; justify-content:space-between; gap:12px; margin-top:16px; color:#64748b; }
.pending-page > div {display:flex; gap:10px; align-items:center;}
.driver-list {max-height: 340px; overflow-y:auto;}
@media (max-width: 900px) { .pending-filters {grid-template-columns:repeat(2,minmax(0,1fr));} }
@media (max-width: 560px) { .pending-filters {grid-template-columns:1fr;} .pending-page,.pending-page>div {flex-wrap:wrap;} }


/* Navegación por módulos: solo se muestra la vista elegida. */
#adminPanel.admin-layout { display: block; }
#adminPanel .module-content { min-width: 0; margin-left: 244px; }
#adminPanel .module-menu {
  position: fixed; top: 105px; bottom: 22px; left: max(14px, calc((100vw - 1560px) / 2));
  z-index: 30; width: 218px; padding: 18px 11px; border-radius: 22px;
  background: linear-gradient(165deg,#0d2346,#142e5b); color: white;
  box-shadow: 0 20px 44px rgba(12,36,73,.22); display: flex; flex-direction: column; gap: 6px;
}
.module-menu-brand { padding: 12px 10px 23px; font-size: 14px; }
.module-menu-brand strong { margin-left: 4px; }
.module-menu-brand small { display:block; margin:6px 0 0 27px; opacity:.65; }
.module-link {
  display:flex; align-items:center; gap:9px; width:100%; padding:13px 11px; border:0;
  border-radius:12px; background:transparent; color:#dbe8fb; text-align:left;
  font:600 13px Inter,system-ui,sans-serif; cursor:pointer;
}
.module-link:hover, .module-link.is-active { background:rgba(255,255,255,.15); color:white; }
.module-link:focus-visible { outline: 2px solid #93c5fd; outline-offset:2px; }
.module-breadcrumb { color:#637792; font-size:13px; font-weight:700; margin:0 0 17px 5px; }
#adminPanel .dashboard-grid, #adminPanel .panel-column { display:contents; }
#adminPanel .library-card, #adminPanel .driver-card, #adminPanel .pending-card, #adminPanel .history-card { margin:0; }
#adminPanel .module-content { display:flex; flex-direction:column; gap:20px; }
#adminPanel[data-current-panel="dashboard"] .library-card,
#adminPanel[data-current-panel="dashboard"] .driver-card,
#adminPanel[data-current-panel="dashboard"] .pending-card,
#adminPanel[data-current-panel="dashboard"] .history-card { display:none; }
#adminPanel[data-current-panel]:not([data-current-panel="dashboard"]) .hero-banner,
#adminPanel[data-current-panel]:not([data-current-panel="dashboard"]) .stats-grid { display:none; }
#adminPanel[data-current-panel="libros"] .driver-card,
#adminPanel[data-current-panel="libros"] .pending-card,
#adminPanel[data-current-panel="libros"] .history-card { display:none; }
#adminPanel[data-current-panel="conductores"] .library-card,
#adminPanel[data-current-panel="conductores"] .pending-card,
#adminPanel[data-current-panel="conductores"] .history-card { display:none; }
#adminPanel[data-current-panel="pendientes"] .library-card,
#adminPanel[data-current-panel="pendientes"] .driver-card,
#adminPanel[data-current-panel="pendientes"] .history-card { display:none; }
#adminPanel[data-current-panel="historial"] .library-card,
#adminPanel[data-current-panel="historial"] .driver-card,
#adminPanel[data-current-panel="historial"] .pending-card { display:none; }
@media(max-width:1050px){
 #adminPanel .module-menu {position:sticky;top:0;left:auto;width:auto;bottom:auto;border-radius:15px;flex-direction:row;overflow-x:auto;padding:8px;margin-bottom:15px;white-space:nowrap;}
 #adminPanel .module-menu-brand {display:none;}
 #adminPanel .module-link {width:auto;flex:0 0 auto;padding:11px;}
 #adminPanel .module-content {margin-left:0;}
}
@media(max-width:640px){
 #adminPanel .module-link {font-size:12px;}
 #adminPanel .module-content {gap:12px;}
 #adminPanel .module-breadcrumb {margin-bottom:4px;}
}

/* Indicadores del módulo de lecturas pendientes */
#adminPanel .pending-card { background: #fff; }
#pendingMetrics { display: grid; grid-template-columns: repeat(3,minmax(0,1fr)); gap: 14px; background:transparent; padding:0; margin: 20px 0; }
#pendingMetrics .metric-item { display:flex; flex-direction:column; gap:7px; border:1px solid #e4eaf4; border-radius:17px; background:#f7faff; padding:18px 20px; color:#19477e; }
#pendingMetrics .metric-item strong { font-size:28px; line-height:1; }
#pendingMetrics .metric-item small { color:#60718a; font-weight:600; }
#pendingMetrics .metric-late { background:#fff7ed; border-color:#fed7aa; color:#c2410c; }
#adminPanel .pending-table {width:100%; border-collapse:collapse;}
#adminPanel .pending-table th {text-align:left; background:#f1f5fc; padding:16px; font-size:13px; color:#4c6080;}
#adminPanel .pending-table td {padding:17px 16px; border-top:1px solid #e6edf6; font-size:14px;}
#adminPanel .pending-table tr:hover td {background:#f8fbff;}
#adminPanel .pending-en_progreso {color:#1d4ed8; font-weight:800;}
#adminPanel .pending-no_iniciado {color:#a16207; font-weight:800;}
#adminPanel .pending-vencido {color:#b91c1c; font-weight:800;}
@media(max-width:680px){#pendingMetrics{grid-template-columns:1fr;}#adminPanel .pending-table-wrap{overflow-x:auto;}}

/* Navegación plegable */
.toggle-menu{background:#ffffff24;color:white;border:0;border-radius:10px;padding:10px 13px;cursor:pointer;margin:0 0 12px;font-size:20px}
.admin-layout.sidebar-collapsed{grid-template-columns:86px minmax(0,1fr)!important}
.admin-layout.sidebar-collapsed .module-menu{width:86px!important;min-width:86px!important;padding-inline:8px}
.admin-layout.sidebar-collapsed .module-menu-brand strong,.admin-layout.sidebar-collapsed .module-menu-brand small,.admin-layout.sidebar-collapsed .module-link span{display:none}
.admin-layout.sidebar-collapsed .module-link{justify-content:center;font-size:18px}
.mobile-menu-row{display:none}
@media(max-width:900px){.mobile-menu-row{display:block;margin-bottom:12px}.admin-layout.sidebar-collapsed .module-menu{display:none}.admin-layout.sidebar-collapsed{display:block!important}.admin-layout.sidebar-collapsed .module-content{width:100%}}
/* Tarjetas refinadas */
.module-content .card,.module-content .stat-card{box-shadow:0 18px 44px rgba(19,43,93,.065)}
.module-link{transition:background .2s ease,transform .2s ease}
.module-link:hover{transform:translateX(2px)}

/* Panel ejecutivo estilo oscuro */
.executive-dashboard{color:#ecf3ff;display:grid;gap:22px;margin-bottom:25px}.exec-welcome{background:linear-gradient(120deg,#151b3c,#162354);border:1px solid #323d81;border-radius:20px;padding:26px 30px;display:flex;justify-content:space-between;align-items:center;gap:15px}.exec-welcome h1{color:#fff;font-size:clamp(25px,2.5vw,36px);margin:6px 0 8px}.exec-welcome p{color:#aebadc;margin:0}.exec-kicker{color:#8ea7ff;font-size:11px;font-weight:800;letter-spacing:2px}.exec-online{border-radius:30px;padding:11px 16px;background:#1a3655;color:#9cecc1;white-space:nowrap;font-size:13px}.exec-kpi-grid{display:grid;grid-template-columns:repeat(5,minmax(0,1fr));gap:14px}.exec-kpi{background:#141b3b;border:1px solid #293766;border-radius:17px;padding:20px;position:relative;box-shadow:0 15px 25px #11204724}.exec-kpi span{font-size:10px;font-weight:800;letter-spacing:1px;color:#a4b4d9}.exec-kpi strong{display:block;font-size:35px;color:#fff;margin:9px 0 6px}.exec-kpi small{font-size:11px;color:#90a2c9}.exec-dot{position:absolute;right:18px;top:20px;height:10px;width:10px;border-radius:50%}.exec-dot.cyan{background:#22d3ee}.exec-dot.green{background:#22c55e}.exec-dot.amber{background:#f59e0b}.exec-dot.rose{background:#fb7185}.exec-dot.purple{background:#a78bfa}.exec-charts{display:grid;grid-template-columns:1fr 1fr;gap:18px}.exec-panel{background:#141b3b;border:1px solid #293766;border-radius:19px;padding:24px;min-width:0}.exec-panel h2{font-size:17px;color:#f8faff;margin:0 0 6px}.exec-panel p{font-size:12px;color:#8d9fc5;margin:0}.exec-donut-layout{display:flex;align-items:center;justify-content:space-around;gap:15px;padding-top:20px}.exec-donut{width:190px;height:190px;flex-shrink:0;border-radius:50%;display:grid;place-items:center;background:#273457}.exec-donut>div{background:#141b3b;border-radius:50%;width:136px;height:136px;display:flex;flex-direction:column;align-items:center;justify-content:center}.exec-donut strong{font-size:38px;color:white}.exec-donut small{color:#a3b6dc}.exec-legend{display:grid;gap:15px;min-width:125px}.exec-legend span{display:flex;align-items:center;gap:8px;color:#bed0f3;font-size:12px}.exec-legend strong{margin-left:auto;color:white}.exec-legend i{width:9px;height:9px;border-radius:50%;flex-shrink:0}.legend-green{background:#22c55e}.legend-amber{background:#f59e0b}.legend-rose{background:#fb7185}.exec-material-bars{margin-top:20px;display:grid;gap:17px;max-height:255px;overflow:auto}.exec-material-bars>p{color:#a4b4d9}.exec-material-line{display:flex;justify-content:space-between;gap:10px;margin-bottom:9px;font-size:12px;color:#d6e1fa}.exec-material-line span{overflow:hidden;text-overflow:ellipsis;white-space:nowrap}.exec-material-line strong{white-space:nowrap;font-size:11px;color:#91e5ff}.exec-material-track{height:9px;border-radius:20px;background:#2b3762;overflow:hidden}.exec-material-track>div{height:100%;border-radius:20px;background:linear-gradient(90deg,#4f66ff,#12d5df)}.exec-bottom{display:grid;grid-template-columns:1fr 2fr;gap:18px}.exec-total span{display:block;color:#a4b4d9;font-size:11px;letter-spacing:1px;font-weight:800}.exec-total strong{display:block;font-size:36px;color:white;margin:12px 0 5px}.exec-total small{color:#8d9fc5}.exec-actions>div{display:flex;flex-wrap:wrap;gap:9px;margin-top:17px}.exec-actions button{border:1px solid #3b4b85;background:#243463;color:#e4edff;border-radius:11px;padding:11px 14px;cursor:pointer;font-weight:700}.exec-actions button:hover{background:#3652a0}.exec-error{color:#ffb4bc;font-size:12px}.admin-layout[data-current-panel="dashboard"] .executive-dashboard{display:grid}.admin-layout:not([data-current-panel="dashboard"]) .executive-dashboard{display:none}@media(max-width:1150px){.exec-kpi-grid{grid-template-columns:repeat(3,minmax(0,1fr))}.exec-charts{grid-template-columns:1fr}}@media(max-width:700px){.exec-kpi-grid{grid-template-columns:repeat(2,minmax(0,1fr))}.exec-bottom{grid-template-columns:1fr}.exec-welcome{flex-direction:column;align-items:flex-start}.exec-donut-layout{flex-wrap:wrap}}@media(max-width:430px){.exec-kpi-grid{grid-template-columns:1fr}}

/* Dashboard Bootstrap 5: aspecto luminoso y mejor jerarquía */
.executive-dashboard{display:block!important;color:#142743;font-family:Inter,system-ui,sans-serif}
#adminPanel[data-current-panel="dashboard"] .executive-dashboard{display:block!important}
#adminPanel[data-current-panel]:not([data-current-panel="dashboard"]) .executive-dashboard{display:none!important}
.executive-dashboard .card{background:#fff;border:1px solid #e3eaf5;box-shadow:0 10px 28px rgba(21,39,74,.05);border-radius:20px}
.executive-dashboard .dash-intro{padding:4px 0 0}
.dash-overline{display:block;color:#4658b9;font-weight:800;font-size:11px;letter-spacing:1.6px;margin-bottom:8px}
.dash-intro h1{color:#152442;font-size:clamp(26px,2.9vw,38px);font-weight:800;letter-spacing:-.7px;margin:0 0 8px}
.dash-intro p{color:#6c7e9a;font-size:14px;margin:0}
.dash-refresh{border-radius:12px!important;font-weight:700!important;font-size:13px!important;padding:11px 15px!important}
.dash-stat .card-body{padding:23px 20px 19px!important;min-height:173px;display:flex;flex-direction:column;align-items:flex-start}
.dash-stat-icon{display:inline-grid;place-items:center;width:37px;height:37px;border-radius:12px;font-size:20px;font-weight:800;margin-bottom:13px}
.dash-stat-icon.cyan{background:#e4f6fc;color:#0891b2}.dash-stat-icon.green{background:#e1f7ed;color:#0e9f6e}.dash-stat-icon.orange{background:#fff1dd;color:#e58e19}.dash-stat-icon.pink{background:#ffebef;color:#e75d83}.dash-stat-icon.violet{background:#efeaff;color:#7c59d9}
.dash-label{color:#657692;font-weight:750;font-size:11px;letter-spacing:.65px;text-transform:uppercase}
.dash-stat strong{font-size:33px;color:#172848;font-weight:800;line-height:1.12;letter-spacing:-1px;margin:7px 0 5px}
.dash-stat small{font-size:12px;color:#8190a7}
.dash-panel h2{font-size:17px;font-weight:800;color:#162949;margin:0 0 6px}
.dash-panel-heading p{font-size:12px;color:#8996ad;margin:0 0 22px}
.dash-donut-layout{display:flex;align-items:center;justify-content:space-around;gap:15px;flex-wrap:wrap;min-height:230px}
.dash-donut{width:184px;height:184px;border-radius:50%;display:grid;place-items:center;background:#e9eff8;position:relative;flex-shrink:0}
.dash-donut:before{content:'';position:absolute;inset:23px;border-radius:50%;background:#fff}
.dash-donut>div{z-index:1;text-align:center;display:flex;flex-direction:column}
.dash-donut strong{font-size:31px;font-weight:800;color:#1a2c4d}
.dash-donut small{color:#8090a8;font-size:12px}
.dash-legend{display:grid;gap:14px;min-width:155px;flex:1;max-width:220px}
.dash-legend>div{display:flex;justify-content:space-between;gap:14px;font-size:12px;color:#667691}
.dash-legend strong{font-size:13px;color:#1e3252}
.legend-dot{width:8px;height:8px;display:inline-block;border-radius:50%;margin-right:5px}
.legend-dot.green{background:#14b87f}.legend-dot.orange{background:#f6ab37}.legend-dot.pink{background:#ed7093}
.dash-materials{display:grid;gap:17px;max-height:310px;overflow-y:auto;min-height:200px}
.exec-material-item{display:grid;gap:7px}.exec-material-line{display:flex;justify-content:space-between;gap:15px;font-size:12px;color:#566882}.exec-material-line span{font-weight:650}.exec-material-line strong{color:#263f67;white-space:nowrap}
.exec-material-track{height:9px;border-radius:999px;background:#edf2f9;overflow:hidden}.exec-material-track>div{height:100%;border-radius:999px;background:linear-gradient(90deg,#6388f8,#6b5be8)}
.dash-page-total{display:block;font-size:42px;color:#1c3c8f;font-weight:800;line-height:1.4}
.executive-dashboard .btn{border-radius:11px;font-weight:700;font-size:13px;padding:11px 16px}
.executive-dashboard .alert{border-radius:14px;font-size:13px}
@media(max-width:1200px){.dash-stat .card-body{min-height:153px}}
@media(max-width:640px){.dash-donut-layout{justify-content:center}.dash-legend{max-width:none}.dash-stat .card-body{min-height:140px}}


/* Estructura fija del administrador: solo el contenido central tiene scroll. */
@media (min-width: 1061px) {
  body.admin-logged-in { height: 100dvh; overflow: hidden; }
  body.admin-logged-in .app-shell { height: 100dvh; min-height: 0; overflow: hidden; }
  body.admin-logged-in .topbar {
    position: fixed; inset: 12px 20px auto; z-index: 100;
    margin: 0; width: calc(100% - 40px); max-width: none;
    height: 86px; padding: 12px 24px;
    border-radius: 18px;
  }
  body.admin-logged-in main.container {
    width: 100%; max-width: none; height: calc(100dvh - 110px);
    margin: 110px 0 0; padding: 0 18px;
    min-height: 0; flex: none;
  }
  body.admin-logged-in #adminPanel { height: 100%; min-height: 0; }
  body.admin-logged-in #adminPanel .module-menu {
    position: fixed; top: 110px; bottom: 14px; left: 18px;
    width: 244px; overflow-y: auto; overscroll-behavior: contain;
  }
  body.admin-logged-in #adminPanel .module-content {
    height: 100%; min-height: 0; margin-left: 262px;
    padding: 12px 20px 34px 10px; overflow-y: auto; overflow-x: hidden;
    overscroll-behavior-y: contain; scrollbar-gutter: stable;
  }
  body.admin-logged-in #adminPanel.sidebar-collapsed .module-content { margin-left: 104px; }
  body.admin-logged-in #adminPanel.sidebar-collapsed .module-menu { width: 86px !important; }
  body.admin-logged-in .footer { display: none; }
  body.admin-logged-in #out:not(:empty) {
    position: fixed; z-index: 110; right: 28px; bottom: 22px;
    max-width: 430px; margin: 0; padding: 12px 17px;
    background: white; border: 1px solid #d8e3f3; border-radius: 12px;
    box-shadow: 0 12px 35px #0c21452a;
  }
}
@media (max-width: 1060px) {
  body.admin-logged-in .topbar { position: sticky; top: 8px; z-index: 100; }
  body.admin-logged-in #adminPanel .module-content { overflow: visible; }
}

/* Reporte de cumplimiento - Bootstrap */
#adminPanel[data-current-panel="cumplimiento"] .compliance-view{display:block!important}
#adminPanel:not([data-current-panel="cumplimiento"]) .compliance-view{display:none!important}
.compliance-view{color:#172744;font-family:Inter,system-ui,sans-serif}.compliance-view .card{background:white;border:1px solid #e3eaf5;border-radius:20px;box-shadow:0 12px 28px #112d5110}.compliance-view .form-label{font-size:12px;color:#475c7e;font-weight:750}.compliance-view .form-select,.compliance-view .form-control{min-height:44px;border-radius:10px;border:1px solid #d9e4f3}.report-kpi{padding:19px;display:flex;align-items:center;gap:16px;min-height:120px}.report-kpi-icon{width:52px;height:52px;display:grid;place-items:center;border-radius:13px;font-size:24px;font-weight:800;flex-shrink:0}.report-kpi-icon.blue{background:#e4f0ff;color:#2764e4}.report-kpi-icon.green{background:#def8ed;color:#119a67}.report-kpi-icon.red{background:#ffebef;color:#e24665}.report-kpi-icon.orange{background:#fff2de;color:#df8b12}.report-kpi small,.report-kpi span{display:block;color:#617692;font-size:12px}.report-kpi strong{display:block;font-size:30px;line-height:1.3;color:#142747}.report-panel h2{font-size:17px;font-weight:800;color:#182b4a;margin:0 0 5px}.report-status-select{max-width:190px}.report-table{font-size:12px;min-width:730px}.report-table th{color:#4b6182;background:#f1f5fa;white-space:nowrap}.report-table td{color:#243b5e}.report-badge{display:inline-block;padding:5px 9px;border-radius:999px;font-size:11px;font-weight:750;white-space:nowrap}.report-badge.cumplio{background:#ddf8e9;color:#087b48}.report-badge.no_cumplio{background:#ffe8ed;color:#c83151}.report-badge.en_proceso{background:#fff1d7;color:#9b6506}.report-progress{display:inline-block;vertical-align:middle;width:65px;height:8px;border-radius:999px;overflow:hidden;background:#e7edf4;margin-right:7px}.report-progress div{height:100%;border-radius:999px}.report-progress .good{background:#12b981}.report-progress .bad{background:#f1627c}.report-progress .wait{background:#4d86f8}.report-donut{width:185px;height:185px;border-radius:50%;display:grid;place-items:center;background:#eaf0f7;flex-shrink:0;position:relative}.report-donut:before{content:'';position:absolute;inset:28px;border-radius:50%;background:white}.report-donut>div{position:relative;z-index:1;text-align:center}.report-donut strong,.report-donut small{display:block}.report-donut strong{font-size:30px;color:#142747}.report-donut small{font-size:12px;color:#647690}.report-legend{display:grid;gap:12px;font-size:12px;color:#4c6381}.report-legend div{display:flex;align-items:center;gap:7px}.report-legend strong{margin-left:auto;padding-left:12px}.compliance-view .progress{height:11px;background:#ebf1f9;border-radius:999px}.compliance-view .btn{border-radius:11px;font-weight:700}.compliance-view .dash-intro h1{font-size:clamp(24px,2.7vw,37px)}

/* Vista principal: el reporte de cumplimiento reemplaza el dashboard anterior. */
#adminPanel .executive-dashboard { display: none !important; }
#adminPanel[data-current-panel="dashboard"] .compliance-view { display: block !important; }
#adminPanel:not([data-current-panel="dashboard"]) .compliance-view { display: none !important; }
/* Solo mostrar las tarjetas que corresponden al menú activo. */
#adminPanel[data-current-panel="dashboard"] .library-card,
#adminPanel[data-current-panel="dashboard"] .driver-card,
#adminPanel[data-current-panel="dashboard"] .pending-card,
#adminPanel[data-current-panel="dashboard"] .history-card { display: none !important; }
#adminPanel[data-current-panel="libros"] .driver-card,
#adminPanel[data-current-panel="libros"] .pending-card,
#adminPanel[data-current-panel="libros"] .history-card { display: none !important; }
#adminPanel[data-current-panel="conductores"] .library-card,
#adminPanel[data-current-panel="conductores"] .pending-card,
#adminPanel[data-current-panel="conductores"] .history-card { display: none !important; }
#adminPanel[data-current-panel="pendientes"] .library-card,
#adminPanel[data-current-panel="pendientes"] .driver-card,
#adminPanel[data-current-panel="pendientes"] .history-card { display: none !important; }
#adminPanel[data-current-panel="historial"] .library-card,
#adminPanel[data-current-panel="historial"] .driver-card,
#adminPanel[data-current-panel="historial"] .pending-card { display: none !important; }

/* Dashboard único: reporte de cumplimiento, sin resumen ejecutivo duplicado. */
#adminPanel[data-current-panel="dashboard"] .compliance-view {display:block !important;}
#adminPanel:not([data-current-panel="dashboard"]) .compliance-view {display:none !important;}
#adminPanel[data-current-panel="dashboard"] .dashboard-grid {display:none !important;}
