/**
 * Tema visual suave — Sistema Magistratura
 * Colores bajos en saturación, área de trabajo clara, menos fatiga visual.
 */

:root {
  --mag-bg-page: #eef1f4;
  --mag-bg-card: #ffffff;
  --mag-border: #dde3ea;
  --mag-sidebar-top: #4a6674;
  --mag-sidebar-bottom: #3d5562;
  --mag-sidebar-active: rgba(255, 255, 255, 0.14);
  --mag-accent: #5a7a8c;
  --mag-accent-hover: #4d6a7a;
  --mag-warm-highlight: #c9a961;
  --mag-danger-soft: #b85c5c;
  --mag-success-soft: #5a8f72;
  --mag-navbar: #ffffff;
  --mag-sidebar-header-bg: #f4f7fa;
  --mag-text: #2c3a44;
  --mag-text-muted: #5c6b78;
  --mag-sidebar-width: 280px;
  --success-color: #5a8f72;
  --warning-color: #c9a24a;
  --danger-color: #b85c5c;
  --accent-color: #5a7a8c;
  --dark-color: #2c3a44;
  --bs-primary: #5a7a8c;
  --bs-primary-rgb: 90, 122, 140;
  --bs-link-color: #4d6a7a;
  --bs-link-hover-color: #3d5562;
}

.app-body {
  background-color: var(--mag-bg-page) !important;
  color: var(--mag-text);
  font-family: 'Source Sans 3', 'Segoe UI', system-ui, sans-serif;
  -webkit-font-smoothing: antialiased;
}

/* ——— Shell: sidebar ——— */
.app-shell-sidebar {
  background: linear-gradient(185deg, var(--mag-sidebar-top) 0%, var(--mag-sidebar-bottom) 100%) !important;
  color: rgba(255, 255, 255, 0.92);
  box-shadow: 2px 0 24px rgba(45, 62, 72, 0.12);
}

.app-shell-sidebar-header {
  background: var(--mag-sidebar-header-bg) !important;
  border-color: rgba(45, 62, 72, 0.12) !important;
  box-shadow: inset 0 -1px 0 rgba(45, 62, 72, 0.08);
  padding-top: 1rem !important;
  padding-bottom: 1rem !important;
}

/* Botón colapsar en franja clara: icono oscuro legible */
.app-shell-sidebar-header .app-shell-icon-btn {
  color: var(--mag-text) !important;
  border-color: rgba(44, 58, 68, 0.22) !important;
  background: rgba(255, 255, 255, 0.85);
}

.app-shell-sidebar-header .app-shell-icon-btn:hover {
  background: #fff !important;
  color: var(--mag-text) !important;
  border-color: rgba(44, 58, 68, 0.3) !important;
}

.app-shell-sidebar-title {
  color: rgba(255, 255, 255, 0.96) !important;
  font-weight: 600;
  letter-spacing: 0.02em;
  font-size: 0.95rem;
  line-height: 1.25;
  max-width: 11rem;
}

.app-shell-sidebar-subtitle {
  color: rgba(255, 255, 255, 0.62) !important;
  font-size: 0.78rem;
}

.app-shell-sidebar-brand-logo {
  display: block;
  max-width: 100%;
  max-height: 3.5rem;
  width: auto;
  height: auto;
  object-fit: contain;
  object-position: left center;
}

.app-shell-sidebar .sidebar-section {
  color: rgba(255, 255, 255, 0.45) !important;
  letter-spacing: 0.06em;
}

.app-shell-sidebar .sidebar-link {
  color: rgba(255, 255, 255, 0.78) !important;
  border-radius: 8px;
  margin-inline: 8px;
  transition: background 0.2s ease, color 0.2s ease;
}

.app-shell-sidebar .sidebar-link:hover {
  color: #fff !important;
  background: rgba(255, 255, 255, 0.08) !important;
}

.app-shell-sidebar .sidebar-link.active,
.app-shell-sidebar .sidebar-link.active.bg-primary {
  background: var(--mag-sidebar-active) !important;
  color: #fff !important;
  border-left: 3px solid var(--mag-warm-highlight) !important;
  box-shadow: inset 0 0 0 1px rgba(255, 255, 255, 0.06);
}

.app-shell-icon-btn {
  color: rgba(255, 255, 255, 0.9);
  border: 1px solid rgba(255, 255, 255, 0.25);
  background: transparent;
}

.app-shell-icon-btn:hover {
  background: rgba(255, 255, 255, 0.1);
  color: #fff;
}

/* ——— Área principal ——— */
.app-shell-main {
  background: var(--mag-bg-page) !important;
}

.app-shell-navbar {
  background: var(--mag-navbar) !important;
  border-color: var(--mag-border) !important;
  border-bottom: 1px solid var(--mag-border) !important;
  box-shadow: 0 1px 0 rgba(45, 62, 72, 0.04);
}

/* Barra superior: botón menú con contraste sobre fondo claro */
.app-shell-navbar .app-shell-icon-btn {
  color: var(--mag-text) !important;
  border-color: rgba(44, 58, 68, 0.2) !important;
  background: rgba(248, 250, 252, 0.95);
}

.app-shell-navbar .app-shell-icon-btn:hover {
  background: var(--mag-bg-page) !important;
  color: var(--mag-text) !important;
  border-color: rgba(44, 58, 68, 0.28) !important;
}

.app-shell-nav-user {
  color: var(--mag-text) !important;
  font-weight: 500;
}

.app-shell-breadcrumb-link {
  color: var(--mag-text-muted) !important;
}

.app-shell-breadcrumb-link:hover {
  color: var(--mag-accent) !important;
}

.app-shell-breadcrumb-active {
  color: var(--mag-text) !important;
  font-weight: 500;
}

.app-shell-dropdown-btn {
  border: 1px solid var(--mag-border);
  color: var(--mag-text);
  background: #fff;
}

.app-shell-dropdown-btn:hover {
  background: var(--mag-bg-page);
  border-color: #cfd6de;
}

.app-shell-user-avatar {
  background: linear-gradient(145deg, #7a9bab, #5a7a8c) !important;
  color: #fff !important;
}

.app-shell-logout {
  color: var(--mag-danger-soft) !important;
}

.app-shell-logout:hover {
  background: rgba(184, 92, 92, 0.08);
}

/* ——— Bootstrap: botones y énfasis más suaves ——— */
.btn-primary {
  background-color: var(--mag-accent) !important;
  border-color: var(--mag-accent) !important;
}

.btn-primary:hover,
.btn-primary:focus {
  background-color: var(--mag-accent-hover) !important;
  border-color: var(--mag-accent-hover) !important;
}

.btn-danger {
  background-color: var(--mag-danger-soft) !important;
  border-color: #a85050 !important;
}

.btn-danger:hover {
  background-color: #9e4e4e !important;
  border-color: #8f4545 !important;
}

.btn-success {
  background-color: var(--mag-success-soft) !important;
  border-color: #4d7d62 !important;
}

.btn-outline-primary {
  color: var(--mag-accent);
  border-color: #9eb4c0;
}

.btn-outline-primary:hover {
  background-color: var(--mag-accent);
  border-color: var(--mag-accent);
}

.bg-primary {
  background-color: var(--mag-accent) !important;
}

.text-primary {
  color: var(--mag-accent) !important;
}

/* Encabezados de tarjetas en formularios (crear / editar) */
.card-header.bg-primary {
  background: linear-gradient(90deg, #5a7a8c 0%, #6d8a9a 100%) !important;
  border: none;
  color: #fff;
}

.card.shadow,
.card.shadow-sm {
  box-shadow: 0 4px 20px rgba(45, 62, 72, 0.06) !important;
  border: 1px solid rgba(221, 227, 234, 0.9);
  border-radius: 12px;
  overflow: hidden;
}

.card:hover {
  transform: none;
  box-shadow: 0 6px 28px rgba(45, 62, 72, 0.09) !important;
}

/* Tablas: menos contraste duro */
.table thead th {
  background: #f0f3f6 !important;
  color: var(--mag-text-muted) !important;
  font-weight: 600;
  border-bottom: 1px solid var(--mag-border) !important;
}

.table tbody td {
  border-color: #e8ecf0 !important;
  vertical-align: middle;
}

.table-hover tbody tr:hover {
  background-color: rgba(90, 122, 140, 0.06) !important;
}

.table-striped > tbody > tr:nth-of-type(odd) > * {
  background-color: rgba(240, 243, 246, 0.5) !important;
}

/* Formularios */
.form-control:focus,
.form-select:focus {
  border-color: #9eb4c0;
  box-shadow: 0 0 0 0.2rem rgba(90, 122, 140, 0.15);
}

.form-label {
  color: var(--mag-text);
  font-weight: 500;
}

/* Grupos de acciones CRUD */
.crud-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
  align-items: center;
}

.crud-actions .btn {
  min-height: 2.25rem;
}

.page-heading-row {
  border-bottom: 1px solid var(--mag-border);
  padding-bottom: 1rem;
  margin-bottom: 1.25rem;
}

.page-heading-row h1,
.page-heading-row .h3 {
  color: var(--mag-text);
  font-weight: 600;
}

/* Toasts suaves (usados desde funciones.js) */
.toast.toast-soft-success {
  background: #e8f2ec !important;
  color: #2d4a3a !important;
  border: 1px solid #c5ddcc !important;
}

.toast.toast-soft-error {
  background: #f8ecec !important;
  color: #5c3535 !important;
  border: 1px solid #e8cccc !important;
}

.toast.toast-soft-warning {
  background: #f8f4e8 !important;
  color: #5c4d2d !important;
  border: 1px solid #e8dcc0 !important;
}

.toast.toast-soft-info {
  background: #e8eef4 !important;
  color: #2d3d4a !important;
  border: 1px solid #c8d6e4 !important;
}

.toast-soft-success .btn-close,
.toast-soft-error .btn-close,
.toast-soft-warning .btn-close,
.toast-soft-info .btn-close {
  opacity: 0.5;
}

/* Modal de confirmación */
#app-confirm-modal .modal-content {
  border: none;
  border-radius: 14px;
  box-shadow: 0 20px 50px rgba(45, 62, 72, 0.18);
}

#app-confirm-modal .modal-header {
  background: #f7f8fa;
  border-bottom: 1px solid var(--mag-border);
}

#app-confirm-modal .modal-title {
  color: var(--mag-text);
  font-weight: 600;
}

#app-confirm-modal .modal-body {
  color: var(--mag-text-muted);
  line-height: 1.55;
}

#app-confirm-modal .modal-footer {
  background: #fafbfc;
  border-top: 1px solid var(--mag-border);
}

#app-confirm-modal .btn-primary {
  background-color: var(--mag-accent) !important;
  border-color: var(--mag-accent) !important;
}

/* Badges */
.badge.bg-primary {
  background-color: var(--mag-accent) !important;
}

/* Paginación */
.page-link {
  color: var(--mag-accent);
}

.page-item.active .page-link {
  background-color: var(--mag-accent);
  border-color: var(--mag-accent);
}

/* ========== Layout único (sidebar + contenido) ========== */
.wrapper {
  display: flex;
  width: 100%;
  align-items: stretch;
}

#sidebar {
  min-width: var(--mag-sidebar-width);
  max-width: var(--mag-sidebar-width);
  transition: margin 0.3s ease;
  position: fixed;
  height: 100vh;
  z-index: 1000;
  left: 0;
  top: 0;
  overflow-y: auto;
}

#sidebar.active {
  margin-left: calc(var(--mag-sidebar-width) * -1);
}

#content {
  width: calc(100% - var(--mag-sidebar-width));
  margin-left: var(--mag-sidebar-width);
  transition: margin 0.3s ease, width 0.3s ease;
  min-height: 100vh;
}

#content.active {
  width: 100%;
  margin-left: 0;
}

.main-content {
  padding: 1.25rem;
}

/* ——— Responsive: tablas, listados y DataTables (móvil / tablet) ——— */
.card .table-responsive,
.data-table .table-responsive {
  -webkit-overflow-scrolling: touch;
}

/* Tarjetas con tabla: el overflow:hidden del .card a veces impide ver el scroll horizontal */
.card.shadow.mag-card-table {
  overflow: visible;
}

.card.shadow.mag-card-table > .card-header {
  border-radius: 12px 12px 0 0;
}

/* Tablas de listado (tachas/reclamos, consultas prepadrón): vista tipo tarjeta en móvil/tablet */
@media (max-width: 991.98px) {
  .mag-list-table thead {
    display: none;
  }

  .mag-list-table tbody tr {
    display: block;
    margin-bottom: 0.85rem;
    border: 1px solid var(--mag-border);
    border-radius: 10px;
    overflow: hidden;
    background: #fff;
    box-shadow: 0 1px 4px rgba(45, 62, 72, 0.06);
  }

  .mag-list-table tbody tr:hover {
    background: #fff !important;
    box-shadow: 0 2px 10px rgba(45, 62, 72, 0.08);
  }

  .mag-list-table tbody td {
    display: flex;
    flex-direction: column;
    align-items: flex-start;
    gap: 0.2rem;
    padding: 0.65rem 0.85rem !important;
    border-bottom: 1px solid var(--mag-border) !important;
    border-left: none !important;
    border-right: none !important;
    max-width: 100%;
    word-break: break-word;
    overflow-wrap: anywhere;
    vertical-align: top !important;
  }

  .mag-list-table tbody td:last-child {
    border-bottom: none !important;
  }

  .mag-list-table tbody td::before {
    content: attr(data-label);
    font-weight: 600;
    font-size: 0.7rem;
    text-transform: uppercase;
    letter-spacing: 0.04em;
    color: var(--mag-text-muted);
    line-height: 1.2;
  }

  .mag-list-table .mag-td-actions > .d-flex {
    width: 100%;
    justify-content: flex-start !important;
  }

  .mag-list-table .mag-td-actions .btn {
    flex-shrink: 0;
  }

  /* Fallback: si no aplica el modo tarjeta, forzar scroll horizontal legible */
  .table-responsive.mag-table-scroll-fallback {
    overflow-x: auto;
  }
}

@media (min-width: 992px) {
  .mag-list-table .mag-td-actions {
    min-width: 200px;
  }
}

.dataTables_wrapper {
  width: 100%;
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
}

@media (max-width: 991.98px) {
  .dataTables_wrapper .row > [class*='col-md'] {
    width: 100%;
    max-width: 100%;
  }

  .dataTables_wrapper .dataTables_length,
  .dataTables_wrapper .dataTables_filter {
    float: none;
    text-align: left;
    margin-bottom: 0.5rem;
  }

  .dataTables_wrapper .dataTables_filter label {
    display: flex;
    flex-direction: column;
    align-items: stretch;
    gap: 0.35rem;
    width: 100%;
  }

  .dataTables_wrapper .dataTables_filter input {
    width: 100% !important;
    max-width: 100%;
    margin-left: 0 !important;
  }

  .dataTables_wrapper .dataTables_info,
  .dataTables_wrapper .dataTables_paginate {
    float: none;
    text-align: center;
    margin-top: 0.5rem;
  }
}

.sidebar-header {
  padding: 1.25rem;
}

.sidebar-title {
  font-weight: 700;
  margin: 0;
  font-size: 1.1rem;
}

.sidebar-subtitle {
  font-size: 0.8rem;
  opacity: 0.85;
}

.components {
  padding: 0.5rem 0 1.5rem;
}

.sidebar-section {
  padding: 0.5rem 1.25rem;
  font-size: 0.72rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  margin-top: 0.75rem;
}

.sidebar-link {
  padding: 0.65rem 1.25rem;
  display: flex;
  align-items: center;
  text-decoration: none;
  transition: background 0.2s ease, color 0.2s ease, border-color 0.2s ease;
  border-left: 3px solid transparent;
}

.sidebar-footer {
  border-top: 1px solid rgba(255, 255, 255, 0.08);
  padding: 1rem 1.25rem;
}

.user-info {
  display: flex;
  align-items: center;
}

@media (min-width: 992px) {
  #sidebar.active {
    margin-left: calc(var(--mag-sidebar-width) * -1);
  }
}

@media (max-width: 991.98px) {
  #sidebar {
    margin-left: calc(var(--mag-sidebar-width) * -1);
    z-index: 1050;
  }

  #sidebar.active {
    margin-left: 0;
  }

  #content,
  #content.active {
    width: 100%;
    margin-left: 0;
  }

  .sidebar-overlay {
    position: fixed;
    inset: 0;
    background: rgba(30, 41, 59, 0.45);
    backdrop-filter: blur(2px);
    z-index: 1040;
    opacity: 0;
    visibility: hidden;
    transition: opacity 0.25s ease, visibility 0.25s ease;
  }

  .sidebar-overlay.show {
    opacity: 1;
    visibility: visible;
  }
}

#sidebarToggle,
#sidebarCollapse {
  border: none;
  background: transparent;
  font-size: 1.2rem;
  padding: 0.35rem 0.65rem;
}

/* ========== Alertas y toasts (legibles, tono institucional) ========== */
.alert {
  border-radius: 10px;
  border: 1px solid transparent;
  padding: 0.85rem 1.15rem;
  font-weight: 500;
  box-shadow: 0 2px 12px rgba(45, 62, 72, 0.06);
}

.alert-success {
  background: #e8f2ec;
  color: #1e4630;
  border-color: #c5ddcc;
}

.alert-danger {
  background: #f8ecec;
  color: #5c3535;
  border-color: #e8cccc;
}

.alert-warning {
  background: #f8f4e8;
  color: #5c4d2d;
  border-color: #e8dcc0;
}

.alert-info {
  background: #e8eef4;
  color: #2d3d4a;
  border-color: #c8d6e4;
}

.alert.alert-white,
.alert.bg-white {
  background: #f8f9fa !important;
  color: #212529 !important;
  border: 1px solid var(--mag-border);
}

.toast {
  border: none;
  border-radius: 10px;
  box-shadow: 0 8px 28px rgba(45, 62, 72, 0.15);
  min-width: 280px;
  max-width: 420px;
}

.toast-body {
  font-weight: 500;
  padding: 0.75rem 1rem;
}

.toast.bg-success,
.toast.text-bg-success {
  background: #2d6a45 !important;
  color: #fff !important;
}

.toast.bg-danger,
.toast.text-bg-danger {
  background: #a84848 !important;
  color: #fff !important;
}

.toast.bg-warning,
.toast.text-bg-warning {
  background: #c9a24a !important;
  color: #1a1508 !important;
}

.toast.bg-info,
.toast.text-bg-info {
  background: var(--mag-accent) !important;
  color: #fff !important;
}

.toast-container {
  z-index: 9999;
  pointer-events: none;
}

.toast-container .toast {
  pointer-events: auto;
  margin-bottom: 0.5rem;
}

/* ========== Utilidades ========== */
.fade-in {
  animation: magFadeInUp 0.45s ease;
}

@keyframes magFadeInUp {
  from {
    opacity: 0;
    transform: translateY(12px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

.slide-in-left {
  animation: magSlideInLeft 0.3s ease-out;
}

@keyframes magSlideInLeft {
  from {
    transform: translateX(-100%);
  }
  to {
    transform: translateX(0);
  }
}

.border-left-primary {
  border-left: 4px solid var(--mag-accent) !important;
}

.border-left-success {
  border-left: 4px solid var(--mag-success-soft) !important;
}

.border-left-warning {
  border-left: 4px solid var(--warning-color) !important;
}

.border-left-danger {
  border-left: 4px solid var(--mag-danger-soft) !important;
}

.text-xs {
  font-size: 0.75rem;
}

.text-sm {
  font-size: 0.875rem;
}

.activity-feed .feed-item {
  border-left: 2px solid var(--mag-border);
  padding-left: 15px;
  position: relative;
}

.activity-feed .feed-item::before {
  content: '';
  position: absolute;
  left: -6px;
  top: 5px;
  width: 10px;
  height: 10px;
  border-radius: 50%;
  background: var(--mag-accent);
}

/* ========== Dashboard y tablas de datos ========== */
.dashboard-stats .card {
  border-left: 4px solid;
}

.dashboard-stats .card-primary {
  border-left-color: var(--mag-accent);
}

.dashboard-stats .card-success {
  border-left-color: var(--mag-success-soft);
}

.dashboard-stats .card-warning {
  border-left-color: var(--warning-color);
}

.dashboard-stats .card-danger {
  border-left-color: var(--mag-danger-soft);
}

.chart-container {
  position: relative;
  height: 300px;
  width: 100%;
}

.status-indicator {
  display: inline-block;
  width: 8px;
  height: 8px;
  border-radius: 50%;
  margin-right: 5px;
}

.status-active {
  background-color: var(--mag-success-soft);
}

.status-pending {
  background-color: var(--warning-color);
}

.status-inactive {
  background-color: var(--mag-danger-soft);
}

.action-buttons {
  display: flex;
  flex-wrap: wrap;
  gap: 0.35rem;
}

.action-buttons .btn {
  padding: 0.25rem 0.5rem;
  font-size: 0.875rem;
}

.search-filter-section {
  background: var(--mag-bg-card);
  border-radius: 12px;
  padding: 1.25rem;
  margin-bottom: 1.25rem;
  box-shadow: 0 2px 12px rgba(45, 62, 72, 0.05);
  border: 1px solid rgba(221, 227, 234, 0.9);
}

.data-table {
  background: var(--mag-bg-card);
  border-radius: 12px;
  overflow: hidden;
  box-shadow: 0 2px 12px rgba(45, 62, 72, 0.05);
  border: 1px solid rgba(221, 227, 234, 0.9);
}

.data-table th {
  background: #f0f3f6;
  border-bottom: 2px solid var(--mag-border);
  font-weight: 600;
  text-transform: uppercase;
  font-size: 0.78rem;
  letter-spacing: 0.04em;
  color: var(--mag-text-muted);
}

.modal-header {
  background: #f7f8fa;
  color: var(--mag-text);
  border-bottom: 1px solid var(--mag-border);
}

.modal-header .btn-close {
  opacity: 0.55;
}

.form-group {
  margin-bottom: 1.25rem;
}

.badge-pill {
  border-radius: 50rem;
  padding: 0.35em 0.65em;
}

.progress {
  height: 8px;
  border-radius: 6px;
  background-color: #e9ecef;
}

.progress-bar {
  border-radius: 6px;
}

.notification-badge {
  position: absolute;
  top: -5px;
  right: -5px;
  background: var(--mag-danger-soft);
  color: #fff;
  border-radius: 50%;
  width: 18px;
  height: 18px;
  font-size: 0.7rem;
  display: flex;
  align-items: center;
  justify-content: center;
}

.btn-loading {
  position: relative;
  color: transparent !important;
  pointer-events: none;
}

.btn-loading::after {
  content: '';
  position: absolute;
  width: 16px;
  height: 16px;
  top: 50%;
  left: 50%;
  margin: -8px 0 0 -8px;
  border: 2px solid rgba(90, 122, 140, 0.25);
  border-top-color: var(--mag-accent);
  border-radius: 50%;
  animation: magBtnSpin 0.8s linear infinite;
}

@keyframes magBtnSpin {
  to {
    transform: rotate(1turn);
  }
}

::-webkit-scrollbar {
  width: 8px;
  height: 8px;
}

::-webkit-scrollbar-track {
  background: #f1f3f5;
}

::-webkit-scrollbar-thumb {
  background: #c5cdd6;
  border-radius: 6px;
}

::-webkit-scrollbar-thumb:hover {
  background: #a8b4c0;
}

.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}

.btn:focus-visible,
.form-control:focus-visible,
.form-select:focus-visible {
  outline: 2px solid rgba(90, 122, 140, 0.45);
  outline-offset: 2px;
}

@media (max-width: 767.98px) {
  .container-fluid {
    padding-left: 0.65rem;
    padding-right: 0.65rem;
  }

  .table th {
    white-space: nowrap;
    font-size: 0.8rem;
    padding: 0.65rem 0.45rem;
  }

  .table td {
    padding: 0.65rem 0.45rem;
    font-size: 0.875rem;
  }

  .form-control,
  .form-select {
    font-size: 16px;
  }

  .pagination {
    flex-wrap: wrap;
  }

  .pagination .page-link {
    padding: 0.375rem 0.5rem;
    font-size: 0.875rem;
  }

  .btn-group-sm .btn,
  .btn-sm {
    padding: 0.3rem 0.55rem;
    font-size: 0.8125rem;
  }
}

@media print {
  .navbar,
  .sidebar,
  .btn,
  .pagination,
  .no-print {
    display: none !important;
  }

  .card {
    border: 1px solid #ccc !important;
    box-shadow: none !important;
  }
}

/* ========== Página de acceso (login) ========== */
.login-body {
  --login-bg-dark: #2d3d47;
  --login-bg-card: #3d4f5c;
  --login-bg-card-light: #4a5f6d;
  --login-primary: #4a6674;
  --login-primary-dark: #3d5562;
  --login-accent: #5a7a8c;
  --login-accent-muted: #6d8a9a;
  --login-text-light: #f1f5f9;
  --login-text-muted: #94a3b8;
  --login-text-white: #ffffff;
  --login-border-dark: #475569;
  --login-border-light: #64748b;
  background: var(--mag-bg-page);
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 2rem 0;
  font-family: 'Source Sans 3', 'Segoe UI', system-ui, sans-serif;
}

.login-container {
  background-color: #e8eef3;
  background-image: url('../img/movimiento_renovación_gremial.png');
  background-repeat: no-repeat;
  background-size: cover;
  /* Enfoca el edificio (lado izquierdo del banner) y recorta el extremo derecho con logo institucional */
  background-position: 18% center;
  border-radius: 14px;
  box-shadow: 0 24px 56px rgba(30, 41, 59, 0.2);
  border: 1px solid rgba(148, 163, 184, 0.14);
  overflow: hidden;
  max-width: 1200px;
  width: 95%;
}

.login-left {
  background: transparent;
  position: relative;
  overflow: hidden;
  padding: 3rem 2rem;
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: 100%;
  height: 100%;
  border-right: 1px solid rgba(226, 232, 240, 0.65);
}

.login-left::before {
  content: '';
  position: absolute;
  inset: 0;
  background: linear-gradient(
    160deg,
    rgba(255, 255, 255, 0.9) 0%,
    rgba(248, 250, 252, 0.78) 50%,
    rgba(248, 250, 252, 0.55) 100%
  );
  pointer-events: none;
}

.login-right {
  position: relative;
  padding: 3rem 2.5rem;
  background: linear-gradient(
    185deg,
    rgba(74, 102, 116, 0.94) 0%,
    rgba(61, 85, 98, 0.96) 100%
  );
  overflow: hidden;
}

.background-effects {
  position: absolute;
  inset: 0;
  pointer-events: none;
  background:
    radial-gradient(ellipse 80% 50% at 90% 10%, rgba(255, 255, 255, 0.07) 0%, transparent 50%),
    radial-gradient(ellipse 60% 40% at 10% 90%, rgba(201, 169, 97, 0.08) 0%, transparent 45%);
}

.login-form-container {
  position: relative;
  z-index: 1;
  max-width: 400px;
  margin: 0 auto;
  animation: magLoginSlideUp 0.55s ease;
}

@keyframes magLoginSlideUp {
  from {
    opacity: 0;
    transform: translateY(16px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

.logo-left-container {
  text-align: center;
  position: relative;
  z-index: 2;
  width: 100%;
  animation: magLoginLogoIn 0.75s ease 0.15s both;
}

@keyframes magLoginLogoIn {
  from {
    opacity: 0;
    transform: translateX(-12px);
  }
  to {
    opacity: 1;
    transform: translateX(0);
  }
}

.logo-image-left {
  max-width: 50%;
  height: auto;
  margin: 0 auto 2rem;
  display: block;
}

.logo-image-small {
  max-width: 50%;
  height: auto;
  margin: 0 auto 1rem;
  display: block;
}

.system-title-left {
  font-size: clamp(1.15rem, 2.5vw, 1.5rem);
  font-weight: 700;
  color: #0f172a;
  margin-bottom: 0.5rem;
  text-align: center;
  letter-spacing: -0.02em;
  line-height: 1.3;
  max-width: 22rem;
  margin-left: auto;
  margin-right: auto;
}

.system-subtitle-left {
  color: #475569;
  text-align: center;
  margin-bottom: 2rem;
  font-size: 1.05rem;
  max-width: 420px;
  margin-left: auto;
  margin-right: auto;
  line-height: 1.55;
}

.login-logo-container {
  text-align: center;
  margin-bottom: 2rem;
}

.login-right .system-title {
  font-size: clamp(1rem, 2.2vw, 1.35rem);
  font-weight: 700;
  color: var(--login-text-light);
  margin-bottom: 0.35rem;
  text-align: center;
  letter-spacing: -0.02em;
  line-height: 1.3;
  max-width: 18rem;
  margin-left: auto;
  margin-right: auto;
}

.login-right .system-subtitle {
  color: var(--login-text-muted);
  text-align: center;
  margin-bottom: 2rem;
  font-size: 1.05rem;
}

.login-right .form-label {
  color: var(--login-text-light);
  font-weight: 600;
  margin-bottom: 0.5rem;
  font-size: 0.95rem;
}

.login-right .input-group {
  margin-bottom: 1.25rem;
}

.login-right .input-group-text {
  background: linear-gradient(135deg, var(--login-bg-card-light) 0%, #3a4d5c 100%) !important;
  border: 2px solid var(--login-border-dark);
  border-right: none !important;
  color: var(--login-text-muted);
  padding: 0.75rem 1rem;
  transition: border-color 0.2s ease, color 0.2s ease;
}

.login-right .form-control {
  background: linear-gradient(135deg, var(--login-bg-card-light) 0%, #3a4d5c 100%);
  border: 2px solid var(--login-border-dark);
  border-left: none !important;
  color: var(--login-text-light);
  padding: 0.75rem 1rem;
  transition: border-color 0.2s ease, box-shadow 0.2s ease;
}

.login-right .form-control:focus {
  background: linear-gradient(135deg, var(--login-bg-card-light) 0%, #415a68 100%);
  border-color: var(--login-accent);
  box-shadow: 0 0 0 3px rgba(90, 122, 140, 0.25);
  color: var(--login-text-light);
}

.login-right .form-control::placeholder {
  color: var(--login-text-muted);
  opacity: 0.75;
}

.btn-login {
  background: var(--login-accent);
  border: none;
  color: var(--login-text-white);
  padding: 0.9rem 1.5rem;
  font-weight: 600;
  border-radius: 10px;
  transition: background 0.2s ease, box-shadow 0.2s ease, transform 0.15s ease;
  width: 100%;
  margin: 1.5rem 0 1rem;
  font-size: 0.95rem;
  letter-spacing: 0.03em;
}

.btn-login:hover {
  background: var(--mag-accent-hover);
  box-shadow: 0 10px 28px rgba(45, 62, 72, 0.25);
  color: var(--login-text-white);
}

.btn-login:active {
  transform: translateY(1px);
}

.login-right .btn-toggle-password {
  background: linear-gradient(135deg, var(--login-bg-card-light) 0%, #3a4d5c 100%);
  border: 2px solid var(--login-border-dark);
  border-left: none !important;
  color: var(--login-text-muted);
  transition: background 0.2s ease, color 0.2s ease;
}

.login-right .btn-toggle-password:hover {
  background: var(--login-border-dark);
  color: var(--login-text-light);
}

.login-right .form-check-input {
  background-color: var(--login-bg-card-light);
  border: 2px solid var(--login-border-dark);
}

.login-right .form-check-input:checked {
  background-color: var(--login-accent);
  border-color: var(--login-accent);
}

.login-right .form-check-label {
  color: var(--login-text-muted);
}

.forgot-link {
  color: var(--login-accent-muted);
  text-decoration: none;
  transition: color 0.2s ease;
  font-weight: 500;
}

.forgot-link:hover {
  color: #b8d4e8;
  text-decoration: underline;
}

.security-notice {
  background: rgba(255, 255, 255, 0.06);
  border: 1px solid rgba(255, 255, 255, 0.1);
  border-radius: 10px;
  padding: 1rem;
  margin-top: 2rem;
  text-align: center;
}

.login-right .input-group:focus-within .input-group-text {
  border-color: var(--login-accent);
  color: var(--login-accent-muted);
}

@media (max-width: 992px) {
  .login-container {
    margin: 1.5rem;
    width: calc(100% - 3rem);
    background-position: 35% center;
  }

  .login-left {
    padding: 2.5rem 1.5rem;
  }

  .login-right {
    padding: 2.5rem 1.5rem;
  }

  .logo-image-left {
    max-width: 150px;
  }
}

@media (max-width: 768px) {
  .login-left {
    padding: 2rem 1.5rem;
  }

  .login-right {
    padding: 2rem 1.5rem;
  }

  .login-right .system-title {
    font-size: 1.5rem;
  }

  .logo-image-small {
    max-width: 80px;
  }
}

@media (max-width: 576px) {
  .login-body {
    padding: 1rem 0;
  }

  .login-container {
    border-radius: 12px;
    margin: 1rem;
    width: calc(100% - 2rem);
  }

  .login-left,
  .login-right {
    padding: 1.5rem 1rem;
  }

  .logo-image-left {
    max-width: 120px;
  }

  .logo-image-small {
    max-width: 70px;
  }
}

/* Encabezado institucional (login, consulta prepadrón, consultas admin) — assets/img/movimiento_renovación_gremial.png */
.cm-encabezado-logo {
  display: block;
  width: 100%;
  max-width: 22rem;
  height: auto;
  margin-left: auto;
  margin-right: auto;
  object-fit: contain;
}

.cm-encabezado-logo--left {
  max-width: min(100%, 26rem);
}

.cm-encabezado-logo--form {
  max-width: min(100%, 20rem);
}

.cm-encabezado-logo--page {
  max-width: min(100%, 28rem);
  max-height: 4.5rem;
  width: auto;
}

@media (max-width: 992px) {
  .cm-encabezado-logo--left {
    max-width: min(100%, 20rem);
  }
  .cm-encabezado-logo--form {
    max-width: min(100%, 18rem);
  }
}

/* Roles: permisos en tarjeta oscura — contraste del checkbox */
.card.bg-dark.text-white .form-check-input {
  --bs-form-check-bg: #fff;
  background-color: #fff;
  border-color: rgba(255, 255, 255, 0.75);
}
.card.bg-dark.text-white .form-check-input:checked {
  background-color: var(--bs-primary);
  border-color: var(--bs-primary);
}
