:root {
  color-scheme: light;
  --bg: #f4f6fa;
  --surface: #fff;
  --soft: #f2f6fb;
  --ink: #151e2e;
  --muted: #515e73;
  --line: #dce3ee;
  --brand: #0d4885;
  --accent: var(--brand);
  --accent-ink: #fff;
  --link: var(--brand);
  --focus: #176cc9;
  --nav: #e6effa;
  --good: #126245;
  --good-bg: #e7f5ee;
  --warn: #774b08;
  --warn-bg: #fff3d8;
  --bad: #a52836;
  --bad-bg: #fff0f1;
  --shadow: 0 8px 30px #12274710;
  font: 16px/1.5 "Inter", "Segoe UI", sans-serif;
}
:root[data-theme="dark"] {
  color-scheme: dark;
  --bg: #101722;
  --surface: #181f2c;
  --soft: #202b3b;
  --ink: #edf3fb;
  --muted: #aebcd1;
  --line: #344157;
  --accent: #a9d0ff;
  --accent-ink: #101e31;
  --link: #a9d0ff;
  --focus: #a9d0ff;
  --nav: #243956;
  --good: #9fe3c2;
  --good-bg: #1c3a32;
  --warn: #ffd791;
  --warn-bg: #3d311f;
  --bad: #ffacb1;
  --bad-bg: #462b35;
  --shadow: 0 8px 30px #0003;
}
* { box-sizing: border-box; }
body { margin: 0; color: var(--ink); background: var(--bg); }
button, select, input { font: inherit; color: inherit; }
button, input, select, a { -webkit-tap-highlight-color: transparent; }
a { color: var(--link); }
button, a.button { cursor: pointer; }
button:disabled { cursor: default; opacity: .55; }
:focus-visible { outline: 3px solid var(--focus); outline-offset: 3px; }
h1, h2, h3, p { margin: 0; }
h1 { font-size: clamp(1.75rem, 3vw, 2.4rem); letter-spacing: -.035em; line-height: 1.17; }
h2 { font-size: 1.22rem; letter-spacing: -.015em; line-height: 1.3; }
h3 { font-size: 1rem; line-height: 1.35; }
.muted, .hint { color: var(--muted); }
.hint, .small { font-size: .88rem; }
.sr-only { position: absolute; width: 1px; height: 1px; padding: 0; overflow: hidden; clip: rect(0,0,0,0); white-space: nowrap; }
.loading { padding: 4rem 2rem; text-align: center; color: var(--muted); }
.top {
  min-height: 66px; display: flex; justify-content: space-between; align-items: center;
  gap: .8rem; padding: .75rem clamp(1rem, 2.6vw, 2.4rem);
  background: var(--surface); border-bottom: 1px solid var(--line);
}
.brand { display: flex; align-items: center; gap: .68rem; color: var(--ink); font-weight: 720; white-space: nowrap; }
.brand-mark {
  display: grid; place-items: center; width: 34px; height: 34px; border-radius: 9px;
  background: var(--brand); color: white; font-size: 1.05rem; letter-spacing: -.08em;
  box-shadow: inset 0 0 0 1px #ffffff22;
}
.brand-name { letter-spacing: -.025em; font-size: 1.1rem; }
.brand-name span { font-weight: 450; }
.top-tools, .actions, .inline { display: flex; align-items: center; flex-wrap: wrap; gap: .55rem; }
.top-tools { justify-content: end; }
.theme { min-width: 40px; font-size: 1.13rem; padding: .36rem .55rem; }
.account-label { margin: 0 .15rem; font-size: .89rem; max-width: 22ch; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.shell { display: grid; grid-template-columns: 220px minmax(0, 1fr); min-height: calc(100dvh - 66px); }
.sidebar { background: var(--surface); border-right: 1px solid var(--line); padding: 1.4rem .65rem; }
.sidebar nav, .nav-group { display: grid; gap: .3rem; }
.nav-title { font-size: .72rem; letter-spacing: .045em; text-transform: uppercase; color: var(--muted); padding: .9rem .65rem .2rem; }
.nav-btn { text-align: left; padding: .6rem .68rem; background: none; border: 0; border-radius: .48rem; }
.nav-btn:hover { background: var(--soft); }
.nav-btn[aria-current] { color: var(--link); background: var(--nav); font-weight: 650; }
.nav-icon { display: inline-block; min-width: 1.65rem; font-size: .95rem; }
.main { min-width: 0; padding: clamp(1.15rem, 3.5vw, 3.2rem); }
.content { width: min(1160px, 100%); margin: auto; display: grid; gap: 1.4rem; }
.heading { display: flex; justify-content: space-between; align-items: center; flex-wrap: wrap; gap: .9rem; }
.heading p, .card-title p, .sign-copy p { margin-top: .42rem; }
.button {
  display: inline-flex; align-items: center; justify-content: center; gap: .3rem;
  border: 1px solid var(--line); border-radius: .52rem; background: var(--surface); color: var(--ink);
  padding: .53rem .83rem; font-size: .92rem; font-weight: 620; min-height: 39px; text-decoration: none;
}
.button:not(:disabled):hover { background: var(--soft); }
.button.primary { background: var(--accent); border-color: var(--accent); color: var(--accent-ink); }
.button.primary:not(:disabled):hover { filter: brightness(.9); }
.button.danger { color: var(--bad); }
.button.danger.solid { background: var(--bad-bg); border-color: var(--bad); }
.button.quiet { background: transparent; border-color: transparent; color: var(--link); padding-inline: .4rem; }
.badge { display: inline-flex; padding: .15rem .55rem; border-radius: .35rem; font-size: .77rem; font-weight: 640; background: var(--soft); color: var(--muted); width: fit-content; }
.badge.good { color: var(--good); background: var(--good-bg); }
.badge.warning { color: var(--warn); background: var(--warn-bg); }
.badge.bad { color: var(--bad); background: var(--bad-bg); }
.cards { display: grid; grid-template-columns: repeat(auto-fit, minmax(min(330px, 100%), 1fr)); gap: 1rem; align-items: start; }
.panel { background: var(--surface); border: 1px solid var(--line); border-radius: .84rem; padding: clamp(1rem, 2vw, 1.45rem); box-shadow: var(--shadow); min-width: 0; }
.panel > * + * { margin-top: .9rem; }
.card-title { display: flex; justify-content: space-between; align-items: start; gap: .65rem; }
.card-title > div { min-width: 0; }
.card-title h2, td, dd { overflow-wrap: anywhere; }
.meta { display: grid; grid-template-columns: minmax(7.5rem, 1fr) minmax(0, 1.25fr); gap: .37rem .55rem; margin-bottom: 0; font-size: .87rem; }
.meta dt { color: var(--muted); }
.meta dd { margin: 0; }
.subpanel { background: var(--soft); border-radius: .64rem; padding: .85rem; }
.subpanel > * + * { margin-top: .55rem; }
.subpanel .actions { gap: .38rem; }
.empty { text-align: center; padding-block: 2.9rem; }
.empty p { max-width: 54ch; margin-inline: auto; }
.notice { padding: .73rem .87rem; border: 1px solid var(--line); border-radius: .57rem; background: var(--soft); font-size: .9rem; }
.notice.error { color: var(--bad); background: var(--bad-bg); border-color: transparent; }
.notice.success { color: var(--good); background: var(--good-bg); border-color: transparent; }
.notice.warning { color: var(--warn); background: var(--warn-bg); border-color: transparent; }
.auth-layout {
  max-width: 980px; margin: clamp(1.7rem, 9vh, 7rem) auto 2rem; padding: 0 1rem;
  display: grid; grid-template-columns: 1fr .92fr; gap: 1.1rem; align-items: stretch;
}
.sign-form { border-radius: .85rem; padding: clamp(1.15rem, 3.5vw, 2.45rem); }
.sign-form > * + * { margin-top: 1.2rem; }
.sign-form h1 { font-size: clamp(1.65rem, 3vw, 2.12rem); }
.auth-aside {
  display: flex; flex-direction: column; justify-content: end; gap: .7rem;
  min-height: 360px; border-radius: .85rem; padding: 2.2rem; color: white; overflow: hidden;
  background: radial-gradient(ellipse at 115% -25%, #2880be, transparent 58%), #00366e;
  position: relative; isolation: isolate;
}
.auth-aside::before, .auth-aside::after { content: ""; position: absolute; border: 1px solid #b9ddff55; border-radius: 25px; transform: rotate(-24deg); width: 140px; height: 140px; top: 24px; right: 36px; z-index: -1; }
.auth-aside::after { width: 102px; height: 102px; right: 84px; top: 66px; }
.auth-aside h2 { max-width: 16ch; font-size: clamp(1.43rem, 3vw, 1.95rem); }
.auth-aside p { color: #d9eaff; max-width: 34ch; }
.form, .fields { display: grid; gap: .86rem; }
.field { min-width: 0; display: grid; gap: .29rem; font-size: .88rem; font-weight: 620; }
.field input, .field select {
  width: 100%; min-width: 0; min-height: 41px; padding: .48rem .65rem; border: 1px solid var(--line);
  border-radius: .5rem; background: var(--surface); font-size: .96rem; font-weight: 450;
}
.checkbox { display: flex; gap: .58rem; align-items: start; font-size: .91rem; }
.checkbox input { width: 1rem; height: 1rem; margin: .19rem 0 0; accent-color: var(--accent); }
.field-grid { display: grid; grid-template-columns: 1fr 1fr; gap: .8rem; }
.country-flag { width: 24px; height: 18px; object-fit: contain; flex: none; }
.flag-title, .server-identity { display: flex; align-items: center; gap: .5rem; min-width: 0; }
.server-text { display: grid; min-width: 0; overflow-wrap: anywhere; }
.server-location { color: var(--muted); font-size: .83em; }
.current-server { display: grid; gap: .35rem; padding: .65rem .8rem; border-radius: .55rem; background: var(--nav); border-left: 3px solid var(--accent); }
.current-server .hint { color: var(--link); }
.server-options, .department-options { display: grid; gap: .45rem; margin: 0; padding: 0; border: 0; min-width: 0; }
.server-options legend, .department-options legend { padding: 0 0 .4rem; font-size: .88rem; font-weight: 620; }
.server-option { display: flex; align-items: center; gap: .62rem; padding: .55rem .65rem; border: 1px solid var(--line); border-radius: .5rem; cursor: pointer; }
.server-option:has(input:checked) { border-color: var(--accent); background: var(--nav); }
.server-option input { margin: 0; accent-color: var(--accent); flex: none; }
.server-option-info { display: grid; gap: .18rem; min-width: 0; }
.server-option:has(input:disabled) { cursor: default; }
.user-server-status { display: grid; justify-items: start; gap: .22rem; }
.user-server-list { display: grid; gap: .65rem; margin: .75rem 0 0; padding: 0; list-style: none; }
.user-server-list li { display: grid; gap: .25rem; }
.flag-picker { border: 1px solid var(--line); border-radius: .5rem; }
.flag-picker summary { display: flex; align-items: center; flex-wrap: wrap; gap: .45rem .65rem; padding: .55rem .65rem; cursor: pointer; font-size: .88rem; }
.flag-picker summary::-webkit-details-marker { display: none; }
.flag-picker summary::after { content: '⌄'; margin-left: auto; color: var(--muted); }
.flag-picker[open] summary::after { transform: rotate(180deg); }
.flag-picker summary .flag-title { color: var(--muted); overflow-wrap: anywhere; }
.flag-content { display: grid; gap: .4rem; padding: .25rem .65rem .65rem; }
.flag-content input { min-width: 0; padding: .4rem .52rem; background: var(--surface); border: 1px solid var(--line); border-radius: .4rem; }
.flag-options { list-style: none; margin: 0; padding: .15rem .15rem .15rem .2rem; max-height: 11rem; overflow: auto; }
.flag-options li + li { margin-top: .18rem; }
.flag-entry { width: 100%; justify-content: start; text-align: left; min-height: 34px; padding: .26rem .44rem; border-color: transparent; font-weight: 450; }
.flag-entry[aria-pressed="true"] { background: var(--nav); }
.flag-entry small { margin-left: auto; color: var(--muted); font-size: .76rem; }
.flag-message { padding: .4rem .2rem; }
.table-wrap { overflow-x: auto; margin: 0; }
table { width: 100%; border-collapse: collapse; font-size: .9rem; text-align: left; }
th, td { border-bottom: 1px solid var(--line); padding: .67rem .54rem; vertical-align: top; }
th { color: var(--muted); font-size: .82rem; font-weight: 660; }
tr:last-child td { border-bottom: 0; }
th:last-child, td:last-child { text-align: right; }
td .actions { justify-content: end; }
td .badge { white-space: nowrap; }
.table-panel { padding-block: .65rem; }
.session + .session { border-top: 1px solid var(--line); padding-top: .65rem; }
.session { display: flex; justify-content: space-between; gap: .7rem; align-items: center; flex-wrap: wrap; }
.button.peer-count { min-height: 0; padding: 0 .2rem; text-decoration: underline; text-underline-offset: .16em; }
.vpn-peer-list { display: grid; gap: .65rem; padding: 0; list-style: none; }
.vpn-peer-list .session > div { min-width: 0; overflow-wrap: anywhere; }
dialog {
  width: min(100% - 1.5rem, 470px); max-height: calc(100dvh - 1.5rem); overflow: auto;
  border-radius: .88rem; padding: 1.3rem; border: 1px solid var(--line); background: var(--surface); color: var(--ink);
  box-shadow: 0 22px 85px #0004;
}
dialog::backdrop { background: #081729a8; }
dialog > * + * { margin-top: .85rem; }
.dialog-top { display: flex; align-items: start; justify-content: space-between; gap: .65rem; }
.dialog-top .button { min-height: 32px; padding-block: .2rem; }
.qr-image { display: block; margin-inline: auto; width: min(270px, 100%); height: auto; border-radius: .5rem; }
.vpn-key { display: block; width: 100%; resize: vertical; padding: .65rem; border: 1px solid var(--line); border-radius: .5rem; background: var(--soft); color: var(--ink); font: .85rem/1.55 monospace; }
dialog:has(.vpn-guide) { width: min(100% - 1.5rem, 560px); }
.vpn-guide { display: grid; gap: .78rem; }
.guide-platforms { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: .3rem; padding: .3rem; border-radius: .64rem; background: var(--soft); }
.guide-platforms .button { justify-content: center; background: transparent; border-color: transparent; }
.guide-platforms .button[aria-pressed="true"] { background: var(--surface); border-color: var(--line); color: var(--link); box-shadow: var(--shadow); }
.guide-steps { display: grid; gap: .58rem; margin: 0; padding: 0; list-style: none; }
.guide-card { display: grid; grid-template-columns: auto minmax(0, 1fr); gap: .68rem; padding: .75rem; border: 1px solid var(--line); border-radius: .7rem; }
.guide-step { display: grid; place-items: center; width: 1.76rem; height: 1.76rem; border-radius: .5rem; background: var(--nav); color: var(--link); font-size: .86rem; font-weight: 680; }
.guide-card-body { display: grid; justify-items: start; gap: .32rem; padding-top: .08rem; }
.guide-card .muted { font-size: .9rem; }
.guide-card-body > .button { margin-top: .2rem; }
.guide-feedback { width: 100%; display: grid; gap: .35rem; }
.guide-feedback:empty { display: none; }
.guide-demo { grid-column: 1 / -1; display: grid; gap: .45rem; min-width: 0; margin: 0; }
.guide-demo figcaption { display: flex; justify-content: space-between; align-items: center; gap: .4rem .65rem; flex-wrap: wrap; font-size: .85rem; }
.guide-demo-toggle { min-height: 34px; padding: .27rem .6rem; font-size: .82rem; }
.guide-demo-image { display: block; width: auto; height: auto; max-width: 100%; max-height: min(74dvh, 740px); margin-inline: auto; border: 1px solid var(--line); border-radius: .58rem; background: #101b2d; object-fit: contain; }
@media (prefers-reduced-motion: no-preference) {
  .guide-card { animation: guide-appear 210ms ease-out both; }
  .guide-card:nth-child(2) { animation-delay: 45ms; }
  .guide-card:nth-child(3) { animation-delay: 90ms; }
  @keyframes guide-appear {
    from { opacity: 0; transform: translateY(5px); }
    to { opacity: 1; transform: translateY(0); }
  }
}
.code { font-family: "IBM Plex Mono", Consolas, monospace; font-size: .84rem; }
.proxy-card .card-title { flex-wrap: wrap; }
.proxy-card .card-title .badge { flex: none; }
.proxy-card .card-title p { margin-top: .15rem; }
.proxy-feedback:empty { display: none; }
.proxy-link { resize: none; overflow-wrap: anywhere; }
.proxy-diagnostics { background: var(--soft); border-radius: .5rem; padding: .55rem .65rem; }
.proxy-diagnostics summary { cursor: pointer; font-size: .88rem; font-weight: 620; }
.proxy-diagnostics .hint { margin-top: .5rem; }
.proxy-session > div { min-width: 0; overflow-wrap: anywhere; }
@media (max-width: 820px) {
  .shell { grid-template-columns: 165px minmax(0,1fr); }
  .nav-btn { padding-inline: .45rem; font-size: .89rem; }
}
@media (max-width: 640px) {
  .top { min-height: 59px; padding: .58rem .85rem; }
  .brand-mark { width: 29px; height: 29px; border-radius: 7px; }
  .brand-name { font-size: .95rem; }
  .account-label { display: none; }
  .top-tools { flex-wrap: nowrap; gap: .24rem; }
  .top-tools .button { min-height: 36px; font-size: .82rem; padding: .3rem .45rem; }
  .shell { display: block; }
  .sidebar { border: 0; border-bottom: 1px solid var(--line); padding: .46rem .75rem; }
  .sidebar nav { display: grid; gap: .35rem; }
  .nav-group { display: flex; flex-wrap: wrap; gap: .2rem; }
  .nav-group + .nav-group { border-top: 1px solid var(--line); padding-top: .35rem; }
  .nav-title { display: none; }
  .nav-btn { padding: .42rem .48rem; font-size: .82rem; }
  .nav-icon { min-width: 1.15rem; }
  .main { padding: 1.15rem .85rem 2rem; }
  .content { gap: 1rem; }
  .auth-layout { grid-template-columns: 1fr; margin-top: 1.15rem; }
  .auth-aside { display: none; }
  .heading { align-items: start; }
  .table-wrap { overflow: visible; }
  table, tbody, tr, td { display: block; }
  thead { display: none; }
  tr { padding: .35rem 0; }
  tr + tr { border-top: 1px solid var(--line); }
  td, td:last-child { display: grid; grid-template-columns: minmax(5.2rem, .37fr) minmax(0, 1fr); gap: .55rem; border: 0; text-align: left; padding: .28rem .05rem; }
  td::before { content: attr(data-label); color: var(--muted); font-size: .8rem; }
  td .actions { justify-content: start; }
  .proxy-card .actions > *, dialog:has(.proxy-link) .actions > * { flex: 1 1 auto; min-height: 44px; }
}
