:root {
  color-scheme: light;
  --brand-blue: #1677ff;
  --brand-blue-hover: #4096ff;
  --brand-blue-soft: #eaf3ff;
  --success-green: #52c41a;
  --success-soft: #f0f9eb;
  --warning-amber: #faad14;
  --warning-soft: #fff7e6;
  --danger-red: #ff4d4f;
  --danger-soft: #fff1f0;
  --ink-primary: #1d2129;
  --ink-secondary: #4e5969;
  --ink-tertiary: #86909c;
  --ink-disabled: #c9cdd4;
  --canvas: #f5f7fa;
  --paper: #ffffff;
  --paper-hover: #f7faff;
  --input-well: #f7f8fa;
  --line: #e5e6eb;
  --line-soft: #f0f1f2;
  --shadow-card: 0 1px 2px rgba(0, 0, 0, .02), 0 2px 8px rgba(0, 0, 0, .035);
  --radius-control: 6px;
  --radius-card: 8px;
  --sidebar-width: 224px;
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", "PingFang SC", "Microsoft YaHei", "Helvetica Neue", Arial, sans-serif;
  font-synthesis: none;
}

* { box-sizing: border-box; }
html, body { margin: 0; min-width: 320px; min-height: 100%; }
body { background: var(--canvas); color: var(--ink-primary); font-size: 14px; -webkit-font-smoothing: antialiased; }
button, input, select { font: inherit; }
button { color: inherit; }
svg { width: 1em; height: 1em; fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; }

.app-shell { min-height: 100vh; }
.sidebar { position: fixed; inset: 0 auto 0 0; z-index: 20; width: var(--sidebar-width); display: flex; flex-direction: column; background: var(--paper); border-right: 1px solid var(--line); }
.brand { height: 64px; display: flex; align-items: center; gap: 10px; padding: 0 20px; border-bottom: 1px solid var(--line-soft); }
.brand-icon { width: 34px; height: 34px; display: grid; place-items: center; flex: 0 0 auto; border-radius: 8px; background: var(--brand-blue); color: white; box-shadow: 0 4px 10px rgba(22,119,255,.2); }
.brand-icon svg { width: 23px; height: 23px; stroke-width: 2; }
.brand-copy { min-width: 0; }
.brand-copy strong, .brand-copy small { display: block; white-space: nowrap; }
.brand-copy strong { font-size: 15px; font-weight: 650; letter-spacing: -.01em; }
.brand-copy small { margin-top: 2px; color: var(--ink-tertiary); font-size: 11px; }
.sidebar-close { display: none; width: 32px; height: 32px; margin-left: auto; place-items: center; border: 0; border-radius: 5px; background: transparent; color: var(--ink-tertiary); font-size: 22px; }

.nav { flex: 1; padding: 12px 10px; overflow-y: auto; }
.nav-label { margin: 16px 12px 6px; color: var(--ink-tertiary); font-size: 12px; }
.nav-label:first-child { margin-top: 4px; }
.nav-item { width: 100%; height: 42px; display: flex; align-items: center; gap: 11px; margin: 2px 0; padding: 0 12px; border: 0; border-radius: var(--radius-control); background: transparent; color: var(--ink-secondary); text-decoration: none; cursor: pointer; transition: color 150ms, background-color 150ms; }
.nav-item svg { width: 18px; height: 18px; flex: 0 0 auto; }
.nav-item span { flex: 1; text-align: left; }
.nav-item:hover { background: #f2f3f5; color: var(--ink-primary); }
.nav-item.active { background: var(--brand-blue-soft); color: var(--brand-blue); font-weight: 600; }
.nav-item.disabled { cursor: default; color: var(--ink-disabled); }
.nav-item.disabled:hover { background: transparent; color: var(--ink-disabled); }
.nav-item em { padding: 1px 5px; border-radius: 3px; background: #f2f3f5; color: var(--ink-tertiary); font-size: 10px; font-style: normal; }
.nav-button { text-align: left; }
.sidebar-foot { min-height: 66px; display: flex; align-items: center; gap: 10px; padding: 12px 20px; border-top: 1px solid var(--line-soft); }
.server-light { width: 8px; height: 8px; flex: 0 0 auto; border-radius: 50%; background: var(--success-green); box-shadow: 0 0 0 4px var(--success-soft); }
.sidebar-foot strong, .sidebar-foot small { display: block; }
.sidebar-foot strong { font-size: 12px; font-weight: 500; }
.sidebar-foot small { margin-top: 3px; color: var(--ink-tertiary); font-size: 11px; }

.workspace { min-height: 100vh; margin-left: var(--sidebar-width); }
.topbar { height: 64px; display: flex; align-items: center; justify-content: space-between; padding: 0 24px; background: var(--paper); border-bottom: 1px solid var(--line); }
.breadcrumb { display: flex; align-items: center; gap: 10px; color: var(--ink-tertiary); font-size: 13px; }
.breadcrumb i { color: var(--ink-disabled); font-style: normal; }
.breadcrumb strong { color: var(--ink-primary); font-weight: 500; }
.topbar-right { display: flex; align-items: center; gap: 9px; color: var(--ink-secondary); font-size: 13px; }
.environment { display: inline-flex; align-items: center; gap: 7px; }
.environment i { width: 7px; height: 7px; border-radius: 50%; background: var(--success-green); }
.divider { width: 1px; height: 18px; margin: 0 5px; background: var(--line); }
.avatar { width: 30px; height: 30px; display: grid; place-items: center; border-radius: 50%; background: var(--brand-blue-soft); color: var(--brand-blue); font-size: 12px; font-weight: 600; }
.mobile-menu { display: none; width: 36px; height: 36px; place-items: center; border: 0; background: transparent; }
.mobile-menu svg { width: 21px; height: 21px; }

.content { max-width: 1560px; margin: 0 auto; padding: 24px; }
.page-title-row { display: flex; align-items: flex-end; justify-content: space-between; gap: 20px; margin-bottom: 20px; }
.page-title-row h1 { margin: 0; font-size: 24px; line-height: 1.35; font-weight: 650; letter-spacing: -.025em; }
.page-title-row p { margin: 5px 0 0; color: var(--ink-tertiary); font-size: 13px; }
.page-actions { display: flex; gap: 10px; }

.button { min-height: 36px; display: inline-flex; align-items: center; justify-content: center; gap: 7px; padding: 0 15px; border: 1px solid transparent; border-radius: var(--radius-control); font-size: 13px; cursor: pointer; transition: background-color 150ms, border-color 150ms, color 150ms, transform 100ms; }
.button svg { width: 15px; height: 15px; }
.button:active { transform: scale(.98); }
.button:focus-visible, .icon-button:focus-visible, input:focus-visible, select:focus-visible { outline: 3px solid rgba(22,119,255,.16); outline-offset: 1px; }
.button:disabled { cursor: not-allowed; opacity: .55; }
.button-primary { background: var(--brand-blue); border-color: var(--brand-blue); color: white; }
.button-primary:hover { background: var(--brand-blue-hover); border-color: var(--brand-blue-hover); }
.button-default { background: white; border-color: #d9dce1; color: var(--ink-primary); }
.button-default:hover { border-color: var(--brand-blue); color: var(--brand-blue); }
.button-text { padding-inline: 9px; background: transparent; color: var(--ink-secondary); }
.button-text:hover { color: var(--brand-blue); }
.button-danger { background: var(--danger-red); border-color: var(--danger-red); color: white; }
.button-danger:hover { background: #ff7875; border-color: #ff7875; }

.summary-grid { display: grid; grid-template-columns: repeat(4, minmax(180px, 1fr)); gap: 16px; margin-bottom: 16px; }
.summary-card { min-height: 116px; display: flex; align-items: center; gap: 16px; padding: 20px; background: var(--paper); border-radius: var(--radius-card); box-shadow: var(--shadow-card); }
.summary-icon { width: 48px; height: 48px; display: grid; place-items: center; flex: 0 0 auto; border-radius: 12px; }
.summary-icon svg { width: 24px; height: 24px; stroke-width: 1.8; }
.summary-total .summary-icon { background: var(--brand-blue-soft); color: var(--brand-blue); }
.summary-online .summary-icon { background: var(--success-soft); color: var(--success-green); }
.summary-ready .summary-icon { background: #f0f5ff; color: #597ef7; }
.summary-warning .summary-icon { background: var(--warning-soft); color: var(--warning-amber); }
.summary-card span, .summary-card strong, .summary-card small { display: block; }
.summary-card span { color: var(--ink-secondary); font-size: 13px; }
.summary-card strong { margin: 5px 0 3px; font-size: 28px; line-height: 1; font-weight: 650; font-variant-numeric: tabular-nums; letter-spacing: -.03em; }
.summary-card small { color: var(--ink-tertiary); font-size: 11px; }
.summary-card small b { color: var(--warning-amber); font-weight: 600; }

.pool-card { background: var(--paper); border-radius: var(--radius-card); box-shadow: var(--shadow-card); overflow: hidden; }
.pool-heading { min-height: 68px; display: flex; align-items: center; justify-content: space-between; padding: 14px 20px; border-bottom: 1px solid var(--line-soft); }
.pool-heading h2 { margin: 0; font-size: 16px; font-weight: 600; }
.pool-heading p { margin: 4px 0 0; color: var(--ink-tertiary); font-size: 12px; }
.sync-state { display: flex; align-items: center; gap: 7px; color: var(--ink-tertiary); font-size: 12px; }
.sync-state i { width: 7px; height: 7px; border-radius: 50%; background: var(--success-green); }

.filter-bar { min-height: 66px; display: flex; align-items: center; gap: 10px; padding: 14px 20px; border-bottom: 1px solid var(--line-soft); }
.search-control { width: min(320px, 34vw); height: 36px; display: flex; align-items: center; gap: 8px; padding: 0 11px; border: 1px solid #d9dce1; border-radius: var(--radius-control); background: white; color: var(--ink-tertiary); }
.search-control:focus-within { border-color: var(--brand-blue); box-shadow: 0 0 0 2px rgba(22,119,255,.08); }
.search-control svg { width: 16px; height: 16px; flex: 0 0 auto; }
.search-control input { width: 100%; border: 0; outline: 0; background: transparent; color: var(--ink-primary); font-size: 13px; }
.search-control input::placeholder { color: #b4bac3; }
.select-control { height: 36px; display: flex; align-items: center; border: 1px solid #d9dce1; border-radius: var(--radius-control); background: white; overflow: hidden; }
.select-control > span { padding: 0 0 0 11px; color: var(--ink-secondary); font-size: 13px; white-space: nowrap; }
.select-control select { height: 100%; min-width: 108px; padding: 0 28px 0 8px; border: 0; outline: 0; background: transparent; color: var(--ink-primary); font-size: 13px; cursor: pointer; }
.button-search { min-width: 64px; }

.alert { margin: 14px 20px 0; padding: 10px 12px; border: 1px solid #ffccc7; border-radius: var(--radius-control); background: var(--danger-soft); color: #cf1322; font-size: 12px; }
.table-scroll { overflow-x: auto; }
.node-table { width: 100%; min-width: 1050px; border-collapse: collapse; table-layout: fixed; }
.node-table th { height: 44px; padding: 0 16px; background: var(--input-well); color: var(--ink-secondary); font-size: 12px; font-weight: 500; text-align: left; white-space: nowrap; }
.node-table td { height: 68px; padding: 10px 16px; border-bottom: 1px solid var(--line-soft); color: var(--ink-secondary); font-size: 13px; vertical-align: middle; }
.node-table tbody tr:hover { background: var(--paper-hover); }
.node-table th:nth-child(1) { width: 220px; }
.node-table th:nth-child(2) { width: 110px; }
.node-table th:nth-child(3) { width: 155px; }
.node-table th:nth-child(4) { width: 105px; }
.node-table th:nth-child(5) { width: 110px; }
.node-table th:nth-child(6) { width: 130px; }
.node-table th:nth-child(7) { width: 90px; }
.node-table th:nth-child(8) { width: 150px; }
.node-table .action-column { text-align: right; }
.node-table th:last-child,
.node-table td:last-child { position: sticky; right: 0; z-index: 2; background: var(--paper); box-shadow: -8px 0 10px -12px rgba(29,33,41,.65); }
.node-table th:last-child { z-index: 3; background: var(--input-well); }
.node-table tbody tr:hover td:last-child { background: var(--paper-hover); }
.node-cell { display: flex; align-items: center; gap: 11px; min-width: 0; }
.node-symbol { width: 36px; height: 36px; display: grid; place-items: center; flex: 0 0 auto; border-radius: 8px; background: var(--brand-blue-soft); color: var(--brand-blue); }
.node-symbol svg { width: 19px; height: 19px; }
.node-cell strong, .node-cell small { display: block; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.node-cell strong { color: var(--ink-primary); font-size: 13px; font-weight: 500; }
.node-cell small { max-width: 150px; margin-top: 4px; color: var(--ink-tertiary); font: 10px/1.2 ui-monospace, SFMono-Regular, Menlo, Consolas, monospace; }
.status-tag { min-width: 64px; display: inline-flex; align-items: center; justify-content: center; gap: 6px; padding: 4px 8px; border-radius: 4px; font-size: 12px; white-space: nowrap; }
.status-tag i { width: 6px; height: 6px; border-radius: 50%; background: currentColor; }
.status-tag.ready { background: var(--success-soft); color: #389e0d; }
.status-tag.leased, .status-tag.redialing { background: var(--warning-soft); color: #d48806; }
.status-tag.error { background: var(--danger-soft); color: #cf1322; }
.status-tag.offline { background: #f2f3f5; color: var(--ink-tertiary); }
.ip-cell strong, .ip-cell small { display: block; }
.ip-cell strong { color: var(--ink-primary); font: 12px/1.2 ui-monospace, SFMono-Regular, Menlo, Consolas, monospace; font-variant-numeric: tabular-nums; }
.ip-cell small { margin-top: 4px; color: var(--ink-tertiary); font-size: 11px; }
.port-value { color: var(--ink-primary); font: 12px/1 ui-monospace, SFMono-Regular, Menlo, Consolas, monospace; }
.heartbeat { color: var(--ink-secondary); font-size: 12px; }
.generation { color: var(--ink-primary); font-variant-numeric: tabular-nums; }
.actions { display: flex; align-items: center; justify-content: flex-end; gap: 4px; white-space: nowrap; }
.table-action { min-height: 32px; padding: 0 7px; border: 0; background: transparent; color: var(--brand-blue); font-size: 12px; cursor: pointer; }
.table-action:hover { background: var(--brand-blue-soft); border-radius: 4px; }
.table-action.danger { color: var(--danger-red); }
.table-action.danger:hover { background: var(--danger-soft); }
.table-action:disabled { cursor: not-allowed; color: var(--ink-disabled); background: transparent; }
.action-separator { width: 1px; height: 13px; background: var(--line); }
.loading-row td, .empty-row td { height: 220px; color: var(--ink-tertiary); text-align: center; }
.spinner { width: 16px; height: 16px; display: inline-block; margin-right: 8px; border: 2px solid #d9e8ff; border-top-color: var(--brand-blue); border-radius: 50%; vertical-align: -3px; animation: spin .7s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }

.table-footer { min-height: 58px; display: flex; align-items: center; justify-content: space-between; padding: 10px 20px; color: var(--ink-tertiary); font-size: 12px; }
.pagination { display: flex; gap: 6px; }
.pagination button { width: 30px; height: 30px; border: 1px solid var(--line); border-radius: 4px; background: white; color: var(--ink-secondary); }
.pagination button.current { border-color: var(--brand-blue); color: var(--brand-blue); }
.pagination button:disabled { color: var(--ink-disabled); }

.toast { position: fixed; z-index: 100; top: 22px; left: 50%; max-width: calc(100vw - 32px); padding: 11px 16px; border-radius: 6px; background: rgba(29,33,41,.94); color: white; box-shadow: 0 8px 24px rgba(0,0,0,.18); font-size: 13px; opacity: 0; pointer-events: none; transform: translate(-50%, -8px); transition: opacity 180ms, transform 180ms; }
.toast.show { opacity: 1; transform: translate(-50%, 0); }
.modal { width: min(460px, calc(100vw - 32px)); padding: 0; border: 0; border-radius: 10px; background: white; color: var(--ink-primary); box-shadow: 0 18px 60px rgba(0,0,0,.2); }
.modal::backdrop { background: rgba(0,0,0,.42); }
.modal[open] { animation: modal-in 180ms cubic-bezier(.23,1,.32,1); }
@keyframes modal-in { from { opacity: 0; transform: scale(.97) translateY(4px); } }
.modal-head { min-height: 72px; display: flex; align-items: flex-start; justify-content: space-between; padding: 20px 20px 14px; }
.modal-head h2, .modal-head p { margin: 0; }
.modal-head h2 { font-size: 18px; font-weight: 600; }
.modal-head p { margin-top: 5px; color: var(--ink-tertiary); font-size: 12px; }
.icon-button { width: 34px; height: 34px; display: grid; place-items: center; border: 0; border-radius: 5px; background: transparent; color: var(--ink-tertiary); cursor: pointer; font-size: 22px; }
.icon-button:hover { background: #f2f3f5; color: var(--ink-primary); }
.modal-body { padding: 8px 20px 24px; }
.form-field > span, .form-field > small { display: block; }
.form-field > span { margin-bottom: 8px; color: var(--ink-secondary); font-size: 13px; }
.form-field input { width: 100%; height: 40px; padding: 0 11px; border: 1px solid #d9dce1; border-radius: var(--radius-control); outline: 0; }
.form-field input:focus { border-color: var(--brand-blue); }
.form-field small { margin-top: 7px; color: var(--ink-tertiary); font-size: 11px; }
.modal-actions { display: flex; justify-content: flex-end; gap: 8px; padding: 12px 20px; border-top: 1px solid var(--line-soft); }
.confirm-content { display: flex; align-items: flex-start; gap: 14px; padding: 24px 24px 20px; }
.confirm-icon { width: 42px; height: 42px; display: grid; place-items: center; flex: 0 0 auto; border-radius: 50%; background: var(--warning-soft); color: var(--warning-amber); }
.confirm-icon svg { width: 21px; height: 21px; }
.confirm-content h2 { margin: 1px 0 8px; font-size: 17px; }
.confirm-content p { margin: 0; color: var(--ink-secondary); font-size: 13px; line-height: 1.7; }
.confirm-content code { padding: 1px 4px; border-radius: 3px; background: var(--input-well); color: var(--ink-primary); font-size: 12px; }
.onboarding ol { margin: 0; padding: 0; list-style: none; }
.onboarding li { display: flex; gap: 12px; padding: 11px 0; }
.onboarding li > i { width: 25px; height: 25px; display: grid; place-items: center; flex: 0 0 auto; border-radius: 50%; background: var(--brand-blue-soft); color: var(--brand-blue); font-size: 12px; font-style: normal; font-weight: 600; }
.onboarding strong, .onboarding span { display: block; }
.onboarding strong { font-size: 13px; font-weight: 500; }
.onboarding span { margin-top: 4px; color: var(--ink-tertiary); font-size: 12px; line-height: 1.55; }

@media (max-width: 1050px) {
  :root { --sidebar-width: 76px; }
  .brand { justify-content: center; padding: 0; }
  .brand-copy, .nav-label, .nav-item span, .nav-item em, .sidebar-foot div { display: none; }
  .nav-item { justify-content: center; padding: 0; }
  .sidebar-foot { justify-content: center; padding: 0; }
  .summary-grid { grid-template-columns: repeat(2, 1fr); }
}
@media (max-width: 720px) {
  :root { --sidebar-width: 0px; }
  .sidebar { display: none; }
  .sidebar.mobile-open { display: flex; width: 224px; box-shadow: 12px 0 32px rgba(0,0,0,.14); }
  .sidebar.mobile-open .brand { justify-content: flex-start; padding: 0 20px; }
  .sidebar.mobile-open .brand-copy,
  .sidebar.mobile-open .nav-label,
  .sidebar.mobile-open .nav-item span,
  .sidebar.mobile-open .nav-item em,
  .sidebar.mobile-open .sidebar-foot div { display: block; }
  .sidebar.mobile-open .nav-item { justify-content: flex-start; padding: 0 12px; }
  .sidebar.mobile-open .sidebar-foot { justify-content: flex-start; padding: 12px 20px; }
  .sidebar.mobile-open .sidebar-close { display: grid; }
  .topbar { height: 56px; padding: 0 16px; }
  .mobile-menu { display: grid; }
  .breadcrumb { margin-right: auto; margin-left: 8px; }
  .environment, .divider, .admin-name { display: none; }
  .content { padding: 16px; }
  .page-title-row { align-items: flex-start; }
  .page-title-row h1 { font-size: 21px; }
  .page-title-row p { max-width: 260px; }
  .page-actions .button-default { display: none; }
  .summary-grid { grid-template-columns: repeat(2, 1fr); gap: 10px; }
  .summary-card { min-height: 96px; gap: 10px; padding: 14px; }
  .summary-icon { width: 38px; height: 38px; border-radius: 9px; }
  .summary-icon svg { width: 20px; height: 20px; }
  .summary-card strong { font-size: 23px; }
  .filter-bar { flex-wrap: wrap; padding: 12px; }
  .search-control { width: 100%; }
  .pool-heading { padding: 13px 14px; }
  .sync-state { display: none; }
}
@media (max-width: 420px) {
  .summary-card { align-items: flex-start; }
  .summary-icon { display: none; }
  .summary-card strong { margin-top: 7px; }
}
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation: none !important; transition-duration: 0s !important; }
}
