/* ==========================================================================
   SISTEMA DE ESTILOS - PORTAL CEJ PUNO (DISEÑO INSTITUCIONAL FORMAL)
   ========================================================================== */

@import url('https://fonts.googleapis.com/css2?family=Inter:wght@300;400;500;600;700&family=Playfair+Display:ital,wght@0,600;1,400&display=swap');

:root {
  /* Paleta de Colores Corporativos (Tonos Blancos y Azules Judiciales) */
  --primary-deep: #0b2545;       /* Azul marino institucional */
  --primary-medium: #134074;     /* Azul intermedio */
  --primary-light: #1d4e89;      /* Azul claro para hover/enlaces */
  --accent-blue: #0077b6;        /* Azul brillante para elementos activos */
  --bg-main: #f0f4f8;            /* Fondo gris-celeste muy claro */
  --bg-card: #ffffff;            /* Fondo blanco de contenedores */
  --text-dark: #1f2937;          /* Texto principal oscuro */
  --text-muted: #6b7280;         /* Texto secundario atenuado */
  --border-color: #cbd5e1;       /* Bordes grises finos */
  --bg-table-header: #f8fafc;    /* Cabecera de tablas */
  
  /* Estados */
  --status-tramite: #d97706;     /* Ámbar */
  --status-resuelto: #15803d;    /* Verde */
  --status-apelacion: #1d4e89;   /* Azul */
  --status-archivado: #4b5563;   /* Gris */
  
  /* Variables de Diseño */
  --font-sans: 'Inter', sans-serif;
  --font-serif: 'Playfair Display', serif;
  --shadow-sm: 0 1px 3px rgba(0, 0, 0, 0.05), 0 1px 2px rgba(0, 0, 0, 0.1);
  --shadow-md: 0 4px 6px -1px rgba(0, 0, 0, 0.05), 0 2px 4px -1px rgba(0, 0, 0, 0.05);
  --shadow-lg: 0 10px 15px -3px rgba(11, 37, 69, 0.08), 0 4px 6px -2px rgba(11, 37, 69, 0.03);
  --transition: all 0.2s ease-in-out;
}

/* Reset de Estilos */
* {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
}

body {
  font-family: var(--font-sans);
  background-color: var(--bg-main);
  color: var(--text-dark);
  line-height: 1.5;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}

.hidden {
  display: none !important;
}

/* ==========================================================================
   PANTALLA DE ACCESO INSTITUCIONAL (LOGIN)
   ========================================================================== */
.login-screen-overlay {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background-color: var(--bg-main);
  background-image: 
    radial-gradient(at 0% 0%, rgba(19, 64, 116, 0.05) 0px, transparent 50%),
    radial-gradient(at 100% 100%, rgba(11, 37, 69, 0.08) 0px, transparent 50%);
  display: flex;
  justify-content: center;
  align-items: center;
  z-index: 9999;
}

.login-card {
  background: var(--bg-card);
  border: 1px solid var(--border-color);
  border-top: 5px solid var(--primary-deep);
  border-radius: 8px;
  width: 100%;
  max-width: 420px;
  padding: 2.5rem;
  box-shadow: var(--shadow-lg);
  text-align: center;
}

.login-header-seal {
  width: 65px;
  height: 65px;
  margin: 0 auto 1.25rem;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 2.25rem;
  background: #f1f5f9;
  border-radius: 50%;
  border: 1px solid var(--border-color);
}

.login-card h2 {
  font-size: 1.35rem;
  color: var(--primary-deep);
  font-weight: 700;
  letter-spacing: 0.5px;
  margin-bottom: 0.5rem;
}

.login-subtitle {
  font-size: 0.85rem;
  color: var(--text-muted);
  margin-bottom: 2rem;
  text-transform: uppercase;
  letter-spacing: 1px;
}

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

.form-group label {
  display: block;
  font-size: 0.8rem;
  font-weight: 600;
  color: var(--primary-deep);
  margin-bottom: 0.4rem;
}

.form-control {
  width: 100%;
  padding: 0.65rem 0.85rem;
  font-size: 0.9rem;
  font-family: inherit;
  border: 1px solid var(--border-color);
  border-radius: 4px;
  background-color: #fafbfc;
  color: var(--text-dark);
  transition: var(--transition);
}

.form-control:focus {
  outline: none;
  border-color: var(--primary-medium);
  background-color: var(--bg-card);
  box-shadow: 0 0 0 3px rgba(19, 64, 116, 0.1);
}

.btn-primary {
  width: 100%;
  padding: 0.75rem 1rem;
  font-size: 0.9rem;
  font-weight: 600;
  font-family: inherit;
  color: #ffffff;
  background-color: var(--primary-deep);
  border: 1px solid var(--primary-deep);
  border-radius: 4px;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.5rem;
  transition: var(--transition);
}

.btn-primary:hover {
  background-color: var(--primary-medium);
  border-color: var(--primary-medium);
}

.btn-primary:active {
  background-color: var(--primary-deep);
}

.login-hint {
  margin-top: 1.5rem;
  padding: 0.75rem;
  background-color: #f8fafc;
  border-radius: 4px;
  border: 1px dashed var(--border-color);
  font-size: 0.78rem;
  color: var(--text-muted);
}

.login-hint strong {
  color: var(--primary-medium);
}

/* ==========================================================================
   ESTRUCTURA PRINCIPAL DE LA APLICACIÓN
   ========================================================================== */
.app-container {
  display: flex;
  flex-direction: column;
  min-height: 100vh;
  width: 100%;
}

/* Header Institucional */
header {
  background-color: var(--primary-deep);
  color: #ffffff;
  padding: 0.75rem 2rem;
  display: flex;
  justify-content: space-between;
  align-items: center;
  border-bottom: 3px solid #b5893d; /* Franja dorada de elegancia judicial */
  box-shadow: var(--shadow-md);
}

.header-logo-section {
  display: flex;
  align-items: center;
  gap: 1rem;
}

.header-seal-icon {
  font-size: 1.8rem;
  background-color: rgba(255, 255, 255, 0.1);
  padding: 0.4rem;
  border-radius: 4px;
}

.header-title-text h1 {
  font-size: 1.15rem;
  font-weight: 700;
  letter-spacing: 0.5px;
  line-height: 1.2;
}

.header-title-text span {
  font-size: 0.75rem;
  color: rgba(255, 255, 255, 0.75);
  text-transform: uppercase;
  letter-spacing: 1px;
}

.header-actions {
  display: flex;
  align-items: center;
  gap: 0.85rem;
}

.btn-header-action {
  background-color: rgba(255, 255, 255, 0.08);
  border: 1px solid rgba(255, 255, 255, 0.2);
  color: #ffffff;
  font-family: inherit;
  font-size: 0.82rem;
  font-weight: 500;
  padding: 0.5rem 0.9rem;
  border-radius: 4px;
  cursor: pointer;
  display: flex;
  align-items: center;
  gap: 0.5rem;
  transition: var(--transition);
}

.btn-header-action:hover {
  background-color: rgba(255, 255, 255, 0.15);
  border-color: rgba(255, 255, 255, 0.3);
}

.notification-badge {
  background-color: #ef4444;
  color: #ffffff;
  font-size: 0.7rem;
  font-weight: 700;
  padding: 0.1rem 0.4rem;
  border-radius: 10px;
}

/* Área de Contenido Principal */
main {
  flex: 1;
  max-width: 1280px;
  width: 100%;
  margin: 0 auto;
  padding: 1.5rem 2rem;
  display: flex;
  flex-direction: column;
  gap: 1.5rem;
}

/* Banner Informativo */
.welcome-banner {
  background: var(--bg-card);
  border: 1px solid var(--border-color);
  border-left: 4px solid var(--primary-medium);
  border-radius: 4px;
  padding: 1.25rem 1.5rem;
  display: flex;
  justify-content: space-between;
  align-items: center;
  box-shadow: var(--shadow-sm);
}

.welcome-banner h2 {
  font-size: 1.2rem;
  color: var(--primary-deep);
  font-weight: 700;
  margin-bottom: 0.25rem;
}

.welcome-banner p {
  font-size: 0.85rem;
  color: var(--text-muted);
}

.current-date {
  font-size: 0.82rem;
  font-weight: 600;
  color: var(--primary-medium);
  background: #f1f5f9;
  padding: 0.4rem 0.8rem;
  border-radius: 4px;
  border: 1px solid var(--border-color);
}

/* Panel Estadístico */
.stats-container {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  gap: 1rem;
}

.stat-item-card {
  background: var(--bg-card);
  border: 1px solid var(--border-color);
  border-radius: 6px;
  padding: 1.25rem;
  display: flex;
  align-items: center;
  gap: 1rem;
  box-shadow: var(--shadow-sm);
  transition: transform 0.2s;
}

.stat-item-card:hover {
  transform: translateY(-2px);
  box-shadow: var(--shadow-md);
}

.stat-card-icon {
  width: 44px;
  height: 44px;
  background-color: #f1f5f9;
  border-radius: 4px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.35rem;
  color: var(--primary-medium);
}

.stat-card-info {
  display: flex;
  flex-direction: column;
}

.stat-card-number {
  font-size: 1.45rem;
  font-weight: 700;
  color: var(--primary-deep);
  line-height: 1.1;
}

.stat-card-label {
  font-size: 0.78rem;
  color: var(--text-muted);
  font-weight: 500;
}

/* ==========================================================================
   MÓDULO DE BÚSQUEDA Y FILTRADO
   ========================================================================== */
.search-panel {
  background: var(--bg-card);
  border: 1px solid var(--border-color);
  border-radius: 6px;
  padding: 1.5rem;
  box-shadow: var(--shadow-sm);
}

.search-tabs-container {
  display: flex;
  border-bottom: 1px solid var(--border-color);
  margin-bottom: 1.25rem;
  gap: 0.5rem;
}

.search-tab-button {
  background: none;
  border: none;
  border-bottom: 3px solid transparent;
  padding: 0.5rem 1rem;
  font-family: inherit;
  font-size: 0.88rem;
  font-weight: 600;
  color: var(--text-muted);
  cursor: pointer;
  transition: var(--transition);
}

.search-tab-button:hover {
  color: var(--primary-light);
}

.search-tab-button.active {
  color: var(--primary-deep);
  border-bottom-color: var(--primary-deep);
}

.search-controls-row {
  display: flex;
  gap: 0.75rem;
}

.search-input-group {
  flex: 1;
  position: relative;
  display: flex;
  align-items: center;
}

.search-input-icon {
  position: absolute;
  left: 0.85rem;
  font-size: 1rem;
  color: var(--text-muted);
}

.search-text-input {
  width: 100%;
  padding: 0.75rem 1rem 0.75rem 2.5rem;
  font-size: 0.92rem;
  font-family: inherit;
  border: 1px solid var(--border-color);
  border-radius: 4px;
  background-color: #fdfdfd;
}

.search-text-input:focus {
  outline: none;
  border-color: var(--primary-medium);
  box-shadow: 0 0 0 3px rgba(19, 64, 116, 0.08);
}

.btn-search-trigger {
  padding: 0 1.5rem;
  background-color: var(--primary-deep);
  border: 1px solid var(--primary-deep);
  color: #ffffff;
  font-family: inherit;
  font-size: 0.9rem;
  font-weight: 600;
  border-radius: 4px;
  cursor: pointer;
  transition: var(--transition);
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

.btn-search-trigger:hover {
  background-color: var(--primary-medium);
  border-color: var(--primary-medium);
}

.btn-filters-toggle {
  background-color: #f1f5f9;
  border: 1px solid var(--border-color);
  color: var(--primary-deep);
  font-family: inherit;
  font-size: 0.82rem;
  font-weight: 500;
  padding: 0.4rem 0.8rem;
  border-radius: 4px;
  cursor: pointer;
  margin-top: 0.85rem;
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
  transition: var(--transition);
}

.btn-filters-toggle:hover {
  background-color: #e2e8f0;
}

.filters-expanded-panel {
  margin-top: 1rem;
  padding: 1.25rem;
  background-color: #f8fafc;
  border: 1px solid var(--border-color);
  border-radius: 4px;
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
  gap: 1rem;
}

.filter-action-buttons {
  grid-column: 1 / -1;
  display: flex;
  justify-content: flex-end;
  gap: 0.5rem;
  margin-top: 0.5rem;
}

.btn-outline-clear {
  background-color: transparent;
  border: 1px solid var(--border-color);
  color: var(--text-dark);
  font-family: inherit;
  font-size: 0.85rem;
  font-weight: 500;
  padding: 0.5rem 1rem;
  border-radius: 4px;
  cursor: pointer;
  transition: var(--transition);
}

.btn-outline-clear:hover {
  background-color: #f1f5f9;
  border-color: #cbd5e1;
}

/* ==========================================================================
   RESULTADOS DE BÚSQUEDA Y SIDEBAR
   ========================================================================== */
.main-content-layout {
  display: grid;
  grid-template-columns: 1fr 300px;
  gap: 1.5rem;
}

@media (max-width: 900px) {
  .main-content-layout {
    grid-template-columns: 1fr;
  }
}

.results-container-section {
  display: flex;
  flex-direction: column;
  gap: 1rem;
}

.results-meta-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  border-bottom: 2px solid var(--border-color);
  padding-bottom: 0.5rem;
}

.results-meta-header h3 {
  font-size: 1rem;
  font-weight: 700;
  color: var(--primary-deep);
}

.results-counter-indicator {
  font-size: 0.82rem;
  color: var(--text-muted);
  font-weight: 500;
}

.results-cards-list {
  display: flex;
  flex-direction: column;
  gap: 1rem;
}

/* Tarjeta de Expediente Individual */
.case-item-card {
  background-color: var(--bg-card);
  border: 1px solid var(--border-color);
  border-radius: 6px;
  padding: 1.25rem;
  box-shadow: var(--shadow-sm);
  display: flex;
  flex-direction: column;
  gap: 1rem;
  transition: border-color 0.2s, box-shadow 0.2s;
}

.case-item-card:hover {
  border-color: var(--primary-light);
  box-shadow: var(--shadow-md);
}

.case-card-top-row {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
}

.case-card-identifier {
  font-size: 1.05rem;
  font-weight: 700;
  color: var(--primary-deep);
  font-family: var(--font-sans);
}

.case-card-specialty {
  font-size: 0.8rem;
  color: var(--text-muted);
  font-weight: 500;
  margin-top: 0.1rem;
}

/* Badges de Estado del Proceso */
.status-badge {
  font-size: 0.72rem;
  font-weight: 700;
  text-transform: uppercase;
  padding: 0.25rem 0.65rem;
  border-radius: 4px;
  letter-spacing: 0.5px;
}

.status-badge.en-tramite {
  background-color: #fef3c7;
  color: #b45309;
  border: 1px solid #fde68a;
}

.status-badge.resuelto {
  background-color: #dcfce7;
  color: #15803d;
  border: 1px solid #bbf7d0;
}

.status-badge.en-apelacion {
  background-color: #dbeafe;
  color: #1d4e89;
  border: 1px solid #bfdbfe;
}

.status-badge.archivado {
  background-color: #f3f4f6;
  color: #4b5563;
  border: 1px solid #e5e7eb;
}

.case-card-grid-details {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 0.75rem 1.5rem;
  background-color: #f8fafc;
  padding: 0.85rem 1.15rem;
  border-radius: 4px;
  border: 1px solid #e2e8f0;
}

@media (max-width: 600px) {
  .case-card-grid-details {
    grid-template-columns: 1fr;
  }
}

.grid-detail-item {
  display: flex;
  flex-direction: column;
}

.detail-item-label {
  font-size: 0.7rem;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  color: var(--text-muted);
  font-weight: 600;
}

.detail-item-value {
  font-size: 0.82rem;
  font-weight: 600;
  color: var(--primary-deep);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.case-card-actions-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  border-top: 1px solid #e2e8f0;
  padding-top: 0.85rem;
}

.case-starting-date {
  font-size: 0.8rem;
  color: var(--text-muted);
}

.case-starting-date strong {
  color: var(--text-dark);
}

.action-buttons-group {
  display: flex;
  gap: 0.5rem;
}

.btn-bookmark-action {
  background: none;
  border: 1px solid var(--border-color);
  color: var(--text-muted);
  width: 32px;
  height: 32px;
  border-radius: 4px;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: var(--transition);
}

.btn-bookmark-action:hover {
  background-color: #f1f5f9;
  color: #e11d48;
  border-color: #fda4af;
}

.btn-bookmark-action.active {
  color: #e11d48;
  border-color: #f43f5e;
  background-color: #fff1f2;
}

.btn-detail-trigger {
  background-color: var(--primary-medium);
  border: 1px solid var(--primary-medium);
  color: #ffffff;
  font-family: inherit;
  font-size: 0.82rem;
  font-weight: 600;
  padding: 0.4rem 1rem;
  border-radius: 4px;
  cursor: pointer;
  transition: var(--transition);
}

.btn-detail-trigger:hover {
  background-color: var(--primary-light);
  border-color: var(--primary-light);
}

/* Estado de lista vacía */
.empty-results-box {
  background: var(--bg-card);
  border: 1px dashed var(--border-color);
  border-radius: 6px;
  padding: 3rem;
  text-align: center;
  color: var(--text-muted);
}

.empty-results-box h4 {
  font-size: 1.05rem;
  color: var(--primary-deep);
  margin: 0.75rem 0 0.25rem;
}

.empty-results-box p {
  font-size: 0.85rem;
}

/* Barra Lateral (Sidebar) */
.sidebar-panel-container {
  display: flex;
  flex-direction: column;
  gap: 1.25rem;
}

.sidebar-card-widget {
  background: var(--bg-card);
  border: 1px solid var(--border-color);
  border-radius: 6px;
  padding: 1.25rem;
  box-shadow: var(--shadow-sm);
}

.sidebar-card-widget h3 {
  font-size: 0.88rem;
  color: var(--primary-deep);
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  border-bottom: 1px solid var(--border-color);
  padding-bottom: 0.5rem;
  margin-bottom: 0.85rem;
}

.history-records-list, .favorites-records-list {
  display: flex;
  flex-direction: column;
  gap: 0.65rem;
}

.history-record-item, .favorite-record-item {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 0.5rem 0.65rem;
  border-radius: 4px;
  border: 1px solid #f1f5f9;
  background-color: #fafbfc;
  cursor: pointer;
  transition: var(--transition);
}

.history-record-item:hover, .favorite-record-item:hover {
  background-color: #f1f5f9;
  border-color: var(--border-color);
}

.record-item-meta-info {
  display: flex;
  flex-direction: column;
  max-width: 85%;
}

.record-query-string {
  font-size: 0.8rem;
  font-weight: 600;
  color: var(--primary-deep);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.record-query-timestamp, .record-query-subtext {
  font-size: 0.7rem;
  color: var(--text-muted);
}

.btn-delete-record {
  background: none;
  border: none;
  color: var(--text-muted);
  cursor: pointer;
  padding: 0.2rem;
  border-radius: 3px;
}

.btn-delete-record:hover {
  color: #ef4444;
  background-color: #fee2e2;
}

/* ==========================================================================
   MODALES (ESTILO FORMAL CON FONDO SEMI-TRANSPARENTE)
   ========================================================================== */
.modal-backdrop-overlay {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background-color: rgba(11, 37, 69, 0.4);
  backdrop-filter: blur(2px);
  display: flex;
  justify-content: center;
  align-items: center;
  z-index: 1000;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.2s ease-in-out;
  padding: 1.5rem;
}

.modal-backdrop-overlay.show {
  opacity: 1;
  pointer-events: auto;
}

.modal-box-wrapper {
  background: var(--bg-card);
  border: 1px solid var(--border-color);
  border-top: 6px solid var(--primary-deep);
  border-radius: 8px;
  width: 100%;
  max-width: 950px;
  max-height: 90vh;
  box-shadow: var(--shadow-lg);
  display: flex;
  flex-direction: column;
  transform: translateY(20px);
  transition: transform 0.2s ease-out;
}

.modal-backdrop-overlay.show .modal-box-wrapper {
  transform: translateY(0);
}

.modal-box-header {
  padding: 1rem 1.5rem;
  border-bottom: 1px solid var(--border-color);
  background-color: #f8fafc;
  display: flex;
  justify-content: space-between;
  align-items: center;
  border-radius: 8px 8px 0 0;
}

.modal-box-title-area {
  display: flex;
  align-items: center;
  gap: 0.75rem;
}

.modal-box-title-area h3 {
  font-size: 1.15rem;
  color: var(--primary-deep);
  font-weight: 700;
}

.btn-close-modal-box {
  background: none;
  border: 1px solid var(--border-color);
  width: 28px;
  height: 28px;
  font-size: 1.2rem;
  font-weight: 300;
  border-radius: 50%;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--text-muted);
  transition: var(--transition);
}

.btn-close-modal-box:hover {
  background-color: #f1f5f9;
  color: var(--text-dark);
  border-color: var(--text-muted);
}

.modal-box-body {
  padding: 1.5rem;
  overflow-y: auto;
  flex: 1;
}

/* Grid de Ficha Técnica dentro de Detalles */
.modal-grid-metadata {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 1rem;
  margin-bottom: 1.5rem;
  background-color: #f1f5f9;
  padding: 1.25rem;
  border-radius: 6px;
  border: 1px solid var(--border-color);
}

@media (max-width: 800px) {
  .modal-grid-metadata {
    grid-template-columns: repeat(2, 1fr);
  }
}

@media (max-width: 600px) {
  .modal-grid-metadata {
    grid-template-columns: 1fr;
  }
}

.metadata-field-cell {
  display: flex;
  gap: 0.75rem;
  background: var(--bg-card);
  padding: 0.75rem;
  border-radius: 4px;
  border: 1px solid var(--border-color);
}

.metadata-field-icon {
  font-size: 1.25rem;
  display: flex;
  align-items: center;
  color: var(--primary-medium);
}

.metadata-field-content-block {
  display: flex;
  flex-direction: column;
  flex: 1;
}

.metadata-cell-label {
  font-size: 0.68rem;
  text-transform: uppercase;
  color: var(--text-muted);
  font-weight: 600;
}

.metadata-cell-value {
  font-size: 0.82rem;
  font-weight: 700;
  color: var(--primary-deep);
  word-break: break-word;
}

.btn-reniec-consultation {
  background-color: #f8fafc;
  border: 1px solid var(--border-color);
  color: var(--primary-light);
  font-family: inherit;
  font-size: 0.7rem;
  font-weight: 700;
  padding: 0.2rem 0.5rem;
  border-radius: 3px;
  cursor: pointer;
  margin-top: 0.25rem;
  display: inline-flex;
  align-items: center;
  gap: 0.25rem;
  align-self: flex-start;
  transition: var(--transition);
}

.btn-reniec-consultation:hover {
  background-color: var(--primary-deep);
  color: #ffffff;
  border-color: var(--primary-deep);
}

/* Modales Pestañas Internas */
.modal-navigation-tabs {
  display: flex;
  border-bottom: 2px solid var(--border-color);
  margin-bottom: 1.25rem;
  gap: 0.5rem;
}

.modal-tab-toggle-btn {
  background: none;
  border: none;
  border-bottom: 3px solid transparent;
  padding: 0.65rem 1.25rem;
  font-family: inherit;
  font-size: 0.88rem;
  font-weight: 600;
  color: var(--text-muted);
  cursor: pointer;
  transition: var(--transition);
}

.modal-tab-toggle-btn:hover {
  color: var(--primary-medium);
}

.modal-tab-toggle-btn.active {
  color: var(--primary-deep);
  border-bottom-color: var(--primary-deep);
}

/* ==========================================================================
   LÍNEA DE TIEMPO VERTICAL FORMAL
   ========================================================================== */
.timeline-vertical-structure {
  position: relative;
  padding: 1rem 0;
  margin-left: 2rem;
}

.timeline-vertical-structure::before {
  content: '';
  position: absolute;
  left: 11px;
  top: 0;
  bottom: 0;
  width: 3px;
  background-color: var(--border-color);
}

.timeline-event-row {
  position: relative;
  padding-left: 2.5rem;
  margin-bottom: 1.5rem;
}

.timeline-event-row:last-child {
  margin-bottom: 0;
}

.timeline-event-indicator {
  position: absolute;
  left: 0;
  top: 4px;
  width: 25px;
  height: 25px;
  border-radius: 50%;
  background-color: var(--bg-card);
  border: 4px solid var(--border-color);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 1;
  transition: var(--transition);
}

.timeline-event-row.active .timeline-event-indicator {
  border-color: var(--accent-blue);
  background-color: var(--primary-deep);
  transform: scale(1.1);
}

.timeline-event-card-body {
  background-color: #f8fafc;
  border: 1px solid var(--border-color);
  border-radius: 6px;
  padding: 1rem 1.25rem;
  box-shadow: var(--shadow-sm);
  transition: var(--transition);
  cursor: pointer;
}

.timeline-event-card-body:hover {
  border-color: var(--primary-light);
  background-color: var(--bg-card);
  box-shadow: var(--shadow-md);
}

.timeline-event-row.active .timeline-event-card-body {
  border-left: 4px solid var(--accent-blue);
  background-color: var(--bg-card);
}

.timeline-event-meta-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 0.35rem;
}

.timeline-event-date-stamp {
  font-size: 0.75rem;
  font-weight: 700;
  color: var(--primary-medium);
}

.timeline-event-category-badge {
  font-size: 0.65rem;
  font-weight: 700;
  text-transform: uppercase;
  padding: 0.15rem 0.45rem;
  border-radius: 3px;
}

.timeline-event-category-badge.escrito {
  background-color: #e0f2fe;
  color: #0369a1;
}

.timeline-event-category-badge.resolucion {
  background-color: #dcfce7;
  color: #15803d;
}

.timeline-event-category-badge.notificacion {
  background-color: #fee2e2;
  color: #b91c1c;
}

.timeline-event-category-badge.audiencia {
  background-color: #fef3c7;
  color: #d97706;
}

.timeline-event-title-text {
  font-size: 0.9rem;
  font-weight: 700;
  color: var(--primary-deep);
  margin-bottom: 0.25rem;
}

.timeline-event-description-text {
  font-size: 0.8rem;
  color: var(--text-dark);
}

.btn-timeline-doc-view {
  background: none;
  border: 1px solid var(--border-color);
  color: var(--primary-light);
  font-family: inherit;
  font-size: 0.72rem;
  font-weight: 600;
  padding: 0.25rem 0.5rem;
  border-radius: 3px;
  cursor: pointer;
  margin-top: 0.5rem;
  display: inline-flex;
  align-items: center;
  gap: 0.25rem;
  transition: var(--transition);
}

.btn-timeline-doc-view:hover {
  background-color: var(--primary-deep);
  color: #ffffff;
  border-color: var(--primary-deep);
}

/* ==========================================================================
   VISOR PDF SIMULADO (ESTILO PAPEL BOND JUDICIAL REGIONAL)
   ========================================================================== */
.pdf-simulator-container {
  display: grid;
  grid-template-columns: 240px 1fr;
  gap: 1.25rem;
  height: 520px;
}

@media (max-width: 750px) {
  .pdf-simulator-container {
    grid-template-columns: 1fr;
    height: auto;
  }
}

/* Lista lateral de documentos */
.pdf-docs-sidebar-navigation {
  border: 1px solid var(--border-color);
  border-radius: 6px;
  background-color: #f8fafc;
  display: flex;
  flex-direction: column;
  overflow-y: auto;
}

.pdf-sidebar-title-header {
  font-size: 0.75rem;
  text-transform: uppercase;
  font-weight: 700;
  color: var(--primary-deep);
  padding: 0.75rem;
  border-bottom: 1px solid var(--border-color);
  background-color: #f1f5f9;
}

.pdf-sidebar-document-item {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  padding: 0.65rem 0.75rem;
  border-bottom: 1px solid #f1f5f9;
  cursor: pointer;
  transition: var(--transition);
}

.pdf-sidebar-document-item:hover {
  background-color: #f1f5f9;
}

.pdf-sidebar-document-item.active {
  background-color: #e0f2fe;
  border-left: 3px solid var(--accent-blue);
}

.pdf-sidebar-document-icon {
  font-size: 1.15rem;
  color: var(--text-muted);
}

.pdf-sidebar-document-item.active .pdf-sidebar-document-icon {
  color: var(--primary-medium);
}

.pdf-sidebar-document-info-cell {
  display: flex;
  flex-direction: column;
  overflow: hidden;
}

.pdf-sidebar-doc-label {
  font-size: 0.78rem;
  font-weight: 600;
  color: var(--text-dark);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.pdf-sidebar-doc-date {
  font-size: 0.68rem;
  color: var(--text-muted);
}

/* Área de despliegue del papel */
.pdf-document-canvas-display {
  display: flex;
  flex-direction: column;
  border: 1px solid var(--border-color);
  border-radius: 6px;
  background-color: #e2e8f0;
  overflow: hidden;
}

.pdf-canvas-top-toolbar {
  background-color: #f1f5f9;
  border-bottom: 1px solid var(--border-color);
  padding: 0.5rem 1rem;
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.pdf-canvas-active-filename {
  font-size: 0.8rem;
  font-weight: 700;
  color: var(--primary-deep);
  font-family: monospace;
}

.pdf-canvas-zoom-indicators {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  font-size: 0.78rem;
  color: var(--text-muted);
}

.btn-pdf-action-icon {
  background: none;
  border: 1px solid var(--border-color);
  width: 26px;
  height: 26px;
  border-radius: 4px;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 0.85rem;
  transition: var(--transition);
}

.btn-pdf-action-icon:hover {
  background-color: #e2e8f0;
  color: var(--text-dark);
}

.pdf-scroller-viewport {
  flex: 1;
  padding: 1.5rem;
  overflow-y: auto;
  display: flex;
  justify-content: center;
}

/* Hoja Bond Judicial Simulada */
.bond-paper-sheet-simulation {
  background-color: #ffffff;
  width: 100%;
  max-width: 650px;
  min-height: 800px;
  box-shadow: 0 4px 10px rgba(0,0,0,0.15);
  border: 1px solid #cbd5e1;
  padding: 3.5rem 3rem 4rem; /* Margen oficial */
  position: relative;
  font-family: 'Courier New', Courier, monospace;
  font-size: 0.82rem;
  line-height: 1.6;
  color: #111111;
  user-select: text;
}

/* Escudo de Agua Oficial en Fondo */
.bond-paper-sheet-simulation::before {
  content: "🏛️";
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  font-size: 12rem;
  opacity: 0.025;
  pointer-events: none;
}

/* Firma y Sello Digital al Pie */
.digital-stamp-signature-area {
  margin-top: 3rem;
  border-top: 1px dashed var(--border-color);
  padding-top: 1rem;
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  font-family: var(--font-sans);
  font-size: 0.72rem;
  line-height: 1.4;
  color: var(--text-muted);
}

.digital-signature-horizontal-line {
  width: 180px;
  border-top: 1px solid var(--text-muted);
  margin-bottom: 0.5rem;
}

.digital-stamp-badge {
  border: 1.5px solid #16a34a;
  color: #16a34a;
  border-radius: 4px;
  padding: 0.3rem 0.5rem;
  text-transform: uppercase;
  font-weight: 700;
  font-size: 0.65rem;
  margin-bottom: 0.5rem;
  transform: rotate(-1.5deg);
  display: inline-block;
  background-color: rgba(22, 163, 74, 0.05);
}

/* ==========================================================================
   FICHA RENIEC SIMULADA (ALTA FIDELIDAD)
   ========================================================================== */
.reniec-id-card-structure {
  background: linear-gradient(135deg, #ffffff, #f0f4f8);
  border: 1px solid #94a3b8;
  border-radius: 8px;
  box-shadow: var(--shadow-md);
  padding: 1.25rem;
  max-width: 480px;
  margin: 0 auto;
  border-top: 4px solid #b91c1c; /* Borde rojo RENIEC */
}

.reniec-card-header-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  border-bottom: 1.5px solid #b91c1c;
  padding-bottom: 0.5rem;
  margin-bottom: 1rem;
}

.reniec-card-header-logo-block {
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

.reniec-national-seal-icon {
  font-size: 1.8rem;
}

.reniec-logo-title-text h4 {
  font-size: 0.72rem;
  font-weight: 700;
  color: #b91c1c;
  line-height: 1.2;
}

.reniec-logo-title-text span {
  font-size: 0.58rem;
  color: var(--text-dark);
  font-weight: 600;
  display: block;
}

.reniec-card-dni-number-block {
  background-color: #fee2e2;
  color: #b91c1c;
  border: 1px solid #fca5a5;
  font-size: 0.95rem;
  font-weight: 700;
  padding: 0.2rem 0.5rem;
  border-radius: 4px;
  font-family: monospace;
}

.reniec-card-main-grid-body {
  display: grid;
  grid-template-columns: 100px 1fr;
  gap: 1.25rem;
}

.reniec-avatar-frame-box {
  width: 100px;
  height: 125px;
  border: 1px solid var(--border-color);
  border-radius: 4px;
  background-color: #e2e8f0;
  display: flex;
  align-items: center;
  justify-content: center;
  overflow: hidden;
}

.reniec-avatar-image {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.reniec-fields-data-column {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 0.5rem 0.75rem;
}

.reniec-data-field-item {
  display: flex;
  flex-direction: column;
}

.reniec-data-field-item.full-width {
  grid-column: span 2;
}

.reniec-data-label {
  font-size: 0.62rem;
  text-transform: uppercase;
  color: var(--text-muted);
  font-weight: 600;
  line-height: 1.2;
}

.reniec-data-value {
  font-size: 0.78rem;
  font-weight: 700;
  color: var(--primary-deep);
}

/* ==========================================================================
   TABLA DE NOTIFICACIONES ELECTRÓNICAS SINOE
   ========================================================================== */
.sinoe-table-scroll-container {
  overflow-x: auto;
  border: 1px solid var(--border-color);
  border-radius: 6px;
  background: var(--bg-card);
}

.sinoe-formal-table {
  width: 100%;
  border-collapse: collapse;
  font-family: var(--font-sans);
  font-size: 0.82rem;
  text-align: left;
}

.sinoe-formal-table th {
  background-color: var(--bg-table-header);
  color: var(--primary-deep);
  font-weight: 700;
  padding: 0.75rem 1rem;
  border-bottom: 2px solid var(--border-color);
  text-transform: uppercase;
  font-size: 0.72rem;
  letter-spacing: 0.5px;
}

.sinoe-formal-table td {
  padding: 0.75rem 1rem;
  border-bottom: 1px solid #f1f5f9;
  color: var(--text-dark);
}

.sinoe-formal-table tr:hover {
  background-color: #f8fafc;
}

.btn-table-action-trigger {
  background-color: #f1f5f9;
  border: 1px solid var(--border-color);
  color: var(--primary-medium);
  font-family: inherit;
  font-size: 0.75rem;
  font-weight: 600;
  padding: 0.3rem 0.6rem;
  border-radius: 4px;
  cursor: pointer;
  transition: var(--transition);
}

.btn-table-action-trigger:hover {
  background-color: var(--primary-deep);
  color: #ffffff;
  border-color: var(--primary-deep);
}

/* Formulario de registro */
.creator-panel-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 1rem;
}

.creator-panel-grid .span-2 {
  grid-column: span 2;
}

/* Contenedor de Toasts */
.toast-container-right-bottom {
  position: fixed;
  bottom: 1.5rem;
  right: 1.5rem;
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
  z-index: 10000;
  pointer-events: none;
}

.toast-message-item {
  pointer-events: auto;
  background-color: var(--primary-deep);
  color: #ffffff;
  padding: 0.75rem 1.25rem;
  border-radius: 4px;
  font-size: 0.8rem;
  font-weight: 500;
  box-shadow: var(--shadow-md);
  display: flex;
  align-items: center;
  gap: 0.5rem;
  transform: translateY(20px);
  opacity: 0;
  animation: toastEntrance 0.3s ease forwards;
  border-left: 4px solid var(--accent-blue);
}

.toast-message-item.success {
  border-left-color: #22c55e;
}

.toast-message-item.warning {
  border-left-color: #eab308;
}

.toast-message-item.info {
  border-left-color: #3b82f6;
}

@keyframes toastEntrance {
  to {
    transform: translateY(0);
    opacity: 1;
  }
}

/* Pie de Página */
footer {
  background-color: #e2e8f0;
  border-top: 1px solid var(--border-color);
  padding: 1.5rem;
  text-align: center;
  font-size: 0.78rem;
  color: var(--text-muted);
  margin-top: auto;
}

footer strong {
  color: var(--primary-deep);
}

footer p {
  margin-top: 0.25rem;
}
