/* ==========================================================================
   ATLAS · 项目控制台
   自托管字体 / 语义化主题变量 / 移动优先响应式
   ========================================================================== */

@font-face {
  font-family: "Space Grotesk";
  src: url("fonts/space-grotesk-400.woff2") format("woff2");
  font-weight: 400; font-style: normal; font-display: swap;
}
@font-face {
  font-family: "Space Grotesk";
  src: url("fonts/space-grotesk-700.woff2") format("woff2");
  font-weight: 700; font-style: normal; font-display: swap;
}
@font-face {
  font-family: "Noto SC";
  src: url("fonts/noto-sc-400.woff2") format("woff2");
  font-weight: 400; font-style: normal; font-display: swap;
}
@font-face {
  font-family: "Noto SC";
  src: url("fonts/noto-sc-700.woff2") format("woff2");
  font-weight: 700; font-style: normal; font-display: swap;
}

:root {
  /* ---- 基础色板 ---- */
  --ink: #080d1c;
  --surface: rgba(18, 26, 47, .74);
  --surface-hi: rgba(26, 36, 62, .86);
  --surface-low: rgba(13, 20, 38, .58);
  --line: rgba(150, 172, 226, .14);
  --line-strong: rgba(150, 172, 226, .30);
  --line-hover: rgba(150, 172, 226, .48);
  --text: #eef2ff;
  --muted: #9aa9cb;
  --faint: #6c7ca3;
  --violet: #8b7cf8;
  --cyan: #45d6e8;
  --amber: #f7b955;
  --ok: #3ddc97;
  --warn: #f7b955;
  --danger: #ff6b7f;
  --ok-ink: #3ddc97;
  --warn-ink: #f7b955;
  --danger-ink: #ffb3bd;
  --radius: 20px;
  --radius-sm: 12px;
  --shadow: 0 24px 64px rgba(0, 0, 0, .40);
  --font-body: "Noto SC", "Space Grotesk", sans-serif;
  --font-display: "Space Grotesk", "Noto SC", sans-serif;

  /* ---- 背景与质感 ---- */
  --bg-image:
    radial-gradient(1100px 640px at 8% -10%, rgba(103, 82, 219, .34), transparent 62%),
    radial-gradient(920px 580px at 96% 2%, rgba(28, 152, 183, .24), transparent 62%),
    radial-gradient(900px 720px at 52% 112%, rgba(148, 62, 158, .18), transparent 66%),
    linear-gradient(180deg, #090f20 0%, #0a1226 42%, #070b18 100%);
  --grid-line: rgba(255,255,255,.028);
  --grid-size: 58px;
  --grain-opacity: .05;
  --glow: .16;
  --glow-hover: .36;

  /* ---- 导航与按钮 ---- */
  --topbar-bg: rgba(8, 13, 28, .72);
  --hover-bg: rgba(255,255,255,.05);
  --ghost-bg: rgba(255,255,255,.045);
  --ghost-hover: rgba(255,255,255,.09);
  --active-bg: rgba(139,124,248,.16);
  --active-ring: rgba(139,124,248,.28);
  --chip-bg: rgba(255,255,255,.03);
  --icon-bg: rgba(255,255,255,.035);
  --icon-bg-hover: rgba(255,255,255,.08);
  --avatar-grad: linear-gradient(135deg, var(--violet), var(--cyan));
  --on-accent: #0b0f1e;
  --btn-grad: linear-gradient(120deg, #a99bff 0%, #8b7cf8 44%, #58cfe6 100%);
  --btn-shadow: 0 10px 28px rgba(120, 110, 240, .30);
  --btn-shadow-hover: 0 16px 34px rgba(120, 110, 240, .42);
  --btn-spinner: rgba(11,15,30,.35);
  --danger-bg: rgba(255,107,127,.16);
  --danger-bg-hover: rgba(255,107,127,.26);
  --danger-line: rgba(255,107,127,.45);

  /* ---- 渐变文字 / 图表 ---- */
  --text-grad: linear-gradient(100deg, #b7a9ff 0%, #7fb8ff 44%, #4fe0d2 100%);
  --hero-rule: linear-gradient(90deg, rgba(139,124,248,.7), rgba(69,214,232,.25), transparent 72%);
  --meter-grad: linear-gradient(90deg, #45d6e8, #8b7cf8);
  --track: rgba(255,255,255,.07);
  --selection: rgba(139,124,248,.42);
  --selection-ink: #fff;

  /* ---- 组件表面 ---- */
  --accent-soft-bg: rgba(139,124,248,.22);
  --accent-line: rgba(139,124,248,.32);
  --accent-ink: #c2b7ff;
  --bt-grad: linear-gradient(115deg, rgba(139,124,248,.16), rgba(69,214,232,.08));
  --bt-grad-hover: linear-gradient(115deg, rgba(139,124,248,.30), rgba(69,214,232,.16));
  --card-shadow: 0 22px 48px rgba(0,0,0,.42);
  --dashed-bg: rgba(255,255,255,.02);
  --orbit-line: rgba(139,124,248,.28);
  --orbit-line-2: rgba(69,214,232,.26);
  --orbit-core: radial-gradient(circle, rgba(139,124,248,.5), transparent 70%);
  --input-bg: rgba(6, 11, 24, .62);
  --input-placeholder: #5b6a90;
  --input-focus-ring: rgba(139,124,248,.18);
  --inset-bg: rgba(6,11,24,.46);
  --ok-surface: rgba(24,52,44,.42);
  --warn-surface: rgba(52,40,24,.55);
  --danger-surface: rgba(58,24,38,.62);
  --ok-bg: rgba(61,220,151,.12);
  --ok-line: rgba(61,220,151,.28);
  --warn-bg: rgba(247,185,85,.14);
  --warn-line: rgba(247,185,85,.4);
  --danger-soft-bg: rgba(255,107,127,.24);
  --form-error-bg: rgba(255,107,127,.14);
  --form-error-line: rgba(255,107,127,.42);
  --form-error-ink: #ffc2ca;
  --backdrop: rgba(4, 7, 16, .76);
  --modal-bg: #131c33;
  --modal-shadow: 0 34px 90px rgba(0,0,0,.66);
  --swatch-ring: #fff;
  --swatch-ring-shadow: rgba(255,255,255,.16);
  --switch-track: rgba(255,255,255,.10);
  --switch-knob: #93a1c4;
  --switch-on: rgba(139,124,248,.55);
  --switch-on-line: rgba(139,124,248,.8);
  --switch-knob-on: #fff;
  --toast-bg: #1b2740;
  --toast-error-bg: #331d2a;
}

*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; scroll-behavior: smooth; }
body {
  margin: 0;
  min-height: 100vh;
  background: var(--ink);
  color: var(--text);
  font: 400 16px/1.65 var(--font-body);
  letter-spacing: .01em;
  overflow-x: hidden;
}
body::before {
  content: ""; position: fixed; inset: 0; z-index: -3; pointer-events: none;
  background: var(--bg-image);
}
body::after {
  content: ""; position: fixed; inset: 0; z-index: -2; pointer-events: none;
  background-image:
    linear-gradient(var(--grid-line) 1px, transparent 1px),
    linear-gradient(90deg, var(--grid-line) 1px, transparent 1px);
  background-size: var(--grid-size) var(--grid-size);
  -webkit-mask-image: linear-gradient(180deg, rgba(0,0,0,.85), transparent 88%);
  mask-image: linear-gradient(180deg, rgba(0,0,0,.85), transparent 88%);
}
.grain {
  position: fixed; inset: 0; z-index: -1; pointer-events: none; opacity: var(--grain-opacity);
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='180' height='180'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='.8' numOctaves='3' stitchTiles='stitch'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23n)'/%3E%3C/svg%3E");
  mix-blend-mode: overlay;
}
a { color: inherit; text-decoration: none; }
button, input { font: inherit; }
button { cursor: pointer; }
code { font-family: var(--font-display); font-size: .92em; }
:focus-visible { outline: 2px solid var(--cyan); outline-offset: 3px; border-radius: 6px; }
::selection { background: var(--selection); color: var(--selection-ink); }

/* ---------- 布局骨架 ---------- */
.shell { width: min(1240px, calc(100% - 40px)); margin: 0 auto; padding: 8px 0 48px; }
.topbar {
  position: sticky; top: 0; z-index: 40;
  background: var(--topbar-bg);
  -webkit-backdrop-filter: blur(18px); backdrop-filter: blur(18px);
  border-bottom: 1px solid var(--line);
}
.topbar-inner {
  width: min(1240px, calc(100% - 40px)); margin: 0 auto;
  min-height: 72px; display: flex; align-items: center; gap: 22px;
}
.brand { display: inline-flex; align-items: center; gap: 12px; flex-shrink: 0; }
.brand-mark { width: 36px; height: 36px; position: relative; display: block; }
.brand-mark i { position: absolute; display: block; border-radius: 3px; }
.brand-mark i:nth-child(1) { inset: 3px 8px 3px 8px; border: 2px solid var(--violet); transform: skewY(-16deg); }
.brand-mark i:nth-child(2) { left: 3px; right: 3px; top: 20px; height: 2px; background: var(--cyan); }
.brand-mark i:nth-child(3) { width: 6px; height: 6px; border-radius: 50%; background: var(--amber); left: 15px; top: 3px; }
.brand-text { display: flex; flex-direction: column; line-height: 1.05; }
.brand-text strong { font: 700 19px/1 var(--font-display); letter-spacing: .18em; }
.brand-text small { color: var(--faint); font-size: 10px; letter-spacing: .26em; margin-top: 4px; }
.nav-links { display: flex; gap: 6px; margin-left: 12px; }
.nav-links a {
  padding: 9px 16px; border-radius: 10px; color: var(--muted); font-size: 14px;
  min-height: 42px; display: inline-flex; align-items: center; transition: .18s ease;
}
.nav-links a:hover { color: var(--text); background: var(--hover-bg); }
.nav-links a.is-active { color: var(--text); background: var(--active-bg); box-shadow: inset 0 0 0 1px var(--active-ring); }
.nav-user { margin-left: auto; display: flex; align-items: center; gap: 14px; }
.user-chip { display: inline-flex; align-items: center; gap: 8px; color: var(--muted); font-size: 13px; }
.user-avatar {
  width: 30px; height: 30px; border-radius: 9px; display: grid; place-items: center;
  background: var(--avatar-grad); color: var(--on-accent);
  font: 700 14px var(--font-display);
}
.site-footer {
  width: min(1240px, calc(100% - 40px)); margin: 0 auto; padding: 22px 0 40px;
  border-top: 1px solid var(--line); display: flex; justify-content: space-between; gap: 20px;
  color: var(--faint); font-size: 12px; letter-spacing: .04em;
}

/* ---------- 通用按钮 ---------- */
.btn-primary, .btn-danger, .btn-ghost, .btn-quiet {
  min-height: 46px; display: inline-flex; align-items: center; justify-content: center; gap: 10px;
  border-radius: 12px; padding: 0 20px; font-size: 14px; font-weight: 700;
  transition: transform .16s ease, box-shadow .16s ease, background .16s ease, border-color .16s ease;
  border: 1px solid transparent; white-space: nowrap;
}
.btn-primary {
  color: var(--on-accent);
  background: var(--btn-grad);
  box-shadow: var(--btn-shadow);
}
.btn-primary:hover { transform: translateY(-2px); box-shadow: var(--btn-shadow-hover); }
.btn-primary:active { transform: translateY(0); }
.btn-primary svg, .btn-ghost svg { width: 17px; height: 17px; }
.btn-ghost {
  color: var(--text); background: var(--ghost-bg); border-color: var(--line-strong);
}
.btn-ghost:hover { background: var(--ghost-hover); border-color: var(--line-hover); }
.btn-quiet { color: var(--muted); background: transparent; border-color: var(--line); padding: 0 16px; }
.btn-quiet:hover { color: var(--text); border-color: var(--line-strong); }
.btn-danger { background: var(--danger-bg); border-color: var(--danger-line); color: var(--danger-ink); }
.btn-danger:hover { background: var(--danger-bg-hover); }
.btn-block { width: 100%; }
button:disabled { opacity: .62; cursor: not-allowed; transform: none !important; }
.is-loading .btn-label { opacity: .85; }
.btn-primary.is-loading::after {
  content: ""; width: 15px; height: 15px; border: 2px solid var(--btn-spinner);
  border-top-color: var(--on-accent); border-radius: 50%; animation: spin .7s linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }

/* ---------- HERO ----------
   紧凑版：整体高度约为初版的一半，保留 kicker / 标题 / 说明 / 状态卡的层次 */
.hero, .config-hero {
  display: flex; align-items: flex-end; justify-content: space-between; gap: 24px;
  padding: 18px 0 20px; position: relative;
}
/* 配置页与首页共用同一套双栏 HERO：左侧标题、右侧操作区；窄屏再塌缩为纵向 */
.config-hero { align-items: center; }
.hero::after, .config-hero::after {
  content: ""; position: absolute; left: 0; right: 0; bottom: 0; height: 1px;
  background: var(--hero-rule);
}
.kicker, .auth-kicker {
  display: inline-flex; align-items: center; gap: 8px;
  font: 700 10px/1 var(--font-display); letter-spacing: .22em; color: var(--muted);
  text-transform: uppercase;
}
.slash { color: var(--faint); }
.live-dot {
  width: 8px; height: 8px; border-radius: 50%; background: var(--ok); flex-shrink: 0;
  box-shadow: 0 0 0 4px rgba(61,220,151,.14), 0 0 14px rgba(61,220,151,.8);
  animation: breathe 2.6s ease-in-out infinite;
}
@keyframes breathe { 50% { opacity: .5; box-shadow: 0 0 0 7px rgba(61,220,151,.05), 0 0 18px rgba(61,220,151,.5); } }
h1 { font-weight: 700; letter-spacing: -.04em; line-height: 1.12; margin: 10px 0 0;
  font-size: clamp(2.1rem, 4.2vw, 3rem); }
.grad {
  background: var(--text-grad);
  -webkit-background-clip: text; background-clip: text; color: transparent;
}
.hero-lead, .auth-lead { color: var(--muted); max-width: 720px; margin: 8px 0 0; font-size: 13.5px; line-height: 1.6; }
.hero-side { flex-shrink: 0; padding-bottom: 2px; }
.hero-status {
  position: relative; min-width: 190px; padding: 13px 18px; border-radius: 15px;
  background: var(--surface); border: 1px solid var(--line); box-shadow: var(--shadow);
  display: flex; flex-direction: column; gap: 2px; overflow: hidden;
  -webkit-backdrop-filter: blur(14px); backdrop-filter: blur(14px);
}
.hero-status-label { color: var(--faint); font-size: 10px; letter-spacing: .16em; text-transform: uppercase; font-family: var(--font-display); }
.hero-status strong { font-size: 17px; letter-spacing: -.02em; }
.hero-status-sub { color: var(--muted); font-size: 11px; }
.hero-pulse { position: absolute; right: -22px; top: -22px; width: 82px; height: 82px; border-radius: 50%; background: rgba(61,220,151,.16); filter: blur(16px); }
.hero-status.level-warn .hero-pulse { background: rgba(247,185,85,.22); }
.hero-status.level-danger .hero-pulse { background: rgba(255,107,127,.28); }
.hero-status.level-warn { border-color: var(--warn-line); }
.hero-status.level-danger { border-color: var(--danger-line); box-shadow: 0 0 0 1px var(--danger-bg), var(--shadow); }

/* ---------- 区块标题 ---------- */
.section { margin-top: 36px; }
.section-head {
  display: flex; align-items: center; justify-content: space-between; gap: 20px;
  margin-bottom: 22px; flex-wrap: wrap;
}
.section-title { display: flex; align-items: baseline; gap: 14px; }
.section-index { font: 700 13px var(--font-display); color: var(--violet); letter-spacing: .12em; }
.section-title h2 { margin: 0; font-size: clamp(1.35rem, 2.4vw, 1.8rem); letter-spacing: -.03em; font-weight: 700; }
.section-actions { display: flex; align-items: center; gap: 12px; flex-wrap: wrap; }
.section-hint, .snapshot { color: var(--faint); font-size: 12px; }
.count-pill {
  color: var(--muted); font-size: 12px; padding: 7px 13px; border-radius: 999px;
  border: 1px solid var(--line); background: var(--surface-low);
}
.bt-inline {
  display: inline-flex; align-items: center; gap: 6px; align-self: center;
  padding: 5px 11px; border-radius: 999px; text-decoration: none;
  border: 1px solid var(--line); background: var(--surface-low);
  color: var(--muted); font-size: 11.5px; font-weight: 600; white-space: nowrap;
  transition: color .18s ease, border-color .18s ease, background .18s ease;
}
.bt-inline:hover { color: var(--accent-ink); border-color: var(--violet); background: var(--accent-soft-bg); }
.bt-inline svg { width: 12px; height: 12px; }
.notice { padding: 16px 20px; border-radius: var(--radius-sm); margin-bottom: 20px; font-size: 14px; }
.notice.is-danger { background: var(--form-error-bg); border: 1px solid var(--form-error-line); color: var(--form-error-ink); }

/* ---------- 指标卡 ---------- */
.metrics-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(200px, 1fr)); gap: 16px; }
.metric-card {
  position: relative; padding: 22px 22px 20px; border-radius: var(--radius);
  background: var(--surface); border: 1px solid var(--line); overflow: hidden;
  -webkit-backdrop-filter: blur(12px); backdrop-filter: blur(12px);
  transition: transform .18s ease, border-color .18s ease;
}
.metric-card:hover { transform: translateY(-3px); border-color: var(--line-strong); }
.metric-card::before {
  content: ""; position: absolute; inset: 0 0 auto 0; height: 2px;
  background: linear-gradient(90deg, transparent, var(--cyan), transparent); opacity: .6;
}
.metric-head { display: flex; align-items: center; justify-content: space-between; gap: 10px; }
.metric-label { color: var(--muted); font-size: 13px; }
.metric-badge {
  font-size: 11px; padding: 3px 9px; border-radius: 999px; letter-spacing: .06em;
  color: var(--ok-ink); background: var(--ok-bg); border: 1px solid var(--ok-line);
}
.metric-value { display: flex; align-items: baseline; gap: 5px; margin: 14px 0 12px; }
.metric-value span { font: 700 clamp(2.4rem, 4vw, 3.2rem)/1 var(--font-display); letter-spacing: -.055em; }
.metric-value small { color: var(--muted); font: 700 15px var(--font-display); }
.meter { height: 6px; border-radius: 99px; background: var(--track); overflow: hidden; }
.meter i {
  display: block; height: 100%; border-radius: 99px;
  background: var(--meter-grad); transition: width .5s ease;
}
.metric-detail { color: var(--faint); font-size: 12px; margin: 12px 0 0; min-height: 18px; }
.metric-card.level-warn { border-color: var(--warn-line); background: var(--warn-surface); }
.metric-card.level-warn .metric-badge { color: var(--warn-ink); background: var(--warn-bg); border-color: var(--warn-line); }
.metric-card.level-warn .meter i { background: linear-gradient(90deg, #f7b955, #ff9d5c); }
.metric-card.level-danger {
  border-color: var(--danger-line); background: var(--danger-surface);
  box-shadow: 0 0 0 1px rgba(255,107,127,.14), 0 12px 40px rgba(255,60,90,.12);
  animation: alarm 2.4s ease-in-out infinite;
}
@keyframes alarm { 50% { box-shadow: 0 0 0 4px rgba(255,107,127,.10), 0 12px 48px rgba(255,60,90,.22); } }
.metric-card.level-danger::before { background: linear-gradient(90deg, transparent, var(--danger), transparent); opacity: 1; }
.metric-card.level-danger .metric-badge { color: var(--danger-ink); background: var(--danger-soft-bg); border-color: var(--danger-line); }
.metric-card.level-danger .metric-value span { color: var(--danger-ink); }
.metric-card.level-danger .meter i { background: linear-gradient(90deg, #ff6b7f, #ff9d5c); }

.server-strip {
  margin-top: 16px; border-radius: var(--radius); border: 1px solid var(--line);
  background: var(--surface-low); display: flex; align-items: stretch; gap: 0;
  flex-wrap: wrap; overflow: hidden;
}
.strip-items { flex: 1 1 620px; display: grid; grid-template-columns: repeat(3, 1fr); }
.strip-item { padding: 16px 20px; border-right: 1px solid var(--line); border-bottom: 1px solid var(--line); }
.strip-item:nth-child(3n) { border-right: none; }
.strip-item:nth-last-child(-n+3) { border-bottom: none; }
.strip-item span { display: block; color: var(--faint); font-size: 11px; letter-spacing: .08em; }
.strip-item strong { display: block; margin-top: 5px; font-size: 13px; font-weight: 700; word-break: break-all; }
.bt-link {
  flex: 0 1 330px; display: flex; align-items: center; gap: 14px; padding: 18px 22px;
  background: var(--bt-grad);
  border-left: 1px solid var(--line); transition: background .18s ease;
}
.bt-link:hover { background: var(--bt-grad-hover); }
.bt-icon { width: 42px; height: 42px; flex-shrink: 0; border-radius: 12px; display: grid; place-items: center; background: var(--accent-soft-bg); color: var(--accent-ink); }
.bt-icon svg { width: 22px; height: 22px; }
.bt-text { display: flex; flex-direction: column; min-width: 0; }
.bt-text strong { font-size: 15px; }
.bt-text small { color: var(--faint); font-size: 11px; line-height: 1.4; margin-top: 3px; }
.bt-arrow { width: 18px; height: 18px; margin-left: auto; flex-shrink: 0; color: var(--muted); }

/* ---------- 大模型余额卡片 ---------- */
.balance-updated { color: var(--faint); font-size: 11.5px; margin: 0 0 14px; }
.balance-updated strong { color: var(--danger-ink); }
.balance-empty {
  color: var(--faint); font-size: 13px; padding: 18px 20px;
  border: 1px dashed var(--line); border-radius: var(--radius-sm);
}
.balance-group + .balance-group { margin-top: 22px; }
.balance-group-head { display: flex; align-items: baseline; gap: 12px; margin-bottom: 10px; }
.balance-group-head h3 { margin: 0; font-size: 14px; font-weight: 700; color: var(--text); }
.balance-group-head span { color: var(--faint); font-size: 11px; letter-spacing: .06em; }
.balance-grid { grid-template-columns: repeat(auto-fit, minmax(220px, 1fr)); }
.balance-card { padding: 16px 18px 15px; border-radius: var(--radius-sm); }
.balance-card .metric-head { align-items: flex-start; }
.balance-card .metric-label {
  display: block; flex: 1 1 auto; min-width: 0; max-width: none;
  color: var(--text); font-size: 12.5px; font-weight: 600; line-height: 1.4;
  overflow-wrap: anywhere;
}
.balance-card .metric-badge { flex: 0 0 auto; margin-top: 1px; }
.balance-card .metric-head-right { display: flex; align-items: center; gap: 6px; flex: 0 0 auto; }
.balance-console {
  width: 22px; height: 22px; flex: 0 0 auto; display: grid; place-items: center;
  border: 1px solid var(--line); border-radius: 7px;
  background: var(--surface-low); color: var(--muted);
  transition: color .18s ease, border-color .18s ease, background .18s ease;
}
.balance-console:hover { color: var(--accent-ink); border-color: var(--violet); background: var(--accent-soft-bg); }
.balance-console svg { width: 12px; height: 12px; }
.balance-card .metric-value { margin: 10px 0 9px; }
.balance-card .metric-value span { font-size: clamp(1.5rem, 2.3vw, 2rem); letter-spacing: -.04em; }
.balance-card .metric-value .balance-value-prefix {
  font: 600 12px var(--font-display); color: var(--muted);
  letter-spacing: 0; margin-right: 3px;
}
.balance-card .metric-detail { margin-top: 9px; min-height: 32px; line-height: 1.5; }
.balance-account {
  display: flex; align-items: center; gap: 7px; min-width: 0;
  margin: 9px 0 0; padding-top: 8px;
  border-top: 1px solid var(--line);
  color: var(--faint); font-size: 11px;
}
.balance-account span {
  flex: 0 0 auto; padding: 1px 6px; border-radius: 5px;
  background: var(--surface-low); border: 1px solid var(--line);
  color: var(--muted); font-size: 10px; letter-spacing: .06em;
}
.balance-account em {
  min-width: 0; font-style: normal; white-space: nowrap;
  overflow: hidden; text-overflow: ellipsis;
}
@media (max-width: 720px) {
  .balance-account { font-size: 10px; margin-top: 7px; padding-top: 6px; }
  .balance-card .metric-label { font-size: 11.5px; }
  .balance-card .balance-value-prefix { font-size: 10px; }
  .bt-inline { font-size: 10px; padding: 4px 8px; }
}
.balance-card.level-muted { opacity: .76; }
.balance-card.level-muted .metric-badge { color: var(--faint); background: var(--surface-low); border-color: var(--line); }
.balance-card.level-muted .meter i { background: var(--line-strong); }

/* ---------- 项目卡片 ---------- */
.projects-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(248px, 1fr)); gap: 16px; }
.project-card {
  position: relative; min-height: 214px; padding: 22px; border-radius: var(--radius);
  border: 1px solid var(--line); background: var(--surface);
  display: flex; flex-direction: column; overflow: hidden; isolation: isolate;
  -webkit-backdrop-filter: blur(12px); backdrop-filter: blur(12px);
  transition: transform .2s cubic-bezier(.2,.8,.2,1), border-color .2s ease, box-shadow .2s ease;
}
.project-card::before {
  content: ""; position: absolute; left: 0; top: 0; height: 3px; width: 100%;
  background: linear-gradient(90deg, var(--card), transparent 92%); z-index: 2;
}
.card-glow {
  position: absolute; right: -60px; top: -70px; width: 170px; height: 170px; border-radius: 50%;
  background: var(--card); filter: blur(60px); opacity: var(--glow); z-index: -1; transition: opacity .25s ease;
}
.project-card:hover { transform: translateY(-5px); border-color: color-mix(in srgb, var(--card) 55%, transparent); box-shadow: var(--card-shadow); }
.project-card:hover .card-glow { opacity: var(--glow-hover); }
.card-top { display: flex; align-items: flex-start; justify-content: space-between; gap: 10px; }
.card-icon {
  width: 44px; height: 44px; border-radius: 13px; display: grid; place-items: center;
  font: 700 15px var(--font-display); letter-spacing: .02em;
  color: var(--card); background: color-mix(in srgb, var(--card) 18%, transparent);
  border: 1px solid color-mix(in srgb, var(--card) 40%, transparent);
}
.card-tag {
  font-size: 11px; color: var(--faint); padding: 5px 10px; border-radius: 999px;
  border: 1px solid var(--line); white-space: nowrap;
}
.project-card h3 { margin: 18px 0 6px; font-size: 17px; letter-spacing: -.02em; font-weight: 700; line-height: 1.4; }
.card-desc { color: var(--muted); font-size: 12.5px; line-height: 1.6; margin: 0; flex: 1; }
.card-foot { display: flex; align-items: center; gap: 8px; margin-top: 18px; padding-top: 14px; border-top: 1px solid var(--line); }
.card-path { color: var(--muted); font-size: 11.5px; flex: 0 1 auto; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.card-state { margin-left: auto; font-size: 10.5px; padding: 4px 9px; border-radius: 999px; white-space: nowrap; }
.card-state.is-soon { color: var(--warn-ink); background: var(--warn-bg); border: 1px solid var(--warn-line); }
.card-state.is-on { color: var(--ok-ink); background: var(--ok-bg); border: 1px solid var(--ok-line); }
.card-state.is-off { color: var(--faint); background: var(--chip-bg); border: 1px solid var(--line); }
.card-arrow { color: var(--card); font: 700 17px var(--font-display); }
.project-card.is-disabled { opacity: .52; filter: saturate(.5); }
.add-card {
  border-style: dashed; border-color: var(--line-strong); background: var(--dashed-bg);
  align-items: flex-start; justify-content: center;
}
.add-card:hover { border-color: var(--violet); background: var(--accent-soft-bg); }
.add-plus { font: 400 40px/1 var(--font-display); color: var(--violet); }
.add-card h3 { margin-top: 16px; }
.add-cta { margin-top: 18px; color: var(--violet); font-size: 13px; font-weight: 700; }

/* ---------- 登录页 ----------
   整页恰好一屏：去掉页脚，用 dvh 居中；移动端再单独压缩为紧凑单栏 */
body.is-auth .site-footer { display: none; }
.auth-wrap {
  width: min(1180px, calc(100% - 40px)); margin: 0 auto;
  min-height: 100vh; min-height: 100dvh; padding: 0;
  display: grid; grid-template-columns: 1.15fr .85fr; gap: 80px;
  align-items: center; align-content: center;
}
.auth-intro { position: relative; }
.auth-intro h1 { font-size: clamp(2.8rem, 6vw, 5rem); margin-top: 26px; }
.auth-intro h1 em {
  font-style: normal;
  background: var(--text-grad);
  -webkit-background-clip: text; background-clip: text; color: transparent;
}
.auth-marks { display: flex; gap: 34px; margin-top: 54px; flex-wrap: wrap; }
.auth-marks div { display: flex; flex-direction: column; gap: 4px; }
.auth-marks strong { font: 700 28px var(--font-display); color: var(--violet); letter-spacing: -.04em; }
.auth-marks span { color: var(--faint); font-size: 12px; }
.auth-orbit { position: absolute; right: 2%; top: -40px; width: 220px; height: 220px; pointer-events: none; opacity: .5; }
.auth-orbit i { position: absolute; inset: 0; border: 1px solid var(--orbit-line); border-radius: 50%; }
.auth-orbit i:nth-child(2) { inset: 34px; border-color: var(--orbit-line-2); }
.auth-orbit i:nth-child(3) { inset: 76px; background: var(--orbit-core); border: none; filter: blur(8px); }
.auth-card {
  position: relative; padding: 38px; border-radius: 26px;
  background: var(--surface-hi); border: 1px solid var(--line-strong);
  box-shadow: var(--shadow); -webkit-backdrop-filter: blur(20px); backdrop-filter: blur(20px);
}
.auth-card::before {
  content: ""; position: absolute; inset: 0 0 auto 0; height: 3px; border-radius: 26px 26px 0 0;
  background: linear-gradient(90deg, var(--violet), var(--cyan));
}
.auth-card-head { margin-bottom: 28px; }
.auth-lock { width: 48px; height: 48px; border-radius: 14px; display: grid; place-items: center; color: var(--accent-ink); background: var(--accent-soft-bg); border: 1px solid var(--accent-line); }
.auth-lock svg { width: 24px; height: 24px; }
.auth-card-head h2 { font-size: 25px; margin: 18px 0 4px; letter-spacing: -.03em; }
.auth-card-head p { color: var(--faint); font-size: 13px; margin: 0; }
.auth-card form { display: flex; flex-direction: column; gap: 16px; }
.auth-foot { color: var(--faint); font-size: 11.5px; text-align: center; margin: 22px 0 0; }

/* ---------- 表单 ---------- */
.field { display: flex; flex-direction: column; gap: 8px; color: var(--muted); font-size: 13px; font-weight: 700; }
.field em { color: var(--violet); font-style: normal; }
.field input, .hex-field input {
  width: 100%; min-height: 48px; padding: 0 14px; color: var(--text);
  background: var(--input-bg); border: 1px solid var(--line-strong); border-radius: 11px;
  transition: border-color .16s ease, box-shadow .16s ease; font-weight: 400; font-size: 15px;
}
.field input::placeholder { color: var(--input-placeholder); }
.field input:focus { outline: none; border-color: var(--violet); box-shadow: 0 0 0 3px var(--input-focus-ring); }
.form-error {
  margin: 0; padding: 11px 14px; border-radius: 10px; font-size: 13px; font-weight: 400;
  color: var(--form-error-ink); background: var(--form-error-bg); border: 1px solid var(--form-error-line);
}
.form-error.is-visible { display: block; }
.form-hint { color: var(--faint); font-size: 11.5px; line-height: 1.6; margin: 4px 0 0; word-break: break-word; }
.field-note { color: var(--faint); font-size: 11.5px; font-weight: 400; line-height: 1.6; }
.field-note code { color: var(--cyan); font-size: 11px; }

/* ---------- 拦截页 ---------- */
.gate-wrap { max-width: 760px; }
.back-link { display: inline-flex; align-items: center; gap: 8px; color: var(--muted); font-size: 13px; padding: 12px 0; min-height: 44px; }
.back-link:hover { color: var(--text); }
.gate-card {
  position: relative; margin-top: 20px; padding: 48px 44px; border-radius: 26px; overflow: hidden;
  background: var(--surface-hi); border: 1px solid var(--line-strong); box-shadow: var(--shadow);
  -webkit-backdrop-filter: blur(20px); backdrop-filter: blur(20px);
}
.gate-card::before { content: ""; position: absolute; inset: 0 0 auto 0; height: 3px; background: linear-gradient(90deg, var(--card, var(--violet)), transparent); }
.gate-orbit { position: absolute; right: -90px; top: -90px; width: 300px; height: 300px; border-radius: 50%; background: var(--card, var(--violet)); filter: blur(90px); opacity: .17; pointer-events: none; }
.gate-code { font: 700 11px var(--font-display); letter-spacing: .28em; color: var(--violet); }
.gate-glyph { font: 700 56px/1 var(--font-display); color: var(--card, var(--violet)); margin: 26px 0 8px; }
.gate-card h1 { font-size: clamp(2rem, 5vw, 3.1rem); margin: 0 0 16px; }
.gate-desc { color: var(--muted); max-width: 560px; line-height: 1.8; margin: 0; }
.gate-spec { display: grid; grid-template-columns: repeat(2, 1fr); gap: 12px; margin: 32px 0 0; padding: 22px; border-radius: 16px; background: var(--inset-bg); border: 1px solid var(--line); }
.gate-spec div { display: flex; flex-direction: column; gap: 4px; }
.gate-spec dt { color: var(--faint); font-size: 11px; }
.gate-spec dd { margin: 0; font-size: 14px; font-weight: 700; }
.gate-actions { display: flex; gap: 12px; flex-wrap: wrap; margin-top: 30px; }
.gate-note { color: var(--faint); font-size: 12px; margin-top: 22px; }

/* ---------- 配置页 ---------- */
.config-actions { display: flex; align-items: center; gap: 12px; flex-wrap: wrap; }
.sync-bar {
  margin-top: 12px; padding: 18px 22px; border-radius: var(--radius);
  display: flex; align-items: center; gap: 16px; flex-wrap: wrap;
  background: var(--surface-low); border: 1px solid var(--line);
}
.sync-dot { width: 11px; height: 11px; border-radius: 50%; flex-shrink: 0; background: var(--faint); box-shadow: 0 0 0 5px rgba(108,124,163,.12); }
.sync-bar.is-ok { border-color: var(--ok-line); background: var(--ok-surface); }
.sync-bar.is-ok .sync-dot { background: var(--ok); box-shadow: 0 0 0 5px rgba(61,220,151,.14), 0 0 14px rgba(61,220,151,.5); }
.sync-bar.is-fail { border-color: var(--danger-line); background: var(--danger-surface); }
.sync-bar.is-fail .sync-dot { background: var(--danger); box-shadow: 0 0 0 5px rgba(255,107,127,.16); }
.sync-copy { display: flex; flex-direction: column; gap: 3px; flex: 1 1 320px; min-width: 0; }
.sync-copy strong { font-size: 14px; }
.sync-copy small { color: var(--muted); font-size: 12px; word-break: break-word; }
.sync-meta { display: flex; flex-direction: column; align-items: flex-end; gap: 3px; color: var(--faint); font-size: 11.5px; }
.cfg-list { display: flex; flex-direction: column; gap: 10px; }
.cfg-list.is-busy { opacity: .55; pointer-events: none; }
.cfg-row {
  display: flex; align-items: center; gap: 16px; padding: 14px 18px;
  border-radius: 15px; background: var(--surface); border: 1px solid var(--line);
  transition: border-color .16s ease, background .16s ease, transform .16s ease;
}
.cfg-row:hover { border-color: var(--line-strong); }
.cfg-row.dragging { opacity: .4; transform: scale(.99); }
.cfg-row.drag-over { border-color: var(--violet); box-shadow: inset 3px 0 0 var(--violet); }
.drag-handle { cursor: grab; color: var(--faint); font-size: 18px; line-height: 1; padding: 8px 4px; user-select: none; touch-action: none; }
.drag-handle:active { cursor: grabbing; }
.cfg-swatch {
  width: 42px; height: 42px; flex-shrink: 0; border-radius: 12px; display: grid; place-items: center;
  font: 700 13px var(--font-display); color: var(--card);
  background: color-mix(in srgb, var(--card) 18%, transparent);
  border: 1px solid color-mix(in srgb, var(--card) 42%, transparent);
}
.cfg-main { flex: 1 1 240px; min-width: 0; }
.cfg-main strong { display: block; font-size: 15px; }
.cfg-sub { color: var(--faint); font-size: 11.5px; margin-top: 3px; display: flex; gap: 7px; flex-wrap: wrap; align-items: center; }
.cfg-sub code { color: var(--cyan); }
.cfg-flags { display: flex; gap: 6px; flex-wrap: wrap; }
.chip-toggle {
  min-height: 34px; padding: 0 12px; border-radius: 999px; font-size: 11.5px;
  color: var(--faint); background: var(--chip-bg); border: 1px solid var(--line);
}
.chip-toggle.on { color: var(--ok-ink); background: var(--ok-bg); border-color: var(--ok-line); }
.chip-toggle:hover { border-color: var(--line-strong); }
.cfg-actions { display: flex; gap: 6px; }
.icon-btn {
  min-width: 40px; min-height: 40px; padding: 0 10px; border-radius: 10px;
  color: var(--muted); background: var(--icon-bg); border: 1px solid var(--line);
  font-size: 13px; display: inline-flex; align-items: center; justify-content: center;
}
.icon-btn:hover { color: var(--text); border-color: var(--line-strong); background: var(--icon-bg-hover); }
.icon-btn.is-danger:hover { color: var(--form-error-ink); border-color: var(--danger-line); background: var(--form-error-bg); }
.list-foot { color: var(--faint); font-size: 12px; margin-top: 14px; }
.rules-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(238px, 1fr)); gap: 14px; }
.rule-card { padding: 20px; border-radius: 16px; background: var(--surface-low); border: 1px solid var(--line); }
.rule-card strong { font-size: 14px; color: var(--text); }
.rule-card p { color: var(--muted); font-size: 12.5px; line-height: 1.7; margin: 8px 0 0; }
.rule-card code { color: var(--cyan); }

/* ---------- 弹窗 ---------- */
.modal-backdrop {
  position: fixed; inset: 0; z-index: 90; padding: 24px;
  background: var(--backdrop); -webkit-backdrop-filter: blur(8px); backdrop-filter: blur(8px);
  display: flex; align-items: center; justify-content: center; overflow-y: auto;
}
.modal-backdrop[hidden] { display: none; }
body.modal-open { overflow: hidden; }
.modal {
  width: min(680px, 100%); max-height: calc(100vh - 48px); overflow-y: auto;
  padding: 26px; border-radius: 24px; background: var(--modal-bg);
  border: 1px solid var(--line-strong); box-shadow: var(--modal-shadow);
  animation: modalIn .22s cubic-bezier(.2,.8,.2,1);
}
@keyframes modalIn { from { opacity: 0; transform: translateY(14px) scale(.985); } }
.modal-sm { width: min(440px, 100%); }
.modal-head { display: flex; align-items: flex-start; justify-content: space-between; margin-bottom: 20px; }
.modal-kicker { font: 700 10px var(--font-display); letter-spacing: .28em; color: var(--violet); }
.modal-head h2 { margin: 6px 0 0; font-size: 24px; letter-spacing: -.03em; }
.modal-close { width: 42px; height: 42px; border-radius: 11px; border: 1px solid var(--line); background: var(--icon-bg); color: var(--muted); font-size: 24px; line-height: 1; }
.modal-close:hover { color: var(--text); background: var(--icon-bg-hover); }
.form-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; }
.field-label { display: inline-flex; align-items: baseline; gap: 4px; }
.span-2 { grid-column: span 2; }
.input-prefix { display: flex; align-items: center; min-height: 48px; border: 1px solid var(--line-strong); border-radius: 11px; background: var(--input-bg); overflow: hidden; }
.input-prefix > span { color: var(--faint); font-size: 12px; padding-left: 12px; white-space: nowrap; }
.input-prefix input { border: none; background: transparent; min-height: 46px; padding-left: 2px; font-family: var(--font-display); }
.input-prefix input:focus { box-shadow: none; }
.input-prefix:focus-within { border-color: var(--violet); box-shadow: 0 0 0 3px var(--input-focus-ring); }
.color-picker { border: 1px solid var(--line); border-radius: 14px; padding: 16px; margin: 16px 0 0; }
.color-picker legend { color: var(--muted); font-size: 13px; font-weight: 700; padding: 0 8px; }
.swatches { display: flex; gap: 10px; flex-wrap: wrap; }
.swatch {
  width: 38px; height: 38px; border-radius: 11px; border: 2px solid transparent;
  background: var(--sw); transition: transform .15s ease, border-color .15s ease;
}
.swatch:hover { transform: translateY(-3px); }
.swatch.is-active { border-color: var(--swatch-ring); box-shadow: 0 0 0 3px var(--swatch-ring-shadow); }
.hex-field { display: flex; align-items: center; gap: 10px; color: var(--muted); font-size: 12px; margin-top: 16px; }
.hex-field input { width: 130px; min-height: 42px; font-family: var(--font-display); letter-spacing: .08em; text-transform: uppercase; }
.switch-row { display: grid; grid-template-columns: repeat(auto-fit, minmax(215px, 1fr)); gap: 6px 18px; margin: 16px 0 0; }
.switch { display: flex; align-items: center; gap: 12px; min-height: 44px; color: var(--muted); font-size: 13.5px; cursor: pointer; }
.switch input { position: absolute; opacity: 0; width: 0; height: 0; }
.switch-ui { width: 42px; height: 24px; border-radius: 99px; background: var(--switch-track); border: 1px solid var(--line-strong); position: relative; flex-shrink: 0; transition: background .18s ease; }
.switch-ui::after { content: ""; position: absolute; width: 18px; height: 18px; border-radius: 50%; background: var(--switch-knob); top: 2px; left: 2px; transition: transform .18s ease, background .18s ease; }
.switch input:checked + .switch-ui { background: var(--switch-on); border-color: var(--switch-on-line); }
.switch input:checked + .switch-ui::after { transform: translateX(18px); background: var(--switch-knob-on); }
.switch input:focus-visible + .switch-ui { outline: 2px solid var(--cyan); outline-offset: 3px; }
.modal-foot { display: flex; justify-content: flex-end; gap: 12px; margin-top: 20px; flex-wrap: wrap; }
.confirm-text { color: var(--muted); line-height: 1.8; font-size: 14px; }
.confirm-text strong { color: var(--text); }

/* ---------- Toast ---------- */
.toast-stack { position: fixed; right: 22px; bottom: 22px; z-index: 120; display: flex; flex-direction: column; gap: 10px; pointer-events: none; }
.toast {
  min-width: 250px; max-width: min(380px, calc(100vw - 44px)); padding: 14px 18px;
  border-radius: 13px; font-size: 13.5px; box-shadow: var(--shadow);
  background: var(--toast-bg); border: 1px solid var(--line-strong); color: var(--text);
  animation: toastIn .25s ease; pointer-events: auto;
}
.toast.is-ok { border-color: rgba(61,220,151,.5); }
.toast.is-error { border-color: var(--danger-line); background: var(--toast-error-bg); }
@keyframes toastIn { from { opacity: 0; transform: translateY(12px); } }

/* ---------- 响应式：每一层都塌缩，手机上所有控件等比缩小 ---------- */
@media (max-width: 1080px) {
  .metrics-grid { grid-template-columns: repeat(3, 1fr); }
  .strip-items { grid-template-columns: repeat(2, 1fr); }
  .strip-item:nth-child(3n) { border-right: 1px solid var(--line); }
  .strip-item:nth-child(2n) { border-right: none; }
  .strip-item:nth-last-child(-n+3) { border-bottom: 1px solid var(--line); }
  .strip-item:nth-last-child(-n+2) { border-bottom: none; }
  .bt-link { flex: 1 1 100%; border-left: none; border-top: 1px solid var(--line); }
  .cfg-row { flex-wrap: wrap; }
  .cfg-actions { margin-left: auto; }
}
@media (max-width: 860px) {
  .hero, .config-hero { flex-direction: column; align-items: flex-start; gap: 16px; padding: 18px 0 20px; }
  .hero-status { min-width: 0; width: 100%; }
  .auth-wrap { grid-template-columns: 1fr; gap: 16px; }
  .auth-orbit { display: none; }
  .auth-card { padding: 30px; }
  .topbar-inner { flex-wrap: wrap; gap: 8px 16px; padding: 10px 0; }
  .nav-links { order: 3; width: 100%; margin-left: 0; }
  .nav-links a { flex: 1; justify-content: center; min-height: 44px; }
  .nav-user { margin-left: auto; }
  .site-footer { flex-direction: column; gap: 6px; }
}
@media (max-width: 640px) {
  .shell, .topbar-inner, .site-footer, .auth-wrap { width: calc(100% - 28px); }
  .shell { padding: 12px 0 26px; }

  /* 顶栏：品牌、导航、用户区、按钮整体降一档 */
  .topbar-inner { min-height: 0; padding: 7px 0; gap: 6px 10px; }
  .brand { gap: 8px; }
  .brand-mark { width: 27px; height: 27px; }
  .brand-mark i:nth-child(2) { top: 15px; }
  .brand-mark i:nth-child(3) { width: 5px; height: 5px; left: 11px; top: 2px; }
  .brand-text strong { font-size: 15px; letter-spacing: .14em; }
  .brand-text small { font-size: 8px; margin-top: 2px; letter-spacing: .18em; }
  .nav-links { gap: 5px; }
  .nav-links a { min-height: 32px; padding: 5px 10px; font-size: 12px; border-radius: 8px; }
  .nav-user { gap: 7px; }
  .user-chip { gap: 5px; font-size: 11px; }
  .user-avatar { width: 25px; height: 25px; border-radius: 8px; font-size: 12px; }
  .btn-quiet { min-height: 32px; padding: 0 11px; font-size: 12px; border-radius: 9px; }

  /* HERO：手机上再压一档 */
  h1 { font-size: clamp(1.9rem, 8.5vw, 2.5rem); margin-top: 8px; }
  .config-hero h1 { font-size: clamp(1.9rem, 8.5vw, 2.5rem); }
  .hero, .config-hero { padding: 14px 0 16px; gap: 12px; }
  .kicker { font-size: 9px; letter-spacing: .16em; gap: 6px; }
  .live-dot { width: 6px; height: 6px; }
  .hero-lead, .auth-lead { font-size: 12.5px; line-height: 1.55; margin-top: 6px; }
  .hero-status { padding: 9px 13px; border-radius: 11px; min-width: 0; width: 100%;
    flex-direction: row; align-items: center; flex-wrap: wrap; gap: 3px 12px; }
  .hero-side { width: 100%; }
  .hero-status-label { font-size: 9px; }
  .hero-status strong { font-size: 14px; }
  .hero-status-sub { font-size: 10px; margin-left: auto; }

  /* 区块标题与按钮 */
  .section { margin-top: 24px; }
  .section-head { margin-bottom: 13px; gap: 9px; }
  .section-title { gap: 9px; }
  .section-index { font-size: 11px; }
  .section-title h2 { font-size: 1.15rem; }
  .section-actions { width: 100%; gap: 8px; }
  .btn-ghost { min-height: 34px; padding: 0 12px; font-size: 12px; border-radius: 9px; }
  .btn-ghost svg, .btn-primary svg { width: 14px; height: 14px; }
  .snapshot, .section-hint, .count-pill { font-size: 10.5px; }
  .count-pill { padding: 5px 9px; }

  /* 指标卡：两列、更小的数字与内边距 */
  .metrics-grid { grid-template-columns: repeat(2, 1fr); gap: 10px; }
  .metric-card { padding: 13px 12px 12px; border-radius: 14px; }
  .metric-label { font-size: 11px; }
  .metric-badge { font-size: 9px; padding: 2px 7px; }
  .metric-value { margin: 8px 0; gap: 3px; }
  .metric-value span { font-size: 1.85rem; }
  .metric-value small { font-size: 11px; }
  .meter { height: 5px; }
  .metric-detail { font-size: 10px; margin-top: 7px; min-height: 0;
    display: -webkit-box; -webkit-box-orient: vertical; -webkit-line-clamp: 2;
    line-clamp: 2; overflow: hidden; overflow-wrap: anywhere; line-height: 1.4; }

  /* 信息条与宝塔入口 */
  .server-strip { margin-top: 10px; border-radius: 14px; }
  .strip-items { grid-template-columns: 1fr; }
  .strip-item { border-right: none !important; border-bottom: 1px solid var(--line) !important; padding: 9px 13px; }
  .strip-item:last-child { border-bottom: none !important; }
  .strip-item span { font-size: 9.5px; }
  .strip-item strong { font-size: 11.5px; margin-top: 2px; }
  .bt-link { padding: 11px 13px; gap: 10px; }
  .bt-icon { width: 32px; height: 32px; border-radius: 9px; }
  .bt-icon svg { width: 18px; height: 18px; }
  .bt-text strong { font-size: 13px; }
  .bt-text small { font-size: 10px; }
  .bt-arrow { width: 15px; height: 15px; }

  /* 项目卡：压缩高度，保持单列可读 */
  .projects-grid { grid-template-columns: 1fr; gap: 10px; }
  .project-card { min-height: 0; padding: 15px; border-radius: 14px; }
  .card-icon { width: 34px; height: 34px; border-radius: 10px; font-size: 12px; }
  .card-tag { font-size: 9.5px; padding: 3px 8px; }
  .project-card h3 { font-size: 14px; margin: 10px 0 4px; }
  .card-desc { font-size: 11px; line-height: 1.5; }
  .card-foot { margin-top: 11px; padding-top: 9px; }
  .card-path { font-size: 10px; }
  .card-state { font-size: 9px; padding: 3px 7px; }
  .card-arrow { font-size: 14px; }
  .add-plus { font-size: 30px; }
  .add-card h3 { margin-top: 8px; }
  .add-cta { margin-top: 10px; font-size: 12px; }

  .gate-card { padding: 28px 20px; }
  .gate-glyph { font-size: 42px; margin: 18px 0 6px; }
  .gate-spec { grid-template-columns: 1fr; padding: 16px; }
  .gate-actions { margin-top: 20px; }
  .form-grid { grid-template-columns: 1fr; }
  .span-2 { grid-column: span 1; }
  .modal { padding: 20px; border-radius: 18px; }
  .modal-backdrop { padding: 12px; }
  .modal-foot .btn-quiet, .modal-foot .btn-primary, .modal-foot .btn-danger { flex: 1; }
  .cfg-row { gap: 10px; padding: 12px; }
  .cfg-main { flex: 1 1 calc(100% - 110px); }
  .cfg-swatch { width: 36px; height: 36px; }
  .cfg-flags { width: 100%; order: 5; }
  .cfg-actions { width: 100%; order: 6; justify-content: flex-end; }
  .icon-btn { min-width: 40px; min-height: 40px; }
  .chip-toggle { min-height: 30px; padding: 0 10px; font-size: 10.5px; }
  .rule-card { padding: 14px; }
  .toast-stack { right: 14px; bottom: 14px; left: 14px; }
  .toast { max-width: none; min-width: 0; }
  .site-footer { padding: 14px 0 18px; font-size: 10px; line-height: 1.5; }
}
@media (max-width: 400px) {
  .brand-text small { display: none; }
  .user-chip { font-size: 0; }
  .user-chip .user-avatar { font-size: 12px; }
}

/* ---------- 登录页手机端：一屏装下，不出现滚动条 ----------
   压缩掉最大的一块（01/02/03 标签组），标题改单行，表单控件降一档。
   右上角浮动皮肤按钮占据约 52px，故留出顶部安全距离。 */
@media (max-width: 860px) {
  .is-auth .auth-wrap {
    gap: 12px; align-content: center;
    padding: 58px 0 max(16px, env(safe-area-inset-bottom));
  }
  .is-auth .auth-kicker { font-size: 9px; letter-spacing: .16em; gap: 6px; }
  .is-auth .auth-host { display: none; }
  .is-auth .auth-intro h1 { font-size: 1.55rem; line-height: 1.25; margin-top: 8px; }
  .is-auth .auth-intro h1 br { display: none; }
  .is-auth .auth-lead { font-size: 12px; line-height: 1.5; margin-top: 6px; }
  .is-auth .auth-marks { display: none; }
  .is-auth .auth-card { padding: 20px 20px 18px; border-radius: 18px; }
  .is-auth .auth-card-head { margin-bottom: 14px; }
  .is-auth .auth-lock { width: 36px; height: 36px; border-radius: 10px; }
  .is-auth .auth-lock svg { width: 18px; height: 18px; }
  .is-auth .auth-card-head h2 { font-size: 19px; margin: 10px 0 2px; }
  .is-auth .auth-card-head p { font-size: 11.5px; }
  .is-auth .auth-card form { gap: 10px; }
  .is-auth .field { gap: 5px; font-size: 12px; }
  .is-auth .field input { min-height: 42px; font-size: 14px; padding: 0 12px; border-radius: 9px; }
  .is-auth .btn-primary { min-height: 42px; border-radius: 10px; font-size: 13px; }
  .is-auth .btn-primary svg { width: 15px; height: 15px; }
  .is-auth .auth-foot { margin: 12px 0 0; font-size: 10.5px; }
}
/* 极矮屏（如横屏 / 老机型）再收一点，仍保持不裁剪 */
@media (max-width: 860px) and (max-height: 680px) {
  .is-auth .auth-wrap { padding-top: 50px; gap: 9px; }
  .is-auth .auth-intro h1 { font-size: 1.35rem; }
  .is-auth .auth-card { padding: 16px 18px 15px; }
  .is-auth .auth-card-head { margin-bottom: 10px; }
  .is-auth .auth-card form { gap: 8px; }
  .is-auth .field input { min-height: 38px; }
  .is-auth .btn-primary { min-height: 38px; }
  .is-auth .auth-foot { margin-top: 9px; }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: .01ms !important; animation-iteration-count: 1 !important; transition-duration: .01ms !important; scroll-behavior: auto !important; }
}

/* ---------- 桌面端统一顶部节奏 + 首页紧凑布局（>=861px） ----------
   首页与配置页的 HERO 共用同一套 padding / 最小高度 / 标题字号，
   切换页面时标题位置不再跳动；移动端 <=860px 仍走上面的响应式规则。 */
@media (min-width: 861px) {
  /* 顶部空白 + 两页共用的 HERO 与标题 */
  .is-home .hero, .config-hero { padding: 8px 0 12px; height: 104px; align-items: center; }
  .is-home h1, .config-hero h1 { margin-top: 6px; font-size: clamp(1.9rem, 3.4vw, 2.55rem); }
  .is-home .hero-status { min-width: 168px; padding: 9px 14px; gap: 1px; border-radius: 13px; }
  .is-home .hero-status strong { font-size: 15px; }
  .is-home .hero-status-sub { font-size: 10px; }

  /* 区块标题行：减小上下留白与按钮高度 */
  .is-home .section { margin-top: 18px; }
  .is-home .section-head { margin-bottom: 12px; }
  .is-home .section-title h2 { font-size: clamp(1.2rem, 1.9vw, 1.45rem); }
  .is-home .section-actions { gap: 10px; }
  .is-home .section-actions .btn-ghost { min-height: 34px; padding: 0 14px; font-size: 12.5px; border-radius: 10px; }
  .is-home .section-actions .btn-ghost svg { width: 15px; height: 15px; }
  .is-home .snapshot, .is-home .count-pill { font-size: 11px; }
  .is-home .count-pill { padding: 5px 11px; }

  /* 指标卡：收紧内边距与数字，小字改为一行后不再预留两行高度 */
  .is-home .metrics-grid { gap: 12px; }
  .is-home .metric-card { padding: 15px 18px 14px; }
  .is-home .metric-value { margin: 9px 0 8px; }
  .is-home .metric-value span { font-size: clamp(2.1rem, 3.2vw, 2.6rem); }
  .is-home .metric-detail { margin-top: 8px; min-height: 0; }

  /* 服务器信息条：两行信息 + 宝塔入口整体变矮 */
  .is-home .server-strip { margin-top: 10px; }
  .is-home .strip-item { padding: 9px 16px; }
  .is-home .strip-item span { font-size: 10px; }
  .is-home .strip-item strong { margin-top: 2px; font-size: 12px; }
  .is-home .bt-link { flex-basis: 300px; padding: 10px 18px; gap: 11px; }
  .is-home .bt-icon { width: 34px; height: 34px; }
  .is-home .bt-icon svg { width: 18px; height: 18px; }
  .is-home .bt-text strong { font-size: 13px; }
  .is-home .bt-text small { font-size: 10px; margin-top: 2px; }
}

/* 中等桌面（861~1080px）：旧响应式会把信息条拆成 2 列 3 行、宝塔独占一行，
   这里统一成「5 张指标卡一行 + 信息条 3 列 2 行 + 宝塔在右侧」，避免高度反弹。 */
@media (min-width: 861px) and (max-width: 1080px) {
  .is-home .metrics-grid { grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); }
  .is-home .metric-card { padding: 13px 14px 12px; }
  .is-home .metric-value span { font-size: clamp(1.9rem, 2.8vw, 2.3rem); }
  .is-home .metric-detail { font-size: 11px; }

  .is-home .strip-items { flex: 1 1 420px; grid-template-columns: repeat(3, 1fr); }
  .is-home .strip-item { padding: 8px 12px; }
  .is-home .strip-item strong { font-size: 11px; }
  .is-home .strip-item:nth-child(2n):not(:nth-child(3n)) { border-right: 1px solid var(--line); }
  .is-home .strip-item:nth-child(3n) { border-right: none; }
  .is-home .strip-item:nth-child(-n+3) { border-bottom: 1px solid var(--line); }
  .is-home .strip-item:nth-last-child(-n+3) { border-bottom: none; }
  .is-home .bt-link { flex: 0 1 240px; padding: 9px 14px; border-left: 1px solid var(--line); border-top: none; }
}
