:root {
    --bg: #070a12;
    --bg-2: #0b101c;
    --panel: rgba(18, 25, 41, 0.86);
    --panel-solid: #111827;
    --panel-soft: rgba(124, 156, 255, 0.06);
    --line: rgba(126, 158, 255, 0.14);
    --line-strong: rgba(126, 158, 255, 0.32);
    --text: #e8edf9;
    --muted: #8d9ab7;
    --accent: #7c9cff;
    --accent-2: #4fe0c0;
    --danger: #ff6b81;
    --warn: #ffc56b;
    --ok: #4fe0c0;
    --radius: 16px;
    --radius-sm: 10px;
    --shadow: 0 24px 60px rgba(2, 6, 18, 0.55);
    --font: -apple-system, BlinkMacSystemFont, "Segoe UI", "PingFang SC", "Microsoft YaHei", "Helvetica Neue", Arial, sans-serif;
    --mono: "SFMono-Regular", Consolas, "Liberation Mono", Menlo, monospace;
}

* {
    box-sizing: border-box;
}

html,
body {
    margin: 0;
    padding: 0;
}

body {
    min-height: 100vh;
    color: var(--text);
    font-family: var(--font);
    font-size: 14px;
    line-height: 1.6;
    background:
        radial-gradient(1100px 600px at 12% -10%, rgba(93, 124, 255, 0.22), transparent 60%),
        radial-gradient(900px 520px at 96% 4%, rgba(79, 224, 192, 0.12), transparent 55%),
        radial-gradient(700px 500px at 60% 110%, rgba(126, 96, 255, 0.14), transparent 60%),
        var(--bg);
    background-attachment: fixed;
    -webkit-font-smoothing: antialiased;
}

a {
    color: var(--accent);
    text-decoration: none;
}

a:hover {
    color: #a8bcff;
}

h1,
h2,
h3 {
    margin: 0;
    font-weight: 650;
    letter-spacing: 0.01em;
}

h1 {
    font-size: 22px;
}

h2 {
    font-size: 15px;
    color: #dfe7ff;
}

p {
    margin: 0 0 8px;
}

code,
pre {
    font-family: var(--mono);
    font-size: 12.5px;
}

code {
    color: #cfe0ff;
    background: rgba(124, 156, 255, 0.08);
    border: 1px solid rgba(124, 156, 255, 0.14);
    border-radius: 6px;
    padding: 1px 6px;
}

pre {
    margin: 0;
    padding: 14px 16px;
    background: rgba(6, 10, 20, 0.72);
    border: 1px solid var(--line);
    border-radius: var(--radius-sm);
    color: #c9d6f5;
    overflow-x: auto;
    white-space: pre-wrap;
    word-break: break-word;
}

/* ---------- 布局 ---------- */

.shell {
    display: flex;
    min-height: 100vh;
}

.sidebar {
    position: sticky;
    top: 0;
    display: flex;
    flex-direction: column;
    gap: 24px;
    width: 248px;
    flex: 0 0 248px;
    height: 100vh;
    padding: 24px 18px;
    background: linear-gradient(180deg, rgba(14, 20, 35, 0.94), rgba(9, 13, 24, 0.86));
    border-right: 1px solid var(--line);
    backdrop-filter: blur(18px);
    z-index: 40;
}

.brand {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 4px 8px;
}

.brand-mark {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 38px;
    height: 38px;
    border-radius: 12px;
    font-weight: 800;
    font-size: 18px;
    color: #08101f;
    background: linear-gradient(135deg, var(--accent-2), #7c9cff);
    box-shadow: 0 8px 22px rgba(79, 224, 192, 0.28);
}

.brand-mark-lg {
    width: 46px;
    height: 46px;
    font-size: 22px;
    border-radius: 14px;
}

.brand-text {
    display: flex;
    flex-direction: column;
    line-height: 1.25;
}

.brand-text strong {
    font-size: 16px;
    letter-spacing: 0.04em;
}

.brand-text small {
    color: var(--muted);
    font-size: 11.5px;
}

.nav {
    display: flex;
    flex-direction: column;
    gap: 4px;
}

.nav-item {
    display: block;
    padding: 10px 14px;
    border-radius: var(--radius-sm);
    color: #b9c4dd;
    border: 1px solid transparent;
    transition: background 0.15s ease, color 0.15s ease, border-color 0.15s ease;
}

.nav-item:hover {
    background: var(--panel-soft);
    color: #eef2ff;
}

.nav-item.is-active {
    color: #fff;
    background: linear-gradient(90deg, rgba(124, 156, 255, 0.24), rgba(79, 224, 192, 0.08));
    border-color: var(--line-strong);
    box-shadow: inset 0 0 0 1px rgba(255, 255, 255, 0.02);
}

.sidebar-foot {
    margin-top: auto;
    display: flex;
    justify-content: space-between;
    padding: 12px 10px 0;
    border-top: 1px solid var(--line);
    color: var(--muted);
    font-size: 11.5px;
}

.main {
    flex: 1;
    min-width: 0;
    display: flex;
    flex-direction: column;
}

.topbar {
    position: sticky;
    top: 0;
    z-index: 30;
    display: flex;
    align-items: center;
    gap: 14px;
    padding: 16px 28px;
    border-bottom: 1px solid var(--line);
    background: rgba(8, 12, 22, 0.78);
    backdrop-filter: blur(16px);
}

.topbar-title {
    font-size: 14px;
    font-weight: 600;
    color: #cfdaef;
}

.topbar-actions {
    margin-left: auto;
    display: flex;
    align-items: center;
    gap: 12px;
}

.user-chip {
    padding: 5px 12px;
    border-radius: 999px;
    border: 1px solid var(--line);
    background: rgba(124, 156, 255, 0.07);
    color: #cdd8f1;
    font-size: 12px;
}

.menu-btn {
    display: none;
}

.content {
    padding: 26px 28px 60px;
    max-width: 1320px;
    width: 100%;
}

/* ---------- 组件 ---------- */

.page-head {
    display: flex;
    align-items: flex-end;
    justify-content: space-between;
    gap: 18px;
    flex-wrap: wrap;
    margin-bottom: 22px;
}

.page-head .sub {
    margin: 6px 0 0;
    color: var(--muted);
    font-size: 12.5px;
}

.grid {
    display: grid;
    gap: 18px;
    margin-bottom: 18px;
}

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

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

.stack {
    display: flex;
    flex-direction: column;
    gap: 18px;
}

.card {
    background: var(--panel);
    border: 1px solid var(--line);
    border-radius: var(--radius);
    padding: 20px 22px;
    box-shadow: var(--shadow);
    backdrop-filter: blur(10px);
}

.card > h2 {
    margin-bottom: 14px;
}

.card-head {
    display: flex;
    align-items: baseline;
    justify-content: space-between;
    gap: 12px;
    margin-bottom: 14px;
}

.card-head h2 {
    margin: 0;
}

.stat {
    display: flex;
    flex-direction: column;
    gap: 4px;
    min-height: 118px;
}

.stat-label {
    color: var(--muted);
    font-size: 12px;
    letter-spacing: 0.06em;
    text-transform: uppercase;
}

.stat-value {
    font-size: 26px;
    font-weight: 700;
    letter-spacing: 0.01em;
    background: linear-gradient(120deg, #ffffff, #9fb6ff);
    -webkit-background-clip: text;
    background-clip: text;
    color: transparent;
    word-break: break-all;
}

.stat-meta {
    color: var(--muted);
    font-size: 12px;
}

.hint {
    color: var(--muted);
    font-size: 12px;
}

.hint code {
    font-size: 11.5px;
}

.empty {
    padding: 26px 10px;
    text-align: center;
    color: var(--muted);
}

/* ---------- 按钮 ---------- */

.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
    padding: 9px 16px;
    border-radius: 10px;
    border: 1px solid var(--line-strong);
    background: rgba(124, 156, 255, 0.1);
    color: #dbe4ff;
    font-family: inherit;
    font-size: 13px;
    font-weight: 600;
    cursor: pointer;
    transition: transform 0.12s ease, background 0.15s ease, border-color 0.15s ease;
    white-space: nowrap;
}

.btn:hover {
    background: rgba(124, 156, 255, 0.18);
    border-color: rgba(126, 158, 255, 0.5);
    color: #fff;
    text-decoration: none;
}

.btn:active {
    transform: translateY(1px);
}

.btn-primary {
    background: linear-gradient(135deg, #6f8cff, #4fd6c8);
    border-color: transparent;
    color: #071019;
    box-shadow: 0 12px 26px rgba(90, 140, 255, 0.28);
}

.btn-primary:hover {
    color: #03080f;
    box-shadow: 0 14px 30px rgba(90, 140, 255, 0.36);
}

.btn-ghost {
    background: transparent;
    border-color: var(--line);
    color: #b9c6e0;
}

.btn-danger {
    background: rgba(255, 107, 129, 0.12);
    border-color: rgba(255, 107, 129, 0.35);
    color: #ffb6c1;
}

.btn-danger:hover {
    background: rgba(255, 107, 129, 0.22);
    color: #ffe1e6;
}

.btn-small {
    padding: 6px 12px;
    font-size: 12px;
}

.btn-tiny {
    padding: 3px 9px;
    font-size: 11.5px;
    border-radius: 7px;
    font-weight: 600;
}

.btn-block {
    width: 100%;
}

.icon-btn {
    border: 1px solid var(--line);
    background: rgba(124, 156, 255, 0.06);
    color: #cfd9f2;
    border-radius: 10px;
    width: 36px;
    height: 34px;
    cursor: pointer;
    font-size: 15px;
}

.inline-form {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    margin: 0;
}

.row-actions {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
    justify-content: flex-end;
}

.mt {
    margin-top: 14px;
}

/* ---------- 表单 ---------- */

.form {
    display: flex;
    flex-direction: column;
    gap: 14px;
}

.field {
    display: flex;
    flex-direction: column;
    gap: 6px;
    font-size: 12.5px;
    color: #b9c5df;
    min-width: 0;
}

.field > span {
    font-weight: 600;
    letter-spacing: 0.01em;
}

.field input[type="text"],
.field input[type="password"],
.field input[type="number"],
.field input[type="file"],
.field select,
.field textarea,
.topbar input,
.page-head input[type="text"] {
    width: 100%;
    padding: 10px 12px;
    border-radius: 10px;
    border: 1px solid var(--line);
    background: rgba(6, 10, 20, 0.72);
    color: var(--text);
    font-family: inherit;
    font-size: 13px;
    outline: none;
    transition: border-color 0.15s ease, box-shadow 0.15s ease;
}

.field input:focus,
.field select:focus,
.field textarea:focus {
    border-color: rgba(126, 158, 255, 0.6);
    box-shadow: 0 0 0 3px rgba(124, 156, 255, 0.14);
}

.field textarea {
    resize: vertical;
    min-height: 80px;
    line-height: 1.55;
}

.field input[type="file"] {
    padding: 8px;
    cursor: pointer;
}

.field select {
    appearance: none;
}

.field.checkbox {
    flex-direction: row;
    align-items: center;
    gap: 8px;
    padding: 8px 10px;
    border: 1px solid var(--line);
    border-radius: 10px;
    background: rgba(6, 10, 20, 0.4);
}

.field.checkbox input {
    width: 16px;
    height: 16px;
    accent-color: #6f8cff;
}

.field.checkbox span,
.field.checkbox label {
    font-weight: 500;
    color: #c5d0e8;
    cursor: pointer;
}

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

.form-inline {
    flex-direction: row;
    align-items: flex-end;
    flex-wrap: wrap;
    gap: 12px;
    margin-bottom: 16px;
}

.form-inline .field {
    min-width: 150px;
}

.form-inline .field.grow {
    flex: 1 1 240px;
}

.form-inline .btn {
    margin-bottom: 2px;
}

.page-head form {
    display: flex;
    gap: 8px;
    align-items: center;
}

.page-head form input[type="text"] {
    padding: 8px 12px;
    border-radius: 9px;
    border: 1px solid var(--line);
    background: rgba(6, 10, 20, 0.72);
    color: var(--text);
    font-family: inherit;
    font-size: 12.5px;
    outline: none;
}

/* ---------- 表格 ---------- */

.table-wrap {
    width: 100%;
    overflow-x: auto;
}

.table {
    width: 100%;
    border-collapse: collapse;
    font-size: 12.5px;
    min-width: 640px;
}

.table th,
.table td {
    padding: 10px 12px;
    text-align: left;
    border-bottom: 1px solid rgba(126, 158, 255, 0.08);
    vertical-align: middle;
}

.table th {
    color: var(--muted);
    font-size: 11px;
    letter-spacing: 0.06em;
    text-transform: uppercase;
    font-weight: 600;
    white-space: nowrap;
}

.table tbody tr:hover {
    background: rgba(124, 156, 255, 0.045);
}

.table tbody tr:last-child td {
    border-bottom: none;
}

.ta-right {
    text-align: right;
}

.nowrap {
    white-space: nowrap;
}

.ua {
    max-width: 260px;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    color: var(--muted);
}

.sha {
    font-family: var(--mono);
    font-size: 11.5px;
    color: #9fb3dd;
}

.break {
    word-break: break-all;
}

.align-top {
    align-items: flex-start;
}

/* ---------- 徽章 / KV ---------- */

.badge {
    display: inline-flex;
    align-items: center;
    padding: 2px 9px;
    border-radius: 999px;
    font-size: 11px;
    font-weight: 600;
    border: 1px solid transparent;
    line-height: 1.6;
    vertical-align: middle;
    margin-left: 6px;
}

.badge:first-child {
    margin-left: 0;
}

.badge-stable {
    color: #8fe8d6;
    background: rgba(79, 224, 192, 0.12);
    border-color: rgba(79, 224, 192, 0.3);
}

.badge-beta {
    color: #ffd28c;
    background: rgba(255, 197, 107, 0.12);
    border-color: rgba(255, 197, 107, 0.3);
}

.badge-current {
    color: #c3d0ff;
    background: rgba(124, 156, 255, 0.16);
    border-color: rgba(124, 156, 255, 0.4);
}

.badge-ok {
    color: #9af0d9;
    background: rgba(79, 224, 192, 0.1);
    border-color: rgba(79, 224, 192, 0.26);
}

.badge-muted {
    color: #9aa6c0;
    background: rgba(140, 155, 185, 0.12);
    border-color: rgba(140, 155, 185, 0.24);
}

.badge-warn {
    color: #ffd28c;
    background: rgba(255, 197, 107, 0.12);
    border-color: rgba(255, 197, 107, 0.3);
}

.kv {
    display: flex;
    gap: 16px;
    align-items: baseline;
    justify-content: space-between;
    padding: 8px 0;
    border-bottom: 1px dashed rgba(126, 158, 255, 0.1);
    font-size: 12.5px;
}

.kv:last-child {
    border-bottom: none;
}

.kv > span:first-child {
    color: var(--muted);
    flex: 0 0 auto;
}

.kv code {
    font-size: 11.5px;
    max-width: 100%;
}

.copy-line {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    flex-wrap: wrap;
    justify-content: flex-end;
}

.changelog {
    white-space: pre-wrap;
    word-break: break-word;
    max-height: 320px;
    overflow-y: auto;
}

.code-block {
    background: rgba(5, 9, 18, 0.8);
    border: 1px solid var(--line);
    border-radius: var(--radius-sm);
    padding: 14px 16px;
    color: #b9cdf4;
    white-space: pre-wrap;
    word-break: break-word;
}

.secret-box {
    display: flex;
    align-items: center;
    gap: 10px;
    flex-wrap: wrap;
    margin-top: 8px;
    padding: 10px 12px;
    border-radius: 10px;
    border: 1px dashed rgba(126, 158, 255, 0.4);
    background: rgba(6, 10, 20, 0.7);
}

.secret-box code {
    flex: 1 1 260px;
    word-break: break-all;
    border: none;
    background: transparent;
    font-size: 13px;
    color: #d7e4ff;
}

/* ---------- 提示 ---------- */

.flashes {
    display: flex;
    flex-direction: column;
    gap: 10px;
    margin-bottom: 18px;
}

.flash {
    padding: 12px 16px;
    border-radius: var(--radius-sm);
    border: 1px solid var(--line);
    background: rgba(17, 24, 40, 0.9);
    font-size: 13px;
}

.flash-msg {
    white-space: pre-wrap;
    word-break: break-word;
}

.flash-success {
    border-color: rgba(79, 224, 192, 0.3);
    background: rgba(79, 224, 192, 0.08);
    color: #b6f2e3;
}

.flash-error {
    border-color: rgba(255, 107, 129, 0.34);
    background: rgba(255, 107, 129, 0.09);
    color: #ffc9d1;
}

.flash-info {
    border-color: rgba(124, 156, 255, 0.3);
    background: rgba(124, 156, 255, 0.08);
    color: #ccd9ff;
}

.flash-token {
    border-color: rgba(255, 197, 107, 0.34);
    background: rgba(255, 197, 107, 0.08);
    color: #ffe1b0;
}

.timeline {
    list-style: none;
    margin: 0;
    padding: 0;
    display: flex;
    flex-direction: column;
    gap: 14px;
}

.timeline li {
    display: flex;
    gap: 12px;
}

.timeline-dot {
    flex: 0 0 auto;
    width: 8px;
    height: 8px;
    margin-top: 7px;
    border-radius: 50%;
    background: linear-gradient(135deg, var(--accent-2), var(--accent));
    box-shadow: 0 0 0 4px rgba(124, 156, 255, 0.1);
}

.timeline strong {
    font-size: 12.5px;
    color: #dbe5fb;
}

.timeline p {
    margin: 2px 0;
    color: #a9b6d2;
    font-size: 12.5px;
    word-break: break-word;
}

.timeline small {
    color: var(--muted);
    font-size: 11.5px;
}

.checklist {
    margin: 0;
    padding-left: 18px;
    color: #b9c6e0;
    font-size: 12.5px;
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.checklist li::marker {
    color: var(--accent-2);
}

details.details {
    margin-top: 16px;
    border-top: 1px dashed rgba(126, 158, 255, 0.16);
    padding-top: 14px;
}

details.details summary {
    cursor: pointer;
    color: #c9d5ee;
    font-weight: 600;
    font-size: 13px;
    list-style: none;
}

details.details summary::-webkit-details-marker {
    display: none;
}

details.details summary::after {
    content: "+";
    float: right;
    color: var(--accent);
}

details.details[open] summary::after {
    content: "−";
}

.pagination {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 14px;
    padding-top: 16px;
}

/* ---------- 登录 / 空状态 ---------- */

.is-bare {
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 40px 18px;
}

.auth-shell {
    width: 100%;
    display: flex;
    justify-content: center;
}

.auth-card {
    width: 100%;
    max-width: 420px;
    padding: 32px 30px;
    border-radius: 22px;
    border: 1px solid var(--line-strong);
    background: linear-gradient(180deg, rgba(20, 28, 47, 0.94), rgba(9, 14, 26, 0.94));
    box-shadow: 0 30px 80px rgba(2, 6, 18, 0.7);
}

.auth-card h1 {
    margin: 20px 0 18px;
    font-size: 20px;
}

.auth-brand {
    display: flex;
    align-items: center;
    gap: 14px;
}

.auth-brand strong {
    display: block;
    font-size: 15px;
}

.auth-brand small {
    color: var(--muted);
    font-size: 12px;
}

.auth-card .hint {
    margin-top: 14px;
    line-height: 1.7;
}

.auth-card .code-block {
    margin: 12px 0;
    font-size: 12px;
}

.auth-card .flash {
    margin-bottom: 14px;
}

/* ---------- 响应式 ---------- */

@media (max-width: 1100px) {
    .grid-4 {
        grid-template-columns: repeat(2, minmax(0, 1fr));
    }
}

@media (max-width: 920px) {
    .sidebar {
        position: fixed;
        left: 0;
        top: 0;
        transform: translateX(-102%);
        transition: transform 0.22s ease;
        box-shadow: 0 20px 60px rgba(0, 0, 0, 0.55);
    }

    body.nav-open .sidebar {
        transform: translateX(0);
    }

    body.nav-open::before {
        content: "";
        position: fixed;
        inset: 0;
        background: rgba(3, 6, 14, 0.62);
        z-index: 35;
    }

    .menu-btn {
        display: inline-flex;
        align-items: center;
        justify-content: center;
    }

    .content {
        padding: 22px 18px 50px;
    }

    .topbar {
        padding: 14px 18px;
    }
}

@media (max-width: 820px) {
    .grid-2 {
        grid-template-columns: minmax(0, 1fr);
    }

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

    .form-inline {
        flex-direction: column;
        align-items: stretch;
    }

    .form-inline .field {
        min-width: 0;
    }

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

@media (max-width: 560px) {
    .grid-4 {
        grid-template-columns: minmax(0, 1fr);
    }

    .topbar-title {
        display: none;
    }

    .stat-value {
        font-size: 22px;
    }
}

@media (prefers-reduced-motion: reduce) {
    * {
        animation-duration: 0.001ms !important;
        transition-duration: 0.001ms !important;
    }
}
