:root {
    --bg: #f3f5f8;
    --card: #fff;
    --ink: #172033;
    --muted: #667085;
    --line: #e4e7ec;
    --blue: #2962ff;
    --blue-dark: #1746c7;
    --green: #087e5b;
    --red: #c83232;
    font-family: Inter, "PingFang SC", "Microsoft YaHei", system-ui, sans-serif;
}

* { box-sizing: border-box; }
body { margin: 0; color: var(--ink); background: var(--bg); }
a { color: var(--blue); text-decoration: none; }
h1, h2, h3, p { margin-top: 0; }
h1 { font-size: clamp(1.7rem, 4vw, 2.5rem); margin-bottom: .65rem; }
h2 { font-size: 1.15rem; }
button, input, select, textarea { font: inherit; }

.topbar {
    height: 68px; padding: 0 max(24px, calc((100vw - 1180px) / 2));
    display: flex; align-items: center; justify-content: space-between;
    background: #111827; color: #fff;
}
.topbar nav, .topbar form { display: flex; align-items: center; gap: 18px; }
.topbar nav a { color: #c7d0df; font-weight: 700; }
.brand { color: #fff; font-weight: 800; font-size: 1.3rem; letter-spacing: -.03em; }
.container { width: min(1180px, calc(100% - 32px)); margin: 38px auto; }
.hero { display: flex; justify-content: space-between; align-items: center; gap: 24px; margin-bottom: 25px; }
.eyebrow { color: var(--blue); font-weight: 800; font-size: .74rem; letter-spacing: .12em; text-transform: uppercase; }
.muted, .hint { color: var(--muted); }
.hint { font-size: .88rem; line-height: 1.6; }
.card { background: var(--card); border: 1px solid var(--line); border-radius: 16px; padding: 25px; box-shadow: 0 8px 30px rgba(16, 24, 40, .04); }
.button {
    display: inline-flex; justify-content: center; align-items: center; border: 0; border-radius: 9px;
    background: var(--blue); color: #fff; padding: 11px 17px; font-weight: 700; cursor: pointer;
}
.button:hover { background: var(--blue-dark); }
.button.secondary { background: #edf2ff; color: var(--blue); }
.link-button { padding: 0; border: 0; background: transparent; color: inherit; cursor: pointer; }
.stats { display: grid; grid-template-columns: 1fr 1fr 2fr; gap: 15px; margin-bottom: 20px; }
.stat { background: #fff; border: 1px solid var(--line); border-radius: 13px; padding: 19px; }
.stat span, .stat strong { display: block; }
.stat span { color: var(--muted); font-size: .83rem; margin-bottom: 9px; }
.stat strong { font-size: 1.7rem; }
.stat .ip { font-size: 1.2rem; }
.section-title { display: flex; justify-content: space-between; align-items: center; }
.section-title span { color: var(--muted); font-size: .9rem; }
.table-wrap { overflow-x: auto; }
table { width: 100%; border-collapse: collapse; }
th, td { padding: 16px 10px; border-bottom: 1px solid var(--line); text-align: left; white-space: nowrap; }
th { color: var(--muted); font-size: .8rem; text-transform: uppercase; }
td small { display: block; color: var(--muted); margin-top: 5px; }
.actions { text-align: right; }
.badge { display: inline-block; padding: 5px 9px; border-radius: 999px; font-size: .78rem; font-weight: 700; }
.badge.on { color: var(--green); background: #e8f8f2; }
.badge.off { color: var(--muted); background: #eef0f3; }
.badge.online { color: var(--green); background: #e8f8f2; }
.badge.pending { color: #9a5b00; background: #fff4dc; }
.badge.offline { color: var(--red); background: #fff0f0; }
.badge.success { color: var(--green); background: #e8f8f2; }
.badge.failed { color: var(--red); background: #fff0f0; }
.badge.running { color: var(--blue); background: #edf2ff; }
.empty { padding: 55px 20px; text-align: center; color: var(--muted); }
.empty h3 { color: var(--ink); }

.auth-shell { min-height: 100vh; display: grid; place-items: center; padding: 24px; }
.auth-card { width: min(430px, 100%); }
.auth-card.wide { width: min(760px, 100%); }
.stack { display: grid; gap: 17px; }
.form-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 17px; }
.full { grid-column: 1 / -1; }
label { display: grid; gap: 7px; font-size: .88rem; font-weight: 700; }
label small { color: var(--muted); font-weight: 400; }
input, select, textarea {
    width: 100%; min-width: 0; border: 1px solid #cfd4dc; border-radius: 8px;
    background: #fff; padding: 10px 12px; color: var(--ink); outline: none;
}
input:focus, select:focus, textarea:focus { border-color: var(--blue); box-shadow: 0 0 0 3px rgba(41, 98, 255, .1); }
.alert { border-radius: 9px; padding: 11px 13px; margin-bottom: 16px; font-size: .9rem; white-space: pre-line; }
.alert.error { color: #922; background: #fff0f0; border: 1px solid #f4cccc; }
.alert.success { color: #076448; background: #ecfbf5; border: 1px solid #bfe9da; }
.back-row { margin-bottom: 18px; }
.split { display: grid; grid-template-columns: minmax(0, 1.5fr) minmax(280px, .8fr); gap: 20px; align-items: start; }
.origin-row { display: grid; grid-template-columns: 100px 1fr 100px; gap: 12px; }
.switch { display: flex; align-items: center; gap: 9px; }
.switch input { width: auto; }
.danger-zone { margin-top: 24px; padding-top: 20px; border-top: 1px solid var(--line); }
.danger { color: var(--red); }
.dns-box { margin: 0; }
.dns-box div { display: flex; justify-content: space-between; gap: 20px; padding: 11px 0; border-bottom: 1px solid var(--line); }
.dns-box dt { color: var(--muted); }
.dns-box dd { margin: 0; font-family: ui-monospace, monospace; font-weight: 700; }
pre { overflow: auto; margin: 18px 0 0; padding: 13px; border-radius: 8px; background: #101828; color: #d8e2f2; font-size: .8rem; }
.node-actions { display: grid; gap: 10px; }
.save-actions { display: flex; align-items: center; gap: 16px; }
.save-only { color: var(--muted); }
.node-status { display: flex; align-items: center; gap: 8px; margin-bottom: 14px; color: var(--green); font-weight: 700; font-size: .9rem; }
.node-status span { width: 9px; height: 9px; border-radius: 50%; background: #19a974; box-shadow: 0 0 0 4px #e4f8f0; }
.node-grid { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 18px; }
.node-card { min-width: 0; }
.node-card-head { display: flex; align-items: flex-start; justify-content: space-between; gap: 16px; }
.node-card-head h2 { margin: 12px 0 0; font-size: 1.2rem; }
.node-type { color: var(--muted); font-size: .8rem; }
.node-meta { margin: 20px 0; }
.node-meta div { display: flex; justify-content: space-between; gap: 15px; padding: 9px 0; border-bottom: 1px solid var(--line); }
.node-meta dt { color: var(--muted); }
.node-meta dd { margin: 0; text-align: right; font-weight: 700; }
.card-link { font-weight: 700; }
.task-list { display: grid; gap: 10px; }
.task-list div { display: flex; justify-content: space-between; align-items: center; gap: 12px; padding-bottom: 10px; border-bottom: 1px solid var(--line); }
details { margin-top: 18px; color: var(--muted); font-size: .88rem; }
summary { cursor: pointer; }
.manual-download { margin-top: 12px; }

@media (max-width: 760px) {
    .hero { align-items: flex-start; }
    .stats, .split, .form-grid, .node-grid { grid-template-columns: 1fr; }
    .full { grid-column: auto; }
    .origin-row { grid-template-columns: 90px 1fr; }
    .origin-row .grow { grid-column: 1 / -1; grid-row: 1; }
}
