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

/* ───────────────────────────────────────────────────────────
   Design System — Gobierno de Morelos (Supernova)
   Tokens mapeados desde Foundations: Colores (Mora, Verde Tierra,
   Arena, Piedra), Bordes, Elevación, Espaciado.
   ─────────────────────────────────────────────────────────── */
:root {
    /* Core ramps (subconjunto usado) */
    --vt-95:#edf4d1; --vt-90:#dfe6c3; --vt-50:#71785b; --vt-40:#5a6146;
    --vt-30:#434a30; --vt-20:#2d331b; --vt-10:#181e08;
    --mora-90:#ffd8e7; --mora-40:#8e466b; --mora-30:#773357; --mora-20:#57183c;
    --arena-95:#ffeedd; --arena-50:#8f724d;

    /* Marca / acento (sem/accent — Mora) */
    --accent:      #773357;
    --on-accent:   #ffffff;
    --accent-low:  #ffd8e7;

    /* Verde institucional (Verde Tierra) */
    --olive:       #5a6146;
    --olive-dark:  #2d331b;
    --bronze:      #8f724d;   /* Arena / content-emphasis */

    /* Contenido / superficies / bordes (sem) */
    --text:        #2e3b2b;   /* content/high */
    --muted:       #5d5e5f;   /* content/low */
    --border:      #cbcabe;   /* border/md */
    --border-low:  #e4e3d6;   /* border/low */
    --surface:     #ffffff;   /* bg/base */
    --surface-alt: #f5f4f2;   /* surface/low */
    --surface-2:   #ebeade;   /* surface/md */
    --btn-bg:      #ebeade;
    --btn-hover:   #e4e3d6;

    /* Estados semánticos */
    --success:     #1c7d29;
    --error:       #da3237;
    --warning:     #936901;
    --info:        #3266cb;

    /* Bordes (radios) */
    --radius-min:  4px;
    --radius-sm:   8px;
    --radius-md:   16px;
    --radius-lg:   24px;

    /* Elevación */
    --shadow-sm:   0 1px 2px rgba(60,1,38,.06);
    --shadow-md:   0 4px 16px rgba(60,1,38,.10);
    --shadow-lg:   0 14px 36px rgba(60,1,38,.16);

    /* Layout */
    --page-max:    1680px;
}

[data-theme="dark"] {
    --accent:      #e791ba;   /* Mora/70 */
    --on-accent:   #3c0126;   /* Mora/10 */
    --accent-low:  #57183c;   /* Mora/20 */
    --olive:       #8d9475;   /* Verde Tierra/60 */
    --olive-dark:  #434a30;   /* Verde Tierra/30 */
    --bronze:      #bc9b73;   /* Arena/70 */
    --text:        #ebeade;   /* Piedra/95 */
    --muted:       #909191;   /* Global/60 */
    --border:      #47473e;   /* Piedra/30 */
    --border-low:  #303129;   /* Piedra/20 */
    --surface:     #1b1c15;   /* Piedra/10 */
    --surface-alt: #11120a;   /* Piedra/5 */
    --surface-2:   #26261e;   /* Piedra/15 */
    --btn-bg:      #303129;
    --btn-hover:   #47473e;
    --shadow-sm:   0 1px 2px rgba(0,0,0,.4);
    --shadow-md:   0 4px 16px rgba(0,0,0,.45);
    --shadow-lg:   0 14px 36px rgba(0,0,0,.55);
}

body {
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Arial, sans-serif;
    color: var(--text);
    background: var(--surface);
    font-size: 14px;
    line-height: 1.5;
    transition: background 0.2s, color 0.2s;
}

a { color: inherit; }

.container {
    max-width: var(--page-max);
    margin: 0 auto;
    padding: 0 40px;
}

/* ─── HEADER ─────────────────────────────────────────────── */
.site-header {
    border-bottom: 1px solid var(--border);
    background: var(--surface);
}

.header-inner {
    max-width: var(--page-max);
    margin: 0 auto;
    padding: 0 40px;
    height: 64px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 16px;
}

/* Grupo izquierdo: logos */
.header-left {
    display: flex;
    align-items: center;
    gap: 14px;
    flex-shrink: 0;
}

/* Grupo derecho: búsqueda + tema + acceso */
.header-right {
    display: flex;
    align-items: center;
    gap: 10px;
    flex-shrink: 0;
}

/* Fila de búsqueda móvil — oculta en desktop */
.header-search-row { display: none; }

.logo-link { display: flex; align-items: center; }

.logo-morelos { height: 40px; display: block; }

.header-divider {
    width: 1px;
    height: 36px;
    background: var(--border);
    flex-shrink: 0;
}

.logo-dgc { height: 38px; display: block; }

.logo-finanzas { height: 34px; display: block; }

/* ─── MAIN ────────────────────────────────────────────────── */
.site-main { padding: 0; }

.section-label {
    font-size: 11px;
    font-weight: 600;
    letter-spacing: 0.1em;
    color: var(--muted);
    text-transform: uppercase;
    margin-bottom: 8px;
}

.section-title {
    font-size: 20px;
    font-weight: 600;
    margin-bottom: 28px;
}

/* ─── GRUPOS DE LICITACIÓN ────────────────────────────────── */
.licitacion-group {
    margin-bottom: 20px;
    border-radius: var(--radius-md);
    overflow: hidden;
    box-shadow: var(--shadow-sm);
    border: 1px solid var(--border);
    transition: border 0.2s, box-shadow 0.2s;
}

/* Cuando se abre: quitar marco y aplicar fondo */
.licitacion-group.open {
    border: none;
    box-shadow: var(--shadow-md);
    border-radius: var(--radius-lg);
}

.group-heading {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    width: 100%;
    padding: 9px 18px;
    background: linear-gradient(100deg, var(--olive-dark) 0%, var(--vt-30) 100%);
    border: none;
    border-bottom: 3px solid var(--bronze);
    text-align: left;
    font-family: inherit;
    cursor: pointer;
    transition: filter 0.12s;
}
.group-heading:hover { filter: brightness(1.08); }

/* Encabezado sin toggle (p. ej. comités: siempre abierto) */
.group-heading--static { cursor: default; }
.group-heading--static:hover { filter: none; }

.group-chevron {
    display: inline-flex;
    align-items: center;
    color: rgba(255,255,255,0.6);
    flex-shrink: 0;
    transition: transform 0.18s ease;
}
.licitacion-group.open .group-chevron { transform: rotate(90deg); }

/* Documentos ocultos por defecto; visibles al expandir la card */
.licitacion-group .docs-grid { display: none; }
.licitacion-group.open .docs-grid { display: grid; }
.licitacion-group .paaas-group { display: none; }
.licitacion-group.open .paaas-group {
    display: flex;
    flex-direction: column;
    gap: 16px;
    padding: 20px;
    background: linear-gradient(135deg, var(--arena-95) 0%, var(--vt-95) 100%);
    border-top: 1px solid rgba(0, 0, 0, 0.05);
}

.group-info {
    display: flex;
    flex-direction: row;
    align-items: baseline;
    text-align: left;
    gap: 14px;
    margin-right: auto;
    min-width: 0;
}

.group-num {
    font-size: 16px;
    font-weight: 700;
    color: #fff;
    line-height: 1.2;
    letter-spacing: 0.01em;
    font-variant-numeric: tabular-nums;
    white-space: nowrap;
    flex-shrink: 0;
    min-width: 160px;          /* celda fija: la descripción siempre arranca igual */
}

.group-desc {
    font-size: 11px;
    color: rgba(255,255,255,0.55);
    text-transform: uppercase;
    letter-spacing: 0.08em;
    min-width: 0;
    overflow-wrap: anywhere;   /* parte palabras largas para no exceder la ventana */
    line-height: 1.35;
    padding-left: 14px;
    border-left: 1px solid rgba(255,255,255,0.18);  /* separador entre celdas */
}

.group-heading-right {
    display: flex;
    align-items: center;
    gap: 10px;
    flex-shrink: 0;
}

.group-count {
    background: rgba(255,255,255,0.10);
    border: 1px solid rgba(255,255,255,0.22);
    border-radius: 20px;
    padding: 5px 14px;
    font-size: 12px;
    color: rgba(255,255,255,0.72);
    white-space: nowrap;
    flex-shrink: 0;
}

.group-emision {
    font-size: 11px;
    color: rgba(255,255,255,0.78);
    white-space: nowrap;
    flex-shrink: 0;
}

.licitacion-group .docs-grid {
    padding: 20px;
    background: linear-gradient(135deg, var(--arena-95) 0%, var(--vt-95) 100%);
    border-top: 1px solid rgba(0, 0, 0, 0.05);
}

/* ─── DOCUMENT GRID ───────────────────────────────────────── */
.docs-grid {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 16px;
}

.doc-card {
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    overflow: hidden;
    background: var(--surface);
    transition: box-shadow 0.15s;
}

.doc-card:hover { box-shadow: var(--shadow-md); }

/* Thumbnail — proporciones hoja A4 (210 × 297 mm) */
.doc-thumbnail {
    background: #efefef;
    aspect-ratio: 8.5 / 11;   /* tamaño carta — reduce el espacio bajo la portada */
    overflow: hidden;
    position: relative;
}

/* Canvas: dimensiones controladas por JS, sin altura fija en CSS */
.pdf-canvas {
    display: none;
    width: 100%;
}

/* Placeholder visible mientras carga o si PDF.js falla */
.thumb-loading {
    position: absolute;
    inset: 0;
    padding: 6px;
    display: flex;
    align-items: stretch;
    background: #e8e8e8;
}

.doc-thumb-page {
    background: #fff;
    width: 100%;
    height: 100%;
    box-shadow: 0 1px 4px rgba(0,0,0,0.15);
    padding: 6px 5px 5px;
    display: flex;
    flex-direction: column;
    gap: 3px;
    overflow: hidden;
}

.doc-thumb-bar {
    background: var(--olive);
    height: 9px;
    width: 100%;
    margin-bottom: 4px;
    flex-shrink: 0;
    border-radius: 1px;
}

.doc-thumb-line {
    background: #ddd;
    height: 4px;
    width: 100%;
    border-radius: 1px;
    flex-shrink: 0;
}
.doc-thumb-line.w80  { width: 80%; }
.doc-thumb-line.w65  { width: 65%; }
.doc-thumb-line.w50  { width: 50%; }
.doc-thumb-line.w90  { width: 90%; }

/* Card body compacto */
.doc-body {
    padding: 9px 10px 10px;
    background: var(--surface);
    border-top: 1px solid var(--border);
}

.doc-title {
    font-size: 12px;
    font-weight: 600;
    line-height: 1.35;
    margin: 3px 0 5px;
    color: var(--text);
    text-transform: uppercase;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

.doc-meta {
    display: flex;
    align-items: center;
    gap: 4px;
    font-size: 11px;
    color: var(--muted);
    margin-bottom: 8px;
}

.doc-meta svg { flex-shrink: 0; }

/* Action buttons */
.doc-actions { display: flex; gap: 8px; }

.doc-actions .btn-action {
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 10px 16px;
    min-height: 36px;
    width: 103.02px;
    flex-shrink: 0;
}

.doc-actions .btn-action {
    flex: 1;
    justify-content: center;
    padding: 6px 8px;
}

.btn-action {
    display: inline-flex;
    align-items: center;
    gap: 5px;
    padding: 6px 11px;
    border-radius: var(--radius-sm);
    font-size: 12px;
    font-weight: 500;
    text-decoration: none;
    color: var(--text);
    background: var(--btn-bg);
    border: none;
    cursor: pointer;
    transition: background 0.12s;
}

.btn-action:hover { background: var(--btn-hover); }

/* ─── DOCUMENTOS DISPONIBLES ─────────────────────────────── */
.section-disponibles { margin-top: 40px; }

.disponibles-grid {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    margin-top: 16px;
    border-top: 1px solid var(--border);
    border-left: 1px solid var(--border);
}

.disponible-card {
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 32px 20px;
    text-align: center;
    font-size: 14px;
    text-decoration: none;
    color: var(--text);
    border-right: 1px solid var(--border);
    border-bottom: 1px solid var(--border);
    background: var(--surface);
    min-height: 90px;
    transition: background 0.12s;
}

.disponible-card:hover { background: var(--surface-alt); }

/* ─── MODAL PDF ───────────────────────────────────────────── */
.pdf-modal-overlay {
    display: none;
    position: fixed;
    inset: 0;
    background: rgba(0,0,0,0.65);
    z-index: 1000;
    align-items: center;
    justify-content: center;
    padding: 20px;
}

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

.pdf-modal-box {
    background: var(--surface);
    border-radius: var(--radius-md);
    width: 100%;
    max-width: var(--page-max);
    height: 90vh;
    display: flex;
    flex-direction: column;
    overflow: hidden;
    box-shadow: var(--shadow-lg);
    box-sizing: border-box;
}

/* Mobile: Full screen without rounded corners */
@media (max-width: 600px) {
    .pdf-modal-box {
        max-width: 100vw;
        height: 95vh;
        border-radius: 0;
    }
}

.pdf-modal-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 16px;
    padding: 14px 18px;
    background: var(--olive-dark);
    color: #fff;
    flex-shrink: 0;
    border-bottom: 1px solid rgba(255,255,255,0.1);
}

.pdf-modal-title {
    font-size: 14px;
    font-weight: 600;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    flex: 1;
    min-width: 0;
}

@media (max-width: 600px) {
    .pdf-modal-header {
        gap: 10px;
        padding: 12px 14px;
    }

    .pdf-modal-title {
        font-size: 13px;
    }

    .pdf-modal-close {
        min-width: 30px;
        height: 30px;
        font-size: 16px;
    }
}

.pdf-modal-close {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-width: 32px;
    height: 32px;
    background: rgba(255,255,255,0.15);
    border: 1px solid rgba(255,255,255,0.25);
    color: rgba(255,255,255,0.9);
    font-size: 18px;
    font-weight: 500;
    line-height: 1;
    cursor: pointer;
    padding: 0;
    border-radius: 6px;
    transition: all 0.15s ease;
}

.pdf-modal-close:hover {
    background: rgba(255,255,255,0.25);
    border-color: rgba(255,255,255,0.4);
    color: #fff;
}

.pdf-modal-close:active {
    background: rgba(255,255,255,0.2);
}

.pdf-modal-body { flex: 1; overflow: auto; -webkit-overflow-scrolling: touch; }

.pdf-modal-frame {
    width: 100%;
    height: 100%;
    border: none;
    display: block;
}

/* ─── CANEFA ──────────────────────────────────────────────── */
.canefa-wrapper {
    width: 100%;
    line-height: 0;
    margin-top: 48px;
    overflow: hidden;
}

.canefa-img { width: 100%; height: auto; display: block; }

/* ─── FEEDBACK BAR ───────────────────────────────────────── */
.feedback-bar {
    border-top: 1px solid var(--border);
    padding: 14px 0;
    background: var(--surface);
}

.feedback-inner {
    display: flex;
    align-items: center;
    gap: 12px;
    font-size: 14px;
}

.feedback-btns { display: flex; gap: 6px; }

.feedback-btn {
    background: none;
    border: 1px solid var(--border);
    border-radius: var(--radius-min);
    padding: 4px 9px;
    cursor: pointer;
    color: var(--text);
    line-height: 1;
    font-size: 15px;
    transition: background 0.12s, border-color 0.12s, transform 0.1s;
}

.feedback-btn:hover { background: var(--btn-bg); transform: translateY(-1px); }
.feedback-btn.is-active { border-color: var(--accent); background: var(--accent-low); }

/* Caja de comentario (al responder "No") */
.feedback-comment { margin-top: 12px; }
.feedback-comment-label {
    display: block;
    font-size: 13px;
    color: var(--muted);
    margin-bottom: 6px;
}
.feedback-comment-row { display: flex; gap: 8px; align-items: flex-start; }
.feedback-textarea {
    flex: 1;
    padding: 9px 12px;
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    font-family: inherit;
    font-size: 13px;
    color: var(--text);
    background: var(--surface);
    resize: vertical;
    outline: none;
    transition: border-color 0.12s;
}
.feedback-textarea:focus { border-color: var(--accent); }
.feedback-send {
    padding: 9px 18px;
    border: none;
    border-radius: var(--radius-sm);
    background: var(--accent);
    color: var(--on-accent);
    font-size: 13px;
    font-weight: 600;
    cursor: pointer;
    white-space: nowrap;
    transition: filter 0.12s;
}
.feedback-send:hover { filter: brightness(0.92); }
.feedback-thanks {
    margin-top: 10px;
    font-size: 14px;
    font-weight: 600;
    color: var(--accent);
}

.btn-reportar {
    margin-left: auto;
    padding: 7px 15px;
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    text-decoration: none;
    font-size: 13px;
    color: var(--text);
    background: var(--surface);
    white-space: nowrap;
}

.btn-reportar:hover { background: var(--btn-bg); }

/* ─── FOOTER ─────────────────────────────────────────────── */
.site-footer {
    background: var(--olive-dark);
    color: #fff;
    padding: 48px 0 32px;
}

.footer-grid {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 40px;
    margin-bottom: 36px;
}

.footer-logo-wrap { margin-bottom: 10px; }

.footer-logo {
    height: 36px;
    filter: brightness(0) invert(1);
    opacity: 0.88;
}

.footer-brand {
    font-size: 14px;
    font-weight: 600;
    margin-bottom: 4px;
}

.footer-col-title {
    font-size: 13px;
    font-weight: 600;
    margin-bottom: 10px;
}

.footer-text {
    font-size: 13px;
    color: rgba(255,255,255,0.65);
    margin-bottom: 3px;
}

.footer-link {
    display: block;
    font-size: 13px;
    color: rgba(255,255,255,0.65);
    text-decoration: underline;
    margin-bottom: 4px;
}

.footer-link:hover { color: #fff; }

.footer-bottom {
    border-top: 1px solid rgba(255,255,255,0.15);
    padding-top: 22px;
}

.footer-links-label {
    font-size: 12px;
    color: rgba(255,255,255,0.5);
    margin-bottom: 8px;
}

.footer-links { display: flex; gap: 18px; flex-wrap: wrap; }

.footer-link-sm {
    font-size: 12px;
    color: rgba(255,255,255,0.55);
    text-decoration: underline;
}

.footer-link-sm:hover { color: #fff; }

/* ─── PORTAL LAYOUT: sidebar + content ───────────────────── */
.portal-layout {
    max-width: var(--page-max);
    margin: 0 auto;
    padding: 32px 40px 56px;
}

/* Link de regreso a inicio */
.back-to-home {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    font-size: 12px;
    color: var(--muted);
    text-decoration: none;
    margin-bottom: 6px;
}
.back-to-home:hover { color: var(--text); }

/* Sidebar */
.portal-sidebar {
    position: sticky;
    top: 24px;
}

.sidebar-section { margin-bottom: 28px; }

.sidebar-historico {
    margin-top: auto;
    padding-top: 16px;
    border-top: 1px solid var(--border);
    margin-bottom: 0;
}
.sidebar-historico-link {
    display: flex;
    align-items: center;
    gap: 7px;
    padding: 7px 10px;
    border-radius: var(--radius-sm);
    font-size: 12px;
    color: var(--muted);
    text-decoration: none;
    transition: background 0.1s, color 0.1s;
}
.sidebar-historico-link:hover {
    background: var(--surface-alt);
    color: var(--text);
}

.sidebar-label {
    font-size: 10px;
    font-weight: 700;
    letter-spacing: 0.1em;
    color: var(--muted);
    text-transform: uppercase;
    margin-bottom: 6px;
    padding: 0 8px;
}

.sidebar-nav { display: flex; flex-direction: column; gap: 1px; }

.sidebar-link {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 7px 10px;
    border-radius: var(--radius-sm);
    font-size: 13px;
    color: var(--text);
    text-decoration: none;
    transition: background 0.1s;
}

.sidebar-link:hover { background: var(--surface-alt); }

.sidebar-link.active {
    background: var(--olive-dark);
    color: #fff;
    font-weight: 600;
}

.sidebar-link.active .sidebar-count { color: rgba(255,255,255,0.65); }

.sidebar-count {
    font-size: 11px;
    color: var(--muted);
    font-variant-numeric: tabular-nums;
}

.sidebar-years { max-height: 340px; overflow-y: auto; }

/* Portal header */
.portal-header {
    display: flex;
    align-items: flex-end;
    justify-content: space-between;
    gap: 16px;
    margin-bottom: 24px;
}

.portal-total {
    font-size: 12px;
    color: var(--muted);
    white-space: nowrap;
    padding-bottom: 4px;
}

.year-badge {
    display: inline-block;
    background: var(--olive);
    color: #fff;
    font-size: 14px;
    font-weight: 600;
    padding: 2px 10px;
    border-radius: 4px;
    margin-left: 8px;
    vertical-align: middle;
}

/* ─── Pestañas de tipo de procedimiento ───────────────────── */
.portal-tabs-row {
    display: flex;
    align-items: flex-end;
    justify-content: space-between;
    gap: 20px;
    border-bottom: 1px solid var(--border);
    margin-bottom: 28px;
}

.portal-tabs {
    display: flex;
    align-items: stretch;
    gap: 2px;
    flex-wrap: wrap;
}

.portal-tab {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 11px 16px;
    font-size: 14px;
    font-weight: 500;
    font-family: inherit;
    color: var(--muted);
    text-decoration: none;
    background: none;
    border: none;
    border-bottom: 2px solid transparent;
    margin-bottom: -1px;
    cursor: pointer;
    white-space: nowrap;
    transition: color 0.12s, border-color 0.12s;
}
.portal-tab:hover { color: var(--text); }

.portal-tab.active,
.portal-tab-dd.active > .portal-tab {
    color: var(--accent);
    font-weight: 600;
    border-bottom-color: var(--accent);
}

/* Submenú de Adjudicaciones Directas */
.portal-tab-dd { position: relative; display: inline-flex; }
.portal-tab-dd .tab-caret { opacity: 0.6; transition: transform 0.15s; }
.portal-tab-dd.open .tab-caret { transform: rotate(180deg); }

.portal-tab-menu {
    position: absolute;
    top: 100%;
    left: 0;
    z-index: 30;
    min-width: 180px;
    margin-top: 2px;
    padding: 6px;
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: 8px;
    box-shadow: var(--shadow-lg);
    display: none;
    flex-direction: column;
    gap: 1px;
}
.portal-tab-dd.open .portal-tab-menu { display: flex; }

.portal-tab-menu a {
    padding: 8px 12px;
    border-radius: var(--radius-sm);
    font-size: 13px;
    color: var(--text);
    text-decoration: none;
    transition: background 0.1s;
}
.portal-tab-menu a:hover { background: var(--surface-alt); }
.portal-tab-menu a.active {
    background: var(--accent);
    color: #fff;
    font-weight: 600;
}

/* Herramientas a la derecha de las pestañas (histórico + año) */
.portal-tools {
    display: flex;
    align-items: center;
    gap: 14px;
    padding-bottom: 6px;
    flex-shrink: 0;
}
.portal-tools .sidebar-historico {
    margin: 0;
    padding: 0;
    border: none;
}

.portal-year-select {
    display: inline-flex;
    align-items: center;
    gap: 7px;
    font-size: 12px;
    color: var(--muted);
}
.portal-year-select select {
    padding: 6px 10px;
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    font-size: 13px;
    font-weight: 600;
    background: var(--surface);
    color: var(--text);
    cursor: pointer;
}

/* Paginación */
.portal-pagination {
    margin-top: 40px;
    margin-bottom: 12px;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    font-size: 13px;
}

/* Barra inferior: paginación centrada + selector de página */
.portal-pagination-bar {
    position: relative;
    margin-top: 40px;
}
.portal-pagination-bar .portal-pagination { margin-top: 0; }
.portal-per-page {
    display: flex;
    justify-content: flex-end;
    margin-top: 8px;
}
.portal-per-page label {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    font-size: 12px;
    color: var(--muted);
}
.portal-per-page select {
    padding: 4px 8px;
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    font-size: 12px;
    background: var(--surface);
    color: var(--text);
    cursor: pointer;
}

/* Prev / Next buttons */
.pag-btn {
    display: inline-flex;
    align-items: center;
    gap: 5px;
    padding: 7px 14px;
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    text-decoration: none;
    color: var(--text);
    background: var(--surface);
    font-weight: 500;
    transition: background 0.12s, border-color 0.12s;
    white-space: nowrap;
}
.pag-btn:hover { background: var(--btn-hover); border-color: var(--border); }

.pag-disabled {
    color: var(--muted);
    pointer-events: none;
    background: var(--surface-alt);
}

/* Number row */
.pag-numbers {
    display: flex;
    align-items: center;
    gap: 3px;
}

.pag-num {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-width: 34px;
    height: 34px;
    padding: 0 6px;
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    text-decoration: none;
    color: var(--text);
    background: var(--surface);
    font-size: 13px;
    transition: background 0.12s, border-color 0.12s;
}
.pag-num:hover { background: var(--btn-hover); border-color: var(--border); }

.pag-current {
    background: var(--olive-dark);
    color: #fff;
    border-color: var(--olive-dark);
    font-weight: 600;
    pointer-events: none;
}

.pag-ellipsis {
    padding: 0 4px;
    color: var(--muted);
    font-size: 14px;
    line-height: 34px;
    user-select: none;
}

.portal-empty {
    padding: 48px 24px;
    text-align: center;
    color: var(--muted);
    font-size: 14px;
}


/* ─── RESPONSIVE ─────────────────────────────────────────── */
@media (max-width: 900px) {
    .portal-layout { padding: 16px 24px 48px; }
    .site-main { overflow-x: clip; }   /* el portal nunca provoca scroll horizontal */
    .portal-content { min-width: 0; max-width: 100%; }
    /* En pantallas estrechas las pestañas se ajustan a varias líneas
       para que todas queden visibles dentro de la ventana. */
    .portal-tabs-row {
        flex-direction: column;
        align-items: stretch;
        gap: 12px;
    }
    .portal-tabs {
        width: 100%;
        min-width: 0;
        flex-wrap: wrap;
        gap: 4px 6px;
    }
    .portal-tab { padding: 9px 13px; }
    /* El submenú de Adjudicaciones se abre hacia la izquierda para no salirse */
    .portal-tab-menu { left: auto; right: 0; }
    .portal-tools { flex-wrap: wrap; justify-content: flex-end; padding-bottom: 0; }
}

@media (max-width: 768px) {
    .docs-grid               { grid-template-columns: repeat(2, 1fr); }
    .disponibles-grid        { grid-template-columns: repeat(2, 1fr); }
    .footer-grid             { grid-template-columns: 1fr; gap: 24px; }
}

@media (max-width: 480px) {
    .docs-grid               { grid-template-columns: 1fr; }
    .disponibles-grid        { grid-template-columns: 1fr; }
    .feedback-inner          { flex-wrap: wrap; }
    .btn-reportar            { margin-left: 0; }
}

/* ═══ LANDING PAGE ════════════════════════════════════════════ */

.home-container {
    max-width: var(--page-max);
    margin: 0 auto;
    padding: 0 40px;
}

/* ─── Hero ────────────────────────────────────────────────── */
.hero {
    position: relative;
    background: linear-gradient(135deg, var(--vt-10) 0%, var(--vt-20) 55%, var(--vt-30) 100%);
    color: #fff;
    overflow: hidden;
    padding: 72px 0 64px;
}

.hero-inner {
    max-width: var(--page-max);
    margin: 0 auto;
    /* Alineado a la izquierda pero con un sangrado que lo acerca al centro
       en pantallas anchas (crece con el ancho, mínimo 40px). */
    padding: 0 40px 0 clamp(40px, 12%, 240px);
    position: relative;
    z-index: 1;
}
/* La columna de texto se mantiene legible, alineada a la izquierda de la página */
.hero-eyebrow,
.hero-title { max-width: 700px; }

.hero-deco {
    position: absolute;
    right: -40px;
    top: -60px;
    width: 500px;
    height: 500px;
    border-radius: 50%;
    background: rgba(255,255,255,0.04);
    pointer-events: none;
}

.hero-eyebrow {
    font-size: 11px;
    font-weight: 600;
    letter-spacing: 0.14em;
    text-transform: uppercase;
    color: rgba(255,255,255,0.55);
    margin-bottom: 12px;
}

.hero-title {
    font-size: 40px;
    font-weight: 800;
    line-height: 1.15;
    margin-bottom: 18px;
    letter-spacing: -0.01em;
}

.hero-sub {
    font-size: 16px;
    line-height: 1.65;
    color: rgba(255,255,255,0.78);
    margin-bottom: 32px;
    max-width: 520px;
}

.hero-actions { display: flex; gap: 12px; flex-wrap: wrap; }

.hero-btn-primary {
    display: inline-flex;
    align-items: center;
    padding: 12px 28px;
    background: var(--accent);
    color: var(--on-accent);
    border-radius: var(--radius-sm);
    font-size: 14px;
    font-weight: 700;
    text-decoration: none;
    transition: background 0.12s, transform 0.1s;
}

.hero-btn-primary:hover { background: var(--mora-40); transform: translateY(-1px); }

.hero-btn-secondary {
    display: inline-flex;
    align-items: center;
    padding: 12px 24px;
    background: rgba(255,255,255,0.12);
    color: rgba(255,255,255,0.9);
    border: 1px solid rgba(255,255,255,0.25);
    border-radius: var(--radius-sm);
    font-size: 14px;
    font-weight: 600;
    text-decoration: none;
    transition: background 0.12s;
}

.hero-btn-secondary:hover { background: rgba(255,255,255,0.2); }

/* ─── Stats bar ───────────────────────────────────────────── */
.home-stats {
    background: var(--surface);
    border-bottom: 1px solid var(--border);
}

.stats-row {
    display: flex;
    align-items: center;
    gap: 0;
}

.stat-item {
    flex: 1;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 4px;
    padding: 28px 20px;
    text-align: center;
}

.stat-num {
    font-size: 28px;
    font-weight: 800;
    color: var(--olive-dark);
    line-height: 1;
    font-variant-numeric: tabular-nums;
}

.stat-desc {
    font-size: 12px;
    color: var(--muted);
    line-height: 1.4;
}

.stat-divider {
    width: 1px;
    height: 48px;
    background: var(--border);
    flex-shrink: 0;
}

/* ─── Sections ────────────────────────────────────────────── */
.home-section { padding: 64px 0; }
.home-section-alt { background: var(--surface-alt); }

.home-section-label {
    font-size: 11px;
    font-weight: 700;
    letter-spacing: 0.12em;
    text-transform: uppercase;
    color: var(--olive);
    margin-bottom: 6px;
}

.home-section-title {
    font-size: 26px;
    font-weight: 700;
    color: var(--olive-dark);
    margin-bottom: 32px;
}

.home-section-head {
    display: flex;
    align-items: flex-end;
    justify-content: space-between;
    margin-bottom: 24px;
}

.home-section-head .home-section-title { margin-bottom: 0; }

.home-ver-todos {
    font-size: 13px;
    color: var(--olive);
    text-decoration: underline;
    white-space: nowrap;
    padding-bottom: 2px;
}

/* ─── Category cards ──────────────────────────────────────── */
.cat-grid {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 20px;
}

.cat-card {
    display: flex;
    flex-direction: column;
    gap: 16px;
    padding: 28px 24px;
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius-md);
    text-decoration: none;
    color: var(--text);
    transition: box-shadow 0.15s, transform 0.12s, border-color 0.12s;
    position: relative;
}

.cat-card:hover {
    box-shadow: var(--shadow-md);
    transform: translateY(-2px);
    border-color: var(--olive);
}

.cat-icon {
    width: 56px;
    height: 56px;
    border-radius: var(--radius-md);
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
}

.cat-lpn   .cat-icon { background: #e8f4fd; color: #0d5c8a; }
.cat-itp   .cat-icon { background: #f0faf0; color: #1a6b2a; }
.cat-ad    .cat-icon { background: #fdf3e8; color: #8a4e0d; }
.cat-adb   .cat-icon { background: #ffddb6; color: #5b4221; }  /* Arena */
.cat-ads   .cat-icon { background: #ffd8e7; color: #773357; }  /* Mora */
.cat-com   .cat-icon { background: #e8f0ff; color: #1a3a8a; }
.cat-paaas .cat-icon { background: #e5f7f0; color: #0a5a3c; }
.cat-con   .cat-icon { background: #fef3e2; color: #7a4800; }

.cat-body { flex: 1; }

.cat-title {
    font-size: 16px;
    font-weight: 700;
    margin-bottom: 8px;
    color: var(--olive-dark);
}

.cat-desc {
    font-size: 13px;
    color: var(--muted);
    line-height: 1.55;
    margin-bottom: 12px;
}

.cat-count {
    font-size: 12px;
    font-weight: 600;
    color: var(--olive);
}

.cat-arrow {
    position: absolute;
    top: 24px;
    right: 24px;
    font-size: 18px;
    color: var(--border);
    transition: color 0.12s, transform 0.12s;
}

.cat-card:hover .cat-arrow { color: var(--olive); transform: translateX(3px); }

/* ─── Recientes grid ──────────────────────────────────────── */
.recientes-grid {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 16px;
}

.reciente-card {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius-md);
    padding: 18px 20px;
    text-decoration: none;
    color: var(--text);
    display: flex;
    flex-direction: column;
    gap: 8px;
    transition: box-shadow 0.15s, border-color 0.12s;
}

.reciente-card:hover {
    box-shadow: var(--shadow-md);
    border-color: var(--olive);
}

.reciente-tipo { display: flex; gap: 6px; }

.tipo-chip {
    font-size: 10px;
    font-weight: 700;
    letter-spacing: 0.06em;
    text-transform: uppercase;
    padding: 2px 8px;
    border-radius: var(--radius-min);
}

/* Chips por tipo — tintes derivados de los ramps del DS */
.tipo-lpn   { background: #ecf2ff; color: #254c97; }  /* Blue Informative */
.tipo-itp   { background: #d2fad2; color: #1c7d29; }  /* Green Success */
.tipo-ad    { background: #ffeedd; color: #755937; }  /* Arena */
.tipo-adb   { background: #ffddb6; color: #5b4221; }  /* Arena */
.tipo-ads   { background: #ffd8e7; color: #773357; }  /* Mora */
.tipo-sub   { background: #edf4d1; color: #434a30; }  /* Verde Tierra */
.tipo-com   { background: #b2ccff; color: #254c97; }  /* Blue Informative */
.tipo-paaas { background: #e6f5de; color: #546250; }  /* Bosque */
.tipo-con   { background: #e5dbd7; color: #4a2c20; }  /* Tierra */

.reciente-num {
    font-size: 14px;
    font-weight: 700;
    color: var(--olive-dark);
}

.reciente-desc {
    font-size: 12px;
    color: var(--muted);
    line-height: 1.4;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

.reciente-footer {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-top: auto;
    padding-top: 8px;
}

.reciente-docs { font-size: 11px; color: var(--muted); white-space: nowrap; }
.reciente-dep {
    font-size: 11px;
    font-weight: 600;
    color: var(--olive);
    text-transform: uppercase;
    letter-spacing: 0.04em;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

/* ─── Info cards ──────────────────────────────────────────── */
.info-grid {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 24px;
}

.info-card {
    padding: 28px 24px;
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius-md);
}

.info-icon {
    width: 44px;
    height: 44px;
    border-radius: var(--radius-sm);
    display: flex;
    align-items: center;
    justify-content: center;
    margin-bottom: 14px;
}

.info-icon-blue   { background: #ecf2ff; color: #254c97; }  /* Blue Informative */
.info-icon-green  { background: #d2fad2; color: #1c7d29; }  /* Green Success */
.info-icon-orange { background: #ffeedd; color: #755937; }  /* Arena */

.info-title {
    font-size: 15px;
    font-weight: 700;
    margin-bottom: 8px;
    color: var(--olive-dark);
}

.info-text {
    font-size: 13px;
    color: var(--muted);
    line-height: 1.6;
    margin-bottom: 14px;
}

.info-link {
    font-size: 13px;
    color: var(--olive);
    text-decoration: underline;
    font-weight: 500;
}

/* ─── Year chips ──────────────────────────────────────────── */
.years-chips {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
}

.year-chip {
    display: inline-flex;
    align-items: center;
    padding: 6px 16px;
    border: 1px solid var(--border);
    border-radius: 20px;
    font-size: 13px;
    font-weight: 600;
    color: var(--text);
    text-decoration: none;
    background: var(--surface);
    transition: background 0.1s, border-color 0.1s, color 0.1s;
}

.year-chip:hover {
    background: var(--olive-dark);
    border-color: var(--olive-dark);
    color: #fff;
}

/* ─── Landing responsive ──────────────────────────────────── */
@media (max-width: 900px) {
    .hero-title  { font-size: 30px; }
    .cat-grid    { grid-template-columns: 1fr; gap: 12px; }
    .cat-card    { flex-direction: row; gap: 16px; }
    .cat-arrow   { display: none; }
    .recientes-grid { grid-template-columns: repeat(2, 1fr); }
    .info-grid   { grid-template-columns: 1fr; }
    .stats-row   { flex-wrap: wrap; }
    .stat-divider { display: none; }
    .stat-item   { flex: 0 0 50%; border-bottom: 1px solid var(--border); }
}

@media (max-width: 600px) {
    .hero-title  { font-size: 26px; }
    .hero-inner  { padding: 0 24px; }
    .recientes-grid { grid-template-columns: 1fr; }
    .home-section { padding: 40px 0; }
    .stat-item   { flex: 0 0 100%; }
}

/* ─── Header login button ─────────────────────────────────── */
/* Texto del botón login: oculto en móvil pequeño */
.header-login-text { display: inline; }

.header-login-btn {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 6px 14px;
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    font-size: 13px;
    font-weight: 500;
    line-height: 1;
    color: var(--text);
    text-decoration: none;
    white-space: nowrap;
    box-sizing: border-box;
    transition: background 0.15s, border-color 0.15s;
}
.header-login-btn:hover {
    background: var(--btn-hover);
    border-color: var(--border);
}
.header-logout-btn {
    background: none;
    cursor: pointer;
    font-family: inherit;
    line-height: 1;
    box-sizing: border-box;
}

/* ─── Search bar ──────────────────────────────────────────── */
/* Usa el mismo contenedor (.portal-layout) que el listado de procedimientos;
   solo ajusta el espacio inferior. */
.search-page { padding-bottom: 60px; }

.search-page-header { margin-bottom: 28px; }

.search-page-header h1 {
    font-size: 22px;
    font-weight: 600;
    margin-bottom: 4px;
}

.search-form {
    display: flex;
    gap: 8px;
    margin-bottom: 32px;
}

.search-input {
    flex: 1;
    padding: 10px 14px;
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    font-size: 14px;
    outline: none;
    transition: border-color 0.15s;
}
.search-input:focus { border-color: var(--accent); }

.search-submit {
    padding: 10px 18px;
    background: var(--accent);
    color: var(--on-accent);
    border: none;
    border-radius: var(--radius-sm);
    font-size: 14px;
    font-weight: 500;
    cursor: pointer;
    transition: filter 0.15s;
}
.search-submit:hover { filter: brightness(0.92); }

.search-results-count {
    font-size: 13px;
    color: var(--muted);
    margin-bottom: 20px;
}

.search-section-title {
    font-size: 12px;
    font-weight: 600;
    letter-spacing: 0.08em;
    text-transform: uppercase;
    color: var(--muted);
    margin: 24px 0 10px;
    padding-bottom: 6px;
    border-bottom: 1px solid var(--border);
}

.search-result-item {
    display: block;
    padding: 12px 0;
    border-bottom: 1px solid var(--border);
    text-decoration: none;
    color: var(--text);
    transition: color 0.15s;
}
.search-result-item:hover { color: var(--olive-dark); }

.search-result-title {
    font-size: 14px;
    font-weight: 500;
    margin-bottom: 3px;
}

.search-tag {
    display: inline-flex;
    align-items: center;
    gap: 5px;
    padding: 2px 9px 2px 7px;
    border-radius: 20px;
    font-size: 10px;
    font-weight: 700;
    letter-spacing: 0.04em;
    text-transform: uppercase;
    vertical-align: 1px;
    margin-right: 8px;
    border: 1px solid transparent;
}
.search-tag::before {
    content: '';
    width: 6px;
    height: 6px;
    border-radius: 50%;
    background: currentColor;
    flex-shrink: 0;
}
.search-tag--proc      { background: #ecf2ff; color: #254c97; border-color: #b2ccff; }
.search-tag--doc       { background: #d2fad2; color: #1c7d29; border-color: #a6f6a6; }
.search-tag--contenido { background: #ffeedd; color: #755937; border-color: #ffddb6; }

[data-theme="dark"] .search-tag--proc      { background: #16213a; color: #7da2e8; border-color: #24375a; }
[data-theme="dark"] .search-tag--doc       { background: #15281b; color: #5dbd7a; border-color: #244d33; }
[data-theme="dark"] .search-tag--contenido { background: #2a1f10; color: #d9a458; border-color: #4a3820; }

/* ── Filtros por tipo en resultados de búsqueda ─────────────── */
.search-filters {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    margin: 4px 0 20px;
}
.search-filter-chip {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 5px 12px;
    border-radius: 20px;
    font-size: 12.5px;
    font-weight: 500;
    color: var(--text);
    background: var(--surface);
    border: 1px solid var(--border);
    text-decoration: none;
    transition: background 0.12s, border-color 0.12s, color 0.12s;
}
.search-filter-chip:hover { border-color: var(--olive); }
.search-filter-chip.active {
    background: var(--olive-dark);
    color: #fff;
    border-color: var(--olive-dark);
}
.search-filter-count {
    font-size: 11px;
    font-variant-numeric: tabular-nums;
    padding: 1px 7px;
    border-radius: 10px;
    background: var(--btn-bg);
    color: var(--muted);
}
.search-filter-chip.active .search-filter-count {
    background: rgba(255,255,255,0.2);
    color: #fff;
}

.search-result-meta {
    font-size: 12px;
    color: var(--muted);
    display: flex;
    align-items: center;   /* el chip no se estira a la altura de la fila */
    flex-wrap: wrap;
    gap: 8px 10px;
}

.search-chip {
    display: inline-flex;
    align-items: center;
    align-self: center;
    flex-shrink: 0;
    max-width: 320px;
    padding: 3px 8px;
    border-radius: var(--radius-min);
    font-size: 11px;
    font-weight: 600;
    line-height: 1.3;
    background: var(--btn-bg);
    color: var(--muted);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.search-empty {
    padding: 40px 0;
    text-align: center;
    color: var(--muted);
}

.search-empty p { margin-bottom: 8px; }

/* Header search widget */
.header-search-form {
    display: flex;
    align-items: center;
    gap: 0;
    background: var(--surface-alt);
    border: 1.5px solid var(--border);
    border-radius: 999px;
    padding: 2px 2px 2px 4px;
    transition: border-color 0.15s, box-shadow 0.15s, background 0.15s;
}
.header-search-form:focus-within {
    border-color: var(--accent);
    background: var(--surface);
    box-shadow: 0 0 0 3px var(--accent-low);
}

.header-search-input {
    width: 230px;
    padding: 8px 12px;
    border: none;
    background: none;
    color: var(--text);
    font-size: 14px;
    outline: none;
    transition: width 0.2s;
}
.header-search-input::placeholder { color: var(--muted); }
.header-search-input:focus { width: 300px; }

.header-search-btn {
    padding: 8px 12px;
    background: var(--accent);
    border: none;
    border-radius: 999px;
    cursor: pointer;
    display: flex;
    align-items: center;
    color: var(--on-accent);
    flex-shrink: 0;
    transition: filter 0.15s;
}
.header-search-btn:hover { filter: brightness(0.92); }


/* ═══ MICROSITIO DE PROCEDIMIENTO (portal/show) ═══════════════ */

.show-breadcrumb {
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 12px;
    color: var(--muted);
    margin-bottom: 28px;
    flex-wrap: wrap;
}

.show-breadcrumb a { color: var(--olive); text-decoration: none; }
.show-breadcrumb a:hover { text-decoration: underline; }
.show-breadcrumb span { color: var(--muted); }

.show-header {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 24px;
    margin-bottom: 24px;
    flex-wrap: wrap;
}

.show-header-left { flex: 1; min-width: 0; }

.show-tipo-chip {
    display: inline-block;
    font-size: 11px;
    font-weight: 700;
    letter-spacing: 0.07em;
    text-transform: uppercase;
    padding: 3px 9px;
    border-radius: 4px;
    margin-bottom: 10px;
}

.show-numero {
    font-size: 30px;
    font-weight: 800;
    color: var(--olive-dark);
    letter-spacing: -0.01em;
    margin-bottom: 6px;
    word-break: break-word;
}

.show-desc {
    font-size: 15px;
    color: var(--muted);
    line-height: 1.55;
}

.show-meta-row {
    display: flex;
    flex-wrap: wrap;
    gap: 0;
    border: 1px solid var(--border);
    border-radius: 8px;
    overflow: hidden;
    margin-bottom: 32px;
    background: var(--surface-2);
}

.show-meta-item {
    flex: 1 1 160px;
    display: flex;
    flex-direction: column;
    gap: 4px;
    padding: 14px 20px;
    border-right: 1px solid var(--border);
}

.show-meta-item:last-child { border-right: none; }

.show-meta-label {
    font-size: 10px;
    font-weight: 700;
    letter-spacing: 0.1em;
    text-transform: uppercase;
    color: var(--muted);
}

.show-meta-item span:not(.show-meta-label) {
    font-size: 14px;
    font-weight: 500;
    color: var(--olive-dark);
}

@media (max-width: 600px) {
    .show-numero { font-size: 22px; }
    .show-meta-item { flex-basis: 50%; border-bottom: 1px solid var(--border); }
    .cat-grid { grid-template-columns: 1fr 1fr; }
}

/* ═══ PAAAS FILE CARDS ════════════════════════════════════════ */

.paaas-group { display: flex; flex-direction: column; gap: 16px; }
.contratos-files { display: flex; flex-direction: column; gap: 12px; padding: 8px 0 4px; }

.paaas-file-card {
    display: flex;
    align-items: center;
    gap: 20px;
    padding: 20px 24px;
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius-md);
    transition: box-shadow 0.15s, border-color 0.12s;
}

.paaas-file-card:hover {
    box-shadow: var(--shadow-md);
    border-color: var(--olive);
}

.paaas-file-icon {
    flex-shrink: 0;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 4px;
    color: var(--muted);
    width: 52px;
}

.paaas-file-ext {
    font-size: 9px;
    font-weight: 800;
    letter-spacing: 0.08em;
    padding: 2px 6px;
    border-radius: 3px;
    background: #ffe8e8;
    color: #cc3333;
}

.paaas-file-ext--xlsx {
    background: #e6f4ea;
    color: #1a6b2a;
}

.paaas-file-body {
    flex: 1;
    min-width: 0;
}

.paaas-file-title {
    font-size: 16px;
    font-weight: 700;
    color: var(--olive-dark);
    margin-bottom: 4px;
    text-transform: uppercase;
}

.paaas-file-meta {
    display: flex;
    align-items: center;
    gap: 6px;
    font-size: 12px;
    color: var(--muted);
    margin-bottom: 6px;
}

.paaas-file-type {
    font-weight: 600;
    color: var(--olive);
}

.paaas-file-desc {
    font-size: 12px;
    color: var(--muted);
    line-height: 1.45;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

.paaas-file-actions {
    flex-shrink: 0;
    display: flex;
    gap: 8px;
    flex-direction: row;
    align-items: center;
    justify-content: flex-end;
}

.paaas-file-actions .btn-action {
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 8px 12px;
    min-height: 36px;
    width: 103.02px;
    flex-shrink: 0;
}

.btn-action--primary {
    background: var(--olive-dark);
    color: #fff;
    border: 1px solid transparent;
    font-weight: 600;
}

.btn-action--primary:hover {
    background: #2e4420;
    color: #fff;
}

@media (max-width: 640px) {
    .paaas-file-card { flex-wrap: wrap; }
    .paaas-file-actions { flex-direction: row; width: 100%; }
}

/* ═══ THEME TOGGLE ════════════════════════════════════════════ */

.header-theme-btn {
    background: none;
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    padding: 5px 8px;
    cursor: pointer;
    color: var(--muted);
    display: flex;
    align-items: center;
    transition: background 0.15s, color 0.15s;
    flex-shrink: 0;
}
.header-theme-btn:hover { background: var(--btn-hover); color: var(--text); }

/* Show sun in dark mode, moon in light mode */
[data-theme="dark"] .icon-moon { display: none; }
[data-theme="dark"] .icon-sun  { display: block; }
:not([data-theme="dark"]) .icon-sun  { display: none; }
:not([data-theme="dark"]) .icon-moon { display: block; }

/* ═══ DARK MODE — component overrides ════════════════════════ */

/* Inputs and selects */
[data-theme="dark"] input,
[data-theme="dark"] select,
[data-theme="dark"] textarea {
    background: var(--surface-2);
    color: var(--text);
    border-color: var(--border);
    color-scheme: dark;
}

/* Thumb loading placeholder */
[data-theme="dark"] .thumb-loading {
    background: #2a2a2a;
}
[data-theme="dark"] .doc-thumb-page {
    background: #1e1e1e;
    box-shadow: 0 1px 4px rgba(0,0,0,0.4);
}
[data-theme="dark"] .doc-thumb-line { background: #3a3a3a; }

/* Search input (modo oscuro: el caret/placeholder siguen el tema) */
[data-theme="dark"] .header-search-input { color-scheme: dark; }

/* Selector de año del portal (modo oscuro) */
[data-theme="dark"] .portal-year-select select {
    color-scheme: dark;
}

/* ═══ MOBILE — header ════════════════════════════════════════ */

/* Progressive logo removal to keep access button visible */
/* First: remove rightmost logo (DGC) at larger breakpoint */
@media (max-width: 1100px) {
    .logo-dgc { display: none; }
}

/* Second: remove middle logo (Finanzas) */
@media (max-width: 900px) {
    .logo-finanzas { display: none; }
}

/* Tablet: remove dividers (Morelos logo always stays visible) */
@media (max-width: 860px) {
    .header-divider { display: none; }
    .header-inner { padding: 0 20px; }
    .header-search-input { width: 160px; }
    .header-search-input:focus { width: 200px; }
}

/* Teléfono grande: reducir tamaños */
@media (max-width: 600px) {
    .header-inner { padding: 0 16px; height: 56px; }
    .logo-morelos { height: 32px; }
    .header-right { gap: 8px; }
    .header-search-input { width: 120px; }
    .header-search-input:focus { width: 150px; }
}

/* Tablet/móvil: mover buscador a fila inferior para no desbordar botones de sesión */
@media (max-width: 640px) {
    .header-search-form { display: none; }

    .header-search-row {
        display: block;
        border-top: 1px solid var(--border);
        padding: 7px 14px;
        background: var(--surface);
    }
    .header-search-row form {
        display: flex;
        align-items: center;
        gap: 0;
        background: var(--surface-alt);
        border: 1.5px solid var(--border);
        border-radius: 999px;
        padding: 2px 2px 2px 4px;
    }
    .header-search-row form:focus-within {
        border-color: var(--accent);
        background: var(--surface);
    }
    .header-search-row .header-search-input {
        flex: 1;
        width: auto;
    }
    .header-search-row .header-search-input:focus { width: auto; }
}

/* Móvil pequeño */
@media (max-width: 430px) {
    .header-inner { height: 50px; padding: 0 14px; }
    .logo-morelos { height: 28px; }
    .header-login-btn { padding: 6px 9px; }
    .header-login-text { display: none; }
}

/* ═══ MOBILE — portal ════════════════════════════════════════ */
@media (max-width: 600px) {
    .portal-layout { padding: 12px 14px 40px; }

    .group-heading {
        flex-direction: column;
        align-items: flex-start;
        gap: 10px;
        padding: 12px 14px;
    }
    .group-info {
        flex-direction: column;
        flex: 1;
        min-width: 0;
        gap: 6px;
        width: 100%;
    }
    .group-num {
        font-size: 15px;
        min-width: unset;
        margin-bottom: 0;
    }
    .group-desc {
        padding-left: 0;
        border-left: none;
        font-size: 11px;
    }
    .group-heading-right {
        width: 100%;
        flex-direction: column;
        align-items: flex-start;
        gap: 8px;
    }
    .group-count {
        align-self: flex-start;
    }

    .portal-header { flex-direction: column; align-items: flex-start; gap: 4px; }
    .portal-total  { padding-bottom: 0; }

    .section-title { font-size: 17px; }

    .portal-tab { padding: 9px 12px; font-size: 13px; }

    .pag-numbers { display: none; }

    .container { padding: 0 14px; }

    /* Búsqueda: evita que el contenido desborde el ancho de la pantalla */
    .search-page-header h1 { font-size: 19px; }
    .search-form { flex-wrap: wrap; }
    .search-form .search-input { flex: 1 1 100%; width: 100%; min-width: 0; font-size: 16px; }
    .search-submit { width: 100%; }
    .search-result-title { overflow-wrap: anywhere; }
    .search-results-count { overflow-wrap: anywhere; }
    .search-result-meta { font-size: 11px; }
    .search-result-meta > div { margin-left: 0; }
    .search-chip { max-width: 62vw; }
}

/* ═══ MOBILE — modal PDF (pantalla completa para máximo ancho) ═══ */
@media (max-width: 600px) {
    .pdf-modal-overlay { padding: 0; align-items: stretch; }
    .pdf-modal-box {
        border-radius: 0;
        height: 100%;
        width: 100%;
        max-width: 100%;
        box-sizing: border-box;
    }
    .pdf-modal-title { font-size: 12px; }
    /* El iframe ocupa todo el ancho disponible; el PDF se ajusta con #view=FitV */
    .pdf-modal-body { overflow: auto; -webkit-overflow-scrolling: touch; }
    .pdf-modal-frame { width: 100%; min-height: 100%; }
}

/* Responsive para página de documento (documento-view) */
@media (max-width: 600px) {
    .container { padding: 14px !important; }
}

/* ═══ MOBILE — footer ════════════════════════════════════════ */
@media (max-width: 480px) {
    .site-footer { padding: 32px 0 20px; }
    .footer-links { gap: 12px; }
    .feedback-inner { flex-wrap: wrap; gap: 8px; }
    .btn-reportar { width: 100%; text-align: center; margin-left: 0; }
}

/* ═══ MOBILE — show page ════════════════════════════════════ */
@media (max-width: 480px) {
    .show-header { flex-direction: column; gap: 10px; }
    .show-numero { font-size: 20px; }
    .show-meta-item { flex-basis: 100%; border-right: none; border-bottom: 1px solid var(--border); }
    .show-meta-item:last-child { border-bottom: none; }
    .doc-actions { flex-wrap: wrap; }
}

/* ═══ MOBILE — home ══════════════════════════════════════════ */
@media (max-width: 480px) {
    .hero { padding: 48px 0 40px; }
    .hero-title { font-size: 22px; }
    .hero-sub { font-size: 14px; }
    .hero-btn-primary,
    .hero-btn-secondary { padding: 10px 18px; font-size: 13px; }
    .home-section-title { font-size: 20px; }
    .cat-grid { grid-template-columns: 1fr; }
    .cat-card { padding: 18px 16px; }
    .home-container { padding: 0 14px; }
}

/* ═══ MÓVIL — objetivos táctiles más grandes (uso en pantallas táctiles) ═══ */
@media (max-width: 768px) {
    .btn-action {
        padding: 11px 16px;
        font-size: 13px;
        min-height: 42px;
    }
    .doc-actions { gap: 8px; }
    .doc-actions .btn-action { flex: 1; width: auto; justify-content: center; }

    .header-login-btn  { padding: 10px 14px; font-size: 14px; }
    .header-theme-btn  { padding: 10px 12px; }   /* incluye el botón de inicio (casita) */
    .header-search-btn { padding: 11px 14px; }
    .header-search-input { font-size: 16px; }     /* evita zoom en iOS al enfocar */

    .feedback-btn  { padding: 9px 15px; font-size: 18px; }
    .feedback-send { padding: 12px 22px; font-size: 14px; }
    .btn-reportar  { padding: 11px 16px; }

    .portal-year-select select,
    .portal-per-page select { padding: 10px 12px; font-size: 15px; }

    .pag-btn  { padding: 11px 16px; min-height: 44px; }
    .pag-num  { min-width: 42px; height: 42px; }

    .pdf-modal-close { min-height: 42px; padding: 9px 14px; }

    .hero-btn-primary { padding: 14px 30px; font-size: 15px; }

    .portal-tab { padding: 11px 15px; }
}
