:root {
    --panel: #121722;
    --panel2: #171d2a;
    --text: #eef2ff;
    --muted: #9da8c3;
    --line: #273049;
    --accent: #c8a96b;
    --soft: rgba(255, 255, 255, 0.03);
}

* {
    box-sizing: border-box;
}

body {
    margin: 0;
    font: 15px/1.5 Inter, Arial, sans-serif;
    background: linear-gradient(180deg, #090b10, #0f1420);
    color: var(--text);
}

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

.layout {
    display: grid;
    grid-template-columns: 240px 1fr;
    min-height: 100vh;
}

.sidebar {
    padding: 28px 18px;
    border-right: 1px solid var(--line);
    background: rgba(10, 13, 19, 0.9);
}

.brand {
    font-size: 22px;
    font-weight: 700;
    margin-bottom: 22px;
}

.sidebar nav {
    display: grid;
    gap: 8px;
}

.sidebar nav a {
    padding: 10px 12px;
    border-radius: 12px;
    color: var(--muted);
    transition: background 0.2s ease, color 0.2s ease, border-color 0.2s ease;
}

.sidebar nav a:hover {
    background: var(--panel);
    color: #fff;
}

.sidebar nav a.active {
    background: rgba(200, 169, 107, 0.12);
    border: 1px solid rgba(200, 169, 107, 0.22);
    color: #fff;
}

.content {
    padding: 30px;
}

.card {
    background: linear-gradient(180deg, var(--panel), var(--panel2));
    border: 1px solid var(--line);
    border-radius: 20px;
    padding: 22px;
}

.toolbar {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 12px;
    margin-bottom: 18px;
}

.toolbar h1,
.toolbar h2 {
    margin: 0;
}

.btn {
    display: inline-block;
    padding: 10px 14px;
    border-radius: 12px;
    background: var(--accent);
    color: #111;
    font-weight: 700;
    border: 0;
    cursor: pointer;
}

.btn.secondary {
    background: #20283a;
    color: #fff;
}

table {
    width: 100%;
    border-collapse: collapse;
}

th,
td {
    padding: 12px;
    border-bottom: 1px solid var(--line);
    text-align: left;
    vertical-align: top;
}

th {
    color: var(--muted);
    font-weight: 600;
}

input,
textarea,
select {
    width: 100%;
    padding: 12px;
    border-radius: 12px;
    background: #0d1220;
    border: 1px solid var(--line);
    color: #fff;
}

input:focus,
textarea:focus,
select:focus {
    outline: none;
    border-color: rgba(200, 169, 107, 0.55);
    box-shadow: 0 0 0 3px rgba(200, 169, 107, 0.08);
}

textarea {
    min-height: 120px;
}

label {
    display: inline-block;
    margin-bottom: 8px;
    color: var(--muted);
    font-size: 13px;
}

.grid {
    display: grid;
    gap: 18px;
}

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

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

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

.stat {
    padding: 18px;
    border-radius: 18px;
    background: #111827;
    border: 1px solid var(--line);
}

.login-wrap {
    min-height: 100vh;
    display: grid;
    place-items: center;
    padding: 20px;
}

.login-box {
    width: min(460px, 100%);
}

@media (max-width: 980px) {
    .layout {
        grid-template-columns: 1fr;
    }

    .sidebar {
        border-right: 0;
        border-bottom: 1px solid var(--line);
        padding: 20px 16px;
    }

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

    .content {
        padding: 20px 16px;
    }

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

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

    .toolbar {
        flex-direction: column;
        align-items: flex-start;
    }
}


.notice {
    padding: 12px 14px;
    border-radius: 12px;
    margin-bottom: 16px;
    border: 1px solid var(--line);
}

.notice.error {
    background: rgba(180, 54, 54, 0.12);
    border-color: rgba(180, 54, 54, 0.35);
    color: #ffd7d7;
}

.notice.success {
    background: rgba(58, 145, 95, 0.12);
    border-color: rgba(58, 145, 95, 0.35);
    color: #d8ffe7;
}

.thumb-cell {
    width: 92px;
}

.admin-thumb {
    width: 72px;
    height: 48px;
    object-fit: cover;
    display: block;
    border-radius: 10px;
    border: 1px solid var(--line);
    background: #0d1220;
}

.image-preview {
    display: grid;
    gap: 10px;
}

.image-preview img {
    width: 180px;
    max-width: 100%;
    aspect-ratio: 3 / 2;
    object-fit: cover;
    border-radius: 12px;
    border: 1px solid var(--line);
    background: #0d1220;
}

.checkbox-inline {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    color: var(--muted);
    font-size: 14px;
}

.checkbox-inline input {
    width: auto;
    margin: 0;
}

.upload-help {
    color: var(--muted);
    font-size: 13px;
    margin-top: 6px;
}

.upload-overlay {
    position: fixed;
    inset: 0;
    z-index: 9999;
    display: grid;
    place-items: center;
    background: rgba(9, 11, 16, 0.7);
    backdrop-filter: blur(6px);
}
.upload-overlay[hidden] {
    display: none !important;
}
.upload-overlay-box {
    width: min(320px, calc(100% - 32px));
    padding: 24px;
    border-radius: 18px;
    background: linear-gradient(180deg, var(--panel), var(--panel2));
    border: 1px solid var(--line);
    text-align: center;
}

.upload-spinner {
    width: 42px;
    height: 42px;
    margin: 0 auto 14px;
    border-radius: 50%;
    border: 3px solid rgba(255,255,255,0.14);
    border-top-color: var(--accent);
    animation: spin 0.9s linear infinite;
}

.upload-overlay-text {
    color: #fff;
    font-weight: 600;
}

body.is-uploading {
    overflow: hidden;
}

@keyframes spin {
    to { transform: rotate(360deg); }
}


@media (max-width: 640px) {
    .brand {
        font-size: 20px;
        margin-bottom: 16px;
    }

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

    .card {
        padding: 16px;
        border-radius: 16px;
    }

    .content {
        padding: 16px 12px;
    }

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

    .btn {
        width: 100%;
        text-align: center;
    }

    table,
    thead,
    tbody,
    th,
    td,
    tr {
        display: block;
    }

    thead {
        display: none;
    }

    table {
        border: 0;
    }

    tbody {
        display: grid;
        gap: 12px;
    }

    tr {
        border: 1px solid var(--line);
        border-radius: 14px;
        padding: 10px;
        background: var(--soft);
    }

    td {
        border: 0;
        padding: 8px 0;
    }

    input,
    textarea,
    select {
        padding: 11px;
    }
}