:root {
  color-scheme: light;
  --paper: #f2f1eb;
  --surface: #fffefa;
  --ink: #151816;
  --muted: #69716c;
  --line: #d5d8d2;
  --green: #087858;
  --red: #bd392f;
  --amber: #b67510;
  --blue: #255f9d;
  --cyan: #117e82;
  --soft-red: #f7e6e2;
  --soft-green: #e4f2eb;
  --shadow: 0 12px 28px rgba(30, 38, 33, .06);
}
* { box-sizing: border-box; }
html { scroll-behavior: smooth; }
body { margin: 0; background: var(--paper); color: var(--ink); font-family: "Microsoft YaHei UI", "PingFang SC", sans-serif; }
button, input { font: inherit; }
[hidden] { display: none !important; }
.login-screen { min-height: 100vh; display: grid; place-items: center; padding: 24px; background: linear-gradient(125deg, transparent 0 55%, rgba(17,126,130,.08) 55% 56%, transparent 56%), var(--paper); }
.pin-card { width: min(370px, 100%); padding: 32px; border: 1px solid var(--line); border-top: 5px solid var(--ink); background: var(--surface); box-shadow: var(--shadow); }
.pin-card h1 { margin: 0 0 10px; font: 700 30px/1.1 Georgia, "Microsoft YaHei", serif; }
.pin-card > p:not(.kicker) { margin: 0 0 22px; color: var(--muted); font-size: 13px; }
.pin-card input { width: 100%; height: 58px; margin-bottom: 12px; border: 1px solid var(--line); border-radius: 2px; background: white; text-align: center; font: 700 28px Consolas, monospace; letter-spacing: 12px; }
.pin-card input:focus { outline: 2px solid var(--blue); outline-offset: 1px; }
.pin-card .primary-action { width: 100%; }
#loginError { display: block; min-height: 18px; margin-top: 10px; color: var(--red); font-size: 12px; text-align: center; }
.topbar, main, footer { width: min(1180px, calc(100% - 40px)); margin-inline: auto; }
.topbar { min-height: 112px; display: flex; align-items: center; justify-content: space-between; border-bottom: 1px solid var(--ink); }
.kicker, .eyebrow { color: var(--muted); font: 700 10px/1.2 Consolas, monospace; letter-spacing: .08em; }
.kicker { margin: 0 0 8px; }
h1 { margin: 0; font: 700 30px/1.1 Georgia, "Microsoft YaHei", serif; }
.header-status { display: flex; align-items: center; gap: 9px; color: var(--muted); font-size: 13px; }
.status-dot { width: 9px; height: 9px; border-radius: 50%; background: var(--amber); }
.status-dot.ok { background: var(--green); }
.status-dot.error { background: var(--red); }
.icon-button { width: 38px; height: 38px; margin-left: 8px; border: 1px solid var(--line); border-radius: 3px; background: var(--surface); color: var(--ink); font-size: 23px; cursor: pointer; }
.icon-button:disabled { opacity: .45; }
.text-button { min-height: 38px; border: 0; background: transparent; color: var(--muted); cursor: pointer; }
main { padding: 28px 0 52px; }
.alert-strip { display: flex; align-items: center; justify-content: space-between; gap: 20px; min-height: 100px; margin-bottom: 12px; padding: 18px 22px; border: 1px solid #e5beb8; border-left: 6px solid var(--red); background: var(--soft-red); }
.alert-strip.quiet { border-color: #bad7c9; border-left-color: var(--green); background: var(--soft-green); }
.alert-strip strong { display: block; margin: 5px 0; font-size: 16px; }
.alert-strip p { margin: 0; color: var(--muted); font-size: 12px; }
.chip-button { min-height: 36px; padding: 0 14px; border: 1px solid currentColor; border-radius: 999px; background: transparent; color: var(--ink); cursor: pointer; white-space: nowrap; }
.route-strip { display: grid; grid-template-columns: .7fr 1.3fr 1.4fr; margin-bottom: 12px; border: 1px solid var(--line); background: var(--surface); }
.route-strip > div { min-width: 0; padding: 15px 18px; }
.route-strip > div + div { border-left: 1px solid var(--line); }
.route-strip strong, .route-strip b { display: block; margin-top: 5px; font-size: 12px; overflow-wrap: anywhere; }
.route-strip strong { color: var(--green); font: 700 18px Consolas, monospace; }
.node-grid { display: grid; grid-template-columns: repeat(3, 1fr); border: 1px solid var(--line); background: var(--surface); box-shadow: var(--shadow); }
.node-panel { min-height: 194px; padding: 24px 27px; position: relative; overflow: hidden; }
.node-panel::after { content: ""; position: absolute; right: -30px; bottom: -52px; width: 120px; height: 120px; border: 1px solid var(--line); border-radius: 50%; opacity: .5; }
.node-panel + .node-panel { border-left: 1px solid var(--line); }
.node-heading { display: flex; justify-content: space-between; align-items: center; }
.region-code { display: grid; place-items: center; width: 42px; height: 27px; background: var(--ink); color: white; font: 700 12px Consolas, monospace; }
.node-state { color: var(--amber); font-size: 12px; }
.node-panel.online .node-state { color: var(--green); }
.node-panel.offline .node-state, .node-panel.slow .node-state { color: var(--red); }
.node-title { margin: 23px 0 7px; color: var(--muted); font-size: 12px; }
.latency { font: 650 48px/1 Consolas, monospace; }
.unit { color: var(--muted); font: 12px Consolas, monospace; }
.node-meta { margin: 13px 0 0; color: var(--muted); font-size: 11px; }
.section-block { margin-top: 28px; border-top: 2px solid var(--ink); padding-top: 14px; }
.section-title { display: flex; justify-content: space-between; align-items: center; gap: 20px; margin-bottom: 16px; }
.section-title > div:first-child { display: flex; align-items: center; gap: 10px; }
.section-title h2 { margin: 0; font-size: 16px; }
.section-title > span { color: var(--muted); font-size: 11px; text-align: right; }
.section-number { color: var(--muted); font: 700 11px Consolas, monospace; }
.metric-grid { display: grid; grid-template-columns: repeat(3, 1fr) 1.25fr .75fr; gap: 1px; border: 1px solid var(--line); background: var(--line); }
.metric, .network-metric { min-height: 94px; padding: 18px; background: var(--surface); }
.metric-label { display: flex; justify-content: space-between; font-size: 12px; }
.metric-label b { font: 600 13px Consolas, monospace; }
.meter { height: 5px; margin-top: 27px; background: #e7e9e4; overflow: hidden; }
.meter i { display: block; width: 0; height: 100%; background: var(--green); transition: width .35s ease; }
.network-metric { display: flex; flex-direction: column; justify-content: space-between; color: var(--muted); font-size: 12px; }
.network-metric b { color: var(--ink); font: 600 13px Consolas, monospace; white-space: nowrap; }
.web-checks { display: grid; grid-template-columns: repeat(3, 1fr); gap: 1px; margin-top: 1px; background: var(--line); border: 1px solid var(--line); }
.web-check { display: flex; align-items: center; justify-content: space-between; padding: 12px 16px; background: var(--surface); font-size: 12px; }
.web-check b { color: var(--green); font: 600 11px Consolas, monospace; }
.web-check.off b { color: var(--red); }
.range-switch { display: flex; border: 1px solid var(--line); background: var(--surface); }
.range-switch button { min-height: 34px; padding: 0 12px; border: 0; border-left: 1px solid var(--line); background: transparent; color: var(--muted); font: 700 10px Consolas, monospace; cursor: pointer; }
.range-switch button:first-child { border-left: 0; }
.range-switch button.active { background: var(--ink); color: white; }
.stat-grid { display: grid; grid-template-columns: repeat(4, 1fr); gap: 10px; }
.stat-card { min-width: 0; padding: 18px; border: 1px solid var(--line); background: var(--surface); }
.stat-card span, .stat-card small { display: block; color: var(--muted); font-size: 11px; }
.stat-card strong { display: block; margin: 12px 0 8px; font: 650 27px Consolas, monospace; overflow-wrap: anywhere; }
.history-section { margin-top: 12px; }
.history-heading { display: flex; align-items: center; justify-content: space-between; margin-bottom: 10px; font-size: 12px; }
.history-heading span { color: var(--muted); font-size: 11px; }
.chart-wrap { height: 210px; padding: 12px 10px 5px; border: 1px solid var(--line); background: var(--surface); }
canvas { width: 100%; height: 100%; display: block; }
.legend { display: flex; gap: 18px; margin-top: 9px; color: var(--muted); font-size: 11px; }
.legend span { display: flex; align-items: center; gap: 6px; }
.legend i { width: 14px; height: 2px; background: var(--blue); }
.legend i.sg { background: var(--amber); }
.legend i.hk { background: var(--cyan); }
.clash-layout { display: grid; grid-template-columns: 1fr 190px; gap: 12px; }
.clash-card, .qr-card { padding: 20px; border: 1px solid var(--line); background: var(--surface); }
.clash-card strong { display: block; margin-top: 7px; font-size: 15px; }
.clash-card p { color: var(--muted); font-size: 12px; line-height: 1.6; }
.clash-actions { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 19px; }
.primary-action, .secondary-action { min-height: 40px; display: inline-flex; align-items: center; justify-content: center; padding: 0 15px; border: 1px solid var(--ink); border-radius: 2px; font: 600 12px "Microsoft YaHei UI", sans-serif; cursor: pointer; text-decoration: none; }
.primary-action { background: var(--ink); color: white; }
.secondary-action { background: var(--surface); color: var(--ink); }
.copy-status { min-height: 18px; margin: 8px 0 0 !important; color: var(--green) !important; }
.qr-card { display: grid; align-content: center; justify-items: center; text-align: center; }
.qr-card img { width: 142px; height: 142px; }
.qr-card p { margin: 8px 0 0; color: var(--muted); font-size: 10px; line-height: 1.5; }
.guide-grid { display: grid; grid-template-columns: repeat(2, 1fr); gap: 10px; }
.guide-card { border: 1px solid var(--line); background: var(--surface); }
.guide-card[open] { border-top: 3px solid var(--blue); }
.guide-card summary { min-height: 64px; display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 0 17px; cursor: pointer; list-style: none; }
.guide-card summary::-webkit-details-marker { display: none; }
.guide-card summary span { font-weight: 700; }
.guide-card summary b { color: var(--muted); font-size: 11px; font-weight: 500; }
.guide-card ol { margin: 0 18px 13px 37px; padding: 0; color: var(--muted); font-size: 12px; line-height: 1.8; }
.guide-card > a { display: block; margin: 0 17px 17px; color: var(--blue); font-size: 12px; }
.ops-grid { display: grid; grid-template-columns: 1.15fr .85fr; gap: 12px; }
.vpn-access-card, .service-section { padding: 19px; border: 1px solid var(--line); background: var(--surface); }
.vpn-access-card h3 { margin: 6px 0; font-size: 16px; }
.vpn-access-card p { margin: 0 0 14px; color: var(--muted); font-size: 11px; }
.credential-list { margin: 0; }
.credential-list div { display: flex; justify-content: space-between; gap: 16px; padding: 7px 0; border-bottom: 1px solid var(--line); font-size: 11px; }
.credential-list dt { color: var(--muted); }
.credential-list dd { margin: 0; max-width: 64%; text-align: right; font-family: Consolas, monospace; overflow-wrap: anywhere; }
.service-list { border-top: 1px solid var(--line); }
.service-row { min-height: 43px; display: flex; justify-content: space-between; align-items: center; gap: 10px; border-bottom: 1px solid var(--line); font: 11px Consolas, monospace; }
.service-state { display: flex; align-items: center; gap: 7px; color: var(--green); font-family: "Microsoft YaHei UI", sans-serif; }
.service-state.off { color: var(--red); }
.service-state i { width: 7px; height: 7px; border-radius: 50%; background: currentColor; }
.alert-history { border: 1px solid var(--line); background: var(--surface); }
.alert-row { display: grid; grid-template-columns: 90px 1fr auto; gap: 15px; align-items: center; min-height: 68px; padding: 12px 16px; border-bottom: 1px solid var(--line); }
.alert-row:last-child { border-bottom: 0; }
.alert-row .alert-status { color: var(--green); font: 700 10px Consolas, monospace; }
.alert-row.active .alert-status { color: var(--red); }
.alert-row strong { display: block; font-size: 12px; }
.alert-row p { margin: 4px 0 0; color: var(--muted); font-size: 11px; }
.alert-row time { color: var(--muted); font: 10px Consolas, monospace; text-align: right; }
.empty-state { margin: 0; padding: 22px; color: var(--muted); font-size: 12px; text-align: center; }
.managed-api-hero { display: flex; align-items: center; justify-content: space-between; gap: 20px; padding: 20px; border: 1px solid var(--line); background: var(--surface); }
.managed-api-hero strong { display: block; margin-top: 7px; font: 650 17px Consolas, monospace; overflow-wrap: anywhere; }
.managed-api-hero p { margin: 8px 0 0; color: var(--muted); font-size: 11px; }
.managed-api-hero code { font-family: Consolas, monospace; }
.managed-stat-grid { display: grid; grid-template-columns: repeat(4, 1fr); gap: 1px; margin-top: 1px; border: 1px solid var(--line); background: var(--line); }
.managed-stat-grid article { min-height: 84px; padding: 16px; background: var(--surface); }
.managed-stat-grid span { display: block; color: var(--muted); font-size: 10px; }
.managed-stat-grid strong { display: block; margin-top: 13px; font: 650 23px Consolas, monospace; }
.key-console { margin-top: 12px; border: 1px solid var(--line); background: var(--surface); }
.key-create-form { display: grid; grid-template-columns: 1fr minmax(220px, .7fr) auto; gap: 14px; align-items: center; padding: 18px; }
.key-create-form label { font-size: 13px; font-weight: 700; }
.key-create-form p { margin: 4px 0 0; color: var(--muted); font-size: 10px; }
.key-create-form input { width: 100%; height: 40px; padding: 0 12px; border: 1px solid var(--line); border-radius: 2px; background: white; }
.key-create-form input:focus { outline: 2px solid var(--blue); outline-offset: 1px; }
.key-create-form button:disabled, .managed-key-row button:disabled { opacity: .45; }
.key-reveal { display: grid; grid-template-columns: .8fr 1.5fr auto auto; gap: 12px; align-items: center; padding: 18px; border-top: 1px solid #e4ca99; background: #fff8e9; }
.key-reveal strong { font-size: 12px; }
.key-reveal p { margin: 3px 0 0; color: var(--muted); font-size: 10px; }
.key-reveal code { min-width: 0; padding: 11px; border: 1px dashed var(--amber); background: white; font: 11px Consolas, monospace; overflow-wrap: anywhere; user-select: all; }
.key-console .copy-status { padding: 0 18px 10px; text-align: right; }
.key-table-wrap { margin-top: 12px; padding: 17px; border: 1px solid var(--line); background: var(--surface); }
.managed-range-switch button { min-width: 42px; }
.managed-key-list { border-top: 1px solid var(--line); }
.managed-key-row { display: grid; grid-template-columns: minmax(160px, 1.2fr) repeat(3, .6fr) 1fr auto; gap: 12px; align-items: center; min-height: 72px; border-bottom: 1px solid var(--line); }
.managed-key-row.revoked { opacity: .55; }
.managed-key-row > div:not(.key-identity):not(.key-action) span { display: block; color: var(--muted); font-size: 9px; }
.managed-key-row > div:not(.key-identity):not(.key-action) b { display: block; margin-top: 5px; font: 600 11px Consolas, monospace; overflow-wrap: anywhere; }
.key-identity strong { display: block; font-size: 12px; }
.key-identity code { display: block; margin-top: 5px; color: var(--muted); font: 10px Consolas, monospace; }
.key-action button { min-height: 32px; padding: 0 11px; border: 1px solid var(--red); background: transparent; color: var(--red); font-size: 10px; cursor: pointer; }
.key-action span { color: var(--muted); font-size: 10px; }
.model-usage { display: flex; align-items: center; gap: 18px; margin-top: 10px; padding: 14px 17px; border: 1px solid var(--line); background: var(--surface); }
.model-usage > div { display: flex; flex-wrap: wrap; gap: 8px; }
.model-usage > div span { padding: 5px 8px; border: 1px solid var(--line); color: var(--muted); font-size: 10px; }
.model-usage > div b { margin-right: 7px; color: var(--ink); font-family: Consolas, monospace; }
.security-note { display: flex; gap: 12px; margin-top: 10px; padding: 11px 13px; border: 1px solid #cfe1d7; background: #edf6f1; color: #315e49; font-size: 10px; }
footer { min-height: 70px; display: flex; justify-content: space-between; align-items: center; border-top: 1px solid var(--line); color: var(--muted); font: 10px Consolas, monospace; }
@media (max-width: 760px) {
  .topbar, main, footer { width: min(100% - 24px, 1180px); }
  .topbar { min-height: 90px; gap: 10px; }
  h1 { font-size: 22px; white-space: nowrap; }
  .kicker { font-size: 8px; }
  .header-status > span:not(.status-dot) { display: none; }
  main { padding-top: 16px; }
  .alert-strip { min-height: 88px; padding: 15px; }
  .route-strip { grid-template-columns: 1fr; }
  .route-strip > div + div { border-left: 0; border-top: 1px solid var(--line); }
  .node-grid, .guide-grid, .ops-grid { grid-template-columns: 1fr; }
  .node-panel { min-height: 156px; padding: 18px; }
  .node-panel + .node-panel { border-left: 0; border-top: 1px solid var(--line); }
  .node-title { margin-top: 16px; }
  .latency { font-size: 40px; }
  .metric-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .metric, .network-metric { min-width: 0; min-height: 86px; padding: 14px; }
  .metric-grid > :last-child { grid-column: span 2; }
  .network-metric b { font-size: 11px; }
  .web-checks, .stat-grid { grid-template-columns: repeat(2, 1fr); }
  .web-check:last-child { grid-column: span 2; }
  .stat-card { padding: 15px; }
  .stat-card strong { font-size: 22px; }
  .managed-api-hero { align-items: stretch; flex-direction: column; }
  .managed-stat-grid { grid-template-columns: repeat(2, 1fr); }
  .key-create-form { grid-template-columns: 1fr; }
  .key-reveal { grid-template-columns: 1fr 1fr; }
  .key-reveal > div, .key-reveal code { grid-column: span 2; }
  .managed-key-row { grid-template-columns: 1.2fr .8fr .8fr; gap: 10px; padding: 13px 0; }
  .managed-key-row .key-identity { grid-column: span 2; }
  .managed-key-row > div:nth-child(5) { grid-column: span 2; }
  .model-usage { align-items: flex-start; flex-direction: column; }
  .security-note { flex-direction: column; gap: 4px; }
  .clash-layout { grid-template-columns: 1fr; }
  .qr-card { min-height: 190px; }
  .clash-actions { display: grid; grid-template-columns: 1fr 1fr; }
  .clash-actions .primary-action { grid-column: span 2; }
  .guide-card summary { min-height: 58px; }
  .section-title { align-items: flex-start; }
  .section-title > span { max-width: 48%; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
  .alert-row { grid-template-columns: 64px 1fr; }
  .alert-row time { grid-column: 2; text-align: left; }
  footer { gap: 10px; }
}
@media (prefers-reduced-motion: reduce) { * { scroll-behavior: auto !important; transition: none !important; } }
