:root {
  --ucg-accion-fondo: #418e9d;
  --ucg-accion-texto: #ffffff;
  --ucg-accion-hover: #357480;
  --ucg-cancelar-fondo: #d64545;
  --ucg-cancelar-hover: #b93636;

  /* Bootstrap trae su propio azul (#0d6efd) hardcodeado en .btn-primary /
     .btn-outline-primary / .border-primary, y solo .text-primary / .bg-primary
     leen estas variables. Sin este bloque, los botones "Nuevo"/"Filtrar" de
     todas las pantallas de catálogo se habrían quedado azules mientras el
     resto del sistema pasa a verde institucional. */
  --bs-primary: #418e9d;
  --bs-primary-rgb: 65, 142, 157;
}

/* Reemplaza el azul por defecto de Bootstrap en los botones "primary", que
   es el estilo que realmente usan la mayoría de las pantallas (catálogos,
   filtros de horas, expedientes) — .btn-accion (arriba) es solo el par
   aceptar/cancelar de los formularios (§1.2). */
.btn-primary {
  color: #fff;
  background-color: #418e9d;
  border-color: #418e9d;
}

.btn-primary:hover {
  color: #fff;
  background-color: #357480;
  border-color: #357480;
}

.btn-check:focus + .btn-primary,
.btn-primary:focus {
  color: #fff;
  background-color: #357480;
  border-color: #357480;
  box-shadow: 0 0 0 0.25rem rgba(65, 142, 157, 0.5);
}

.btn-check:active + .btn-primary,
.btn-check:checked + .btn-primary,
.btn-primary.active,
.btn-primary:active,
.show > .btn-primary.dropdown-toggle {
  color: #fff;
  background-color: #2c606b;
  border-color: #2c606b;
}

.btn-check:active + .btn-primary:focus,
.btn-check:checked + .btn-primary:focus,
.btn-primary.active:focus,
.btn-primary:active:focus,
.show > .btn-primary.dropdown-toggle:focus {
  box-shadow: 0 0 0 0.25rem rgba(65, 142, 157, 0.5);
}

.btn-primary.disabled,
.btn-primary:disabled {
  color: #fff;
  background-color: #418e9d;
  border-color: #418e9d;
}

.btn-outline-primary {
  color: #418e9d;
  border-color: #418e9d;
}

.btn-outline-primary:hover {
  color: #fff;
  background-color: #418e9d;
  border-color: #418e9d;
}

.btn-check:focus + .btn-outline-primary,
.btn-outline-primary:focus {
  box-shadow: 0 0 0 0.25rem rgba(65, 142, 157, 0.5);
}

.btn-check:active + .btn-outline-primary,
.btn-check:checked + .btn-outline-primary,
.btn-outline-primary.active,
.btn-outline-primary.dropdown-toggle.show,
.btn-outline-primary:active {
  color: #fff;
  background-color: #418e9d;
  border-color: #418e9d;
}

.btn-check:active + .btn-outline-primary:focus,
.btn-check:checked + .btn-outline-primary:focus,
.btn-outline-primary.active:focus,
.btn-outline-primary.dropdown-toggle.show:focus,
.btn-outline-primary:active:focus {
  box-shadow: 0 0 0 0.25rem rgba(65, 142, 157, 0.5);
}

.btn-outline-primary.disabled,
.btn-outline-primary:disabled {
  color: #418e9d;
  background-color: transparent;
}

.border-primary {
  border-color: #418e9d !important;
}

.form-acciones {
  margin-top: 1.25rem;
}

/* Dentro de un modal el borde y el relleno los pone .modal-footer; el margen
   superior del par sobraría y lo dejaría descolgado del pie. */
.modal-footer .form-acciones {
  width: 100%;
  margin-top: 0;
}

.btn-accion,
.btn-accion:visited {
  min-width: 10rem;
  padding: 0.5rem 1.25rem;
  border: 1px solid var(--ucg-accion-fondo);
  border-radius: 0.375rem;
  background-color: var(--ucg-accion-fondo);
  color: var(--ucg-accion-texto);
  font-weight: 600;
  text-decoration: none;
}

.btn-accion:hover,
.btn-accion:focus {
  background-color: var(--ucg-accion-hover);
  border-color: var(--ucg-accion-hover);
  color: var(--ucg-accion-texto);
}

.btn-accion:disabled {
  opacity: 0.65;
}

/* Cancelar se distingue de Aceptar con color rojo (decisión explícita del
   cliente: se abandonó el requisito original de apariencia idéntica). */
.btn-accion.btn-cancelar,
.btn-accion.btn-cancelar:visited {
  border-color: var(--ucg-cancelar-fondo);
  background-color: var(--ucg-cancelar-fondo);
}

.btn-accion.btn-cancelar:hover,
.btn-accion.btn-cancelar:focus {
  background-color: var(--ucg-cancelar-hover);
  border-color: var(--ucg-cancelar-hover);
}

.nav-close-button,
.nav-logout-button,
.menu-trigger {
  border: 0;
  background: transparent;
}

.menu-trigger {
  color: #2d3033;
  font-size: 1.75rem;
  line-height: 1;
  padding: 0 0.35rem 0 0;
}

#side-nav .nav-items .nav-item .nav-logout-button {
  width: 48px;
  height: 48px;
  display: block;
  position: relative;
  color: #859aaa;
  padding: 8px;
  margin-bottom: 16px;
  border-radius: 8px;
  overflow: hidden;
  text-align: left;
  transition: all 0.3s ease-in-out;
}

#side-nav .nav-items .nav-item .nav-logout-button:hover {
  background-color: #eeeff1;
}

#side-nav .menu-icon {
  display: inline-flex;
  width: 32px;
  height: 32px;
  align-items: center;
  justify-content: center;
  font-style: normal;
  font-size: 32px;
  line-height: 1;
}

#side-nav .nav-logout-button span {
  display: inline-block;
  width: 0;
  opacity: 0;
  top: 12px;
  left: 64px;
  position: absolute;
  white-space: nowrap;
  transition: all 0.3s ease-in-out;
}

#side-nav:hover .nav-items .nav-item .nav-logout-button,
#side-nav.open .nav-items .nav-item .nav-logout-button {
  width: 248px;
  transition-delay: 0.3s;
}

#side-nav:hover .nav-logout-button span,
#side-nav.open .nav-logout-button span {
  width: auto;
  opacity: 1;
  left: 40px;
  padding-left: 8px;
  transition-delay: 0.5s;
}

.table th,
.table td {
  padding: 1rem 1.25rem;
}

.usuarios-master-detail {
  min-height: 100%;
}

.usuarios-listado {
  height: 100%;
  overflow-y: auto;
}

#usuario-detalle {
  display: flex;
  flex-direction: column;
}

#usuario-detalle .aside-card-body {
  flex: 1;
}

.usuario-empty-state {
  position: absolute;
  top: 50%;
  left: 50%;
  width: min(360px, 80%);
  transform: translate(-50%, -50%);
  text-align: center;
}

.usuario-card:focus-visible {
  outline: 3px solid rgba(65, 142, 157, 0.35);
  outline-offset: 2px;
}

.detalle-close {
  border: 0;
  background: transparent;
}

.expediente-empty-icon {
  font-size: 8rem;
}

/* Panel de detalle del maestro-detalle (también en main.scss; se repite en
   admin.css porque el layout carga main.min.css y puede ir desfasado). */
#expediente-detalle {
  display: flex;
  flex: 1 1 auto;
  flex-direction: column;
  min-height: 0;
  min-width: 0;
}

#expediente-detalle .aside-card-body {
  flex: 1 1 auto;
  min-height: 0;
  overflow-y: auto !important;
}

.aside-card {
  overflow: hidden;
}

.historial-expediente {
  border-left: 2px solid #c3ced8;
  margin-left: 0.5rem;
  padding-left: 1.5rem;
}

.historial-item {
  position: relative;
  margin-bottom: 1.5rem;
}

.historial-item::before {
  content: "";
  position: absolute;
  top: 0.35rem;
  left: -1.92rem;
  width: 0.75rem;
  height: 0.75rem;
  border-radius: 50%;
  background: #418e9d;
  box-shadow: 0 0 0 4px #fff;
}

.historial-item time {
  display: block;
  color: #7690a5;
  font-size: 0.875rem;
  margin-bottom: 0.25rem;
}

@media (max-width: 767.98px) {
  #navbar-include {
    position: fixed;
    height: 100%;
  }

  .main-content {
    padding: 18px;
  }
}

/* ─── Portal de cliente ──────────────────────────────────────────────────── */

.portal-main {
  max-width: 960px;
}

/* Listado del maestro-detalle: reutiliza .cardlist pero NO el azul sólido
   de .card.active (pensado para el despacho). Aquí el ítem se queda blanco
   y solo se marca con borde/acento. */
.portal-cardlist .card.portal-list-card {
  position: relative;
  cursor: pointer;
  background-color: #fff;
  color: #2d3033;
}

.portal-cardlist .card.portal-list-card h5 {
  color: #2d3033;
}

.portal-cardlist .card.portal-list-card > div span {
  color: #7690a5;
}

.portal-cardlist .card.portal-list-card .badge-estado {
  position: relative;
  z-index: 1;
  /* Los badges no deben heredar el color blanco del .card.active global. */
  color: inherit;
}

.portal-cardlist .card.portal-list-card:hover {
  background-color: #f6f7fa;
  color: #2d3033;
}

.portal-cardlist .card.portal-list-card:hover h5,
.portal-cardlist .card.portal-list-card:hover > div span {
  color: inherit;
}

.portal-cardlist .card.portal-list-card:hover h5 {
  color: #2d3033;
}

.portal-cardlist .card.portal-list-card:hover > div span {
  color: #7690a5;
}

.portal-cardlist .card.portal-list-card.active,
.portal-cardlist .card.portal-list-card.active:hover {
  background-color: #fff !important;
  color: #2d3033 !important;
  border: 1px solid #5fadbd;
  box-shadow: 0 1px 2px rgba(0, 0, 0, 0.06), 0 1px 6px rgba(0, 29, 124, 0.06);
}

.portal-cardlist .card.portal-list-card.active h5,
.portal-cardlist .card.portal-list-card.active:hover h5 {
  color: #2d3033 !important;
}

.portal-cardlist .card.portal-list-card.active > div span,
.portal-cardlist .card.portal-list-card.active:hover > div span {
  color: #7690a5 !important;
}

.portal-cardlist .card.portal-list-card.active .badge-estado-activo {
  background: rgba(111, 207, 151, 0.18);
  color: #1e7a45 !important;
}

.portal-cardlist .card.portal-list-card.active .badge-estado-suspendido {
  background: rgba(251, 196, 123, 0.28);
  color: #9a6412 !important;
}

.portal-cardlist .card.portal-list-card.active .badge-estado-concluido {
  background: rgba(65, 142, 157, 0.12);
  color: #325a62 !important;
}

.portal-cardlist .card.portal-list-card.active .badge-estado-archivado {
  background: #e3e6e9;
  color: #667179 !important;
}

/* Panel derecho: fondo blanco como en expedientes del despacho. */
.portal-detalle-panel {
  background-color: #fff;
}

.portal-detalle-intro {
  background: #fafbfc;
  border: 1px solid #e3e6e9;
  border-radius: 0.75rem;
  padding: 1.25rem;
}

.portal-detalle-panel .portal-seccion:last-child {
  margin-bottom: 0;
}

.portal-detalle-panel .portal-resumen-card {
  background: #fafbfc;
}

.portal-detalle-panel .portal-seccion {
  background: #fff;
  border-color: #e3e6e9;
}

.portal-page-header {
  margin-bottom: 1.5rem;
}

.portal-page-sub {
  color: #859aaa;
  font-size: 0.95rem;
}

.portal-breadcrumb {
  margin-bottom: 1rem;
}

.portal-breadcrumb a {
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
  color: #667179;
  font-size: 0.9rem;
  font-weight: 500;
  text-decoration: none;
}

.portal-breadcrumb a:hover {
  color: #418e9d;
}

.portal-tabs {
  border-bottom: 1px solid #d3dae0;
  gap: 0.25rem;
}

.portal-tabs .nav-link {
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  color: #667179;
  border: 0;
  border-bottom: 2px solid transparent;
  border-radius: 0;
  padding: 0.75rem 1rem;
  font-weight: 500;
}

.portal-tabs .nav-link:hover {
  color: #2d3033;
  border-color: transparent;
}

.portal-tabs .nav-link.active {
  color: #418e9d;
  background: transparent;
  border-bottom-color: #418e9d;
}

.portal-tab-count {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 1.5rem;
  height: 1.5rem;
  padding: 0 0.4rem;
  border-radius: 999px;
  background: #e3e6e9;
  color: #667179;
  font-size: 0.75rem;
  font-weight: 600;
}

.portal-tabs .nav-link.active .portal-tab-count {
  background: rgba(65, 142, 157, 0.12);
  color: #418e9d;
}

.portal-tab-content {
  padding-top: 1.25rem;
}

.portal-casos-lista {
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
}

.portal-caso-card {
  display: flex;
  align-items: center;
  gap: 1rem;
  padding: 1.15rem 1.25rem;
  background: #fff;
  border: 1px solid #e3e6e9;
  border-radius: 0.75rem;
  box-shadow: 0 1px 2px rgba(0, 0, 0, 0.04), 0 1px 6px rgba(0, 29, 124, 0.04);
  text-decoration: none;
  color: inherit;
  transition: border-color 0.15s ease, box-shadow 0.15s ease, transform 0.15s ease;
}

.portal-caso-card:hover {
  border-color: #5fadbd;
  box-shadow: 0 4px 12px rgba(0, 29, 124, 0.08);
  transform: translateY(-1px);
  color: inherit;
  text-decoration: none;
}

.portal-caso-card-body {
  flex: 1;
  min-width: 0;
}

.portal-caso-titulo {
  font-size: 1.05rem;
  font-weight: 600;
  line-height: 1.35;
  color: #2d3033;
}

.portal-caso-meta {
  display: flex;
  flex-wrap: wrap;
  gap: 0.35rem 1.1rem;
  color: #859aaa;
  font-size: 0.875rem;
}

.portal-caso-meta span {
  display: inline-flex;
  align-items: center;
  gap: 0.3rem;
}

.portal-caso-meta i {
  font-size: 1rem;
  opacity: 0.85;
}

.portal-caso-accion {
  flex-shrink: 0;
  color: #c3ced8;
  font-size: 1.5rem;
  line-height: 1;
}

.portal-caso-card:hover .portal-caso-accion {
  color: #418e9d;
}

.badge-estado {
  font-weight: 600;
  font-size: 0.75rem;
  letter-spacing: 0.02em;
  padding: 0.35em 0.7em;
  border-radius: 999px;
}

.badge-estado-activo {
  background: rgba(111, 207, 151, 0.18);
  color: #1e7a45;
}

.badge-estado-suspendido {
  background: rgba(251, 196, 123, 0.28);
  color: #9a6412;
}

.badge-estado-concluido {
  background: rgba(65, 142, 157, 0.12);
  color: #325a62;
}

.badge-estado-archivado {
  background: #e3e6e9;
  color: #667179;
}

.portal-empty {
  text-align: center;
  padding: 3rem 1rem;
  color: #859aaa;
  background: #fff;
  border: 1px dashed #d3dae0;
  border-radius: 0.75rem;
}

.portal-empty-compact {
  padding: 1.5rem 1rem;
  border-style: solid;
  border-color: #e3e6e9;
}

.portal-empty-icon {
  display: block;
  font-size: 3rem;
  line-height: 1;
  margin-bottom: 0.75rem;
  opacity: 0.55;
}

.portal-detalle-header {
  background: #fff;
  border: 1px solid #e3e6e9;
  border-radius: 0.75rem;
  padding: 1.5rem;
  margin-bottom: 1.25rem;
  box-shadow: 0 1px 2px rgba(0, 0, 0, 0.04), 0 1px 6px rgba(0, 29, 124, 0.04);
}

.portal-detalle-header-top {
  display: flex;
  align-items: flex-start;
  gap: 0.5rem;
  margin-bottom: 1.25rem;
  padding-bottom: 1.25rem;
  border-bottom: 1px solid #eef0f3;
}

.portal-detalle-titulo-wrap {
  flex: 1;
  min-width: 0;
}

.portal-detalle-titulo {
  font-size: 1.5rem;
  font-weight: 600;
  line-height: 1.3;
  margin-bottom: 0.5rem;
  color: #2d3033;
}

.portal-detalle-subtitulo {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.65rem;
}

.portal-detalle-numero {
  color: #667179;
  font-size: 0.95rem;
  font-weight: 500;
}

.portal-ficha-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 1.15rem 1.5rem;
  margin: 0;
}

.portal-ficha-item-wide {
  grid-column: 1 / -1;
}

.portal-ficha-item dt {
  margin: 0 0 0.25rem;
  font-size: 0.75rem;
  font-weight: 500;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  color: #859aaa;
}

.portal-ficha-item dd {
  margin: 0;
  color: #2d3033;
  font-size: 0.95rem;
  line-height: 1.45;
}

.portal-abogados-lista {
  display: flex;
  flex-direction: column;
  gap: 0.4rem;
}

.portal-abogados-lista li {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.4rem;
}

.portal-abogados-lista i {
  color: #859aaa;
  font-size: 1.1rem;
}

.portal-chip {
  display: inline-block;
  padding: 0.15em 0.55em;
  border-radius: 999px;
  background: rgba(65, 142, 157, 0.1);
  color: #418e9d;
  font-size: 0.7rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.03em;
}

.portal-resumen {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 0.75rem;
  margin-bottom: 1.5rem;
}

.portal-resumen-simple {
  grid-template-columns: repeat(2, minmax(0, 1fr));
  max-width: 28rem;
}

.portal-resumen-card {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  padding: 1rem 1.1rem;
  background: #fff;
  border: 1px solid #e3e6e9;
  border-radius: 0.75rem;
  box-shadow: 0 1px 2px rgba(0, 0, 0, 0.03);
}

.portal-resumen-icono {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 2.5rem;
  height: 2.5rem;
  border-radius: 0.6rem;
  background: rgba(65, 142, 157, 0.1);
  color: #418e9d;
  font-size: 1.35rem;
  flex-shrink: 0;
}

.portal-resumen-valor {
  display: block;
  font-size: 1.25rem;
  font-weight: 600;
  line-height: 1.2;
  color: #2d3033;
}

.portal-resumen-etiqueta {
  display: block;
  font-size: 0.75rem;
  color: #859aaa;
  margin-top: 0.1rem;
}

.portal-seccion {
  background: #fff;
  border: 1px solid #e3e6e9;
  border-radius: 0.75rem;
  margin-bottom: 1.25rem;
  overflow: hidden;
  box-shadow: 0 1px 2px rgba(0, 0, 0, 0.03);
}

.portal-seccion-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.75rem;
  padding: 1rem 1.25rem;
  border-bottom: 1px solid #eef0f3;
  background: #fafbfc;
}

.portal-seccion-header h2 {
  display: inline-flex;
  align-items: center;
  gap: 0.45rem;
  margin: 0;
  font-size: 1.05rem;
  font-weight: 600;
  color: #2d3033;
}

.portal-seccion-header h2 i {
  color: #418e9d;
  font-size: 1.25rem;
}

.portal-seccion-count {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 1.6rem;
  height: 1.6rem;
  padding: 0 0.45rem;
  border-radius: 999px;
  background: #e3e6e9;
  color: #667179;
  font-size: 0.8rem;
  font-weight: 600;
}

.portal-seccion-total {
  color: #667179;
  font-size: 0.9rem;
}

.portal-seccion-body {
  padding: 1.25rem;
}

.portal-subseccion-titulo {
  font-size: 0.8rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  color: #859aaa;
  margin: 0 0 0.75rem;
}

.portal-timeline-meta {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.5rem;
  margin-bottom: 0.35rem;
}

.portal-timeline-meta time {
  display: inline;
  margin-bottom: 0;
}

.portal-eventos-lista {
  display: flex;
  flex-direction: column;
  gap: 0.65rem;
}

.portal-evento-card {
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
  padding: 0.9rem 1rem;
  border: 1px solid #e3e6e9;
  border-radius: 0.6rem;
  background: #fafbfc;
}

.portal-evento-proximo {
  border-color: rgba(65, 142, 157, 0.28);
  background: rgba(65, 142, 157, 0.04);
}

.portal-evento-fecha {
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
  color: #667179;
  font-size: 0.875rem;
  font-weight: 500;
}

.portal-evento-fecha i {
  color: #418e9d;
  font-size: 1.1rem;
}

.portal-evento-lugar {
  color: #859aaa;
  font-size: 0.875rem;
}

.portal-evento-lugar i {
  margin-right: 0.15rem;
}

.portal-tabla {
  margin-bottom: 0;
}

.portal-tabla thead th {
  font-size: 0.75rem;
  text-transform: uppercase;
  letter-spacing: 0.03em;
  color: #859aaa;
  font-weight: 500;
  border-bottom-width: 1px;
  background: #fafbfc;
}

.portal-tabla tbody td {
  vertical-align: middle;
  border-color: #eef0f3;
}

.portal-tabla tfoot th {
  border-top: 1px solid #d3dae0;
  color: #2d3033;
  background: #fafbfc;
}

.portal-tabla-fecha {
  white-space: nowrap;
  color: #667179;
  font-size: 0.9rem;
}

.portal-docs-lista {
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
}

.portal-doc-item {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 0.75rem 1rem;
  padding: 0.85rem 1rem;
  border: 1px solid #e3e6e9;
  border-radius: 0.6rem;
  background: #fafbfc;
}

.portal-doc-info {
  display: flex;
  align-items: flex-start;
  gap: 0.75rem;
  min-width: 0;
  flex: 1;
}

.portal-doc-icono {
  font-size: 1.5rem;
  color: #418e9d;
  line-height: 1;
  margin-top: 0.1rem;
}

.portal-doc-nombre {
  display: block;
  font-weight: 500;
  color: #2d3033;
  word-break: break-word;
}

.portal-doc-fecha {
  display: block;
  color: #859aaa;
  font-size: 0.85rem;
  margin-top: 0.15rem;
}

.portal-doc-descarga {
  display: inline-flex;
  align-items: center;
  gap: 0.3rem;
  flex-shrink: 0;
}

.portal-filtro-card {
  background: #fff;
  border: 1px solid #e3e6e9;
  border-radius: 0.75rem;
  padding: 1.15rem 1.25rem;
  margin-bottom: 1.25rem;
  box-shadow: 0 1px 2px rgba(0, 0, 0, 0.03);
}

@media (max-width: 991.98px) {
  .portal-resumen {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}

@media (max-width: 575.98px) {
  .portal-ficha-grid {
    grid-template-columns: 1fr;
  }

  .portal-resumen,
  .portal-resumen-simple {
    grid-template-columns: 1fr;
  }

  .portal-detalle-titulo {
    font-size: 1.25rem;
  }

  .portal-caso-card {
    padding: 1rem;
  }

  .portal-seccion-body {
    padding: 1rem;
  }
}
