:root {
    --bg: #0c1b23;
    --bg-2: #132a32;
    --panel: rgba(7, 15, 28, 0.92);
    --panel-2: rgba(12, 25, 36, 0.94);
    --line: rgba(168, 195, 199, 0.16);
    --line-strong: rgba(168, 195, 199, 0.28);
    --text: #f4f7f8;
    --muted: #afc1c7;
    --navy: #214b58;
    --cyan: #91c5ca;
    --mint: #a6ceca;
    --gold: #c7ab68;
    --shadow: 0 30px 80px rgba(1, 8, 18, 0.42);
}

* { box-sizing: border-box; }
html, body { margin: 0; min-height: 100%; }
body {
    font-family: "Segoe UI Variable Text", "Segoe UI", "Trebuchet MS", sans-serif;
    background:
        radial-gradient(circle at top left, rgba(109, 177, 183, 0.10), transparent 30%),
        radial-gradient(circle at right 20%, rgba(112, 163, 158, 0.10), transparent 24%),
        linear-gradient(180deg, #10232b 0%, #0c1b23 36%, #0c1b23 100%);
    color: var(--text);
}

a { color: inherit; text-decoration: none; }
button, input, select, textarea { font: inherit; }
img { display: block; max-width: 100%; }
.site-shell { min-height: 100vh; position: relative; z-index: 2; }
.site-shell * { min-width: 0; }
.page-particles {
    position: fixed;
    inset: 0;
    width: 100%;
    height: 100%;
    z-index: 0;
    pointer-events: none;
    opacity: .48;
}

.glass {
    background: linear-gradient(180deg, var(--panel-2), var(--panel));
    border: 1px solid var(--line);
    box-shadow: var(--shadow);
    backdrop-filter: blur(18px);
}

.flash {
    position: fixed;
    top: 20px;
    right: 20px;
    z-index: 60;
    padding: 14px 18px;
    border-radius: 16px;
    border: 1px solid rgba(255,255,255,.12);
}
.flash-success { background: rgba(20, 95, 73, 0.94); }
.flash-danger { background: rgba(122, 31, 50, 0.94); }
.flash-warning { background: rgba(120, 86, 18, 0.94); }

.hero {
    position: relative;
    min-height: 410px;
    background:
        linear-gradient(90deg, rgba(10, 27, 35, 0.96) 0%, rgba(17, 40, 48, 0.86) 38%, rgba(17, 40, 48, 0.44) 100%),
        url('https://images.unsplash.com/photo-1519452575417-564c1401ecc0?auto=format&fit=crop&w=1600&q=80') center/cover;
    overflow: hidden;
}
.hero-compact { min-height: 280px; }
.hero::before {
    content: "";
    position: absolute;
    inset: 0;
    background:
        radial-gradient(circle at 14% 18%, rgba(109, 177, 183, 0.18), transparent 18%),
        linear-gradient(180deg, transparent 0%, rgba(4, 10, 18, 0.22) 70%, rgba(4, 10, 18, 0.58) 100%);
}
.hero::after {
    content: "";
    position: absolute;
    left: 0;
    right: 0;
    bottom: 0;
    height: 8px;
    background: linear-gradient(90deg, var(--cyan), var(--mint), var(--gold));
}
.hero-overlay {
    position: absolute;
    inset: 0;
    background:
        repeating-linear-gradient(90deg, rgba(255,255,255,.035), rgba(255,255,255,.035) 1px, transparent 1px, transparent 72px);
}
.hero-particles {
    position: absolute;
    inset: 0;
    width: 100%;
    height: 100%;
    z-index: 1;
    pointer-events: none;
    opacity: .75;
}
.hero-inner {
    position: relative;
    z-index: 2;
    max-width: 1320px;
    margin: 0 auto;
    padding: 34px 32px 62px;
    min-height: 410px;
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    gap: 24px;
}
.hero-brand {
    display: flex;
    align-items: flex-end;
    gap: 22px;
    margin-top: auto;
}
.brand-logo {
    width: 112px;
    height: 136px;
    object-fit: contain;
    filter: drop-shadow(0 16px 28px rgba(7, 17, 26, 0.38));
}
.hero-copy {
    max-width: 720px;
}
.brand-overline,
.eyebrow,
.auth-heading span,
.admin-brand span {
    color: var(--mint);
    font-size: 12px;
    letter-spacing: .22em;
    text-transform: uppercase;
}
.hero h1,
.search-panel h2,
.intro-block h3,
.collections-block h3,
.areas-block h3,
.recent-block h3,
.side-card h4,
.detail-main h1,
.detail-main h2,
.auth-card h1,
.admin-header h1 {
    margin: 0;
    font-family: "Bahnschrift", "Segoe UI", sans-serif;
    letter-spacing: -.025em;
}
.hero h1 {
    margin-top: 10px;
    font-size: clamp(2.2rem, 4vw, 3.8rem);
}
.hero-copy p {
    margin: 14px 0 0;
    max-width: 640px;
    color: #d1dfe2;
    font-size: 1.02rem;
    line-height: 1.7;
}
.hero-nav {
    display: flex;
    flex-wrap: wrap;
    justify-content: flex-end;
    gap: 10px;
}
.hero-nav a {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-height: 44px;
    padding: 0 18px;
    border-radius: 999px;
    background: rgba(7, 17, 26, 0.42);
    border: 1px solid rgba(255,255,255,.16);
    color: #f0f6ff;
}

.content-wrap {
    position: relative;
    z-index: 3;
    max-width: 1320px;
    margin: -44px auto 0;
    padding: 0 32px 42px;
}
.page-grid,
.detail-layout {
    display: grid;
    grid-template-columns: minmax(0, 1.7fr) 340px;
    gap: 24px;
    align-items: start;
}
.main-column,
.sidebar,
.areas-block,
.recent-block,
.admin-content,
.table-list,
.auth-form,
.admin-form {
    display: grid;
    gap: 18px;
}

.search-panel,
.side-card,
.detail-main,
.auth-card,
.admin-sidebar,
.panel-card,
.metric-card,
.recent-card,
.collection-card {
    border-radius: 24px;
}
.search-panel {
    padding: 30px;
}
.section-heading {
    display: flex;
    justify-content: space-between;
    gap: 16px;
    align-items: flex-end;
}
.search-panel h2,
.intro-block h3,
.collections-block h3,
.areas-block h3,
.recent-block h3,
.side-card h4,
.detail-main h1,
.detail-main h2 {
    margin-bottom: 14px;
}
.search-bar {
    display: grid;
    grid-template-columns: 1fr 180px;
    gap: 0;
    overflow: hidden;
    border-radius: 18px;
    border: 1px solid rgba(255,255,255,.14);
    background: rgba(255,255,255,.95);
}
.search-bar input,
.search-bar button {
    border: 0;
    padding: 17px 18px;
}
.search-bar input {
    background: transparent;
    color: #244650;
}
.search-bar button,
.button-primary {
    background: linear-gradient(90deg, #285c65, #214b5c);
    color: #ffffff;
    font-weight: 800;
}
.button-secondary {
    background: rgba(255,255,255,.06);
    border: 1px solid rgba(255,255,255,.12);
    color: #eff6ff;
}
.button-danger {
    background: rgba(255, 91, 91, .14);
    border: 1px solid rgba(255, 91, 91, .36);
    color: #ffd7d7;
    cursor: pointer;
}
.button-primary,
.button-secondary,
.button-danger {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-height: 46px;
    padding: 0 18px;
    border-radius: 14px;
    font-weight: 800;
}

.search-meta,
.intro-block p,
.collection-card p,
.recent-card p,
.side-list,
.detail-summary,
.detail-meta,
.detail-authors,
.collection-lead,
.areas-list span {
    color: var(--muted);
    line-height: 1.7;
}

.collection-grid {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 18px;
}
.collection-card {
    position: relative;
    overflow: hidden;
    padding: 28px;
}
.collection-card::before {
    content: "";
    position: absolute;
    right: -50px;
    bottom: -50px;
    width: 180px;
    height: 180px;
    border-radius: 50%;
    background: color-mix(in srgb, var(--accent) 26%, transparent);
    filter: blur(20px);
}
.collection-link {
    display: block;
    transition: transform .18s ease, border-color .18s ease;
}
.collection-link:hover {
    transform: translateY(-3px);
    border-color: color-mix(in srgb, var(--accent) 60%, rgba(255,255,255,.2));
}
.collection-icon {
    width: 62px;
    height: 62px;
    border-radius: 18px;
    display: grid;
    place-items: center;
    margin-bottom: 18px;
    background: color-mix(in srgb, var(--accent) 24%, rgba(255,255,255,.08));
    color: var(--accent);
    font-size: 1.45rem;
    font-weight: 800;
}
.collection-card h4 {
    margin: 0 0 14px;
    font-size: 1.55rem;
    font-family: "Bahnschrift", "Segoe UI", sans-serif;
}
.collection-cta {
    display: inline-flex;
    margin-top: 12px;
    color: #e4eef0;
    font-weight: 700;
}


.areas-block {
    padding: 26px;
}
.areas-list {
    display: grid;
    gap: 14px;
    padding: 0;
    margin: 0;
    list-style: none;
}
.areas-list li {
    position: relative;
    padding-left: 28px;
}
.areas-list li::before {
    content: ">";
    position: absolute;
    left: 0;
    top: 0;
    color: #91c5ca;
    font-weight: 900;
}
.areas-list strong,
.areas-list span {
    display: block;
}
.areas-list strong {
    margin-bottom: 4px;
    color: #eff6ff;
}
.recent-card {
    display: flex;
    overflow: hidden;
}
.recent-bar {
    width: 4px;
    background: var(--accent);
}
.recent-body {
    padding: 22px;
}
.recent-title {
    display: block;
    margin-bottom: 8px;
    font-size: 1.08rem;
    font-weight: 800;
}
.recent-meta {
    margin-bottom: 10px;
    color: #b8cbcf;
    font-size: .95rem;
}

.side-card {
    padding: 22px;
}
.link-icons {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 10px;
}
.link-icons span,
.status-pill {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-height: 44px;
    border-radius: 14px;
    background: rgba(255,255,255,.06);
    border: 1px solid rgba(255,255,255,.10);
    color: #e0eaed;
}
.status-pill {
    min-width: 88px;
    padding: 10px 14px;
    text-transform: lowercase;
}
.side-list,
.metrics {
    list-style: none;
    padding: 0;
    margin: 0;
}
.side-list li + li,
.metrics li + li {
    margin-top: 10px;
}
.side-list a {
    color: #dce6e8;
}
.metrics li {
    display: flex;
    justify-content: space-between;
    gap: 12px;
    padding: 12px 0;
    border-bottom: 1px solid rgba(255,255,255,.08);
}
.metrics strong {
    color: var(--mint);
    font-size: 1.22rem;
}
.featured-title {
    display: block;
    margin-bottom: 10px;
    font-weight: 800;
}
.pager {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
    margin-top: 6px;
}
.pager-link {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-width: 44px;
    min-height: 44px;
    padding: 0 14px;
    border-radius: 12px;
    background: rgba(255,255,255,.05);
    border: 1px solid rgba(255,255,255,.10);
    color: #edf3f4;
}
.pager-link.active {
    background: linear-gradient(90deg, #285c65, #214b5c);
    color: #ffffff;
    border-color: transparent;
    font-weight: 800;
}

.public-footer {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 16px;
    padding: 32px;
    background: rgba(4, 12, 22, 0.82);
    border-top: 1px solid rgba(255,255,255,.08);
}
.footer-badges {
    display: flex;
    gap: 10px;
    flex-wrap: wrap;
}
.footer-badges span {
    padding: 10px 14px;
    border-radius: 999px;
    background: rgba(255,255,255,.05);
    border: 1px solid rgba(255,255,255,.08);
}

.detail-page { padding-top: 36px; }
.detail-main { padding: 30px; }
.detail-topline {
    width: 100%;
    height: 4px;
    border-radius: 999px;
    background: linear-gradient(90deg, var(--cyan), var(--mint));
    margin-bottom: 20px;
}
.file-card { margin-top: 36px; }
.file-preview {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 18px;
    padding: 22px;
    border-radius: 18px;
}
.file-icon {
    width: 64px;
    height: 64px;
    border-radius: 18px;
    display: grid;
    place-items: center;
    background: rgba(255,255,255,.08);
    color: #ff7171;
    font-weight: 800;
}

.auth-page {
    min-height: 100vh;
    display: grid;
    place-items: center;
    padding: 32px;
}
.auth-card {
    width: min(560px, 100%);
    padding: 34px;
}
.auth-heading {
    display: flex;
    gap: 18px;
    align-items: center;
}
.brand-logo-auth {
    width: 94px;
    height: 114px;
    flex: 0 0 auto;
}
.auth-card p,
.auth-help,
.back-link {
    color: var(--muted);
    line-height: 1.7;
}
.auth-form label,
.admin-form label {
    display: grid;
    gap: 8px;
    color: #dce6e8;
}
.auth-form input,
.admin-form input,
.admin-form select,
.admin-form textarea {
    width: 100%;
    max-width: 100%;
    padding: 14px 16px;
    border-radius: 14px;
    border: 1px solid rgba(255,255,255,.14);
    background: rgba(255,255,255,.06);
    color: var(--text);
}
.admin-form textarea {
    resize: vertical;
}

.admin-page {
    min-height: 100vh;
    display: grid;
    grid-template-columns: 300px minmax(0, 1fr);
    gap: 24px;
    padding: 24px;
}
.admin-sidebar {
    position: sticky;
    top: 24px;
    height: calc(100vh - 48px);
    padding: 24px;
}
.admin-brand {
    display: flex;
    gap: 16px;
    align-items: center;
    margin-bottom: 28px;
}
.brand-logo-admin {
    width: 78px;
    height: 94px;
    flex: 0 0 auto;
}
.admin-brand strong {
    display: block;
    font-size: 1.08rem;
}
.admin-nav {
    display: grid;
    gap: 10px;
}
.admin-nav a {
    padding: 15px 16px;
    border-radius: 14px;
    background: rgba(255,255,255,.04);
    color: #d4e2e5;
    border: 1px solid transparent;
    transition: background .18s ease, border-color .18s ease, color .18s ease;
}
.admin-nav a.active {
    background: rgba(45, 103, 112, 0.28);
    border: 1px solid rgba(109, 177, 183, 0.34);
    color: #f4fbff;
}
.admin-nav a:hover {
    background: rgba(255,255,255,.08);
    border-color: rgba(109, 177, 183, 0.18);
}
.admin-header {
    display: flex;
    justify-content: space-between;
    align-items: flex-end;
    gap: 16px;
}
.header-actions {
    display: flex;
    gap: 12px;
    flex-wrap: wrap;
}
.metric-grid {
    display: grid;
    grid-template-columns: repeat(4, minmax(0, 1fr));
    gap: 18px;
}
.metric-card {
    padding: 24px;
}
.metric-card strong {
    display: block;
    margin-bottom: 8px;
    color: var(--mint);
    font-family: "Bahnschrift", "Segoe UI", sans-serif;
    font-size: 2rem;
}
.admin-split {
    display: grid;
    grid-template-columns: 1.08fr .92fr;
    gap: 22px;
}
.admin-split-wide {
    grid-template-columns: 1.04fr .96fr;
}
.panel-card {
    padding: 24px;
}
.panel-heading {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 12px;
    margin-bottom: 16px;
}
.table-row {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 16px;
    padding: 16px;
    border-radius: 16px;
    background: rgba(255,255,255,.04);
    border: 1px solid rgba(255,255,255,.08);
}
.table-content {
    flex: 1 1 auto;
}
.table-row strong,
.table-row span,
.table-row small,
.recent-title,
.recent-meta,
.featured-title,
.side-list li,
.collection-card h4,
.collection-card p,
.hero-copy p,
.table-row a,
.status-pill,
p, h1, h2, h3, h4, strong, span, small, li, a {
    overflow-wrap: anywhere;
}
.table-row span,
.table-row small {
    display: block;
    color: var(--muted);
    margin-top: 4px;
}
.table-row > a,
.row-actions {
    flex: 0 0 auto;
}
.row-actions {
    display: flex;
    align-items: center;
    gap: 10px;
    flex-wrap: wrap;
    justify-content: flex-end;
}
.row-actions form {
    margin: 0;
}
.row-actions a,
.row-actions button {
    white-space: nowrap;
}
.row-actions .button-danger {
    min-height: 38px;
    padding: 0 12px;
    border-radius: 12px;
    font-weight: 800;
}
.form-columns,
.permission-grid {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 16px;
}
.check-card {
    display: flex;
    gap: 10px;
    align-items: flex-start;
    padding: 14px;
    border-radius: 14px;
    background: rgba(255,255,255,.04);
    border: 1px solid rgba(255,255,255,.08);
}
.narrow-panel {
    max-width: 760px;
}
.empty-state {
    max-width: 760px;
    margin: 80px auto;
    padding: 30px;
    text-align: center;
}
.empty-inline {
    padding: 22px;
    border-radius: 18px;
}

select {
    appearance: none;
    background-image:
        linear-gradient(45deg, transparent 50%, #afc1c7 50%),
        linear-gradient(135deg, #afc1c7 50%, transparent 50%);
    background-position:
        calc(100% - 22px) calc(50% - 3px),
        calc(100% - 16px) calc(50% - 3px);
    background-size: 6px 6px, 6px 6px;
    background-repeat: no-repeat;
    padding-right: 40px;
}

@media (max-width: 1120px) {
    .page-grid,
    .detail-layout,
    .admin-page,
    .admin-split,
    .admin-split-wide,
    .metric-grid {
        grid-template-columns: 1fr;
    }

    .admin-sidebar {
        position: static;
        height: auto;
    }
}

@media (max-width: 760px) {
    .hero-inner,
    .content-wrap,
    .auth-page,
    .admin-page,
    .public-footer {
        padding-left: 18px;
        padding-right: 18px;
    }

    .hero-inner {
        min-height: 360px;
        flex-direction: column;
        justify-content: space-between;
    }

    .hero-brand,
    .auth-heading,
    .file-preview,
    .public-footer,
    .admin-header,
    .table-row.stack-mobile {
        flex-direction: column;
        align-items: stretch;
    }

    .hero-nav {
        justify-content: flex-start;
    }

    .page-grid,
    .collection-grid,
    .detail-layout,
    .form-columns,
    .permission-grid,
    .search-bar {
        grid-template-columns: 1fr;
    }
}


/* Native dropdowns need an opaque background to retain readable text. */
.admin-form select { background-color: #142d35; color: #f1f5fb; color-scheme: dark; }
.admin-form select option { background: #142d35; color: #f1f5fb; }
.catalog-controls { display: flex; flex-wrap: wrap; gap: 12px; align-items: center; }
.catalog-editor { margin-top: 14px; }
.catalog-editor summary { cursor: pointer; color: #a6ceca; padding: 10px 0; }
.catalog-editor form { margin-top: 12px; }
.areas-list .area-entry { padding: 16px 16px 16px 28px; border-bottom: 1px solid var(--line); }
.areas-list .area-entry::before { top: 16px; }
.admin-form input[type="color"] { min-height: 52px; padding: 6px; }
button { cursor: pointer; }
:focus-visible { outline: 2px solid #a6ceca; outline-offset: 3px; }
.admin-content { align-content: start; }
.panel-heading { flex-wrap: wrap; }
.panel-heading > a { flex-shrink: 0; }
.status-pill { flex-shrink: 0; white-space: nowrap; }
.catalog-controls { margin-top: 12px; }
.admin-form .check-card { display: flex; align-items: center; }
.admin-form .check-card input { width: 18px; height: 18px; flex: 0 0 18px; margin: 0; }

/* Identidad institucional Javier Pulgar Vidal. */
.hero::after { height: 5px; background: linear-gradient(90deg, #285c65, #91c5ca 65%, var(--gold)); }
.page-particles { opacity: .18; }
.hero-particles { opacity: .3; }
.hero-overlay { opacity: .4; }
.collection-card, .recent-card { --accent: var(--cyan) !important; }
.collection-card:nth-child(even) { --accent: var(--gold) !important; }
.brand-logo { height: auto; aspect-ratio: 371 / 405; }
.brand-logo-auth, .brand-logo-admin { height: auto; }
.auth-card { background: #080f1c; border-color: rgba(168, 195, 199, .24); }
.auth-form input { background: #f4f7f8; color: #244650; border-color: #dce6e8; }
.auth-form input::placeholder { color: #536c75; }
.search-bar input::placeholder { color: #536c75; opacity: 1; }
.search-bar button, .button-primary { border: 1px solid transparent; transition: filter .18s ease, box-shadow .18s ease; }
.search-bar button:hover, .button-primary:hover { filter: brightness(1.14); box-shadow: 0 6px 20px rgba(40, 92, 101, .22); }
.auth-form input:focus, .admin-form input:focus, .admin-form textarea:focus, .admin-form select:focus { border-color: var(--cyan); }
::selection { background: #285c65; color: #fff; }
@media (prefers-reduced-motion: reduce) {
    .page-particles, .hero-particles { display: none; }
    *, *::before, *::after { transition: none !important; }
}
