/* ===================================================================
   域名监控 · 设计系统
   无外部依赖；亮色/暗色跟随系统
   =================================================================== */
:root {
  --bg: #f4f5f7;
  --surface: #ffffff;
  --surface-2: #f9fafb;
  --surface-3: #f1f3f6;
  --border: #e5e7eb;
  --border-strong: #d4d7dd;
  --text: #0f172a;
  --text-2: #334155;
  --muted: #64748b;
  --faint: #94a3b8;

  --primary: #4f46e5;
  --primary-hover: #4338ca;
  --primary-soft: #eef2ff;
  --primary-text: #4338ca;

  --ok: #059669;   --ok-soft: #ecfdf5;   --ok-dot: #10b981;
  --down: #dc2626; --down-soft: #fef2f2; --down-dot: #ef4444;
  --warn: #b45309; --warn-soft: #fffbeb; --warn-dot: #f59e0b;
  --info: #475569; --info-soft: #f1f5f9; --info-dot: #94a3b8;

  --shadow-sm: 0 1px 2px rgba(15, 23, 42, .05);
  --shadow: 0 1px 3px rgba(15, 23, 42, .06), 0 1px 2px rgba(15, 23, 42, .04);
  --shadow-lg: 0 20px 40px -12px rgba(15, 23, 42, .25), 0 4px 12px rgba(15, 23, 42, .08);
  --radius: 12px;
  --radius-sm: 8px;
  --sidebar-w: 232px;
  --topbar-h: 60px;
  --font: -apple-system, BlinkMacSystemFont, "Segoe UI", "PingFang SC", "Hiragino Sans GB", "Microsoft YaHei", "Helvetica Neue", Arial, sans-serif;
  --mono: ui-monospace, SFMono-Regular, "SF Mono", Menlo, Consolas, "Liberation Mono", monospace;
  color-scheme: light;
}

@media (prefers-color-scheme: dark) {
  :root {
    --bg: #0b0e14;
    --surface: #121620;
    --surface-2: #161b26;
    --surface-3: #1c2230;
    --border: #232a38;
    --border-strong: #2f3747;
    --text: #e8ebf1;
    --text-2: #c3c9d4;
    --muted: #8b94a5;
    --faint: #5d6678;
    --primary: #6d68f5;
    --primary-hover: #807bff;
    --primary-soft: rgba(109, 104, 245, .14);
    --primary-text: #a5a1ff;
    --ok: #34d399;   --ok-soft: rgba(16, 185, 129, .12);
    --down: #f87171; --down-soft: rgba(239, 68, 68, .13);
    --warn: #fbbf24; --warn-soft: rgba(245, 158, 11, .13);
    --info: #a3adbd; --info-soft: rgba(148, 163, 184, .12);
    --shadow-sm: none;
    --shadow: 0 1px 2px rgba(0, 0, 0, .3);
    --shadow-lg: 0 24px 48px -12px rgba(0, 0, 0, .6);
    color-scheme: dark;
  }
}

* { box-sizing: border-box; }
html, body { margin: 0; }
body {
  font: 14px/1.55 var(--font);
  color: var(--text);
  background: var(--bg);
  -webkit-font-smoothing: antialiased;
}
a { color: var(--primary-text); text-decoration: none; }
a:hover { text-decoration: underline; }
h1, h2, h3, h4 { margin: 0; line-height: 1.3; color: var(--text); }
h1 { font-size: 20px; font-weight: 650; }
h2 { font-size: 16px; font-weight: 600; }
h3 { font-size: 14px; font-weight: 600; }
p { margin: 0; }
code, .mono { font-family: var(--mono); font-size: 12.5px; }
.num { font-variant-numeric: tabular-nums; }
.muted { color: var(--muted); }
.faint { color: var(--faint); }
.small { font-size: 12px; }
.nowrap { white-space: nowrap; }
.truncate { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.hidden { display: none !important; }
.sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); }

svg.icon { width: 16px; height: 16px; flex: none; stroke: currentColor; fill: none; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; vertical-align: -3px; }
svg.icon.lg { width: 20px; height: 20px; }

/* ------------------------------------------------------------ 布局 */
.app { display: flex; min-height: 100vh; }
.sidebar {
  width: var(--sidebar-w); flex: none; position: fixed; inset: 0 auto 0 0; z-index: 30;
  background: var(--surface); border-right: 1px solid var(--border);
  display: flex; flex-direction: column;
}
.brand { height: var(--topbar-h); display: flex; align-items: center; gap: 10px; padding: 0 20px; font-weight: 650; font-size: 15px; }
.brand-mark { width: 30px; height: 30px; border-radius: 9px; display: grid; place-items: center; color: #fff;
  background: linear-gradient(135deg, #6366f1, #4f46e5 55%, #7c3aed); box-shadow: 0 4px 12px rgba(79, 70, 229, .35); }
.brand-mark svg.icon { width: 17px; height: 17px; stroke-width: 2.4; }
.brand small { display: block; font-size: 11px; font-weight: 500; color: var(--muted); margin-top: 1px; }
.nav { padding: 8px 12px; flex: 1; overflow-y: auto; }
.nav-label { font-size: 11px; font-weight: 600; color: var(--faint); text-transform: uppercase; letter-spacing: .06em; padding: 14px 10px 6px; }
.nav a {
  display: flex; align-items: center; gap: 10px; padding: 8px 10px; border-radius: var(--radius-sm);
  color: var(--text-2); font-weight: 500; margin-bottom: 2px;
}
.nav a:hover { background: var(--surface-3); text-decoration: none; color: var(--text); }
.nav a.active { background: var(--primary-soft); color: var(--primary-text); }
.nav a .badge { margin-left: auto; }
.sidebar-foot { border-top: 1px solid var(--border); padding: 12px; }
.user-card { display: flex; align-items: center; gap: 10px; padding: 6px; border-radius: var(--radius-sm); }
.avatar { width: 32px; height: 32px; border-radius: 50%; flex: none; display: grid; place-items: center; font-weight: 600; font-size: 13px;
  background: var(--primary-soft); color: var(--primary-text); }
.user-card .who { min-width: 0; flex: 1; line-height: 1.3; }
.user-card .who b { display: block; font-weight: 600; font-size: 13px; }
.user-card .who span { font-size: 12px; color: var(--muted); }

.main { flex: 1; margin-left: var(--sidebar-w); min-width: 0; display: flex; flex-direction: column; }
.topbar {
  height: var(--topbar-h); position: sticky; top: 0; z-index: 20;
  display: flex; align-items: center; gap: 12px; padding: 0 28px;
  background: color-mix(in srgb, var(--bg) 85%, transparent); backdrop-filter: saturate(1.5) blur(10px);
  border-bottom: 1px solid var(--border);
}
.topbar h1 { flex: 1; min-width: 0; }
.topbar .menu-btn { display: none; }
.content { padding: 24px 28px 96px; max-width: 1440px; width: 100%; }
.page-head { display: flex; align-items: flex-end; justify-content: space-between; gap: 16px; margin-bottom: 18px; flex-wrap: wrap; }
.page-head p { margin-top: 4px; }

/* ------------------------------------------------------------ 组件：卡片 */
.card { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); box-shadow: var(--shadow-sm); }
.card + .card { margin-top: 16px; }
.card-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 16px 20px; border-bottom: 1px solid var(--border); }
.card-head p { margin-top: 2px; }
.card-body { padding: 20px; }
.card-foot { padding: 14px 20px; border-top: 1px solid var(--border); display: flex; gap: 10px; justify-content: flex-end; background: var(--surface-2); border-radius: 0 0 var(--radius) var(--radius); }
.grid { display: grid; gap: 16px; }
.grid-2 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.grid-3 { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.split { display: grid; grid-template-columns: minmax(0, 1.4fr) minmax(0, 1fr); gap: 16px; align-items: start; }

/* KPI */
.kpis { display: grid; grid-template-columns: repeat(auto-fit, minmax(170px, 1fr)); gap: 14px; margin-bottom: 18px; }
.kpi { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); padding: 16px 18px; box-shadow: var(--shadow-sm);
  display: block; color: inherit; position: relative; overflow: hidden; }
a.kpi:hover { text-decoration: none; border-color: var(--border-strong); }
.kpi .label { color: var(--muted); font-size: 13px; display: flex; align-items: center; gap: 6px; }
.kpi .value { font-size: 28px; font-weight: 650; letter-spacing: -.02em; margin-top: 6px; font-variant-numeric: tabular-nums; }
.kpi .sub { font-size: 12px; color: var(--muted); margin-top: 2px; }
.kpi.down .value { color: var(--down); }
.kpi.ok .value { color: var(--ok); }
.kpi.warn .value { color: var(--warn); }
.kpi::after { content: ""; position: absolute; left: 0; top: 0; bottom: 0; width: 3px; background: transparent; }
.kpi.down.hot::after { background: var(--down-dot); }

/* ------------------------------------------------------------ 按钮 */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 6px;
  height: 34px; padding: 0 14px; border-radius: var(--radius-sm); border: 1px solid var(--border-strong);
  background: var(--surface); color: var(--text); font: 500 13px/1 var(--font); cursor: pointer; white-space: nowrap;
  box-shadow: var(--shadow-sm); transition: background .12s, border-color .12s, color .12s;
}
.btn:hover { background: var(--surface-3); text-decoration: none; }
.btn:disabled, .btn.loading { opacity: .6; pointer-events: none; }
.btn.primary { background: var(--primary); border-color: var(--primary); color: #fff; }
.btn.primary:hover { background: var(--primary-hover); border-color: var(--primary-hover); }
.btn.danger { color: var(--down); }
.btn.danger:hover { background: var(--down-soft); border-color: color-mix(in srgb, var(--down) 40%, var(--border)); }
.btn.danger-solid { background: #dc2626; border-color: #dc2626; color: #fff; }
.btn.danger-solid:hover { background: #b91c1c; }
.btn.ghost { background: transparent; border-color: transparent; box-shadow: none; color: var(--text-2); }
.btn.ghost:hover { background: var(--surface-3); color: var(--text); }
.btn.sm { height: 28px; padding: 0 10px; font-size: 12.5px; }
.btn.icon-only { width: 30px; height: 30px; padding: 0; }
.btn.block { width: 100%; }
.btn-group { display: inline-flex; gap: 8px; flex-wrap: wrap; align-items: center; }

/* ------------------------------------------------------------ 表单 */
.field { margin-bottom: 16px; }
.field > label, .label { display: block; font-weight: 500; font-size: 13px; margin-bottom: 6px; color: var(--text-2); }
.help { font-size: 12px; color: var(--muted); margin-top: 6px; }
.errorlist { list-style: none; margin: 6px 0 0; padding: 0; color: var(--down); font-size: 12.5px; }
.input, .field input[type=text], .field input[type=password], .field input[type=number], .field input[type=email],
.field input[type=datetime-local], .field select, .field textarea, select.input, textarea.input {
  width: 100%; height: 36px; padding: 0 12px; border: 1px solid var(--border-strong); border-radius: var(--radius-sm);
  background: var(--surface); color: var(--text); font: 14px var(--font); transition: border-color .12s, box-shadow .12s;
}
.field textarea, textarea.input { height: auto; padding: 10px 12px; line-height: 1.6; resize: vertical; }
.input:focus, .field input:focus, .field select:focus, .field textarea:focus {
  outline: none; border-color: var(--primary); box-shadow: 0 0 0 3px color-mix(in srgb, var(--primary) 20%, transparent);
}
.field.has-error input, .field.has-error select { border-color: var(--down); }
.input-icon { position: relative; }
.input-icon svg.icon { position: absolute; left: 11px; top: 10px; color: var(--faint); pointer-events: none; }
.input-icon .input { padding-left: 34px; }
.form-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 0 20px; }
.form-grid .full { grid-column: 1 / -1; }

.switch { display: inline-flex; align-items: center; gap: 10px; cursor: pointer; user-select: none; }
.switch input { appearance: none; width: 36px; height: 20px; border-radius: 999px; background: var(--border-strong); position: relative; cursor: pointer; transition: background .15s; margin: 0; }
.switch input::after { content: ""; position: absolute; top: 2px; left: 2px; width: 16px; height: 16px; border-radius: 50%; background: #fff; box-shadow: 0 1px 2px rgba(0,0,0,.25); transition: transform .15s; }
.switch input:checked { background: var(--primary); }
.switch input:checked::after { transform: translateX(16px); }

input[type=checkbox].check { width: 16px; height: 16px; accent-color: var(--primary); cursor: pointer; margin: 0; vertical-align: middle; }

/* ------------------------------------------------------------ 状态 */
.pill { display: inline-flex; align-items: center; gap: 6px; height: 24px; padding: 0 10px; border-radius: 999px; font-size: 12.5px; font-weight: 500; white-space: nowrap; }
.pill .dot { width: 7px; height: 7px; border-radius: 50%; background: currentColor; flex: none; }
.pill.ok { background: var(--ok-soft); color: var(--ok); }
.pill.down { background: var(--down-soft); color: var(--down); }
.pill.down .dot { animation: pulse 1.6s ease-out infinite; }
.pill.error { background: var(--warn-soft); color: var(--warn); }
.pill.pending { background: var(--info-soft); color: var(--info); }
.pill.disabled { background: var(--surface-3); color: var(--faint); }
.pill.primary { background: var(--primary-soft); color: var(--primary-text); }
@keyframes pulse { 0% { box-shadow: 0 0 0 0 color-mix(in srgb, currentColor 50%, transparent); } 100% { box-shadow: 0 0 0 6px transparent; } }
.badge { display: inline-flex; align-items: center; justify-content: center; min-width: 20px; height: 20px; padding: 0 6px; border-radius: 999px; font-size: 11.5px; font-weight: 600; background: var(--surface-3); color: var(--muted); font-variant-numeric: tabular-nums; }
.badge.down { background: var(--down); color: #fff; }
.tag { display: inline-flex; align-items: center; height: 20px; padding: 0 7px; border-radius: 6px; font-size: 11.5px; font-weight: 500; background: var(--surface-3); color: var(--text-2); }
.tag.down { background: var(--down-soft); color: var(--down); }
.tag.warn { background: var(--warn-soft); color: var(--warn); }
.tag.ok { background: var(--ok-soft); color: var(--ok); }

/* ------------------------------------------------------------ 横幅 / 提示 */
.banner { display: flex; gap: 12px; align-items: flex-start; padding: 12px 16px; border-radius: var(--radius); margin-bottom: 18px; border: 1px solid; }
.banner svg.icon { margin-top: 2px; }
.banner b { display: block; margin-bottom: 2px; }
.banner.down { background: var(--down-soft); border-color: color-mix(in srgb, var(--down) 30%, transparent); color: var(--down); }
.banner.down p { color: var(--text-2); }
.banner.info { background: var(--primary-soft); border-color: color-mix(in srgb, var(--primary) 25%, transparent); color: var(--primary-text); }
.banner.info p { color: var(--text-2); }

/* ------------------------------------------------------------ 表格 */
.table-wrap { overflow-x: auto; }
table.table { width: 100%; border-collapse: separate; border-spacing: 0; font-size: 13.5px; }
/* 表格放在 .table-wrap（overflow-x:auto）里，它本身就是滚动容器，吸顶偏移必须是 0，
   否则表头会下移一个顶栏的高度，把第一行盖住 */
.table th { text-align: left; font-weight: 500; color: var(--muted); font-size: 12.5px; padding: 10px 14px; background: var(--surface-2); border-bottom: 1px solid var(--border); white-space: nowrap; }
.table td { padding: 12px 14px; border-bottom: 1px solid var(--border); vertical-align: middle; }
.table tbody tr:last-child td { border-bottom: none; }
.table tbody tr { transition: background .1s; }
.table tbody tr:hover { background: var(--surface-2); }
.table tbody tr.selected { background: var(--primary-soft); }
.table tbody tr.is-disabled td { color: var(--faint); }
.table .col-check { width: 44px; padding-right: 0; }
.table .col-actions { width: 1%; white-space: nowrap; text-align: right; }
.host { font-weight: 600; color: var(--text); cursor: pointer; display: inline-flex; align-items: center; gap: 6px; max-width: 100%; }
.host:hover { color: var(--primary-text); text-decoration: none; }
.host-sub { font-size: 12.5px; color: var(--muted); margin-top: 2px; max-width: 360px; }
.row-actions { display: inline-flex; gap: 2px; opacity: .55; transition: opacity .12s; }
tr:hover .row-actions { opacity: 1; }
.empty { text-align: center; padding: 56px 20px; color: var(--muted); }
.empty svg.icon { width: 36px; height: 36px; stroke-width: 1.5; color: var(--faint); margin-bottom: 10px; }
.empty h3 { margin-bottom: 4px; }

/* 状态标签页 */
.tabs { display: flex; gap: 4px; flex-wrap: wrap; }
.tab { display: inline-flex; align-items: center; gap: 7px; height: 32px; padding: 0 12px; border-radius: var(--radius-sm); color: var(--text-2); font-weight: 500; font-size: 13px; border: 1px solid transparent; }
.tab:hover { background: var(--surface-3); text-decoration: none; color: var(--text); }
.tab.active { background: var(--surface); border-color: var(--border-strong); color: var(--text); box-shadow: var(--shadow-sm); }
.tab .badge { height: 18px; min-width: 18px; font-size: 11px; }
.tab.t-down .badge:not(:empty) { background: var(--down-soft); color: var(--down); }
.tab.t-error .badge { background: var(--warn-soft); color: var(--warn); }

.toolbar { display: flex; gap: 10px; align-items: center; flex-wrap: wrap; padding: 14px 16px; border-bottom: 1px solid var(--border); }
.toolbar .grow { flex: 1; min-width: 220px; }
.filters-extra { display: flex; gap: 10px; align-items: flex-end; flex-wrap: wrap; padding: 12px 16px; background: var(--surface-2); border-bottom: 1px solid var(--border); }
.filters-extra .field { margin: 0; }
.filters-extra .field input, .filters-extra .field select { width: auto; height: 32px; }

.pager { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 12px 16px; border-top: 1px solid var(--border); flex-wrap: wrap; }
.pager .pages { display: flex; gap: 4px; align-items: center; }
.pager .pages a, .pager .pages span { min-width: 30px; height: 30px; display: inline-grid; place-items: center; padding: 0 8px; border-radius: 7px; color: var(--text-2); font-size: 13px; }
.pager .pages a:hover { background: var(--surface-3); text-decoration: none; }
.pager .pages .current { background: var(--primary); color: #fff; font-weight: 600; }

.select-banner { display: none; padding: 9px 16px; background: var(--primary-soft); color: var(--primary-text); font-size: 13px; text-align: center; border-bottom: 1px solid var(--border); }
.select-banner.show { display: block; }
.select-banner button { background: none; border: none; color: inherit; font-weight: 600; text-decoration: underline; cursor: pointer; font-size: 13px; padding: 0 4px; }

/* 批量操作栏 */
.bulkbar {
  position: fixed; left: calc(50% + var(--sidebar-w) / 2); bottom: 24px; transform: translate(-50%, 140%);
  z-index: 40; display: flex; align-items: center; gap: 6px; padding: 8px 8px 8px 16px;
  background: #111827; color: #e5e7eb; border-radius: 12px; box-shadow: var(--shadow-lg);
  transition: transform .2s cubic-bezier(.2, .9, .3, 1.2); max-width: calc(100vw - 32px); flex-wrap: wrap;
}
.bulkbar.show { transform: translate(-50%, 0); }
.bulkbar .count { font-weight: 600; margin-right: 8px; white-space: nowrap; }
.bulkbar .btn { background: transparent; border-color: transparent; color: #e5e7eb; box-shadow: none; height: 32px; }
.bulkbar .btn:hover { background: rgba(255, 255, 255, .1); }
.bulkbar .btn.danger { color: #fca5a5; }
.bulkbar .sep { width: 1px; height: 20px; background: rgba(255, 255, 255, .15); margin: 0 4px; }

/* 队列指示器 */
.queue-chip { display: inline-flex; align-items: center; gap: 8px; height: 32px; padding: 0 12px; border-radius: 999px; background: var(--surface); border: 1px solid var(--border); font-size: 12.5px; color: var(--muted); }
.queue-chip.busy { color: var(--primary-text); border-color: color-mix(in srgb, var(--primary) 35%, var(--border)); background: var(--primary-soft); }
.queue-chip .spinner { width: 12px; height: 12px; border-radius: 50%; border: 2px solid currentColor; border-right-color: transparent; animation: spin .8s linear infinite; display: none; }
.queue-chip.busy .spinner { display: inline-block; }
.queue-chip .idle-dot { width: 7px; height: 7px; border-radius: 50%; background: var(--ok-dot); }
.queue-chip.busy .idle-dot { display: none; }
.queue-chip button { background: none; border: none; color: inherit; cursor: pointer; padding: 0; font: inherit; text-decoration: underline; }
@keyframes spin { to { transform: rotate(360deg); } }

/* ------------------------------------------------------------ 列表 / 时间线 */
.list { list-style: none; margin: 0; padding: 0; }
.list li { display: flex; align-items: center; gap: 12px; padding: 12px 20px; border-bottom: 1px solid var(--border); }
.list li:last-child { border-bottom: none; }
.list .grow { flex: 1; min-width: 0; }
.list .title { font-weight: 600; }
.ev-icon { width: 30px; height: 30px; border-radius: 9px; display: grid; place-items: center; flex: none; }
.ev-icon.down, .ev-icon.still_down, .ev-icon.key_paused { background: var(--down-soft); color: var(--down); }
.ev-icon.recovered, .ev-icon.key_resumed { background: var(--ok-soft); color: var(--ok); }

.strip { display: flex; gap: 3px; align-items: flex-end; height: 28px; }
.strip i { flex: 1; min-width: 4px; max-width: 10px; height: 100%; border-radius: 3px; background: var(--ok-dot); opacity: .85; }
.strip i.f { background: var(--warn-dot); height: 70%; }
.strip i.c { background: var(--down-dot); }
.strip i.e { background: var(--info-dot); height: 45%; }

.steps { counter-reset: s; display: grid; gap: 10px; }
.step { display: flex; align-items: center; gap: 12px; padding: 12px 14px; border: 1px solid var(--border); border-radius: var(--radius-sm); background: var(--surface); }
.step::before { counter-increment: s; content: counter(s); width: 24px; height: 24px; border-radius: 50%; display: grid; place-items: center; font-size: 12px; font-weight: 600; background: var(--surface-3); color: var(--muted); flex: none; }
.step.done::before { content: "✓"; background: var(--ok-soft); color: var(--ok); }
.step.done .step-text { color: var(--muted); text-decoration: line-through; }
.step .step-text { flex: 1; }

.meter { height: 6px; border-radius: 999px; background: var(--surface-3); overflow: hidden; min-width: 80px; }
.meter > i { display: block; height: 100%; background: var(--primary); border-radius: inherit; }
.meter.hot > i { background: var(--warn-dot); }
.meter.full > i { background: var(--down-dot); }

.kv { display: grid; grid-template-columns: 110px 1fr; gap: 10px 12px; font-size: 13.5px; }
.kv dt { color: var(--muted); }
.kv dd { margin: 0; min-width: 0; word-break: break-all; }

/* ------------------------------------------------------------ 抽屉 / 对话框 / 提示 */
.drawer-backdrop { position: fixed; inset: 0; background: rgba(15, 23, 42, .35); z-index: 50; opacity: 0; pointer-events: none; transition: opacity .2s; }
.drawer { position: fixed; top: 0; right: 0; bottom: 0; width: min(560px, 100vw); z-index: 51; background: var(--surface); box-shadow: var(--shadow-lg);
  transform: translateX(100%); transition: transform .25s cubic-bezier(.2, .8, .2, 1); display: flex; flex-direction: column; }
.drawer.open { transform: none; }
.drawer.open + .drawer-backdrop, .drawer-backdrop.open { opacity: 1; pointer-events: auto; }
.drawer-head { display: flex; align-items: flex-start; gap: 12px; padding: 18px 20px; border-bottom: 1px solid var(--border); }
.drawer-head .grow { flex: 1; min-width: 0; }
.drawer-body { flex: 1; overflow-y: auto; padding: 20px; }
.drawer-body section + section { margin-top: 24px; }
.drawer-body h3 { margin-bottom: 10px; }
.drawer-foot { padding: 14px 20px; border-top: 1px solid var(--border); display: flex; gap: 8px; }

dialog.modal { border: none; padding: 0; border-radius: 14px; background: var(--surface); color: var(--text); box-shadow: var(--shadow-lg); width: min(520px, calc(100vw - 32px)); }
dialog.modal.wide { width: min(680px, calc(100vw - 32px)); }
dialog.modal::backdrop { background: rgba(15, 23, 42, .45); backdrop-filter: blur(2px); }
.modal-head { padding: 20px 22px 0; display: flex; align-items: flex-start; gap: 12px; }
.modal-head .grow { flex: 1; }
.modal-head p { margin-top: 4px; color: var(--muted); font-size: 13px; }
.modal-body { padding: 18px 22px; }
.modal-foot { padding: 14px 22px; display: flex; justify-content: flex-end; gap: 8px; border-top: 1px solid var(--border); background: var(--surface-2); border-radius: 0 0 14px 14px; }
.modal-icon { width: 38px; height: 38px; border-radius: 10px; display: grid; place-items: center; flex: none; background: var(--primary-soft); color: var(--primary-text); }
.modal-icon.danger { background: var(--down-soft); color: var(--down); }

.toasts { position: fixed; top: 16px; right: 16px; z-index: 100; display: flex; flex-direction: column; gap: 8px; pointer-events: none; }
.toast { pointer-events: auto; display: flex; gap: 10px; align-items: flex-start; min-width: 260px; max-width: 420px; padding: 12px 14px; border-radius: 10px;
  background: var(--surface); border: 1px solid var(--border); box-shadow: var(--shadow-lg); font-size: 13.5px; animation: toast-in .2s ease-out; }
.toast.out { animation: toast-out .2s ease-in forwards; }
.toast .t-icon { width: 20px; height: 20px; border-radius: 50%; display: grid; place-items: center; flex: none; margin-top: 1px; }
.toast.success .t-icon { background: var(--ok-soft); color: var(--ok); }
.toast.error .t-icon { background: var(--down-soft); color: var(--down); }
.toast.warning .t-icon { background: var(--warn-soft); color: var(--warn); }
.toast.info .t-icon { background: var(--primary-soft); color: var(--primary-text); }
.toast .t-icon svg.icon { width: 13px; height: 13px; stroke-width: 2.6; }
@keyframes toast-in { from { opacity: 0; transform: translateY(-8px); } }
@keyframes toast-out { to { opacity: 0; transform: translateX(16px); } }

/* ------------------------------------------------------------ 设置：节点选择 */
.node-tools { display: flex; gap: 8px; flex-wrap: wrap; align-items: center; margin-bottom: 14px; }
.node-region { margin-bottom: 16px; }
.node-region h4 { font-size: 12px; color: var(--muted); font-weight: 600; margin-bottom: 8px; letter-spacing: .04em; }
.node-cities { display: grid; grid-template-columns: repeat(auto-fill, minmax(230px, 1fr)); gap: 8px; }
.node-city { display: flex; align-items: center; justify-content: space-between; gap: 8px; padding: 7px 8px 7px 12px; border: 1px solid var(--border); border-radius: var(--radius-sm); background: var(--surface); }
.node-city .name { font-size: 13px; font-weight: 500; }
.node-isps { display: flex; gap: 4px; }
.isp { height: 24px; padding: 0 8px; font-size: 12px; border-radius: 6px; border: 1px solid var(--border-strong); background: var(--surface); color: var(--muted); cursor: pointer; font-family: inherit; }
.isp:hover { border-color: var(--primary); color: var(--primary-text); }
.isp.on.dx { background: #2563eb; border-color: #2563eb; color: #fff; }
.isp.on.lt { background: #e11d48; border-color: #e11d48; color: #fff; }
.isp.on.yd { background: #059669; border-color: #059669; color: #fff; }
.isp:disabled { opacity: .3; cursor: not-allowed; border-style: dashed; }

.savebar { position: sticky; bottom: 0; z-index: 10; margin-top: 16px; padding: 12px 16px; display: flex; justify-content: flex-end; gap: 10px; align-items: center;
  background: color-mix(in srgb, var(--surface) 92%, transparent); backdrop-filter: blur(8px); border: 1px solid var(--border); border-radius: var(--radius); box-shadow: var(--shadow); }
.savebar .grow { flex: 1; }

/* ------------------------------------------------------------ 登录 */
.auth { min-height: 100vh; display: grid; place-items: center; padding: 24px;
  background: radial-gradient(900px 500px at 15% -10%, color-mix(in srgb, var(--primary) 18%, transparent), transparent 60%),
              radial-gradient(700px 400px at 110% 110%, color-mix(in srgb, #7c3aed 14%, transparent), transparent 60%), var(--bg); }
.auth-card { width: min(400px, 100%); background: var(--surface); border: 1px solid var(--border); border-radius: 16px; padding: 32px; box-shadow: var(--shadow-lg); }
.auth-card .brand { padding: 0; height: auto; margin-bottom: 24px; }
.auth-card h1 { font-size: 22px; margin-bottom: 4px; }

.error-page { min-height: 100vh; display: grid; place-items: center; text-align: center; padding: 24px; }
.error-page .code { font-size: 64px; font-weight: 700; letter-spacing: -.04em; color: var(--faint); }

/* ------------------------------------------------------------ 响应式 */
@media (max-width: 1100px) {
  .split, .grid-2 { grid-template-columns: 1fr; }
}
@media (max-width: 860px) {
  .sidebar { transform: translateX(-100%); transition: transform .2s; box-shadow: var(--shadow-lg); }
  body.nav-open .sidebar { transform: none; }
  body.nav-open .drawer-backdrop.nav { opacity: 1; pointer-events: auto; }
  .main { margin-left: 0; }
  .topbar { padding: 0 16px; }
  .topbar .menu-btn { display: inline-flex; }
  .content { padding: 16px 16px 96px; }
  .bulkbar { left: 50%; }
  .form-grid, .grid-3 { grid-template-columns: 1fr; }
  .hide-sm { display: none !important; }
  .table th { position: static; }
}
