:root {
    --bg: #f4f7fb;
    --bg-alt: #eef4ff;
    --panel: rgba(255, 255, 255, 0.88);
    --panel-strong: #ffffff;
    --border: rgba(22, 31, 52, 0.08);
    --text: #172033;
    --muted: #697386;
    --heading: #0f172a;
    --brand: #2563eb;
    --brand-deep: #1d4ed8;
    --accent: #06b6d4;
    --navy: #172554;
    --success: #1f8f5f;
    --danger: #c94a4a;
    --shadow-lg: 0 30px 80px rgba(17, 24, 39, 0.12);
    --shadow-md: 0 18px 45px rgba(17, 24, 39, 0.08);
    --shadow-card: 0 16px 38px rgba(37, 99, 235, 0.10);
    --radius-xl: 24px;
    --radius-lg: 18px;
    --radius-md: 16px;
}

* { box-sizing: border-box; }

body {
    font-family: "Segoe UI", Tahoma, Geneva, Verdana, sans-serif;
    color: var(--text);
    background:
        radial-gradient(circle at top left, rgba(37, 99, 235, 0.18), transparent 22%),
        radial-gradient(circle at top right, rgba(6, 182, 212, 0.16), transparent 18%),
        linear-gradient(180deg, #f8fbff 0%, #f4f7fb 52%, #eef4ff 100%);
    min-height: 100vh;
}

h1, h2, h3, h4, h5, h6, .page-title, .brand-title, .navbar-brand, .auth-card h1 {
    color: var(--heading);
    letter-spacing: -0.03em;
    font-family: "Segoe UI", Tahoma, Geneva, Verdana, sans-serif;
}

p, .text-muted, .page-subtitle { color: var(--muted) !important; }
a { text-decoration: none; }

.btn, .form-control, .form-select, .badge, .nav-link, .sidebar-link, small, label, table, .auth-eyebrow, .section-kicker, .footer-note, .feature-pill {
    font-family: "Segoe UI", Tahoma, Geneva, Verdana, sans-serif;
}

.btn {
    border-radius: 999px;
    padding: .82rem 1.2rem;
    font-weight: 700;
    letter-spacing: .01em;
    border-width: 1px;
}

.btn-dark {
    background: linear-gradient(135deg, var(--brand-deep), var(--navy));
    border-color: transparent;
    box-shadow: 0 14px 28px rgba(37, 99, 235, .20);
}

.btn-dark:hover {
    background: linear-gradient(135deg, #1e40af, #1e3a8a);
    transform: translateY(-1px);
}

.btn-outline-dark {
    border-color: rgba(37, 99, 235, .18);
    color: var(--navy);
    background: rgba(255, 255, 255, .92);
}

.btn-outline-dark:hover {
    background: rgba(20, 32, 51, .06);
    color: var(--navy);
    border-color: rgba(20, 32, 51, .24);
}

.form-control, .form-select {
    min-height: 54px;
    border-radius: 16px;
    border: 1px solid rgba(148, 163, 184, .20);
    background: rgba(255, 255, 255, .96);
    padding: .85rem 1rem;
    box-shadow: 0 4px 14px rgba(15, 23, 42, .04);
}

.form-control:focus, .form-select:focus {
    border-color: rgba(37, 99, 235, .34);
    box-shadow: 0 0 0 .25rem rgba(37, 99, 235, .10);
}

.auth-shell { min-height: 100vh; display: grid; place-items: center; padding: 2rem; }
.auth-card, .panel-card, .catalog-card, .stat-card, .glass-hero, .filter-shell, .form-shell {
    border: 1px solid var(--border);
    box-shadow: var(--shadow-lg);
    border-radius: var(--radius-xl);
    background: var(--panel);
    backdrop-filter: blur(18px);
}

.auth-card {
    width: min(100%, 500px);
    padding: 2.4rem;
    position: relative;
    overflow: hidden;
}

.auth-card::before, .panel-card::before, .glass-hero::before {
    content: "";
    position: absolute;
    inset: 0;
    background: linear-gradient(135deg, rgba(255, 255, 255, .44), transparent 50%);
    pointer-events: none;
}

.auth-card > *, .panel-card > *, .glass-hero > * { position: relative; }

.auth-eyebrow {
    display: inline-flex;
    align-items: center;
    gap: .45rem;
    color: var(--brand);
    font-size: .84rem;
    font-weight: 800;
    text-transform: uppercase;
    letter-spacing: .12em;
    margin-bottom: 1rem;
}

.auth-eyebrow::before {
    content: "";
    width: 10px;
    height: 10px;
    border-radius: 999px;
    background: linear-gradient(135deg, var(--brand), var(--accent));
}

.auth-card h1 {
    font-size: clamp(2.2rem, 5vw, 3.3rem);
    line-height: 1.02;
}

.auth-footer { margin-top: 1.2rem; color: var(--muted); font-size: .95rem; }
.admin-wrapper { display: flex; min-height: 100vh; width: 100%; overflow-x: hidden; }

.sidebar {
    width: 305px;
    padding: 1.6rem;
    background: radial-gradient(circle at top, rgba(6, 182, 212, .14), transparent 24%), linear-gradient(180deg, #0f172a 0%, #13233f 55%, #162a57 100%);
    color: #fff;
    display: flex;
    flex-direction: column;
    justify-content: space-between;
    position: sticky;
    top: 0;
    height: 100vh;
}

.brand-mark { display: inline-flex; align-items: center; gap: .95rem; color: inherit; }

.brand-dot {
    width: 15px;
    height: 15px;
    border-radius: 999px;
    background: linear-gradient(135deg, var(--brand), var(--accent));
    box-shadow: 0 0 0 10px rgba(255, 255, 255, .07);
}

.brand-title { font-size: 1.18rem; }
.sidebar small { color: rgba(255, 255, 255, .58); }

.sidebar-link {
    display: flex;
    align-items: center;
    gap: .8rem;
    color: rgba(255, 255, 255, .76);
    padding: .95rem 1rem;
    border-radius: 18px;
    margin-bottom: .45rem;
    transition: .2s ease;
}

.sidebar-link:hover, .sidebar-link.active {
    color: #fff;
    background: rgba(255, 255, 255, .09);
    transform: translateX(2px);
}

.main-panel { flex: 1; min-width: 0; width: 100%; padding: 2rem; }
.topbar { display: flex; align-items: flex-start; justify-content: space-between; gap: 1rem; margin-bottom: 1.8rem; }
.page-title { font-size: clamp(2.2rem, 4vw, 3.2rem); font-weight: 700; line-height: 1; margin-bottom: .45rem; }
.member-nav { background: rgba(252, 250, 246, .7); backdrop-filter: blur(16px); border-bottom: 1px solid rgba(20, 32, 51, .08); }
.member-nav { background: rgba(255, 255, 255, .84); }
.navbar-toggler { color: var(--navy); }
.navbar .nav-link { color: var(--muted); font-weight: 700; }
.navbar .nav-link.active, .navbar .nav-link:hover { color: var(--navy); }
.hero-shell { padding: 4rem 0 2rem; }
.glass-hero { position: relative; overflow: hidden; padding: 2.2rem; }
.hero-grid { display: grid; grid-template-columns: 1.4fr .9fr; gap: 1.5rem; align-items: stretch; }

.hero-metric {
    background: rgba(255, 255, 255, .72);
    border: 1px solid rgba(20, 32, 51, .08);
    border-radius: 20px;
    padding: 1rem 1.1rem;
}

.hero-metric span { display: block; font-size: .85rem; color: var(--muted); margin-bottom: .25rem; }
.hero-metric strong { font-family: Georgia, "Times New Roman", serif; font-size: 1.5rem; color: var(--heading); }
.section-kicker { text-transform: uppercase; letter-spacing: .12em; font-size: .76rem; font-weight: 800; color: var(--brand); }

.stat-card {
    padding: 1.5rem;
    background: radial-gradient(circle at top right, rgba(216, 178, 95, .18), transparent 36%), linear-gradient(180deg, rgba(255, 255, 255, .92), rgba(255, 255, 255, .76));
}

.stat-card span { display: block; color: var(--muted); font-size: .88rem; margin-bottom: .65rem; }
.stat-card h3 { font-size: clamp(2rem, 5vw, 2.8rem); margin: 0; }
.panel-card { position: relative; padding: 1.45rem; }
.saas-toolbar {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 1rem;
    margin-bottom: 1rem;
}
.filter-shell {
    position: relative;
    padding: 1.15rem;
    border-radius: 22px;
    background: linear-gradient(180deg, rgba(255,255,255,.95), rgba(248,250,255,.9));
}
.filter-shell .form-control,
.filter-shell .form-select {
    min-height: 50px;
}
.filter-input {
    position: relative;
}
.filter-input i {
    position: absolute;
    left: 1rem;
    top: 50%;
    transform: translateY(-50%);
    color: var(--muted);
    z-index: 2;
}
.filter-input .form-control {
    padding-left: 2.7rem;
}
.catalog-card {
    border-radius: 24px;
    background: linear-gradient(180deg, rgba(255,255,255,.98), rgba(247,250,255,.94));
    box-shadow: var(--shadow-card);
}
.catalog-card:hover {
    transform: translateY(-8px);
    box-shadow: 0 22px 52px rgba(37, 99, 235, .16);
}
.catalog-card .catalog-thumb {
    border-radius: 24px 24px 0 0;
}
.catalog-card .catalog-body {
    padding: 1.25rem 1.25rem 1.35rem;
}
.catalog-meta {
    display: flex;
    flex-wrap: wrap;
    gap: .55rem;
    margin-bottom: .95rem;
}
.catalog-title {
    font-size: 1.14rem;
    font-weight: 700;
    margin-bottom: .5rem;
}
.catalog-desc {
    font-size: .94rem;
    line-height: 1.6;
    min-height: 3rem;
}
.catalog-actions {
    display: flex;
    flex-wrap: wrap;
    gap: .7rem;
    margin-top: 1rem;
}
.table-shell {
    border-radius: 22px;
    overflow: hidden;
    background: linear-gradient(180deg, rgba(255,255,255,.98), rgba(248,250,255,.92));
    border: 1px solid rgba(148, 163, 184, .16);
}
.table thead th {
    background: rgba(241, 245, 249, .9);
    color: #64748b;
    font-size: .78rem;
    border-bottom: 1px solid rgba(148, 163, 184, .12);
}
.table tbody tr {
    transition: background .2s ease, transform .2s ease;
}
.table tbody tr:hover {
    background: rgba(37, 99, 235, .03);
}
.table-entity {
    display: flex;
    align-items: center;
    gap: .9rem;
}
.entity-copy {
    min-width: 0;
}
.entity-copy .entity-title {
    font-weight: 700;
    color: var(--heading);
}
.entity-copy .entity-subtitle {
    font-size: .86rem;
    color: var(--muted);
    margin-top: .18rem;
}
.soft-badge {
    background: #eff6ff;
    color: #1d4ed8;
    border: 1px solid rgba(37, 99, 235, .12);
}
.condition-badge {
    background: #f8fafc;
    color: #0f172a;
    border: 1px solid rgba(148, 163, 184, .18);
}
.status-badge-active {
    background: #ecfdf3;
    color: #047857;
    border: 1px solid rgba(16, 185, 129, .16);
}
.status-badge-inactive {
    background: #f8fafc;
    color: #475569;
    border: 1px solid rgba(148, 163, 184, .18);
}
.action-bar {
    display: flex;
    flex-wrap: wrap;
    gap: .55rem;
    justify-content: flex-end;
}
.action-bar .btn,
.catalog-actions .btn {
    min-width: 104px;
}
.form-shell {
    position: relative;
    padding: 1.4rem;
    border-radius: 24px;
    background: linear-gradient(180deg, rgba(255,255,255,.98), rgba(246,249,255,.94));
}
.form-section-title {
    font-size: 1rem;
    font-weight: 700;
    color: var(--heading);
    margin-bottom: .25rem;
}
.form-section-copy {
    color: var(--muted);
    font-size: .9rem;
    margin-bottom: 1rem;
}
.upload-dropzone {
    border: 1.5px dashed rgba(37, 99, 235, .22);
    border-radius: 20px;
    padding: 1rem;
    background: linear-gradient(180deg, #f8fbff, #f1f6ff);
}
.preview-image {
    border: 1px solid rgba(148, 163, 184, .12);
    box-shadow: var(--shadow-md);
}
.table-responsive { border-radius: 18px; }
.table { margin-bottom: 0; }
.table thead th { border-bottom-width: 1px; color: var(--muted); font-size: .82rem; text-transform: uppercase; letter-spacing: .08em; font-weight: 800; }
.table > :not(caption) > * > * { padding: 1rem .75rem; background: transparent; border-color: rgba(20, 32, 51, .06); }
.table-thumb { width: 84px; height: 64px; object-fit: cover; border-radius: 16px; border: 1px solid rgba(20, 32, 51, .08); }
.assignment-stack, .assignment-item { display: grid; gap: .3rem; }
.assignment-item { padding: 1rem 0; border-bottom: 1px solid rgba(20, 32, 51, .08); }
.assignment-item:last-child { border-bottom: 0; padding-bottom: 0; }

.catalog-thumb, .preview-image, .detail-image { width: 100%; display: block; object-fit: cover; }
.catalog-thumb { height: 230px; }
.compact-card .catalog-thumb { height: 185px; }
.preview-image { height: 190px; border-radius: 20px; }
.detail-image { height: 420px; border-radius: 22px; }
.catalog-body { padding: 1.4rem; }
.catalog-card h5, .panel-card h5 { font-size: 1.15rem; }
.badge { border-radius: 999px; padding: .55rem .85rem; font-size: .74rem; font-weight: 800; letter-spacing: .04em; }
.surface-grid { display: grid; gap: 1.5rem; }

.feature-pill {
    display: inline-flex;
    align-items: center;
    gap: .55rem;
    padding: .7rem .95rem;
    border-radius: 999px;
    background: rgba(255, 255, 255, .75);
    border: 1px solid rgba(20, 32, 51, .08);
    font-size: .92rem;
    color: var(--heading);
}

.feature-pill i { color: var(--brand); }

.showcase-panel {
    min-height: 100%;
    background: linear-gradient(180deg, rgba(20, 32, 51, .96), rgba(25, 38, 58, .94)), linear-gradient(135deg, rgba(186, 74, 47, .18), transparent 45%);
    color: #fff;
}

.showcase-panel h3, .showcase-panel p, .showcase-panel .hero-metric strong { color: #fff !important; }

.showcase-panel .hero-metric {
    background: rgba(255, 255, 255, .08);
    border-color: rgba(255, 255, 255, .1);
}

.showcase-panel .hero-metric span { color: rgba(255, 255, 255, .72); }
.empty-state { padding: 2.5rem 1.5rem; text-align: center; color: var(--muted); }
.footer-note { font-size: .88rem; color: var(--muted); }

@media (max-width: 991.98px) {
    .sidebar { display: none; }
    .main-panel { padding: 1.2rem; }
    .hero-grid { grid-template-columns: 1fr; }
    .detail-image { height: 300px; }
    .catalog-thumb { height: 210px; }
    .auth-card { padding: 1.6rem; }
    .topbar { margin-bottom: 1.2rem; }
    .page-title { font-size: clamp(1.85rem, 8vw, 2.6rem); }
    .panel-card, .glass-hero, .filter-shell, .form-shell { padding: 1.15rem; }
    .member-nav .container { padding-top: .35rem; padding-bottom: .35rem; }
    .navbar-collapse {
        background: rgba(255, 255, 255, .82);
        border: 1px solid rgba(20, 32, 51, .08);
        border-radius: 20px;
        padding: .85rem;
        margin-top: .75rem;
        box-shadow: var(--shadow-md);
    }
    .navbar-nav .nav-link { padding: .85rem .5rem; }
    .action-stack .btn { width: 100%; }
    .catalog-actions .btn,
    .action-bar .btn {
        width: 100%;
    }
    .table-responsive { overflow-x: auto; }
    .hero-shell { padding-top: 1.5rem; }
    .topbar { flex-wrap: wrap; }
    .saas-toolbar {
        flex-direction: column;
        align-items: stretch;
    }
}

@media (max-width: 767.98px) {
    .main-panel, main.container { padding-left: .95rem !important; padding-right: .95rem !important; }
    .panel-card, .glass-hero, .auth-card, .stat-card { border-radius: 22px; }
    .catalog-thumb { height: 190px; }
    .detail-image { height: 250px; }
    .hero-metric strong { font-size: 1.2rem; }
    .btn { padding: .78rem 1rem; }
    .topbar .btn { width: 100%; }
    .d-flex.justify-content-between.align-items-center.mb-3,
    .d-flex.justify-content-between.align-items-end.mb-4 {
        flex-direction: column;
        align-items: stretch !important;
        gap: .85rem;
    }
    .d-flex.justify-content-between.align-items-center.mb-3 > .btn,
    .d-flex.justify-content-between.align-items-center.mb-3 > div,
    .d-flex.justify-content-between.align-items-end.mb-4 > div {
        width: 100%;
    }
    .d-flex.justify-content-between.align-items-center.mb-3 .btn,
    .d-flex.justify-content-between.align-items-end.mb-4 .btn {
        width: 100%;
    }
    .glass-hero .row,
    .panel-card .row {
        --bs-gutter-x: .8rem;
    }
    .hero-metric {
        padding: .9rem;
        border-radius: 18px;
    }
    .table-responsive.admin-stack {
        overflow: visible;
    }
    .admin-stack table,
    .admin-stack thead,
    .admin-stack tbody,
    .admin-stack tr,
    .admin-stack th,
    .admin-stack td {
        display: block;
        width: 100%;
    }
    .admin-stack thead {
        display: none;
    }
    .admin-stack tbody {
        display: grid;
        gap: 1rem;
    }
    .admin-stack tr {
        border: 1px solid rgba(20, 32, 51, .08);
        border-radius: 18px;
        background: rgba(255, 255, 255, .62);
        padding: .55rem .85rem;
        box-shadow: 0 10px 24px rgba(16, 24, 40, .06);
    }
    .admin-stack td {
        border: 0 !important;
        padding: .45rem 0 !important;
        text-align: left !important;
    }
    .admin-stack td::before {
        content: attr(data-label);
        display: block;
        margin-bottom: .2rem;
        font-family: "Segoe UI", Tahoma, Geneva, Verdana, sans-serif;
        font-size: .72rem;
        font-weight: 800;
        letter-spacing: .08em;
        text-transform: uppercase;
        color: var(--muted);
    }
    .admin-stack .table-thumb {
        width: 100%;
        height: 170px;
        margin-bottom: .6rem;
    }
    .admin-stack .action-stack-admin .btn,
    .admin-stack .action-stack-admin form,
    .admin-stack .action-stack-admin form .btn {
        width: 100%;
    }
    .admin-stack .action-stack-admin {
        display: grid !important;
        gap: .55rem;
        justify-content: stretch !important;
    }
    .public-nav-actions .btn {
        width: 100%;
    }
}

@media (max-width: 767.98px) {
    .member-nav .container {
        padding-left: 1rem;
        padding-right: 1rem;
    }
}
