/* ==========================================================================
   TuVoz Escolar — Estilo Institucional Peruano (Rojo y Blanco)
   Diseño Cívico, Oficial y Humano (Sin clichés ni estéticas de IA)
   Alineado a las Skills: frontend-design e interface-design
   ========================================================================== */

:root {
    /* Paleta Institucional: Rojo Bandera y Blanco Peruano */
    --peru-red: #c8102e;             /* Rojo oficial de la bandera peruana */
    --peru-red-hover: #b91c1c;       /* Rojo oscuro para hover */
    --peru-red-dark: #881337;        /* Guinda institucional profundo */
    --peru-red-tint: #fef2f2;        /* Fondo claro rojo suave */
    --peru-red-border: #fecaca;      /* Borde sutil rojo */

    /* Superficies y Fondos Clari-Luminosos */
    --color-bg-body: #f8fafc;        /* Fondo general gris neutro papel */
    --color-surface-white: #ffffff;  /* Fondo de tarjetas y paneles */
    --color-surface-muted: #f1f5f9;  /* Superficies secundarias */

    /* Bordes y Separadores */
    --border-subtle: #e2e8f0;
    --border-strong: #cbd5e1;
    --border-peru: #c8102e;

    /* Jerarquía Tipográfica (Alto Contraste y Legibilidad Humana) */
    --text-primary: #0f172a;         /* Carbón oscuro para lectura impecable */
    --text-secondary: #334155;       /* Gris pizarra para párrafos y descripciones */
    --text-muted: #64748b;           /* Gris medio para metadatos y fechas */
    --text-on-red: #ffffff;

    /* Etiquetas de Estado Normativo */
    --danger-bg: #fef2f2;
    --danger-text: #991b1b;
    --danger-border: #fecaca;

    --success-bg: #f0fdf4;
    --success-text: #166534;
    --success-border: #bbf7d0;

    --caution-bg: #fffbeb;
    --caution-text: #92400e;
    --caution-border: #fde68a;

    /* Tipografías Oficiales */
    --font-heading: 'Outfit', -apple-system, sans-serif;
    --font-body: 'Plus Jakarta Sans', system-ui, -apple-system, sans-serif;
    --font-mono: 'JetBrains Mono', Consolas, monospace;

    /* Escala Tipográfica (Ratio 1.25) */
    --text-xs: 0.75rem;    /* 12px */
    --text-sm: 0.875rem;   /* 14px */
    --text-base: 1rem;     /* 16px */
    --text-lg: 1.125rem;   /* 18px */
    --text-xl: 1.375rem;   /* 22px */
    --text-2xl: 1.75rem;   /* 28px */
    --text-3xl: 2.25rem;   /* 36px */

    /* Bordes y Sombras Reales de Papelería */
    --radius-sm: 6px;
    --radius-md: 10px;
    --radius-lg: 14px;
    --shadow-card: 0 1px 3px 0 rgba(0, 0, 0, 0.08), 0 1px 2px -1px rgba(0, 0, 0, 0.05);
    --shadow-elevated: 0 10px 25px -3px rgba(0, 0, 0, 0.1), 0 4px 6px -4px rgba(0, 0, 0, 0.05);
}

/* Reset Base */
*, *::before, *::after {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
}

html {
    font-size: 16px;
    scroll-behavior: smooth;
    background-color: var(--color-bg-body);
    color: var(--text-primary);
}

body {
    font-family: var(--font-body);
    line-height: 1.6;
    background-color: var(--color-bg-body);
    color: var(--text-primary);
    -webkit-font-smoothing: antialiased;
    min-height: 100vh;
    display: flex;
    flex-direction: column;
}

/* Tipografía Formal */
h1, h2, h3, h4, h5 {
    font-family: var(--font-heading);
    font-weight: 800;
    color: var(--text-primary);
    line-height: 1.25;
}

p {
    color: var(--text-secondary);
}

a {
    color: var(--peru-red);
    text-decoration: none;
    transition: color 0.15s ease;
}

a:hover {
    color: var(--peru-red-hover);
    text-decoration: underline;
}

/* Contenedor */
.container {
    width: 100%;
    max-width: 1140px;
    margin: 0 auto;
    padding: 0 1.25rem;
}

/* Cabecera Institucional Superior (Rojo Bandera Oficial) */
.gov-header-bar {
    background-color: var(--peru-red);
    color: #ffffff;
    padding: 0.4rem 0;
    font-size: var(--text-xs);
    border-bottom: 2px solid var(--peru-red-dark);
}

.gov-header-inner {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 1rem;
    flex-wrap: wrap;
}

.gov-flag-label {
    display: flex;
    align-items: center;
    gap: 0.6rem;
    font-weight: 700;
    letter-spacing: 0.03em;
}

.peru-flag-icon {
    width: 18px;
    height: 12px;
    display: inline-flex;
    border: 1px solid rgba(255, 255, 255, 0.4);
    box-shadow: 0 1px 2px rgba(0,0,0,0.15);
}

.flag-stripe-red { width: 33.3%; background: #ffffff; background: #c8102e; }
.flag-stripe-white { width: 33.4%; background: #ffffff; }

.gov-header-links {
    display: flex;
    align-items: center;
    gap: 1.25rem;
    font-size: 0.72rem;
}

.gov-header-links a {
    color: #ffffff;
    opacity: 0.95;
    font-weight: 600;
}

.gov-header-links a:hover {
    opacity: 1;
    text-decoration: underline;
}

/* Cabecera Principal */
.site-header {
    background: #ffffff;
    border-bottom: 1px solid var(--border-subtle);
    padding: 1rem 0;
    position: sticky;
    top: 0;
    z-index: 40;
    box-shadow: 0 1px 4px rgba(0, 0, 0, 0.04);
}

.header-inner {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 1.25rem;
    flex-wrap: wrap;
}

.brand-wrapper {
    display: flex;
    align-items: center;
    gap: 0.9rem;
}

.brand-crest {
    width: 46px;
    height: 46px;
    border-radius: var(--radius-sm);
    background: var(--peru-red);
    color: #ffffff;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.35rem;
    box-shadow: 0 2px 6px rgba(200, 16, 46, 0.25);
    flex-shrink: 0;
}

.brand-titles h1 {
    font-size: 1.35rem;
    display: flex;
    align-items: center;
    gap: 0.5rem;
    color: var(--text-primary);
}

.brand-badge {
    font-size: 0.65rem;
    font-weight: 800;
    letter-spacing: 0.05em;
    text-transform: uppercase;
    background: var(--peru-red-tint);
    color: var(--peru-red);
    padding: 0.15rem 0.5rem;
    border-radius: var(--radius-sm);
    border: 1px solid var(--peru-red-border);
}

.brand-subtitle {
    font-size: var(--text-xs);
    color: var(--text-muted);
    display: block;
    font-weight: 500;
}

/* Botones de Cabecera */
.header-actions {
    display: flex;
    align-items: center;
    gap: 0.65rem;
}

.btn-gov-secondary {
    background: #ffffff;
    border: 1px solid var(--border-strong);
    color: var(--text-secondary);
    padding: 0.5rem 0.9rem;
    border-radius: var(--radius-sm);
    font-size: var(--text-xs);
    font-weight: 700;
    cursor: pointer;
    display: inline-flex;
    align-items: center;
    gap: 0.45rem;
    transition: all 0.15s ease;
}

.btn-gov-secondary:hover {
    background: var(--color-surface-muted);
    border-color: var(--peru-red);
    color: var(--peru-red);
    text-decoration: none;
}

.btn-gov-primary {
    background: var(--peru-red);
    border: 1px solid var(--peru-red-hover);
    color: #ffffff;
    padding: 0.5rem 1rem;
    border-radius: var(--radius-sm);
    font-size: var(--text-xs);
    font-weight: 700;
    cursor: pointer;
    display: inline-flex;
    align-items: center;
    gap: 0.45rem;
    text-decoration: none;
    transition: background-color 0.15s ease;
}

.btn-gov-primary:hover {
    background: var(--peru-red-hover);
    color: #ffffff;
    text-decoration: none;
}

/* Ticker de Emergencia Oficial */
.emergency-strip {
    background: #ffffff;
    border-bottom: 2px solid var(--border-subtle);
    padding: 0.75rem 0;
}

.emergency-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
    gap: 0.75rem;
}

.emergency-pill {
    background: #ffffff;
    border: 1px solid var(--border-subtle);
    border-left: 4px solid var(--peru-red);
    border-radius: var(--radius-sm);
    padding: 0.6rem 0.85rem;
    display: flex;
    align-items: center;
    justify-content: space-between;
    font-size: var(--text-xs);
    font-family: inherit;
    text-align: left;
    cursor: pointer;
    width: 100%;
    transition: border-color 0.15s ease, box-shadow 0.15s ease, transform 0.1s ease;
    text-decoration: none;
}

.emergency-pill:hover {
    border-color: var(--peru-red);
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.08);
    transform: translateY(-1px);
    text-decoration: none;
}

.emergency-pill:active {
    transform: translateY(0);
}

.emergency-meta strong {
    display: block;
    color: var(--text-primary);
    font-weight: 700;
    font-size: 0.78rem;
}

.emergency-meta span {
    color: var(--text-muted);
    font-size: 0.7rem;
}

.emergency-phone {
    font-family: var(--font-mono);
    font-weight: 800;
    color: var(--peru-red);
    background: var(--peru-red-tint);
    padding: 0.2rem 0.5rem;
    border-radius: var(--radius-sm);
    font-size: 0.8rem;
    border: 1px solid var(--peru-red-border);
}

/* Portada y Búsqueda */
.hero-section {
    padding: 2.25rem 0 1.5rem;
    text-align: center;
}

.hero-tagline {
    font-size: var(--text-xs);
    font-weight: 800;
    text-transform: uppercase;
    letter-spacing: 0.08em;
    color: var(--peru-red);
    margin-bottom: 0.4rem;
    display: block;
}

.hero-title {
    font-size: clamp(1.65rem, 3.5vw, 2.35rem);
    color: var(--text-primary);
    margin-bottom: 0.65rem;
    letter-spacing: -0.025em;
}

.hero-lead {
    font-size: var(--text-base);
    color: var(--text-secondary);
    max-width: 72ch;
    margin: 0 auto 1.75rem;
    line-height: 1.6;
}

/* Buscador Estilo Registro Oficial */
.search-container {
    max-width: 660px;
    margin: 0 auto 1.5rem;
}

.search-input-wrapper {
    display: flex;
    align-items: center;
    background: #ffffff;
    border: 2px solid var(--border-strong);
    border-radius: var(--radius-md);
    padding: 0.4rem 0.85rem;
    box-shadow: var(--shadow-card);
    transition: border-color 0.15s ease, box-shadow 0.15s ease;
    position: relative;
}

.search-input-wrapper:focus-within {
    border-color: var(--peru-red);
    box-shadow: 0 0 0 3px rgba(200, 16, 46, 0.12);
}

.search-icon {
    color: var(--text-muted);
    font-size: 1rem;
    margin-right: 0.65rem;
}

.search-input {
    width: 100%;
    background: transparent;
    border: none;
    outline: none;
    font-size: var(--text-base);
    color: var(--text-primary);
    font-family: inherit;
}

.search-input::placeholder {
    color: var(--text-muted);
}

.search-clear {
    background: none;
    border: none;
    color: var(--text-muted);
    cursor: pointer;
    font-size: 0.9rem;
    padding: 0.25rem;
}

.search-clear:hover {
    color: var(--peru-red);
}

/* Menú de Autocompletado Profesional */
.search-autocomplete-box {
    position: absolute;
    top: calc(100% + 6px);
    left: 0;
    right: 0;
    background: #ffffff;
    border: 2px solid var(--peru-red);
    border-radius: var(--radius-md);
    box-shadow: 0 12px 30px rgba(0, 0, 0, 0.15);
    z-index: 100;
    overflow: hidden;
    max-height: 380px;
    overflow-y: auto;
    text-align: left;
    animation: fadeInSlide 0.15s ease-out;
}

.search-autocomplete-header {
    background: var(--color-surface-muted);
    padding: 0.45rem 0.85rem;
    font-size: 0.68rem;
    font-weight: 800;
    text-transform: uppercase;
    color: var(--text-muted);
    letter-spacing: 0.05em;
    border-bottom: 1px solid var(--border-subtle);
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.search-autocomplete-item {
    padding: 0.65rem 0.95rem;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 0.75rem;
    cursor: pointer;
    border-bottom: 1px solid var(--border-subtle);
    transition: background 0.12s ease;
}

.search-autocomplete-item:last-child {
    border-bottom: none;
}

.search-autocomplete-item:hover,
.search-autocomplete-item.active {
    background: var(--peru-red-tint);
}

.autocomplete-item-main {
    display: flex;
    align-items: center;
    gap: 0.65rem;
    text-align: left;
}

.autocomplete-item-icon {
    color: var(--peru-red);
    font-size: 0.85rem;
    flex-shrink: 0;
}

.autocomplete-item-title {
    font-size: 0.82rem;
    font-weight: 600;
    color: var(--text-primary);
    line-height: 1.35;
}

.autocomplete-item-badge {
    font-size: 0.65rem;
    font-weight: 700;
    padding: 0.15rem 0.45rem;
    border-radius: var(--radius-sm);
    background: var(--color-surface-muted);
    color: var(--text-muted);
    flex-shrink: 0;
}

/* Barra de Resumen de Búsqueda Multifuente */
.search-results-summary {
    background: #ffffff;
    border: 1px solid var(--border-strong);
    border-left: 4px solid var(--peru-red);
    border-radius: var(--radius-sm);
    padding: 0.65rem 1rem;
    margin-bottom: 1.25rem;
    display: flex;
    align-items: center;
    justify-content: space-between;
    flex-wrap: wrap;
    gap: 0.75rem;
    box-shadow: 0 1px 4px rgba(0, 0, 0, 0.04);
    animation: fadeInSlide 0.2s ease-out;
}

.search-summary-text {
    font-size: 0.82rem;
    color: var(--text-primary);
    font-weight: 600;
    display: flex;
    align-items: center;
    gap: 0.5rem;
    flex-wrap: wrap;
}

.search-summary-badge {
    background: var(--peru-red-tint);
    color: var(--peru-red);
    border: 1px solid var(--peru-red-border);
    padding: 0.1rem 0.45rem;
    border-radius: var(--radius-sm);
    font-size: 0.7rem;
    font-weight: 700;
}

.search-summary-reset {
    background: none;
    border: 1px solid var(--border-strong);
    color: var(--text-secondary);
    padding: 0.25rem 0.65rem;
    border-radius: var(--radius-sm);
    font-size: 0.72rem;
    font-weight: 700;
    cursor: pointer;
    transition: all 0.15s ease;
}

.search-summary-reset:hover {
    border-color: var(--peru-red);
    color: var(--peru-red);
    background: var(--peru-red-tint);
}

/* Protocolo de Emergencia Escolar (Violencia Sexual / Tocamientos) */
.search-emergency-banner {
    background: #fff5f5;
    border: 2px solid var(--peru-red);
    border-radius: var(--radius-sm);
    padding: 1.15rem;
    margin-bottom: 1rem;
    box-shadow: 0 4px 14px rgba(200, 16, 46, 0.15);
    text-align: left;
}

.search-emergency-header {
    display: flex;
    align-items: center;
    gap: 0.65rem;
    color: var(--peru-red);
    font-weight: 800;
    font-size: 0.92rem;
    margin-bottom: 0.65rem;
    text-transform: uppercase;
    letter-spacing: 0.04em;
}

.search-emergency-lead {
    font-size: 0.86rem;
    color: var(--text-primary);
    line-height: 1.5;
    margin-bottom: 0.85rem;
}

.search-emergency-steps {
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
    font-size: 0.8rem;
    color: var(--text-secondary);
    line-height: 1.45;
    margin-bottom: 1rem;
    background: #ffffff;
    padding: 0.85rem;
    border-radius: var(--radius-sm);
    border: 1px solid #fecaca;
}

.search-emergency-actions {
    display: flex;
    flex-wrap: wrap;
    gap: 0.65rem;
}

.btn-emergency-call {
    background: var(--peru-red);
    color: #ffffff;
    border: none;
    padding: 0.55rem 1rem;
    border-radius: var(--radius-sm);
    font-size: 0.78rem;
    font-weight: 800;
    cursor: pointer;
    display: inline-flex;
    align-items: center;
    gap: 0.45rem;
    transition: background 0.15s ease;
}

.btn-emergency-call:hover {
    background: var(--peru-red-hover);
}

.btn-emergency-secondary {
    background: #ffffff;
    color: var(--text-primary);
    border: 1px solid var(--border-strong);
    padding: 0.55rem 0.85rem;
    border-radius: var(--radius-sm);
    font-size: 0.78rem;
    font-weight: 700;
    cursor: pointer;
    display: inline-flex;
    align-items: center;
    gap: 0.45rem;
    text-decoration: none;
    transition: all 0.15s ease;
}

.btn-emergency-secondary:hover {
    border-color: var(--peru-red);
    color: var(--peru-red);
}

.chip-emergency {
    border-color: var(--peru-red-border) !important;
    background: var(--peru-red-tint) !important;
    color: var(--peru-red) !important;
    font-weight: 700 !important;
}

/* Sugerencias de Búsqueda Rápida */
.search-quick-tags {
    display: flex;
    align-items: center;
    justify-content: center;
    flex-wrap: wrap;
    gap: 0.45rem;
    max-width: 860px;
    margin: -0.75rem auto 1.5rem;
    font-size: var(--text-xs);
}

.quick-tags-label {
    color: var(--text-muted);
    font-weight: 700;
    margin-right: 0.25rem;
    display: inline-flex;
    align-items: center;
    gap: 0.3rem;
}

.quick-tag-chip {
    background: #ffffff;
    border: 1px solid var(--border-subtle);
    border-radius: 999px;
    padding: 0.25rem 0.65rem;
    font-size: 0.72rem;
    font-weight: 600;
    color: var(--text-secondary);
    cursor: pointer;
    font-family: inherit;
    transition: all 0.15s ease;
}

.quick-tag-chip:hover {
    border-color: var(--peru-red);
    color: var(--peru-red);
    background: var(--peru-red-tint);
    transform: translateY(-1px);
}

/* Panel de Dictamen Legal Inmediato */
.search-instant-box {
    background: #ffffff;
    border: 1px solid var(--peru-red-border);
    border-left: 5px solid var(--peru-red);
    border-radius: var(--radius-sm);
    padding: 1.15rem 1.35rem;
    margin-bottom: 1.75rem;
    box-shadow: 0 4px 15px rgba(200, 16, 46, 0.07);
    animation: fadeInSlide 0.2s ease-out;
}

@keyframes fadeInSlide {
    from { opacity: 0; transform: translateY(-6px); }
    to { opacity: 1; transform: translateY(0); }
}

.search-instant-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 0.5rem;
    margin-bottom: 0.5rem;
    flex-wrap: wrap;
}

.search-instant-tag {
    font-size: 0.68rem;
    font-weight: 800;
    text-transform: uppercase;
    letter-spacing: 0.06em;
    color: var(--peru-red);
    background: var(--peru-red-tint);
    border: 1px solid var(--peru-red-border);
    padding: 0.15rem 0.5rem;
    border-radius: var(--radius-sm);
    display: inline-flex;
    align-items: center;
    gap: 0.35rem;
}

.search-instant-title {
    font-size: var(--text-base);
    font-weight: 800;
    color: var(--text-primary);
    margin-bottom: 0.35rem;
}

.search-instant-text {
    font-size: 0.84rem;
    color: var(--text-secondary);
    line-height: 1.6;
    margin: 0;
}

/* Multidimensional Match Sections */
.search-multi-section {
    margin-bottom: 1.85rem;
    animation: fadeInSlide 0.25s ease-out;
}

.search-multi-title {
    font-size: 0.72rem;
    font-weight: 800;
    text-transform: uppercase;
    letter-spacing: 0.06em;
    color: var(--text-muted);
    margin-bottom: 0.75rem;
    display: flex;
    align-items: center;
    gap: 0.45rem;
    border-bottom: 1px solid var(--border-subtle);
    padding-bottom: 0.35rem;
}

.search-multi-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(260px, 1fr));
    gap: 0.85rem;
}

.channel-match-card {
    background: #ffffff;
    border: 1px solid var(--border-subtle);
    border-left: 4px solid var(--peru-red);
    border-radius: var(--radius-sm);
    padding: 0.85rem 1rem;
    display: flex;
    flex-direction: column;
    justify-content: space-between;
    gap: 0.65rem;
    box-shadow: var(--shadow-card);
    transition: transform 0.15s ease, box-shadow 0.15s ease;
}

.channel-match-card:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.08);
}

.channel-match-card strong {
    font-size: 0.82rem;
    color: var(--text-primary);
    display: block;
}

.channel-match-card p {
    font-size: 0.74rem;
    color: var(--text-secondary);
    margin: 0.2rem 0 0;
    line-height: 1.45;
}

.channel-match-actions {
    display: flex;
    gap: 0.45rem;
    align-items: center;
    flex-wrap: wrap;
    margin-top: 0.35rem;
}

.law-match-card {
    background: #ffffff;
    border: 1px solid var(--border-subtle);
    border-left: 4px solid #334155;
    border-radius: var(--radius-sm);
    padding: 0.85rem 1rem;
    box-shadow: var(--shadow-card);
}

.law-match-card h5 {
    font-size: 0.8rem;
    font-weight: 800;
    color: var(--text-primary);
    margin-bottom: 0.25rem;
}

.law-match-card p {
    font-size: 0.74rem;
    color: var(--text-secondary);
    margin: 0;
    line-height: 1.45;
}

mark.search-highlight {
    background: #fef08a;
    color: #854d0e;
    font-weight: 700;
    padding: 0.05rem 0.25rem;
    border-radius: 2px;
}

.empty-state-actions {
    display: flex;
    align-items: center;
    justify-content: center;
    flex-wrap: wrap;
    gap: 0.45rem;
    margin-top: 1rem;
}

/* Filtros por Categoría (Pestañas Formales) */
.filter-tabs {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0.4rem;
    flex-wrap: wrap;
    margin-bottom: 2rem;
}

.filter-btn {
    background: #ffffff;
    border: 1px solid var(--border-subtle);
    color: var(--text-secondary);
    padding: 0.45rem 0.85rem;
    border-radius: var(--radius-sm);
    font-size: var(--text-xs);
    font-weight: 700;
    cursor: pointer;
    transition: all 0.15s ease;
}

.filter-btn:hover {
    border-color: var(--border-strong);
    background: var(--color-surface-muted);
    color: var(--text-primary);
}

.filter-btn.active {
    background: var(--peru-red);
    border-color: var(--peru-red-hover);
    color: #ffffff;
    box-shadow: 0 2px 5px rgba(200, 16, 46, 0.25);
}

/* Cabecera de Sección */
.section-meta-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 1.25rem;
    padding-bottom: 0.6rem;
    border-bottom: 2px solid var(--border-subtle);
}

.section-counter {
    font-size: var(--text-xs);
    font-weight: 700;
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: 0.04em;
}

/* Cuadrícula de Tarjetas (Fichas Documentales) */
.cards-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(330px, 1fr));
    gap: 1.25rem;
    margin-bottom: 3rem;
}

.doc-card {
    background: #ffffff;
    border: 1px solid var(--border-subtle);
    border-top: 3px solid var(--peru-red);
    border-radius: var(--radius-md);
    padding: 1.35rem;
    display: flex;
    flex-direction: column;
    justify-content: space-between;
    box-shadow: var(--shadow-card);
    transition: transform 0.15s ease, box-shadow 0.15s ease, border-color 0.15s ease;
    cursor: pointer;
}

.doc-card:hover {
    transform: translateY(-2px);
    box-shadow: var(--shadow-elevated);
    border-color: var(--border-strong);
}

.doc-card-header {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 0.5rem;
    margin-bottom: 0.75rem;
}

.doc-badge-category {
    font-size: 0.68rem;
    font-weight: 800;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    color: var(--peru-red);
    background: var(--peru-red-tint);
    border: 1px solid var(--peru-red-border);
    padding: 0.2rem 0.5rem;
    border-radius: var(--radius-sm);
}

.verdict-tag {
    font-size: 0.68rem;
    font-weight: 800;
    padding: 0.2rem 0.55rem;
    border-radius: var(--radius-sm);
    text-align: right;
}

.verdict-danger {
    background: var(--danger-bg);
    border: 1px solid var(--danger-border);
    color: var(--danger-text);
}

.verdict-success {
    background: var(--success-bg);
    border: 1px solid var(--success-border);
    color: var(--success-text);
}

.verdict-caution {
    background: var(--caution-bg);
    border: 1px solid var(--caution-border);
    color: var(--caution-text);
}

.doc-card-title {
    font-size: var(--text-base);
    font-weight: 800;
    color: var(--text-primary);
    line-height: 1.35;
    margin-bottom: 0.5rem;
}

.doc-card-desc {
    font-size: var(--text-xs);
    color: var(--text-secondary);
    line-height: 1.55;
    margin-bottom: 1rem;
}

.doc-card-footer {
    border-top: 1px solid var(--border-subtle);
    padding-top: 0.85rem;
    display: flex;
    align-items: center;
    justify-content: space-between;
    font-size: var(--text-xs);
}

.doc-law-cite {
    font-size: 0.7rem;
    color: var(--text-muted);
    font-weight: 600;
}

.doc-link-action {
    color: var(--peru-red);
    font-weight: 700;
    font-size: 0.75rem;
}

/* Estado Vacío */
.empty-state {
    text-align: center;
    padding: 3rem 1rem;
    background: #ffffff;
    border: 1px dashed var(--border-strong);
    border-radius: var(--radius-md);
    display: none;
}

.empty-state.visible {
    display: block;
}

.empty-state h3 {
    font-size: var(--text-lg);
    margin-bottom: 0.35rem;
}

/* Módulo Territorial (Villa El Salvador & UGEL 01) */
.territorial-section {
    background: #ffffff;
    border: 1px solid var(--border-subtle);
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-card);
    padding: 2rem;
    margin-bottom: 3.5rem;
}

.territorial-header {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 1.5rem;
    flex-wrap: wrap;
    margin-bottom: 1.5rem;
    padding-bottom: 1.25rem;
    border-bottom: 1px solid var(--border-subtle);
}

.territorial-subhead {
    font-size: 0.7rem;
    font-weight: 800;
    text-transform: uppercase;
    letter-spacing: 0.06em;
    color: var(--peru-red);
    display: block;
    margin-bottom: 0.2rem;
}

.territorial-title {
    font-size: var(--text-xl);
    color: var(--text-primary);
}

.territorial-note {
    background: var(--caution-bg);
    border: 1px solid var(--caution-border);
    border-left: 3px solid #d97706;
    padding: 0.6rem 0.85rem;
    border-radius: var(--radius-sm);
    font-size: 0.75rem;
    color: var(--caution-text);
    max-width: 480px;
    line-height: 1.45;
}

.territorial-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
    gap: 1.25rem;
}

.territorial-panel {
    background: var(--color-bg-body);
    border: 1px solid var(--border-subtle);
    border-radius: var(--radius-md);
    padding: 1.25rem;
    display: flex;
    flex-direction: column;
    justify-content: space-between;
    gap: 1rem;
}

.territorial-name {
    font-size: var(--text-sm);
    font-weight: 800;
    color: var(--text-primary);
    margin-bottom: 0.35rem;
}

.territorial-desc {
    font-size: var(--text-xs);
    color: var(--text-secondary);
    line-height: 1.5;
    margin-bottom: 0.65rem;
}

.territorial-meta {
    font-size: 0.73rem;
    color: var(--text-muted);
    border-top: 1px solid var(--border-subtle);
    padding-top: 0.65rem;
    line-height: 1.55;
}

.meta-row strong {
    color: var(--text-primary);
}

.territorial-panel-footer {
    display: flex;
    gap: 0.5rem;
    flex-wrap: wrap;
}

/* Ventana Modal (Dossier Oficial) */
.modal-overlay {
    position: fixed;
    inset: 0;
    background: rgba(15, 23, 42, 0.65);
    backdrop-filter: blur(4px);
    z-index: 100;
    display: none;
    align-items: center;
    justify-content: center;
    padding: 1rem;
}

.modal-overlay.open {
    display: flex;
}

.modal-window {
    background: #ffffff;
    border: 1px solid var(--border-strong);
    border-radius: var(--radius-md);
    width: 100%;
    max-width: 720px;
    max-height: 90vh;
    display: flex;
    flex-direction: column;
    box-shadow: var(--shadow-elevated);
    overflow: hidden;
    animation: modalSlide 0.2s ease-out;
}

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

.modal-header {
    padding: 1.2rem 1.5rem;
    border-bottom: 1px solid var(--border-subtle);
    background: #ffffff;
    border-top: 4px solid var(--peru-red);
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 1rem;
}

.modal-header h3 {
    font-size: var(--text-base);
    color: var(--text-primary);
}

.modal-close-btn {
    background: var(--color-surface-muted);
    border: 1px solid var(--border-subtle);
    color: var(--text-secondary);
    width: 30px;
    height: 30px;
    border-radius: var(--radius-sm);
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    font-size: 0.95rem;
    font-weight: 700;
}

.modal-close-btn:hover {
    background: var(--border-strong);
    color: var(--text-primary);
}

.modal-body {
    padding: 1.5rem;
    overflow-y: auto;
    font-size: var(--text-sm);
    line-height: 1.6;
}

.modal-status-bar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 0.5rem;
    margin-bottom: 1.25rem;
    flex-wrap: wrap;
    padding-bottom: 0.75rem;
    border-bottom: 1px solid var(--border-subtle);
}

.modal-section {
    margin-bottom: 1.35rem;
}

.modal-subheading {
    font-size: var(--text-sm);
    font-weight: 800;
    color: var(--text-primary);
    margin-bottom: 0.35rem;
}

.modal-text {
    font-size: var(--text-sm);
    color: var(--text-secondary);
}

.callout-example {
    background: var(--color-surface-muted);
    border-left: 3px solid #475569;
    padding: 0.85rem 1rem;
    border-radius: 0 var(--radius-sm) var(--radius-sm) 0;
}

.callout-title {
    font-size: 0.75rem;
    font-weight: 800;
    text-transform: uppercase;
    color: var(--text-primary);
    margin-bottom: 0.3rem;
}

.callout-body {
    font-size: 0.8rem;
    color: var(--text-secondary);
}

.step-guide {
    list-style: none;
    margin: 0.85rem 0;
}

.step-guide-item {
    display: flex;
    gap: 0.85rem;
    margin-bottom: 0.85rem;
}

.step-guide-item:last-child {
    margin-bottom: 0;
}

.step-index {
    width: 24px;
    height: 24px;
    border-radius: var(--radius-sm);
    background: var(--peru-red);
    color: #ffffff;
    font-weight: 800;
    font-size: 0.75rem;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
}

.step-content {
    font-size: 0.82rem;
    color: var(--text-secondary);
}

.notice-box {
    margin-top: 1rem;
    padding: 0.75rem 0.95rem;
    border-radius: var(--radius-sm);
    font-size: 0.78rem;
    line-height: 1.5;
}

.notice-warning {
    background: var(--danger-bg);
    border: 1px solid var(--danger-border);
    color: var(--danger-text);
}

.notice-info {
    background: var(--success-bg);
    border: 1px solid var(--success-border);
    color: var(--success-text);
}

.legal-dossier {
    background: #ffffff;
    border: 1px solid var(--border-subtle);
    border-left: 3px solid var(--peru-red);
    padding: 0.85rem 1rem;
    border-radius: 0 var(--radius-sm) var(--radius-sm) 0;
    margin-top: 1.25rem;
}

.dossier-heading {
    font-size: 0.75rem;
    font-weight: 800;
    text-transform: uppercase;
    color: var(--peru-red);
    margin-bottom: 0.35rem;
}

.dossier-citation {
    font-size: 0.78rem;
    color: var(--text-secondary);
    margin-bottom: 0.5rem;
}

.dossier-metadata {
    display: flex;
    justify-content: space-between;
    font-size: 0.72rem;
    color: var(--text-muted);
    border-top: 1px solid var(--border-subtle);
    padding-top: 0.45rem;
    flex-wrap: wrap;
    gap: 0.5rem;
}

/* Tarjeta de Canal Oficial dentro del Modal de Situación */
.modal-channel-card {
    background: #f8fafc;
    border: 1px solid var(--peru-red-border);
    border-left: 4px solid var(--peru-red);
    border-radius: var(--radius-sm);
    padding: 1rem 1.15rem;
    margin-top: 1rem;
    margin-bottom: 1rem;
}

.modal-footer {
    padding: 1rem 1.5rem;
    border-top: 1px solid var(--border-subtle);
    background: var(--color-surface-muted);
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 0.75rem;
    flex-wrap: wrap;
}

.modal-window-channel {
    max-width: 580px;
}

.modal-pretitle {
    font-size: 0.68rem;
    font-weight: 800;
    text-transform: uppercase;
    letter-spacing: 0.06em;
    color: var(--peru-red);
    display: block;
    margin-bottom: 0.2rem;
}

/* Ficha de Canal y Teléfono */
.channel-desktop-notice {
    background: #f8fafc;
    border: 1px solid var(--border-subtle);
    border-left: 3px solid #0284c7;
    padding: 0.7rem 0.9rem;
    border-radius: 0 var(--radius-sm) var(--radius-sm) 0;
    margin-bottom: 1.15rem;
    font-size: 0.78rem;
    color: #334155;
    line-height: 1.5;
}

.channel-hero-card {
    background: #ffffff;
    border: 1px solid var(--peru-red-border);
    border-radius: var(--radius-sm);
    padding: 1.15rem;
    text-align: center;
    background: linear-gradient(180deg, #ffffff 0%, var(--peru-red-tint) 100%);
    margin-bottom: 1.25rem;
}

.channel-badge-type {
    display: inline-block;
    font-size: 0.7rem;
    font-weight: 700;
    color: var(--peru-red);
    background: var(--peru-red-tint);
    border: 1px solid var(--peru-red-border);
    padding: 0.2rem 0.6rem;
    border-radius: var(--radius-sm);
    margin-bottom: 0.35rem;
}

.channel-phone-large {
    font-family: var(--font-mono);
    font-size: 1.65rem;
    font-weight: 800;
    color: var(--peru-red);
    display: block;
    margin: 0.25rem 0;
    letter-spacing: 0.04em;
}

.channel-phone-badge {
    font-size: 0.72rem;
    font-weight: 700;
    color: var(--text-muted);
    display: inline-block;
    margin-bottom: 0.85rem;
}

.channel-actions-row {
    display: flex;
    justify-content: center;
    gap: 0.65rem;
    flex-wrap: wrap;
}

.btn-channel-copy {
    background: var(--peru-red);
    border: 1px solid var(--peru-red-hover);
    color: #ffffff;
    padding: 0.55rem 1rem;
    border-radius: var(--radius-sm);
    font-size: var(--text-xs);
    font-weight: 700;
    cursor: pointer;
    display: inline-flex;
    align-items: center;
    gap: 0.45rem;
    transition: background-color 0.15s ease, transform 0.1s ease;
}

.btn-channel-copy:hover {
    background: var(--peru-red-hover);
    color: #ffffff;
    transform: translateY(-1px);
}

.btn-channel-whatsapp {
    background: #22c55e;
    border: 1px solid #16a34a;
    color: #ffffff;
    padding: 0.55rem 1rem;
    border-radius: var(--radius-sm);
    font-size: var(--text-xs);
    font-weight: 700;
    cursor: pointer;
    display: inline-flex;
    align-items: center;
    gap: 0.45rem;
    text-decoration: none;
    transition: background-color 0.15s ease, transform 0.1s ease;
}

.btn-channel-whatsapp:hover {
    background: #16a34a;
    color: #ffffff;
    transform: translateY(-1px);
    text-decoration: none;
}

.btn-channel-dial {
    background: #ffffff;
    border: 1px solid var(--border-strong);
    color: var(--text-secondary);
    padding: 0.55rem 0.9rem;
    border-radius: var(--radius-sm);
    font-size: var(--text-xs);
    font-weight: 700;
    display: inline-flex;
    align-items: center;
    gap: 0.45rem;
    text-decoration: none;
    transition: all 0.15s ease;
}

.btn-channel-dial:hover {
    border-color: var(--text-primary);
    color: var(--text-primary);
    background: var(--color-surface-muted);
    text-decoration: none;
}

/* Ficha de Detalles de Canal */
.channel-meta-table {
    display: grid;
    grid-template-columns: 1fr;
    gap: 0.75rem;
    margin-bottom: 1.25rem;
}

.channel-meta-box {
    background: #ffffff;
    border: 1px solid var(--border-subtle);
    border-radius: var(--radius-sm);
    padding: 0.75rem 0.9rem;
    font-size: 0.8rem;
}

.channel-meta-box strong {
    color: var(--text-primary);
    font-size: 0.75rem;
    text-transform: uppercase;
    letter-spacing: 0.04em;
    display: block;
    margin-bottom: 0.2rem;
}

.channel-meta-box p {
    color: var(--text-secondary);
    margin: 0;
    font-size: 0.8rem;
    line-height: 1.45;
}

/* Toast Notification Flotante */
.toast-notification {
    position: fixed;
    bottom: 1.5rem;
    right: 1.5rem;
    z-index: 10000;
    background: #0f172a;
    color: #ffffff;
    padding: 0.85rem 1.25rem;
    border-radius: var(--radius-sm);
    box-shadow: 0 10px 25px -3px rgba(0, 0, 0, 0.35);
    border-left: 4px solid var(--peru-red);
    display: flex;
    align-items: center;
    gap: 0.75rem;
    font-size: var(--text-xs);
    font-weight: 600;
    opacity: 0;
    transform: translateY(20px);
    pointer-events: none;
    transition: opacity 0.25s ease, transform 0.25s ease;
}

.toast-notification.visible {
    opacity: 1;
    transform: translateY(0);
    pointer-events: auto;
}

.toast-icon {
    color: #22c55e;
    font-size: 1.15rem;
}

/* Tarjeta de Canal Inmediato dentro del Modal de Situación */
.modal-channel-card {
    background: #ffffff;
    border: 1px solid var(--peru-red-border);
    border-radius: var(--radius-sm);
    padding: 1rem 1.15rem;
    margin: 1.25rem 0;
    box-shadow: 0 2px 8px rgba(200, 16, 46, 0.05);
}

.modal-channel-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    flex-wrap: wrap;
    gap: 0.5rem;
    margin-bottom: 0.5rem;
}

.modal-channel-badge {
    font-size: 0.7rem;
    font-weight: 800;
    text-transform: uppercase;
    color: var(--peru-red);
    background: var(--peru-red-tint);
    border: 1px solid var(--peru-red-border);
    padding: 0.15rem 0.5rem;
    border-radius: var(--radius-sm);
    display: inline-flex;
    align-items: center;
    gap: 0.35rem;
}

.modal-channel-source {
    font-size: 0.72rem;
    color: var(--text-muted);
    font-weight: 600;
}

.modal-channel-entity {
    font-size: 0.95rem;
    font-weight: 800;
    color: var(--text-primary);
    margin: 0 0 0.75rem 0;
}

.modal-channel-actions {
    display: flex;
    flex-wrap: wrap;
    gap: 0.5rem;
    align-items: center;
}

/* Sección de Directorio Oficial de Fuentes y Canales Estatales */
.directory-section {
    background: #ffffff;
    border: 1px solid var(--border-strong);
    border-top: 4px solid var(--peru-red);
    border-radius: var(--radius-sm);
    padding: 1.75rem;
    margin-bottom: 3.5rem;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.04);
}

.directory-header {
    margin-bottom: 1.25rem;
    border-bottom: 1px solid var(--border-subtle);
    padding-bottom: 1rem;
}

.directory-title {
    font-size: var(--text-lg);
    font-weight: 800;
    color: var(--text-primary);
    margin: 0.2rem 0;
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.directory-subtitle {
    font-size: var(--text-xs);
    color: var(--text-secondary);
    line-height: 1.5;
}

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

.gov-directory-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 0.8rem;
    text-align: left;
}

.gov-directory-table th {
    background: #0f172a;
    color: #ffffff;
    font-weight: 800;
    font-size: 0.72rem;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    padding: 0.75rem 0.85rem;
    border: 1px solid #1e293b;
    white-space: nowrap;
}

.gov-directory-table td {
    padding: 0.75rem 0.85rem;
    border: 1px solid var(--border-subtle);
    vertical-align: middle;
    color: var(--text-secondary);
}

.gov-directory-table tr:nth-child(even) td {
    background: #f8fafc;
}

.gov-directory-table tr:hover td {
    background: var(--peru-red-tint);
}

.dir-entity-name {
    font-weight: 800;
    color: var(--text-primary);
    display: block;
    font-size: 0.82rem;
}

.dir-entity-tag {
    font-size: 0.68rem;
    color: var(--peru-red);
    font-weight: 700;
}

.dir-phone-block {
    display: flex;
    flex-direction: column;
    gap: 0.25rem;
}

.dir-phone-pill {
    font-family: var(--font-mono);
    font-weight: 700;
    font-size: 0.78rem;
    color: var(--text-primary);
    background: #ffffff;
    border: 1px solid var(--border-strong);
    padding: 0.2rem 0.45rem;
    border-radius: var(--radius-sm);
    display: inline-flex;
    align-items: center;
    gap: 0.35rem;
    cursor: pointer;
    text-decoration: none;
    transition: all 0.15s ease;
}

.dir-phone-pill:hover {
    border-color: var(--peru-red);
    color: var(--peru-red);
    background: var(--peru-red-tint);
}

.dir-wa-pill {
    background: #dcfce7;
    color: #15803d;
    border: 1px solid #86efac;
    font-weight: 700;
    font-size: 0.72rem;
    padding: 0.25rem 0.55rem;
    border-radius: var(--radius-sm);
    display: inline-flex;
    align-items: center;
    gap: 0.35rem;
    text-decoration: none;
    transition: all 0.15s ease;
    white-space: nowrap;
}

.dir-wa-pill:hover {
    background: #22c55e;
    color: #ffffff;
    text-decoration: none;
}

.dir-wa-none {
    font-size: 0.7rem;
    color: var(--text-muted);
    font-style: italic;
}

.dir-web-link {
    color: #0284c7;
    font-weight: 700;
    font-size: 0.75rem;
    display: inline-flex;
    align-items: center;
    gap: 0.3rem;
    text-decoration: none;
}

.dir-web-link:hover {
    text-decoration: underline;
    color: #0369a1;
}

.dir-source-badge {
    background: #f1f5f9;
    border: 1px solid #cbd5e1;
    color: #475569;
    font-size: 0.68rem;
    font-weight: 700;
    padding: 0.15rem 0.45rem;
    border-radius: var(--radius-sm);
    display: inline-flex;
    align-items: center;
    gap: 0.3rem;
}

/* Pie de Página Institucional */
.site-footer {
    background: #ffffff;
    border-top: 2px solid var(--border-subtle);
    padding: 2.5rem 0 1.5rem;
    margin-top: auto;
    font-size: var(--text-xs);
    color: var(--text-muted);
}

.footer-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
    gap: 1.75rem;
    margin-bottom: 2rem;
}

.footer-col h4 {
    font-size: var(--text-sm);
    color: var(--text-primary);
    margin-bottom: 0.75rem;
    border-bottom: 2px solid var(--peru-red);
    padding-bottom: 0.3rem;
    display: inline-block;
}

.footer-col ul {
    list-style: none;
}

.footer-col ul li {
    margin-bottom: 0.45rem;
}

.footer-bottom {
    padding-top: 1.5rem;
    border-top: 1px solid var(--border-subtle);
    display: flex;
    justify-content: space-between;
    align-items: center;
    flex-wrap: wrap;
    gap: 0.75rem;
    font-size: 0.72rem;
}

/* Modo Impresión (A4 Limpio) */
@media print {
    body {
        background: #ffffff !important;
        color: #000000 !important;
    }
    .gov-header-bar, .site-header, .emergency-strip, .search-container, .filter-tabs, .site-footer, .header-actions {
        display: none !important;
    }
    .doc-card {
        border: 1px solid #000000 !important;
        border-top: 3px solid #000000 !important;
        background: #ffffff !important;
        color: #000000 !important;
        page-break-inside: avoid;
        margin-bottom: 1rem;
        box-shadow: none !important;
    }
    h1, h2, h3, h4, p, span, strong {
        color: #000000 !important;
    }
}

/* Responsive */
@media (max-width: 640px) {
    .brand-titles h1 { font-size: 1.15rem; }
    .hero-title { font-size: 1.5rem; }
    .cards-grid { grid-template-columns: 1fr; }
    .territorial-header { flex-direction: column; }
    .emergency-grid { grid-template-columns: 1fr; }
    .gov-header-links { display: none; }
}
