:root {
    color-scheme: light;
    --bg: #e9eef6;
    --panel: rgba(255, 255, 255, .94);
    --panel-solid: #ffffff;
    --panel-soft: #f6f8fb;
    --text: #111827;
    --muted: #667085;
    --line: #d9e2ee;
    --line-soft: rgba(148, 163, 184, .24);
    --primary: #2563eb;
    --primary-dark: #173f9c;
    --primary-soft: rgba(37, 99, 235, .1);
    --danger: #d92d20;
    --success: #067647;
    --nav: #0a1020;
    --nav-2: #14213d;
    --gold: #c9a45c;
    --shadow: 0 28px 80px rgba(15, 23, 42, .16);
}

* {
    box-sizing: border-box;
}

body {
    margin: 0;
    color: var(--text);
    font-family: "Microsoft YaHei", "PingFang SC", Arial, sans-serif;
    background:
        linear-gradient(135deg, rgba(10, 16, 32, .08), transparent 36%),
        radial-gradient(circle at 18% 6%, rgba(37, 99, 235, .16), transparent 28%),
        radial-gradient(circle at 84% 0%, rgba(201, 164, 92, .18), transparent 26%),
        linear-gradient(180deg, #f7f9fc 0%, #e8eef7 100%);
}

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

button,
input,
select {
    font: inherit;
}

code {
    padding: 2px 6px;
    border-radius: 7px;
    background: #eef2f7;
}

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

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

.login-card,
.panel {
    border: 1px solid rgba(255, 255, 255, .8);
    border-radius: 8px;
    background: var(--panel);
    box-shadow: var(--shadow);
    backdrop-filter: blur(18px);
}

.login-card {
    width: min(430px, 100%);
    margin: 0 auto;
    padding: 34px;
}

.login-card h1,
.install-head h1,
.admin-topbar h1,
.panel h2 {
    margin: 5px 0 0;
    letter-spacing: 0;
}

.login-card h1,
.install-head h1,
.admin-topbar h1 {
    font-size: 30px;
}

.panel h2 {
    font-size: 20px;
}

.eyebrow {
    margin: 0;
    color: var(--primary);
    font-size: 12px;
    font-weight: 900;
    letter-spacing: 0;
    text-transform: uppercase;
}

.login-card label,
.form-stack label,
.form-grid label {
    display: grid;
    gap: 8px;
}

.login-card label {
    margin-top: 18px;
}

label span {
    color: #344054;
    font-size: 14px;
    font-weight: 800;
}

input,
select {
    width: 100%;
    height: 44px;
    border: 1px solid var(--line);
    border-radius: 8px;
    padding: 0 13px;
    outline: 0;
    color: var(--text);
    background: rgba(255, 255, 255, .9);
    transition: border-color .16s ease, box-shadow .16s ease, background .16s ease;
}

input:focus,
select:focus {
    border-color: rgba(37, 99, 235, .72);
    background: #fff;
    box-shadow: 0 0 0 4px rgba(37, 99, 235, .12);
}

.button {
    display: inline-flex;
    min-height: 42px;
    align-items: center;
    justify-content: center;
    border: 1px solid var(--line);
    border-radius: 8px;
    padding: 0 17px;
    color: #1f2937;
    font-weight: 800;
    background: #fff;
    box-shadow: 0 8px 18px rgba(15, 23, 42, .05);
    cursor: pointer;
    transition: transform .16s ease, box-shadow .16s ease, background .16s ease;
}

.button:hover {
    transform: translateY(-1px);
    box-shadow: 0 12px 24px rgba(15, 23, 42, .1);
}

.button.primary {
    border-color: transparent;
    color: #fff;
    background: linear-gradient(135deg, #1f4fbf, #102a6b);
}

.button.primary:hover {
    background: linear-gradient(135deg, #2f6fed, var(--primary-dark));
}

.button.full {
    width: 100%;
    margin-top: 22px;
}

.muted-link,
.ghost-link {
    color: var(--muted);
    font-size: 14px;
}

.ghost-link {
    min-height: 34px;
    border: 1px solid var(--line);
    border-radius: 8px;
    padding: 7px 11px;
    background: rgba(255, 255, 255, .68);
}

.panel-tools {
    display: flex;
    flex-wrap: wrap;
    justify-content: flex-end;
    gap: 8px;
}

.inline-action {
    display: contents;
}

.inline-action .ghost-link {
    cursor: pointer;
}

.muted-link {
    display: block;
    margin-top: 16px;
    text-align: center;
}

.notice {
    border: 1px solid var(--line);
    border-radius: 8px;
    margin: 0 0 18px;
    padding: 13px 15px;
    background: var(--panel-soft);
}

.notice.success {
    border-color: rgba(6, 118, 71, .2);
    color: var(--success);
    background: #ecfdf3;
}

.notice.danger {
    border-color: rgba(217, 45, 32, .2);
    color: var(--danger);
    background: #fef3f2;
}

.install-panel {
    padding: 30px;
}

.install-head,
.panel-head,
.admin-topbar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 16px;
    margin-bottom: 22px;
}

.requirements {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    margin-bottom: 22px;
}

.requirements span {
    border-radius: 999px;
    padding: 7px 12px;
    font-size: 13px;
    font-weight: 800;
}

.requirements .ok {
    color: var(--success);
    background: #dcfae6;
}

.requirements .bad {
    color: var(--danger);
    background: #fee4e2;
}

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

.form-actions {
    grid-column: 1 / -1;
}

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

.admin-page {
    min-height: 100vh;
    display: grid;
    grid-template-columns: 270px minmax(0, 1fr);
}

.sidebar {
    position: sticky;
    top: 0;
    display: flex;
    flex-direction: column;
    height: 100vh;
    border-right: 1px solid rgba(255, 255, 255, .08);
    padding: 24px;
    color: #fff;
    background:
        linear-gradient(180deg, rgba(20, 33, 61, .92), rgba(10, 16, 32, .98)),
        radial-gradient(circle at 18% 0%, rgba(201, 164, 92, .24), transparent 28%),
        radial-gradient(circle at 0% 20%, rgba(96, 165, 250, .22), transparent 32%),
        var(--nav);
    box-shadow: 24px 0 70px rgba(15, 23, 42, .22);
}

.brand {
    display: grid;
    grid-template-columns: 48px minmax(0, 1fr);
    align-items: center;
    gap: 12px;
    margin-bottom: 32px;
}

.brand span {
    display: grid;
    width: 48px;
    height: 48px;
    place-items: center;
    border: 1px solid rgba(255, 255, 255, .35);
    border-radius: 8px;
    color: #0a1020;
    font-weight: 900;
    background: linear-gradient(135deg, #f8e7bd, #94bfff);
    box-shadow: 0 14px 34px rgba(201, 164, 92, .22);
}

.brand span.brand-logo {
    padding: 4px;
    background: #fff;
}

.brand-logo img {
    width: 100%;
    height: 100%;
    object-fit: contain;
}

.brand strong {
    overflow: hidden;
    font-size: 17px;
    text-overflow: ellipsis;
    white-space: nowrap;
}

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

.sidebar nav a,
.sidebar-foot a {
    min-height: 44px;
    border: 1px solid transparent;
    border-radius: 8px;
    padding: 12px 13px;
    color: rgba(255, 255, 255, .74);
    font-weight: 700;
}

.sidebar nav a.active,
.sidebar nav a:hover,
.sidebar-foot a:hover {
    border-color: rgba(255, 255, 255, .16);
    color: #fff;
    background: linear-gradient(135deg, rgba(255, 255, 255, .12), rgba(255, 255, 255, .06));
}

.sidebar nav a.active {
    box-shadow: inset 3px 0 0 var(--gold), 0 14px 30px rgba(0, 0, 0, .12);
}

.sidebar-foot {
    display: grid;
    gap: 6px;
    margin-top: auto;
}

.admin-main {
    width: min(1320px, 100%);
    padding: 30px;
}

.admin-topbar {
    min-height: 104px;
    border: 1px solid rgba(255, 255, 255, .78);
    border-radius: 8px;
    margin-bottom: 20px;
    padding: 24px 28px;
    background:
        linear-gradient(135deg, rgba(255, 255, 255, .96), rgba(248, 251, 255, .82)),
        radial-gradient(circle at 88% 12%, rgba(201, 164, 92, .2), transparent 24%),
        radial-gradient(circle at 72% 0%, rgba(37, 99, 235, .15), transparent 26%);
    box-shadow: 0 22px 60px rgba(15, 23, 42, .1);
}

.admin-topbar h1 {
    font-size: 34px;
    color: #0f172a;
}

.admin-topbar .eyebrow {
    color: #8a6a24;
}

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

.stat-card {
    display: grid;
    gap: 10px;
    border: 1px solid rgba(255, 255, 255, .72);
    border-radius: 8px;
    padding: 22px;
    background:
        linear-gradient(180deg, #fff, #f8fbff),
        radial-gradient(circle at 100% 0%, rgba(201, 164, 92, .12), transparent 30%);
    box-shadow: 0 18px 46px rgba(15, 23, 42, .1);
}

.stat-card span {
    color: var(--muted);
    font-size: 14px;
    font-weight: 700;
}

.stat-card strong {
    font-size: 32px;
    line-height: 1;
}

.panel {
    padding: 25px;
    box-shadow: 0 22px 60px rgba(15, 23, 42, .11);
}

.action-grid {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
}

.admin-grid.two {
    display: grid;
    grid-template-columns: minmax(310px, 410px) minmax(0, 1fr);
    gap: 20px;
    align-items: start;
}

.form-stack {
    display: grid;
    gap: 16px;
}

.site-filter-bar {
    display: grid;
    grid-template-columns: minmax(160px, 240px) minmax(220px, 1fr) auto auto;
    align-items: end;
    gap: 12px;
    margin-bottom: 16px;
}

.site-filter-bar label {
    display: grid;
    gap: 8px;
}

.empty-cell {
    padding: 28px 12px;
    color: var(--muted);
    text-align: center;
}

.check-line {
    display: flex !important;
    grid-template-columns: none !important;
    align-items: center;
    gap: 10px !important;
}

.check-line input {
    width: 18px;
    height: 18px;
}

.check-line span {
    font-weight: 600;
}

.table-wrap {
    overflow-x: auto;
    border: 1px solid var(--line-soft);
    border-radius: 8px;
    background: rgba(255, 255, 255, .94);
    box-shadow: inset 0 1px 0 rgba(255, 255, 255, .7);
}

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

th,
td {
    border-bottom: 1px solid #edf1f6;
    padding: 14px 12px;
    text-align: left;
    vertical-align: middle;
}

tr:last-child td {
    border-bottom: 0;
}

tbody tr {
    transition: background .16s ease;
}

tbody tr:hover {
    background: #f8fbff;
}

th {
    color: #64748b;
    font-size: 13px;
    font-weight: 900;
    background: #f8fafc;
}

td small {
    display: block;
    max-width: 360px;
    overflow: hidden;
    color: var(--muted);
    text-overflow: ellipsis;
    white-space: nowrap;
}

.row-actions {
    display: flex;
    align-items: center;
    gap: 10px;
}

.row-actions a,
.row-actions button {
    border: 0;
    border-radius: 7px;
    padding: 6px 8px;
    color: var(--primary);
    font-weight: 800;
    background: var(--primary-soft);
    cursor: pointer;
}

.row-actions button {
    color: var(--danger);
    background: #fef3f2;
}

.settings-form {
    max-width: 1040px;
}

.media-grid {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 16px;
    margin: 18px 0;
}

.upload-box {
    display: grid;
    gap: 12px;
    border: 1px solid var(--line-soft);
    border-radius: 8px;
    padding: 16px;
    background: linear-gradient(180deg, #ffffff, #f8fafc);
}

.upload-box > span {
    color: #344054;
    font-weight: 900;
}

.upload-box img {
    width: 100%;
    aspect-ratio: 16 / 9;
    border-radius: 8px;
    object-fit: cover;
    background: #e4e9f1;
}

.upload-box audio {
    width: 100%;
}

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

.gallery-item {
    display: grid;
    gap: 8px;
    border: 1px solid var(--line);
    border-radius: 8px;
    padding: 8px;
    background: #fff;
}

.gallery-item img {
    aspect-ratio: 16 / 9;
}

.gallery-item small {
    overflow: hidden;
    color: var(--muted);
    text-overflow: ellipsis;
    white-space: nowrap;
}

.mini-danger {
    min-height: 31px;
    border: 1px solid rgba(217, 45, 32, .24);
    border-radius: 7px;
    color: var(--danger);
    font-weight: 800;
    background: #fff;
    cursor: pointer;
}

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

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

    .sidebar {
        position: static;
        height: auto;
    }

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

    .admin-grid.two,
    .stats-grid,
    .media-grid,
    .site-filter-bar {
        grid-template-columns: 1fr;
    }
}

@media (max-width: 640px) {
    .login-page,
    .install-page,
    .admin-main {
        padding: 16px;
    }

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

    .install-head,
    .panel-head,
    .admin-topbar {
        align-items: flex-start;
        flex-direction: column;
    }

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