:root {
  --navy-950: #0b1f3a;
  --navy-900: #102a4c;
  --navy-800: #17355e;
  --navy-700: #23477a;
  --gold-500: #b8912f;
  --gold-400: #cca94a;
  --gold-100: #f6ecd4;
  --ink: #1c2430;
  --ink-soft: #52606f;
  --paper: #f7f7f5;
  --paper-card: #ffffff;
  --line: #e3e2dd;
  --green-600: #2f7a4f;
  --green-100: #e4f3e8;
  --amber-700: #9a6b12;
  --amber-100: #fbf0da;
  --red-700: #a3342b;
  --red-100: #fbe4e1;
  --radius: 10px;
}

* {
  box-sizing: border-box;
}

html,
body {
  margin: 0;
  padding: 0;
}

body {
  background: var(--paper);
  color: var(--ink);
  font-family: "Inter", system-ui, sans-serif;
  min-height: 100vh;
}

.visually-hidden {
  position: absolute;
  width: 1px;
  height: 1px;
  overflow: hidden;
  clip: rect(0 0 0 0);
  white-space: nowrap;
}

/* Header */

.site-header {
  background: var(--navy-950);
  color: #fff;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 14px 16px;
}

.wordmark {
  display: flex;
  flex-direction: column;
  line-height: 1.25;
  min-width: 0;
}

.wordmark-tribunal {
  font-size: 0.68rem;
  letter-spacing: 0.05em;
  text-transform: uppercase;
  color: var(--gold-400);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.wordmark-sistema {
  font-family: "Lora", serif;
  font-weight: 600;
  font-size: 1.15rem;
}

.header-user {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-shrink: 0;
}

.header-user-name {
  font-size: 0.85rem;
  color: #cdd6e3;
  display: none;
}

.header-user-avatar {
  width: 32px;
  height: 32px;
  border-radius: 50%;
  background: var(--navy-700);
  border: 1px solid var(--gold-500);
  color: var(--gold-100);
  font-size: 0.75rem;
  font-weight: 600;
  display: flex;
  align-items: center;
  justify-content: center;
}

@media (min-width: 560px) {
  .header-user-name {
    display: inline;
  }
}

/* Demo banner */

.demo-banner {
  background: var(--gold-100);
  color: var(--amber-700);
  font-size: 0.8rem;
  text-align: center;
  padding: 8px 16px;
  border-bottom: 1px solid var(--gold-400);
}

/* Navegación entre Expedientes / Avisos */

.nav-secciones {
  display: flex;
  gap: 4px;
  padding: 0 16px;
  max-width: 900px;
  margin: 0 auto;
  border-bottom: 1px solid var(--line);
}

.nav-boton {
  background: none;
  border: none;
  border-bottom: 2px solid transparent;
  font-family: inherit;
  font-size: 0.88rem;
  font-weight: 600;
  color: var(--ink-soft);
  padding: 13px 6px;
  margin-right: 18px;
  min-height: 44px;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  gap: 6px;
}

.nav-boton[aria-current="page"] {
  color: var(--navy-900);
  border-bottom-color: var(--gold-500);
}

.nav-badge {
  background: var(--red-100);
  color: var(--red-700);
  font-size: 0.7rem;
  font-weight: 700;
  padding: 1px 7px;
  border-radius: 999px;
  min-width: 18px;
  text-align: center;
}

.nav-badge:empty {
  display: none;
}

/* Main / toolbar */

.main {
  max-width: 900px;
  margin: 0 auto;
  padding: 20px 16px 64px;
}

.toolbar {
  display: flex;
  flex-direction: column;
  gap: 12px;
  margin-bottom: 8px;
}

.search-field input {
  width: 100%;
  padding: 13px 14px;
  font-size: 1rem;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--paper-card);
  color: var(--ink);
  font-family: inherit;
}

.search-field input:focus {
  outline: 2px solid var(--navy-700);
  outline-offset: 1px;
}

.filters {
  display: flex;
  gap: 10px;
}

.filter-field {
  flex: 1;
  min-width: 0;
  display: flex;
  flex-direction: column;
  gap: 4px;
  font-size: 0.75rem;
  color: var(--ink-soft);
  font-weight: 600;
}

.filter-field select {
  width: 100%;
  padding: 11px 10px;
  font-size: 0.95rem;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--paper-card);
  color: var(--ink);
  font-family: inherit;
}

.filter-field select:focus {
  outline: 2px solid var(--navy-700);
  outline-offset: 1px;
}

.resultados-contador {
  font-size: 0.8rem;
  color: var(--ink-soft);
  margin: 14px 2px 10px;
}

/* Lista de expedientes */

.lista-expedientes {
  list-style: none;
  margin: 0;
  padding: 0;
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.tarjeta-expediente {
  background: var(--paper-card);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  transition: border-color 0.15s ease, box-shadow 0.15s ease;
}

.tarjeta-expediente:hover,
.tarjeta-expediente:focus-within {
  border-color: var(--navy-700);
  box-shadow: 0 2px 10px rgba(11, 31, 58, 0.08);
}

.tarjeta-link {
  display: block;
  padding: 14px 16px;
  text-decoration: none;
  color: inherit;
  min-height: 44px;
}

.tarjeta-fila-superior {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
}

.tarjeta-numero {
  font-family: "Lora", serif;
  font-weight: 600;
  font-size: 1rem;
  color: var(--navy-900);
}

.badge {
  font-size: 0.7rem;
  font-weight: 600;
  padding: 3px 9px;
  border-radius: 999px;
  white-space: nowrap;
}

.badge-tramite {
  background: var(--amber-100);
  color: var(--amber-700);
}

.badge-concluido {
  background: var(--green-100);
  color: var(--green-600);
}

.tarjeta-actor {
  margin: 6px 0 4px;
  font-size: 0.95rem;
  color: var(--ink);
}

.tarjeta-meta {
  font-size: 0.82rem;
  color: var(--ink-soft);
}

.tarjeta-separador {
  margin: 0 6px;
}

.tarjeta-fila-inferior {
  display: flex;
  flex-direction: column;
  gap: 2px;
  margin-top: 10px;
  padding-top: 10px;
  border-top: 1px solid var(--line);
  font-size: 0.75rem;
  color: var(--ink-soft);
}

@media (min-width: 640px) {
  .toolbar {
    flex-direction: row;
    align-items: flex-end;
  }

  .search-field {
    flex: 1;
  }

  .filters {
    width: auto;
  }

  .filter-field {
    min-width: 160px;
    flex: none;
  }

  .tarjeta-fila-inferior {
    flex-direction: row;
    justify-content: space-between;
  }
}

.sin-resultados {
  text-align: center;
  color: var(--ink-soft);
  padding: 40px 16px;
  font-size: 0.95rem;
}

/* Visor de expediente */

.visor {
  padding-top: 16px;
}

.btn-volver {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  background: none;
  border: none;
  color: var(--navy-800);
  font-family: inherit;
  font-size: 0.9rem;
  font-weight: 600;
  padding: 8px 4px;
  margin-bottom: 8px;
  cursor: pointer;
  min-height: 44px;
}

.btn-volver:hover {
  color: var(--gold-500);
}

.visor-encabezado {
  background: var(--paper-card);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 16px;
  margin-bottom: 14px;
}

.visor-encabezado-top {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
}

.visor-numero {
  font-family: "Lora", serif;
  font-weight: 600;
  font-size: 1.1rem;
  color: var(--navy-900);
}

.visor-actor {
  margin: 8px 0 4px;
  font-size: 1rem;
}

.visor-meta {
  font-size: 0.82rem;
  color: var(--ink-soft);
}

.visor-tabs {
  display: flex;
  gap: 4px;
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
  scrollbar-width: none;
  border-bottom: 1px solid var(--line);
  margin-bottom: 16px;
}

.visor-tabs::-webkit-scrollbar {
  display: none;
}

.visor-tab {
  flex-shrink: 0;
  background: none;
  border: none;
  border-bottom: 2px solid transparent;
  font-family: inherit;
  font-size: 0.85rem;
  font-weight: 600;
  color: var(--ink-soft);
  padding: 10px 12px;
  min-height: 44px;
  white-space: nowrap;
  cursor: pointer;
}

.visor-tab[aria-selected="true"] {
  color: var(--navy-900);
  border-bottom-color: var(--gold-500);
}

.visor-tab:focus-visible {
  outline: 2px solid var(--navy-700);
  outline-offset: -2px;
}

.visor-panel {
  min-height: 120px;
}

.subseccion-titulo {
  font-family: "Lora", serif;
  font-size: 0.95rem;
  font-weight: 600;
  margin: 20px 0 8px;
  color: var(--navy-900);
}

.subseccion-titulo:first-child {
  margin-top: 0;
}

.fundamento {
  font-weight: 400;
  font-size: 0.78rem;
  color: var(--ink-soft);
}

.ficha-datos {
  display: flex;
  flex-direction: column;
  gap: 10px;
  margin: 0;
}

.ficha-datos > div {
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.ficha-datos dt {
  font-size: 0.72rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.03em;
  color: var(--ink-soft);
}

.ficha-datos dd {
  margin: 0;
  font-size: 0.95rem;
}

.lista-simple {
  margin: 0;
  padding-left: 20px;
  font-size: 0.9rem;
}

.lista-simple li {
  margin-bottom: 4px;
}

.bitacora-vacia {
  color: var(--ink-soft);
  font-size: 0.9rem;
  background: var(--paper);
  border: 1px dashed var(--line);
  border-radius: var(--radius);
  padding: 16px;
  text-align: center;
  margin: 0;
}

.lista-documentos {
  list-style: none;
  margin: 0;
  padding: 0;
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.documento-item {
  background: var(--paper-card);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 12px 14px;
}

.documento-fila-superior {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
}

.documento-folio {
  font-family: "Lora", serif;
  font-weight: 600;
  font-size: 0.9rem;
}

.documento-tipo {
  margin: 6px 0 2px;
  font-size: 0.9rem;
}

.documento-firmas {
  margin: 0;
  font-size: 0.8rem;
  color: var(--ink-soft);
}

.suspension-estado {
  font-weight: 600;
  color: var(--amber-700);
  background: var(--amber-100);
  border-radius: var(--radius);
  padding: 10px 14px;
  margin: 0 0 14px;
  font-size: 0.9rem;
}

.btn-firmar {
  margin-top: 10px;
  background: var(--navy-900);
  color: #fff;
  border: none;
  border-radius: var(--radius);
  padding: 10px 16px;
  font-family: inherit;
  font-size: 0.85rem;
  font-weight: 600;
  min-height: 44px;
  cursor: pointer;
}

.btn-firmar:hover {
  background: var(--navy-800);
}

/* Modal de firma (Fase 5) */

.modal-firma {
  border: none;
  border-radius: 14px;
  padding: 0;
  width: min(420px, calc(100vw - 32px));
  color: var(--ink);
  background: var(--paper-card);
}

.modal-firma::backdrop {
  background: rgba(11, 31, 58, 0.55);
}

.modal-firma-header {
  background: var(--navy-950);
  color: #fff;
  padding: 18px 20px;
  border-radius: 14px 14px 0 0;
}

.modal-firma-simulacion {
  margin: 0 0 6px;
  font-size: 0.68rem;
  font-weight: 700;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  color: var(--gold-400);
}

.modal-firma-titulo {
  margin: 0;
  font-family: "Lora", serif;
  font-size: 1.15rem;
  font-weight: 600;
}

.modal-firma-doc {
  margin: 6px 0 0;
  font-size: 0.82rem;
  color: #cdd6e3;
}

#form-firma {
  padding: 20px;
  display: flex;
  flex-direction: column;
  gap: 14px;
}

.campo-firma {
  display: flex;
  flex-direction: column;
  gap: 5px;
  font-size: 0.8rem;
  font-weight: 600;
  color: var(--ink-soft);
}

.campo-firma input {
  font-family: inherit;
  font-size: 0.9rem;
  padding: 10px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--paper);
  color: var(--ink);
}

.campo-firma input:focus {
  outline: 2px solid var(--gold-500);
  outline-offset: 1px;
}

.modal-firma-botones {
  display: flex;
  justify-content: flex-end;
  gap: 10px;
  margin-top: 6px;
}

.btn-cancelar-firma {
  background: none;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 10px 16px;
  font-family: inherit;
  font-size: 0.85rem;
  font-weight: 600;
  color: var(--ink-soft);
  cursor: pointer;
  min-height: 44px;
}

.btn-confirmar-firma {
  background: var(--navy-900);
  color: #fff;
  border: none;
  border-radius: var(--radius);
  padding: 10px 16px;
  font-family: inherit;
  font-size: 0.85rem;
  font-weight: 600;
  cursor: pointer;
  min-height: 44px;
}

.btn-confirmar-firma:hover {
  background: var(--navy-800);
}

.modal-firma-estado {
  padding: 32px 20px 28px;
  text-align: center;
  font-size: 0.95rem;
  color: var(--ink);
}

/* Vista de Avisos (Fase 6) */

.avisos-intro {
  margin-bottom: 20px;
}

.avisos-titulo {
  font-family: "Lora", serif;
  font-size: 1.3rem;
  font-weight: 600;
  margin: 0 0 8px;
  color: var(--ink);
}

.avisos-subtitulo {
  margin: 0;
  font-size: 0.88rem;
  color: var(--ink-soft);
  max-width: 60ch;
}

.avisos-grupo-titulo {
  font-family: "Lora", serif;
  font-size: 1rem;
  font-weight: 600;
  margin: 24px 0 10px;
  color: var(--ink);
}

.avisos-grupo-titulo:first-child {
  margin-top: 0;
}

.avisos-lista {
  margin-bottom: 4px;
}

.aviso-card {
  cursor: pointer;
}

.aviso-card:hover,
.aviso-card:focus-visible {
  border-color: var(--gold-500);
  box-shadow: 0 2px 10px rgba(11, 31, 58, 0.12);
  outline: none;
}

.badge-vencido {
  background: var(--red-100);
  color: var(--red-700);
}

.badge-info {
  background: var(--line);
  color: var(--ink-soft);
}
