/* ═══════════════════════════════════════════════════════════
   AWS Pusher — 设计系统
   中性灰 + 蓝强调；分隔线列表、克制的边框与阴影、统一控件高度
   ═══════════════════════════════════════════════════════════ */

/* ── Tokens ── */
:root {
  --bg: #0b0d10;
  --surface: #14161b;
  --surface-2: #1a1d24;
  --surface-3: #22262f;
  --border: rgba(255, 255, 255, 0.07);
  --border-strong: rgba(255, 255, 255, 0.12);
  --text: #e8eaee;
  --text-2: #9aa3b2;
  --text-3: #646c7a;
  --accent: #3b7cf5;
  --accent-hover: #2f6ce0;
  --accent-fg: #ffffff;
  --accent-soft: rgba(59, 124, 245, 0.16);
  --ok: #22c55e;
  --ok-soft: rgba(34, 197, 94, 0.14);
  --warn: #f59e0b;
  --warn-soft: rgba(245, 158, 11, 0.14);
  --danger: #ef4444;
  --danger-soft: rgba(239, 68, 68, 0.14);
  --overlay: rgba(4, 6, 10, 0.6);
  --shadow-sm: 0 1px 2px rgba(0, 0, 0, 0.3);
  --shadow: 0 12px 32px rgba(0, 0, 0, 0.45), 0 2px 6px rgba(0, 0, 0, 0.3);
  --topbar-bg: rgba(11, 13, 16, 0.82);

  --fs-xs: 11px; --fs-sm: 12px; --fs-base: 13px; --fs-md: 14px; --fs-lg: 16px; --fs-xl: 20px;
  --radius-sm: 6px; --radius: 10px; --radius-lg: 14px;
  --h-ctl: 32px; --h-sm: 28px;
  --ease: cubic-bezier(0.2, 0.7, 0.2, 1);
  --dur-fast: 0.12s; --dur: 0.2s;
  --ring: 0 0 0 3px var(--accent-soft);
  --mono: "SF Mono", "JetBrains Mono", "Fira Code", Menlo, Consolas, monospace;
  color-scheme: dark;
}
[data-theme="light"] {
  --bg: #f5f6f8;
  --surface: #ffffff;
  --surface-2: #f3f4f7;
  --surface-3: #e9ebf0;
  --border: rgba(17, 24, 39, 0.08);
  --border-strong: rgba(17, 24, 39, 0.15);
  --text: #111827;
  --text-2: #4b5563;
  --text-3: #8b93a3;
  --accent: #2b63d9;
  --accent-hover: #2352bd;
  --accent-soft: rgba(43, 99, 217, 0.1);
  --ok: #16a34a;
  --ok-soft: rgba(22, 163, 74, 0.12);
  --warn: #d97706;
  --warn-soft: rgba(217, 119, 6, 0.12);
  --danger: #dc2626;
  --danger-soft: rgba(220, 38, 38, 0.1);
  --overlay: rgba(17, 24, 39, 0.35);
  --shadow-sm: 0 1px 2px rgba(17, 24, 39, 0.04), 0 1px 3px rgba(17, 24, 39, 0.06);
  --shadow: 0 12px 32px rgba(17, 24, 39, 0.14), 0 2px 6px rgba(17, 24, 39, 0.06);
  --topbar-bg: rgba(245, 246, 248, 0.82);
  color-scheme: light;
}

/* ── Reset ── */
*, *::before, *::after { box-sizing: border-box; }
* { margin: 0; padding: 0; }
html { -webkit-text-size-adjust: 100%; }
html.theme-transitioning, html.theme-transitioning *, html.theme-transitioning *::before, html.theme-transitioning *::after {
  transition: background-color 0.25s ease, color 0.2s ease, border-color 0.25s ease !important;
}
body {
  font-family: -apple-system, BlinkMacSystemFont, "SF Pro Text", "Inter", "Segoe UI", "PingFang SC", "Hiragino Sans GB", "Microsoft YaHei", sans-serif;
  font-size: var(--fs-base); line-height: 1.5;
  font-variant-numeric: tabular-nums;
  background: var(--bg); color: var(--text);
  min-height: 100vh;
  -webkit-font-smoothing: antialiased; -moz-osx-font-smoothing: grayscale;
}
button, input, select, textarea { font-family: inherit; font-size: inherit; color: inherit; }
button { cursor: pointer; background: none; border: 0; }
code, .mono, kbd { font-family: var(--mono); }
svg { display: block; }
.hidden, [hidden] { display: none !important; }
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: 0.001s !important; transition-duration: 0.001s !important; }
}

/* ── 布局 ── */
.container { max-width: 900px; margin: 0 auto; padding: 20px 20px 96px; }
.panel { display: none; }
.panel.active { display: block; animation: fadeIn var(--dur) var(--ease); }

/* ── 顶栏 ── */
.topbar {
  position: sticky; top: 0; z-index: 50;
  background: var(--topbar-bg); backdrop-filter: saturate(160%) blur(12px); -webkit-backdrop-filter: saturate(160%) blur(12px);
  border-bottom: 1px solid var(--border);
}
.topbar-inner {
  max-width: 900px; margin: 0 auto; padding: 0 20px;
  display: flex; align-items: center; gap: 16px; height: 52px;
}
.brand { display: inline-flex; align-items: center; gap: 9px; font-size: var(--fs-md); font-weight: 600; letter-spacing: -0.2px; white-space: nowrap; color: var(--text); }
.brand-mark {
  width: 22px; height: 22px; border-radius: 7px; display: inline-flex; align-items: center; justify-content: center;
  background: #232F3E; color: #fff; box-shadow: 0 1px 2px rgba(0,0,0,0.25);
}
.brand-mark svg { width: 14px; height: 14px; }
.tabs { display: flex; gap: 2px; margin: 0 auto; height: 100%; }
.tab {
  position: relative; height: 100%; padding: 0 12px; color: var(--text-2);
  font-size: var(--fs-base); font-weight: 500; transition: color var(--dur-fast) var(--ease);
}
.tab:hover { color: var(--text); }
.tab.active { color: var(--text); }
.tab::after {
  content: ""; position: absolute; left: 10px; right: 10px; bottom: -1px; height: 2px; border-radius: 2px 2px 0 0;
  background: var(--accent); opacity: 0; transform: scaleX(0.6); transition: opacity var(--dur) var(--ease), transform var(--dur) var(--ease);
}
.tab.active::after { opacity: 1; transform: none; }
.topbar-actions { display: flex; gap: 2px; }
.icon-sun { display: none; }
[data-theme="light"] .icon-sun { display: block; }
[data-theme="light"] .icon-moon { display: none; }

/* ── 焦点 ── */
:focus-visible { outline: none; box-shadow: var(--ring); }
input:focus-visible, select:focus-visible, textarea:focus-visible { box-shadow: none; }

/* ── 卡片 ── */
.card {
  background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius-lg);
  margin-bottom: 16px; box-shadow: var(--shadow-sm);
}
.card-head { display: flex; align-items: center; gap: 12px; min-height: 56px; padding: 12px 20px 0; }
.card-title { display: inline-flex; align-items: center; gap: 8px; flex-shrink: 0; white-space: nowrap; font-size: var(--fs-lg); font-weight: 600; letter-spacing: -0.2px; }
.card-count { font-size: var(--fs-sm); font-weight: 500; color: var(--text-3); }
.card-summary { flex: 1; min-width: 0; font-size: var(--fs-sm); color: var(--text-2); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.card-actions { margin-left: auto; display: flex; align-items: center; gap: 6px; flex-wrap: wrap; justify-content: flex-end; }
.card-body { padding: 12px 20px 20px; }
.card-desc { font-size: var(--fs-sm); color: var(--text-2); margin: 0 0 14px; line-height: 1.65; max-width: 72ch; }
.card-desc code { font-size: var(--fs-xs); background: var(--surface-2); padding: 1px 5px; border-radius: 4px; border: 1px solid var(--border); }
.card.collapsible > .card-head { cursor: pointer; user-select: none; padding-bottom: 12px; }
.card.collapsible > .card-body { padding-top: 0; }
.card.collapsed > .card-body { display: none; }
.collapse-arrow { display: inline-flex; color: var(--text-3); transition: transform var(--dur) var(--ease); flex-shrink: 0; }
.collapse-arrow svg { width: 14px; height: 14px; }
.collapsed .collapse-arrow, .rule-card.collapsed .collapse-arrow { transform: rotate(-90deg); }
.dirty-badge {
  display: inline-flex; align-items: center; gap: 5px; font-size: var(--fs-xs); font-weight: 500; color: var(--warn);
  animation: fadeIn var(--dur) var(--ease);
}
.dirty-badge::before { content: ""; width: 6px; height: 6px; border-radius: 50%; background: var(--warn); }

/* ── 表单 ── */
.grid { display: grid; grid-template-columns: 1fr 1fr; gap: 16px 18px; }
.grid > .full { grid-column: 1 / -1; }
.field, label:not(.checkbox):not(.switch):not(.row-check):not(.site-check):not(.bulk-check) {
  display: flex; flex-direction: column; gap: 6px; font-size: var(--fs-sm); font-weight: 500; color: var(--text-2); min-width: 0;
}
.field-label { display: flex; align-items: center; gap: 8px; font-size: var(--fs-sm); font-weight: 500; color: var(--text-2); margin-bottom: 8px; }
.field-hint { font-size: var(--fs-xs); font-weight: 400; color: var(--text-3); }
input:not([type="checkbox"]):not([type="radio"]), select, textarea {
  width: 100%; height: var(--h-ctl); padding: 0 10px;
  background: var(--surface-2); border: 1px solid var(--border); border-radius: var(--radius-sm);
  color: var(--text); font-size: var(--fs-base); outline: none;
  transition: border-color var(--dur-fast) var(--ease), box-shadow var(--dur-fast) var(--ease), background var(--dur-fast) var(--ease);
}
input:not([type="checkbox"]):not([type="radio"]):hover, select:hover, textarea:hover { border-color: var(--border-strong); }
input:focus, select:focus, textarea:focus { border-color: var(--accent); box-shadow: var(--ring); background: var(--surface); }
textarea { height: auto; padding: 8px 10px; resize: vertical; line-height: 1.55; }
input::placeholder, textarea::placeholder { color: var(--text-3); }
input[type="search"]::-webkit-search-decoration, input[type="search"]::-webkit-search-cancel-button { -webkit-appearance: none; }
input[type="number"] { -moz-appearance: textfield; }
input[type="number"]::-webkit-inner-spin-button, input[type="number"]::-webkit-outer-spin-button { -webkit-appearance: none; }
select {
  appearance: none; padding-right: 28px; cursor: pointer;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 24 24' fill='none' stroke='%239aa3b2' stroke-width='2.5' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpolyline points='6 9 12 15 18 9'/%3E%3C/svg%3E");
  background-repeat: no-repeat; background-position: right 10px center;
}
label.checkbox { display: flex; flex-direction: row; align-items: center; gap: 8px; color: var(--text); font-weight: 400; font-size: var(--fs-base); min-height: var(--h-ctl); cursor: pointer; }
input[type="checkbox"] { width: 15px; height: 15px; accent-color: var(--accent); cursor: pointer; margin: 0; flex-shrink: 0; }
.input-wrap { position: relative; }
.input-wrap input { padding-right: 34px; }
.input-affix {
  position: absolute; right: 4px; top: 4px; width: 24px; height: 24px;
  display: inline-flex; align-items: center; justify-content: center;
  border-radius: 4px; color: var(--text-3); transition: all var(--dur-fast) var(--ease);
}
.input-affix:hover { background: var(--surface-3); color: var(--text); }
.input-affix:disabled { opacity: 0.5; cursor: default; }
.input-affix.testing svg { animation: pulse 0.8s ease-in-out infinite; }
.input-affix svg { width: 15px; height: 15px; }
.input-suffix { position: relative; }
.input-suffix input { padding-right: 36px; }
.input-suffix > span { position: absolute; right: 10px; top: 0; height: var(--h-ctl); display: inline-flex; align-items: center; font-size: var(--fs-sm); color: var(--text-3); pointer-events: none; }
.input-row { display: flex; gap: 6px; }
.input-row input { flex: 1; min-width: 0; }
.policy-wrap { display: flex; flex-direction: column; gap: 6px; }
.policy-tags { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 2px; }

/* 开关 */
.switch { display: inline-flex; align-items: center; gap: 10px; cursor: pointer; font-size: var(--fs-base); color: var(--text); min-height: var(--h-ctl); user-select: none; }
.switch input { position: absolute; opacity: 0; width: 0; height: 0; }
.switch-track {
  position: relative; width: 34px; height: 20px; border-radius: 999px; background: var(--surface-3); border: 1px solid var(--border-strong);
  transition: background var(--dur) var(--ease), border-color var(--dur) var(--ease); flex-shrink: 0;
}
.switch-track::after {
  content: ""; position: absolute; top: 2px; left: 2px; width: 14px; height: 14px; border-radius: 50%; background: #fff;
  box-shadow: 0 1px 2px rgba(0,0,0,0.3); transition: transform var(--dur) var(--ease);
}
.switch input:checked + .switch-track { background: var(--accent); border-color: var(--accent); }
.switch input:checked + .switch-track::after { transform: translateX(14px); }
.switch input:focus-visible + .switch-track { box-shadow: var(--ring); }
.switch .inline-num { margin-left: 2px; }
.inline-num { width: 84px !important; height: var(--h-sm) !important; font-size: var(--fs-sm) !important; }

/* ── 按钮 ── */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 6px;
  height: var(--h-ctl); padding: 0 12px; border-radius: var(--radius-sm);
  border: 1px solid var(--border-strong); background: var(--surface); color: var(--text);
  font-size: var(--fs-base); font-weight: 500; white-space: nowrap; line-height: 1;
  transition: background var(--dur-fast) var(--ease), border-color var(--dur-fast) var(--ease), color var(--dur-fast) var(--ease), transform var(--dur-fast) var(--ease), opacity var(--dur-fast) var(--ease);
  box-shadow: var(--shadow-sm);
}
.btn:hover:not(:disabled) { background: var(--surface-2); border-color: var(--text-3); }
.btn:active:not(:disabled) { transform: translateY(0.5px); }
.btn:disabled { opacity: 0.45; cursor: not-allowed; box-shadow: none; }
.btn.primary { background: var(--accent); border-color: var(--accent); color: var(--accent-fg); }
.btn.primary:hover:not(:disabled) { background: var(--accent-hover); border-color: var(--accent-hover); }
.btn.ghost, .btn.text { border-color: transparent; background: transparent; color: var(--text-2); box-shadow: none; }
.btn.ghost:hover:not(:disabled), .btn.text:hover:not(:disabled) { background: var(--surface-2); color: var(--text); border-color: transparent; }
.btn.danger { background: var(--danger); border-color: var(--danger); color: #fff; }
.btn.danger:hover:not(:disabled) { filter: brightness(0.93); }
.btn.danger-hover:hover:not(:disabled) { color: var(--danger); background: var(--danger-soft); border-color: transparent; }
.btn-sm { height: var(--h-sm); padding: 0 10px; font-size: var(--fs-sm); }
.btn.icon { width: var(--h-ctl); padding: 0; }
.btn.icon.btn-sm { width: var(--h-sm); }
.btn svg { width: 14px; height: 14px; flex-shrink: 0; }
.btn .caret { width: 12px; height: 12px; opacity: 0.7; margin-right: -2px; }
.btn[aria-busy="true"] { pointer-events: none; }
.btn-row { display: flex; align-items: center; flex-wrap: wrap; gap: 8px; margin-top: 14px; }
.spinner {
  width: 12px; height: 12px; border: 2px solid rgba(255,255,255,0.35); border-top-color: currentColor;
  border-radius: 50%; animation: spin 0.6s linear infinite; display: inline-block; flex-shrink: 0;
}
.btn:not(.primary):not(.danger) .spinner { border-color: var(--border-strong); border-top-color: var(--text); }
kbd.key {
  display: inline-flex; align-items: center; justify-content: center; min-width: 18px; height: 18px; padding: 0 5px;
  border: 1px solid var(--border-strong); border-bottom-width: 2px; border-radius: 4px; font-size: 10.5px; color: var(--text-3); background: var(--surface);
}

/* ── 分段控件 ── */
.seg { display: inline-flex; padding: 2px; gap: 2px; background: var(--surface-2); border: 1px solid var(--border); border-radius: var(--radius-sm); }
.seg-item {
  height: 22px; padding: 0 10px; border-radius: 4px; color: var(--text-2);
  font-size: var(--fs-sm); font-weight: 500; transition: all var(--dur-fast) var(--ease);
}
.seg-item:hover { color: var(--text); }
.seg-item.active { background: var(--surface); color: var(--text); box-shadow: var(--shadow-sm); }

/* ── Chip ── */
.chip-grid { display: flex; flex-wrap: wrap; gap: 6px; }
.chip {
  display: inline-flex; align-items: center; gap: 5px; height: var(--h-sm); padding: 0 10px; border-radius: 999px;
  border: 1px solid var(--border-strong); background: transparent; color: var(--text-2);
  font-size: var(--fs-sm); font-weight: 500; transition: all var(--dur-fast) var(--ease); white-space: nowrap;
}
.chip:hover { color: var(--text); border-color: var(--text-3); background: var(--surface-2); }
.chip.selected { background: var(--accent-soft); border-color: transparent; color: var(--accent); box-shadow: inset 0 0 0 1px var(--accent); }
.chip.unsupported { opacity: 0.4; cursor: not-allowed; text-decoration: line-through; }
.chip.unsupported:hover { color: var(--text-2); border-color: var(--border-strong); background: transparent; }
.chip.mono { font-family: var(--mono); font-size: 11.5px; }
.chip.custom { padding-right: 6px; }
.chip.legacy { border-style: dashed; }
.chip.add { border-style: dashed; color: var(--text-3); }
.chip.add:hover { color: var(--accent); border-color: var(--accent); background: transparent; }
.chip-remove { font-size: 14px; line-height: 1; color: var(--text-3); border-radius: 50%; width: 16px; height: 16px; display: inline-flex; align-items: center; justify-content: center; }
.chip-remove:hover { color: var(--danger); background: var(--danger-soft); }
.chip-input {
  height: var(--h-sm) !important; width: 150px !important; padding: 0 10px !important; border-radius: 999px !important;
  border: 1px solid var(--accent) !important; background: var(--surface) !important; font-size: var(--fs-sm) !important;
}
.chip-count { opacity: 0.6; font-size: var(--fs-xs); }
.chip.selected .chip-count { opacity: 0.9; }

/* ── 文本反馈 / 徽章 / 状态点 ── */
.inline-result { font-size: var(--fs-sm); color: var(--text-2); }
.inline-result:empty { display: none; }
.inline-result.ok, .ok { color: var(--ok); }
.inline-result.err, .err { color: var(--danger); }
.info-hint { font-size: var(--fs-sm); color: var(--text-3); line-height: 1.55; }
.info-hint.err { color: var(--danger); background: var(--danger-soft); padding: 8px 10px; border-radius: var(--radius-sm); margin-top: 12px; white-space: pre-wrap; }
.badge {
  display: inline-flex; align-items: center; gap: 4px; height: 18px; padding: 0 7px; border-radius: 999px;
  font-size: var(--fs-xs); font-weight: 500; background: var(--surface-3); color: var(--text-2); white-space: nowrap; line-height: 1;
}
.badge.ok { background: var(--ok-soft); color: var(--ok); }
.badge.accent { background: var(--accent-soft); color: var(--accent); }
.badge.warn { background: var(--warn-soft); color: var(--warn); }
.badge.danger { background: var(--danger-soft); color: var(--danger); }
.badge.muted { background: var(--surface-3); color: var(--text-3); }
.dot { display: inline-block; width: 8px; height: 8px; border-radius: 50%; background: var(--text-3); flex-shrink: 0; }
.dot.ok { background: var(--ok); box-shadow: 0 0 0 3px var(--ok-soft); }
.dot.danger { background: var(--danger); box-shadow: 0 0 0 3px var(--danger-soft); }
.dot.accent { background: var(--accent); box-shadow: 0 0 0 3px var(--accent-soft); }
.dot.warn { background: var(--warn); box-shadow: 0 0 0 3px var(--warn-soft); }
.dot.muted { background: var(--text-3); opacity: 0.6; }
.dot.pulse { animation: pulse 1.2s ease-in-out infinite; }
.queue-no { font-family: var(--mono); font-size: var(--fs-xs); font-weight: 600; color: var(--text-3); letter-spacing: 0.2px; }
.queue-no.next { color: var(--accent); }
.queue-edit { display: inline-flex; align-items: center; gap: 3px; font-family: var(--mono); font-size: var(--fs-xs); font-weight: 600; color: var(--text-3); letter-spacing: 0.2px; }
.queue-edit.next { color: var(--accent); }
.queue-edit input.queue-input { width: 2.8em; height: 20px; padding: 0 2px; font: inherit; color: inherit; text-align: center; background: var(--surface-2); border: 1px solid var(--border); border-radius: 4px; }
.queue-edit input.queue-input:hover { border-color: var(--border-strong); }
.queue-edit input.queue-input:focus { outline: none; box-shadow: none; border-color: var(--accent); background: var(--surface); }

/* ── 空态 / 骨架 ── */
.empty-state { display: flex; flex-direction: column; align-items: center; gap: 6px; padding: 28px 12px; text-align: center; color: var(--text-3); font-size: var(--fs-sm); }
.empty-state svg { width: 28px; height: 28px; opacity: 0.5; margin-bottom: 4px; }
.empty-state b { font-weight: 500; color: var(--text-2); font-size: var(--fs-base); }
.empty-state.compact { padding: 14px 0; align-items: flex-start; text-align: left; }
.skeleton-list { display: flex; flex-direction: column; }
.skeleton-row { display: flex; flex-direction: column; gap: 8px; padding: 14px 4px; }
.skeleton-row + .skeleton-row { border-top: 1px solid var(--border); }
.skeleton { height: 12px; border-radius: 4px; background: linear-gradient(90deg, var(--surface-2) 25%, var(--surface-3) 50%, var(--surface-2) 75%); background-size: 200% 100%; animation: shimmer 1.4s linear infinite; }

/* ── 分隔线列表（站点 / 密钥） ── */
.list { display: flex; flex-direction: column; margin: 0 -8px; }
.row {
  display: grid; grid-template-columns: 1fr auto; gap: 4px 16px; align-items: center;
  padding: 12px 8px; border-radius: var(--radius-sm); position: relative;
  transition: background var(--dur-fast) var(--ease);
}
.row + .row::before { content: ""; position: absolute; left: 8px; right: 8px; top: 0; height: 1px; background: var(--border); }
.row:hover { background: var(--surface-2); }
.row:hover::before, .row:hover + .row::before { opacity: 0; }
.row.current { background: var(--accent-soft); box-shadow: inset 2px 0 0 var(--accent); }
.row.current::before, .row.current + .row::before { opacity: 0; }
.row-main { min-width: 0; display: flex; flex-direction: column; gap: 4px; }
.row-title { display: flex; align-items: center; gap: 8px; font-size: var(--fs-base); font-weight: 600; min-width: 0; flex-wrap: wrap; }
.row-title .name { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.row-title .note { color: var(--text-2); font-size: 12px; font-weight: 400; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; min-width: 0; }
.row-sub { display: flex; align-items: center; gap: 10px; font-family: var(--mono); font-size: 11.5px; color: var(--text-2); min-width: 0; }
.row-sub code { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.row-meta { font-size: var(--fs-xs); color: var(--text-3); display: flex; gap: 4px; flex-wrap: wrap; }
.row-meta .sep { opacity: 0.5; }
.row-actions { display: flex; align-items: center; gap: 4px; }
.row.status-disabled .row-title, .row.status-disabled .row-sub { opacity: 0.55; }
.fail-reason { margin-top: 3px; font-size: 12px; color: var(--danger); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; min-width: 0; }
.copy-btn {
  display: inline-flex; align-items: center; gap: 5px; padding: 1px 6px; margin-left: -6px; border-radius: 4px;
  font-family: var(--mono); font-size: 11.5px; color: var(--text-2); transition: all var(--dur-fast) var(--ease); max-width: 100%;
}
.copy-btn span { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.copy-btn svg { width: 12px; height: 12px; opacity: 0; transition: opacity var(--dur-fast) var(--ease); flex-shrink: 0; }
.copy-btn:hover { background: var(--surface-3); color: var(--text); }
.copy-btn:hover svg, .copy-btn:focus-visible svg { opacity: 0.8; }
.sk-mask { color: var(--text-3); letter-spacing: 0.5px; }

/* 密钥筛选 / 搜索 / 模式条 */
.toolbar { display: flex; align-items: center; gap: 10px; margin-bottom: 10px; }
.filter-chips { display: flex; gap: 6px; overflow-x: auto; scrollbar-width: none; padding: 2px; margin: -2px; }
.filter-chips::-webkit-scrollbar { display: none; }
.search { position: relative; margin-left: auto; width: 240px; flex-shrink: 0; }
.search > svg { position: absolute; left: 9px; top: 50%; transform: translateY(-50%); width: 13px; height: 13px; color: var(--text-3); pointer-events: none; }
.search input { height: var(--h-sm) !important; padding: 0 30px 0 28px !important; font-size: var(--fs-sm) !important; }
.search kbd { position: absolute; right: 6px; top: 50%; transform: translateY(-50%); pointer-events: none; }
.search input:focus ~ kbd { display: none; }
.mode-bar {
  display: flex; align-items: center; flex-wrap: wrap; gap: 8px; margin-bottom: 10px;
  padding: 8px 12px; background: var(--accent-soft); border: 1px solid transparent; border-radius: var(--radius-sm);
  animation: fadeIn var(--dur) var(--ease);
}
.mode-bar .mode-title { font-size: var(--fs-sm); font-weight: 600; color: var(--accent); }
.mode-bar .mode-hint { font-size: var(--fs-sm); color: var(--text-2); }
.mode-bar .spacer { flex: 1; }
.bulk-check { display: inline-flex; align-items: center; gap: 6px; font-size: var(--fs-sm); color: var(--text); cursor: pointer; font-weight: 500; }
.bulk-count { font-size: var(--fs-sm); color: var(--text-2); }

/* 密钥行：主列两行 + 右侧时间列 + 操作 */
.row.key { grid-template-columns: 1fr auto auto; padding: 9px 8px; }
.row.key .row-main { gap: 3px; }
.row.key .row-actions { min-width: 202px; justify-content: flex-end; }
.row.key > .row-meta, .row.reorder > .row-meta {
  flex-direction: column; align-items: flex-end; gap: 2px; text-align: right; white-space: nowrap; padding-right: 8px;
}
.row.key > .row-meta .sep { display: none; }

/* 批量 / 排序模式的行 */
.row.selectable { grid-template-columns: auto 1fr auto; }
.row.key.selectable { grid-template-columns: auto 1fr auto auto; }
.row.selected { background: var(--accent-soft); }
.row.selected::before, .row.selected + .row::before { opacity: 0; }
.row-check { display: inline-flex; align-items: center; justify-content: center; width: 24px; height: 24px; cursor: pointer; }
.row.reorder { grid-template-columns: auto 1fr auto auto; cursor: grab; user-select: none; }
.row.reorder:active { cursor: grabbing; }
.row.dragging { opacity: 0.4; }
.row.drag-over-top { box-shadow: inset 0 2px 0 var(--accent); }
.row.drag-over-bottom { box-shadow: inset 0 -2px 0 var(--accent); }
.drag-handle { display: inline-flex; align-items: center; justify-content: center; width: 20px; color: var(--text-3); }
.drag-handle svg { width: 16px; height: 16px; }
.row.reorder:hover .drag-handle { color: var(--text-2); }

/* 站点勾选 */
.site-list { display: flex; flex-direction: column; gap: 6px; }
.site-check {
  display: flex; align-items: center; gap: 10px; padding: 8px 12px; min-height: 40px;
  border: 1px solid var(--border-strong); border-radius: var(--radius-sm); cursor: pointer; transition: all var(--dur-fast) var(--ease);
  font-size: var(--fs-base); font-weight: 500; color: var(--text);
}
.site-check:hover { border-color: var(--text-3); background: var(--surface-2); }
.site-check.checked { border-color: var(--accent); background: var(--accent-soft); }
.site-check:has(input:focus-visible) { box-shadow: var(--ring); }
.site-check input { position: absolute; opacity: 0; width: 0; height: 0; }
.site-check-box {
  width: 16px; height: 16px; border: 1px solid var(--border-strong); border-radius: 4px; position: relative; flex-shrink: 0;
  background: var(--surface); transition: all var(--dur-fast) var(--ease);
}
.site-check.checked .site-check-box { background: var(--accent); border-color: var(--accent); }
.site-check.checked .site-check-box::after {
  content: ""; position: absolute; left: 5px; top: 2px; width: 4px; height: 8px;
  border: solid #fff; border-width: 0 2px 2px 0; transform: rotate(45deg);
}
.site-check-url { font-size: 11.5px; font-weight: 400; color: var(--text-3); font-family: var(--mono); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; min-width: 0; }

/* IAM 结果：键值列表 */
.kv-list { display: flex; flex-direction: column; gap: 6px; }
.kv-row {
  display: grid; grid-template-columns: 64px 1fr auto; gap: 10px; align-items: center;
  padding: 8px 10px; background: var(--surface-2); border: 1px solid var(--border); border-radius: var(--radius-sm);
}
.kv-row .kv-label { font-size: var(--fs-sm); color: var(--text-3); }
.kv-row code, .kv-row a { font-family: var(--mono); font-size: 12.5px; color: var(--text); word-break: break-all; user-select: all; }
.kv-row a { color: var(--accent); text-decoration: none; }
.kv-row a:hover { text-decoration: underline; }

/* ── 下拉菜单 ── */
.menu {
  position: fixed; z-index: 200; min-width: 168px; padding: 4px;
  background: var(--surface); border: 1px solid var(--border-strong); border-radius: var(--radius); box-shadow: var(--shadow);
  animation: menuIn var(--dur-fast) var(--ease); transform-origin: top right;
}
.menu-item {
  display: flex; align-items: center; gap: 8px; width: 100%; height: 32px; padding: 0 10px; border-radius: 6px;
  color: var(--text); font-size: var(--fs-base); text-align: left; transition: background var(--dur-fast) var(--ease); white-space: nowrap;
}
.menu-item svg { width: 14px; height: 14px; color: var(--text-3); flex-shrink: 0; }
.menu-item:hover, .menu-item.focus { background: var(--surface-2); }
.menu-item:focus-visible { box-shadow: none; background: var(--surface-2); }
.menu-item:disabled { opacity: 0.4; cursor: not-allowed; }
.menu-item.danger { color: var(--danger); }
.menu-item.danger svg { color: var(--danger); }
.menu-item.danger:hover, .menu-item.danger.focus { background: var(--danger-soft); }
.menu-sep { height: 1px; margin: 4px 6px; background: var(--border); }
.menu-info { padding: 6px 10px 8px; font-size: var(--fs-xs); color: var(--text-3); line-height: 1.5; white-space: nowrap; }

/* ── 推送预设：分段 ── */
.preset-section { padding: 14px 0; border-top: 1px solid var(--border); }
.preset-section:first-of-type { padding-top: 0; border-top: 0; }
.preset-section:last-child { padding-bottom: 0; }
.preset-section-head { display: flex; align-items: center; justify-content: space-between; gap: 10px; margin-bottom: 8px; }
.preset-section-head .field-label { margin-bottom: 0; }

/* ── 规则列表 ── */
.rule-row .row-title { gap: 6px; }
.rule-row .rule-num { font-size: var(--fs-sm); font-weight: 600; white-space: nowrap; margin-right: 2px; }
.rule-models { display: inline-flex; flex-wrap: wrap; gap: 4px; }
.chip.readonly { height: 20px; padding: 0 7px; pointer-events: none; color: var(--text-2); border-color: var(--border-strong); }
.rule-regions { font-family: var(--mono); font-size: 11.5px; color: var(--text-2); }
.rule-target { align-items: center; gap: 5px; }
.rule-target b { font-weight: 600; color: var(--text-2); }
.rule-target .arrow { color: var(--text-3); font-weight: 600; }
.rule-row.has-problem { box-shadow: inset 2px 0 0 var(--danger); }

/* ── 规则编辑弹窗 ── */
.modal-content.wide { max-width: 760px; }
.rule-editor-grid { display: grid; grid-template-columns: minmax(0, 3fr) minmax(0, 2fr); gap: 16px 22px; }
.rule-editor-main, .rule-editor-side { display: flex; flex-direction: column; gap: 16px; min-width: 0; }
.rule-editor-side { padding-left: 22px; border-left: 1px solid var(--border); }
.rule-field { display: flex; flex-direction: column; gap: 8px; }
.rule-field-head { display: flex; align-items: center; justify-content: space-between; gap: 10px; min-height: var(--h-sm); }
.rule-field-head .field-label { margin-bottom: 0; }
.rule-field > .field-hint { margin-top: -4px; line-height: 1.5; }
.region-groups { display: flex; flex-direction: column; gap: 10px; }
.region-group { display: flex; flex-direction: column; gap: 6px; }
.region-group-head { display: flex; align-items: center; gap: 6px; font-size: var(--fs-xs); font-weight: 600; color: var(--text-3); letter-spacing: 0.4px; text-transform: uppercase; }
.chip-grid.regions .chip { font-family: var(--mono); font-size: 11.5px; padding: 0 9px; }
.rule-preview { font-size: var(--fs-sm); color: var(--text-2); min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.rule-preview.err { color: var(--danger); }

/* ── 推送结果 ── */
.push-summary { display: flex; align-items: stretch; gap: 8px; margin-bottom: 12px; }
.push-stat { flex: 1; padding: 10px 12px; border-radius: var(--radius-sm); background: var(--surface-2); border: 1px solid var(--border); font-size: var(--fs-sm); color: var(--text-2); }
.push-stat b { display: block; font-size: var(--fs-xl); font-weight: 600; color: var(--text); line-height: 1.2; margin-top: 2px; letter-spacing: -0.3px; }
.push-stat.ok b { color: var(--ok); }
.push-stat.err b { color: var(--danger); }
.push-skip { color: var(--text-3); font-size: var(--fs-sm); margin-bottom: 8px; }
.push-error { color: var(--danger); font-size: 12.5px; background: var(--danger-soft); padding: 8px 10px; border-radius: var(--radius-sm); margin-bottom: 8px; }
.push-fail-list { max-height: 260px; overflow-y: auto; }
.push-fail-title { font-size: var(--fs-xs); font-weight: 600; color: var(--text-3); margin: 6px 0 2px; letter-spacing: 0.3px; }
.result-item { display: grid; grid-template-columns: 16px 1fr; gap: 2px 8px; padding: 8px 0; border-bottom: 1px solid var(--border); font-size: 12.5px; }
.result-item:last-child { border-bottom: 0; }
.result-icon { font-size: var(--fs-sm); font-weight: 700; text-align: center; }
.result-icon.fail { color: var(--danger); }
.result-text { min-width: 0; display: flex; align-items: center; gap: 6px; flex-wrap: wrap; }
.result-text code { font-size: 11.5px; }
.result-msg { grid-column: 2; color: var(--text-3); font-size: var(--fs-sm); white-space: normal; word-break: break-word; }

/* ── 轮换状态 / 日志 ── */
.stat-grid { display: grid; grid-template-columns: repeat(4, 1fr); gap: 8px; }
.stat { padding: 12px 14px; border-radius: var(--radius); background: var(--surface-2); border: 1px solid var(--border); min-width: 0; }
.stat-label { font-size: var(--fs-xs); font-weight: 500; color: var(--text-3); letter-spacing: 0.3px; margin-bottom: 6px; }
.stat-value { display: flex; align-items: center; gap: 8px; font-size: var(--fs-md); font-weight: 600; color: var(--text); min-height: 22px; letter-spacing: -0.2px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.stat-value.sm { font-size: var(--fs-base); font-weight: 500; }
.stat-value.wrap { white-space: normal; flex-wrap: wrap; gap: 4px 12px; }
.stat-value .count-item { display: inline-flex; align-items: baseline; gap: 4px; font-weight: 500; font-size: var(--fs-sm); color: var(--text-2); }
.stat-value .count-item b { font-weight: 600; color: var(--text); font-size: var(--fs-base); }
.stat.wide { grid-column: span 2; }
.log-box {
  max-height: 360px; overflow-y: auto; font-family: var(--mono); font-size: var(--fs-sm); line-height: 1.6;
  background: var(--surface-2); border: 1px solid var(--border); border-radius: var(--radius-sm); padding: 6px 0;
}
.log-line { display: flex; gap: 12px; padding: 2px 12px; transition: background var(--dur-fast) var(--ease); }
.log-line:hover { background: var(--surface-3); }
.log-time { color: var(--text-3); flex-shrink: 0; }
.log-msg { word-break: break-word; }
.log-line.log-err .log-msg { color: var(--danger); }
.log-line.log-ok .log-msg { color: var(--ok); }

/* ── 弹窗 ── */
.modal {
  position: fixed; inset: 0; z-index: 100; display: none; align-items: center; justify-content: center;
  background: var(--overlay); backdrop-filter: blur(6px); -webkit-backdrop-filter: blur(6px); padding: 20px;
  animation: fadeIn var(--dur-fast) var(--ease);
}
.modal.show { display: flex; }
.modal-content {
  width: 100%; max-width: 560px; max-height: calc(100vh - 40px); display: flex; flex-direction: column;
  background: var(--surface); border: 1px solid var(--border-strong); border-radius: var(--radius-lg);
  box-shadow: var(--shadow); animation: modalIn var(--dur) var(--ease);
}
.modal-content.narrow { max-width: 440px; }
.modal-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 16px 20px 0; }
.modal-title { font-size: var(--fs-lg); font-weight: 600; letter-spacing: -0.2px; }
.modal-body { padding: 14px 20px 4px; overflow-y: auto; }
.modal-body .card-desc { margin-top: 0; }
.modal-foot { display: flex; align-items: center; gap: 8px; padding: 14px 20px 16px; }
.modal-foot .spacer { flex: 1; }
.modal-foot .inline-result { min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.confirm-body { font-size: var(--fs-base); color: var(--text-2); line-height: 1.65; }
.login-modal { z-index: 300; background: var(--bg); backdrop-filter: none; -webkit-backdrop-filter: none; }
.login-brand { display: flex; align-items: center; justify-content: center; gap: 10px; margin: 4px 0 18px; font-size: var(--fs-lg); font-weight: 600; }
.login-brand .brand-mark { width: 30px; height: 30px; border-radius: 9px; }
.login-brand .brand-mark svg { width: 19px; height: 19px; stroke-width: 2.2; }

/* ── Toast ── */
.toast-container { position: fixed; right: 20px; bottom: 20px; z-index: 400; display: flex; flex-direction: column; gap: 8px; pointer-events: none; max-width: calc(100vw - 40px); }
.toast {
  display: flex; align-items: flex-start; gap: 10px; padding: 10px 10px 10px 12px; width: 360px; max-width: 100%;
  background: var(--surface); border: 1px solid var(--border-strong); border-radius: var(--radius); box-shadow: var(--shadow);
  font-size: var(--fs-base); animation: toastIn var(--dur) var(--ease); pointer-events: auto;
}
.toast-icon { width: 16px; height: 16px; flex-shrink: 0; margin-top: 2px; color: var(--text-3); }
.toast.success .toast-icon { color: var(--ok); }
.toast.error .toast-icon { color: var(--danger); }
.toast-msg { flex: 1; min-width: 0; line-height: 1.45; word-break: break-word; }
.toast-close { width: 22px; height: 22px; border-radius: 4px; color: var(--text-3); display: inline-flex; align-items: center; justify-content: center; flex-shrink: 0; }
.toast-close:hover { background: var(--surface-2); color: var(--text); }
.toast-close svg { width: 12px; height: 12px; }
.toast.leaving { animation: toastOut var(--dur) var(--ease) forwards; }

/* ── 动画 ── */
@keyframes spin { to { transform: rotate(360deg); } }
@keyframes pulse { 0%, 100% { opacity: 1; } 50% { opacity: 0.35; } }
@keyframes fadeIn { from { opacity: 0; } to { opacity: 1; } }
@keyframes modalIn { from { opacity: 0; transform: translateY(6px) scale(0.985); } to { opacity: 1; transform: none; } }
@keyframes menuIn { from { opacity: 0; transform: scale(0.96) translateY(-2px); } to { opacity: 1; transform: none; } }
@keyframes toastIn { from { opacity: 0; transform: translateY(8px); } to { opacity: 1; transform: none; } }
@keyframes toastOut { to { opacity: 0; transform: translateY(8px); } }
@keyframes shimmer { from { background-position: 200% 0; } to { background-position: -200% 0; } }

/* ── 响应式 ── */
@media (max-width: 720px) {
  .container { padding: 14px 14px 80px; }
  .topbar-inner { padding: 0 14px; gap: 10px; }
  .brand > span:not(.brand-mark) { display: none; }
  .tab { padding: 0 10px; }
  .card-head { flex-wrap: wrap; padding: 12px 16px 0; min-height: 0; row-gap: 8px; }
  .card-actions { margin-left: auto; }
  .card-body { padding: 12px 16px 16px; }
  .grid { grid-template-columns: 1fr; }
  .stat-grid { grid-template-columns: 1fr 1fr; }
  .stat.wide { grid-column: span 2; }
  .row.key { grid-template-columns: 1fr; }
  .row.key.selectable { grid-template-columns: auto 1fr; }
  .row.key .row-actions { grid-column: 1 / -1; margin-top: 4px; flex-wrap: wrap; min-width: 0; justify-content: flex-start; }
  .row.key.selectable .row-actions { grid-column: 2; }
  .row.key > .row-meta, .row.reorder > .row-meta { flex-direction: row; align-items: center; gap: 4px; text-align: left; white-space: normal; padding-right: 0; }
  .row.key > .row-meta .sep { display: inline; }
  .row.key.selectable > .row-meta { grid-column: 2; }
  .row.reorder { grid-template-columns: auto 1fr; }
  .row.reorder > .row-meta, .row.reorder .row-actions { grid-column: 2; }
  .toolbar { flex-wrap: wrap; }
  .search { margin-left: 0; width: 100%; }
  .toast-container { right: 12px; left: 12px; bottom: 12px; }
  .toast { width: 100%; }
  .modal { padding: 12px; }
  .modal-content { max-height: calc(100vh - 24px); }
  .rule-row { grid-template-columns: 1fr; }
  .rule-row .row-actions { margin-top: 4px; }
  .rule-editor-grid { grid-template-columns: 1fr; }
  .rule-editor-side { padding-left: 0; border-left: 0; padding-top: 16px; border-top: 1px solid var(--border); }
  .modal-foot { flex-wrap: wrap; }
  .rule-preview { flex-basis: 100%; white-space: normal; }
}
@media (max-width: 480px) {
  .card-summary { display: none; }
  .stat-grid { grid-template-columns: 1fr; }
  .stat.wide { grid-column: auto; }
}
