:root {
  --pdl-navy: #16233f;
  --pdl-navy-2: #1e3a6e;
  --pdl-blue: #2563eb;
  --pdl-blue-hover: #1d4ed8;
  --pdl-blue-light: #eff6ff;
  --pdl-green: #22c55e;
  --pdl-green-bg: #dcfce7;
  --pdl-green-text: #166534;
  --pdl-amber-bg: #fef3c7;
  --pdl-amber-text: #854d0e;
  --pdl-red-bg: #fee2e2;
  --pdl-red-text: #991b1b;
  --pdl-info-bg: #e0f2fe;
  --pdl-info-text: #0369a1;
  --pdl-gray-bg: #eef1f6;
  --pdl-border: #e2e8f0;
  --pdl-text: #1e293b;
  --pdl-text-muted: #64748b;
}

html { font-size: 14px; }
@media (min-width: 768px) { html { font-size: 16px; } }

body {
  background: var(--pdl-gray-bg);
  color: var(--pdl-text);
}

.btn:focus, .btn:active:focus, .btn-link.nav-link:focus, .form-control:focus, .form-check-input:focus {
  box-shadow: 0 0 0 0.1rem white, 0 0 0 0.25rem var(--pdl-blue);
}

/* ---- App shell (sidebar + content) ---- */
.app-shell { display: flex; min-height: 100vh; align-items: stretch; }

.app-sidebar {
  width: 236px;
  flex-shrink: 0;
  background: var(--pdl-navy);
  color: #fff;
  display: flex;
  flex-direction: column;
  padding: 20px 12px;
  box-sizing: border-box;
  position: sticky;
  top: 0;
  height: 100vh;
  overflow-y: auto;
}

.app-logo {
  display: flex;
  align-items: center;
  gap: 9px;
  padding: 0 8px 20px;
  color: #fff;
  font-weight: 700;
  font-size: 14px;
  letter-spacing: .02em;
  text-decoration: none;
}
.app-logo:hover { color: #fff; }
.app-logo span { min-width: 0; }
.app-logo-icon {
  width: 28px; height: 28px;
  border-radius: 7px;
  background: var(--pdl-navy-2);
  color: #5ecbc0;
  display: flex; align-items: center; justify-content: center;
  flex-shrink: 0;
}

.app-nav { display: flex; flex-direction: column; gap: 1px; }
.app-nav-link {
  display: flex; align-items: center; gap: 10px;
  padding: 9px 12px; border-radius: 8px;
  font-size: 13px; font-weight: 500;
  color: #9fb0cc; text-decoration: none;
}
.app-nav-link:hover { color: #fff; background: rgba(255,255,255,.06); }
.app-nav-link.active { background: var(--pdl-navy-2); color: #fff; }
.app-nav-link svg { flex-shrink: 0; }

.app-nav-spacer { flex: 1; }

.app-user {
  display: flex; align-items: center; gap: 9px;
  padding: 10px 8px; border-top: 1px solid var(--pdl-navy-2);
  margin-top: 8px;
}
.app-user-avatar {
  width: 28px; height: 28px; border-radius: 50%;
  background: var(--pdl-blue); color: #fff;
  display: flex; align-items: center; justify-content: center;
  font-size: 11px; font-weight: 700; flex-shrink: 0;
}
.app-user-name { font-size: 12px; font-weight: 600; color: #fff; }
.app-user-role { font-size: 10.5px; color: #9fb0cc; }
.app-logout-btn {
  background: none; border: none; color: #9fb0cc;
  font-size: 13px; font-weight: 500;
  display: flex; align-items: center; gap: 10px;
  padding: 9px 12px; width: 100%; text-align: left; border-radius: 8px;
}
.app-logout-btn:hover { color: #fff; background: rgba(255,255,255,.06); }

.app-main { flex: 1; display: flex; flex-direction: column; min-width: 0; }
.app-topbar {
  height: 56px; flex-shrink: 0; background: #fff;
  border-bottom: 1px solid var(--pdl-border);
  display: flex; align-items: center; padding: 0 26px;
}
.app-topbar-title { font-size: 16px; font-weight: 700; color: var(--pdl-text); }
.app-content { flex: 1; padding: 22px 26px; box-sizing: border-box; }

/* ---- Bootstrap component retheme (Bootstrap 5.1, colors compiled — override directly) ---- */
a { color: var(--pdl-blue); }
a:hover { color: var(--pdl-blue-hover); }

.btn-primary {
  background-color: var(--pdl-blue) !important;
  border-color: var(--pdl-blue) !important;
}
.btn-primary:hover, .btn-primary:focus, .btn-primary:active {
  background-color: var(--pdl-blue-hover) !important;
  border-color: var(--pdl-blue-hover) !important;
}
.btn-outline-primary {
  color: var(--pdl-blue) !important;
  border-color: var(--pdl-blue) !important;
}
.btn-outline-primary:hover {
  background-color: var(--pdl-blue) !important;
  border-color: var(--pdl-blue) !important;
  color: #fff !important;
}

.card {
  border: 1px solid var(--pdl-border);
  border-radius: 10px;
  box-shadow: 0 1px 2px rgba(15, 23, 42, .04);
}

.table thead th {
  color: var(--pdl-text-muted);
  font-weight: 600;
  font-size: .82rem;
  border-bottom: 1px solid var(--pdl-border);
}
.table td { color: var(--pdl-text); vertical-align: middle; }

.badge.bg-success, .badge.text-bg-success { background-color: var(--pdl-green-bg) !important; color: var(--pdl-green-text) !important; }
.badge.bg-warning, .badge.text-bg-warning { background-color: var(--pdl-amber-bg) !important; color: var(--pdl-amber-text) !important; }
.badge.bg-danger, .badge.text-bg-danger { background-color: var(--pdl-red-bg) !important; color: var(--pdl-red-text) !important; }
.badge.bg-secondary, .badge.text-bg-secondary { background-color: #f1f5f9 !important; color: var(--pdl-text-muted) !important; }
.badge.bg-primary, .badge.text-bg-primary { background-color: var(--pdl-blue-light) !important; color: var(--pdl-blue) !important; }
.badge.bg-info, .badge.text-bg-info { background-color: var(--pdl-info-bg) !important; color: var(--pdl-info-text) !important; }

.nav-tabs { border-bottom: 1px solid var(--pdl-border); }
.nav-tabs .nav-link {
  border: none; color: var(--pdl-text-muted);
  font-size: .87rem; font-weight: 500;
}
.nav-tabs .nav-link.active {
  color: var(--pdl-navy-2); font-weight: 700;
  border: none; border-bottom: 2px solid var(--pdl-blue);
  background: none;
}

.form-select:focus, .form-control:focus {
  border-color: var(--pdl-blue);
  box-shadow: 0 0 0 .2rem rgba(37, 99, 235, .15);
}

.progress-bar.bg-success { background-color: var(--pdl-green) !important; }

.pagination .page-item.active .page-link {
  background-color: var(--pdl-blue) !important;
  border-color: var(--pdl-blue) !important;
}
.pagination .page-link { color: var(--pdl-blue); }

.alert-success { background-color: var(--pdl-green-bg); color: var(--pdl-green-text); border-color: transparent; }
.alert-danger { background-color: var(--pdl-red-bg); color: var(--pdl-red-text); border-color: transparent; }

/* ---- Expedientes: listado y detalle ---- */
.filter-bar { background: #fff; border: 1px solid var(--pdl-border); border-radius: 10px; padding: 14px 16px; }
.filter-bar .form-label { font-size: .74rem; font-weight: 600; color: var(--pdl-text-muted); text-transform: uppercase; letter-spacing: .03em; margin-bottom: 4px; }

.row-link { cursor: pointer; }
.row-link:hover { background-color: var(--pdl-blue-light); }

.folio-cell { font-family: var(--bs-font-monospace); font-size: .82rem; color: var(--pdl-text-muted); }
.cliente-cell { font-weight: 600; color: var(--pdl-text); }

.mini-progress { width: 84px; height: 6px; border-radius: 100px; background: var(--pdl-gray-bg); overflow: hidden; display: inline-block; vertical-align: middle; }
.mini-progress > span { display: block; height: 100%; background: var(--pdl-green); border-radius: 100px; }

.retencion-flag { display: inline-flex; align-items: center; gap: 4px; font-size: .78rem; }
.retencion-flag.warn { color: var(--pdl-amber-text); font-weight: 600; }
.retencion-flag.expired { color: var(--pdl-text-muted); }

.progress-ring { width: 88px; height: 88px; border-radius: 50%; flex-shrink: 0; display: flex; align-items: center; justify-content: center; }
.progress-ring-inner { width: 64px; height: 64px; border-radius: 50%; background: #fff; display: flex; flex-direction: column; align-items: center; justify-content: center; line-height: 1.1; }
.progress-ring-inner b { font-size: 1.05rem; }
.progress-ring-inner span { font-size: .62rem; color: var(--pdl-text-muted); text-transform: uppercase; letter-spacing: .03em; }

.doc-required {
  display: inline-block; width: 6px; height: 6px; border-radius: 50%;
  background: var(--pdl-blue); margin-right: 6px; vertical-align: middle;
}

.tab-icon { margin-right: 6px; opacity: .75; vertical-align: -2px; }

.expediente-header { display: flex; align-items: flex-start; justify-content: space-between; gap: 16px; flex-wrap: wrap; margin-bottom: 20px; }
.expediente-header .titles h1 { font-size: 1.3rem; font-weight: 700; margin-bottom: 2px; }
.expediente-header .titles .folio { font-family: var(--bs-font-monospace); font-size: .82rem; color: var(--pdl-text-muted); }
.expediente-header .actions { display: flex; gap: 8px; flex-wrap: wrap; }

/* ---- Auth pages (login, recuperar contraseña, portal) ---- */
.auth-shell { display: flex; min-height: 100vh; }

.auth-brand {
  flex: 0 0 44%;
  background: linear-gradient(160deg, var(--pdl-navy) 0%, var(--pdl-navy-2) 100%);
  color: #fff;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  padding: 48px;
  box-sizing: border-box;
}
.auth-brand-logo { display: flex; align-items: center; gap: 10px; font-weight: 700; font-size: 15px; letter-spacing: .02em; }
.auth-brand-logo-icon {
  width: 32px; height: 32px; border-radius: 9px;
  background: rgba(255,255,255,.08); color: #5ecbc0;
  display: flex; align-items: center; justify-content: center; flex-shrink: 0;
}
.auth-brand-body { margin-top: auto; margin-bottom: 18px; max-width: 380px; }
.auth-brand-title { font-size: 28px; font-weight: 700; line-height: 1.28; margin-bottom: 14px; }
.auth-brand-sub { color: #a9bad9; font-size: 14px; line-height: 1.6; }
.auth-brand-foot { color: #6b83ab; font-size: 12px; }

.auth-panel {
  flex: 1;
  min-width: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 32px;
  background: #fff;
  box-sizing: border-box;
}
.auth-card { width: min(380px, 100%); }
.auth-card h1 { font-size: 22px; font-weight: 700; margin-bottom: 4px; color: var(--pdl-text); }
.auth-subtitle { color: var(--pdl-text-muted); font-size: 13.5px; margin-bottom: 26px; }
.auth-card .form-label { font-size: 13px; font-weight: 600; color: var(--pdl-text); }
.auth-card .form-control { padding: 10px 12px; font-size: 14px; }
.auth-links { margin-top: 18px; font-size: 13.5px; text-align: center; }
.auth-links a { text-decoration: none; font-weight: 500; }
.auth-links a:hover { text-decoration: underline; }

@media (max-width: 860px) {
  .auth-brand { display: none; }
  .auth-panel { padding: 24px; }
}
