/* ===== 全站样式：深色 + 蓝紫渐变，移动端优先 ===== */
:root {
    --bg: #0a0e15;
    --bg-soft: #0f151f;
    --panel: #141c28;
    --panel-2: #1b2634;
    --line: #253243;
    --line-soft: #1d2836;
    --text: #e8eef7;
    --muted: #8b9cb3;
    --pri: #3b82f6;
    --pri-2: #6366f1;
    --ok: #22c55e;
    --warn: #f59e0b;
    --danger: #ef4444;
    --radius: 14px;
    --shadow: 0 10px 30px rgba(0, 0, 0, .35);
}

* {
    box-sizing: border-box;
}

html, body {
    margin: 0;
    padding: 0;
}

body {
    background: radial-gradient(1100px 520px at 50% -12%, #17233a 0%, transparent 62%), var(--bg);
    background-color: var(--bg);
    color: var(--text);
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", "Microsoft YaHei", "PingFang SC", Roboto, Helvetica, Arial, sans-serif;
    font-size: 15px;
    line-height: 1.6;
    -webkit-font-smoothing: antialiased;
    min-height: 100vh;
}

a {
    color: var(--pri);
    text-decoration: none;
}

a:hover {
    text-decoration: underline;
}

/* ===== 顶栏 ===== */
.topbar {
    display: flex;
    align-items: center;
    gap: 14px;
    padding: 14px 20px;
    border-bottom: 1px solid var(--line-soft);
    background: rgba(10, 14, 21, .8);
    backdrop-filter: blur(8px);
    position: sticky;
    top: 0;
    z-index: 30;
}

.topbar .logo {
    display: flex;
    align-items: center;
    gap: 10px;
    font-weight: 700;
    font-size: 17px;
    color: var(--text);
}

.topbar .logo:hover {
    text-decoration: none;
}

.topbar .dot {
    width: 26px;
    height: 26px;
    border-radius: 8px;
    background: linear-gradient(135deg, var(--pri), var(--pri-2));
    display: inline-block;
}

.topbar nav {
    margin-left: auto;
    display: flex;
    gap: 8px;
    align-items: center;
    flex-wrap: wrap;
}

.topbar nav a {
    color: var(--muted);
    padding: 6px 12px;
    border-radius: 8px;
    font-size: 14px;
}

.topbar nav a:hover, .topbar nav a.on {
    color: var(--text);
    background: var(--panel-2);
    text-decoration: none;
}

/* ===== 布局 ===== */
.wrap {
    max-width: 1180px;
    margin: 0 auto;
    padding: 24px 20px 60px;
}

.wrap.narrow {
    max-width: 760px;
}

.card {
    background: var(--panel);
    border: 1px solid var(--line-soft);
    border-radius: var(--radius);
    padding: 20px;
    box-shadow: var(--shadow);
}

.card + .card {
    margin-top: 18px;
}

.card h2 {
    margin: 0 0 14px;
    font-size: 16px;
    font-weight: 600;
}

.card h2 .sub {
    font-weight: 400;
    color: var(--muted);
    font-size: 13px;
    margin-left: 8px;
}

.muted {
    color: var(--muted);
}

.small {
    font-size: 13px;
}

.center {
    text-align: center;
}

.row {
    display: flex;
    gap: 12px;
    flex-wrap: wrap;
    align-items: center;
}

.grow {
    flex: 1;
    min-width: 0;
}

.hidden {
    display: none !important;
}

footer.foot {
    text-align: center;
    color: var(--muted);
    font-size: 12px;
    padding: 20px;
}

/* ===== 按钮 ===== */
.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
    border: 1px solid var(--line);
    background: var(--panel-2);
    color: var(--text);
    padding: 10px 18px;
    border-radius: 10px;
    font-size: 14px;
    font-family: inherit;
    cursor: pointer;
    transition: .15s;
    white-space: nowrap;
}

.btn:hover {
    border-color: #35455a;
    background: #202c3c;
    text-decoration: none;
}

.btn:active {
    transform: translateY(1px);
}

.btn:disabled {
    opacity: .5;
    cursor: not-allowed;
}

.btn.pri {
    background: linear-gradient(135deg, var(--pri), var(--pri-2));
    border-color: transparent;
    color: #fff;
    font-weight: 600;
}

.btn.pri:hover {
    filter: brightness(1.08);
}

.btn.danger {
    color: #ffb4b4;
    border-color: #4a2530;
    background: #2a1720;
}

.btn.danger:hover {
    background: #3a1d28;
}

.btn.sm {
    padding: 6px 12px;
    font-size: 13px;
    border-radius: 8px;
}

.btn.block {
    width: 100%;
}

.btn.lg {
    padding: 14px 26px;
    font-size: 16px;
}

/* ===== 表单 ===== */
label.lab {
    display: block;
    font-size: 13px;
    color: var(--muted);
    margin-bottom: 6px;
}

input[type=text], input[type=password], input[type=number], select, textarea {
    width: 100%;
    background: var(--bg-soft);
    border: 1px solid var(--line);
    color: var(--text);
    border-radius: 10px;
    padding: 10px 12px;
    font-size: 15px;
    font-family: inherit;
    outline: none;
    transition: .15s;
}

input:focus, select:focus, textarea:focus {
    border-color: var(--pri);
    box-shadow: 0 0 0 3px rgba(59, 130, 246, .15);
}

select {
    appearance: none;
    background-image: linear-gradient(45deg, transparent 50%, var(--muted) 50%), linear-gradient(135deg, var(--muted) 50%, transparent 50%);
    background-position: calc(100% - 18px) 50%, calc(100% - 13px) 50%;
    background-size: 5px 5px, 5px 5px;
    background-repeat: no-repeat;
    padding-right: 34px;
}

.field {
    margin-bottom: 14px;
}

.form-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
    gap: 14px 18px;
}

.switch {
    display: flex;
    align-items: center;
    gap: 8px;
    cursor: pointer;
    user-select: none;
}

.switch input {
    width: 18px;
    height: 18px;
    accent-color: var(--pri);
}

/* ===== 徽标 ===== */
.badge {
    display: inline-block;
    padding: 2px 9px;
    border-radius: 999px;
    font-size: 12px;
    border: 1px solid var(--line);
    color: var(--muted);
    white-space: nowrap;
}

.badge.ok {
    color: #86efac;
    border-color: #1e4634;
    background: #10261c;
}

.badge.warn {
    color: #fcd34d;
    border-color: #4a3a16;
    background: #241d0d;
}

.badge.err {
    color: #fca5a5;
    border-color: #4a2626;
    background: #241313;
}

/* ===== 表格 ===== */
.table-wrap {
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
}

table.tb {
    width: 100%;
    border-collapse: collapse;
    font-size: 14px;
    min-width: 860px;
}

table.tb th, table.tb td {
    text-align: left;
    padding: 10px 12px;
    border-bottom: 1px solid var(--line-soft);
    vertical-align: middle;
}

table.tb th {
    color: var(--muted);
    font-weight: 500;
    font-size: 13px;
    white-space: nowrap;
}

table.tb tbody tr:hover {
    background: rgba(255, 255, 255, .02);
}

table.tb td .name {
    max-width: 260px;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    display: block;
}

.acts {
    display: flex;
    gap: 6px;
    flex-wrap: wrap;
}

/* ===== 统计卡 ===== */
.stats {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
    gap: 12px;
    margin-bottom: 18px;
}

.stat {
    background: var(--panel);
    border: 1px solid var(--line-soft);
    border-radius: 12px;
    padding: 14px 16px;
}

.stat .k {
    color: var(--muted);
    font-size: 12px;
}

.stat .v {
    font-size: 21px;
    font-weight: 700;
    margin-top: 2px;
}

.stat .v.small {
    font-size: 16px;
}

/* ===== 进度条 ===== */
.bar {
    height: 10px;
    background: var(--bg-soft);
    border-radius: 999px;
    overflow: hidden;
    border: 1px solid var(--line-soft);
}

.bar > i {
    display: block;
    height: 100%;
    width: 0;
    background: linear-gradient(90deg, var(--pri), var(--pri-2));
    transition: width .25s;
}

.bar.thin {
    height: 6px;
}

/* ===== 弹窗 ===== */
.mask {
    position: fixed;
    inset: 0;
    background: rgba(4, 7, 12, .78);
    backdrop-filter: blur(4px);
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 20px;
    z-index: 100;
}

.modal {
    background: var(--panel);
    border: 1px solid var(--line);
    border-radius: 16px;
    padding: 24px;
    width: 100%;
    max-width: 400px;
    box-shadow: var(--shadow);
}

.modal h3 {
    margin: 0 0 6px;
    font-size: 18px;
}

.modal .err {
    color: #fca5a5;
    font-size: 13px;
    min-height: 20px;
    margin-top: 8px;
}

/* ===== 轻提示 ===== */
.toast {
    position: fixed;
    left: 50%;
    bottom: 32px;
    transform: translateX(-50%);
    background: #1f2937;
    border: 1px solid var(--line);
    color: var(--text);
    padding: 10px 18px;
    border-radius: 999px;
    font-size: 14px;
    z-index: 200;
    box-shadow: var(--shadow);
    opacity: 0;
    pointer-events: none;
    transition: .2s;
}

.toast.show {
    opacity: 1;
    bottom: 44px;
}

/* ===== 键值列表 ===== */
.kv {
    display: grid;
    grid-template-columns: max-content 1fr;
    gap: 8px 16px;
    font-size: 14px;
}

.kv .k {
    color: var(--muted);
}

.kv .v {
    word-break: break-all;
}

/* ===== 移动端 ===== */
@media (max-width: 720px) {
    body {
        font-size: 14px;
    }

    .wrap {
        padding: 16px 14px 48px;
    }

    .card {
        padding: 16px;
        border-radius: 12px;
    }

    .topbar {
        padding: 12px 14px;
    }

    .stats {
        grid-template-columns: repeat(2, 1fr);
    }

    .stat .v {
        font-size: 18px;
    }

    .btn {
        padding: 10px 14px;
    }
}
