:root {
    --bg: #070b14;
    --panel: #0f1626;
    --panel-2: #131d31;
    --border: #1e2a44;
    --border-soft: #16213a;
    --text: #e8eefc;
    --muted: #8fa3c8;
    --muted-2: #6f83a8;
    --accent: #4f8cff;
    --accent-2: #22d3ee;
    --success: #34d399;
    --warn: #fbbf24;
    --danger: #f87171;
}

* {
    box-sizing: border-box;
}

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

body {
    background: var(--bg);
    color: var(--text);
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", "PingFang SC", "Hiragino Sans GB", "Microsoft YaHei", sans-serif;
    font-size: 14px;
    line-height: 1.6;
    -webkit-font-smoothing: antialiased;
}

a {
    color: #7fb0ff;
    text-decoration: none;
}

a:hover {
    color: #a9c9ff;
}

/* ---------- 布局 ---------- */
.layout {
    display: flex;
    min-height: 100vh;
}

.sidebar {
    width: 234px;
    flex: 0 0 234px;
    background: linear-gradient(180deg, #0b1220 0%, #090f1b 100%);
    border-right: 1px solid var(--border);
    padding: 22px 14px 18px;
    position: sticky;
    top: 0;
    height: 100vh;
    display: flex;
    flex-direction: column;
    gap: 24px;
    z-index: 40;
}

.brand {
    display: flex;
    align-items: center;
    gap: 11px;
    padding: 0 6px;
    min-width: 0;
}

.brand-logo {
    width: 38px;
    height: 38px;
    flex: none;
    border-radius: 11px;
    background: linear-gradient(135deg, #4f8cff, #22d3ee);
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 800;
    font-size: 10.5px;
    letter-spacing: .5px;
    color: #04101f;
    box-shadow: 0 8px 24px rgba(79, 140, 255, .32);
}

.brand-name {
    font-weight: 600;
    font-size: 14.5px;
    letter-spacing: .2px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

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

.nav a {
    display: flex;
    align-items: center;
    gap: 11px;
    padding: 9px 12px;
    border-radius: 9px;
    color: var(--muted);
    font-size: 13.5px;
    transition: background .15s, color .15s;
}

.nav a svg {
    width: 18px;
    height: 18px;
    flex: none;
    opacity: .85;
}

.nav a:hover {
    background: #131d31;
    color: var(--text);
}

.nav a.active {
    background: linear-gradient(90deg, rgba(79, 140, 255, .18), rgba(34, 211, 238, .05));
    color: #dbe8ff;
    box-shadow: inset 0 0 0 1px rgba(79, 140, 255, .22);
}

.nav a.active svg {
    opacity: 1;
    color: #8ab6ff;
}

.sidebar-foot {
    margin-top: auto;
    padding: 11px 12px;
    border-radius: 10px;
    background: #0b1322;
    border: 1px solid var(--border);
    color: var(--muted-2);
    font-size: 11.5px;
    line-height: 1.7;
}

.sidebar-foot b {
    color: #9fb5d9;
    font-weight: 500;
}

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

.topbar {
    height: 64px;
    display: flex;
    align-items: center;
    gap: 14px;
    padding: 0 26px;
    border-bottom: 1px solid var(--border);
    background: rgba(9, 14, 24, .78);
    backdrop-filter: blur(10px);
    position: sticky;
    top: 0;
    z-index: 30;
}

.page-title {
    font-size: 15.5px;
    font-weight: 600;
    letter-spacing: .2px;
}

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

.user-name {
    color: var(--muted);
    font-size: 12.5px;
}

.menu-btn {
    display: none;
    background: none;
    border: 1px solid var(--border);
    color: var(--text);
    border-radius: 8px;
    width: 34px;
    height: 34px;
    cursor: pointer;
    align-items: center;
    justify-content: center;
    padding: 0;
}

.content {
    padding: 26px;
    max-width: 1440px;
    width: 100%;
    margin: 0 auto;
    flex: 1;
}

/* ---------- 卡片 ---------- */
.cards {
    display: grid;
    grid-template-columns: repeat(4, minmax(0, 1fr));
    gap: 16px;
    margin-bottom: 20px;
}

.stat {
    background: linear-gradient(180deg, #101a2d, #0d1526);
    border: 1px solid var(--border);
    border-radius: 14px;
    padding: 17px 18px 15px;
    position: relative;
    overflow: hidden;
}

.stat::after {
    content: "";
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    height: 2px;
    background: linear-gradient(90deg, transparent, rgba(79, 140, 255, .55), transparent);
}

.stat .label {
    color: var(--muted);
    font-size: 12.5px;
    display: flex;
    align-items: center;
    gap: 6px;
}

.stat .value {
    font-size: 25px;
    font-weight: 700;
    margin-top: 5px;
    letter-spacing: .3px;
    font-variant-numeric: tabular-nums;
}

.stat .hint {
    color: var(--muted-2);
    font-size: 11.5px;
    margin-top: 3px;
}

/* ---------- 面板 ---------- */
.panel {
    background: var(--panel);
    border: 1px solid var(--border);
    border-radius: 14px;
    margin-bottom: 20px;
    overflow: hidden;
}

.panel-head {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    padding: 15px 18px;
    border-bottom: 1px solid var(--border);
    flex-wrap: wrap;
}

.panel-head h2 {
    margin: 0;
    font-size: 14px;
    font-weight: 600;
}

.panel-head .sub {
    color: var(--muted-2);
    font-size: 12px;
    font-weight: 400;
}

.panel-body {
    padding: 18px;
}

.panel-body.flush {
    padding: 0;
}

.cols {
    display: grid;
    grid-template-columns: 1.55fr 1fr;
    gap: 20px;
    align-items: start;
}

/* ---------- 表格 ---------- */
.table-wrap {
    overflow-x: auto;
}

table.table {
    width: 100%;
    border-collapse: collapse;
    font-size: 13px;
}

.table th {
    text-align: left;
    font-weight: 500;
    color: var(--muted);
    background: #0c1424;
    padding: 10px 16px;
    white-space: nowrap;
    border-bottom: 1px solid var(--border);
}

.table td {
    padding: 12px 16px;
    border-bottom: 1px solid var(--border-soft);
    vertical-align: middle;
}

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

.table tbody tr:hover td {
    background: rgba(79, 140, 255, .03);
}

.mono {
    font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, "Liberation Mono", monospace;
    font-size: 12.5px;
}

.cell-sub {
    color: var(--muted-2);
    font-size: 11.5px;
    margin-top: 2px;
}

/* ---------- 徽标 ---------- */
.badge {
    display: inline-flex;
    align-items: center;
    gap: 5px;
    padding: 3px 9px;
    border-radius: 999px;
    font-size: 11.5px;
    font-weight: 500;
    white-space: nowrap;
    line-height: 1.5;
}

.badge::before {
    content: "";
    width: 5px;
    height: 5px;
    border-radius: 50%;
    background: currentColor;
}

.badge.ok {
    color: var(--success);
    background: rgba(52, 211, 153, .1);
}

.badge.warn {
    color: var(--warn);
    background: rgba(251, 191, 36, .1);
}

.badge.off {
    color: var(--muted);
    background: rgba(143, 163, 200, .1);
}

.badge.danger {
    color: var(--danger);
    background: rgba(248, 113, 113, .1);
}

.tag {
    display: inline-block;
    padding: 1px 7px;
    border-radius: 6px;
    background: #16223a;
    color: #9fb5d9;
    font-size: 11px;
}

/* ---------- 按钮 ---------- */
.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
    padding: 8px 14px;
    border-radius: 8px;
    border: 1px solid var(--border);
    background: var(--panel-2);
    color: var(--text);
    font-size: 13px;
    font-family: inherit;
    cursor: pointer;
    transition: filter .15s, background .15s, border-color .15s;
    white-space: nowrap;
    line-height: 1.4;
}

.btn:hover {
    background: #182541;
    border-color: #2d4066;
    color: var(--text);
}

.btn-primary {
    background: linear-gradient(135deg, #4f8cff, #2f6fed);
    border-color: transparent;
    color: #fff;
    box-shadow: 0 6px 18px rgba(79, 140, 255, .25);
}

.btn-primary:hover {
    background: linear-gradient(135deg, #5d97ff, #3a78f5);
    color: #fff;
    filter: brightness(1.05);
}

.btn-danger {
    color: #fca5a5;
    border-color: rgba(248, 113, 113, .28);
    background: rgba(248, 113, 113, .07);
}

.btn-danger:hover {
    background: rgba(248, 113, 113, .15);
    border-color: rgba(248, 113, 113, .45);
    color: #fecaca;
}

.btn-sm {
    padding: 4px 10px;
    font-size: 12px;
    border-radius: 7px;
}

.btn-ghost {
    background: transparent;
    border-color: transparent;
    color: var(--muted);
}

.btn-ghost:hover {
    background: #16223a;
    color: var(--text);
}

.actions {
    display: flex;
    gap: 7px;
    align-items: center;
    flex-wrap: wrap;
}

.actions form {
    margin: 0;
}

/* ---------- 表单 ---------- */
.field {
    margin-bottom: 16px;
}

.field label {
    display: block;
    font-size: 12.5px;
    color: var(--muted);
    margin-bottom: 6px;
}

.field .req {
    color: var(--danger);
    margin-left: 2px;
}

input[type=text],
input[type=password],
input[type=number],
input[type=email],
select,
textarea {
    width: 100%;
    background: #0a1220;
    border: 1px solid #22304d;
    border-radius: 9px;
    padding: 9px 12px;
    color: var(--text);
    font-size: 13.5px;
    font-family: inherit;
    outline: none;
    transition: border-color .15s, box-shadow .15s;
    line-height: 1.5;
}

input:focus,
select:focus,
textarea:focus {
    border-color: #3b6dd8;
    box-shadow: 0 0 0 3px rgba(59, 109, 216, .16);
}

input::placeholder {
    color: #54678a;
}

select option {
    background: #0f1626;
}

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

.hint-text {
    color: var(--muted-2);
    font-size: 11.5px;
    margin-top: 5px;
}

.grid-2 {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 0 18px;
}

.form-actions {
    display: flex;
    gap: 10px;
    margin-top: 20px;
    align-items: center;
}

.form-card {
    max-width: 820px;
}

.checkbox {
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 13px;
    color: var(--text);
}

/* ---------- 提示 ---------- */
.alert {
    padding: 10px 14px;
    border-radius: 10px;
    font-size: 13px;
    margin-bottom: 16px;
    border: 1px solid transparent;
}

.alert.success {
    background: rgba(52, 211, 153, .08);
    border-color: rgba(52, 211, 153, .25);
    color: #a7f3d0;
}

.alert.error {
    background: rgba(248, 113, 113, .08);
    border-color: rgba(248, 113, 113, .25);
    color: #fecaca;
}

.alert.warn {
    background: rgba(251, 191, 36, .08);
    border-color: rgba(251, 191, 36, .25);
    color: #fde68a;
}

/* ---------- 图表 ---------- */
.chart {
    display: flex;
    align-items: flex-end;
    gap: 14px;
    height: 190px;
    padding: 6px 2px 0;
}

.chart-col {
    flex: 1;
    height: 100%;
    display: flex;
    flex-direction: column;
    justify-content: flex-end;
    align-items: center;
    gap: 6px;
    min-width: 0;
}

.bar {
    width: 100%;
    max-width: 52px;
    background: linear-gradient(180deg, #5b9bff, #22d3ee);
    border-radius: 6px 6px 3px 3px;
    min-height: 2px;
    box-shadow: 0 -2px 12px rgba(79, 140, 255, .18);
}

.bar-val {
    font-size: 10.5px;
    color: var(--muted-2);
    white-space: nowrap;
}

.bar-label {
    font-size: 11px;
    color: var(--muted-2);
}

/* ---------- 空状态 ---------- */
.empty {
    padding: 44px 20px;
    text-align: center;
    color: var(--muted-2);
    font-size: 13px;
}

.empty strong {
    display: block;
    color: var(--text);
    margin-bottom: 5px;
    font-size: 14px;
}

/* ---------- 代码块 ---------- */
.codebox {
    position: relative;
    background: #060b15;
    border: 1px solid #1c2942;
    border-radius: 10px;
    padding: 12px 52px 12px 13px;
    overflow: auto;
}

.codebox pre {
    margin: 0;
    font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, "Liberation Mono", monospace;
    font-size: 12px;
    color: #b9cdf0;
    white-space: pre-wrap;
    word-break: break-all;
    line-height: 1.75;
}

.copy-btn {
    position: absolute;
    top: 8px;
    right: 8px;
    background: #16223a;
    border: 1px solid #283a5c;
    color: #b9cdf0;
    border-radius: 6px;
    padding: 3px 8px;
    font-size: 11px;
    cursor: pointer;
    font-family: inherit;
}

.copy-btn:hover {
    background: #1d2c49;
}

/* ---------- 节点卡片 ---------- */
.node-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(340px, 1fr));
    gap: 16px;
}

.node-card {
    background: var(--panel);
    border: 1px solid var(--border);
    border-radius: 14px;
    padding: 17px;
    display: flex;
    flex-direction: column;
    gap: 13px;
}

.node-head {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 10px;
}

.node-head h3 {
    margin: 0;
    font-size: 14.5px;
    font-weight: 600;
    min-width: 0;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.node-meta {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 10px 14px;
    font-size: 12.5px;
}

.node-meta .k {
    color: var(--muted-2);
    font-size: 11px;
    display: block;
    margin-bottom: 1px;
}

.node-meta .v {
    color: #d4e0f7;
}

details.install {
    border-top: 1px solid var(--border);
    padding-top: 11px;
}

details.install summary {
    cursor: pointer;
    color: #9fc0ff;
    font-size: 12.5px;
    list-style: none;
    user-select: none;
}

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

details.install summary::before {
    content: "+ ";
    color: var(--accent);
}

details.install[open] summary::before {
    content: "- ";
}

details.install .install-tip {
    color: var(--muted-2);
    font-size: 11.5px;
    margin: 9px 0 8px;
}

/* ---------- 套餐 ---------- */
.pkg-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(285px, 1fr));
    gap: 16px;
}

.pkg {
    background: var(--panel);
    border: 1px solid var(--border);
    border-radius: 14px;
    padding: 19px;
    display: flex;
    flex-direction: column;
    gap: 13px;
}

.pkg h3 {
    margin: 0;
    font-size: 15px;
    font-weight: 600;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 10px;
}

.pkg .price {
    font-size: 26px;
    font-weight: 700;
    color: #dbe8ff;
    letter-spacing: .3px;
}

.pkg .price small {
    font-size: 12px;
    color: var(--muted-2);
    font-weight: 400;
    margin-left: 3px;
}

.pkg ul {
    list-style: none;
    margin: 0;
    padding: 0;
    display: flex;
    flex-direction: column;
    gap: 7px;
    font-size: 12.5px;
}

.pkg li {
    display: flex;
    justify-content: space-between;
    gap: 10px;
    border-bottom: 1px dashed #1b2740;
    padding-bottom: 6px;
    color: #c3d3ee;
}

.pkg li:last-child {
    border-bottom: none;
    padding-bottom: 0;
}

.pkg li span:first-child {
    color: var(--muted-2);
}

.pkg .usage-line {
    display: flex;
    justify-content: space-between;
    color: var(--muted-2);
    font-size: 11.5px;
    margin-top: 2px;
}

/* ---------- 用量条 ---------- */
.usage {
    height: 5px;
    background: #0a1220;
    border-radius: 99px;
    overflow: hidden;
    margin-top: 6px;
    border: 1px solid rgba(255, 255, 255, .03);
}

.usage i {
    display: block;
    height: 100%;
    background: linear-gradient(90deg, #4f8cff, #22d3ee);
    border-radius: 99px;
}

.usage.hot i {
    background: linear-gradient(90deg, #fbbf24, #f87171);
}

/* ---------- 登录 / 安装 ---------- */
.auth-body {
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 24px;
    background:
        radial-gradient(1000px 600px at 12% 8%, rgba(79, 140, 255, .14), transparent 60%),
        radial-gradient(900px 600px at 92% 92%, rgba(34, 211, 238, .1), transparent 60%),
        #070b14;
}

.auth-wrap {
    width: 100%;
    max-width: 402px;
}

.auth-brand {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 12px;
    margin-bottom: 20px;
}

.auth-brand .brand-name {
    font-size: 16px;
}

.auth-card {
    background: rgba(15, 22, 38, .92);
    border: 1px solid #22304d;
    border-radius: 18px;
    padding: 30px;
    box-shadow: 0 30px 70px rgba(0, 0, 0, .45);
}

.auth-card h1 {
    margin: 0 0 5px;
    font-size: 20px;
    font-weight: 600;
}

.auth-card .sub {
    color: var(--muted);
    font-size: 12.5px;
    margin: 0 0 22px;
}

.auth-foot {
    text-align: center;
    color: #54678a;
    font-size: 11.5px;
    margin-top: 18px;
}

/* ---------- 通用 ---------- */
.row-between {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    flex-wrap: wrap;
}

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

.small {
    font-size: 12px;
}

.text-danger {
    color: var(--danger);
}

.mb-0 {
    margin-bottom: 0;
}

.w-100 {
    width: 100%;
}

.mt-0 {
    margin-top: 0;
}

.flex {
    display: flex;
    gap: 8px;
    align-items: center;
    flex-wrap: wrap;
}

.section-title {
    font-size: 13px;
    font-weight: 600;
    color: #d4e0f7;
    margin: 0 0 12px;
    display: flex;
    align-items: center;
    gap: 8px;
}

.section-title::before {
    content: "";
    width: 3px;
    height: 13px;
    border-radius: 2px;
    background: linear-gradient(180deg, #4f8cff, #22d3ee);
}

.guide {
    max-width: 940px;
}

.guide h2 {
    font-size: 16px;
    margin: 0 0 10px;
}

.guide h3 {
    font-size: 13.5px;
    margin: 20px 0 8px;
    color: #cfe0ff;
}

.guide p,
.guide li {
    color: #a9bcdd;
    font-size: 13px;
}

.guide ol,
.guide ul {
    padding-left: 20px;
    margin: 8px 0;
}

.guide li {
    margin-bottom: 5px;
}

.guide .step {
    display: inline-flex;
    width: 22px;
    height: 22px;
    border-radius: 7px;
    background: rgba(79, 140, 255, .16);
    color: #9fc0ff;
    align-items: center;
    justify-content: center;
    font-size: 12px;
    font-weight: 600;
    margin-right: 8px;
}

/* ---------- 响应式 ---------- */
@media (max-width: 1100px) {
    .cards {
        grid-template-columns: repeat(2, minmax(0, 1fr));
    }

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

@media (max-width: 900px) {
    .sidebar {
        position: fixed;
        left: 0;
        top: 0;
        transform: translateX(-100%);
        transition: transform .2s ease;
        box-shadow: 0 0 60px rgba(0, 0, 0, .6);
    }

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

    .menu-btn {
        display: inline-flex;
    }

    .content {
        padding: 18px;
    }

    .topbar {
        padding: 0 16px;
    }

    .user-name {
        display: none;
    }
}

@media (max-width: 640px) {
    .cards {
        grid-template-columns: 1fr;
    }

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

    .node-grid,
    .pkg-grid {
        grid-template-columns: 1fr;
    }

    .chart {
        gap: 7px;
        height: 160px;
    }

    .bar-val {
        display: none;
    }

    .table th,
    .table td {
        padding: 10px 12px;
    }
}
