/* ---------------------------------------------------------------------
   IMPORTANTE: el orden de carga de las hojas es significativo.
   Está declarado en src/Support/Assets.php (constante CSS) y no debe
   alterarse: varias reglas de los archivos finales afinan a propósito lo
   que definen los primeros.
   --------------------------------------------------------------------- */

/* =====================================================================
   Componentes tardíos — verificación, evidencia, agrupación de
   expedientes, notificaciones e iconografía
   ---------------------------------------------------------------------
   Estas reglas se escribieron después que el resto del diseño y algunas
   ajustan deliberadamente lo definido antes (contraste de texto atenuado,
   alineación de los SVG que sustituyeron a los glifos). Por eso este
   archivo se carga al final y no debe adelantarse.
   ===================================================================== */

/* ===================================================================
   Verificación de correo electrónico
   Paleta institucional sobre fondo claro:
   guinda #691C32 · dorado #BC955C · crema #ECD798
   =================================================================== */

.verify-block {
  margin: 22px 0 4px;
  padding: 20px;
  border: 2px solid var(--line);
  border-radius: var(--radius);
  background: linear-gradient(160deg, #fffdfa, var(--surface));
  transition: border-color .2s ease, background .2s ease;
}
.verify-block[data-state="sent"]     { border-color: var(--dorado); background: linear-gradient(160deg, #fffaf0, var(--surface)); }
.verify-block[data-state="verified"] { border-color: #9ccdb5; background: linear-gradient(160deg, #f4fbf7, var(--surface)); }
.verify-block[data-state="error"]    { border-color: #e3a7ae; background: linear-gradient(160deg, #fdf6f7, var(--surface)); }

.verify-head { display: flex; gap: 14px; align-items: flex-start; margin-bottom: 18px; }
.verify-head > div { display: flex; flex-direction: column; gap: 3px; }
.verify-head strong { font-size: 15px; color: var(--guinda); }
.verify-head small { font-size: 12.5px; line-height: 1.55; color: var(--muted); }

.verify-icon {
  flex-shrink: 0; width: 42px; height: 42px; border-radius: 50%;
  display: grid; place-items: center; font-size: 19px;
  background: var(--crema); color: var(--guinda);
}
.verify-block[data-state="verified"] .verify-icon { background: #d8efe3; color: #1c6647; }

/* Fila: campo de correo + botón */
.verify-row { display: flex; gap: 10px; align-items: flex-end; flex-wrap: wrap; }
.verify-email-field { flex: 1 1 260px; margin-bottom: 0; }
.verify-row .button { flex-shrink: 0; height: 46px; white-space: nowrap; }

/* Mensajes de estado */
.verify-msg {
  margin: 14px 0 0; padding: 11px 14px; border-radius: 12px;
  font-size: 13px; line-height: 1.55; font-weight: 500;
}
.verify-msg[data-tone="info"]    { background: #fdf6ea; border: 1px solid #ecd9b4; color: #7a5a1e; }
.verify-msg[data-tone="error"]   { background: #fdf1f2; border: 1px solid #edc3c8; color: #8e2130; }
.verify-msg[data-tone="success"] { background: #eff8f3; border: 1px solid #bfe0cf; color: #1c6647; }
.verify-msg button {
  background: none; border: 0; padding: 0; margin-left: 4px;
  color: var(--guinda); font: inherit; font-weight: 700; text-decoration: underline; cursor: pointer;
}

/* Área del código */
.verify-code-area {
  margin-top: 16px; padding-top: 16px; border-top: 1px dashed var(--line);
  display: flex; gap: 10px; align-items: flex-end; flex-wrap: wrap;
}
.verify-code-area .field { flex: 0 1 190px; margin-bottom: 0; }
.verify-code-area .button { height: 46px; flex-shrink: 0; }

/* El reenvío es una acción secundaria: no debe competir con «Verificar». */
#resendBtn {
  height: 46px; padding: 0 4px; font-size: 13px; font-weight: 600;
  color: var(--muted); text-decoration: underline; background: none; border: 0;
}
#resendBtn:hover:not(:disabled) { color: var(--guinda); }
#resendBtn:disabled { text-decoration: none; opacity: .7; cursor: default; }

.code-input {
  font-family: ui-monospace, "Courier New", monospace;
  font-size: 22px !important; letter-spacing: .28em; text-align: center; font-weight: 700;
  color: var(--guinda);
}

.verify-hint { flex-basis: 100%; margin: 6px 0 0; font-size: 12px; line-height: 1.6; color: var(--muted); }

/* Estado verificado */
.verify-done { display: flex; gap: 13px; align-items: center; margin-top: 6px; }
.verify-done > div { display: flex; flex-direction: column; gap: 2px; }
.verify-done strong { font-size: 15px; color: #1c6647; }
.verify-done small { font-size: 12.5px; color: var(--muted); }
.verify-check {
  flex-shrink: 0; width: 42px; height: 42px; border-radius: 50%;
  display: grid; place-items: center; font-size: 21px; font-weight: 700;
  background: #1c6647; color: #fff;
}

/* Aviso de bloqueo al intentar avanzar sin verificar */
.verify-required {
  margin-top: 14px; padding: 12px 15px; border-radius: 12px;
  border-left: 4px solid var(--dorado); background: #fdf6ea;
  font-size: 13px; line-height: 1.6; color: #7a5a1e;
}

@media (max-width: 560px) {
  .verify-row, .verify-code-area { flex-direction: column; align-items: stretch; }
  .verify-row .button, .verify-code-area .button { width: 100%; }
  .verify-code-area .field { flex: 1 1 auto; }
}

/* Contraste mejorado para el texto atenuado (WCAG AA) */
.field-hint { display: block; margin-top: 5px; font-size: 12px; line-height: 1.55; color: var(--muted); }

/* Texto solo para lectores de pantalla: acompaña a los controles que únicamente
   muestran un símbolo, como el botón del menú móvil. */
.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;
}

/* --- Caja de evidencia ---------------------------------------------------
   El marcado usa <strong> y <small> dentro de un <span>; sin esta regla
   quedan en la misma línea y el bloque se lee como un párrafo corrido. */
.evidence-box > span:not(.evidence-icon) { display: flex; flex-direction: column; gap: 3px; }
.evidence-box strong { font-size: 13px; color: var(--guinda); }
.evidence-box small { font-size: 11px; color: var(--muted); line-height: 1.5; }
.evidence-box input[type="file"] {
  grid-column: 1 / -1;
  margin-top: 4px;
  font-size: 12px;
  color: var(--muted);
}
.evidence-box input[type="file"]::file-selector-button {
  margin-right: 10px;
  padding: 7px 14px;
  border: 0;
  border-radius: 999px;
  background: var(--guinda-soft);
  color: var(--guinda);
  font-weight: 650;
  font-size: 12px;
  cursor: pointer;
}
.evidence-box input[type="file"]::file-selector-button:hover { background: var(--crema); }

/* Archivos ya seleccionados */
.evidence-list { list-style: none; margin: 10px 0 0; padding: 0; display: grid; gap: 6px; }
.evidence-list li {
  display: flex; align-items: center; gap: 9px;
  padding: 8px 12px; border-radius: 11px;
  background: var(--guinda-soft); font-size: 12px;
}
.evidence-list .size { margin-left: auto; color: var(--muted); font-size: 11px; }

/* --- Agrupación de expedientes -------------------------------------------
   La carga activa se separa de los expedientes cerrados: mezclarlos hace que
   lo que ya no requiere trabajo compita por atención con lo que sí. */
.case-group { margin-bottom: 26px; }
.case-group-head {
  display: flex; align-items: center; gap: 10px;
  margin: 0 0 12px; padding-bottom: 9px;
  border-bottom: 2px solid var(--line);
}
.case-group-head h3 {
  margin: 0;
  font: 750 15px/1.3 Montserrat, Arial, sans-serif;
  color: var(--guinda);
}
.case-group-head span {
  min-width: 24px; padding: 2px 9px;
  border-radius: 999px;
  background: var(--guinda-soft); color: var(--guinda);
  font-size: 12px; font-weight: 700; text-align: center;
}

/* Los cerrados van visualmente apagados: están ahí para consulta, no para
   trabajarlos. */
.case-group-closed { opacity: .72; }
.case-group-closed .case-group-head { border-bottom-color: #ded6d3; }
.case-group-closed .case-group-head h3,
.case-group-closed .case-group-head span { color: var(--muted); background: var(--surface-alt); }
.case-group-closed:hover { opacity: 1; }

.empty-note { padding: 26px; text-align: center; color: var(--muted); font-size: 13px; }

/* Estado vacío con más aire: suele ser lo primero que ve alguien recién dado
   de alta, así que conviene que explique en vez de solo informar. */
.empty-note { padding: 40px 26px; text-align: center; color: var(--muted); font-size: 13px; line-height: 1.7; }
.empty-note strong { display: block; color: var(--guinda); font-size: 15px; margin-bottom: 6px; }
.empty-note em { color: var(--guinda); font-style: normal; font-weight: 650; }

/* --- Notificaciones del panel -------------------------------------------- */
.notif-wrap { position: relative; }

.notification-button { display: grid; place-items: center; color: var(--guinda); cursor: pointer; }
.notification-button:hover { background: var(--guinda-soft); border-color: var(--dorado); }
.notification-button[aria-expanded="true"] { background: var(--guinda); border-color: var(--guinda); color: #fff; }

/* El punto solo aparece cuando hay algo que atender */
.notification-button i { box-shadow: 0 0 0 2px #fff; }
.notification-button[aria-expanded="true"] i { box-shadow: 0 0 0 2px var(--guinda); }

.notif-panel {
  position: absolute; right: 0; top: calc(100% + 10px); z-index: 60;
  width: min(360px, calc(100vw - 32px));
  background: #fff; border: 1px solid var(--line); border-radius: 16px;
  box-shadow: var(--shadow-lg); overflow: hidden;
}
.notif-head {
  display: flex; align-items: center; justify-content: space-between;
  padding: 14px 17px; border-bottom: 1px solid var(--line); background: var(--guinda-soft);
}
.notif-head strong { font-size: 14px; color: var(--guinda); }
.notif-head span:not(:empty) {
  min-width: 22px; padding: 2px 8px; border-radius: 999px;
  background: var(--guinda); color: #fff; font-size: 11px; font-weight: 700; text-align: center;
}
.notif-list { max-height: 400px; overflow-y: auto; }

.notif-item {
  width: 100%; display: flex; gap: 12px; align-items: flex-start;
  padding: 13px 17px; border: 0; border-bottom: 1px solid var(--line);
  background: #fff; text-align: left; cursor: pointer;
}
.notif-item:last-child { border-bottom: 0; }
.notif-item:hover { background: var(--surface-alt); }
.notif-item > span:last-child { display: flex; flex-direction: column; gap: 2px; }
.notif-item strong { font-size: 13.5px; color: var(--ink); font-weight: 650; }
.notif-item small { font-size: 11.5px; color: var(--muted); line-height: 1.5; }

.notif-icon {
  flex-shrink: 0; width: 30px; height: 30px; border-radius: 9px;
  display: grid; place-items: center; font-size: 14px; font-weight: 700;
}
[data-tono="urgente"] .notif-icon { background: #fdf1f2; color: #96202e; }
[data-tono="aviso"]   .notif-icon { background: #fff6e8; color: #8a5a12; }
[data-tono="info"]    .notif-icon { background: var(--guinda-soft); color: var(--guinda); }

.notif-empty { margin: 0; padding: 30px 22px; text-align: center; font-size: 12.5px; color: var(--muted); line-height: 1.7; }

/* Nota al pie del catálogo de categorías: orienta a quien no encuentra su
   caso, en vez de dejarlo sin salida. */
.category-note {
  display: flex; gap: 11px; align-items: flex-start;
  margin: 18px 0 0; padding: 14px 16px;
  border-left: 4px solid var(--dorado);
  border-radius: 0 12px 12px 0;
  background: #fdf8ef;
  font-size: 12.5px; line-height: 1.65; color: #6d5a3c;
  text-align: left;
}
.category-note > span:first-child { font-size: 15px; color: var(--dorado-dark); flex-shrink: 0; }

/* --- Logos sobre fondo oscuro ---------------------------------------------
   Los logotipos actuales ya vienen en dorado o a color y se leen bien sobre el
   guinda del panel, del acceso y del pie. Antes se les forzaba el blanco con
   `brightness(0) invert(1)`, que era necesario cuando eran PNG guinda oscuro
   pero ahora los aplasta a una silueta blanca.

   El único que sigue necesitándolo es el institucional del Estado de México,
   que sí es guinda oscuro; por eso lleva su propia clase. */
.logo-oscuro { filter: brightness(0) invert(1); opacity: .85; }

/* ===================================================================
   Iconografía SVG
   Sustituye los glifos tipográficos que se usaban antes. Al ser trazo
   (no relleno), heredan el color del texto y se alinean con él.
   =================================================================== */
svg { flex-shrink: 0; }

/* Los contenedores que antes centraban un carácter ahora centran un SVG */
.quick-icon, .evidence-icon, .verify-icon, .verify-check,
.notif-icon, .category-symbol, .login-lock {
  display: inline-grid; place-items: center;
}
/* Estos dos van centrados como bloque, con el texto debajo */
.step-icon, .success-icon { display: grid; place-items: center; }

/* Botones e insignias con icono + texto */
.button svg, .public-nav button svg, .admin-sidebar nav button svg,
.sidebar-logout svg, .login-help svg, .category-note svg, .eyebrow svg {
  vertical-align: -0.18em;
}
.eyebrow svg, .category-note svg, .login-help svg { margin-right: 2px; }

/* El punto de selección de categoría: el SVG sustituye al carácter ✓ */
.radio-dot { display: inline-grid; place-items: center; }

/* Iconos del tablero y del resumen de roles */
.metric-grid.rich article > i, .role-summary article > i,
.trust-points b, .setting-toggle > i {
  display: inline-grid; place-items: center; font-style: normal;
}

/* En la barra lateral el icono y la etiqueta van en línea */
.admin-sidebar nav button { display: flex; align-items: center; gap: 10px; }
.sidebar-logout { display: flex; align-items: center; gap: 9px; }

/* El buscador ya no lleva el símbolo dentro del placeholder */
.search-input { padding-left: 14px; }
