:root {
    --bg: #0a0d14;
    --panel: #121825;
    --panel-soft: #171f30;
    --line: rgba(255, 255, 255, 0.08);
    --text: #f4f7ff;
    --muted: rgba(228, 234, 255, 0.68);
    --primary: #7668ff;
    --secondary: #00c9be;
    --danger: #ff6b81;
    --success: #3ddc97;
    --warning: #ffb84d;
    --shadow: 0 24px 64px rgba(0, 0, 0, 0.34);
}

* {
    box-sizing: border-box;
}

body {
    margin: 0;
    background:
        radial-gradient(circle at top left, rgba(118, 104, 255, 0.18), transparent 25%),
        linear-gradient(180deg, #090c13 0%, #0b1018 100%);
    color: var(--text);
    font-family: "PingFang SC", "Microsoft YaHei", sans-serif;
}

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

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

input,
textarea,
select {
    width: 100%;
    padding: 13px 14px;
    border-radius: 14px;
    border: 1px solid rgba(255, 255, 255, 0.08);
    background: rgba(7, 10, 16, 0.78);
    color: var(--text);
}

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

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

button,
.primary-button,
.ghost-button,
.danger-button {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: 12px 18px;
    border-radius: 999px;
    border: 0;
    cursor: pointer;
    font-weight: 700;
    transition: transform 0.2s ease, opacity 0.2s ease;
}

button:hover,
.primary-button:hover,
.ghost-button:hover,
.danger-button:hover {
    transform: translateY(-1px);
}

.primary-button {
    background: linear-gradient(90deg, var(--primary), var(--secondary));
    color: white;
}

.ghost-button {
    border: 1px solid rgba(255, 255, 255, 0.1);
    background: rgba(255, 255, 255, 0.03);
    color: var(--text);
}

.danger-button {
    background: rgba(255, 107, 129, 0.14);
    color: #ffccda;
    border: 1px solid rgba(255, 107, 129, 0.2);
}

.admin-shell {
    display: grid;
    grid-template-columns: 260px 1fr;
    min-height: 100vh;
}

.admin-sidebar {
    position: sticky;
    top: 0;
    height: 100vh;
    padding: 24px 18px;
    background: rgba(8, 12, 19, 0.94);
    border-right: 1px solid rgba(255, 255, 255, 0.08);
}

.brand-block {
    display: flex;
    gap: 14px;
    align-items: center;
    margin-bottom: 26px;
    padding: 16px;
    border-radius: 22px;
    background: rgba(255, 255, 255, 0.03);
}

.brand-mark {
    width: 42px;
    height: 42px;
    display: grid;
    place-items: center;
    border-radius: 14px;
    background: linear-gradient(135deg, var(--primary), var(--secondary));
    font-weight: 800;
}

.brand-block strong {
    display: block;
}

.brand-block p {
    margin: 4px 0 0;
    font-size: 12px;
    color: var(--muted);
}

.admin-menu {
    display: grid;
    gap: 10px;
}

.menu-link {
    padding: 14px 16px;
    border-radius: 16px;
    color: var(--muted);
    background: transparent;
}

.menu-link.active {
    background: linear-gradient(90deg, rgba(118, 104, 255, 0.18), rgba(0, 201, 190, 0.1));
    color: white;
}

.sidebar-foot {
    position: absolute;
    left: 18px;
    right: 18px;
    bottom: 24px;
    display: grid;
    gap: 8px;
    color: var(--muted);
    font-size: 13px;
}

.admin-main {
    padding: 28px;
}

.admin-topbar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 20px;
    margin-bottom: 20px;
}

.admin-topbar h1 {
    margin: 0 0 6px;
    font-size: 28px;
}

.admin-topbar p {
    margin: 0;
    color: var(--muted);
}

.flash {
    padding: 14px 16px;
    border-radius: 16px;
    margin-bottom: 18px;
    border: 1px solid rgba(255, 255, 255, 0.08);
}

.flash-success {
    background: rgba(61, 220, 151, 0.12);
    color: #c9ffe8;
}

.flash-error {
    background: rgba(255, 107, 129, 0.12);
    color: #ffd6de;
}

.flash-warning {
    background: rgba(255, 184, 77, 0.12);
    color: #ffe7bf;
}

.panel,
.table-card,
.login-card,
.install-card,
.stat-grid .stat-item {
    background: linear-gradient(180deg, rgba(18, 24, 37, 0.95), rgba(10, 13, 20, 0.98));
    border: 1px solid var(--line);
    border-radius: 24px;
    box-shadow: var(--shadow);
}

.panel,
.table-card,
.login-card,
.install-card {
    padding: 24px;
}

.panel + .panel,
.table-card + .table-card {
    margin-top: 20px;
}

.grid-2,
.grid-3 {
    display: grid;
    gap: 16px;
}

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

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

.full {
    grid-column: 1 / -1;
}

.form-actions {
    margin-top: 18px;
    display: flex;
    flex-wrap: wrap;
    gap: 12px;
}

.stat-grid {
    display: grid;
    grid-template-columns: repeat(5, minmax(0, 1fr));
    gap: 16px;
    margin-bottom: 20px;
}

.stat-grid .stat-item {
    padding: 20px;
}

.stat-item span {
    display: block;
    color: var(--muted);
    font-size: 13px;
    margin-bottom: 12px;
}

.stat-item strong {
    font-size: 30px;
}

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

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

th,
td {
    padding: 14px 10px;
    text-align: left;
    border-bottom: 1px solid rgba(255, 255, 255, 0.06);
    vertical-align: top;
}

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

.row-actions {
    display: flex;
    gap: 10px;
    flex-wrap: wrap;
}

.login-page,
.install-body {
    min-height: 100vh;
    display: grid;
    place-items: center;
    padding: 24px;
}

.login-card,
.install-card {
    width: min(980px, 100%);
}

.login-card {
    max-width: 460px;
}

.login-card h1,
.install-head h1 {
    margin: 0 0 10px;
    font-size: 34px;
}

.login-card p,
.install-head p {
    margin: 0 0 24px;
    color: var(--muted);
}

.eyebrow {
    display: inline-block;
    margin-bottom: 12px;
    padding: 8px 12px;
    border-radius: 999px;
    background: rgba(118, 104, 255, 0.12);
    color: #d7d0ff;
    font-size: 12px;
}

.install-wrapper {
    width: min(1080px, 100%);
}

.install-section + .install-section {
    margin-top: 24px;
}

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

.check-item {
    padding: 16px;
    border-radius: 18px;
    border: 1px solid rgba(255, 255, 255, 0.08);
    display: flex;
    justify-content: space-between;
    gap: 12px;
    align-items: center;
}

.check-item.ok {
    background: rgba(61, 220, 151, 0.06);
}

.check-item.bad {
    background: rgba(255, 107, 129, 0.06);
}

.install-actions {
    margin-top: 24px;
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 14px;
}

.list-editor {
    display: grid;
    gap: 18px;
}

.editor-card {
    padding: 20px;
    border-radius: 20px;
    background: rgba(255, 255, 255, 0.03);
    border: 1px solid rgba(255, 255, 255, 0.06);
}

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

.chip {
    display: inline-flex;
    padding: 6px 10px;
    border-radius: 999px;
    background: rgba(118, 104, 255, 0.12);
    font-size: 12px;
}

.table-thumb {
    width: 90px;
    height: 58px;
    border-radius: 10px;
    object-fit: cover;
    background: rgba(255, 255, 255, 0.06);
}

.editor-preview-image {
    width: min(100%, 280px);
    border-radius: 14px;
    object-fit: cover;
    box-shadow: 0 16px 32px rgba(0, 0, 0, 0.25);
}

.media-input-group {
    display: flex;
    gap: 10px;
    align-items: center;
}

.media-input-group input[type="text"] {
    flex: 1;
}

.inline-upload-button {
    white-space: nowrap;
    min-width: 104px;
}

.inline-upload-status {
    display: inline-block;
    margin-top: 8px;
    font-size: 12px;
    color: var(--muted);
}

.inline-upload-status.is-success {
    color: #aef2de;
}

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

    .admin-sidebar {
        position: relative;
        height: auto;
    }

    .sidebar-foot {
        position: static;
        margin-top: 24px;
    }

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

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

    .media-input-group {
        flex-direction: column;
        align-items: stretch;
    }

    .admin-main {
        padding: 18px;
    }

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