:root {
  color: #132238;
  background: #f5f7fb;
  font-family: Inter, ui-sans-serif, -apple-system, BlinkMacSystemFont, "Segoe UI", "PingFang SC", "Microsoft YaHei", sans-serif;
  font-size: 14px;
  line-height: 1.5;
  --ink: #132238;
  --muted: #718096;
  --line: #e5eaf2;
  --card: #ffffff;
  --blue: #3478f6;
  --green: #16a36b;
  --amber: #d58a19;
  --purple: #8a5cf6;
  --shadow: 0 10px 30px rgba(34, 50, 84, .07);
}
* { box-sizing: border-box; }
body { min-height: 100vh; margin: 0; background: radial-gradient(circle at 8% -10%, #e9f2ff 0, transparent 34%), var(--background, #f5f7fb); }
button, input { font: inherit; }
button { cursor: pointer; }
button:disabled { cursor: wait; opacity: .62; }
button:focus-visible, input:focus-visible { outline: 3px solid rgba(52, 120, 246, .25); outline-offset: 2px; }
[hidden] { display: none !important; }
.topbar { height: 74px; display: flex; align-items: center; justify-content: space-between; padding: 0 42px; border-bottom: 1px solid rgba(221, 228, 239, .9); background: rgba(255, 255, 255, .86); backdrop-filter: blur(16px); position: sticky; top: 0; z-index: 5; }
.brand { display: inline-flex; align-items: center; gap: 12px; color: var(--ink); text-decoration: none; }
.brand-mark { display: grid; width: 36px; height: 36px; place-items: center; border-radius: 11px; color: #fff; background: linear-gradient(135deg, #3b82f6, #6756e8); box-shadow: 0 7px 15px rgba(59, 130, 246, .25); font-size: 21px; font-weight: 700; }
.brand strong, .brand small { display: block; }
.brand strong { font-size: 16px; letter-spacing: -.01em; }
.brand small { margin-top: 1px; color: var(--muted); font-size: 11px; }
.topbar-actions { display: flex; align-items: center; gap: 18px; }
.secure-label { display: inline-flex; align-items: center; gap: 7px; color: #64748b; font-size: 12px; }
.secure-label i { width: 7px; height: 7px; border-radius: 50%; background: #25b77b; box-shadow: 0 0 0 4px #e5f7ef; }
main { width: min(1420px, calc(100% - 64px)); margin: 0 auto; padding: 42px 0 74px; }
.page-heading { display: flex; align-items: flex-end; justify-content: space-between; gap: 20px; margin-bottom: 28px; }
.heading-actions { display: flex; align-items: center; gap: 8px; }
.eyebrow { margin: 0 0 5px; color: #73829b; font-size: 11px; font-weight: 700; letter-spacing: .13em; text-transform: uppercase; }
h1, h2, p { margin-top: 0; }
h1 { margin-bottom: 6px; color: #142238; font-size: clamp(27px, 3vw, 35px); line-height: 1.15; letter-spacing: -.04em; }
h2 { margin: 0; color: #16263d; font-size: 18px; letter-spacing: -.02em; }
.muted, .panel-help { color: var(--muted); }
.page-heading .muted { margin: 0; font-size: 14px; }
.outline-button, .ghost-button, .primary-button, .copy-button, .danger-button, .text-button, .icon-button { border: 0; transition: background .18s, color .18s, box-shadow .18s, transform .18s; }
.outline-button { display: inline-flex; align-items: center; gap: 8px; min-height: 42px; padding: 0 15px; color: #3b66c4; border: 1px solid #d4def2; border-radius: 10px; background: #fff; box-shadow: 0 4px 10px rgba(63, 90, 140, .05); }
.outline-button:hover { background: #f0f5ff; border-color: #b8caf0; }
.ghost-button { padding: 6px 10px; color: #68778c; background: transparent; border-radius: 7px; }
.ghost-button:hover { color: #1e4da4; background: #edf3ff; }
.primary-button { min-height: 42px; padding: 0 19px; color: #fff; border-radius: 10px; background: linear-gradient(135deg, #3478f6, #5c62e8); box-shadow: 0 8px 16px rgba(52, 120, 246, .22); font-weight: 650; }
.primary-button:hover { transform: translateY(-1px); box-shadow: 0 11px 20px rgba(52, 120, 246, .28); }
.primary-button.wide { width: 100%; display: flex; align-items: center; justify-content: space-between; }
.stats-grid { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 16px; margin-bottom: 22px; }
.stat-card { position: relative; min-height: 136px; padding: 21px 22px; overflow: hidden; border: 1px solid transparent; border-radius: 16px; box-shadow: var(--shadow); }
.stat-card::after { position: absolute; right: -28px; bottom: -45px; width: 130px; height: 130px; border-radius: 50%; background: currentColor; content: ""; opacity: .08; }
.stat-card.blue { color: #2f70e4; background: linear-gradient(135deg, #eef5ff, #fff); border-color: #d9e8ff; }
.stat-card.green { color: #129564; background: linear-gradient(135deg, #ecfbf4, #fff); border-color: #d5f2e4; }
.stat-card.amber { color: #c77d11; background: linear-gradient(135deg, #fff8e9, #fff); border-color: #f6e6be; }
.stat-card.purple { color: #7850e0; background: linear-gradient(135deg, #f4efff, #fff); border-color: #e4d9ff; }
.stat-label, .stat-card small { display: block; color: #63728a; }
.stat-label { font-size: 13px; font-weight: 600; }
.stat-card strong { display: block; margin: 10px 0 3px; color: #182b45; font-size: 30px; line-height: 1; letter-spacing: -.04em; }
.stat-card small { font-size: 12px; }
.health-banner { display: flex; align-items: center; gap: 12px; min-height: 56px; margin: -6px 0 22px; padding: 11px 15px; border: 1px solid #f2dfb3; border-radius: 12px; background: #fffaf0; color: #8b631e; }
.health-banner.pending { border-color: #d5e1fb; background: #f4f7ff; color: #4364a3; }
.health-icon { display: grid; flex: 0 0 25px; width: 25px; height: 25px; place-items: center; border-radius: 50%; background: #f1c66c; color: #fff; font-size: 13px; font-weight: 800; }
.health-banner.pending .health-icon { background: #7193dc; }
.health-copy { display: flex; min-width: 0; flex: 1; flex-direction: column; line-height: 1.35; }
.health-copy strong { font-size: 13px; }
.health-copy span { margin-top: 2px; color: inherit; opacity: .8; font-size: 12px; }
.health-banner .text-button { flex: 0 0 auto; margin: 0; }
.action-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; margin-bottom: 22px; }
.panel { border: 1px solid var(--line); border-radius: 16px; background: var(--card); box-shadow: var(--shadow); }
.config-panel, .approve-panel { padding: 23px 24px; }
.panel-heading { display: flex; align-items: flex-start; justify-content: space-between; gap: 18px; }
.panel-heading.compact { align-items: center; }
.panel-icon { display: grid; width: 32px; height: 32px; place-items: center; color: #4a6ac3; border-radius: 9px; background: #edf3ff; font-size: 19px; }
.panel-help { margin: 9px 0 16px; font-size: 13px; }
.copy-field, .approve-form { display: flex; gap: 9px; }
input { min-width: 0; height: 42px; padding: 0 12px; color: #20324a; border: 1px solid #d9e1ec; border-radius: 9px; background: #fbfcfe; }
input::placeholder { color: #a2adbd; }
#phone { flex: 1; color: #4e6180; font-family: ui-monospace, SFMono-Regular, Menlo, monospace; font-size: 12px; }
#code { flex: 1; letter-spacing: .2em; }
.copy-button { min-width: 62px; color: #3562bd; border: 1px solid #d2dff8; border-radius: 9px; background: #f1f5ff; font-weight: 600; }
.copy-button:hover { background: #e3edff; }
.device-panel { overflow: hidden; }
.device-panel > .panel-heading { padding: 23px 25px 17px; }
.device-panel .panel-help { margin-bottom: 0; }
.device-tools { display: flex; align-items: center; justify-content: flex-end; gap: 8px; flex-wrap: wrap; }
.search-box { display: flex; width: 185px; height: 34px; align-items: center; gap: 5px; padding: 0 8px; color: #8190a5; border: 1px solid #dce4ef; border-radius: 8px; background: #fbfcfe; }
.search-box span { font-size: 18px; line-height: 1; }
.search-box input { width: 100%; height: 30px; padding: 0 2px; border: 0; outline: 0; background: transparent; font-size: 12px; }
.device-tools select { height: 34px; padding: 0 8px; color: #60718b; border: 1px solid #dce4ef; border-radius: 8px; background: #fbfcfe; font-size: 12px; }
.device-count { color: #7d8ca1; font-size: 11px; white-space: nowrap; }
.last-updated { color: #8290a4; font-size: 12px; white-space: nowrap; }
.table-wrap { overflow-x: auto; }
table { width: 100%; min-width: 980px; border-collapse: collapse; text-align: left; }
thead { background: #f8faff; border-top: 1px solid #edf1f7; border-bottom: 1px solid #e8edf4; }
th, td { padding: 14px 18px; border-bottom: 1px solid #edf0f5; vertical-align: middle; }
th { color: #7b899e; font-size: 11px; font-weight: 700; letter-spacing: .08em; text-transform: uppercase; white-space: nowrap; }
tbody tr:last-child td { border-bottom: 0; }
tbody tr { transition: background .15s; }
tbody tr:hover { background: #fbfcff; }
.device-identity { display: flex; min-width: 175px; align-items: center; gap: 11px; }
.device-avatar { display: grid; flex: 0 0 38px; width: 38px; height: 38px; place-items: center; color: #3e66bf; border-radius: 11px; background: #eaf1ff; font-size: 12px; font-weight: 750; }
.device-details { min-width: 0; }
.device-name-line { display: flex; align-items: center; gap: 4px; min-width: 0; }
.device-name, .device-id, .egress-ip, .egress-region, .egress-org, .cell-note { display: block; }
.device-name { overflow: hidden; color: #20324b; font-weight: 650; text-overflow: ellipsis; white-space: nowrap; }
.edit-button { flex: 0 0 auto; padding: 1px 3px; color: #8a9ab0; border: 0; border-radius: 4px; background: transparent; font-size: 13px; line-height: 1; opacity: 0; }
.device-row:hover .edit-button, .edit-button:focus-visible { opacity: 1; }
.edit-button:hover { color: #3970d5; background: #edf3ff; }
.rename-editor { display: flex; align-items: center; gap: 4px; }
.rename-editor input { width: 132px; height: 28px; padding: 0 6px; font-size: 12px; }
.rename-editor button { height: 28px; padding: 0 5px; border-radius: 5px; font-size: 11px; }
.rename-save { color: #fff; border: 0; background: #3970d5; }
.rename-cancel { color: #6d7c91; border: 1px solid #dce4ef; background: #fff; }
.device-id { margin-top: 2px; color: #9aa7b9; font-family: ui-monospace, monospace; font-size: 10px; }
.status-cell { min-width: 115px; }
.status-badge { display: inline-flex; align-items: center; gap: 6px; color: #586a83; font-size: 12px; font-weight: 650; }
.status-badge i { width: 7px; height: 7px; border-radius: 50%; background: #9ca8b8; }
.status-badge.online { color: #138759; }
.status-badge.online i { background: #18a972; box-shadow: 0 0 0 4px #e2f7ed; }
.status-badge.connecting { color: #496eb8; }
.status-badge.connecting i { background: #6d91df; box-shadow: 0 0 0 4px #e8efff; animation: status-pulse 1.5s ease-in-out infinite; }
.status-badge.pending { color: #b8760d; }
.status-badge.pending i { background: #e5a329; box-shadow: 0 0 0 4px #fff3d8; }
@keyframes status-pulse { 50% { opacity: .35; transform: scale(.78); } }
.cell-note { margin-top: 5px; color: #9aa6b6; font-size: 11px; line-height: 1.35; }
.offline-note { color: #b7791f; }
.code-note { color: #bd7a16; font-family: ui-monospace, monospace; }
.egress-cell { min-width: 178px; }
.egress-ip { color: #243a5a; font-family: ui-monospace, monospace; font-size: 13px; font-weight: 700; }
.egress-region { margin-top: 2px; color: #536782; font-size: 12px; }
.egress-org { margin-top: 2px; max-width: 180px; overflow: hidden; color: #94a0b1; font-size: 11px; text-overflow: ellipsis; white-space: nowrap; }
.warning { color: #b8760d; }
.text-button { margin-top: 7px; padding: 0; color: #3970d5; background: transparent; font-size: 11px; }
.text-button:hover { color: #1c4eaa; text-decoration: underline; }
.traffic-cell { min-width: 155px; }
.traffic-line { display: flex; gap: 9px; color: #64758c; font-size: 12px; font-family: ui-monospace, monospace; }
.traffic-line .up { color: #2871dd; }
.traffic-line .down { color: #129565; }
.proxy-cell { min-width: 290px; }
.proxy-field { display: flex; gap: 6px; }
.proxy-field input { width: 245px; height: 34px; padding: 0 9px; color: #536988; background: #f8faff; font-family: ui-monospace, monospace; font-size: 10px; }
.icon-button { display: grid; flex: 0 0 34px; width: 34px; height: 34px; place-items: center; color: #5274bc; border: 1px solid #d5e0f3; border-radius: 8px; background: #f0f5ff; font-size: 16px; }
.icon-button:hover { color: #244c9c; background: #e3edff; }
.action-cell { width: 76px; text-align: right; }
.danger-button { padding: 5px 9px; color: #bc5260; border-radius: 7px; background: transparent; font-size: 12px; }
.danger-button:hover { color: #a72e3e; background: #fff0f1; }
.empty-state { display: flex; min-height: 185px; flex-direction: column; align-items: center; justify-content: center; gap: 6px; color: #6c7d94; text-align: center; }
.empty-icon { display: grid; width: 43px; height: 43px; place-items: center; margin-bottom: 3px; color: #6889cc; border-radius: 13px; background: #edf3ff; font-size: 22px; }
.empty-state strong { color: #344b6b; font-size: 14px; }
.empty-state span { font-size: 12px; }
.login-shell { min-height: calc(100vh - 74px); display: grid; place-items: center; padding: 40px 0; }
.login-card { width: min(410px, 100%); padding: 39px 40px 31px; border: 1px solid #e3e9f2; border-radius: 20px; background: rgba(255, 255, 255, .93); box-shadow: 0 22px 60px rgba(47, 70, 111, .12); }
.login-icon { display: grid; width: 48px; height: 48px; place-items: center; margin-bottom: 21px; color: #fff; border-radius: 15px; background: linear-gradient(135deg, #3478f6, #6756e8); box-shadow: 0 9px 20px rgba(52, 120, 246, .25); font-size: 25px; font-weight: 700; }
.login-card h1 { margin-bottom: 9px; font-size: 29px; }
.login-card .muted { margin-bottom: 26px; font-size: 13px; }
.login-card label { display: block; margin-bottom: 7px; color: #425570; font-size: 12px; font-weight: 650; }
.login-card input { width: 100%; margin-bottom: 13px; }
.login-note { margin: 20px 0 0; color: #9aa7ba; font-size: 11px; text-align: center; }
.toast { position: fixed; right: 22px; bottom: 22px; z-index: 20; max-width: min(420px, calc(100% - 44px)); padding: 11px 15px; transform: translateY(12px); opacity: 0; pointer-events: none; border: 1px solid #f1d1d1; border-radius: 10px; background: #fff8f8; box-shadow: 0 12px 30px rgba(53, 62, 84, .14); color: #b23f4d; font-size: 13px; transition: opacity .2s, transform .2s; }
.toast.show { transform: translateY(0); opacity: 1; }
.toast.success { color: #137f59; border-color: #cceede; background: #f4fffa; }
@media (max-width: 900px) {
  .topbar { padding: 0 24px; }
  main { width: min(100% - 36px, 720px); padding-top: 32px; }
  .stats-grid { grid-template-columns: repeat(2, 1fr); }
  .action-grid { grid-template-columns: 1fr; }
}
@media (max-width: 560px) {
  .topbar { height: 65px; padding: 0 16px; }
  .secure-label { display: none; }
  main { width: calc(100% - 28px); padding: 26px 0 50px; }
  .page-heading { align-items: flex-start; }
  .heading-actions { flex: 0 0 auto; }
  .page-heading .muted { max-width: 240px; }
  .outline-button { padding: 0 11px; }
  .outline-button span { display: none; }
  .stats-grid { gap: 10px; }
  .stat-card { min-height: 113px; padding: 16px; border-radius: 13px; }
  .stat-card strong { margin-top: 7px; font-size: 25px; }
  .config-panel, .approve-panel, .device-panel > .panel-heading { padding: 18px; }
  .copy-field, .approve-form { flex-direction: column; }
  .copy-button, .approve-form .primary-button { width: 100%; }
  .device-panel > .panel-heading { gap: 8px; }
  .device-tools { width: 100%; justify-content: flex-start; margin-top: 5px; }
  .search-box { flex: 1; width: auto; }
  .edit-button { opacity: 1; }
  .health-banner { align-items: flex-start; }
  .health-banner .text-button { align-self: center; }
  .last-updated { font-size: 10px; }
  .login-shell { min-height: calc(100vh - 65px); }
  .login-card { padding: 30px 24px 25px; }
}
