/* admin/assets/admin.css */
:root {
    --navy: #06144a;
    --navy-2: #0b2672;
    --cyan: #10c7df;
    --cyan-soft: rgba(16, 199, 223, .12);
    --ink: #132033;
    --muted: #667085;
    --line: rgba(12, 40, 88, .12);
    --bg: #f5fbff;
    --white: #ffffff;
    --danger: #dc2626;
    --success: #16a34a;
    --warning: #f59e0b;
    --radius: 26px;
    --shadow: 0 22px 60px rgba(6, 20, 74, .12);
    --shadow-soft: 0 14px 34px rgba(6, 20, 74, .08);
}

* {
    box-sizing: border-box;
}

html {
    scroll-behavior: smooth;
}

body {
    margin: 0;
    min-height: 100vh;
    font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
    color: var(--ink);
    background:
        radial-gradient(circle at 8% 0%, rgba(16, 199, 223, .16), transparent 32%),
        radial-gradient(circle at 100% 12%, rgba(6, 20, 74, .12), transparent 30%),
        linear-gradient(180deg, #ffffff 0%, var(--bg) 42%, #ffffff 100%);
}

a {
    color: inherit;
    text-decoration: none;
}

button,
input,
textarea,
select {
    font: inherit;
}

button {
    cursor: pointer;
}

img {
    display: block;
    max-width: 100%;
}

/* HEADER */
.admin-header {
    position: sticky;
    top: 0;
    z-index: 50;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 28px;
    padding: 16px 28px;
    background: rgba(255, 255, 255, .88);
    border-bottom: 1px solid rgba(12, 40, 88, .08);
    backdrop-filter: blur(18px);
}

.admin-brand {
    display: flex;
    align-items: center;
    gap: 14px;
    min-width: 0;
}

.admin-logo-wrap {
    display: grid;
    place-items: center;
    width: 122px;
    min-width: 122px;
    height: 58px;
    padding: 8px;
    border-radius: 18px;
    background: white;
    box-shadow: var(--shadow-soft);
}

.admin-logo-wrap img {
    width: 100%;
    height: auto;
}

.admin-brand strong {
    display: block;
    color: var(--navy);
    font-size: 16px;
    line-height: 1.1;
}

.admin-brand span {
    display: block;
    margin-top: 4px;
    color: var(--muted);
    font-size: 13px;
    font-weight: 700;
}

/* NAVBAR ADMIN CON JERARQUÍA VISUAL */
.admin-nav {
    display: flex;
    align-items: center;
    justify-content: flex-end;
    gap: 14px;
    margin-left: auto;
    flex-wrap: wrap;
}

.nav-group {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 6px;
    border-radius: 999px;
}

.nav-group-main {
    background: rgba(6, 20, 74, .07);
    border: 1px solid rgba(6, 20, 74, .10);
}

.nav-group-public {
    background: rgba(16, 199, 223, .08);
    border: 1px solid rgba(16, 199, 223, .16);
}

.nav-label {
    padding: 0 8px 0 10px;
    font-size: 10px;
    font-weight: 900;
    letter-spacing: .08em;
    text-transform: uppercase;
    color: #7a7f8c;
    white-space: nowrap;
}

.nav-item {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 7px;
    min-height: 38px;
    padding: 0 14px;
    border-radius: 999px;
    font-size: 13px;
    font-weight: 850;
    line-height: 1;
    color: var(--navy);
    text-decoration: none;
    background: transparent;
    border: 1px solid transparent;
    transition: background .18s ease, color .18s ease, border-color .18s ease, transform .18s ease, box-shadow .18s ease;
}

.nav-item:hover {
    background: #ffffff;
    border-color: rgba(12, 40, 88, .14);
    color: var(--navy);
    transform: translateY(-1px);
    box-shadow: 0 10px 24px rgba(15, 23, 42, 0.08);
}

.nav-item.is-active {
    background: linear-gradient(135deg, var(--navy), var(--cyan));
    color: #ffffff;
    border-color: transparent;
    box-shadow: 0 12px 26px rgba(6, 20, 74, .24);
}

.nav-public {
    color: #475467;
}

.nav-public:hover {
    color: var(--navy);
}

.nav-icon {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 18px;
    height: 18px;
    font-size: 13px;
    line-height: 1;
    opacity: .9;
}

.nav-divider {
    width: 1px;
    height: 34px;
    background: rgba(17, 24, 39, 0.12);
}

.admin-nav .logout-link {
    background: rgba(220, 38, 38, 0.08);
    color: #991b1b !important;
    border-color: rgba(220, 38, 38, 0.14);
    font-weight: 900;
}

.admin-nav .logout-link:hover {
    background: #991b1b;
    color: #ffffff !important;
    border-color: #991b1b;
}

/* LAYOUT */
.admin-shell {
    width: min(1240px, calc(100% - 36px));
    margin: 0 auto;
    padding: 34px 0 56px;
}

.admin-hero {
    display: flex;
    align-items: flex-end;
    justify-content: space-between;
    gap: 24px;
    margin-bottom: 22px;
    padding: 32px;
    border-radius: 34px;
    color: white;
    background:
        radial-gradient(circle at 90% 0%, rgba(16, 199, 223, .35), transparent 38%),
        linear-gradient(135deg, var(--navy), #0a2d88);
    box-shadow: var(--shadow);
}

.admin-eyebrow,
.card-title span,
.panel-title span {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    color: var(--cyan);
    font-size: 11px;
    font-weight: 950;
    letter-spacing: .10em;
    text-transform: uppercase;
}

.admin-hero h1 {
    margin: 12px 0 10px;
    font-size: clamp(30px, 4vw, 48px);
    line-height: 1;
    letter-spacing: -.045em;
}

.admin-hero p {
    max-width: 720px;
    margin: 0;
    color: rgba(255, 255, 255, .78);
    line-height: 1.65;
}

.hero-action {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-height: 48px;
    padding: 0 18px;
    border-radius: 999px;
    color: var(--navy);
    background: white;
    font-size: 14px;
    font-weight: 950;
    white-space: nowrap;
    box-shadow: 0 14px 36px rgba(0, 0, 0, .16);
}

.stats-grid {
    display: grid;
    grid-template-columns: repeat(4, minmax(0, 1fr));
    gap: 14px;
    margin-bottom: 22px;
}

.stat-card {
    padding: 22px;
    border-radius: 24px;
    background: rgba(255, 255, 255, .86);
    border: 1px solid rgba(12, 40, 88, .10);
    box-shadow: var(--shadow-soft);
}

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

.stat-card strong {
    display: block;
    margin: 8px 0 4px;
    color: var(--navy);
    font-size: 34px;
    line-height: 1;
}

.stat-card small {
    color: var(--muted);
    font-weight: 700;
}

.alert {
    display: flex;
    align-items: flex-start;
    gap: 8px;
    margin-bottom: 18px;
    padding: 16px 18px;
    border-radius: 20px;
    border: 1px solid transparent;
    font-weight: 700;
}

.alert strong {
    font-weight: 950;
}

.alert-success {
    color: #14532d;
    background: #ecfdf3;
    border-color: rgba(22, 163, 74, .16);
}

.alert-error {
    color: #7f1d1d;
    background: #fef2f2;
    border-color: rgba(220, 38, 38, .16);
}

.admin-grid {
    display: grid;
    grid-template-columns: minmax(0, 1.25fr) minmax(360px, .75fr);
    gap: 22px;
    align-items: start;
}

.case-form {
    display: grid;
    gap: 18px;
}

.form-card,
.cases-panel {
    padding: 26px;
    border-radius: 30px;
    background: rgba(255, 255, 255, .90);
    border: 1px solid rgba(12, 40, 88, .10);
    box-shadow: var(--shadow-soft);
}

.card-title,
.panel-title {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 16px;
    margin-bottom: 20px;
}

.card-title h2,
.panel-title h2 {
    margin: 7px 0 0;
    color: var(--navy);
    font-size: 24px;
    letter-spacing: -.03em;
}

.panel-title b,
.edit-pill {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-width: 34px;
    min-height: 30px;
    padding: 0 10px;
    border-radius: 999px;
    color: var(--navy);
    background: var(--cyan-soft);
    font-size: 12px;
    font-weight: 950;
}

/* FORMULARIO */
.field {
    display: grid;
    gap: 8px;
    margin-bottom: 16px;
}

.field span,
.upload-title {
    color: var(--navy);
    font-size: 13px;
    font-weight: 950;
}

.field input,
.field textarea,
.field select {
    width: 100%;
    border: 1px solid rgba(12, 40, 88, .13);
    outline: none;
    border-radius: 18px;
    background: #fbfdff;
    color: var(--ink);
    font-size: 15px;
    font-weight: 650;
    transition: border .2s ease, box-shadow .2s ease, background .2s ease;
}

.field input,
.field select {
    min-height: 50px;
    padding: 0 15px;
}

.field textarea {
    resize: vertical;
    min-height: 125px;
    padding: 14px 15px;
    line-height: 1.6;
}

.field input:focus,
.field textarea:focus,
.field select:focus {
    border-color: rgba(16, 199, 223, .58);
    background: white;
    box-shadow: 0 0 0 5px rgba(16, 199, 223, .10);
}

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

.check-label {
    display: flex;
    align-items: center;
    gap: 12px;
    min-height: 50px;
    padding: 13px 15px;
    margin-bottom: 16px;
    border-radius: 18px;
    background: #fbfdff;
    border: 1px solid rgba(12, 40, 88, .13);
    cursor: pointer;
}

.check-label input {
    width: 18px;
    height: 18px;
    accent-color: var(--cyan);
}

.check-label span {
    display: grid;
    gap: 2px;
}

.check-label strong {
    color: var(--navy);
    font-size: 13px;
}

.check-label small {
    color: var(--muted);
    font-size: 12px;
    font-weight: 700;
}

.muted {
    margin: -6px 0 20px;
    color: var(--muted);
    line-height: 1.65;
    font-size: 14px;
}

/* SUBIDA Y PREVISUALIZACIÓN DE IMÁGENES */
.upload-grid {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 18px;
}

.upload-card {
    display: grid;
    gap: 10px;
    padding: 16px;
    border-radius: 26px;
    background: #fbfdff;
    border: 1px dashed rgba(12, 40, 88, .22);
    cursor: pointer;
    transition: border .2s ease, background .2s ease, transform .2s ease;
}

.upload-card:hover {
    transform: translateY(-2px);
    border-color: rgba(16, 199, 223, .55);
    background: #ffffff;
}

.upload-title {
    color: var(--navy);
    font-size: 13px;
    font-weight: 950;
}

.upload-card > small {
    color: var(--muted);
    font-size: 12px;
    font-weight: 700;
}

.preview-box {
    position: relative;
    width: 100%;
    aspect-ratio: 1 / 1;
    overflow: hidden;
    border-radius: 22px;
    background:
        radial-gradient(circle at 20% 10%, rgba(16, 199, 223, .16), transparent 36%),
        linear-gradient(135deg, #eefaff, #f8fcff);
    border: 1px solid rgba(12, 40, 88, .10);
}

.preview-box img {
    position: absolute;
    inset: 0;
    z-index: 2;
    width: 100%;
    height: 100%;
    object-fit: cover;
    border: 0;
}

.preview-box img[hidden],
.preview-box.is-empty img {
    display: none !important;
}

.preview-box.has-image .upload-placeholder {
    opacity: 0;
    visibility: hidden;
}

.upload-placeholder {
    position: absolute;
    inset: 0;
    z-index: 1;
    display: grid;
    place-items: center;
    align-content: center;
    gap: 8px;
    padding: 22px;
    text-align: center;
    color: var(--navy);
    transition: opacity .2s ease, visibility .2s ease;
}

.upload-placeholder span {
    display: grid;
    place-items: center;
    width: 54px;
    height: 54px;
    margin: 0 auto 4px;
    border-radius: 999px;
    color: white;
    background: linear-gradient(135deg, var(--navy), var(--cyan));
    font-size: 30px;
    font-weight: 700;
    line-height: 1;
    box-shadow: 0 14px 30px rgba(6, 20, 74, .16);
}

.upload-placeholder strong {
    display: block;
    font-size: 14px;
    font-weight: 950;
}

.upload-placeholder small {
    display: block;
    color: var(--muted);
    font-size: 12px;
    font-weight: 700;
}

.upload-card input[type="file"] {
    width: 100%;
    padding: 11px;
    border-radius: 16px;
    background: white;
    border: 1px solid rgba(12, 40, 88, .10);
    color: var(--muted);
    font-size: 12px;
}

/* BOTONES FORMULARIO */
.form-actions {
    display: flex;
    align-items: center;
    gap: 12px;
    flex-wrap: wrap;
    margin-top: 22px;
}

.form-actions button,
.form-actions a {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-height: 50px;
    padding: 0 18px;
    border-radius: 999px;
    font-size: 14px;
    font-weight: 950;
}

.form-actions button {
    border: 0;
    color: white;
    background: linear-gradient(135deg, var(--navy), var(--cyan));
    box-shadow: 0 14px 30px rgba(6, 20, 74, .16);
}

.form-actions a {
    color: var(--navy);
    background: #f4fbff;
    border: 1px solid rgba(12, 40, 88, .10);
}

/* PANEL CASOS */
.cases-panel {
    position: sticky;
    top: 100px;
}

.empty-state {
    padding: 24px;
    border-radius: 24px;
    background: #f6fbff;
    border: 1px solid rgba(12, 40, 88, .08);
    text-align: center;
}

.empty-state strong {
    display: block;
    color: var(--navy);
    margin-bottom: 6px;
}

.empty-state p {
    margin: 0;
    color: var(--muted);
    line-height: 1.6;
}

.admin-case-list {
    display: grid;
    gap: 12px;
    max-height: 760px;
    overflow: auto;
    padding-right: 4px;
}

.admin-case-list article {
    display: grid;
    grid-template-columns: 86px minmax(0, 1fr);
    gap: 13px;
    padding: 12px;
    border-radius: 22px;
    background: #fbfdff;
    border: 1px solid rgba(12, 40, 88, .08);
    transition: border .2s ease, transform .2s ease, background .2s ease;
}

.admin-case-list article:hover {
    transform: translateY(-1px);
    border-color: rgba(16, 199, 223, .26);
    background: white;
}

.admin-case-list article.is-current {
    border-color: rgba(16, 199, 223, .56);
    box-shadow: 0 0 0 4px rgba(16, 199, 223, .08);
}

.case-thumb {
    width: 86px;
    height: 86px;
    overflow: hidden;
    border-radius: 18px;
    background: #eaf6fb;
}

.case-thumb img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.case-info {
    min-width: 0;
}

.case-line {
    display: flex;
    align-items: center;
    gap: 6px;
    flex-wrap: wrap;
    margin-bottom: 7px;
}

.status-pill,
.featured-pill {
    display: inline-flex;
    align-items: center;
    min-height: 24px;
    padding: 0 9px;
    border-radius: 999px;
    font-size: 10px;
    font-weight: 950;
    letter-spacing: .06em;
    text-transform: uppercase;
}

.status-published {
    color: #166534;
    background: #dcfce7;
}

.status-draft {
    color: #92400e;
    background: #fef3c7;
}

.featured-pill {
    color: white;
    background: linear-gradient(135deg, var(--navy), var(--cyan));
}

.case-info strong {
    display: block;
    color: var(--navy);
    font-size: 14px;
    line-height: 1.25;
    margin-bottom: 4px;
    overflow-wrap: anywhere;
}

.case-info small {
    display: block;
    color: var(--muted);
    font-size: 12px;
    font-weight: 700;
    margin-bottom: 10px;
}

.item-actions {
    display: flex;
    align-items: center;
    gap: 8px;
    flex-wrap: wrap;
}

.item-actions a,
.item-actions button {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-height: 32px;
    padding: 0 11px;
    border-radius: 999px;
    font-size: 12px;
    font-weight: 950;
}

.item-actions a {
    color: var(--navy);
    background: rgba(16, 199, 223, .12);
}

.item-actions form {
    margin: 0;
}

.item-actions button {
    border: 0;
    color: var(--danger);
    background: #fef2f2;
}

/* RESPONSIVE */
@media (max-width: 1080px) {
    .admin-grid {
        grid-template-columns: 1fr;
    }

    .cases-panel {
        position: static;
    }

    .admin-case-list {
        max-height: none;
    }
}

@media (max-width: 900px) {
    .admin-header {
        align-items: flex-start;
        flex-direction: column;
    }

    .admin-nav {
        width: 100%;
        margin-left: 0;
        justify-content: flex-start;
    }

    .nav-group {
        border-radius: 18px;
        flex-wrap: wrap;
    }

    .nav-label {
        width: 100%;
        padding: 4px 8px 2px;
    }

    .nav-divider {
        display: none;
    }
}

@media (max-width: 780px) {
    .admin-header {
        padding: 14px;
    }

    .admin-shell {
        width: min(100% - 24px, 760px);
        padding-top: 22px;
    }

    .admin-hero {
        align-items: flex-start;
        flex-direction: column;
        padding: 24px;
        border-radius: 28px;
    }

    .stats-grid {
        grid-template-columns: repeat(2, minmax(0, 1fr));
    }

    .form-row,
    .upload-grid {
        grid-template-columns: 1fr;
    }

    .form-card,
    .cases-panel {
        padding: 20px;
        border-radius: 26px;
    }
}

@media (max-width: 520px) {
    .admin-brand {
        width: 100%;
    }

    .admin-logo-wrap {
        width: 108px;
        min-width: 108px;
        height: 52px;
    }

    .admin-nav {
        gap: 10px;
    }

    .nav-group {
        width: 100%;
    }

    .nav-item {
        flex: 1;
        padding: 0 10px;
    }

    .admin-nav .logout-link {
        width: 100%;
    }

    .stats-grid {
        grid-template-columns: 1fr;
    }

    .admin-case-list article {
        grid-template-columns: 76px minmax(0, 1fr);
    }

    .case-thumb {
        width: 76px;
        height: 76px;
    }

    .form-actions {
        display: grid;
        grid-template-columns: 1fr;
    }

    .form-actions button,
    .form-actions a {
        width: 100%;
    }
}

/* LOGIN ADMIN */
.admin-login-page {
    min-height: 100vh;
    margin: 0;
    display: grid;
    place-items: center;
    padding: 28px;
    background:
        radial-gradient(circle at 12% 10%, rgba(16, 199, 223, .22), transparent 34%),
        radial-gradient(circle at 92% 4%, rgba(6, 20, 74, .16), transparent 30%),
        linear-gradient(135deg, #eefbff 0%, #ffffff 48%, #eef7fb 100%);
}

.login-layout {
    width: min(100%, 440px);
}

.login-card {
    position: relative;
    overflow: hidden;
    width: 100%;
    padding: 34px;
    border-radius: 34px;
    background: rgba(255, 255, 255, .92);
    border: 1px solid rgba(12, 40, 88, .10);
    box-shadow: 0 28px 80px rgba(6, 20, 74, .16);
    backdrop-filter: blur(18px);
}

.login-card::before {
    content: "";
    position: absolute;
    inset: 0 0 auto 0;
    height: 7px;
    background: linear-gradient(90deg, var(--navy), var(--cyan));
}

.login-logo {
    display: flex;
    justify-content: center;
    margin-bottom: 22px;
}

.login-logo img {
    width: 150px;
    height: auto;
    object-fit: contain;
}

.login-heading {
    text-align: center;
    margin-bottom: 26px;
}

.login-heading span {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-height: 28px;
    padding: 0 12px;
    margin-bottom: 12px;
    border-radius: 999px;
    color: var(--navy);
    background: rgba(16, 199, 223, .12);
    font-size: 11px;
    font-weight: 950;
    letter-spacing: .09em;
    text-transform: uppercase;
}

.login-heading h1 {
    margin: 0;
    color: var(--navy);
    font-size: 30px;
    line-height: 1.05;
    letter-spacing: -.045em;
}

.login-heading p {
    margin: 12px auto 0;
    max-width: 330px;
    color: var(--muted);
    font-size: 14px;
    line-height: 1.6;
    font-weight: 650;
}

.login-form {
    display: grid;
    gap: 15px;
}

.login-field {
    display: grid;
    gap: 8px;
}

.login-field span {
    color: var(--navy);
    font-size: 13px;
    font-weight: 950;
}

.login-field input {
    width: 100%;
    min-height: 52px;
    padding: 0 15px;
    border-radius: 18px;
    border: 1px solid rgba(12, 40, 88, .14);
    outline: none;
    color: var(--ink);
    background: #fbfdff;
    font-size: 15px;
    font-weight: 700;
    transition: border .2s ease, box-shadow .2s ease, background .2s ease;
}

.login-field input:focus {
    border-color: rgba(16, 199, 223, .62);
    background: #ffffff;
    box-shadow: 0 0 0 5px rgba(16, 199, 223, .12);
}

.login-form button {
    width: 100%;
    min-height: 54px;
    margin-top: 6px;
    border: 0;
    border-radius: 999px;
    color: #ffffff;
    background: linear-gradient(135deg, var(--navy), var(--cyan));
    font-size: 15px;
    font-weight: 950;
    box-shadow: 0 16px 34px rgba(6, 20, 74, .22);
    transition: transform .2s ease, box-shadow .2s ease;
}

.login-form button:hover {
    transform: translateY(-1px);
    box-shadow: 0 20px 40px rgba(6, 20, 74, .26);
}

.login-footer {
    margin-top: 22px;
    padding-top: 18px;
    text-align: center;
    border-top: 1px solid rgba(12, 40, 88, .10);
}

.login-footer a {
    color: var(--navy);
    font-size: 13px;
    font-weight: 900;
}

.login-footer a:hover {
    color: var(--cyan);
}

.admin-login-page .alert {
    margin-bottom: 18px;
}

@media (max-width: 520px) {
    .admin-login-page {
        padding: 18px;
        align-items: start;
    }

    .login-card {
        padding: 28px 22px;
        border-radius: 28px;
    }

    .login-logo img {
        width: 130px;
    }

    .login-heading h1 {
        font-size: 26px;
    }
}

.service-thumb-icon {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 86px;
    height: 86px;
    border-radius: 18px;
    background:
        radial-gradient(circle at 20% 10%, rgba(16, 199, 223, .20), transparent 40%),
        linear-gradient(135deg, #eefaff, #f8fcff);
    border: 1px solid rgba(12, 40, 88, .10);
    color: var(--navy);
    font-size: 34px;
    font-weight: 900;
}

@media (max-width: 520px) {
    .service-thumb-icon {
        width: 76px;
        height: 76px;
        font-size: 30px;
    }
}

/* =========================================================
   PANEL ADMIN REAL: SIDEBAR + TOPBAR + FOOTER
   PEGAR AL FINAL DE admin/assets/admin.css
========================================================= */

body:not(.admin-login-page) {
    display: grid;
    grid-template-columns: 290px minmax(0, 1fr);
    min-height: 100vh;
    background: #f4f7fb;
    overflow-x: hidden;
}

/* SIDEBAR */
.admin-sidebar {
    position: sticky;
    top: 0;
    z-index: 100;
    height: 100vh;
    display: flex;
    flex-direction: column;
    padding: 22px 18px;
    background:
        radial-gradient(circle at 20% 0%, rgba(16, 199, 223, .18), transparent 34%),
        linear-gradient(180deg, #06144a 0%, #071b5e 55%, #041033 100%);
    color: #ffffff;
    box-shadow: 18px 0 45px rgba(6, 20, 74, .18);
}

.sidebar-brand {
    display: flex;
    align-items: center;
    gap: 14px;
    padding: 10px 8px 22px;
    border-bottom: 1px solid rgba(255, 255, 255, .12);
}

.sidebar-logo {
    width: 74px;
    min-width: 74px;
    height: 52px;
    display: grid;
    place-items: center;
    padding: 7px;
    border-radius: 16px;
    background: #ffffff;
    box-shadow: 0 12px 30px rgba(0, 0, 0, .18);
}

.sidebar-logo img {
    width: 100%;
    height: 100%;
    object-fit: contain;
}

.sidebar-brand strong {
    display: block;
    font-size: 16px;
    line-height: 1.1;
    font-weight: 950;
    color: #ffffff;
}

.sidebar-brand span {
    display: block;
    margin-top: 4px;
    font-size: 12px;
    font-weight: 800;
    color: rgba(255, 255, 255, .66);
}

.sidebar-nav {
    flex: 1;
    display: flex;
    flex-direction: column;
    gap: 8px;
    padding-top: 22px;
}

.sidebar-label {
    display: block;
    margin: 10px 10px 8px;
    font-size: 10px;
    font-weight: 950;
    letter-spacing: .11em;
    text-transform: uppercase;
    color: rgba(255, 255, 255, .46);
}

.sidebar-label-secondary {
    margin-top: 24px;
}

.sidebar-link {
    display: flex;
    align-items: center;
    gap: 12px;
    min-height: 48px;
    padding: 0 14px;
    border-radius: 16px;
    color: rgba(255, 255, 255, .78);
    font-size: 14px;
    font-weight: 850;
    border: 1px solid transparent;
    transition: .18s ease;
}

.sidebar-link:hover {
    color: #ffffff;
    background: rgba(255, 255, 255, .10);
    border-color: rgba(255, 255, 255, .12);
    transform: translateX(2px);
}

.sidebar-link.is-active {
    color: #06144a;
    background: linear-gradient(135deg, #ffffff, #dff9ff);
    box-shadow: 0 14px 28px rgba(0, 0, 0, .18);
}

.sidebar-icon {
    width: 30px;
    height: 30px;
    display: grid;
    place-items: center;
    border-radius: 12px;
    background: rgba(255, 255, 255, .12);
    font-size: 15px;
}

.sidebar-link.is-active .sidebar-icon {
    color: #ffffff;
    background: linear-gradient(135deg, var(--navy), var(--cyan));
}

.sidebar-footer {
    padding-top: 18px;
    border-top: 1px solid rgba(255, 255, 255, .12);
}

.sidebar-logout {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 10px;
    min-height: 46px;
    border-radius: 16px;
    background: rgba(220, 38, 38, .14);
    color: #fecaca;
    font-size: 14px;
    font-weight: 950;
    border: 1px solid rgba(248, 113, 113, .20);
}

.sidebar-logout:hover {
    background: #dc2626;
    color: #ffffff;
}

/* MAIN CONTENT */
.admin-shell {
    width: 100% !important;
    max-width: none !important;
    margin: 0 !important;
    padding: 24px 30px 0 !important;
    min-width: 0;
}

/* TOPBAR */
.admin-topbar {
    position: sticky;
    top: 0;
    z-index: 60;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 18px;
    min-height: 72px;
    margin: -24px -30px 26px;
    padding: 0 30px;
    background: rgba(255, 255, 255, .88);
    border-bottom: 1px solid rgba(12, 40, 88, .10);
    backdrop-filter: blur(18px);
}

.admin-topbar span {
    display: block;
    margin-bottom: 3px;
    color: var(--muted);
    font-size: 11px;
    font-weight: 950;
    letter-spacing: .10em;
    text-transform: uppercase;
}

.admin-topbar strong {
    display: block;
    color: var(--navy);
    font-size: 22px;
    line-height: 1;
    letter-spacing: -.035em;
}

.topbar-actions {
    display: flex;
    align-items: center;
    gap: 10px;
}

.topbar-actions a {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-height: 40px;
    padding: 0 14px;
    border-radius: 999px;
    color: var(--navy);
    background: #ffffff;
    border: 1px solid rgba(12, 40, 88, .12);
    font-size: 13px;
    font-weight: 950;
    box-shadow: 0 8px 22px rgba(6, 20, 74, .06);
}

.topbar-actions a:last-child {
    color: #991b1b;
    background: #fff1f2;
    border-color: rgba(220, 38, 38, .14);
}

/* HERO MÁS ADMIN */
.admin-hero {
    margin-bottom: 22px !important;
    border-radius: 28px !important;
    padding: 28px !important;
}

/* TARJETAS KPI */
.stats-grid {
    grid-template-columns: repeat(4, minmax(0, 1fr)) !important;
}

/* CONTENIDO */
.admin-grid {
    grid-template-columns: minmax(0, 1fr) 390px !important;
    align-items: start;
}

.form-card,
.cases-panel {
    border-radius: 24px !important;
}

.cases-panel {
    position: sticky;
    top: 96px;
}

/* FOOTER */
.admin-footer {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 18px;
    margin: 34px -30px 0;
    padding: 20px 30px;
    color: #667085;
    background: #ffffff;
    border-top: 1px solid rgba(12, 40, 88, .10);
    font-size: 13px;
    font-weight: 800;
}

/* OCULTA CLASES DEL HEADER ANTIGUO SI QUEDARON EN OTRAS VISTAS */
.admin-header {
    display: none;
}

/* RESPONSIVE */
@media (max-width: 1180px) {
    body:not(.admin-login-page) {
        grid-template-columns: 250px minmax(0, 1fr);
    }

    .admin-sidebar {
        padding: 18px 14px;
    }

    .admin-grid {
        grid-template-columns: 1fr !important;
    }

    .cases-panel {
        position: static;
    }
}

@media (max-width: 900px) {
    body:not(.admin-login-page) {
        display: block;
    }

    .admin-sidebar {
        position: relative;
        height: auto;
        border-radius: 0 0 26px 26px;
    }

    .sidebar-nav {
        display: grid;
        grid-template-columns: repeat(2, minmax(0, 1fr));
    }

    .sidebar-label {
        grid-column: 1 / -1;
    }

    .sidebar-footer {
        margin-top: 18px;
    }

    .admin-shell {
        padding: 20px 18px 0 !important;
    }

    .admin-topbar {
        margin: -20px -18px 22px;
        padding: 14px 18px;
        min-height: auto;
        flex-direction: column;
        align-items: flex-start;
    }

    .stats-grid {
        grid-template-columns: repeat(2, minmax(0, 1fr)) !important;
    }

    .admin-footer {
        margin-left: -18px;
        margin-right: -18px;
        padding: 18px;
        flex-direction: column;
        align-items: flex-start;
    }
}

@media (max-width: 560px) {
    .sidebar-brand {
        align-items: flex-start;
    }

    .sidebar-nav {
        grid-template-columns: 1fr;
    }

    .stats-grid {
        grid-template-columns: 1fr !important;
    }

    .topbar-actions {
        width: 100%;
        display: grid;
        grid-template-columns: 1fr 1fr;
    }

    .topbar-actions a {
        width: 100%;
    }
}

/* =========================================================
   MODAL ADMIN GLOBAL
   Usado por blog.php y futuras pantallas del admin
========================================================= */

body.modal-lock {
    overflow: hidden;
}

.admin-modal {
    position: fixed;
    inset: 0;
    z-index: 9999;
    display: none;
    align-items: center;
    justify-content: center;
    padding: 24px;
}

.admin-modal.is-open {
    display: flex;
}

.modal-backdrop {
    position: absolute;
    inset: 0;
    background: rgba(2, 8, 23, .62);
    backdrop-filter: blur(8px);
}

.modal-card {
    position: relative;
    z-index: 2;
    width: min(1120px, 100%);
    max-height: 92vh;
    overflow: hidden;
    border-radius: 28px;
    background: #ffffff;
    border: 1px solid rgba(15, 23, 42, .12);
    box-shadow: 0 32px 90px rgba(2, 8, 23, .30);
    transform: translateY(18px) scale(.98);
    opacity: 0;
    transition: transform .22s ease, opacity .22s ease;
}

.admin-modal.is-open .modal-card {
    transform: translateY(0) scale(1);
    opacity: 1;
}

.modal-head {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 18px;
    padding: 22px 26px;
    background:
        radial-gradient(circle at 0% 0%, rgba(16, 199, 223, .16), transparent 34%),
        linear-gradient(135deg, #ffffff 0%, #f8fbff 100%);
    border-bottom: 1px solid rgba(12, 40, 88, .10);
}

.modal-head h2 {
    margin: 0;
    color: var(--navy);
    font-size: 24px;
    line-height: 1.15;
}

.modal-head span {
    display: block;
    margin-bottom: 6px;
    color: #7a0f22;
    font-size: 12px;
    font-weight: 900;
    letter-spacing: .08em;
    text-transform: uppercase;
}

.modal-close {
    display: grid;
    place-items: center;
    width: 44px;
    height: 44px;
    border: 0;
    border-radius: 16px;
    color: var(--navy);
    background: rgba(6, 20, 74, .08);
    font-size: 28px;
    line-height: 1;
    transition: transform .18s ease, background .18s ease;
}

.modal-close:hover {
    transform: scale(1.05);
    background: rgba(220, 38, 38, .12);
    color: var(--danger);
}

.modal-body {
    max-height: calc(92vh - 89px);
    overflow-y: auto;
    padding: 24px;
    background: #f8fbff;
}

.modal-body .form-card {
    margin: 0;
}

.modal-body .form-actions {
    position: sticky;
    bottom: -24px;
    margin: 24px -24px -24px;
    padding: 18px 24px;
    background: rgba(255, 255, 255, .92);
    border-top: 1px solid rgba(12, 40, 88, .10);
    backdrop-filter: blur(14px);
}

@media (max-width: 760px) {
    .admin-modal {
        padding: 12px;
    }

    .modal-card {
        border-radius: 22px;
        max-height: 94vh;
    }

    .modal-head {
        padding: 18px;
    }

    .modal-head h2 {
        font-size: 20px;
    }

    .modal-body {
        padding: 18px;
        max-height: calc(94vh - 82px);
    }

    .modal-body .form-actions {
        margin: 20px -18px -18px;
        padding: 16px 18px;
    }
}