/* GG-VPN 管理后台 · 视觉 token 与 docs/03-界面设计说明.md 一致 */
:root {
  --ground: #F4F5F7; --surface: #FFFFFF; --border: #DDE1E7; --border-soft: #EDF0F4;
  --ink: #1B1F26; --ink-2: #3A4250; --muted: #5B6472; --faint: #8A93A2;
  --green: #0E7A5F; --green-bg: #E3F3EC; --blue: #2451B8; --blue-bg: #E8EEFC;
  --red: #B42318; --red-bg: #FBEAE7; --orange: #B54708; --orange-bg: #FDF1E6;
}
* { box-sizing: border-box; }
html, body { margin: 0; background: var(--ground); color: var(--ink); font: 13px/1.5 -apple-system, "SF Pro Text", "PingFang SC", "Helvetica Neue", sans-serif; }
a { color: var(--blue); text-decoration: none; }
a:hover { color: #1B3F93; }
button, input, select, textarea { font: inherit; color: inherit; }
h1 { margin: 0; font-size: 22px; font-weight: 600; }
h2 { margin: 0; font-size: 14px; font-weight: 600; }
code { font-family: "SF Mono", Menlo, monospace; font-size: 12px; }

.topbar { height: 52px; padding: 0 24px; background: var(--surface); border-bottom: 1px solid var(--border); display: flex; align-items: center; gap: 14px; position: sticky; top: 0; z-index: 5; }
.logo { width: 26px; height: 26px; border-radius: 7px; background: var(--green); display: flex; align-items: center; justify-content: center; }
.brand { font-weight: 600; font-size: 15px; }
.env { padding: 2px 8px; border-radius: 5px; background: var(--green-bg); color: var(--green); font-weight: 600; font-size: 11px; }
.env.dev { background: var(--orange-bg); color: var(--orange); }
.spacer { flex: 1; }
.me { display: flex; align-items: center; gap: 8px; }
.avatar { width: 28px; height: 28px; border-radius: 14px; background: var(--ink); color: #fff; display: flex; align-items: center; justify-content: center; font-size: 11px; font-weight: 600; }

.layout { display: flex; flex-wrap: wrap; min-height: calc(100vh - 52px); }
nav.side { width: 220px; padding: 16px 12px; background: var(--surface); border-right: 1px solid var(--border); display: flex; flex-direction: column; gap: 2px; }
nav.side a { padding: 8px 12px; border-radius: 7px; color: var(--ink-2); display: flex; justify-content: space-between; }
nav.side a.active { background: #EFF1F4; color: var(--ink); font-weight: 600; }
nav.side .group { margin: 12px 12px 6px; font-size: 11px; color: var(--faint); font-weight: 600; }
nav.side .count { background: var(--orange-bg); color: var(--orange); border-radius: 10px; padding: 0 7px; font-size: 11px; font-weight: 600; }
main { flex: 999 1 560px; min-width: 0; padding: 24px 28px; display: flex; flex-direction: column; gap: 16px; }
.page-head { display: flex; align-items: center; justify-content: space-between; flex-wrap: wrap; gap: 10px; }
.page-head .sub { color: var(--muted); font-size: 12px; margin-top: 4px; }
.actions { display: flex; gap: 8px; flex-wrap: wrap; }

.card { background: var(--surface); border: 1px solid var(--border); border-radius: 10px; padding: 16px 18px; display: flex; flex-direction: column; gap: 10px; min-width: 0; }
.card.flush { padding: 0; overflow: hidden; }
.card .head { display: flex; align-items: center; justify-content: space-between; }
.card.flush .head { padding: 12px 18px; border-bottom: 1px solid var(--border-soft); }
.grid2 { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 14px; }
.grid3 { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 14px; }
.grid4 { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 14px; }
.grid-main { display: grid; grid-template-columns: minmax(0, 1fr) 360px; gap: 16px; align-items: start; }
@media (max-width: 900px) { .grid2, .grid3, .grid4, .grid-main { grid-template-columns: 1fr; } }
.stat .label { font-size: 12px; color: var(--muted); }
.stat .value { font-size: 28px; font-weight: 600; letter-spacing: -0.4px; }
.stat .note { font-size: 12px; color: var(--muted); }
.kv { display: flex; justify-content: space-between; gap: 12px; color: var(--ink-2); }
.kv span:first-child { color: var(--muted); }

.table-wrap { overflow-x: auto; }
table { width: 100%; border-collapse: collapse; font-size: 12px; }
th { text-align: left; padding: 9px 14px; background: var(--ground); color: var(--muted); font-weight: 600; white-space: nowrap; }
td { padding: 9px 14px; border-top: 1px solid var(--border-soft); vertical-align: middle; }
tr.hl { background: #FFFBF7; }
tr.sel { background: #F5F8FD; }
tr.click { cursor: pointer; }
tr.click:hover { background: var(--ground); }
.sub { color: var(--muted); font-size: 11px; }
.strong { font-weight: 600; }
.right { text-align: right; }
.nowrap { white-space: nowrap; }

.badge { display: inline-block; padding: 2px 8px; border-radius: 5px; font-weight: 600; font-size: 11px; white-space: nowrap; }
.badge.green { background: var(--green-bg); color: var(--green); }
.badge.blue { background: var(--blue-bg); color: var(--blue); }
.badge.red { background: var(--red-bg); color: var(--red); }
.badge.orange { background: var(--orange-bg); color: var(--orange); }
.badge.gray { background: #EFF1F4; color: var(--muted); }
.c-green { color: var(--green); font-weight: 600; } .c-blue { color: var(--blue); font-weight: 600; }
.c-red { color: var(--red); font-weight: 600; } .c-orange { color: var(--orange); font-weight: 600; } .c-muted { color: var(--muted); }

.btn { height: 30px; padding: 0 12px; border-radius: 7px; border: 1px solid #D5D9E0; background: var(--surface); cursor: pointer; font-size: 12px; white-space: nowrap; }
.btn:hover { background: var(--ground); }
.btn.primary { background: var(--green); border-color: var(--green); color: #fff; font-weight: 600; }
.btn.primary:hover { opacity: .92; background: var(--green); }
.btn.dark { background: var(--ink); border-color: var(--ink); color: #fff; font-weight: 600; }
.btn.danger { color: var(--red); border-color: #F1B8B0; }
.btn.sm { height: 26px; padding: 0 10px; }
.btn:disabled { opacity: .5; cursor: not-allowed; }
.btn.link { border: none; background: none; color: var(--blue); padding: 0; height: auto; }
input[type=text], input[type=search], input[type=number], input[type=datetime-local], select, textarea { height: 30px; border-radius: 7px; border: 1px solid #D5D9E0; padding: 0 10px; font-size: 12px; background: var(--surface); }
textarea { height: auto; padding: 8px 10px; resize: vertical; font-family: "SF Mono", Menlo, monospace; }
input:focus, select:focus, textarea:focus { outline: none; border-color: var(--blue); }
label.f { display: flex; flex-direction: column; gap: 4px; font-size: 12px; }
label.f > span { color: var(--muted); }
label.chk { display: flex; align-items: center; gap: 8px; font-size: 12px; }
input[type=checkbox] { width: 16px; height: 16px; accent-color: var(--green); }
.filters { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; }
.seg { display: flex; padding: 3px; border-radius: 7px; background: #EFF1F4; gap: 2px; }
.seg button { flex: 1; height: 26px; border: none; border-radius: 5px; background: transparent; color: var(--ink-2); font-size: 12px; cursor: pointer; }
.seg button.on { background: var(--surface); font-weight: 600; box-shadow: 0 1px 2px rgba(0,0,0,.08); }
.tabs { display: flex; gap: 18px; border-bottom: 1px solid var(--border); }
.tabs button { padding: 6px 2px 9px; border: none; background: none; color: var(--muted); cursor: pointer; margin-bottom: -1px; }
.tabs button.on { color: var(--ink); font-weight: 600; border-bottom: 2px solid var(--ink); }
.chips { display: flex; flex-wrap: wrap; gap: 6px; }
.chip { padding: 3px 9px; border-radius: 6px; background: var(--green-bg); color: var(--green); font-weight: 600; font-size: 12px; display: inline-flex; gap: 6px; align-items: center; }
.chip.blue { background: var(--blue-bg); color: var(--blue); }
.chip button { border: none; background: none; cursor: pointer; color: inherit; padding: 0; font-size: 12px; }
.bar { display: flex; align-items: center; gap: 8px; font-size: 12px; }
.bar .track { flex: 1; height: 8px; border-radius: 4px; background: #EFF1F4; overflow: hidden; }
.bar .fill { display: block; height: 100%; background: var(--red); }
.note { font-size: 11px; color: var(--muted); }
.warn-box { padding: 10px 12px; border-radius: 8px; background: var(--red-bg); color: var(--red); font-size: 12px; line-height: 18px; }
.ok-box { padding: 12px 14px; border-radius: 8px; background: #F6FBF9; border: 1px solid #CFE8DD; }
.empty { padding: 24px; text-align: center; color: var(--muted); }
pre.code { margin: 0; padding: 10px 12px; border-radius: 8px; background: var(--ink); color: #C9D1DC; font-size: 11px; line-height: 17px; overflow: auto; }

.toast { position: fixed; right: 24px; bottom: 24px; padding: 10px 14px; border-radius: 10px; color: #fff; font-weight: 600; font-size: 12px; box-shadow: 0 8px 24px rgba(0,0,0,.18); z-index: 20; background: var(--green); }
.toast.err { background: var(--red); }
.modal-bg { position: fixed; inset: 0; background: rgba(27,31,38,.35); display: flex; align-items: center; justify-content: center; z-index: 10; padding: 16px; }
.modal { width: 560px; max-width: 100%; max-height: 90vh; overflow: auto; background: var(--surface); border-radius: 12px; padding: 20px 22px; display: flex; flex-direction: column; gap: 12px; box-shadow: 0 16px 48px rgba(0,0,0,.2); }
.modal h2 { font-size: 16px; }
.form-stack { display: flex; flex-direction: column; gap: 14px; }
.form-stack .note { margin-top: 2px; }
.modal .foot { display: flex; justify-content: flex-end; gap: 8px; padding-top: 6px; }

.vpn-layout { display: grid; grid-template-columns: 280px minmax(0, 1fr); gap: 16px; align-items: start; }
.vpn-list, .vpn-detail, .vpn-editor { display: flex; flex-direction: column; gap: 12px; min-width: 0; }
.vpn-detail .head { gap: 10px; flex-wrap: wrap; }
.vpn-detail .kv span:last-child { min-width: 0; overflow-wrap: anywhere; text-align: right; }
.editor-bar { display: flex; align-items: center; justify-content: space-between; gap: 12px; }
.vpn-editor [hidden] { display: none !important; }
.json-editor { width: 100%; min-height: 300px; max-height: 45vh; line-height: 1.55; tab-size: 2; }
.json-status { min-height: 24px; padding-top: 6px; font-size: 12px; }
.json-preview { font-size: 12px; color: var(--ink-2); overflow-wrap: anywhere; }
@media (max-width: 1050px) { .vpn-layout { grid-template-columns: 220px minmax(0, 1fr); } }
@media (max-width: 760px) { .vpn-layout { grid-template-columns: minmax(0, 1fr); } main { padding: 16px; } .modal { padding: 16px; } }

.login { min-height: 100vh; display: flex; }
.login .left { width: 420px; background: var(--green); color: #fff; padding: 48px 36px; display: flex; flex-direction: column; justify-content: flex-end; gap: 14px; }
.login .left h1 { font-size: 28px; }
.login .left p { margin: 0; color: #D7F0E6; font-size: 15px; }
.login .right { flex: 1; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 18px; padding: 40px; }
.login .right h2 { font-size: 22px; }
.btn.feishu { width: 320px; height: 48px; border-radius: 10px; background: #3370FF; border-color: #3370FF; color: #fff; font-size: 15px; font-weight: 600; }
.login form { width: 320px; display: flex; flex-direction: column; gap: 8px; padding: 14px; border-radius: 10px; background: var(--ground); }
@media (max-width: 760px) { .login { flex-direction: column; } .login .left { width: auto; } }
