* {
    box-sizing: border-box;
}

:root {
    --bg: #020617;
    --panel: rgba(15, 23, 42, 0.82);
    --panel-strong: rgba(15, 23, 42, 0.95);
    --card: rgba(15, 23, 42, 0.72);
    --section: rgba(2, 6, 23, 0.72);
    --text: #ffffff;
    --muted: #94a3b8;
    --border: rgba(148, 163, 184, 0.16);
    --blue: #2563eb;
    --cyan: #06b6d4;
    --green: #22c55e;
    --red: #ef4444;
}

body.light {
    --bg: #f1f5f9;
    --panel: rgba(255, 255, 255, 0.88);
    --panel-strong: rgba(255, 255, 255, 0.96);
    --card: rgba(255, 255, 255, 0.84);
    --section: rgba(248, 250, 252, 0.95);
    --text: #0f172a;
    --muted: #64748b;
    --border: rgba(15, 23, 42, 0.1);
}

body {
    margin: 0;
    font-family: "Inter", "Segoe UI", Arial, sans-serif;
    color: var(--text);
    background:
        radial-gradient(circle at top left, rgba(37, 99, 235, 0.35), transparent 34%),
        radial-gradient(circle at top right, rgba(6, 182, 212, 0.22), transparent 28%),
        radial-gradient(circle at bottom right, rgba(168, 85, 247, 0.18), transparent 30%),
        var(--bg);
    min-height: 100vh;
}

.app-shell {
    display: flex;
    min-height: 100vh;
}

/* Sidebar */
.sidebar {
    width: 290px;
    height: 100vh;
    position: sticky;
    top: 0;
    padding: 22px 18px;
    background: var(--panel);
    border-right: 1px solid var(--border);
    backdrop-filter: blur(22px);
    -webkit-backdrop-filter: blur(22px);
    transition: width .25s ease;
    overflow: hidden;
}

.sidebar.collapsed {
    width: 92px;
}

.brand-row {
    display: flex;
    align-items: center;
    gap: 12px;
    margin-bottom: 30px;
}

.brand-icon {
    width: 46px;
    height: 46px;
    border-radius: 16px;
    display: grid;
    place-items: center;
    font-weight: 900;
    background: linear-gradient(135deg, var(--blue), var(--cyan));
    color: #fff;
    box-shadow: 0 18px 35px rgba(37, 99, 235, 0.35);
    flex-shrink: 0;
}

.logo {
    font-size: 22px;
    font-weight: 900;
    line-height: 1;
}

.sidebar-subtitle {
    margin-top: 5px;
    color: var(--muted);
    font-size: 12px;
    white-space: nowrap;
}

.collapse-btn {
    margin-left: auto;
    width: 40px;
    height: 40px;
    border: 1px solid var(--border);
    border-radius: 14px;
    background: rgba(255,255,255,0.06);
    color: var(--text);
    cursor: pointer;
}

.side-label {
    color: var(--muted);
    text-transform: uppercase;
    letter-spacing: 1px;
    font-size: 11px;
    font-weight: 800;
    margin: 0 0 12px 12px;
}

.menu-list {
    display: flex;
    flex-direction: column;
    gap: 9px;
}

.sidebar a {
    text-decoration: none;
    color: var(--muted);
}

.menu-list a,
.logout {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 13px 14px;
    border-radius: 16px;
    transition: .22s ease;
    font-weight: 750;
    white-space: nowrap;
}

.menu-list a:hover {
    color: var(--text);
    background: rgba(59, 130, 246, 0.14);
    transform: translateX(3px);
}

.menu-list a.active {
    color: #fff;
    background: linear-gradient(135deg, var(--blue), var(--cyan));
    box-shadow: 0 16px 32px rgba(37, 99, 235, 0.33);
}

.menu-icon {
    width: 24px;
    text-align: center;
    flex-shrink: 0;
}

.sidebar-footer {
    margin-top: 24px;
    border-top: 1px solid var(--border);
    padding-top: 18px;
}

.logout {
    color: #fca5a5 !important;
    background: rgba(239, 68, 68, 0.10);
}

.logout:hover {
    background: rgba(239, 68, 68, 0.18);
}

.sidebar.collapsed .brand-text,
.sidebar.collapsed .side-label,
.sidebar.collapsed .menu-text {
    display: none;
}

.sidebar.collapsed .brand-row {
    justify-content: center;
}

.sidebar.collapsed .collapse-btn {
    margin-left: 0;
}

.sidebar.collapsed .menu-list a,
.sidebar.collapsed .logout {
    justify-content: center;
}

/* Main */
.main {
    flex: 1;
    padding: 30px;
    max-width: 1500px;
    margin: 0 auto;
}

.topbar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 22px;
    background: var(--panel);
    border: 1px solid var(--border);
    border-radius: 28px;
    padding: 22px 24px;
    backdrop-filter: blur(20px);
    -webkit-backdrop-filter: blur(20px);
    box-shadow: 0 24px 60px rgba(0, 0, 0, 0.22);
}

.eyebrow {
    color: #38bdf8;
    text-transform: uppercase;
    font-size: 12px;
    font-weight: 900;
    letter-spacing: 1.4px;
    margin-bottom: 7px;
}

.topbar h1 {
    margin: 0;
    font-size: 32px;
    letter-spacing: -0.8px;
}

.topbar p {
    margin: 7px 0 0;
    color: var(--muted);
}

.top-actions {
    display: flex;
    align-items: center;
    gap: 14px;
}

.theme-btn {
    width: 48px;
    height: 48px;
    border-radius: 16px;
    border: 1px solid var(--border);
    background: var(--panel-strong);
    color: var(--text);
    cursor: pointer;
    font-size: 18px;
}

.avatar-wrapper {
    position: relative;
}

.avatar-box {
    width: 50px;
    height: 50px;
    border-radius: 18px;
    display: grid;
    place-items: center;
    font-weight: 950;
    cursor: pointer;
    background: linear-gradient(135deg, var(--blue), var(--cyan));
    color: #fff;
    box-shadow: 0 16px 32px rgba(37, 99, 235, 0.34);
}

.dropdown {
    position: absolute;
    right: 0;
    top: 62px;
    width: 240px;
    background: var(--panel-strong);
    border: 1px solid var(--border);
    border-radius: 20px;
    padding: 16px;
    display: none;

    /* IMPORTANT */
    z-index: 99999;

    box-shadow: 0 30px 75px rgba(0, 0, 0, 0.35);

    backdrop-filter: blur(20px);
    -webkit-backdrop-filter: blur(20px);
}

.dropdown.show {
    display: block;
}

.dropdown strong {
    display: block;
    margin-bottom: 5px;
}

.dropdown small {
    color: var(--muted);
    display: block;
    margin-bottom: 14px;
    word-break: break-all;
}

.dropdown a {
    display: block;
    color: #38bdf8;
    text-decoration: none;
    font-weight: 800;
    padding: 10px 0;
}

/* Stats */
.stats-grid {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 18px;
    margin: 24px 0;
}

.stat-card {
    background: var(--card);
    border: 1px solid var(--border);
    border-radius: 24px;
    padding: 22px;
    backdrop-filter: blur(18px);
    -webkit-backdrop-filter: blur(18px);
    box-shadow: 0 20px 50px rgba(0, 0, 0, 0.18);
}

.stat-card span {
    display: block;
    color: var(--muted);
    font-size: 13px;
    font-weight: 800;
    margin-bottom: 10px;
}

.stat-card strong {
    font-size: 24px;
    letter-spacing: -0.5px;
}

/* Editor */
.editor-card {
    background: var(--card);
    border: 1px solid var(--border);
    border-radius: 30px;
    padding: 28px;
    backdrop-filter: blur(20px);
    -webkit-backdrop-filter: blur(20px);
    box-shadow: 0 28px 80px rgba(0, 0, 0, 0.27);
    position: relative;
    overflow: hidden;
}

.editor-card::before {
    content: "";
    position: absolute;
    width: 280px;
    height: 280px;
    border-radius: 50%;
    background: rgba(56, 189, 248, 0.08);
    top: -140px;
    right: -110px;
}

.editor-head {
    position: relative;
    display: flex;
    justify-content: space-between;
    gap: 18px;
    align-items: center;
    margin-bottom: 24px;
}

.editor-head h2 {
    margin: 0;
    font-size: 25px;
}

.editor-head p {
    margin: 6px 0 0;
    color: var(--muted);
}

.file-chip {
    padding: 10px 14px;
    border-radius: 999px;
    background: rgba(56, 189, 248, 0.12);
    color: #38bdf8;
    border: 1px solid rgba(56, 189, 248, 0.25);
    font-weight: 850;
    font-size: 13px;
}

.section {
    background: var(--section);
    border: 1px solid var(--border);
    border-radius: 24px;
    padding: 22px;
    margin-bottom: 20px;
    position: relative;
    transition: .22s ease;
}

.section:hover {
    transform: translateY(-2px);
    border-color: rgba(56, 189, 248, 0.28);
}

.section-title {
    display: flex;
    justify-content: space-between;
    gap: 12px;
    align-items: center;
    border-bottom: 1px solid var(--border);
    padding-bottom: 14px;
    margin-bottom: 18px;
}

.section-title span {
    color: #38bdf8;
    font-size: 18px;
    font-weight: 900;
}

.section-title small {
    color: var(--muted);
    font-weight: 700;
}

.field-group {
    margin-bottom: 16px;
}

label {
    display: block;
    color: var(--muted);
    font-size: 13px;
    font-weight: 850;
    margin-bottom: 8px;
}

input,
textarea {
    width: 100%;
    border: 1px solid var(--border);
    border-radius: 16px;
    background: rgba(2, 6, 23, 0.75);
    color: #fff;
    padding: 14px 15px;
    outline: none;
    font-size: 14px;
    transition: .22s ease;
}

body.light input,
body.light textarea {
    background: #f8fafc;
    color: #0f172a;
}

textarea {
    min-height: 115px;
    resize: vertical;
}

input:hover,
textarea:hover,
input:focus,
textarea:focus {
    border-color: rgba(56, 189, 248, 0.55);
    box-shadow: 0 0 0 4px rgba(56, 189, 248, 0.12);
}

.save-btn {
    width: 100%;
    border: none;
    border-radius: 20px;
    padding: 17px;
    background: linear-gradient(135deg, var(--blue), var(--cyan));
    color: #fff;
    cursor: pointer;
    font-weight: 950;
    display: flex;
    flex-direction: column;
    gap: 3px;
    align-items: center;
    box-shadow: 0 20px 42px rgba(37, 99, 235, 0.35);
    transition: .22s ease;
}

.save-btn:hover {
    transform: translateY(-2px);
    box-shadow: 0 26px 55px rgba(6, 182, 212, 0.36);
}

.save-btn small {
    opacity: .78;
    font-weight: 700;
}

/* Messages */
.success {
    position: relative;
    z-index: 2;
    background: rgba(34, 197, 94, 0.14);
    border: 1px solid rgba(34, 197, 94, 0.35);
    color: #86efac;
    padding: 14px 16px;
    border-radius: 16px;
    margin-bottom: 20px;
    font-weight: 850;
}

.error {
    background: rgba(239, 68, 68, 0.15);
    border: 1px solid rgba(239, 68, 68, 0.4);
    color: #fca5a5;
    padding: 14px 16px;
    border-radius: 16px;
    margin-bottom: 18px;
    font-weight: 850;
}

/* Login / Password pages */
.login-page,
.password-page {
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 25px;
}

.login-box,
.password-card {
    width: 100%;
    max-width: 480px;
    background: var(--panel);
    border: 1px solid var(--border);
    border-radius: 30px;
    padding: 36px;
    box-shadow: 0 30px 90px rgba(0,0,0,0.42);
    backdrop-filter: blur(22px);
}

.login-box h2,
.password-card h2 {
    margin: 0;
    font-size: 30px;
    text-align: center;
}

.login-box p,
.password-card p {
    text-align: center;
    color: var(--muted);
    margin-bottom: 25px;
}

.back-link {
    display: block;
    text-align: center;
    margin-top: 18px;
    color: #38bdf8;
    text-decoration: none;
    font-weight: 850;
}

/* Scrollbar */
::-webkit-scrollbar {
    width: 10px;
}

::-webkit-scrollbar-thumb {
    background: rgba(56, 189, 248, 0.36);
    border-radius: 99px;
}

/* Mobile */
@media (max-width: 950px) {
    .app-shell {
        flex-direction: column;
    }

    .sidebar,
    .sidebar.collapsed {
        width: 100%;
        height: auto;
        position: relative;
    }

    .sidebar.collapsed .brand-text,
    .sidebar.collapsed .side-label,
    .sidebar.collapsed .menu-text {
        display: block;
    }

    .sidebar.collapsed .menu-list a,
    .sidebar.collapsed .logout {
        justify-content: flex-start;
    }

    .menu-list {
        display: grid;
        grid-template-columns: repeat(2, minmax(0, 1fr));
    }

    .main {
        padding: 18px;
    }

    .topbar,
    .editor-head {
        flex-direction: column;
        align-items: flex-start;
    }

    .top-actions {
        align-self: flex-end;
    }

    .stats-grid {
        grid-template-columns: 1fr;
    }
}

@media (max-width: 540px) {
    .menu-list {
        grid-template-columns: 1fr;
    }

    .topbar h1 {
        font-size: 25px;
    }

    .editor-card {
        padding: 20px;
    }
}
.topbar {
    position: relative;
    z-index: 1000;
}
.avatar-wrapper {
    position: relative;
    z-index: 1001;
}
.table-switcher {
    display: flex;
    gap: 12px;
    margin-top: 18px;
    flex-wrap: wrap;
}

.table-switcher a {
    padding: 10px 16px;
    border-radius: 14px;
    text-decoration: none;
    color: var(--text);
    background: rgba(255,255,255,0.05);
    border: 1px solid var(--border);
    font-weight: 800;
    transition: .2s;
}

.table-switcher a:hover {
    transform: translateY(-1px);
    background: rgba(37,99,235,0.15);
}

.table-switcher a.active {
    background: linear-gradient(135deg, #2563eb, #06b6d4);
    color: white;
    border-color: transparent;
}

.table-wrap {
    width: 100%;
    overflow-x: auto;
}

.modern-table {
    width: 100% !important;
    margin-top: 20px !important;
    border-collapse: collapse !important;
    overflow: hidden;
    border-radius: 20px;
}

table.dataTable {
    color: var(--text);
}

table.dataTable thead {
    background: linear-gradient(135deg, #2563eb, #06b6d4);
    color: white;
}

table.dataTable thead th {
    border: none !important;
    padding: 14px !important;
}

table.dataTable tbody tr {
    background: rgba(255,255,255,0.02);
}

table.dataTable tbody td {
    padding: 14px !important;
    border-color: rgba(255,255,255,0.05) !important;
    vertical-align: top;
}

.dataTables_wrapper .dataTables_filter input,
.dataTables_wrapper .dataTables_length select {
    background: rgba(255,255,255,0.05);
    border: 1px solid var(--border);
    color: var(--text);
    border-radius: 12px;
    padding: 8px 10px;
}

.dataTables_wrapper .dataTables_filter,
.dataTables_wrapper .dataTables_length,
.dataTables_wrapper .dataTables_info {
    color: var(--muted) !important;
}

.dataTables_wrapper .dataTables_paginate .paginate_button {
    color: var(--text) !important;
    border-radius: 10px !important;
}

.dataTables_wrapper .dataTables_paginate .paginate_button.current {
    background: linear-gradient(135deg, #2563eb, #06b6d4) !important;
    border: none !important;
    color: white !important;
}
.table-switcher {
    display: flex;
    gap: 14px;
    margin-top: 22px;
    flex-wrap: wrap;
}

.table-switcher a {
    display: inline-flex;
    align-items: center;
    justify-content: center;

    padding: 12px 20px;

    border-radius: 14px;

    text-decoration: none;

    color: var(--text);

    background: rgba(255,255,255,0.06);

    border: 1px solid var(--border);

    font-weight: 800;

    transition: all .22s ease;

    min-width: 110px;
}

.table-switcher a:hover {
    transform: translateY(-2px);

    background: rgba(37,99,235,0.16);

    border-color: rgba(37,99,235,0.45);
}

.table-switcher a.active {
    background: linear-gradient(135deg, #2563eb, #06b6d4);

    color: #fff;

    border-color: transparent;

    box-shadow: 0 12px 30px rgba(37,99,235,0.35);
}
.login-btn {
    margin-top: 14px !important;

    width: 100%;

    border: none;

    border-radius: 16px;

    padding: 12px 16px !important;

    background: linear-gradient(135deg, var(--blue), var(--cyan));

    color: #fff;

    cursor: pointer;

    font-weight: 900;

    box-shadow: 0 14px 30px rgba(37, 99, 235, 0.28);

    min-height: auto !important;
}

.login-btn span {
    display: block;
    font-size: 15px;
    line-height: 1.1;
}

.login-btn small {
    display: block;
    margin-top: 2px;
    opacity: .8;
    font-size: 11px;
    line-height: 1.1;
    font-weight: 700;
}