:root {
    --bg: #1a1121;
    --bg-soft: #24182e;
    --bg-elevated: #2b1c37;
    --text: #f2edf7;
    --muted: #b59cc8;
    --border: #3a274c;
    --primary: #9019e6;
    --primary-strong: #7a14c2;
    --gold: #d4af37;
    --success: #33c16c;
    --danger: #ef4f69;
    --warning: #ffb74d;
}

* {
    box-sizing: border-box;
}

html,
body {
    margin: 0;
    padding: 0;
    min-height: 100%;
}

body {
    font-family: "Manrope", sans-serif;
    color: var(--text);
    background:
        radial-gradient(900px 500px at 80% -10%, rgba(144, 25, 230, 0.24), transparent 70%),
        radial-gradient(700px 420px at -10% 20%, rgba(212, 175, 55, 0.1), transparent 75%),
        var(--bg);
}

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

.container {
    width: min(1200px, 100% - 2rem);
    margin-inline: auto;
}

.hidden {
    display: none !important;
}

/* Admin shell */
.app-shell {
    display: grid;
    grid-template-columns: 280px 1fr;
    min-height: 100vh;
}

.sidebar {
    position: sticky;
    top: 0;
    height: 100vh;
    border-right: 1px solid var(--border);
    background: linear-gradient(175deg, #1f1328, #140d1a);
    padding: 1.2rem;
    overflow-y: auto;
}

.main-area {
    min-width: 0;
    display: flex;
    flex-direction: column;
}

.topbar {
    position: sticky;
    top: 0;
    z-index: 30;
    border-bottom: 1px solid var(--border);
    background: rgba(24, 15, 30, 0.9);
    backdrop-filter: blur(8px);
    padding: 0.9rem 1.2rem;
}

.mobile-toggle {
    display: none;
    border: 1px solid var(--border);
    color: var(--text);
    background: transparent;
    border-radius: 10px;
    padding: 0.4rem 0.6rem;
}

.page-content {
    padding: 1.4rem;
}

.brand {
    display: flex;
    align-items: center;
    gap: 0.7rem;
    margin-bottom: 1rem;
}

.brand-icon {
    width: 40px;
    height: 40px;
    border-radius: 12px;
    overflow: hidden;
    display: grid;
    place-items: center;
    background: linear-gradient(150deg, var(--primary), #5a0e95);
    border: 1px solid rgba(212, 175, 55, 0.35);
    box-shadow: 0 0 18px rgba(144, 25, 230, 0.4);
}

.brand-icon img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    display: block;
}

.brand-title {
    margin: 0;
    font-weight: 800;
}

.brand-subtitle {
    margin: 0;
    color: var(--muted);
    font-size: 0.75rem;
}

.nav-group {
    margin-top: 1rem;
}

.nav-label {
    color: var(--muted);
    font-size: 0.72rem;
    text-transform: uppercase;
    letter-spacing: 0.13em;
    margin: 0 0 0.5rem;
}

.nav-item {
    display: flex;
    align-items: center;
    gap: 0.65rem;
    border: 1px solid transparent;
    border-radius: 12px;
    color: #d6c9e2;
    padding: 0.65rem 0.8rem;
    font-size: 0.92rem;
    transition: all 0.18s ease;
}

.nav-item:hover {
    color: #fff;
    background: rgba(144, 25, 230, 0.12);
    border-color: rgba(144, 25, 230, 0.35);
}

.nav-item.active {
    color: #fff;
    background: rgba(144, 25, 230, 0.2);
    border-color: rgba(144, 25, 230, 0.5);
}

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

/* Shared components */
.card {
    background: linear-gradient(170deg, rgba(44, 30, 56, 0.95), rgba(24, 15, 30, 0.95));
    border: 1px solid var(--border);
    border-radius: 18px;
    padding: 1rem;
    box-shadow: 0 10px 25px rgba(5, 3, 8, 0.4);
}

.card h1,
.card h2,
.card h3,
.card h4 {
    margin-top: 0;
}

.grid {
    display: grid;
    gap: 1rem;
}

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

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

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

.stat-value {
    font-size: 1.7rem;
    font-weight: 800;
}

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

.badge {
    display: inline-flex;
    align-items: center;
    gap: 0.3rem;
    border-radius: 999px;
    border: 1px solid rgba(212, 175, 55, 0.35);
    color: var(--gold);
    font-size: 0.72rem;
    padding: 0.2rem 0.6rem;
}

.badge.ok {
    color: var(--success);
    border-color: rgba(51, 193, 108, 0.35);
}

.badge.warn {
    color: var(--warning);
    border-color: rgba(255, 183, 77, 0.4);
}

.badge.danger {
    color: var(--danger);
    border-color: rgba(239, 79, 105, 0.4);
}

.btn {
    border: 0;
    border-radius: 12px;
    padding: 0.68rem 1rem;
    font-weight: 700;
    cursor: pointer;
    transition: all 0.18s ease;
    font-family: inherit;
    display: inline-flex;
    align-items: center;
    justify-content: center;
}

.btn:disabled {
    opacity: 0.45;
    cursor: not-allowed;
}

.btn-primary {
    background: linear-gradient(150deg, var(--primary), #7413b7);
    color: #fff;
    box-shadow: 0 8px 22px rgba(144, 25, 230, 0.35);
}

.btn-primary:hover {
    transform: translateY(-1px);
    filter: brightness(1.05);
}

.btn-secondary {
    background: transparent;
    color: var(--text);
    border: 1px solid var(--border);
}

.btn-secondary:hover {
    border-color: rgba(212, 175, 55, 0.45);
    color: var(--gold);
}

.btn-danger {
    background: rgba(239, 79, 105, 0.15);
    color: var(--danger);
    border: 1px solid rgba(239, 79, 105, 0.35);
}

.button-row {
    display: flex;
    gap: 0.6rem;
    flex-wrap: wrap;
}

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

.field {
    display: flex;
    flex-direction: column;
    gap: 0.32rem;
}

.field label {
    font-size: 0.82rem;
    color: var(--muted);
}

.field input,
.field select,
.field textarea {
    width: 100%;
    border: 1px solid var(--border);
    border-radius: 12px;
    background: #1d1326;
    color: var(--text);
    padding: 0.66rem 0.72rem;
    font-family: inherit;
}

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

.field input:focus,
.field select:focus,
.field textarea:focus {
    outline: none;
    border-color: var(--primary);
    box-shadow: 0 0 0 3px rgba(144, 25, 230, 0.2);
}

.checkbox-field {
    display: flex;
    align-items: center;
    gap: 0.6rem;
    color: var(--muted);
    font-size: 0.9rem;
}

.hero {
    padding: 5rem 0 2.5rem;
}

.hero h1 {
    margin: 0 0 0.9rem;
    font-size: clamp(2rem, 5vw, 4rem);
    line-height: 1.07;
    font-weight: 800;
}

.hero p {
    margin: 0;
    color: var(--muted);
    max-width: 780px;
    font-size: 1.03rem;
}

.section-title {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 1rem;
    margin: 1rem 0;
}

.section-title h2 {
    margin: 0;
    font-size: 1.25rem;
}

.list-reset {
    list-style: none;
    margin: 0;
    padding: 0;
}

.item-list {
    display: flex;
    flex-direction: column;
    gap: 0.65rem;
}

.item-list li {
    border: 1px solid var(--border);
    border-radius: 12px;
    padding: 0.65rem 0.8rem;
    background: rgba(36, 24, 46, 0.8);
}

.table-wrap {
    overflow-x: auto;
}

table {
    width: 100%;
    border-collapse: collapse;
    min-width: 720px;
}

th,
td {
    text-align: left;
    font-size: 0.88rem;
    padding: 0.62rem;
    border-bottom: 1px solid var(--border);
}

th {
    font-size: 0.76rem;
    text-transform: uppercase;
    letter-spacing: 0.08em;
    color: var(--muted);
}

.progress {
    width: 100%;
    height: 12px;
    border-radius: 999px;
    background: #120a17;
    border: 1px solid #332041;
    overflow: hidden;
}

.progress > span {
    height: 100%;
    display: block;
    background: linear-gradient(130deg, var(--gold), var(--primary));
}

.flash-stack {
    display: flex;
    flex-direction: column;
    gap: 0.6rem;
    margin-bottom: 1rem;
}

.flash {
    border-radius: 12px;
    padding: 0.72rem 0.88rem;
    border: 1px solid transparent;
    font-size: 0.9rem;
}

.flash.success {
    background: rgba(51, 193, 108, 0.13);
    border-color: rgba(51, 193, 108, 0.35);
    color: #8eebb0;
}

.flash.error {
    background: rgba(239, 79, 105, 0.12);
    border-color: rgba(239, 79, 105, 0.4);
    color: #ff8da2;
}

.flash.info {
    background: rgba(144, 25, 230, 0.15);
    border-color: rgba(144, 25, 230, 0.45);
    color: #dcb6ff;
}

/* Unified public navigation */
.site-header {
    position: sticky;
    top: 0;
    z-index: 50;
    border-bottom: 1px solid rgba(255, 255, 255, 0.08);
    background: rgba(18, 10, 26, 0.9);
    backdrop-filter: blur(10px);
}

.site-header-inner {
    display: flex;
    align-items: center;
    justify-content: space-between;
    min-height: 74px;
    gap: 1rem;
}

.brand {
    display: inline-flex;
    align-items: center;
    gap: 0.6rem;
}

.site-header .brand .brand-icon {
    width: 34px;
    height: 34px;
    border-radius: 999px;
    overflow: hidden;
    border: 1px solid rgba(212, 175, 55, 0.4);
    box-shadow: 0 0 15px rgba(144, 25, 230, 0.3);
}

.site-header .brand .brand-title {
    margin: 0;
    color: #f7f0fe;
    font-size: 1.15rem;
    font-weight: 800;
}

.site-nav {
    display: flex;
    align-items: center;
    gap: 0.4rem;
}

.site-nav-link {
    border: 1px solid transparent;
    border-radius: 10px;
    padding: 0.45rem 0.75rem;
    color: #d7cce2;
    font-size: 0.92rem;
    font-weight: 600;
    transition: all 0.16s ease;
}

.site-nav-link:hover {
    color: #fff;
    background: rgba(144, 25, 230, 0.14);
    border-color: rgba(144, 25, 230, 0.28);
}

.site-nav-link.active {
    color: #fff;
    background: rgba(144, 25, 230, 0.2);
    border-color: rgba(144, 25, 230, 0.42);
}

.site-actions {
    display: flex;
    align-items: center;
    gap: 0.55rem;
}

.site-dropdown {
    position: relative;
}

.dropdown-toggle {
    display: inline-flex;
    align-items: center;
    gap: 0.2rem;
    cursor: pointer;
}

.dropdown-menu {
    position: absolute;
    top: calc(100% + 8px);
    left: 0;
    min-width: 190px;
    padding: 0.4rem;
    border-radius: 12px;
    border: 1px solid rgba(255, 255, 255, 0.1);
    background: #1b1122;
    box-shadow: 0 14px 30px rgba(0, 0, 0, 0.35);
    display: none;
}

.dropdown-menu.open {
    display: block;
}

.dropdown-menu a,
.dropdown-menu button {
    width: 100%;
    display: block;
    border: 0;
    background: transparent;
    text-align: left;
    border-radius: 9px;
    color: #d8cde3;
    padding: 0.48rem 0.6rem;
    font-size: 0.88rem;
    font-weight: 600;
    cursor: pointer;
    font-family: inherit;
}

.dropdown-menu a:hover,
.dropdown-menu button:hover {
    color: #fff;
    background: rgba(144, 25, 230, 0.15);
}

.dropdown-menu a.active {
    color: #fff;
    background: rgba(144, 25, 230, 0.2);
}

.dropdown-menu-right {
    right: 0;
    left: auto;
}

.user-menu-trigger {
    display: inline-flex;
    align-items: center;
    gap: 0.45rem;
    border: 1px solid var(--border);
    border-radius: 999px;
    padding: 0.25rem 0.55rem 0.25rem 0.25rem;
    background: rgba(255, 255, 255, 0.03);
    color: #efe7f8;
    cursor: pointer;
}

.user-menu-trigger .avatar {
    width: 30px;
    height: 30px;
    border-radius: 999px;
    overflow: hidden;
    border: 1px solid rgba(212, 175, 55, 0.4);
    flex: 0 0 30px;
}

.user-menu-trigger .avatar img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.user-menu-trigger .user-name {
    font-size: 0.85rem;
    font-weight: 700;
}

.mobile-nav-toggle {
    display: none;
    width: 40px;
    height: 40px;
    border-radius: 10px;
    border: 1px solid var(--border);
    background: rgba(255, 255, 255, 0.03);
    color: #efe7f8;
}

.mobile-drawer {
    display: none;
    border-top: 1px solid rgba(255, 255, 255, 0.07);
    background: #170e20;
}

.mobile-drawer.open {
    display: block;
}

.mobile-drawer-inner {
    width: min(1200px, 100% - 2rem);
    margin-inline: auto;
    padding: 0.8rem 0 1rem;
    display: grid;
    gap: 0.35rem;
}

.mobile-divider {
    height: 1px;
    background: rgba(255, 255, 255, 0.08);
    margin: 0.45rem 0;
}

/* Unified footer */
.site-footer {
    margin-top: auto;
    border-top: 1px solid rgba(255, 255, 255, 0.08);
    background: rgba(17, 11, 24, 0.92);
}

.site-footer-inner {
    min-height: 74px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 1rem;
    padding: 0.8rem 0;
}

.site-footer-brand {
    display: inline-flex;
    align-items: center;
    gap: 0.55rem;
    color: #b59cc8;
    font-size: 0.85rem;
    font-weight: 600;
}

.site-footer-brand img {
    width: 24px;
    height: 24px;
    object-fit: cover;
    border-radius: 999px;
    border: 1px solid rgba(212, 175, 55, 0.4);
}

.site-footer-cta {
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
    color: #d7c8e4;
    font-size: 0.84rem;
    font-weight: 600;
}

.site-footer-cta a {
    color: var(--gold);
}

.site-footer-cta a:hover {
    color: #fff;
}

.site-footer-links {
    display: inline-flex;
    align-items: center;
    gap: 0.9rem;
    flex-wrap: wrap;
    justify-content: center;
}

.site-footer-links a {
    color: #b59cc8;
    font-size: 0.84rem;
    font-weight: 600;
}

.site-footer-links a:hover {
    color: #fff;
}

.content-admin-overview .stat-card {
    min-height: 112px;
}

.content-admin-layout {
    grid-template-columns: minmax(0, 1fr);
    gap: 1rem;
    align-items: flex-start;
}

.content-section-chip-row {
    display: flex;
    flex-wrap: wrap;
    gap: 0.55rem;
}

.content-section-chip {
    border: 1px solid var(--border);
    background: rgba(27, 18, 34, 0.7);
    border-radius: 999px;
    color: var(--text);
    font-size: 0.8rem;
    font-weight: 700;
    font-family: inherit;
    padding: 0.42rem 0.72rem;
    cursor: pointer;
    transition: all 0.18s ease;
}

.content-section-chip:hover {
    border-color: rgba(212, 175, 55, 0.35);
    color: var(--gold);
}

.content-section-chip.is-active {
    border-color: rgba(144, 25, 230, 0.6);
    background: rgba(144, 25, 230, 0.18);
    color: #fff;
}

.content-advanced {
    border: 1px dashed var(--border);
    border-radius: 12px;
    padding: 0.6rem 0.7rem;
    background: rgba(17, 10, 22, 0.4);
}

.content-advanced summary {
    cursor: pointer;
    color: var(--muted);
    font-size: 0.84rem;
    font-weight: 600;
}

.content-advanced[open] summary {
    margin-bottom: 0.55rem;
}

.content-guide-box {
    border: 1px solid var(--border);
    border-radius: 12px;
    padding: 0.75rem;
    background: rgba(17, 10, 22, 0.45);
}

.content-guide-box p {
    margin: 0.45rem 0 0.75rem;
    color: var(--muted);
    font-size: 0.83rem;
    line-height: 1.4;
}

.content-preview {
    border: 1px solid var(--border);
    border-radius: 14px;
    padding: 0.85rem;
    background: linear-gradient(165deg, rgba(42, 26, 56, 0.75), rgba(20, 12, 26, 0.88));
}

.content-preview h3 {
    margin: 0 0 0.55rem;
    font-size: 0.96rem;
}

.content-preview-title {
    margin: 0 0 0.38rem;
    font-size: 1rem;
    font-weight: 700;
}

.content-preview-meta {
    margin: 0 0 0.45rem;
    color: #cfbde0;
    font-size: 0.78rem;
}

.content-preview-excerpt {
    margin: 0;
    color: var(--muted);
    font-size: 0.84rem;
    line-height: 1.45;
}

.content-preview-tags {
    margin: 0.7rem 0 0;
    color: #d9cde4;
    font-size: 0.81rem;
}

.content-filter-grid {
    display: grid;
    grid-template-columns: minmax(180px, 2fr) minmax(140px, 1fr) minmax(140px, 1fr) auto;
    gap: 0.75rem;
    align-items: end;
    margin-bottom: 0.9rem;
}

.content-filter-grid .button-row {
    min-width: 150px;
}

.content-list-card td {
    vertical-align: top;
    white-space: normal;
    word-break: break-word;
}

.content-list-card small {
    display: inline-block;
    max-width: 100%;
}

/* Responsive */
@media (max-width: 1024px) {
    .grid.cols-4,
    .grid.cols-3 {
        grid-template-columns: repeat(2, minmax(0, 1fr));
    }

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

    .content-filter-grid .button-row {
        grid-column: 1 / -1;
    }
}

@media (max-width: 900px) {
    .app-shell {
        grid-template-columns: 1fr;
    }

    .sidebar {
        position: fixed;
        left: -290px;
        width: 280px;
        z-index: 60;
        transition: left 0.2s ease;
    }

    .sidebar.is-open {
        left: 0;
    }

    .mobile-toggle {
        display: inline-flex;
        align-items: center;
        justify-content: center;
    }

    .desktop-only {
        display: none !important;
    }

    .mobile-nav-toggle {
        display: inline-flex;
        align-items: center;
        justify-content: center;
    }

    .site-footer-inner {
        flex-direction: column;
        align-items: flex-start;
        gap: 0.6rem;
    }

    .site-footer-cta {
        order: 3;
    }
}

@media (max-width: 720px) {
    .grid.cols-4,
    .grid.cols-3,
    .grid.cols-2,
    .form-grid {
        grid-template-columns: 1fr;
    }

    .content-filter-grid {
        grid-template-columns: 1fr;
    }

    .content-section-chip-row {
        gap: 0.45rem;
    }

    .hero {
        padding: 3.6rem 0 1.8rem;
    }

    .page-content {
        padding: 1rem;
    }
}
