/* ==========================================================================
   NPCSMC 控制台 · v3 管理面板（MCSM 风格）
   深色紧凑 / 终端感 / 高信息密度；与公开页视觉明确区分。
   结构：1) 变量 2) 基础 3) 登录 4) 框架 5) 组件 6) 控制台 7) 文件 8) 响应式
   ========================================================================== */

/* ---------- 1. 设计变量 ---------- */
:root {
  --bg: #0E1116;
  --bg-soft: #11161D;
  --panel: #161B22;
  --panel-2: #1B222C;
  --panel-3: #202936;
  --border: #252C36;
  --border-strong: #33404D;
  --text: #D7E0E8;
  --text-dim: #9AA7B4;
  --text-faint: #65727F;
  --accent: #3FB98F;
  --accent-bright: #4ED9A8;
  --accent-dark: #2E8F6E;
  --accent-soft: rgba(63, 185, 143, 0.12);
  --blue: #4C9AFF;
  --blue-soft: rgba(76, 154, 255, 0.12);
  --danger: #E5534B;
  --danger-soft: rgba(229, 83, 75, 0.12);
  --warn: #D9A55E;
  --warn-soft: rgba(217, 165, 94, 0.12);
  --terminal: #0A0C10;
  --mono: "Cascadia Mono", Consolas, "Courier New", monospace;
  --ui: "Segoe UI", system-ui, -apple-system, "Microsoft YaHei", "PingFang SC", sans-serif;
  --sidebar-w: 226px;
  --topbar-h: 52px;
  --radius: 8px;
  --radius-sm: 6px;
  --radius-xs: 4px;
  --shadow: 0 10px 30px rgba(0, 0, 0, 0.35);
  --ease: cubic-bezier(0.22, 0.61, 0.36, 1);
}

/* ---------- 2. 基础 ---------- */
*,
*::before,
*::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; scrollbar-color: #2E3844 transparent; }
html, body { min-height: 100%; }
body {
  margin: 0;
  min-height: 100vh;
  background: var(--bg);
  color: var(--text);
  font-family: var(--ui);
  font-size: 13px;
  line-height: 1.55;
  overflow-x: hidden;
  -webkit-font-smoothing: antialiased;
}
body::before {
  content: "";
  position: fixed;
  inset: 0;
  z-index: -1;
  pointer-events: none;
  background:
    radial-gradient(900px 420px at 80% -10%, rgba(63, 185, 143, 0.05), transparent 60%),
    radial-gradient(700px 380px at 0% 100%, rgba(76, 154, 255, 0.04), transparent 60%);
}
h1, h2, h3, h4, p, ul, ol, dl, dd, dt, figure { margin: 0; }
ul, ol { padding: 0; list-style: none; }
button { font-family: inherit; font-size: inherit; color: inherit; }
img, svg, canvas { display: block; }
svg { flex: none; }
table { border-collapse: collapse; }
a { color: var(--blue); text-decoration: none; }
a:hover { text-decoration: underline; text-underline-offset: 2px; }
::selection { background: var(--accent-soft); color: var(--text); }
[hidden] { display: none !important; }
.sr-only { position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; border: 0; }

* { scrollbar-width: thin; }
::-webkit-scrollbar { width: 9px; height: 9px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: #2E3844; border-radius: 6px; border: 2px solid transparent; background-clip: padding-box; }
::-webkit-scrollbar-thumb:hover { background: #3C4957; background-clip: padding-box; border: 2px solid transparent; }

/* 加载遮罩 */
.boot {
  position: fixed;
  inset: 0;
  z-index: 300;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 6px;
  background: var(--bg);
  transition: opacity 0.25s var(--ease);
}
.boot.is-hidden { opacity: 0; pointer-events: none; }
.boot-logo {
  width: 46px;
  height: 46px;
  display: grid;
  place-items: center;
  border-radius: 10px;
  background: var(--accent);
  box-shadow: 0 6px 20px rgba(63, 185, 143, 0.22);
  margin-bottom: 12px;
}
.boot-text { font-size: 15px; font-weight: 600; letter-spacing: 0.5px; }
.boot-sub { font-size: 12px; color: var(--text-faint); }
.noscript { position: fixed; top: 20px; left: 50%; transform: translateX(-50%); padding: 10px 16px; background: var(--panel); border: 1px solid var(--border); border-radius: var(--radius-sm); color: var(--warn); }

/* ---------- 3. 登录页 ---------- */
.login-root { min-height: 100vh; }
.login-page {
  min-height: 100vh;
  display: grid;
  place-items: center;
  padding: 32px 18px;
  background:
    radial-gradient(760px 380px at 50% 0%, rgba(63, 185, 143, 0.06), transparent 62%),
    linear-gradient(180deg, #0E1116, #0B0E13);
}
.login-card {
  width: min(384px, 100%);
  padding: 26px 26px 20px;
  background: var(--panel);
  border: 1px solid var(--border);
  border-radius: 10px;
  box-shadow: var(--shadow);
  animation: rise-in 0.25s var(--ease) both;
}
@keyframes rise-in { from { opacity: 0; transform: translateY(8px); } to { opacity: 1; transform: none; } }
.login-brand { display: flex; align-items: center; gap: 12px; padding-bottom: 18px; border-bottom: 1px solid var(--border); }
.login-mark {
  width: 38px;
  height: 38px;
  flex: none;
  display: grid;
  place-items: center;
  border-radius: 8px;
  background: var(--accent-soft);
  border: 1px solid rgba(63, 185, 143, 0.35);
  color: var(--accent);
}
.login-title { font-size: 17px; font-weight: 600; letter-spacing: 0.3px; }
.login-sub { margin-top: 2px; font-size: 11.5px; color: var(--text-faint); font-family: var(--mono); }
.login-form { display: flex; flex-direction: column; gap: 8px; padding-top: 18px; }
.login-label { font-size: 12px; color: var(--text-dim); }
.login-input-wrap { position: relative; display: flex; align-items: center; }
.login-input-wrap .input { height: 40px; padding-right: 40px; }
.pw-toggle {
  position: absolute;
  right: 5px;
  top: 50%;
  transform: translateY(-50%);
  width: 30px;
  height: 30px;
  display: grid;
  place-items: center;
  padding: 0;
  border: 0;
  border-radius: var(--radius-xs);
  background: transparent;
  color: var(--text-faint);
  cursor: pointer;
}
.pw-toggle:hover { color: var(--text); background: var(--panel-3); }
.login-error { min-height: 0; font-size: 12px; color: var(--danger); }
.login-error:empty { display: none; }
.login-error.is-shake { animation: shake 0.38s ease; }
@keyframes shake {
  0%, 100% { transform: translateX(0); }
  20% { transform: translateX(-5px); }
  40% { transform: translateX(4px); }
  60% { transform: translateX(-2px); }
  80% { transform: translateX(1px); }
}
.login-meta {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  margin-top: 16px;
  padding-top: 14px;
  border-top: 1px solid var(--border);
  font-size: 11.5px;
  color: var(--text-faint);
  flex-wrap: wrap;
}
.login-meta b { color: var(--text-dim); font-family: var(--mono); font-weight: 400; font-size: 11px; }
.login-back { color: var(--text-dim); font-size: 11.5px; }
.login-back:hover { color: var(--accent); }
.login-foot { margin-top: 10px; font-size: 10.5px; color: var(--text-faint); text-align: center; }

/* ---------- 4. 应用框架 ---------- */
.app { display: flex; min-height: 100vh; }
.sidebar {
  position: fixed;
  top: 0;
  bottom: 0;
  left: 0;
  z-index: 50;
  width: var(--sidebar-w);
  display: flex;
  flex-direction: column;
  background: var(--bg-soft);
  border-right: 1px solid var(--border);
}
.sidebar-brand {
  height: 60px;
  flex: none;
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 0 14px;
  border-bottom: 1px solid var(--border);
}
.brand-mark {
  width: 32px;
  height: 32px;
  flex: none;
  display: grid;
  place-items: center;
  border-radius: 7px;
  background: var(--accent);
  color: #071A13;
}
.brand-text { min-width: 0; }
.brand-name { font-size: 13.5px; font-weight: 600; letter-spacing: 0.3px; white-space: nowrap; }
.brand-sub { font-size: 9.5px; letter-spacing: 1.4px; color: var(--text-faint); font-family: var(--mono); white-space: nowrap; }
.sidebar-section {
  padding: 14px 16px 6px;
  font-size: 10.5px;
  letter-spacing: 1px;
  color: var(--text-faint);
  font-family: var(--mono);
}
.sidebar-servers { display: flex; flex-direction: column; gap: 2px; padding: 0 8px; }
.server-status-item {
  display: flex;
  align-items: center;
  gap: 8px;
  height: 32px;
  padding: 0 8px;
  border: 1px solid transparent;
  border-radius: var(--radius-sm);
  background: transparent;
  color: var(--text-dim);
  font-size: 12px;
  cursor: pointer;
  text-align: left;
  transition: background 0.12s, color 0.12s, border-color 0.12s;
}
.server-status-item:hover { background: var(--panel-2); color: var(--text); }
.server-status-item.is-active { background: var(--panel); border-color: var(--border); color: var(--text); }
.ssi-label { flex: 1; min-width: 0; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.ssi-online { font-family: var(--mono); font-size: 10.5px; color: var(--text-faint); }
.server-status-item.is-active .ssi-online { color: var(--accent); }
.sidebar-empty { padding: 8px; font-size: 11px; color: var(--text-faint); }
.sidebar-nav { margin-top: 16px; padding: 0 8px; display: flex; flex-direction: column; gap: 2px; }
.nav-item {
  position: relative;
  display: flex;
  align-items: center;
  gap: 9px;
  height: 34px;
  padding: 0 10px;
  border: 1px solid transparent;
  border-radius: var(--radius-sm);
  background: transparent;
  color: var(--text-dim);
  font-size: 12.5px;
  cursor: pointer;
  text-align: left;
  transition: background 0.12s, color 0.12s, border-color 0.12s;
}
.nav-item svg { color: var(--text-faint); }
.nav-item:hover { background: var(--panel-2); color: var(--text); }
.nav-item.is-active { background: var(--panel); border-color: var(--border); color: var(--text); }
.nav-item.is-active svg { color: var(--accent); }
.nav-item.is-active::before {
  content: "";
  position: absolute;
  left: -1px;
  top: 8px;
  bottom: 8px;
  width: 2px;
  border-radius: 2px;
  background: var(--accent);
}
.nav-item:focus-visible { outline: 2px solid var(--accent); outline-offset: 1px; }
.sidebar-foot {
  margin-top: auto;
  flex: none;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  padding: 12px 14px;
  border-top: 1px solid var(--border);
  font-size: 10.5px;
  color: var(--text-faint);
  font-family: var(--mono);
}
.main { flex: 1; min-width: 0; margin-left: var(--sidebar-w); display: flex; flex-direction: column; min-height: 100vh; }
.topbar {
  position: sticky;
  top: 0;
  z-index: 30;
  height: var(--topbar-h);
  flex: none;
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 0 18px;
  background: rgba(17, 22, 29, 0.94);
  border-bottom: 1px solid var(--border);
  backdrop-filter: blur(8px);
}
.topbar-left { display: flex; align-items: center; gap: 10px; min-width: 0; flex: 1; }
.topbar-route { font-size: 13px; font-weight: 600; color: var(--text); white-space: nowrap; }
.topbar-sep { width: 1px; height: 16px; background: var(--border); flex: none; }
.topbar-label { font-size: 11px; color: var(--text-faint); white-space: nowrap; }
.topbar-server { width: auto; min-width: 132px; max-width: 220px; height: 30px; font-size: 12px; background: var(--panel); }
.topbar-right { display: flex; align-items: center; gap: 10px; flex: none; }
.topbar-online {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-size: 11.5px;
  color: var(--text-dim);
  white-space: nowrap;
  font-family: var(--mono);
}
.topbar-online svg { color: var(--accent); }
.topbar-online b { color: var(--text); font-weight: 600; font-size: 12.5px; }
.topbar-online .online-unit { color: var(--text-faint); font-size: 10.5px; }
.topbar-online[data-status="offline"] svg { color: var(--text-faint); }
.topbar-email {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  font-size: 11px;
  color: var(--text-faint);
  font-family: var(--mono);
  white-space: nowrap;
  max-width: 220px;
  overflow: hidden;
  text-overflow: ellipsis;
}
.topbar-email svg { color: var(--text-faint); }
.hamburger { display: none; }
.view { flex: 1; width: 100%; max-width: 1560px; margin: 0 auto; padding: 16px 18px 22px; outline: none; }

.drawer-overlay {
  position: fixed;
  inset: 0;
  z-index: 45;
  background: rgba(0, 0, 0, 0.55);
  backdrop-filter: blur(1px);
}

/* ---------- 5. 通用组件 ---------- */
.icon-btn {
  display: inline-grid;
  place-items: center;
  width: 30px;
  height: 30px;
  padding: 0;
  border: 1px solid transparent;
  border-radius: var(--radius-sm);
  background: transparent;
  color: var(--text-dim);
  cursor: pointer;
}
.icon-btn:hover { background: var(--panel-2); border-color: var(--border); color: var(--text); }
.icon-btn:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  height: 32px;
  padding: 0 12px;
  border: 1px solid var(--border-strong);
  border-radius: var(--radius-sm);
  background: var(--panel-2);
  color: var(--text);
  font-size: 12px;
  font-weight: 500;
  white-space: nowrap;
  cursor: pointer;
  user-select: none;
  transition: background 0.12s, border-color 0.12s, color 0.12s;
}
.btn:hover { background: var(--panel-3); border-color: #465666; }
.btn:active { transform: translateY(1px); }
.btn:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
.btn:disabled { opacity: 0.45; cursor: not-allowed; transform: none; }
.btn svg { width: 13px; height: 13px; }
.btn-primary { background: var(--accent); border-color: var(--accent); color: #062018; font-weight: 600; }
.btn-primary:hover { background: var(--accent-bright); border-color: var(--accent-bright); }
.btn-success { background: rgba(63, 185, 143, 0.12); border-color: rgba(63, 185, 143, 0.45); color: var(--accent); }
.btn-success:hover { background: rgba(63, 185, 143, 0.22); border-color: var(--accent); }
.btn-warning { background: rgba(217, 165, 94, 0.1); border-color: rgba(217, 165, 94, 0.4); color: var(--warn); }
.btn-warning:hover { background: rgba(217, 165, 94, 0.2); border-color: var(--warn); }
.btn-danger { background: var(--danger); border-color: var(--danger); color: #fff; font-weight: 600; }
.btn-danger:hover { background: #F06A62; border-color: #F06A62; }
.btn-danger-outline { background: transparent; border-color: rgba(229, 83, 75, 0.4); color: var(--danger); }
.btn-danger-outline:hover { background: var(--danger-soft); border-color: var(--danger); }
.btn-ghost { background: transparent; border-color: transparent; color: var(--text-dim); }
.btn-ghost:hover { background: var(--panel-2); border-color: var(--border); color: var(--text); }
.btn-sm { height: 28px; padding: 0 10px; font-size: 11.5px; }
.btn-xs { height: 24px; padding: 0 8px; font-size: 11px; border-radius: var(--radius-xs); }
.btn-xs svg { width: 12px; height: 12px; }
.btn-block { width: 100%; height: 38px; }
.btn.is-loading { pointer-events: none; }
.spinner {
  width: 12px;
  height: 12px;
  flex: none;
  border: 2px solid currentColor;
  border-right-color: transparent;
  border-radius: 50%;
  animation: spin 0.7s linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }

.input, .select, .textarea {
  width: 100%;
  height: 34px;
  padding: 0 9px;
  color: var(--text);
  font-family: var(--ui);
  font-size: 12.5px;
  background: var(--bg-soft);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  outline: none;
  transition: border-color 0.12s, box-shadow 0.12s;
  -webkit-appearance: none;
  appearance: none;
}
.input::placeholder, .textarea::placeholder { color: var(--text-faint); }
.input:hover, .select:hover, .textarea:hover { border-color: var(--border-strong); }
.input:focus, .select:focus, .textarea:focus { border-color: var(--accent); box-shadow: 0 0 0 2px rgba(63, 185, 143, 0.16); }
.input:disabled, .select:disabled, .textarea:disabled { opacity: 0.55; cursor: not-allowed; }
.input-mono { font-family: var(--mono); }
.select {
  padding-right: 26px;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' fill='none' stroke='%239AA7B4' stroke-width='1.7' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='m3 5 3 3 3-3'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 8px center;
  cursor: pointer;
}
.textarea { height: auto; min-height: 120px; padding: 8px 10px; line-height: 1.6; resize: vertical; font-family: var(--mono); }
.panel {
  background: var(--panel);
  border: 1px solid var(--border);
  border-radius: var(--radius);
}
.panel-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  padding: 10px 14px;
  border-bottom: 1px solid var(--border);
}
.panel-title { font-size: 12.5px; font-weight: 600; color: var(--text); letter-spacing: 0.2px; }

.status-dot {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  flex: none;
  display: inline-block;
  background: var(--text-faint);
}
.status-dot.is-online { background: var(--accent); box-shadow: 0 0 0 2px rgba(63, 185, 143, 0.16); }
.status-dot.is-offline { background: #55606C; }
.status-dot.is-starting, .status-dot.is-stopping { background: var(--warn); box-shadow: 0 0 0 2px rgba(217, 165, 94, 0.16); animation: blink 1s steps(2, start) infinite; }
.status-dot.is-unknown { background: var(--text-faint); }
@keyframes blink { 50% { opacity: 0.3; } }

.switch { display: inline-flex; align-items: center; gap: 7px; cursor: pointer; user-select: none; font-size: 11.5px; color: var(--text-dim); }
.switch input { position: absolute; opacity: 0; width: 0; height: 0; }
.switch .track {
  position: relative;
  width: 32px;
  height: 18px;
  flex: none;
  border-radius: 999px;
  background: #2A333E;
  border: 1px solid var(--border-strong);
  transition: background 0.15s, border-color 0.15s;
}
.switch .track::after {
  content: "";
  position: absolute;
  top: 2px;
  left: 2px;
  width: 12px;
  height: 12px;
  border-radius: 50%;
  background: #8B98A5;
  transition: transform 0.15s var(--ease), background 0.15s;
}
.switch input:checked + .track { background: rgba(63, 185, 143, 0.35); border-color: var(--accent); }
.switch input:checked + .track::after { transform: translateX(14px); background: var(--accent); }
.switch input:focus-visible + .track { outline: 2px solid var(--accent); outline-offset: 2px; }

.skeleton { position: relative; overflow: hidden; border-radius: 4px; background: #222B36; }
.skeleton::after { content: ""; position: absolute; inset: 0; transform: translateX(-100%); background: linear-gradient(90deg, transparent, rgba(255, 255, 255, 0.05), transparent); animation: shimmer 1.3s infinite; }
@keyframes shimmer { 100% { transform: translateX(100%); } }
.skeleton-line { height: 10px; display: block; }

/* Toast */
.toast-root {
  position: fixed;
  top: 16px;
  right: 16px;
  z-index: 200;
  display: flex;
  flex-direction: column;
  gap: 8px;
  width: min(360px, calc(100vw - 32px));
  pointer-events: none;
}
.toast {
  display: flex;
  align-items: stretch;
  gap: 9px;
  padding: 9px 10px 9px 0;
  background: var(--panel-2);
  border: 1px solid var(--border-strong);
  border-radius: var(--radius-sm);
  box-shadow: var(--shadow);
  pointer-events: auto;
  animation: toast-in 0.18s var(--ease);
}
.toast.is-leaving { animation: toast-out 0.18s var(--ease) forwards; }
.toast-bar { width: 3px; border-radius: 2px; background: var(--accent); flex: none; }
.toast.is-success .toast-bar { background: var(--accent); }
.toast.is-error .toast-bar { background: var(--danger); }
.toast.is-warning .toast-bar { background: var(--warn); }
.toast.is-info .toast-bar { background: var(--blue); }
.toast-body { flex: 1; min-width: 0; padding: 2px 0 0 10px; }
.toast-msg { font-size: 12px; line-height: 1.55; color: var(--text); word-break: break-word; }
.toast-close {
  flex: none;
  align-self: flex-start;
  width: 20px;
  height: 20px;
  display: grid;
  place-items: center;
  padding: 0;
  border: 0;
  border-radius: var(--radius-xs);
  background: transparent;
  color: var(--text-faint);
  cursor: pointer;
}
.toast-close:hover { background: var(--panel-3); color: var(--text); }
@keyframes toast-in { from { opacity: 0; transform: translateX(14px); } to { opacity: 1; transform: none; } }
@keyframes toast-out { to { opacity: 0; transform: translateX(14px); } }

/* Modal */
.modal-root { position: relative; z-index: 210; }
.modal-backdrop {
  position: fixed;
  inset: 0;
  z-index: 210;
  display: grid;
  place-items: center;
  padding: 18px;
  background: rgba(4, 6, 9, 0.66);
  backdrop-filter: blur(2px);
  animation: fade-in 0.15s ease;
}
@keyframes fade-in { from { opacity: 0; } to { opacity: 1; } }
.modal {
  width: min(440px, 100%);
  background: var(--panel);
  border: 1px solid var(--border-strong);
  border-radius: 10px;
  box-shadow: 0 24px 70px rgba(0, 0, 0, 0.55);
  overflow: hidden;
  animation: modal-in 0.16s var(--ease);
}
@keyframes modal-in { from { opacity: 0; transform: translateY(6px) scale(0.99); } to { opacity: 1; transform: none; } }
.modal-head { display: flex; align-items: center; gap: 10px; padding: 16px 18px 0; }
.modal-icon {
  width: 30px;
  height: 30px;
  flex: none;
  display: grid;
  place-items: center;
  border-radius: var(--radius-sm);
  background: var(--accent-soft);
  color: var(--accent);
}
.modal-icon.is-danger { background: var(--danger-soft); color: var(--danger); }
.modal-title { font-size: 14px; font-weight: 600; }
.modal-body { padding: 10px 18px 18px; font-size: 12.5px; color: var(--text-dim); line-height: 1.7; }
.modal-body p + p { margin-top: 6px; }
.modal-foot { display: flex; justify-content: flex-end; gap: 8px; padding: 12px 18px; border-top: 1px solid var(--border); background: var(--bg-soft); }
.prompt-body { display: flex; flex-direction: column; gap: 7px; }
.prompt-label { font-size: 11.5px; color: var(--text-faint); }

/* 空状态 */
.empty-state { display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 5px; padding: 40px 16px; text-align: center; }
.empty-title { font-size: 13px; font-weight: 600; color: var(--text-dim); }
.empty-desc { font-size: 11.5px; color: var(--text-faint); max-width: 420px; line-height: 1.6; }

/* ---------- 6. 控制台 ---------- */
.console-page { display: flex; flex-direction: column; gap: 10px; }
.server-bar { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 8px 10px; flex-wrap: wrap; }
.server-tabs { display: flex; align-items: center; gap: 3px; flex-wrap: wrap; }
.server-tab {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  height: 30px;
  padding: 0 10px;
  border: 1px solid transparent;
  border-radius: var(--radius-sm);
  background: transparent;
  color: var(--text-dim);
  font-size: 12px;
  cursor: pointer;
  white-space: nowrap;
}
.server-tab:hover { background: var(--panel-2); color: var(--text); }
.server-tab.is-active { background: var(--panel-2); border-color: var(--border-strong); color: var(--text); }
.server-tab .tab-count { font-family: var(--mono); font-size: 10.5px; color: var(--text-faint); }
.server-tab.is-active .tab-count { color: var(--accent); }
.server-tab:focus-visible { outline: 2px solid var(--accent); outline-offset: 1px; }
.server-actions { display: flex; align-items: center; gap: 6px; flex-wrap: wrap; }
.action-sep { width: 1px; height: 16px; background: var(--border); }
.stream-pill { display: inline-flex; align-items: center; gap: 5px; font-size: 10.5px; color: var(--text-faint); font-family: var(--mono); white-space: nowrap; }
.stream-dot { width: 6px; height: 6px; border-radius: 50%; background: var(--text-faint); flex: none; }
.stream-pill[data-state="live"] { color: var(--accent); }
.stream-pill[data-state="live"] .stream-dot { background: var(--accent); box-shadow: 0 0 0 2px rgba(63, 185, 143, 0.18); animation: breathe 2s infinite; }
.stream-pill[data-state="connecting"] { color: var(--warn); }
.stream-pill[data-state="connecting"] .stream-dot { background: var(--warn); animation: blink 0.9s steps(2, start) infinite; }
.stream-pill[data-state="offline"] { color: var(--danger); }
.stream-pill[data-state="offline"] .stream-dot { background: var(--danger); }
@keyframes breathe { 0%, 100% { box-shadow: 0 0 0 1px rgba(63, 185, 143, 0.25); } 50% { box-shadow: 0 0 0 4px rgba(63, 185, 143, 0); } }

.console-grid { display: grid; grid-template-columns: minmax(0, 1fr) 288px; gap: 10px; align-items: start; }
.terminal-panel { display: flex; flex-direction: column; overflow: hidden; min-width: 0; }
.terminal-head {
  display: flex;
  align-items: center;
  gap: 9px;
  padding: 8px 12px;
  border-bottom: 1px solid var(--border);
  background: var(--panel-2);
  flex-wrap: wrap;
}
.term-dots { display: flex; gap: 4px; }
.term-dots i { width: 7px; height: 7px; border-radius: 50%; background: #3B4653; }
.term-title { font-family: var(--mono); font-size: 11px; color: var(--text-dim); }
.term-spacer { flex: 1; }
.term-count { font-family: var(--mono); font-size: 10.5px; color: var(--text-faint); }
.terminal {
  height: calc(100vh - 318px);
  min-height: 340px;
  overflow-y: auto;
  padding: 10px 12px;
  background: var(--terminal);
  font-family: var(--mono);
  font-size: 12.5px;
  line-height: 1.62;
  color: #9BA6B2;
  overscroll-behavior: contain;
}
.log-line { display: flex; gap: 9px; white-space: pre-wrap; word-break: break-word; }
.log-line.is-new { animation: line-in 0.16s ease; }
@keyframes line-in { from { opacity: 0; } to { opacity: 1; } }
.log-time { flex: none; color: #4E5A66; }
.log-level { flex: none; width: 46px; color: #7C8896; }
.log-text { flex: 1; min-width: 0; }
.log-line.level-info .log-level { color: #7C8896; }
.log-line.level-info .log-text { color: #A6B1BD; }
.log-line.level-warn .log-level { color: var(--warn); }
.log-line.level-warn .log-text { color: #E3C08F; }
.log-line.level-error .log-level { color: var(--danger); }
.log-line.level-error .log-text { color: #F2A39D; }
.log-line.level-chat .log-level { color: var(--blue); }
.log-line.level-chat .log-text { color: #9EC3F5; }
.log-line.level-cmd .log-level { color: var(--accent); }
.log-line.level-cmd .log-text { color: #8FE3C3; }
.log-line.level-other .log-level { color: #6B7785; }
.log-line.level-other .log-text { color: #8E9AA6; }
.terminal-placeholder { color: #56626E; font-size: 11.5px; padding: 4px 0; }
.terminal-empty { padding: 24px 10px; text-align: center; color: var(--text-faint); }
.terminal-empty-title { font-size: 12.5px; color: var(--text-dim); }
.terminal-empty-desc { margin-top: 4px; font-size: 11.5px; color: var(--text-faint); }
.terminal-empty .btn { margin-top: 10px; }
.cmd-row { display: flex; align-items: center; gap: 8px; padding: 8px 12px; border-top: 1px solid var(--border); background: var(--panel-2); }
.cmd-prompt { font-family: var(--mono); color: var(--accent); font-size: 13px; flex: none; }
.cmd-input {
  flex: 1;
  min-width: 0;
  height: 30px;
  padding: 0 9px;
  background: var(--terminal);
  color: #C9D4DE;
  border: 1px solid var(--border-strong);
  border-radius: var(--radius-sm);
  font-family: var(--mono);
  font-size: 12.5px;
  outline: none;
}
.cmd-input:focus { border-color: var(--accent); box-shadow: 0 0 0 2px rgba(63, 185, 143, 0.14); }
.cmd-input:disabled { opacity: 0.55; cursor: not-allowed; }

.info-panel { display: flex; flex-direction: column; min-width: 0; }
#info-status { display: inline-flex; align-items: center; gap: 5px; font-size: 11px; color: var(--text-dim); }
.info-list { padding: 6px 14px 10px; display: flex; flex-direction: column; }
.info-row { display: flex; align-items: baseline; justify-content: space-between; gap: 10px; padding: 5px 0; border-bottom: 1px dashed rgba(37, 44, 54, 0.8); }
.info-row:last-child { border-bottom: 0; }
.info-row dt { flex: none; font-size: 11px; color: var(--text-faint); }
.info-row dd { margin: 0; min-width: 0; text-align: right; font-size: 11.5px; font-family: var(--mono); color: var(--text); word-break: break-all; }
.info-row dd.is-mono { font-family: var(--mono); }
.info-row dd.is-wrap { word-break: break-all; }
.info-note {
  display: flex;
  gap: 6px;
  margin: 0 14px 14px;
  padding: 8px 9px;
  border-radius: var(--radius-sm);
  background: var(--bg-soft);
  border: 1px solid var(--border);
  color: var(--text-faint);
  font-size: 10.5px;
  line-height: 1.6;
}
.info-note svg { margin-top: 1px; color: var(--text-faint); }
.info-empty { padding: 20px 14px; color: var(--text-faint); font-size: 11.5px; }

/* ---------- 7. 文件管理 ---------- */
.files-page { display: flex; flex-direction: column; gap: 10px; }
.files-toolbar { display: flex; align-items: center; justify-content: space-between; gap: 10px; padding: 8px 12px; flex-wrap: wrap; }
.files-toolbar-left { display: flex; align-items: center; gap: 10px; min-width: 0; flex-wrap: wrap; }
.files-server { display: inline-flex; align-items: center; gap: 8px; min-width: 0; }
.files-server-label { font-size: 12.5px; font-weight: 600; color: var(--text); white-space: nowrap; }
.files-server-dir { font-family: var(--mono); font-size: 10.5px; color: var(--text-faint); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; max-width: 260px; }
.files-path { font-family: var(--mono); font-size: 11px; color: var(--text-dim); background: var(--bg-soft); border: 1px solid var(--border); border-radius: var(--radius-xs); padding: 2px 7px; max-width: 320px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.files-toolbar-right { display: flex; align-items: center; gap: 6px; flex-wrap: wrap; }
.files-panel { display: flex; flex-direction: column; overflow: hidden; }
.files-crumbs-row { display: flex; align-items: center; gap: 8px; padding: 8px 12px; border-bottom: 1px solid var(--border); flex-wrap: wrap; }
.breadcrumb { display: flex; align-items: center; gap: 3px; min-width: 0; flex-wrap: wrap; font-family: var(--mono); font-size: 11.5px; }
.crumb {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  height: 24px;
  padding: 0 6px;
  border: 1px solid transparent;
  border-radius: var(--radius-xs);
  background: transparent;
  color: var(--blue);
  font-family: inherit;
  font-size: inherit;
  cursor: pointer;
  white-space: nowrap;
}
.crumb:hover { background: var(--panel-2); border-color: var(--border); }
.crumb:last-child { color: var(--text-dim); }
.crumb-sep { color: var(--text-faint); font-size: 11px; }
.files-count { margin-left: auto; font-family: var(--mono); font-size: 10.5px; color: var(--text-faint); white-space: nowrap; }
.files-table-wrap { width: 100%; overflow-x: auto; }
.files-table { width: 100%; min-width: 620px; font-size: 12px; }
.files-table thead th {
  padding: 8px 12px;
  text-align: left;
  font-size: 10.5px;
  font-weight: 500;
  letter-spacing: 0.6px;
  color: var(--text-faint);
  background: var(--bg-soft);
  border-bottom: 1px solid var(--border);
  white-space: nowrap;
  font-family: var(--mono);
}
.files-table tbody tr { border-bottom: 1px solid var(--border); transition: background 0.1s; }
.files-table tbody tr:last-child { border-bottom: 0; }
.files-table tbody tr:hover { background: var(--panel-2); }
.files-table tbody td { padding: 6px 12px; height: 36px; color: var(--text-dim); }
.files-table .col-actions { text-align: right; width: 150px; }
.file-row.is-dir .file-name { color: var(--blue); }
.file-name {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  max-width: 100%;
  padding: 0;
  border: 0;
  background: transparent;
  color: var(--text);
  font-size: 12px;
  text-align: left;
  cursor: pointer;
}
.file-name:hover { color: var(--accent); text-decoration: underline; text-underline-offset: 2px; }
.file-icon { display: inline-flex; color: var(--text-faint); }
.file-row.is-dir .file-icon { color: var(--blue); }
.file-label { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.file-type { color: var(--text-faint); font-size: 11px; white-space: nowrap; }
.file-size, .file-mtime { font-family: var(--mono); font-size: 11px; white-space: nowrap; color: var(--text-faint); }
.file-mtime { color: var(--text-dim); }
.file-actions { text-align: right; white-space: nowrap; }
.file-actions .btn { margin-left: 5px; }
.files-table tbody tr.is-skeleton td { height: 36px; }
.files-empty-cell { padding: 0 !important; }
.files-empty { padding: 42px 16px; text-align: center; }
.files-empty-title { font-size: 12.5px; font-weight: 600; color: var(--text-dim); }
.files-empty-desc { margin-top: 5px; font-size: 11.5px; color: var(--text-faint); }
.files-empty .btn { margin-top: 12px; }
.files-foot {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 8px 12px;
  border-top: 1px solid var(--border);
  background: var(--bg-soft);
  font-size: 10.5px;
  color: var(--text-faint);
  flex-wrap: wrap;
}
.files-foot span { display: inline-flex; align-items: center; gap: 5px; }
.files-foot span:last-child { font-family: var(--mono); }

/* 编辑器（覆盖层） */
.editor-layer {
  position: fixed;
  inset: 0;
  z-index: 100;
  display: grid;
  place-items: center;
  padding: 18px;
  background: rgba(4, 6, 9, 0.72);
  backdrop-filter: blur(2px);
  animation: fade-in 0.15s ease;
}
.editor-panel {
  width: min(1080px, 100%);
  height: min(760px, calc(100vh - 36px));
  display: flex;
  flex-direction: column;
  background: var(--panel);
  border: 1px solid var(--border-strong);
  border-radius: 10px;
  box-shadow: 0 28px 80px rgba(0, 0, 0, 0.6);
  overflow: hidden;
  animation: modal-in 0.16s var(--ease);
}
.editor-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 10px 14px;
  border-bottom: 1px solid var(--border);
  background: var(--panel-2);
  flex-wrap: wrap;
}
.editor-title-wrap { min-width: 0; }
.editor-title { display: block; font-size: 13px; font-weight: 600; }
.editor-meta { display: block; margin-top: 1px; font-family: var(--mono); font-size: 10.5px; color: var(--text-faint); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.editor-actions { display: flex; align-items: center; gap: 8px; }
.editor-dirty { font-size: 10.5px; color: var(--warn); font-family: var(--mono); }
.editor-textarea {
  flex: 1;
  width: 100%;
  min-height: 0;
  padding: 12px 14px;
  background: var(--terminal);
  color: #C9D4DE;
  border: 0;
  outline: none;
  resize: none;
  font-family: var(--mono);
  font-size: 12.5px;
  line-height: 1.7;
  tab-size: 2;
  white-space: pre;
  overflow: auto;
  caret-color: var(--accent);
}
.editor-textarea:read-only { color: #97A3AF; }
.editor-foot {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 7px 14px;
  border-top: 1px solid var(--border);
  background: var(--panel-2);
  font-family: var(--mono);
  font-size: 10.5px;
  color: var(--text-faint);
  flex-wrap: wrap;
}

/* ---------- 8. 响应式 ---------- */
@media (max-width: 1240px) {
  .console-grid { grid-template-columns: minmax(0, 1fr) 264px; }
}
@media (max-width: 1100px) {
  .console-grid { grid-template-columns: minmax(0, 1fr); }
  .info-panel { order: 2; }
  .terminal { height: min(48vh, 420px); }
  .info-list { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 0 18px; }
  .info-note { margin-top: 2px; }
}
@media (max-width: 900px) {
  .sidebar {
    transform: translateX(-102%);
    transition: transform 0.22s var(--ease);
    box-shadow: 16px 0 40px rgba(0, 0, 0, 0.45);
    width: min(248px, 82vw);
  }
  body.drawer-open .sidebar { transform: none; }
  .main { margin-left: 0; }
  .hamburger { display: inline-grid; }
  .topbar { padding: 0 12px; gap: 8px; }
  .topbar-label { display: none; }
  .topbar-email { display: none; }
  .topbar-sep { display: none; }
  .view { padding: 12px; }
  .terminal { height: min(46vh, 380px); min-height: 280px; }
  .files-server-dir { max-width: 150px; }
  .files-path { max-width: 200px; }
  .files-table { min-width: 580px; }
  .editor-layer { padding: 0; }
  .editor-panel { width: 100%; height: 100vh; border-radius: 0; border: 0; }
}
@media (max-width: 640px) {
  .topbar-route { display: none; }
  .topbar-server { min-width: 118px; max-width: 150px; height: 28px; }
  .topbar-online .online-text { display: none; }
  .server-bar { flex-direction: column; align-items: stretch; }
  .server-tabs { width: 100%; }
  .server-tab { flex: 1; justify-content: center; padding: 0 6px; }
  .server-actions { justify-content: space-between; }
  .stream-pill { order: 2; }
  .console-grid { gap: 8px; }
  .terminal { height: min(52vh, 400px); min-height: 260px; font-size: 12px; padding: 8px; }
  .log-level { width: 40px; }
  .terminal-head { padding: 6px 9px; gap: 7px; }
  .term-count { display: none; }
  .cmd-row { padding: 6px 9px; }
  .info-list { grid-template-columns: minmax(0, 1fr); }
  .files-toolbar { flex-direction: column; align-items: stretch; }
  .files-toolbar-right { justify-content: flex-end; }
  .files-toolbar-left { justify-content: space-between; }
  .files-server-dir { display: none; }
  .files-path { max-width: 100%; }
  .files-foot span:first-child { display: none; }
  .files-foot { justify-content: flex-end; }
  .files-crumbs-row { gap: 6px; }
  .file-actions .btn { height: 22px; padding: 0 6px; }
  .files-table { min-width: 540px; }
  .editor-head { padding: 8px 10px; }
  .editor-meta { max-width: 240px; }
  .editor-actions .btn span:not(.spinner) { display: none; }
  .editor-textarea { font-size: 12px; padding: 10px; }
  .login-card { padding: 22px 18px 16px; }
  .toast-root { top: 10px; right: 10px; }
  .modal-backdrop { padding: 10px; }
}
@media (max-width: 420px) {
  .topbar-server { max-width: 132px; min-width: 108px; }
  .server-tab .tab-count { display: none; }
  .server-actions .btn { flex: 1; }
  .action-sep { display: none; }
  .stream-pill { width: 100%; justify-content: flex-end; }
  .files-toolbar-right .btn { flex: 1; }
  .editor-title { font-size: 12px; }
}

/* ---------- 9. 动效 / 可访问性 ---------- */
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    animation-duration: 0.001ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.001ms !important;
  }
}
:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
button:focus:not(:focus-visible), a:focus:not(:focus-visible) { outline: none; }

/* ==========================================================================
   10. v3.1 移动端适配增强（任务 task-17）
   - ≤900px：抽屉锁滚动、Tab 横向滚动、终端 dvh、命令栏 sticky、信息卡折叠
   - ≤640px：文件表格隐藏大小/时间列、面包屑横向滚动、按钮紧凑
   ========================================================================== */

/* 登录页：移动端安全区 / dvh 居中 */
.login-root,
.login-page { min-height: 100dvh; }
.login-page { padding-bottom: max(18px, env(safe-area-inset-bottom, 0px)); }

/* 服务器信息卡折叠（details） */
.info-details { display: block; }
.info-summary {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 10px 14px;
  border-bottom: 1px solid var(--border);
  list-style: none;
  user-select: none;
}
.info-summary::-webkit-details-marker { display: none; }
.info-summary .panel-title { flex: 1; min-width: 0; }
.info-details:not([open]) .info-summary { border-bottom: 0; }
.info-chevron { display: none; color: var(--text-faint); }
.info-chevron svg { transition: transform 0.18s var(--ease); }
.info-details[open] .info-chevron svg { transform: rotate(90deg); }
@media (min-width: 901px) {
  .info-summary { cursor: default; pointer-events: none; }
}
@media (max-width: 900px) {
  .info-chevron { display: inline-flex; }
  .info-summary { cursor: pointer; }
  .info-summary:active { background: var(--panel-2); }
  .info-panel { min-height: 0; }
  .info-details:not([open]) .info-list,
  .info-details:not([open]) .info-note { display: none; }
  .info-details[open] .info-list { grid-template-columns: minmax(0, 1fr); }
}

@media (max-width: 900px) {
  /* 抽屉：打开时锁背景滚动，层级：抽屉 60 > 遮罩 55 > 顶栏 40 */
  body.drawer-open { overflow: hidden; }
  .sidebar { z-index: 60; }
  .drawer-overlay { position: fixed; inset: 0; z-index: 55; }
  .topbar { z-index: 40; }
  .main { margin-left: 0; }

  /* 控制台：Tab 横向滚动、操作按钮紧凑单行、终端 dvh、命令栏 sticky */
  .server-bar { gap: 8px; }
  .server-tabs {
    flex-wrap: nowrap;
    overflow-x: auto;
    overscroll-behavior-x: contain;
    -webkit-overflow-scrolling: touch;
    scrollbar-width: none;
    width: 100%;
    padding-bottom: 2px;
  }
  .server-tabs::-webkit-scrollbar { display: none; }
  .server-tab { flex: 0 0 auto; }
  .server-actions {
    flex-wrap: nowrap;
    width: 100%;
    justify-content: flex-start;
    gap: 6px;
  }
  .server-actions .btn {
    flex: 1 1 0;
    min-width: 0;
    height: 28px;
    padding: 0 6px;
    font-size: 11.5px;
  }
  .server-actions .action-sep { display: none; }
  .stream-pill { flex: 0 0 auto; margin-left: auto; }

  .terminal-panel { overflow: visible; }
  .terminal {
    height: calc(100dvh - 300px);
    min-height: 240px;
    max-height: 62dvh;
    overflow-x: hidden;
    font-size: 12px;
  }
  .cmd-row {
    position: sticky;
    bottom: 0;
    z-index: 4;
    border-radius: 0 0 var(--radius) var(--radius);
    padding-bottom: calc(8px + env(safe-area-inset-bottom, 0px));
  }
  .log-line { gap: 6px; }
  .log-text { overflow-wrap: anywhere; word-break: break-word; }
  .log-level { width: 42px; }
  .info-panel { order: 2; }

  /* 文件页：面包屑横向滚动 */
  .files-crumbs-row { flex-wrap: nowrap; gap: 6px; }
  #btn-up { flex: 0 0 auto; }
  .breadcrumb {
    flex: 1 1 auto;
    min-width: 0;
    flex-wrap: nowrap;
    overflow-x: auto;
    overscroll-behavior-x: contain;
    -webkit-overflow-scrolling: touch;
    scrollbar-width: none;
    padding-bottom: 2px;
  }
  .breadcrumb::-webkit-scrollbar { display: none; }
  .files-count { flex: 0 0 auto; }
}

@media (max-width: 640px) {
  html { -webkit-tap-highlight-color: transparent; }
  .topbar { height: 48px; padding: 0 10px; }
  .view { padding: 10px 10px max(14px, env(safe-area-inset-bottom, 0px)); }
  .server-bar { padding: 7px 8px; }
  .server-tab { height: 28px; font-size: 11.5px; padding: 0 9px; }
  .terminal {
    height: calc(100dvh - 292px);
    min-height: 230px;
    max-height: 58dvh;
    padding: 8px;
    font-size: 12px;
  }
  .terminal-head { gap: 6px; }
  .switch-text { display: none; }
  .cmd-row { gap: 6px; padding: 6px 8px; }
  .cmd-input { height: 32px; font-size: 12.5px; }
  #cmd-send { flex: 0 0 auto; height: 30px; padding: 0 10px; }

  /* 文件表格：隐藏大小/修改时间列，名称列自适应，无横向滚动 */
  .files-table { min-width: 0; table-layout: fixed; }
  .files-table thead th:nth-child(3),
  .files-table tbody td:nth-child(3),
  .files-table thead th:nth-child(4),
  .files-table tbody td:nth-child(4) { display: none; }
  .files-table thead th:nth-child(2),
  .files-table tbody td:nth-child(2) { width: 42px; padding-left: 4px; padding-right: 2px; }
  .files-table thead th.col-actions,
  .files-table tbody td.file-actions { width: 100px; }
  .files-table tbody td { padding: 6px 8px; }
  .file-actions .btn { margin-left: 2px; height: 24px; padding: 0 6px; }
  .file-actions .btn-danger-outline { padding: 0 5px; }
  .file-name { max-width: 100%; }
  .file-label { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
  .files-toolbar-right { width: 100%; gap: 6px; }
  .files-toolbar-right .btn { flex: 1 1 0; padding: 0 6px; }
  .files-foot { padding: 6px 8px; }
  .files-path { max-width: 100%; }

  /* 登录页小屏 */
  .login-page { padding: 18px 14px max(18px, env(safe-area-inset-bottom, 0px)); }
  .login-card { padding: 22px 18px 16px; }
  .login-brand { gap: 10px; }
  .login-title { font-size: 16px; }
  .login-sub { font-size: 10.5px; }
  .login-meta { gap: 6px; font-size: 11px; }
}

@media (max-width: 420px) {
  .stream-pill { width: auto; margin-left: auto; justify-content: flex-end; }
  .server-actions .btn { flex: 1 1 0; font-size: 11px; padding: 0 4px; }
  .server-actions .btn svg { width: 12px; height: 12px; }
  .terminal { height: calc(100dvh - 286px); }
  .file-actions .btn { padding: 0 5px; }
}

/* 桌面端隐藏移动端汉堡按钮（覆盖 .icon-btn 的 display） */
@media (min-width: 901px) {
  .topbar .hamburger { display: none; }
}

/* ==========================================================================
   11. 备份管理页（#/backup）
   ========================================================================== */
.backup-page { display: flex; flex-direction: column; gap: 10px; }
.backup-head {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: 12px;
  flex-wrap: wrap;
  padding: 2px 2px 0;
}
.backup-title { font-size: 17px; font-weight: 600; letter-spacing: 0.2px; }
.backup-sub { margin-top: 2px; font-size: 11.5px; color: var(--text-faint); }
.backup-head-status { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
.backup-head-pill {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  height: 24px;
  padding: 0 9px;
  border-radius: 999px;
  border: 1px solid var(--border);
  background: var(--bg-soft);
  font-size: 11px;
  color: var(--text-dim);
}
.backup-dot { width: 6px; height: 6px; border-radius: 50%; background: var(--accent); box-shadow: 0 0 0 2px rgba(63, 185, 143, 0.16); }
.backup-dot.is-run { animation: blink 1s steps(2, start) infinite; }
.backup-head-server { font-size: 11px; color: var(--text-faint); font-family: var(--mono); }
.backup-page .panel-title { display: inline-flex; align-items: center; gap: 6px; }
.backup-page .panel-title svg { color: var(--text-faint); }
.backup-config-state { display: inline-flex; align-items: center; gap: 5px; font-size: 11px; color: var(--text-dim); }
.backup-config-body { padding: 12px 14px 0; }
.backup-switch-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
  padding: 10px 12px;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  background: var(--bg-soft);
}
.backup-switch-info { min-width: 0; }
.backup-label { font-size: 12.5px; color: var(--text); font-weight: 500; }
.backup-hint { margin-top: 2px; font-size: 10.5px; color: var(--text-faint); line-height: 1.5; }
.backup-fields { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px 14px; margin-top: 12px; }
.backup-field { display: flex; flex-direction: column; gap: 5px; min-width: 0; }
.backup-field.is-full { grid-column: 1 / -1; }
.backup-field .input { height: 32px; font-size: 12px; }
.backup-field .input[readonly] { color: var(--text-dim); background: var(--bg-soft); }
.backup-config-meta {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 8px;
  padding: 12px 14px 0;
}
.backup-meta-item {
  display: flex;
  align-items: flex-start;
  gap: 8px;
  min-width: 0;
  padding: 8px 10px;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  background: var(--bg-soft);
}
.backup-meta-icon { color: var(--text-faint); margin-top: 1px; flex: none; }
.backup-meta-text { display: flex; flex-direction: column; gap: 2px; min-width: 0; }
.backup-meta-label { font-size: 10.5px; color: var(--text-faint); }
.backup-meta-value { font-size: 11.5px; font-family: var(--mono); color: var(--text-dim); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; max-width: 100%; }
.backup-meta-value.is-ok { color: var(--accent); }
.backup-meta-value.is-error { color: var(--danger); }
.backup-config-actions {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 10px;
  padding: 10px 14px 12px;
}
.backup-dirty { display: inline-flex; align-items: center; gap: 4px; font-size: 10.5px; color: var(--warn); margin-right: auto; }

.backup-list-head { flex-wrap: wrap; gap: 8px; }
.backup-list-tools { display: flex; align-items: center; gap: 6px; flex-wrap: wrap; }
.backup-server-tabs {
  display: flex;
  align-items: center;
  gap: 3px;
  padding: 7px 12px;
  border-bottom: 1px solid var(--border);
  background: var(--bg-soft);
  overflow-x: auto;
  scrollbar-width: none;
}
.backup-server-tabs::-webkit-scrollbar { display: none; }
.backup-server-tabs .server-tab { flex: 0 0 auto; }
.backup-tab-count { font-family: var(--mono); font-size: 10px; color: var(--text-faint); }
.backup-running {
  display: flex;
  align-items: center;
  gap: 9px;
  margin: 10px 12px 0;
  padding: 8px 10px;
  border: 1px solid rgba(63, 185, 143, 0.35);
  border-radius: var(--radius-sm);
  background: var(--accent-soft);
  font-size: 11.5px;
  color: var(--accent);
  flex-wrap: wrap;
}
.backup-running-dot { width: 7px; height: 7px; border-radius: 50%; background: var(--accent); animation: blink 1s steps(2, start) infinite; flex: none; }
.backup-running-text { flex: 1; min-width: 120px; }
.backup-progress { position: relative; width: 160px; max-width: 45%; height: 6px; border-radius: 999px; background: rgba(63, 185, 143, 0.16); overflow: hidden; }
.backup-progress-bar { display: block; height: 100%; width: 30%; border-radius: inherit; background: var(--accent); transition: width 0.4s var(--ease); }
.backup-progress-bar.is-indeterminate { animation: backup-slide 1.1s ease-in-out infinite; }
@keyframes backup-slide {
  0% { transform: translateX(-110%); }
  100% { transform: translateX(360%); }
}
.backup-list-body { padding: 0; }
.backup-table-wrap { width: 100%; overflow-x: auto; }
.backup-table { width: 100%; font-size: 12px; }
.backup-table thead th {
  padding: 8px 12px;
  text-align: left;
  font-size: 10.5px;
  font-weight: 500;
  letter-spacing: 0.6px;
  color: var(--text-faint);
  background: var(--bg-soft);
  border-bottom: 1px solid var(--border);
  font-family: var(--mono);
  white-space: nowrap;
}
.backup-table tbody tr { border-bottom: 1px solid var(--border); transition: background 0.1s; }
.backup-table tbody tr:last-child { border-bottom: 0; }
.backup-table tbody tr:hover { background: var(--panel-2); }
.backup-table tbody td { padding: 8px 12px; height: 48px; color: var(--text-dim); vertical-align: middle; }
.backup-table .col-actions { text-align: right; width: 168px; white-space: nowrap; }
.backup-created { display: flex; flex-direction: column; gap: 1px; }
.backup-time-main { color: var(--text); font-family: var(--mono); font-size: 11.5px; }
.backup-time-rel { color: var(--text-faint); font-size: 10.5px; }
.backup-mono { font-family: var(--mono); font-size: 11.5px; white-space: nowrap; }
.backup-type, .backup-consistency {
  display: inline-flex;
  align-items: center;
  height: 20px;
  padding: 0 7px;
  border-radius: 999px;
  font-size: 10.5px;
  border: 1px solid transparent;
  white-space: nowrap;
}
.backup-type.is-auto { color: var(--blue); background: var(--blue-soft); border-color: rgba(76, 154, 255, 0.28); }
.backup-type.is-manual { color: var(--accent); background: var(--accent-soft); border-color: rgba(63, 185, 143, 0.3); }
.backup-type.is-unknown { color: var(--text-faint); background: var(--panel-2); border-color: var(--border); }
.backup-consistency.is-ok { color: var(--accent); background: var(--accent-soft); border-color: rgba(63, 185, 143, 0.25); }
.backup-consistency.is-bad { color: var(--danger); background: var(--danger-soft); border-color: rgba(229, 83, 75, 0.3); }
.backup-actions { text-align: right; }
.backup-actions .btn { margin-left: 5px; }
.backup-row.is-bad td:first-child .backup-time-main { color: var(--warn); }
.backup-list-foot {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 8px 12px;
  border-top: 1px solid var(--border);
  background: var(--bg-soft);
  font-size: 10.5px;
  color: var(--text-faint);
  flex-wrap: wrap;
}
.backup-foot-result { display: inline-flex; align-items: center; gap: 5px; }
.backup-foot-result.is-ok { color: var(--accent); }
.backup-foot-result.is-error { color: var(--danger); }
.backup-foot-muted { color: var(--text-faint); }

/* 移动端卡片（桌面隐藏） */
.backup-cards { display: none; }

/* 空态 / loading / 错误 */
.backup-empty { display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 6px; padding: 44px 16px; text-align: center; }
.backup-empty-icon {
  width: 46px;
  height: 46px;
  display: grid;
  place-items: center;
  border-radius: 10px;
  background: var(--bg-soft);
  border: 1px solid var(--border);
  color: var(--text-faint);
  margin-bottom: 4px;
}
.backup-empty-title { font-size: 13px; font-weight: 600; color: var(--text-dim); }
.backup-empty-desc { font-size: 11.5px; color: var(--text-faint); max-width: 460px; line-height: 1.65; }
.backup-empty .btn { margin-top: 8px; }
.backup-skeleton { padding: 8px 12px; display: flex; flex-direction: column; gap: 12px; }
.backup-skeleton-row { display: flex; gap: 16px; align-items: center; padding: 8px 0; border-bottom: 1px solid var(--border); }
.backup-skeleton-row:last-child { border-bottom: 0; }
.backup-confirm-body p { margin: 0 0 6px; }
.backup-confirm-body p:last-child { margin-bottom: 0; }
.backup-confirm-body p.is-warn { color: var(--warn); }
.backup-confirm-body p.is-error { color: var(--danger); }
.backup-confirm-body p.is-ok { color: var(--accent); }

@media (max-width: 900px) {
  .backup-head { align-items: flex-start; }
  .backup-config-meta { grid-template-columns: minmax(0, 1fr); }
  .backup-list-head { align-items: center; }
  .backup-list-tools { flex: 1 1 auto; justify-content: flex-end; }
  .backup-page .panel-title { font-size: 12px; }
}
@media (max-width: 640px) {
  .backup-head { gap: 6px; }
  .backup-title { font-size: 15px; }
  .backup-sub { display: none; }
  .backup-head-status { width: 100%; justify-content: flex-start; }
  .backup-config-body { padding: 10px 10px 0; }
  .backup-switch-row { padding: 9px 10px; gap: 10px; }
  .backup-fields { grid-template-columns: minmax(0, 1fr); gap: 9px; }
  .backup-config-meta { padding: 10px 10px 0; gap: 6px; }
  .backup-meta-item { padding: 7px 9px; }
  .backup-config-actions { padding: 9px 10px 10px; }
  .backup-server-tabs { padding: 6px 8px; }
  .backup-list-head { padding: 8px 10px; }
  .backup-list-tools { width: 100%; justify-content: stretch; }
  .backup-list-tools .btn { flex: 1 1 0; }
  .backup-running { margin: 8px 8px 0; }
  .backup-progress { width: 100%; max-width: 100%; }
  .backup-table-wrap { display: none; }
  .backup-cards { display: flex; flex-direction: column; gap: 8px; padding: 10px 8px; }
  .backup-card {
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    background: var(--bg-soft);
    padding: 10px;
    display: flex;
    flex-direction: column;
    gap: 8px;
  }
  .backup-card.is-bad { border-color: rgba(229, 83, 75, 0.4); }
  .backup-card-head { display: flex; align-items: flex-start; justify-content: space-between; gap: 8px; flex-wrap: wrap; }
  .backup-card-time { display: flex; flex-direction: column; gap: 1px; min-width: 0; }
  .backup-card-time b { font-size: 12px; font-family: var(--mono); color: var(--text); font-weight: 500; }
  .backup-card-time span { font-size: 10.5px; color: var(--text-faint); }
  .backup-card-badges { display: flex; align-items: center; gap: 5px; flex-wrap: wrap; }
  .backup-card-meta { display: flex; align-items: center; gap: 12px; flex-wrap: wrap; font-size: 11px; color: var(--text-dim); font-family: var(--mono); }
  .backup-card-meta span { display: inline-flex; align-items: center; gap: 4px; }
  .backup-card-meta span.is-error { color: var(--danger); font-family: var(--ui); }
  .backup-card-actions { display: flex; gap: 6px; }
  .backup-card-actions .btn { flex: 1; height: 28px; }
  .backup-list-foot { padding: 7px 10px; gap: 4px; font-size: 10px; }
  .backup-empty { padding: 32px 14px; }
  .backup-skeleton { padding: 6px 10px; }
  .backup-confirm-body { font-size: 12px; }
}
@media (max-width: 420px) {
  .backup-list-tools .btn { padding: 0 6px; font-size: 11px; }
  .backup-card-actions .btn { font-size: 11px; padding: 0 6px; }
}

/* ==========================================================================
   12. v3.3 管理前端增强
   - 文件二次鉴权层 / 文件下载按钮
   - 关服·重启密钥确认弹窗
   - 备份磁盘低空间预警（minFreeGB / lowSpace）
   ========================================================================== */

/* ---- 文件二次鉴权 ---- */
.file-auth-layer {
  position: fixed;
  inset: 0;
  z-index: 120;
  display: grid;
  place-items: center;
  padding: 18px;
  background: rgba(4, 6, 9, 0.78);
  backdrop-filter: blur(3px);
  animation: fade-in 0.15s ease;
}
.file-auth-card {
  width: min(420px, 100%);
  background: var(--panel);
  border: 1px solid var(--border-strong);
  border-radius: 10px;
  box-shadow: 0 28px 80px rgba(0, 0, 0, 0.6);
  padding: 24px 22px 18px;
  animation: modal-in 0.16s var(--ease);
}
.file-auth-icon {
  width: 44px;
  height: 44px;
  display: grid;
  place-items: center;
  border-radius: 10px;
  background: var(--accent-soft);
  border: 1px solid rgba(63, 185, 143, 0.35);
  color: var(--accent);
  margin-bottom: 12px;
}
.file-auth-title { font-size: 16px; font-weight: 600; }
.file-auth-desc { margin-top: 5px; font-size: 12px; line-height: 1.65; color: var(--text-dim); }
.file-auth-form { display: flex; flex-direction: column; gap: 7px; margin-top: 16px; }
.file-auth-label { font-size: 12px; color: var(--text-dim); }
.file-auth-form .input { height: 38px; }
.file-auth-error { min-height: 0; font-size: 12px; color: var(--danger); }
.file-auth-error:empty { display: none; }
.file-auth-error.is-shake { animation: shake 0.38s ease; }
.file-auth-actions { display: flex; justify-content: flex-end; gap: 8px; margin-top: 8px; flex-wrap: wrap; }
.file-auth-actions .btn { height: 34px; }
.file-auth-actions .btn-ghost { margin-right: auto; }
.file-auth-foot { margin-top: 12px; padding-top: 10px; border-top: 1px solid var(--border); font-size: 10.5px; color: var(--text-faint); line-height: 1.6; }

/* ---- 关服/重启密钥确认 ---- */
.action-confirm-body { display: flex; flex-direction: column; gap: 8px; }
.action-confirm-body p { margin: 0; line-height: 1.7; }
.action-key-label { margin-top: 4px; font-size: 12px; color: var(--text); font-weight: 500; }
.action-confirm-body .input { height: 36px; }
.action-key-hint { font-size: 10.5px; color: var(--text-faint); }
.action-key-error { min-height: 0; font-size: 12px; color: var(--danger); }
.action-key-error:empty { display: none; }
.action-key-error.is-shake { animation: shake 0.38s ease; }

/* ---- 文件下载：操作列容纳 3 个按钮 ---- */
@media (max-width: 640px) {
  .files-table thead th.col-actions,
  .files-table tbody td.file-actions { width: 132px; }
  .file-actions .btn { margin-left: 2px; padding: 0 5px; font-size: 10.5px; }
  .editor-actions { gap: 5px; }
  .editor-actions .btn { padding: 0 8px; font-size: 11px; }
}

/* ---- 备份低空间预警 ---- */
.backup-lowspace {
  display: flex;
  align-items: flex-start;
  gap: 9px;
  margin: 10px 14px 0;
  padding: 10px 12px;
  border: 1px solid rgba(229, 83, 75, 0.45);
  border-radius: var(--radius-sm);
  background: var(--danger-soft);
  color: #F2A39D;
}
.backup-lowspace-icon { color: var(--danger); margin-top: 1px; flex: none; }
.backup-lowspace-text { display: flex; flex-direction: column; gap: 2px; min-width: 0; }
.backup-lowspace-text b { font-size: 12px; color: #F5B4AE; font-weight: 600; }
.backup-lowspace-text span { font-size: 11px; line-height: 1.55; color: #E3A49D; }
.backup-config-meta { grid-template-columns: repeat(4, minmax(0, 1fr)); }
@media (max-width: 1200px) {
  .backup-config-meta { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}
@media (max-width: 900px) {
  .backup-config-meta { grid-template-columns: minmax(0, 1fr); }
  .backup-lowspace { margin: 9px 10px 0; }
}




