@import url('https://fonts.googleapis.com/css2?family=Anaheim:wght@400;500;700&display=swap');

:root {
  --green: #51bd6c;
  --blue: #0c3865;
  --bg: #f4f7fb;
  --text: #1f2937;
  --white: #fff;
  --border: #dbe4ef;
}

* { box-sizing: border-box; }
body { margin: 0; font-family: 'Anaheim', Arial, sans-serif; color: var(--text); background: var(--bg); }

.login-body { display: flex; min-height: 100vh; align-items: center; justify-content: center; background: linear-gradient(130deg, var(--blue), var(--green)); }
.login-card { width: 360px; background: var(--white); border-radius: 10px; padding: 24px; box-shadow: 0 16px 40px rgba(0, 0, 0, 0.18); }
.login-logo { margin: 0 0 12px; text-align: center; }
.login-logo img { max-width: 100%; height: auto; display: block; margin: 0 auto; }
.login-subtitle { margin: 0 0 14px; color: #4b5563; text-align: center; font-size: 15px; }
.login-heading { margin: 0 0 8px; color: var(--blue); font-size: 1.25rem; text-align: center; }
.login-card p { margin: 0 0 14px; color: #4b5563; }

label { display: block; margin: 8px 0 4px; font-size: 13px; font-weight: bold; color: #334155; }
input, select, button {
  width: 100%;
  padding: 10px;
  border-radius: 8px;
  border: 1px solid #cbd5e1;
  transition: box-shadow 0.16s ease, border-color 0.16s ease;
}
input:focus, select:focus {
  outline: none;
  border-color: #79a7d5;
  box-shadow: 0 0 0 3px rgba(12, 56, 101, 0.12);
}
button { background: var(--green); color: #fff; border: none; cursor: pointer; font-weight: bold; }
button.secondary { background: var(--blue); }
button.danger { background: #dc2626; }

.alert { margin-bottom: 10px; border-radius: 6px; padding: 10px; font-size: 13px; }
.alert.error { background: #fee2e2; color: #991b1b; }
.alert.success { background: #dcfce7; color: #166534; }
.link-btn { display: inline-block; margin-top: 10px; color: var(--blue); }

.app-body { display: flex; min-height: 100vh; }
.sidebar { width: 240px; background: var(--blue); color: #fff; padding: 18px; }
.sidebar .brand {
  margin-bottom: 16px;
  padding: 4px 0;
  display: flex;
  justify-content: center;
  align-items: center;
  width: 100%;
  box-sizing: border-box;
}
/* Logo sidebar: centrado y monocromo blanco (por defecto y cliente) */
.sidebar .brand img {
  max-width: 100%;
  width: auto;
  height: auto;
  max-height: 64px;
  display: block;
  object-fit: contain;
  object-position: center;
  margin: 0 auto;
  filter: brightness(0) invert(1);
}
.user-box { margin-bottom: 16px; padding-bottom: 12px; border-bottom: 1px solid rgba(255, 255, 255, 0.3); }
.user-box small { display: block; margin-top: 4px; color: #bfdbfe; }
.user-sidebar-cargo { margin-top: 2px !important; font-size: 12px; color: #e2e8f0; line-height: 1.3; }
.sidebar-avatar {
  margin-top: 12px;
  display: flex;
  justify-content: center;
}
.sidebar-avatar img {
  width: 72px;
  height: 72px;
  border-radius: 50%;
  object-fit: cover;
  border: 2px solid rgba(255, 255, 255, 0.35);
  display: block;
}
.sidebar-avatar-placeholder {
  width: 72px;
  height: 72px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  background: rgba(255, 255, 255, 0.14);
  color: #fff;
  font-size: 1.35rem;
  font-weight: 700;
  letter-spacing: 0.02em;
  border: 2px solid rgba(255, 255, 255, 0.25);
}
.app-mobile-header {
  display: none;
}

.sidebar-nav {
  display: flex;
  flex-direction: column;
}
.sidebar-nav-link {
  display: flex;
  align-items: center;
  gap: 10px;
  text-decoration: none;
  color: #fff;
  padding: 10px;
  border-radius: 6px;
  margin-bottom: 8px;
  background: rgba(255, 255, 255, 0.08);
}
.sidebar-nav-link:hover {
  background: rgba(255, 255, 255, 0.22);
}
.sidebar-nav-link--logout {
  margin-top: 6px;
  background: rgba(220, 38, 38, 0.22);
}
.sidebar-nav-link--logout:hover {
  background: rgba(220, 38, 38, 0.38);
}
.nav-icon {
  width: 22px;
  height: 22px;
  flex-shrink: 0;
  display: flex;
  align-items: center;
  justify-content: center;
}
.nav-icon svg {
  width: 100%;
  height: 100%;
  display: block;
}
.nav-label {
  flex: 1;
  min-width: 0;
}
.nav-label-short {
  display: none;
}

.main-content { flex: 1; min-width: 0; }
.main-content iframe { width: 100%; height: 100vh; border: none; background: var(--bg); }

.module-body { padding: 18px; }
h2 { margin-top: 0; color: var(--blue); }
.form-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 12px;
  background: #fff;
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 14px;
  box-shadow: 0 6px 20px rgba(15, 23, 42, 0.05);
}
.form-grid-clients .span-2 { grid-column: span 2; }
.form-hint { margin: 6px 0 0; font-size: 13px; color: #64748b; line-height: 1.4; }
.form-hint img { max-height: 48px; max-width: 160px; object-fit: contain; vertical-align: middle; margin-left: 8px; border-radius: 4px; }
.checkbox-inline { display: flex; align-items: center; gap: 8px; margin-top: 10px; font-size: 14px; cursor: pointer; }
.form-actions { display: flex; align-items: end; gap: 8px; }
.form-actions button { width: auto; min-width: 110px; }

.table-wrap {
  margin-top: 16px;
  background: #fff;
  border: 1px solid var(--border);
  border-radius: 10px;
  overflow: auto;
  box-shadow: 0 6px 20px rgba(15, 23, 42, 0.05);
}
table { width: 100%; border-collapse: collapse; }
th, td { border-bottom: 1px solid var(--border); text-align: left; padding: 8px; font-size: 13px; }
th { background: #eff6ff; color: var(--blue); }
.clients-table-logo {
  object-fit: contain;
  vertical-align: middle;
  border-radius: 4px;
  background: #f8fafc;
}
td button { width: auto; padding: 6px 8px; margin-right: 4px; font-size: 12px; }
tbody tr:hover { background: #f8fbff; }
.section-title { margin: 18px 0 8px; color: var(--blue); font-size: 18px; }
.req-block { margin-top: 18px; }
.form-grid-req { grid-template-columns: repeat(4, minmax(0, 1fr)); }
.assign-dialog {
  width: min(1100px, 96vw);
  border: none;
  border-radius: 12px;
  padding: 0;
}
.assign-dialog::backdrop {
  background: rgba(12, 56, 101, 0.45);
}
.assign-header,
.assign-footer {
  padding: 12px 14px;
  border-bottom: 1px solid var(--border);
  display: flex;
  justify-content: space-between;
  align-items: center;
}
.assign-footer {
  border-top: 1px solid var(--border);
  border-bottom: none;
  justify-content: flex-end;
}
.assign-header h3 { margin: 0; color: var(--blue); }
.assign-body {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 14px;
  padding: 14px;
}
.assign-left, .assign-right {
  background: #fff;
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 10px;
  min-height: 380px;
}
.areas-tree { max-height: 420px; overflow: auto; }
.area-node { border: 1px solid var(--border); border-radius: 8px; margin-bottom: 10px; }
.area-node > summary {
  padding: 8px 10px;
  cursor: grab;
  font-weight: bold;
  color: var(--blue);
}
.req-tree-list { list-style: none; margin: 0; padding: 6px 10px 10px; }
.req-tree-list li {
  margin: 6px 0;
  border: 1px dashed #b6c6dd;
  border-radius: 6px;
  padding: 8px;
  cursor: grab;
  background: #f8fbff;
  font-size: 13px;
}
.drop-zone {
  min-height: 330px;
  border: 2px dashed #9fb7d6;
  border-radius: 8px;
  padding: 10px;
  background: #f8fbff;
}
.drop-zone.drop-over {
  border-color: var(--green);
  background: #edfdf1;
}
.drop-hint {
  margin: 0 0 8px;
  color: #64748b;
  font-size: 13px;
}
.assigned-list {
  list-style: none;
  margin: 0;
  padding: 0;
  display: flex;
  flex-direction: column;
  gap: 8px;
}
.assigned-item {
  display: flex;
  justify-content: space-between;
  gap: 8px;
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 8px 10px;
  background: #fff;
  align-items: center;
}
.assigned-empty {
  color: #64748b;
  font-size: 13px;
}
.stats-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 10px;
  margin-bottom: 14px;
}
.stat-card {
  background: #fff;
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 12px;
}
.stat-card small {
  display: block;
  color: #64748b;
  margin-bottom: 6px;
}
.stat-card strong {
  font-size: 24px;
  color: var(--blue);
}
.stat-card.success strong { color: #15803d; }
.stat-card.warning strong { color: #b45309; }
.stat-card.danger strong { color: #b91c1c; }
.area-section { margin-top: 8px; }
.badge {
  display: inline-block;
  padding: 4px 8px;
  border-radius: 999px;
  font-size: 12px;
  font-weight: bold;
}
.badge-success { background: #dcfce7; color: #166534; }
.badge-warning { background: #fef3c7; color: #92400e; }
.badge-danger { background: #fee2e2; color: #991b1b; }

.upload-input {
  border: 1px dashed #9fb7d6;
  background: #f8fbff;
  padding: 8px;
  border-radius: 8px;
  font-size: 12px;
}
.upload-input::file-selector-button {
  border: none;
  border-radius: 6px;
  padding: 6px 10px;
  margin-right: 8px;
  background: var(--blue);
  color: #fff;
  cursor: pointer;
}
.btn-upload {
  margin-top: 6px;
  width: auto;
  min-width: 90px;
  font-size: 12px;
  padding: 7px 10px;
}

.req-order-cell {
  width: 42px;
  text-align: center;
  color: #64748b;
  cursor: grab;
  user-select: none;
  font-size: 14px;
  white-space: nowrap;
}
tr.req-row-draggable td.req-order-cell:active {
  cursor: grabbing;
}
tr.req-row-draggable.req-dragging {
  opacity: 0.55;
}
.req-order-handle {
  margin-right: 4px;
}
.req-order-btn {
  width: auto;
  min-width: 24px;
  padding: 2px 6px;
  margin: 0 1px;
  font-size: 11px;
  line-height: 1.1;
  background: #e2e8f0;
  color: #0f172a;
}
.req-order-btn:hover {
  background: #cbd5e1;
}

/* Modal nativo: capa superior del documento (mejor que fixed dentro del formulario) */
dialog.save-dialog {
  margin: auto;
  border: none;
  padding: 0;
  background: transparent;
  max-width: none;
  max-height: none;
}
dialog.save-dialog::backdrop {
  background: rgba(12, 56, 101, 0.45);
  backdrop-filter: blur(2px);
}
/* Fallback si showModal no existe y solo se usa atributo open */
dialog.save-dialog[open] {
  position: fixed;
  inset: 0;
  z-index: 2147483647;
  width: 100vw;
  max-width: 100vw;
  height: 100%;
  display: flex;
  align-items: center;
  justify-content: center;
  box-sizing: border-box;
}
.save-overlay-box {
  background: var(--white);
  padding: 28px 36px;
  border-radius: 12px;
  box-shadow: 0 12px 40px rgba(0, 0, 0, 0.2);
  text-align: center;
  min-width: 200px;
}
.save-overlay-box p {
  margin: 14px 0 0;
  font-weight: bold;
  color: var(--blue);
  font-size: 15px;
}
.save-spinner {
  width: 40px;
  height: 40px;
  margin: 0 auto;
  border: 4px solid var(--border);
  border-top-color: var(--green);
  border-radius: 50%;
  animation: save-spin 0.75s linear infinite;
}
@keyframes save-spin {
  to { transform: rotate(360deg); }
}

.toast-root {
  position: fixed;
  top: 14px;
  right: 14px;
  z-index: 2147483647;
  display: flex;
  flex-direction: column;
  gap: 10px;
  pointer-events: none;
}
.toast {
  min-width: 260px;
  max-width: 420px;
  padding: 12px 14px;
  border-radius: 10px;
  color: #fff;
  font-size: 13px;
  line-height: 1.35;
  box-shadow: 0 12px 24px rgba(0, 0, 0, 0.2);
  transform: translateY(-8px);
  opacity: 0;
  transition: transform 0.2s ease, opacity 0.2s ease;
  pointer-events: auto;
  cursor: pointer;
}
.toast.show {
  transform: translateY(0);
  opacity: 1;
}
.toast-info { background: #334155; }
.toast-success { background: #15803d; }
.toast-error { background: #b91c1c; }

.overdue-modal {
  width: min(520px, 92vw);
  max-width: 100%;
  border: none;
  border-radius: 14px;
  padding: 0;
  margin: auto;
  box-shadow: 0 24px 60px rgba(127, 29, 29, 0.35);
  overflow: hidden;
  z-index: 2147483000;
}
.overdue-modal::backdrop {
  background: rgba(127, 29, 29, 0.4);
  backdrop-filter: blur(2px);
}
.overdue-head {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 10px;
  padding: 14px 16px;
  background: linear-gradient(90deg, #b91c1c, #ef4444);
  color: #fff;
}
.overdue-head h3 {
  margin: 0;
  font-size: 20px;
  font-weight: 700;
  color: #fff;
}
.overdue-head .secondary {
  width: auto;
  min-width: 90px;
  background: rgba(255, 255, 255, 0.2);
  color: #fff;
  border: 1px solid rgba(255, 255, 255, 0.4);
}
.overdue-body {
  padding: 18px 16px 20px;
  background: #fff5f5;
  color: #7f1d1d;
  font-size: 16px;
  line-height: 1.45;
}
.overdue-body p {
  margin: 0;
}

@media (max-width: 980px) {
  .form-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .assign-body { grid-template-columns: 1fr; }
  .stats-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .dash-hero-grid { grid-template-columns: 1fr !important; }
  .dash-gauge-row { grid-template-columns: 1fr !important; }
}

/* --- Dashboard --- */
.dashboard-module .dash-title { margin-bottom: 4px; }
.dash-subtitle { margin: 0 0 20px; color: #64748b; font-size: 15px; }
.dash-section-title { margin: 22px 0 12px; color: var(--blue); font-size: 1.1rem; }
.dash-empty { color: #64748b; margin: 12px 0; }
.dash-cta-wrap { margin-top: 18px; }
.dash-cta {
  display: inline-block;
  padding: 12px 20px;
  background: var(--green);
  color: #fff !important;
  text-decoration: none;
  border-radius: 10px;
  font-weight: 700;
  box-shadow: 0 8px 24px rgba(81, 189, 108, 0.35);
}
.dash-cta:hover { filter: brightness(1.05); }

.dash-user-stats { margin-bottom: 18px; }

.dash-gauge-row {
  display: grid;
  grid-template-columns: minmax(200px, 280px) 1fr;
  gap: 18px;
  align-items: stretch;
  margin-bottom: 8px;
}
.dash-gauge-card {
  background: #fff;
  border: 1px solid var(--border);
  border-radius: 14px;
  padding: 16px;
  text-align: center;
  box-shadow: 0 8px 28px rgba(15, 23, 42, 0.06);
}
.dash-gauge-card h3 { margin: 0 0 6px; font-size: 1rem; color: var(--blue); }
.gauge-caption { margin: 8px 0 0; font-size: 15px; color: #475569; }
.gauge-wrap { max-width: 220px; margin: 0 auto; }
.gauge-wrap-lg { max-width: 280px; }
.gauge-svg { display: block; width: 100%; height: auto; }
.gauge-arc { transition: stroke-dashoffset 0.6s ease; }

.dash-primary-box {
  background: linear-gradient(135deg, rgba(12, 56, 101, 0.06), rgba(81, 189, 108, 0.12));
  border: 1px solid var(--border);
  border-radius: 14px;
  padding: 18px 20px;
  box-shadow: 0 8px 28px rgba(15, 23, 42, 0.06);
}
.dash-primary-box h4 { margin: 0 0 8px; color: var(--blue); font-size: 0.95rem; text-transform: uppercase; letter-spacing: 0.04em; }
.dash-primary-name { margin: 0 0 12px; font-size: 1.35rem; font-weight: 700; color: #0f172a; }
.dash-primary-stats { display: flex; flex-wrap: wrap; gap: 12px; margin-bottom: 10px; font-size: 14px; }
.dash-primary-stats .bad { color: #b91c1c; font-weight: 700; }

.dash-bar {
  height: 10px;
  background: #e2e8f0;
  border-radius: 999px;
  overflow: hidden;
  margin: 6px 0;
}
.dash-bar.sm { height: 6px; }
.dash-bar > span {
  display: block;
  height: 100%;
  border-radius: 999px;
  background: linear-gradient(90deg, var(--green), #34d399);
  transition: width 0.5s ease;
}

.dash-area-pills {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
  gap: 12px;
}
.dash-area-pill {
  background: #fff;
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 12px 14px;
  box-shadow: 0 4px 16px rgba(15, 23, 42, 0.04);
}
.dash-area-pill strong { display: block; color: var(--blue); margin-bottom: 6px; }
.dash-pill-row { font-size: 12px; color: #64748b; display: flex; gap: 10px; flex-wrap: wrap; }
.dash-pill-row .ok { color: #15803d; }
.dash-pill-row .pv { color: #b45309; }
.dash-pill-row .vc { color: #b91c1c; }

.dash-req-table { width: 100%; border-collapse: collapse; font-size: 14px; }
.dash-req-table th, .dash-req-table td { padding: 10px 12px; text-align: left; border-bottom: 1px solid var(--border); }

.dash-admin-bar {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 12px;
  margin-bottom: 18px;
  padding: 14px 16px;
  background: #fff;
  border: 1px solid var(--border);
  border-radius: 12px;
}
.dash-filter-label { font-weight: 700; color: var(--blue); margin: 0; }
.dash-cliente-select { width: auto; min-width: 220px; max-width: 100%; }
.dash-admin-bar button { width: auto; min-width: 100px; }

.dash-hero-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 18px;
  margin-bottom: 24px;
}
.dash-hero-card {
  background: #fff;
  border: 1px solid var(--border);
  border-radius: 16px;
  padding: 20px 22px;
  box-shadow: 0 12px 36px rgba(12, 56, 101, 0.08);
}
.dash-hero-card h3 { margin: 0 0 6px; color: var(--blue); font-size: 1.2rem; }
.dash-hero-hint { margin: 0 0 16px; font-size: 13px; color: #64748b; line-height: 1.4; }
.dash-hero-metrics {
  display: flex;
  flex-wrap: wrap;
  gap: 14px 20px;
  margin-top: 12px;
  font-size: 14px;
  color: #475569;
}
.dash-hero-metrics em { font-style: normal; font-weight: 800; color: var(--blue); font-size: 1.1em; }
.dash-hero-metrics .metric-bad em { color: #b91c1c; }

.dash-rank-list { display: flex; flex-direction: column; gap: 12px; max-height: 420px; overflow-y: auto; }
.dash-rank-item {
  display: flex;
  gap: 12px;
  align-items: flex-start;
  padding: 10px 0;
  border-bottom: 1px solid #f1f5f9;
}
.dash-rank-item:last-child { border-bottom: none; }
.dash-rank-pos {
  flex-shrink: 0;
  width: 32px;
  height: 32px;
  border-radius: 10px;
  background: linear-gradient(135deg, var(--blue), #1e5a8a);
  color: #fff;
  font-weight: 800;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 14px;
}
.dash-rank-body { flex: 1; min-width: 0; }
.dash-rank-head { display: flex; justify-content: space-between; align-items: baseline; gap: 8px; margin-bottom: 4px; }
.dash-rank-head strong { color: #0f172a; font-size: 15px; }
.dash-rank-pct { font-weight: 800; color: var(--green); font-size: 1.05rem; }
.dash-rank-body small { color: #94a3b8; font-size: 12px; }

.dash-risk-section h3 { color: var(--blue); margin: 0 0 6px; }
.dash-risk-section .dash-hero-hint { margin-bottom: 12px; }

/* Visor de archivos — Mis requisitos */
.file-viewer-dialog {
  width: min(920px, 96vw);
  max-height: 92vh;
  border: none;
  border-radius: 12px;
  padding: 0;
  overflow: hidden;
  box-shadow: 0 24px 48px rgba(15, 23, 42, 0.2);
}
.file-viewer-dialog::backdrop {
  background: rgba(12, 56, 101, 0.5);
}
.file-viewer-shell {
  display: flex;
  flex-direction: column;
  max-height: 92vh;
  background: #fff;
}
.file-viewer-head {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 10px 14px;
  padding: 12px 16px;
  border-bottom: 1px solid var(--border);
  flex-shrink: 0;
}
.file-viewer-title {
  margin: 0;
  font-size: 1.05rem;
  color: var(--blue);
  flex: 1;
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.file-viewer-actions {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 10px;
}
.file-viewer-actions .secondary {
  width: auto;
  min-width: 88px;
}
.file-viewer-body {
  flex: 1;
  min-height: 50vh;
  max-height: calc(92vh - 64px);
  overflow: auto;
  background: #f8fafc;
}
.file-viewer-frame {
  width: 100%;
  min-height: 72vh;
  border: none;
  display: block;
  background: #525659;
}
.file-viewer-img {
  display: block;
  max-width: 100%;
  height: auto;
  margin: 0 auto;
  padding: 12px;
  box-sizing: border-box;
}
.file-viewer-fallback {
  padding: 28px 20px;
  text-align: center;
  color: var(--text);
}
.file-viewer-fallback-msg {
  margin: 0 0 14px;
  line-height: 1.5;
  max-width: 420px;
  margin-left: auto;
  margin-right: auto;
}
button.file-view-btn.link-btn {
  background: none;
  border: none;
  padding: 0;
  margin: 0;
  cursor: pointer;
  font: inherit;
  color: var(--blue);
  text-decoration: underline;
  text-align: left;
  width: auto;
  display: inline;
}

/* Mis requisitos — modo auditoría */
.myreq-toolbar {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 12px 16px;
  margin-bottom: 16px;
  padding: 12px 14px;
  background: #fff;
  border: 1px solid var(--border);
  border-radius: 10px;
  box-shadow: 0 4px 14px rgba(15, 23, 42, 0.04);
}
.myreq-audit-switch {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  cursor: pointer;
  user-select: none;
  font-weight: 600;
  color: var(--blue);
  position: relative;
}
.myreq-audit-switch input {
  position: absolute;
  opacity: 0;
  width: 0;
  height: 0;
}
.myreq-audit-switch-ui {
  position: relative;
  width: 44px;
  height: 24px;
  background: #cbd5e1;
  border-radius: 999px;
  flex-shrink: 0;
  transition: background 0.2s ease;
}
.myreq-audit-switch-ui::after {
  content: '';
  position: absolute;
  top: 2px;
  left: 2px;
  width: 20px;
  height: 20px;
  background: #fff;
  border-radius: 50%;
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.18);
  transition: transform 0.2s ease;
}
.myreq-audit-switch input:checked + .myreq-audit-switch-ui {
  background: var(--green);
}
.myreq-audit-switch input:checked + .myreq-audit-switch-ui::after {
  transform: translateX(20px);
}
.myreq-audit-switch input:focus-visible + .myreq-audit-switch-ui {
  outline: 2px solid var(--blue);
  outline-offset: 2px;
}
.myreq-audit-hint {
  margin: 0;
  flex: 1 1 100%;
  font-size: 13px;
  color: #64748b;
  line-height: 1.45;
}
body.myreq-audit-mode .myreq-stats {
  display: none;
}

.myreq-upload-cell {
  min-width: 11rem;
  vertical-align: top;
}
.myreq-upload-cell .upload-period-select {
  display: block;
  width: 100%;
  max-width: 16rem;
  margin-bottom: 0.4rem;
  font: inherit;
  padding: 0.35rem 0.5rem;
  border-radius: 6px;
  border: 1px solid var(--border);
  background: #fff;
}
.myreq-upload-cell .upload-input {
  display: block;
  margin-bottom: 0.35rem;
  max-width: 16rem;
}

.myreq-cal-resumen {
  max-width: 22rem;
  font-size: 13px;
  line-height: 1.45;
  color: var(--text);
}

.myreq-upload-no-slots {
  margin: 0 0 0.35rem;
  font-size: 12px;
  color: #b45309;
}

.myreq-sql-banner {
  margin: 0 0 1rem;
  padding: 12px 14px;
  background: #fff7ed;
  border: 1px solid #fdba74;
  border-radius: 8px;
  color: #9a3412;
  font-size: 14px;
  line-height: 1.5;
}

.audit-folder-grid,
.audit-doc-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(152px, 1fr));
  gap: 14px;
}
.audit-folder-card,
.audit-doc-card {
  display: flex;
  flex-direction: column;
  align-items: center;
  text-align: center;
  padding: 18px 12px;
  background: #fff !important;
  color: var(--text) !important;
  border: 1px solid var(--border);
  border-radius: 12px;
  box-shadow: 0 6px 20px rgba(15, 23, 42, 0.06);
  cursor: pointer;
  transition: box-shadow 0.15s ease, border-color 0.15s ease, transform 0.12s ease;
  font: inherit;
  width: 100%;
  box-sizing: border-box;
}
button.audit-folder-card,
button.audit-doc-card {
  font-weight: 500;
}
.audit-folder-card:hover,
.audit-doc-card:not(.audit-doc-card--empty):hover {
  border-color: #79a7d5;
  box-shadow: 0 10px 28px rgba(12, 56, 101, 0.12);
  transform: translateY(-2px);
}
.audit-folder-card:focus-visible,
.audit-doc-card:focus-visible {
  outline: 2px solid var(--green);
  outline-offset: 2px;
}
.audit-doc-card.audit-doc-card--empty {
  cursor: default;
  opacity: 0.75;
}
.audit-doc-card.audit-doc-card--empty:hover {
  transform: none;
  border-color: var(--border);
  box-shadow: 0 6px 20px rgba(15, 23, 42, 0.06);
}
.audit-folder-icon,
.audit-doc-icon {
  width: 48px;
  height: 48px;
  color: var(--blue);
  margin-bottom: 10px;
}
.audit-doc-card--empty .audit-doc-icon {
  color: #94a3b8;
}
.audit-folder-icon svg,
.audit-doc-icon svg {
  width: 100%;
  height: 100%;
  display: block;
}
.audit-folder-name,
.audit-doc-name {
  font-weight: 700;
  color: var(--blue);
  font-size: 14px;
  line-height: 1.3;
  word-break: break-word;
}
.audit-folder-meta,
.audit-doc-file {
  margin-top: 6px;
  font-size: 12px;
  color: #64748b;
  line-height: 1.3;
}
.audit-browse-top {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 12px;
  margin-bottom: 18px;
}
.audit-back-btn {
  width: auto;
  min-width: 100px;
}
.audit-area-title {
  margin: 0;
  flex: 1;
  min-width: 0;
  color: var(--blue);
  font-size: 1.15rem;
}

.audit-files-dialog {
  width: min(760px, 94vw);
  border: none;
  border-radius: 12px;
  padding: 0;
  overflow: hidden;
  box-shadow: 0 24px 48px rgba(15, 23, 42, 0.25);
}
.audit-files-dialog::backdrop {
  background: rgba(12, 56, 101, 0.45);
}
.audit-files-shell {
  background: #fff;
  max-height: 84vh;
  display: flex;
  flex-direction: column;
}
.audit-files-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 12px 14px;
  border-bottom: 1px solid var(--border);
}
.audit-files-title {
  margin: 0;
  color: var(--blue);
  font-size: 1.05rem;
}
.audit-files-head .secondary {
  width: auto;
  min-width: 84px;
}
.audit-files-body {
  padding: 12px;
  overflow: auto;
}
.audit-files-empty {
  margin: 10px 2px;
  color: #64748b;
}
.audit-files-list {
  display: grid;
  gap: 10px;
}
.audit-file-item {
  width: 100%;
  display: flex;
  align-items: center;
  gap: 10px;
  text-align: left;
  padding: 10px 12px;
  border: 1px solid var(--border);
  border-radius: 10px;
  background: #fff;
  color: inherit;
}
.audit-file-item:hover {
  border-color: #79a7d5;
  box-shadow: 0 6px 16px rgba(12, 56, 101, 0.08);
}
.audit-file-item-icon {
  width: 28px;
  height: 28px;
  color: var(--blue);
  flex-shrink: 0;
}
.audit-file-item-icon svg {
  width: 100%;
  height: 100%;
  display: block;
}
.audit-file-item-main {
  display: flex;
  flex-direction: column;
  min-width: 0;
}
.audit-file-item-main strong {
  color: #0f172a;
  font-size: 14px;
  line-height: 1.3;
  word-break: break-word;
}
.audit-file-item-main small {
  color: #64748b;
  margin-top: 2px;
  font-size: 12px;
}

/* --- Aula RyR: explorador de contenido (evita botones a ancho completo del CSS global) --- */
.aula-browse {
  background: var(--white);
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 12px 14px;
  box-shadow: 0 6px 20px rgba(15, 23, 42, 0.05);
}
.aula-breadcrumb {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 6px 10px;
  margin: 0 0 14px;
  font-size: 14px;
  color: #475569;
}
.aula-breadcrumb button {
  width: auto;
  padding: 6px 12px;
  font-size: 13px;
  font-weight: 600;
  background: #e2e8f0;
  color: var(--blue);
  border: 1px solid #cbd5e1;
}
.aula-breadcrumb button:hover {
  background: #dbeafe;
}
.aula-breadcrumb-sep {
  color: #94a3b8;
  user-select: none;
}
.aula-breadcrumb-current {
  font-weight: 700;
  color: var(--blue);
}
.aula-browse-list {
  display: flex;
  flex-direction: column;
  gap: 8px;
}
.aula-browse-row {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 12px 14px;
  border-radius: 10px;
  border: 1px solid var(--border);
  background: #fafcff;
  transition: background 0.15s ease, border-color 0.15s ease;
}
.aula-browse-row:hover {
  background: #f1f5f9;
  border-color: #c7d7ec;
}
.aula-browse-row--folder {
  cursor: pointer;
}
.aula-type-icon {
  flex-shrink: 0;
  width: 40px;
  height: 40px;
  border-radius: 10px;
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--white);
}
.aula-type-icon svg {
  width: 22px;
  height: 22px;
  display: block;
}
.aula-type-icon--folder { background: #0c3865; }
.aula-type-icon--doc { background: #2563eb; }
.aula-type-icon--video { background: #7c3aed; }
.aula-type-icon--eval { background: #059669; }
.aula-browse-main {
  flex: 1;
  min-width: 0;
}
.aula-browse-title {
  margin: 0;
  font-size: 15px;
  font-weight: 700;
  color: var(--text);
  line-height: 1.35;
}
.aula-browse-meta {
  margin: 4px 0 0;
  font-size: 12px;
  color: #64748b;
}
.aula-row-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  align-items: center;
  justify-content: flex-end;
}
.aula-row-actions button {
  width: auto;
  min-width: 0;
  padding: 8px 14px;
  font-size: 13px;
  white-space: nowrap;
}
.aula-row-actions button.aula-btn-ghost {
  background: transparent;
  color: var(--blue);
  border: 1px solid #94a3b8;
  font-weight: 600;
}
.aula-row-actions button.aula-btn-ghost:hover {
  background: #eff6ff;
}
.aula-browse-empty {
  margin: 0;
  padding: 20px;
  text-align: center;
  color: #64748b;
  font-size: 14px;
}
.aula-video-dialog {
  width: min(920px, 96vw);
  max-width: 96vw;
  border: none;
  border-radius: 12px;
  padding: 0;
  overflow: hidden;
}
.aula-video-dialog::backdrop {
  background: rgba(12, 56, 101, 0.45);
}
.aula-video-dialog-inner {
  padding: 0;
}
.aula-video-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 14px 16px;
  border-bottom: 1px solid var(--border);
  background: #fff;
}
.aula-video-title {
  margin: 0;
  font-size: 1.05rem;
  color: var(--blue);
  flex: 1;
  min-width: 0;
}
.aula-video-head button {
  width: auto;
  flex-shrink: 0;
}
.aula-video-body {
  padding: 0;
  background: #0f172a;
}
.aula-video-body iframe,
.aula-video-body video {
  display: block;
  width: 100%;
  min-height: min(52vh, 420px);
  border: 0;
  background: #000;
}
.aula-video-fallback {
  padding: 20px;
  color: #e2e8f0;
  font-size: 14px;
  text-align: center;
}
.aula-video-fallback a {
  color: #93c5fd;
}

/* --- Aula: reporte de cumplimiento --- */
.aula-cumplimiento-intro {
  margin: 0 0 16px;
  max-width: 720px;
  font-size: 14px;
  line-height: 1.5;
  color: #475569;
}
.aula-cumplimiento-filtro {
  margin-bottom: 20px;
}
.aula-cumplimiento-section-title {
  margin: 28px 0 6px;
  font-size: 1.05rem;
  color: var(--blue);
  font-weight: 700;
}
.aula-cumplimiento-section-title:first-of-type {
  margin-top: 8px;
}
.aula-cumplimiento-hint {
  margin: 0 0 8px;
  font-size: 13px;
  color: #64748b;
}
.aula-cumplimiento-table th {
  white-space: nowrap;
}
.aula-cumplimiento-login {
  color: #64748b;
  font-weight: 500;
  font-size: 12px;
}
.aula-cumplimiento-meta {
  display: block;
  margin-top: 4px;
  font-size: 12px;
  color: #64748b;
}
.aula-cumplimiento-nota {
  white-space: nowrap;
}
.aula-cumplimiento-empty {
  text-align: center;
  color: #64748b;
  padding: 16px !important;
}

/* --- Responsive: movil / tablet estrecha --- */
@media (max-width: 768px) {
  .login-body {
    padding: 16px;
    align-items: flex-start;
    padding-top: max(24px, env(safe-area-inset-top, 0px));
  }
  .login-card {
    width: 100%;
    max-width: 400px;
    margin: 0 auto;
  }

  .module-body {
    padding: 12px 12px 20px;
  }
  .module-body h2 {
    font-size: 1.2rem;
  }

  .form-grid {
    grid-template-columns: 1fr;
  }
  .form-grid-clients .span-2 {
    grid-column: span 1;
  }
  .form-actions {
    flex-direction: column;
    align-items: stretch;
  }
  .form-actions button {
    width: 100%;
  }

  .stats-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 8px;
  }
  .stat-card {
    padding: 10px;
  }
  .stat-card strong {
    font-size: 20px;
  }

  th, td {
    font-size: 12px;
    padding: 6px;
  }

  .aula-browse-row {
    flex-wrap: wrap;
  }
  .aula-row-actions {
    width: 100%;
    justify-content: flex-start;
    margin-top: 4px;
  }
  .aula-row-actions button {
    flex: 1;
    min-width: 120px;
  }

  .dash-area-pills {
    grid-template-columns: 1fr;
  }
  .file-viewer-dialog {
    width: 100vw;
    max-width: 100vw;
    max-height: 100dvh;
    margin: 0;
    border-radius: 0;
  }
  .file-viewer-shell {
    max-height: 100dvh;
  }
  .file-viewer-body {
    max-height: calc(100dvh - 56px);
  }
  .file-viewer-frame {
    min-height: 65dvh;
  }

  .app-body {
    flex-direction: column;
    min-height: 100dvh;
  }

  .app-mobile-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 10px;
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    z-index: 60;
    height: calc(48px + env(safe-area-inset-top, 0px));
    padding: 0 12px 0 calc(12px + env(safe-area-inset-left, 0px));
    padding-right: calc(12px + env(safe-area-inset-right, 0px));
    padding-top: env(safe-area-inset-top, 0px);
    box-sizing: border-box;
    background: var(--blue);
    color: #fff;
    box-shadow: 0 2px 14px rgba(12, 56, 101, 0.35);
  }
  .app-mobile-header-brand {
    display: flex;
    align-items: center;
    gap: 10px;
    min-width: 0;
    flex: 1;
  }
  .app-mobile-header-logo {
    width: 34px;
    height: 34px;
    object-fit: contain;
    flex-shrink: 0;
  }
  .app-mobile-header-logo.app-mobile-header-logo--default {
    filter: brightness(0) invert(1);
  }
  .app-mobile-header-logo.app-mobile-header-logo--cliente {
    filter: none;
  }
  .app-mobile-header-title {
    font-size: 14px;
    font-weight: 700;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
  }
  .app-mobile-header-user {
    flex-shrink: 0;
  }
  .app-mobile-header-avatar {
    width: 36px;
    height: 36px;
    border-radius: 50%;
    object-fit: cover;
    display: block;
    border: 2px solid rgba(255, 255, 255, 0.35);
  }
  .app-mobile-header-avatar--ph {
    display: flex;
    align-items: center;
    justify-content: center;
    background: rgba(255, 255, 255, 0.16);
    font-size: 12px;
    font-weight: 700;
    color: #fff;
  }

  .sidebar {
    position: fixed;
    bottom: 0;
    left: 0;
    right: 0;
    top: auto;
    width: 100%;
    max-width: 100%;
    padding: 6px 4px calc(6px + env(safe-area-inset-bottom, 0px));
    padding-left: calc(4px + env(safe-area-inset-left, 0px));
    padding-right: calc(4px + env(safe-area-inset-right, 0px));
    z-index: 55;
    border-top: 1px solid rgba(255, 255, 255, 0.2);
    box-shadow: 0 -10px 28px rgba(15, 23, 42, 0.2);
  }
  .sidebar .brand,
  .sidebar .user-box {
    display: none;
  }

  .sidebar-nav {
    flex-direction: row;
    flex-wrap: nowrap;
    overflow-x: auto;
    gap: 2px;
    margin: 0;
    padding: 0;
    -webkit-overflow-scrolling: touch;
    scrollbar-width: none;
  }
  .sidebar-nav::-webkit-scrollbar {
    display: none;
  }

  .sidebar-nav-link {
    flex: 1 0 auto;
    min-width: 58px;
    max-width: 88px;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 2px;
    margin-bottom: 0;
    padding: 6px 3px;
    font-size: 9px;
    line-height: 1.2;
    text-align: center;
    hyphens: auto;
  }
  .sidebar-nav-link .nav-icon {
    width: 22px;
    height: 22px;
  }
  .sidebar-nav-link .nav-label-full {
    display: none !important;
  }
  .sidebar-nav-link .nav-label-short {
    display: block !important;
    font-weight: 600;
    flex: none;
  }
  .sidebar-nav-link--logout {
    margin-top: 0;
  }

  .main-content {
    flex: 1;
    min-height: 0;
    width: 100%;
    padding-top: calc(48px + env(safe-area-inset-top, 0px));
    padding-bottom: calc(64px + env(safe-area-inset-bottom, 0px));
  }
  .main-content iframe {
    height: calc(
      100dvh - 48px - 64px - env(safe-area-inset-top, 0px) - env(safe-area-inset-bottom, 0px)
    );
    min-height: 200px;
  }
}

@media (max-width: 400px) {
  .stats-grid {
    grid-template-columns: 1fr;
  }
}

