/* ------------------------------------------------------------------
   Base visual compartida — misma paleta, tipografía y componentes
   que el sistema institucional (site.css). app.css la extiende.
------------------------------------------------------------------- */

:root {
    --bg: #f4f7fb;
    --surface: #ffffff;
    --surface-soft: #f8fafc;
    --ink: #0f172a;
    --muted: #64748b;
    --line: #e2e8f0;
    --brand: #1e3a8a;
    --brand-2: #4f46e5;
    --brand-3: #0ea5e9;
    --success: #047857;
    --success-soft: #ecfdf5;
    --danger: #be123c;
    --danger-soft: #fff1f2;
    --radius: 18px;
    --radius-sm: 12px;
    --shadow: 0 24px 60px -34px rgba(15, 23, 42, .55);
    --shadow-sm: 0 10px 26px -20px rgba(15, 23, 42, .45);
}

* { box-sizing: border-box; }
html { scroll-behavior: smooth; }

body {
    margin: 0;
    color: var(--ink);
    font-family: "Segoe UI", Tahoma, Verdana, Arial, sans-serif;
    font-size: 15px;
    line-height: 1.5;
    -webkit-font-smoothing: antialiased;
}

a { color: var(--brand-2); text-decoration: none; }
a:hover { text-decoration: underline; }
img { max-width: 100%; height: auto; }
h1, h2, h3, p { margin-top: 0; }

.muted { color: var(--muted); }

.sr-only {
    position: absolute;
    width: 1px;
    height: 1px;
    padding: 0;
    margin: -1px;
    overflow: hidden;
    clip: rect(0, 0, 0, 0);
    white-space: nowrap;
    border: 0;
}

/* ------------------------------ Sitio ----------------------------- */

.site-body {
    min-height: 100vh;
    background:
        radial-gradient(circle at 12% 0%, rgba(79, 70, 229, .10), transparent 34rem),
        radial-gradient(circle at 88% 8%, rgba(14, 165, 233, .12), transparent 30rem),
        var(--bg);
}

.site-header {
    position: sticky;
    top: 0;
    z-index: 20;
    border-bottom: 1px solid rgba(226, 232, 240, .8);
    background: rgba(255, 255, 255, .88);
    backdrop-filter: blur(14px);
}

.site-header__inner {
    width: min(1180px, calc(100% - 32px));
    min-height: 76px;
    margin: 0 auto;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 20px;
}

.brand {
    display: flex;
    align-items: center;
    gap: 14px;
    min-width: 0;
    color: var(--ink);
    text-decoration: none;
}

.brand:hover { text-decoration: none; }

.brand__text { display: grid; gap: 1px; min-width: 0; }

.brand__text small {
    color: var(--muted);
    font-size: 10.5px;
    font-weight: 700;
    letter-spacing: .11em;
    text-transform: uppercase;
}

.brand__text strong {
    font-size: 17px;
    line-height: 1.2;
    letter-spacing: -.02em;
}

.site-nav { display: flex; align-items: center; gap: 6px; }

.site-nav a {
    padding: 9px 13px;
    border-radius: 10px;
    color: #334155;
    font-size: 13px;
    font-weight: 700;
    text-decoration: none;
}

.site-nav a:hover { background: #eef2ff; color: var(--brand); text-decoration: none; }

.site-nav .nav-admin { border: 1px solid var(--line); background: #fff; }

.site-main {
    width: min(1180px, calc(100% - 32px));
    margin: 0 auto;
    padding: 30px 0 54px;
}

/* Portada */
.hero {
    position: relative;
    overflow: hidden;
    display: grid;
    grid-template-columns: minmax(0, 1.25fr) minmax(220px, .75fr);
    gap: 34px;
    align-items: center;
    padding: 40px 44px;
    border-radius: 26px;
    color: #fff;
    background:
        radial-gradient(circle at 82% 20%, rgba(56, 189, 248, .38), transparent 22rem),
        linear-gradient(135deg, #172554 0%, #1e3a8a 48%, #4338ca 100%);
    box-shadow: var(--shadow);
}

.hero::before,
.hero::after {
    content: "";
    position: absolute;
    border: 1px solid rgba(255, 255, 255, .12);
    border-radius: 50%;
    pointer-events: none;
}

.hero::before { width: 340px; height: 340px; right: -110px; top: -160px; }
.hero::after { width: 220px; height: 220px; left: -90px; bottom: -150px; }

.hero__eyebrow {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    margin-bottom: 14px;
    color: #bfdbfe;
    font-size: 11px;
    font-weight: 800;
    letter-spacing: .13em;
    text-transform: uppercase;
}

.hero__eyebrow::before {
    content: "";
    width: 22px;
    height: 2px;
    border-radius: 2px;
    background: #7dd3fc;
}

.hero h1 {
    max-width: 680px;
    margin-bottom: 14px;
    font-size: clamp(30px, 4.2vw, 46px);
    line-height: 1.06;
    letter-spacing: -.035em;
}

.hero p { max-width: 590px; margin-bottom: 24px; color: #dbeafe; font-size: 15px; }
.hero__stats { display: flex; flex-wrap: wrap; gap: 10px; }

.hero-stat {
    display: flex;
    align-items: baseline;
    gap: 7px;
    padding: 9px 13px;
    border: 1px solid rgba(255, 255, 255, .14);
    border-radius: 999px;
    background: rgba(255, 255, 255, .09);
    font-size: 12px;
    color: #e0f2fe;
}

.hero-stat strong { color: #fff; font-size: 18px; line-height: 1; }

.hero__art { position: relative; z-index: 1; justify-self: center; }

/* Buscador */
.search-card {
    position: relative;
    z-index: 2;
    margin: -22px 28px 0;
    padding: 18px;
    border: 1px solid rgba(226, 232, 240, .9);
    border-radius: 18px;
    background: rgba(255, 255, 255, .97);
    box-shadow: var(--shadow-sm);
}

.search-form { display: flex; gap: 10px; align-items: center; }
.search-field { position: relative; flex: 1; min-width: 0; }

.search-field svg {
    position: absolute;
    top: 50%;
    left: 14px;
    width: 18px;
    height: 18px;
    color: #94a3b8;
    transform: translateY(-50%);
    pointer-events: none;
}

.search-field input {
    width: 100%;
    height: 46px;
    padding: 0 14px 0 42px;
    border: 1px solid var(--line);
    border-radius: 12px;
    color: var(--ink);
    background: var(--surface-soft);
    font: inherit;
    font-size: 14px;
}

.search-field input:focus {
    outline: none;
    border-color: #a5b4fc;
    background: #fff;
    box-shadow: 0 0 0 3px rgba(79, 70, 229, .12);
}

/* Botones */
.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    min-height: 42px;
    padding: 9px 16px;
    border: 1px solid transparent;
    border-radius: 11px;
    font: inherit;
    font-size: 13px;
    font-weight: 800;
    line-height: 1.2;
    cursor: pointer;
    text-decoration: none;
    transition: transform .15s ease, background .15s ease, border-color .15s ease, box-shadow .15s ease;
}

.btn:hover { text-decoration: none; transform: translateY(-1px); }

.btn-primary {
    color: #fff;
    background: linear-gradient(135deg, var(--brand-2), var(--brand));
    box-shadow: 0 10px 20px -12px rgba(67, 56, 202, .75);
}

.btn-primary:hover { color: #fff; box-shadow: 0 14px 26px -14px rgba(67, 56, 202, .85); }

.btn-ghost { color: #334155; border-color: var(--line); background: #fff; }
.btn-ghost:hover { background: #f8fafc; }

.btn-soft { color: var(--brand); background: #eef2ff; border-color: #e0e7ff; }

.btn-danger { color: var(--danger); border-color: #fecdd3; background: var(--danger-soft); }
.btn-danger:hover { background: #ffe4e6; }

.btn-sm { min-height: 34px; padding: 6px 11px; border-radius: 9px; font-size: 12px; }
.btn-block { width: 100%; }

.icon-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 34px;
    height: 34px;
    padding: 0;
    border: 1px solid var(--line);
    border-radius: 9px;
    color: #475569;
    background: #fff;
    cursor: pointer;
    transition: background .15s ease, border-color .15s ease, color .15s ease;
}

.icon-btn svg { width: 17px; height: 17px; }
.icon-btn:hover { color: var(--brand); border-color: #c7d2fe; background: #eef2ff; }

.icon-btn:focus-visible { outline: 3px solid rgba(79, 70, 229, .18); outline-offset: 1px; }

.icon-btn--danger { color: var(--danger); border-color: #fecdd3; background: var(--danger-soft); }
.icon-btn--danger:hover { color: var(--danger); border-color: #fda4af; background: #ffe4e6; }
.icon-btn:disabled { opacity: .42; cursor: not-allowed; filter: grayscale(.25); }

/* Secciones */
.section { margin-top: 30px; }

.section-head {
    display: flex;
    flex-wrap: wrap;
    align-items: end;
    justify-content: space-between;
    gap: 12px;
    margin-bottom: 16px;
}

.section-head h2 { margin: 0; font-size: 21px; letter-spacing: -.025em; }
.section-head p { margin: 4px 0 0; color: var(--muted); font-size: 13px; }

.chips { display: flex; flex-wrap: wrap; gap: 8px; margin-bottom: 20px; }

.chip {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 8px 12px;
    border: 1px solid var(--line);
    border-radius: 999px;
    color: #475569;
    background: #fff;
    font-size: 12px;
    font-weight: 700;
    text-decoration: none;
}

.chip:hover { border-color: #c7d2fe; color: var(--brand); text-decoration: none; }

.chip.is-active {
    color: #fff;
    border-color: transparent;
    background: linear-gradient(135deg, var(--brand), var(--brand-2));
}

.chip span { opacity: .75; font-weight: 600; }

/* Documentos */
.docs-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(270px, 1fr));
    gap: 16px;
}

.doc-card {
    position: relative;
    display: flex;
    flex-direction: column;
    gap: 13px;
    padding: 18px;
    border: 1px solid var(--line);
    border-radius: var(--radius);
    background: #fff;
    box-shadow: 0 1px 0 rgba(255, 255, 255, .9) inset;
    transition: transform .18s ease, box-shadow .18s ease, border-color .18s ease;
}

.doc-card:hover { transform: translateY(-3px); border-color: #c7d2fe; box-shadow: var(--shadow-sm); }
.doc-card__top { display: flex; align-items: flex-start; gap: 12px; }

.doc-icon {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    flex: 0 0 44px;
    width: 44px;
    height: 44px;
    border-radius: 12px;
    color: #fff;
}

.doc-icon svg { width: 22px; height: 22px; }

.doc-icon--pdf { background: linear-gradient(135deg, #e11d48, #9f1239); }
.doc-icon--doc { background: linear-gradient(135deg, #2563eb, #1e40af); }
.doc-icon--xls { background: linear-gradient(135deg, #059669, #047857); }
.doc-icon--ppt { background: linear-gradient(135deg, #ea580c, #c2410c); }
.doc-icon--img { background: linear-gradient(135deg, #7c3aed, #5b21b6); }
.doc-icon--other { background: linear-gradient(135deg, #64748b, #334155); }

.doc-card h3 {
    margin: 0 0 4px;
    font-size: 15px;
    line-height: 1.3;
    letter-spacing: -.01em;
    overflow-wrap: anywhere;
}

.doc-card__meta {
    color: var(--muted);
    font-size: 11px;
    font-weight: 700;
    letter-spacing: .04em;
    text-transform: uppercase;
}

.doc-card p { margin: 0; color: #475569; font-size: 13px; line-height: 1.55; overflow-wrap: anywhere; }

.doc-card__footer {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 10px;
    margin-top: auto;
    padding-top: 4px;
}

.badge {
    display: inline-flex;
    align-items: center;
    padding: 4px 9px;
    border-radius: 999px;
    color: #4338ca;
    background: #eef2ff;
    font-size: 10.5px;
    font-weight: 800;
    letter-spacing: .04em;
    text-transform: uppercase;
}

.bookmark { display: inline-flex; align-items: center; gap: 5px; color: var(--muted); font-size: 11px; font-weight: 600; }

.empty {
    display: grid;
    place-items: center;
    gap: 8px;
    padding: 48px 20px;
    border: 1px dashed #cbd5e1;
    border-radius: var(--radius);
    background: rgba(255, 255, 255, .65);
    text-align: center;
}

.empty svg { width: 42px; height: 42px; color: #94a3b8; }
.empty h3 { margin: 0; font-size: 17px; }
.empty p { max-width: 420px; margin: 0; color: var(--muted); font-size: 13px; }

/* Pie */
.site-footer { border-top: 1px solid var(--line); background: #fff; }

.site-footer__inner {
    width: min(1180px, calc(100% - 32px));
    margin: 0 auto;
    padding: 22px 0;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    color: var(--muted);
    font-size: 12px;
}

.site-footer strong { color: #334155; }

/* ------------------------------ Admin ----------------------------- */

.admin-body {
    min-height: 100vh;
    background:
        radial-gradient(circle at 8% 0%, rgba(79, 70, 229, .08), transparent 28rem),
        var(--bg);
}

.admin-top {
    color: #fff;
    background:
        radial-gradient(circle at 85% 10%, rgba(56, 189, 248, .32), transparent 22rem),
        linear-gradient(135deg, #172554 0%, #1e3a8a 50%, #4338ca 100%);
}

.admin-top__inner {
    width: min(1180px, calc(100% - 32px));
    margin: 0 auto;
    padding: 18px 0;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 18px;
}

.admin-brand { display: flex; align-items: center; gap: 12px; min-width: 0; }
.admin-brand__text { display: grid; gap: 1px; }

.admin-brand__text small {
    color: #bfdbfe;
    font-size: 10px;
    font-weight: 800;
    letter-spacing: .12em;
    text-transform: uppercase;
}

.admin-brand__text strong { font-size: 16px; letter-spacing: -.02em; }

.admin-user { display: flex; align-items: center; gap: 10px; font-size: 12px; }

.admin-user__avatar {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 34px;
    height: 34px;
    border: 1px solid rgba(255, 255, 255, .2);
    border-radius: 50%;
    background: rgba(255, 255, 255, .12);
    font-weight: 800;
}

.admin-shell {
    width: min(1180px, calc(100% - 32px));
    margin: 0 auto;
    padding: 28px 0 54px;
}

.admin-nav { display: flex; flex-wrap: wrap; gap: 6px; margin-bottom: 22px; }

.admin-nav a {
    padding: 8px 12px;
    border-radius: 9px;
    color: #475569;
    font-size: 12.5px;
    font-weight: 700;
    text-decoration: none;
}

.admin-nav a:hover { background: #eef2ff; color: var(--brand); text-decoration: none; }

.stat-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
    gap: 14px;
    margin-bottom: 24px;
}

.stat-card {
    padding: 18px;
    border: 1px solid var(--line);
    border-radius: var(--radius);
    background: #fff;
    box-shadow: var(--shadow-sm);
}

.stat-card span {
    display: block;
    color: var(--muted);
    font-size: 11px;
    font-weight: 800;
    letter-spacing: .08em;
    text-transform: uppercase;
}

.stat-card strong { display: block; margin-top: 6px; font-size: 30px; line-height: 1; letter-spacing: -.04em; }

.panel {
    margin-bottom: 22px;
    padding: 22px;
    border: 1px solid var(--line);
    border-radius: var(--radius);
    background: #fff;
    box-shadow: var(--shadow-sm);
}

.panel-head {
    display: flex;
    flex-wrap: wrap;
    align-items: end;
    justify-content: space-between;
    gap: 10px;
    margin-bottom: 18px;
}

.panel-head h2 { margin: 0; font-size: 18px; letter-spacing: -.025em; }
.panel-head p { margin: 4px 0 0; color: var(--muted); font-size: 12.5px; }

.form-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 14px; }
.form-grid--full { grid-template-columns: 1fr; }

.field { display: grid; gap: 6px; }
.field--full { grid-column: 1 / -1; }
.field label { color: #334155; font-size: 12px; font-weight: 800; }

.field input[type="text"],
.field input[type="password"],
.field input[type="file"],
.field select,
.field textarea {
    width: 100%;
    min-height: 42px;
    padding: 9px 11px;
    border: 1px solid #cbd5e1;
    border-radius: 10px;
    color: var(--ink);
    background: #fff;
    font: inherit;
    font-size: 13px;
}

.field textarea { min-height: 82px; resize: vertical; }

.field input:focus,
.field select:focus,
.field textarea:focus {
    outline: none;
    border-color: #a5b4fc;
    box-shadow: 0 0 0 3px rgba(79, 70, 229, .12);
}

.field small { color: var(--muted); font-size: 11px; }

.form-actions { display: flex; flex-wrap: wrap; align-items: center; gap: 9px; margin-top: 14px; }

.table-wrap { overflow-x: auto; border: 1px solid var(--line); border-radius: 14px; }

.data-table {
    width: 100%;
    min-width: 720px;
    border-collapse: collapse;
    font-size: 12.5px;
}

.data-table th {
    padding: 10px 12px;
    color: #475569;
    background: #f8fafc;
    border-bottom: 1px solid var(--line);
    font-size: 10.5px;
    font-weight: 800;
    letter-spacing: .07em;
    text-align: left;
    text-transform: uppercase;
    white-space: nowrap;
}

.data-table td { padding: 11px 12px; border-bottom: 1px solid #f1f5f9; vertical-align: top; }
.data-table tr:last-child td { border-bottom: 0; }
.data-table tr:hover td { background: #fbfdff; }

.table-title { display: flex; align-items: flex-start; gap: 10px; min-width: 220px; }
.table-title .doc-icon { flex: 0 0 34px; width: 34px; height: 34px; border-radius: 9px; }
.table-title .doc-icon svg { width: 17px; height: 17px; }

.table-title strong { display: block; color: var(--ink); font-size: 12.5px; line-height: 1.35; }
.table-title small { display: block; margin-top: 2px; color: var(--muted); font-size: 10.5px; }

.table-actions { display: flex; align-items: center; gap: 6px; white-space: nowrap; }

.category-list { display: grid; gap: 8px; }

.category-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    padding: 11px 13px;
    border: 1px solid var(--line);
    border-radius: 11px;
    background: var(--surface-soft);
}

.category-row strong { font-size: 13px; }
.category-row span { color: var(--muted); font-size: 11.5px; }

.alert {
    display: flex;
    align-items: flex-start;
    gap: 9px;
    margin-bottom: 16px;
    padding: 11px 13px;
    border: 1px solid transparent;
    border-radius: 11px;
    font-size: 12.5px;
    font-weight: 600;
}

.alert-success { color: var(--success); border-color: #a7f3d0; background: var(--success-soft); }
.alert-danger { color: var(--danger); border-color: #fecdd3; background: var(--danger-soft); }
.alert-info { color: #1d4ed8; border-color: #bfdbfe; background: #eff6ff; }

/* Login */
.login-body {
    min-height: 100vh;
    display: grid;
    place-items: center;
    padding: 20px;
    background:
        radial-gradient(circle at 14% 10%, rgba(79, 70, 229, .14), transparent 28rem),
        radial-gradient(circle at 88% 85%, rgba(14, 165, 233, .12), transparent 26rem),
        var(--bg);
}

.login-card {
    width: min(900px, 100%);
    display: grid;
    grid-template-columns: minmax(0, 1.05fr) minmax(0, .95fr);
    overflow: hidden;
    border: 1px solid var(--line);
    border-radius: 24px;
    background: #fff;
    box-shadow: var(--shadow);
}

.login-aside {
    position: relative;
    display: flex;
    flex-direction: column;
    justify-content: space-between;
    min-height: 440px;
    padding: 34px;
    color: #fff;
    background:
        radial-gradient(circle at 90% 10%, rgba(56, 189, 248, .38), transparent 18rem),
        linear-gradient(135deg, #172554, #1e3a8a 52%, #4338ca);
}

.login-logos {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 100%;
    max-width: 100%;
    padding: 18px;
    border-radius: 12px;
    background: #fff;
}

.login-aside h1 { margin: 26px 0 10px; font-size: 30px; line-height: 1.08; letter-spacing: -.035em; }

.login-aside p { max-width: 360px; margin: 0; color: #dbeafe; font-size: 13px; }

.login-aside__foot {
    display: flex;
    align-items: center;
    gap: 7px;
    color: #bfdbfe;
    font-size: 11px;
    font-weight: 700;
    letter-spacing: .06em;
    text-transform: uppercase;
}

.login-form { display: flex; flex-direction: column; justify-content: center; padding: 34px; }
.login-form h2 { margin: 0 0 5px; font-size: 23px; letter-spacing: -.03em; }
.login-form > p { margin: 0 0 20px; color: var(--muted); font-size: 12.5px; }
.login-form .field { margin-bottom: 13px; }

.login-help {
    margin-top: 16px;
    padding-top: 14px;
    border-top: 1px solid var(--line);
    color: var(--muted);
    font-size: 11px;
    line-height: 1.5;
}

/* Errores */
.error-body { min-height: 100vh; display: grid; place-items: center; padding: 20px; background: var(--bg); }

.error-card {
    width: min(520px, 100%);
    padding: 34px;
    border: 1px solid var(--line);
    border-radius: 20px;
    background: #fff;
    box-shadow: var(--shadow);
}

.error-badge {
    display: inline-flex;
    padding: 4px 9px;
    border-radius: 999px;
    color: var(--danger);
    background: var(--danger-soft);
    font-size: 10.5px;
    font-weight: 800;
    letter-spacing: .06em;
    text-transform: uppercase;
}

.error-card h1 { margin: 14px 0 8px; font-size: 25px; letter-spacing: -.03em; }
.error-card p { color: var(--muted); font-size: 13px; }

/* --------------------------- Responsive --------------------------- */

@media (max-width: 900px) {
    .hero { grid-template-columns: 1fr; padding: 30px 26px; }
    .hero__art { display: none; }
    .search-card { margin: -18px 14px 0; }
    .login-card { grid-template-columns: 1fr; max-width: 460px; }
    .login-aside { min-height: auto; padding: 24px; }
    .login-logos { padding: 12px; }
    .login-aside h1 { font-size: 24px; }
    .login-aside__foot { display: none; }
    .login-form { padding: 26px 24px; }
    .form-grid { grid-template-columns: 1fr; }
}

@media (max-width: 620px) {
    .site-header__inner { min-height: 68px; gap: 10px; }
    .brand__text small { display: none; }
    .brand__text strong { font-size: 14px; }
    .site-nav a { padding: 8px 9px; font-size: 11.5px; }
    .site-nav .nav-admin { display: none; }
    .hero { padding: 26px 20px; border-radius: 20px; }
    .hero h1 { font-size: 28px; }
    .search-form { flex-direction: column; align-items: stretch; }
    .search-form .btn { width: 100%; }
    .docs-grid { grid-template-columns: 1fr; }
    .site-footer__inner { flex-direction: column; align-items: flex-start; }
    .admin-top__inner { flex-direction: column; align-items: flex-start; }
    .admin-user { width: 100%; justify-content: space-between; }
    .panel { padding: 16px; }
    .stat-grid { grid-template-columns: 1fr 1fr; }
}
