:root {
    --bg: #070809;
    --panel: rgba(16, 18, 21, .86);
    --line: rgba(255, 255, 255, .08);
    --text: #e7eeea;
    --muted: #8d9893;
    --green: #1fdb78;
    --green-deep: #128a48;
    --danger: #ff6b78;
    --shadow: 0 24px 60px rgba(0, 0, 0, .38);
    font-family: "Segoe UI Variable Text", "Segoe UI", "PingFang SC", "Microsoft YaHei", sans-serif;
}

* { box-sizing: border-box; }
[hidden] { display: none !important; }
html, body { margin: 0; min-height: 100%; }
body {
    color: var(--text);
    background: var(--bg);
    font-size: 14px;
    -webkit-font-smoothing: antialiased;
}
button, input, select, textarea { font: inherit; color: inherit; }
button { cursor: pointer; }
a { color: #d5ffe8; }
::selection { background: rgba(31, 219, 120, .28); }
::-webkit-scrollbar { width: 10px; height: 10px; }
::-webkit-scrollbar-thumb { background: #2c3330; border-radius: 99px; }
:focus-visible { outline: 2px solid rgba(31, 219, 120, .75); outline-offset: 2px; }

#scene {
    position: fixed;
    inset: 0;
    width: 100%;
    height: 100%;
    z-index: 0;
    pointer-events: none;
}
.admin-body #scene { opacity: .55; }

.login-body { min-height: 100vh; }
.login-wrap {
    position: relative;
    z-index: 1;
    min-height: 100vh;
    display: flex;
    justify-content: center;
    padding: 36px 16px;
}
.login-card { margin: auto; }
.login-card {
    width: min(440px, 100%);
    padding: 32px 30px 26px;
    border-radius: 22px;
    background: linear-gradient(180deg, rgba(22, 26, 30, .78), rgba(8, 10, 12, .84));
    border: 1px solid rgba(255, 255, 255, .1);
    box-shadow: var(--shadow), inset 0 1px 0 rgba(255, 255, 255, .14);
    backdrop-filter: blur(18px);
    transform: perspective(900px) rotateX(var(--rx, 0deg)) rotateY(var(--ry, 0deg));
}
.install-card { width: min(520px, 100%); }
.brand-lockup, .logo { display: flex; align-items: center; gap: 12px; color: inherit; text-decoration: none; }
.brand-lockup h1, .page-head h1, .card h2 { margin: 0; letter-spacing: -.03em; }
.brand-lockup p, .login-note, .hint, .page-head p { color: var(--muted); }
.login-note { margin: 14px 0 0; text-align: center; letter-spacing: .22em; color: #d7ffe8; }
.login-card label, .field, .form-grid label {
    display: flex;
    flex-direction: column;
    gap: 8px;
    margin: 14px 0;
    color: #c5d0cb;
    font-size: 13px;
}
input, select, textarea {
    width: 100%;
    border: 1px solid rgba(255, 255, 255, .1);
    background: rgba(0, 0, 0, .35);
    border-radius: 12px;
    padding: 11px 12px;
    outline: none;
}
textarea { resize: vertical; line-height: 1.55; }
input:focus, select:focus, textarea:focus { border-color: rgba(31, 219, 120, .7); }
.voice-cell audio { width: 180px; height: 32px; }
.voice-cell form { margin-top: 8px; }
.remark-form { display: flex; gap: 8px; align-items: center; }
.remark-form input { width: 140px; }
.remark-form .btn-ghost { flex: none; white-space: nowrap; }
.bind-list { display: flex; flex-wrap: wrap; gap: 8px 14px; margin: 8px 0; }
.bind-list label { flex-direction: row; align-items: center; gap: 6px; margin: 0; }
.bind-list input { width: auto; }
.btn-go, .btn-ghost, .text-btn, .link-danger {
    border: 0;
    border-radius: 12px;
    text-decoration: none;
}
.btn-go {
    height: 42px;
    padding: 0 16px;
    background: linear-gradient(180deg, #2ee58a, #149552);
    color: #04210f;
    font-weight: 700;
    box-shadow: 0 10px 24px rgba(31, 219, 120, .22), inset 0 1px 0 rgba(255, 255, 255, .35);
}
.btn-go:disabled { opacity: .45; cursor: not-allowed; }
.btn-ghost {
    height: 38px;
    padding: 0 12px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    background: rgba(255, 255, 255, .04);
    border: 1px solid var(--line);
    color: var(--text);
}
.block { width: 100%; }
.text-btn, .link-danger { background: none; color: var(--muted); padding: 0; }
.link-danger { color: var(--danger); }
.text-link { color: var(--green); }
.form-error, .flash.bad {
    background: rgba(255, 107, 120, .12);
    color: #ffd0d5;
    border: 1px solid rgba(255, 107, 120, .3);
    border-radius: 12px;
    padding: 10px 12px;
}
.form-ok, .flash.ok, .flash {
    background: rgba(31, 219, 120, .1);
    color: #d9ffe9;
    border: 1px solid rgba(31, 219, 120, .24);
    border-radius: 12px;
    padding: 10px 12px;
    margin-bottom: 14px;
}
.ext-list { list-style: none; padding: 0; margin: 8px 0 16px; display: flex; flex-wrap: wrap; gap: 8px; }
.ext-list li { padding: 6px 10px; border-radius: 999px; background: rgba(255,255,255,.04); font-size: 12px; }
.ext-list li.ok { color: #b9f5d4; }
.ext-list li.bad { color: #ffb4bb; }
.sql-help {
    margin: 0 0 14px;
    padding: 12px;
    overflow: auto;
    border-radius: 12px;
    background: rgba(0, 0, 0, .45);
    color: #d7ffe8;
    font-family: Consolas, "Cascadia Mono", monospace;
    font-size: 12px;
    line-height: 1.55;
    white-space: pre-wrap;
}

.admin-shell {
    position: relative;
    z-index: 1;
    min-height: 100vh;
    display: grid;
    grid-template-columns: 248px minmax(0, 1fr);
}
.side {
    display: flex;
    flex-direction: column;
    padding: 18px 14px 14px;
    background: linear-gradient(180deg, rgba(14, 16, 18, .92), rgba(7, 8, 10, .88));
    border-right: 1px solid var(--line);
    backdrop-filter: blur(16px);
    position: sticky;
    top: 0;
    height: 100vh;
}
.side .logo { padding: 4px 8px 12px; font-weight: 700; }
.tree { display: flex; flex-direction: column; }
.tree-label {
    margin: 16px 12px 6px;
    color: #6d7772;
    font-size: 11px;
    letter-spacing: .16em;
}
.tree a {
    height: 38px;
    display: flex;
    align-items: center;
    padding: 0 12px;
    border-radius: 10px;
    color: #d5ddd9;
    text-decoration: none;
}
.tree a.on, .tree a:hover { background: rgba(31, 219, 120, .12); color: white; }
.side-user {
    margin-top: auto;
    padding: 12px;
    border-radius: 16px;
    background: rgba(255, 255, 255, .03);
    border: 1px solid var(--line);
    box-shadow: inset 0 1px 0 rgba(255, 255, 255, .06), 0 16px 30px rgba(0, 0, 0, .25);
}
.who { display: flex; gap: 10px; align-items: center; }
.who b, .who small { display: block; }
.who small { color: var(--muted); }
.avatar {
    width: 34px;
    height: 34px;
    border-radius: 50%;
    display: grid;
    place-items: center;
    background: radial-gradient(circle at 30% 30%, #2ee58a, #0d6b38);
    color: #04210f;
    font-weight: 800;
}
.token-pill {
    margin-top: 12px;
    display: flex;
    justify-content: space-between;
    align-items: baseline;
    padding: 8px 10px;
    border-radius: 12px;
    text-decoration: none;
    background: rgba(31, 219, 120, .08);
    color: #dcffe9;
}
.token-pill strong { font-size: 20px; font-variant-numeric: tabular-nums; }
.logout, .dock-foot a { color: var(--muted); font-size: 12px; }
.main { padding: 26px 28px 48px; min-width: 0; }
.page-head { display: flex; justify-content: space-between; gap: 16px; align-items: flex-end; margin-bottom: 18px; }
.page-head h1 { font-size: 28px; }
.page-head select { width: 180px; }
.card {
    margin-bottom: 16px;
    padding: 16px 18px 18px;
    border-radius: 18px;
    background: rgba(16, 18, 22, .78);
    border: 1px solid var(--line);
    box-shadow: var(--shadow), inset 0 1px 0 rgba(255, 255, 255, .05);
    backdrop-filter: blur(10px);
}
.card h2 { margin-bottom: 12px; font-size: 16px; }
.stat-grid, .split, .media-grid { display: grid; gap: 14px; }
.stat-grid { grid-template-columns: repeat(3, minmax(0, 1fr)); margin-bottom: 16px; }
.split { grid-template-columns: 1fr 1fr; }
.stat {
    padding: 16px 16px 14px;
    border-radius: 16px;
    background: linear-gradient(180deg, rgba(28, 34, 31, .92), rgba(12, 14, 16, .92));
    border: 1px solid var(--line);
    box-shadow: inset 0 1px 0 rgba(255, 255, 255, .08), 0 16px 30px rgba(0, 0, 0, .25);
}
.stat em { color: var(--green); font-style: normal; font-size: 12px; }
.stat b { display: block; margin: 8px 0 2px; font-size: 30px; font-variant-numeric: tabular-nums; letter-spacing: -.04em; }
.stat span, .media-meta p { color: var(--muted); }
.tabs { display: flex; gap: 8px; margin: 6px 0 14px; }
.tabs a {
    padding: 7px 12px;
    border-radius: 999px;
    text-decoration: none;
    color: var(--muted);
    border: 1px solid transparent;
}
.tabs a.on { color: #04210f; background: var(--green); font-weight: 700; }
.bars { display: flex; flex-direction: column; gap: 8px; }
.bar-row { display: grid; grid-template-columns: 72px 1fr 48px; gap: 8px; align-items: center; font-variant-numeric: tabular-nums; font-size: 12px; }
.bar-track { height: 8px; border-radius: 99px; background: rgba(255,255,255,.06); overflow: hidden; }
.bar-fill { display: block; height: 100%; background: linear-gradient(90deg, #128a48, #1fdb78); }
.bar-fill.alt { background: linear-gradient(90deg, #245c86, #8fd0ff); }
.table-wrap { overflow: auto; }
table { width: 100%; border-collapse: collapse; }
th, td { padding: 12px 10px; text-align: left; border-bottom: 1px solid rgba(255,255,255,.06); vertical-align: middle; }
th { color: var(--muted); font-size: 12px; font-weight: 600; }
td small { display: block; color: var(--muted); }
.num { font-variant-numeric: tabular-nums; }
.up { color: #8dffc4; }
.down { color: #ff9aa4; }
.tag { display: inline-flex; padding: 2px 8px; border-radius: 999px; background: rgba(255,255,255,.06); font-size: 12px; }
.tag.admin { color: #04210f; background: var(--green); }
.ops, .inline-form, .toolbar, .form-actions, .media-title { display: flex; gap: 8px; align-items: center; }
.inline-form input[type="number"] { width: 110px; }
.toolbar input { max-width: 240px; }
.form-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 0 16px; }
.form-actions { grid-column: 1 / -1; }
.media-grid { grid-template-columns: repeat(auto-fill, minmax(240px, 1fr)); }
.media-card {
    overflow: hidden;
    border-radius: 16px;
    background: rgba(16, 18, 22, .82);
    border: 1px solid var(--line);
}
.media-view { display: block; aspect-ratio: 4 / 3; background: #090b0c; }
.media-view img, .media-view video { width: 100%; height: 100%; object-fit: cover; }
.media-meta { padding: 12px; }
.media-meta .btn-go { display: inline-flex; align-items: center; margin-top: 8px; }
.media-actions { display: flex; gap: 12px; align-items: center; margin-top: 8px; }
.media-actions .btn-go { margin-top: 0; }
.media-actions form { margin: 0; }
details summary { cursor: pointer; color: var(--muted); }
.empty, .empty-block { color: var(--muted); }
.empty-block { padding: 36px 20px; text-align: center; }
.pager { display: flex; gap: 12px; align-items: center; justify-content: center; margin-top: 8px; }
.back-link { display: inline-block; margin-bottom: 8px; color: var(--muted); text-decoration: none; }
.back-link:hover { color: var(--text); }
.task-total { color: var(--muted); font-variant-numeric: tabular-nums; }
.task-list { display: flex; flex-direction: column; gap: 12px; }
.task-card {
    display: grid;
    grid-template-columns: 86px minmax(0, 1fr) auto;
    gap: 16px;
    align-items: center;
    padding: 12px;
    border-radius: 18px;
    text-decoration: none;
    color: inherit;
    background: rgba(16, 18, 22, .82);
    border: 1px solid var(--line);
    box-shadow: inset 0 1px 0 rgba(255, 255, 255, .05);
}
.task-card:hover { border-color: rgba(31, 219, 120, .45); }
.task-cover {
    width: 86px;
    height: 120px;
    border-radius: 12px;
    overflow: hidden;
    background: #090b0c;
}
.task-cover img, .task-cover video { width: 100%; height: 100%; object-fit: cover; display: block; }
.task-main { display: flex; flex-direction: column; gap: 6px; min-width: 0; }
.task-main strong { font-size: 18px; letter-spacing: -.03em; }
.task-main small, .task-file-body p { color: var(--muted); }
.task-pills { display: flex; flex-wrap: wrap; gap: 6px; }
.task-pills em {
    font-style: normal;
    padding: 3px 8px;
    border-radius: 999px;
    background: rgba(31, 219, 120, .1);
    color: #c8f5de;
    font-size: 12px;
}
.task-open {
    margin-right: 8px;
    padding: 8px 14px;
    border-radius: 999px;
    background: var(--green);
    color: #04210f;
    font-weight: 700;
}
.task-stats { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 12px; margin-bottom: 16px; }
.task-stats div {
    padding: 14px 16px;
    border-radius: 16px;
    background: rgba(16, 18, 22, .82);
    border: 1px solid var(--line);
}
.task-stats em { color: var(--green); font-style: normal; font-size: 12px; }
.task-stats b { display: block; margin-top: 6px; font-size: 26px; font-variant-numeric: tabular-nums; }
.task-files { display: grid; grid-template-columns: repeat(auto-fill, minmax(180px, 1fr)); gap: 14px; }
.task-file {
    overflow: hidden;
    border-radius: 18px;
    background: rgba(16, 18, 22, .82);
    border: 1px solid var(--line);
}
.task-preview { display: block; aspect-ratio: 9 / 16; background: #090b0c; }
.task-preview img, .task-preview video { width: 100%; height: 100%; object-fit: cover; display: block; }
.task-file-body { display: flex; flex-direction: column; gap: 8px; padding: 12px; }
.task-file-body .btn-go { display: flex; align-items: center; justify-content: center; }
.task-file-body form { margin: 0; }
@media (max-width: 720px) {
    .task-card { grid-template-columns: 72px minmax(0, 1fr); }
    .task-open { display: none; }
    .task-stats { grid-template-columns: 1fr; }
}

@media (max-width: 980px) {
    .admin-shell { grid-template-columns: 1fr; }
    .side { position: relative; height: auto; }
    .stat-grid, .split, .form-grid { grid-template-columns: 1fr; }
}
