/* =========================================================
   Nimbus Panel — 轻量简约的虚拟主机总管理面板
   纯静态 CSS，无构建、无依赖
   ========================================================= */

:root {
  --accent: #3b82f6;
  --accent-soft: rgba(59, 130, 246, .10);
  --accent-line: rgba(59, 130, 246, .28);
  --ok: #10b981;
  --warn: #f59e0b;
  --danger: #f43f5e;

  --bg: #f6f7f9;
  --surface: #ffffff;
  --surface-2: #fbfcfd;
  --line: #e7e9ee;
  --line-soft: #f0f2f5;
  --text: #14171e;
  --text-2: #5b6472;
  --text-3: #949cab;

  --radius: 16px;
  --radius-sm: 10px;
  --shadow: 0 1px 2px rgba(20, 23, 30, .04), 0 8px 24px -12px rgba(20, 23, 30, .12);
  --shadow-lg: 0 2px 6px rgba(20, 23, 30, .05), 0 18px 44px -18px rgba(20, 23, 30, .22);

  --sans: "Outfit", "PingFang SC", "Hiragino Sans GB", "Microsoft YaHei", "Noto Sans SC", sans-serif;
  --mono: "JetBrains Mono", ui-monospace, "SFMono-Regular", Menlo, Consolas, monospace;

  --sb-w: 244px;
  --ease: cubic-bezier(.4, 0, .2, 1);
}

[data-theme="dark"] {
  --accent: #60a5fa;
  --accent-soft: rgba(96, 165, 250, .14);
  --accent-line: rgba(96, 165, 250, .32);
  --ok: #34d399;
  --warn: #fbbf24;
  --danger: #fb7185;

  --bg: #0e1117;
  --surface: #161b23;
  --surface-2: #1b212b;
  --line: #262d38;
  --line-soft: #1f252f;
  --text: #e8ecf3;
  --text-2: #9aa4b2;
  --text-3: #6b7684;

  --shadow: 0 1px 2px rgba(0, 0, 0, .3), 0 8px 24px -12px rgba(0, 0, 0, .6);
  --shadow-lg: 0 2px 6px rgba(0, 0, 0, .35), 0 18px 44px -18px rgba(0, 0, 0, .7);
}

* { box-sizing: border-box; }

html, body {
  margin: 0; padding: 0;
  background: var(--bg);
  color: var(--text);
  font-family: var(--sans);
  font-size: 14px;
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}

h1, h2, h3, h4 { margin: 0; font-weight: 600; letter-spacing: -.01em; }
p { margin: 0; }
a { color: inherit; text-decoration: none; }
button { font-family: inherit; font-size: inherit; color: inherit; }
input, select, textarea { font-family: inherit; font-size: inherit; }

::selection { background: var(--accent-soft); }

/* scrollbar */
* { scrollbar-width: thin; scrollbar-color: var(--line) transparent; }
*::-webkit-scrollbar { width: 8px; height: 8px; }
*::-webkit-scrollbar-thumb { background: var(--line); border-radius: 8px; }
*::-webkit-scrollbar-track { background: transparent; }

/* ---------------- Layout ---------------- */
.app { display: flex; min-height: 100dvh; }
.app[hidden] { display: none; }

.sidebar {
  width: var(--sb-w);
  flex: 0 0 var(--sb-w);
  background: var(--surface);
  border-right: 1px solid var(--line);
  display: flex; flex-direction: column;
  position: sticky; top: 0;
  height: 100dvh;
  z-index: 40;
}

.brand {
  display: flex; align-items: center; gap: 11px;
  padding: 18px 18px 16px;
}
.brand-mark { display: flex; }
.brand-text { display: flex; flex-direction: column; line-height: 1.25; min-width: 0; }
.brand-text strong { font-size: 15.5px; font-weight: 600; letter-spacing: -.02em; }
.brand-text span {
  font-size: 11.5px; color: var(--text-3);
  font-family: var(--mono);
  overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}

.nav { flex: 1; overflow-y: auto; padding: 4px 12px 12px; }
.nav-label {
  font-size: 10.5px; font-weight: 600; letter-spacing: .09em;
  text-transform: uppercase; color: var(--text-3);
  padding: 16px 10px 7px;
}
.nav-item {
  display: flex; align-items: center; gap: 10px;
  padding: 8.5px 10px; margin-bottom: 2px;
  border-radius: var(--radius-sm);
  color: var(--text-2);
  font-size: 13.5px; font-weight: 500;
  transition: background .16s var(--ease), color .16s var(--ease);
  position: relative;
}
.nav-item:hover { background: var(--line-soft); color: var(--text); }
.nav-item.active { background: var(--accent-soft); color: var(--accent); font-weight: 600; }
.nav-item.active::before {
  content: ""; position: absolute; left: -12px; top: 50%; transform: translateY(-50%);
  width: 3px; height: 18px; border-radius: 0 3px 3px 0; background: var(--accent);
}
.nav-ico { display: flex; width: 17px; height: 17px; flex: 0 0 17px; color: currentColor; }
.nav-ico svg { width: 17px; height: 17px; stroke-width: 1.9; }
.nav-badge {
  margin-left: auto; font-style: normal; font-size: 11px; font-weight: 600;
  font-family: var(--mono);
  background: var(--line-soft); color: var(--text-3);
  padding: 1px 6px; border-radius: 20px; min-width: 20px; text-align: center;
}
.nav-item.active .nav-badge { background: var(--accent); color: #fff; }

.sidebar-foot { padding: 12px; border-top: 1px solid var(--line); }
.health {
  display: flex; align-items: center; gap: 10px;
  padding: 10px 11px; border-radius: var(--radius-sm);
  background: var(--surface-2); border: 1px solid var(--line);
}
.dot {
  width: 8px; height: 8px; border-radius: 50%; flex: 0 0 8px;
  background: var(--text-3); position: relative;
}
.dot::after {
  content: ""; position: absolute; inset: -3px; border-radius: 50%;
  border: 1.5px solid currentColor; opacity: .35;
  animation: pulse 2.2s ease-out infinite;
}
.dot.ok { background: var(--ok); color: var(--ok); }
.dot.warn { background: var(--warn); color: var(--warn); }
.dot.danger { background: var(--danger); color: var(--danger); }
@keyframes pulse {
  0% { transform: scale(.7); opacity: .6; }
  70% { transform: scale(1.5); opacity: 0; }
  100% { opacity: 0; }
}
.health-text { display: flex; flex-direction: column; line-height: 1.3; min-width: 0; }
.health-text strong { font-size: 12.5px; font-weight: 600; }
.health-text span { font-size: 11px; color: var(--text-3); font-family: var(--mono); }

.main { flex: 1; min-width: 0; display: flex; flex-direction: column; }

.topbar {
  position: sticky; top: 0; z-index: 30;
  display: flex; align-items: center; gap: 14px;
  padding: 13px 26px;
  background: color-mix(in srgb, var(--bg) 88%, transparent);
  backdrop-filter: saturate(1.6) blur(12px);
  border-bottom: 1px solid var(--line);
}
.page-head { min-width: 0; }
.page-head h1 { font-size: 18px; line-height: 1.3; }
.page-head p { font-size: 12.5px; color: var(--text-3); margin-top: 1px; }

.topbar-actions { margin-left: auto; display: flex; align-items: center; gap: 8px; }

.search {
  display: flex; align-items: center; gap: 7px;
  background: var(--surface); border: 1px solid var(--line);
  border-radius: 10px; padding: 0 10px; height: 34px;
  width: 224px; transition: border-color .16s var(--ease), box-shadow .16s var(--ease);
}
.search:focus-within { border-color: var(--accent-line); box-shadow: 0 0 0 3px var(--accent-soft); }
.search > span { display: flex; color: var(--text-3); }
.search > span svg { width: 15px; height: 15px; stroke-width: 2; }
.search input {
  border: 0; outline: 0; background: none; width: 100%; color: var(--text);
  font-size: 13px;
}
.search input::placeholder { color: var(--text-3); }

.icon-btn {
  width: 34px; height: 34px; flex: 0 0 34px;
  display: inline-flex; align-items: center; justify-content: center;
  border-radius: 10px; border: 1px solid var(--line);
  background: var(--surface); color: var(--text-2); cursor: pointer;
  transition: all .16s var(--ease);
}
.icon-btn:hover { color: var(--accent); border-color: var(--accent-line); background: var(--accent-soft); }
.icon-btn svg { width: 16px; height: 16px; stroke-width: 2; }
.icon-btn.spin svg { animation: spin .7s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }

.avatar {
  width: 34px; height: 34px; flex: 0 0 34px; border-radius: 50%;
  display: flex; align-items: center; justify-content: center;
  background: linear-gradient(145deg, var(--accent), #60a5fa);
  color: #fff; font-weight: 600; font-size: 13px;
}

.view { padding: 22px 26px 60px; outline: none; }

.only-mobile { display: none; }

/* ---------------- Cards ---------------- */
.card {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
}
.card-head {
  display: flex; align-items: center; gap: 10px;
  padding: 15px 18px; border-bottom: 1px solid var(--line-soft);
}
.card-head h3 { font-size: 14px; font-weight: 600; }
.card-head .sub { font-size: 12px; color: var(--text-3); }
.card-head .spacer { margin-left: auto; }
.card-ico {
  width: 28px; height: 28px; flex: 0 0 28px; border-radius: 8px;
  display: flex; align-items: center; justify-content: center;
  background: var(--accent-soft); color: var(--accent);
}
.card-ico svg { width: 15px; height: 15px; stroke-width: 2; }
.card-body { padding: 16px 18px; }
.card-body.tight { padding: 6px 8px; }

.grid { display: grid; gap: 14px; align-items: start; }
.g-4 { grid-template-columns: repeat(4, minmax(0, 1fr)); }
.g-3 { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.g-2 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.g-2-1 { grid-template-columns: minmax(0, 2fr) minmax(0, 1fr); }
.g-1-2 { grid-template-columns: minmax(0, 1fr) minmax(0, 2fr); }
.stack { display: flex; flex-direction: column; gap: 14px; }
.row { display: flex; align-items: center; gap: 10px; }
.mt { margin-top: 14px; }

/* ---------------- Stat cards ---------------- */
.stat {
  background: var(--surface); border: 1px solid var(--line);
  border-radius: var(--radius); padding: 15px 16px 13px;
  box-shadow: var(--shadow);
  position: relative; overflow: hidden;
  transition: transform .2s var(--ease), box-shadow .2s var(--ease);
}
.stat:hover { transform: translateY(-2px); box-shadow: var(--shadow-lg); }
.stat-top { display: flex; align-items: center; gap: 8px; }
.stat-top .lbl { font-size: 12px; color: var(--text-2); font-weight: 500; }
.stat-ico { margin-left: auto; color: var(--text-3); display: flex; }
.stat-ico svg { width: 16px; height: 16px; stroke-width: 1.9; }
.stat-val {
  font-size: 26px; font-weight: 600; letter-spacing: -.02em;
  line-height: 1.25; margin-top: 6px;
  font-variant-numeric: tabular-nums;
}
.stat-val small { font-size: 14px; font-weight: 500; color: var(--text-3); margin-left: 2px; }
.stat-foot {
  display: flex; align-items: center; gap: 6px;
  margin-top: 5px; font-size: 11.5px; color: var(--text-3);
}
.trend { display: inline-flex; align-items: center; gap: 3px; font-weight: 600; }
.trend.up, .trend.good { color: var(--ok); }
.trend.down, .trend.bad { color: var(--danger); }
.trend.flat { color: var(--text-3); }
.trend svg { width: 12px; height: 12px; stroke-width: 2.4; }
.stat-spark { margin-top: 10px; height: 34px; }

/* ---------------- Meters ---------------- */
.meter { margin-bottom: 15px; }
.meter:last-child { margin-bottom: 0; }
.meter-top {
  display: flex; align-items: baseline; gap: 8px; margin-bottom: 6px;
}
.meter-top .lbl { font-size: 12.5px; color: var(--text-2); }
.meter-top .val {
  margin-left: auto; font-size: 12.5px; font-weight: 600;
  font-family: var(--mono); font-variant-numeric: tabular-nums;
}
.meter-bg {
  height: 7px; border-radius: 6px; background: var(--line-soft); overflow: hidden;
}
.meter-fill {
  height: 100%; border-radius: 6px;
  background: linear-gradient(90deg, var(--accent), #60a5fa);
  transition: width .6s var(--ease);
}
.meter-fill.ok { background: linear-gradient(90deg, #10b981, #34d399); }
.meter-fill.warn { background: linear-gradient(90deg, #f59e0b, #fbbf24); }
.meter-fill.danger { background: linear-gradient(90deg, #f43f5e, #fb7185); }

/* ---------------- Donut ---------------- */
.donut-wrap { display: flex; align-items: center; gap: 18px; }
.donut { position: relative; flex: 0 0 auto; }
.donut svg { transform: rotate(-90deg); display: block; }
.donut circle { fill: none; stroke-linecap: round; }
.donut .track { stroke: var(--line-soft); }
.donut-center {
  position: absolute; inset: 0; display: flex; flex-direction: column;
  align-items: center; justify-content: center; line-height: 1.2;
}
.donut-center b { font-size: 19px; font-weight: 600; font-variant-numeric: tabular-nums; }
.donut-center span { font-size: 10.5px; color: var(--text-3); }
.legend { display: flex; flex-direction: column; gap: 7px; flex: 1; min-width: 0; }
.legend-row { display: flex; align-items: center; gap: 8px; font-size: 12.5px; }
.legend-row i {
  width: 8px; height: 8px; border-radius: 2.5px; flex: 0 0 8px; background: var(--accent);
}
.legend-row .nm { color: var(--text-2); }
.legend-row .vl {
  margin-left: auto; font-family: var(--mono); font-size: 12px;
  font-variant-numeric: tabular-nums; color: var(--text);
}

/* ---------------- Table ---------------- */
.table-wrap { overflow-x: auto; }
table.tbl { width: 100%; border-collapse: collapse; font-size: 13px; }
.tbl th {
  text-align: left; font-size: 11px; font-weight: 600; letter-spacing: .06em;
  text-transform: uppercase; color: var(--text-3);
  padding: 10px 14px; border-bottom: 1px solid var(--line);
  white-space: nowrap; background: var(--surface-2);
}
.tbl td {
  padding: 11px 14px; border-bottom: 1px solid var(--line-soft);
  vertical-align: middle;
}
.tbl tbody tr { transition: background .14s var(--ease); }
.tbl tbody tr:hover { background: var(--surface-2); }
.tbl tbody tr:last-child td { border-bottom: 0; }
.tbl .mono { font-family: var(--mono); font-size: 12.5px; }
.tbl .num { text-align: right; font-family: var(--mono); font-variant-numeric: tabular-nums; }
.tbl .actions { text-align: right; white-space: nowrap; }

.chip {
  display: inline-flex; align-items: center; gap: 5px;
  padding: 2.5px 9px; border-radius: 20px;
  font-size: 11.5px; font-weight: 500;
  background: var(--line-soft); color: var(--text-2);
  white-space: nowrap;
}
.chip .cd { width: 5px; height: 5px; border-radius: 50%; background: currentColor; }
.chip.ok { background: rgba(16, 185, 129, .12); color: var(--ok); }
.chip.warn { background: rgba(245, 158, 11, .13); color: var(--warn); }
.chip.danger { background: rgba(244, 63, 94, .12); color: var(--danger); }
.chip.info { background: var(--accent-soft); color: var(--accent); }

.btn {
  display: inline-flex; align-items: center; gap: 6px;
  height: 32px; padding: 0 13px; border-radius: 9px;
  border: 1px solid var(--line); background: var(--surface);
  color: var(--text-2); font-size: 12.5px; font-weight: 500;
  cursor: pointer; transition: all .16s var(--ease);
}
.btn:hover { color: var(--text); border-color: var(--accent-line); background: var(--accent-soft); }
.btn svg { width: 14px; height: 14px; stroke-width: 2; }
.btn.primary {
  background: var(--accent); border-color: var(--accent); color: #fff;
  box-shadow: 0 2px 8px -2px color-mix(in srgb, var(--accent) 55%, transparent);
}
.btn.primary:hover { filter: brightness(1.07); color: #fff; }
.btn.ghost { background: none; border-color: transparent; }
.btn.sm { height: 27px; padding: 0 10px; font-size: 12px; }
.btn.danger:hover { color: var(--danger); border-color: color-mix(in srgb, var(--danger) 35%, transparent); background: rgba(244, 63, 94, .08); }

/* ---------------- List rows ---------------- */
.list { display: flex; flex-direction: column; }
.list-item {
  display: flex; align-items: center; gap: 12px;
  padding: 11px 18px; border-bottom: 1px solid var(--line-soft);
  transition: background .14s var(--ease);
}
.list-item:last-child { border-bottom: 0; }
.list-item:hover { background: var(--surface-2); }
.list-ico {
  width: 32px; height: 32px; flex: 0 0 32px; border-radius: 9px;
  display: flex; align-items: center; justify-content: center;
  background: var(--accent-soft); color: var(--accent);
}
.list-ico svg { width: 16px; height: 16px; stroke-width: 2; }
.list-main { min-width: 0; flex: 1; }
.list-main .t { font-size: 13.5px; font-weight: 500; }
.list-main .s {
  font-size: 12px; color: var(--text-3); font-family: var(--mono);
  overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}
.list-side { margin-left: auto; text-align: right; flex: 0 0 auto; }
.list-side .t { font-size: 12.5px; font-weight: 500; }
.list-side .s { font-size: 11.5px; color: var(--text-3); font-family: var(--mono); }

/* ---------------- Timeline ---------------- */
.timeline { position: relative; padding-left: 22px; }
.timeline::before {
  content: ""; position: absolute; left: 5px; top: 6px; bottom: 6px;
  width: 1.5px; background: var(--line);
}
.tl-item { position: relative; padding-bottom: 16px; }
.tl-item:last-child { padding-bottom: 0; }
.tl-item::before {
  content: ""; position: absolute; left: -21px; top: 5px;
  width: 9px; height: 9px; border-radius: 50%;
  background: var(--surface); border: 2px solid var(--line);
}
.tl-item.ok::before { border-color: var(--ok); }
.tl-item.warn::before { border-color: var(--warn); }
.tl-item.danger::before { border-color: var(--danger); }
.tl-item .t { font-size: 13px; font-weight: 500; }
.tl-item .s { font-size: 12px; color: var(--text-3); }

/* ---------------- Empty / misc ---------------- */
.empty {
  display: flex; flex-direction: column; align-items: center; gap: 8px;
  padding: 44px 20px; color: var(--text-3); text-align: center;
}
.empty svg { width: 34px; height: 34px; stroke-width: 1.5; opacity: .6; }
.empty .t { font-size: 13.5px; color: var(--text-2); font-weight: 500; }
.empty .s { font-size: 12px; }

.kv { display: grid; grid-template-columns: 104px 1fr; gap: 0; }
.kv > dt {
  font-size: 12.5px; color: var(--text-3);
  padding: 9px 0; border-bottom: 1px dashed var(--line);
}
.kv > dd {
  margin: 0; font-size: 13px; padding: 9px 0;
  border-bottom: 1px dashed var(--line);
  font-family: var(--mono); word-break: break-all;
}
.kv > dt:last-of-type, .kv > dd:last-of-type { border-bottom: 0; }

.code {
  font-family: var(--mono); font-size: 12.5px;
  background: var(--surface-2); border: 1px solid var(--line);
  border-radius: var(--radius-sm); padding: 12px 14px;
  overflow-x: auto; white-space: pre; color: var(--text-2);
  line-height: 1.7;
}

.notice {
  display: flex; gap: 11px; align-items: flex-start;
  padding: 12px 14px; border-radius: var(--radius-sm);
  background: var(--accent-soft); border: 1px solid var(--accent-line);
  color: var(--text-2); font-size: 12.5px; line-height: 1.6;
}
.notice svg { width: 16px; height: 16px; flex: 0 0 16px; color: var(--accent); margin-top: 1px; }
.notice.warn { background: rgba(245, 158, 11, .10); border-color: rgba(245, 158, 11, .3); }
.notice.warn svg { color: var(--warn); }

/* ---------------- Toast ---------------- */
.toast-wrap {
  position: fixed; right: 20px; bottom: 20px; z-index: 220;
  display: flex; flex-direction: column; gap: 8px; align-items: flex-end;
}
.toast {
  display: flex; align-items: center; gap: 9px;
  background: var(--surface); border: 1px solid var(--line);
  border-radius: 11px; padding: 10px 14px;
  box-shadow: var(--shadow-lg); font-size: 13px;
  animation: toastIn .26s var(--ease);
  max-width: 320px;
}
.toast svg { width: 15px; height: 15px; color: var(--ok); flex: 0 0 15px; }
.toast.err svg { color: var(--danger); }
.toast.out { animation: toastOut .22s var(--ease) forwards; }
@keyframes toastIn { from { opacity: 0; transform: translateY(8px) scale(.97); } }
@keyframes toastOut { to { opacity: 0; transform: translateY(6px) scale(.97); } }

/* ---------------- Drawer / modal ---------------- */
.mask {
  position: fixed; inset: 0; z-index: 210;
  background: rgba(14, 17, 23, .45); backdrop-filter: blur(3px);
  opacity: 0; pointer-events: none; transition: opacity .2s var(--ease);
}
.mask.open { opacity: 1; pointer-events: auto; }
.drawer {
  position: fixed; top: 0; right: 0; bottom: 0; z-index: 211;
  width: min(460px, 100%);
  background: var(--surface); border-left: 1px solid var(--line);
  transform: translateX(100%); transition: transform .26s var(--ease);
  display: flex; flex-direction: column;
  box-shadow: var(--shadow-lg);
}
.drawer.open { transform: none; }
.drawer-head {
  display: flex; align-items: center; gap: 10px;
  padding: 16px 20px; border-bottom: 1px solid var(--line);
}
.drawer-head h3 { font-size: 15px; }
.drawer-body { flex: 1; overflow-y: auto; padding: 18px 20px; }
.drawer-foot {
  display: flex; gap: 9px; justify-content: flex-end;
  padding: 14px 20px; border-top: 1px solid var(--line);
}

.form { display: flex; flex-direction: column; gap: 14px; }
.field { display: flex; flex-direction: column; gap: 5px; }
.field[hidden] { display: none; }
.field label { font-size: 12.5px; color: var(--text-2); font-weight: 500; }
.field input, .field select, .field textarea {
  height: 36px; padding: 0 11px; border-radius: 9px;
  border: 1px solid var(--line); background: var(--surface-2);
  color: var(--text); outline: 0; font-size: 13px;
  transition: border-color .16s var(--ease), box-shadow .16s var(--ease);
}
.field textarea { height: auto; padding: 9px 11px; resize: vertical; min-height: 76px; font-family: var(--mono); }
.field input:focus, .field select:focus, .field textarea:focus {
  border-color: var(--accent-line); box-shadow: 0 0 0 3px var(--accent-soft);
}

/* toggle */
.switch { display: flex; align-items: center; gap: 9px; cursor: pointer; }
.switch input { display: none; }
.switch .track {
  width: 36px; height: 20px; border-radius: 20px; background: var(--line);
  position: relative; transition: background .2s var(--ease); flex: 0 0 36px;
}
.switch .track::after {
  content: ""; position: absolute; top: 2px; left: 2px;
  width: 16px; height: 16px; border-radius: 50%; background: #fff;
  transition: transform .2s var(--ease);
  box-shadow: 0 1px 3px rgba(0,0,0,.2);
}
.switch input:checked + .track { background: var(--accent); }
.switch input:checked + .track::after { transform: translateX(16px); }

/* ---------------- Mobile ---------------- */
.sidebar-scrim {
  position: fixed; inset: 0; z-index: 39;
  background: rgba(14, 17, 23, .4);
  opacity: 0; pointer-events: none; transition: opacity .2s var(--ease);
}
.sidebar-scrim.open { opacity: 1; pointer-events: auto; }

@media (max-width: 1180px) {
  .g-4 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .g-2-1, .g-1-2 { grid-template-columns: minmax(0, 1fr); }
}
@media (max-width: 860px) {
  .only-mobile { display: inline-flex; }
  .sidebar {
    position: fixed; left: 0; top: 0;
    transform: translateX(-100%); transition: transform .26s var(--ease);
  }
  .sidebar.open { transform: none; }
  .g-3, .g-2 { grid-template-columns: minmax(0, 1fr); }
  .view { padding: 16px 15px 60px; }
  .topbar { padding: 11px 15px; }
  .search { width: 40px; padding: 0 11px; }
  .search input { display: none; }
  .search:focus-within { width: 180px; }
  .search:focus-within input { display: block; }
  .page-head p { display: none; }
}
@media (max-width: 560px) {
  .g-4 { grid-template-columns: minmax(0, 1fr); }
  .stat-val { font-size: 22px; }
  .toast-wrap { left: 14px; right: 14px; align-items: stretch; }
  .toast { max-width: none; }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    animation-duration: .01ms !important;
    transition-duration: .01ms !important;
  }
}

/* =========================================================
   登录门禁
   ========================================================= */
.gate {
  position: fixed; inset: 0; z-index: 200;
  display: flex; align-items: center; justify-content: center;
  padding: 24px;
  background: var(--bg);
  background-image:
    radial-gradient(circle at 20% 20%, var(--accent-soft), transparent 42%),
    radial-gradient(circle at 82% 78%, var(--accent-soft), transparent 46%);
}
.gate[hidden] { display: none; }
.gate-card {
  width: 100%; max-width: 380px;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 20px;
  box-shadow: var(--shadow-lg);
  padding: 30px 28px 22px;
  animation: gateIn .32s var(--ease);
}
@keyframes gateIn {
  from { opacity: 0; transform: translateY(10px) scale(.98); }
  to { opacity: 1; transform: none; }
}
.gate-brand { display: flex; align-items: center; gap: 11px; margin-bottom: 24px; }
.gate-brand > div { display: flex; flex-direction: column; line-height: 1.25; }
.gate-brand strong { font-size: 16px; font-weight: 600; letter-spacing: -.02em; }
.gate-brand span { font-size: 12px; color: var(--text-3); }
.gate-title { font-size: 20px; margin-bottom: 4px; }
.gate-desc { font-size: 13px; color: var(--text-3); margin-bottom: 20px; }
.gate-form { display: flex; flex-direction: column; gap: 14px; }
.gate-btn { width: 100%; height: 40px; justify-content: center; font-size: 13.5px; margin-top: 2px; }
.gate-err {
  background: rgba(244, 63, 94, .10);
  border: 1px solid rgba(244, 63, 94, .28);
  color: var(--danger);
  border-radius: var(--radius-sm);
  padding: 9px 12px; font-size: 12.5px; line-height: 1.5;
}
.gate-err[hidden] { display: none; }
.gate-foot {
  margin-top: 18px; padding-top: 14px;
  border-top: 1px solid var(--line-soft);
  font-size: 11.5px; color: var(--text-3); text-align: center;
}
.gate-foot[hidden] { display: none; }

/* =========================================================
   站点管理
   ========================================================= */
.site-grid { display: grid; gap: 14px; grid-template-columns: repeat(auto-fill, minmax(300px, 1fr)); }
.site-card {
  background: var(--surface); border: 1px solid var(--line);
  border-radius: var(--radius); padding: 16px 17px;
  box-shadow: var(--shadow);
  transition: transform .2s var(--ease), box-shadow .2s var(--ease);
  position: relative; overflow: hidden;
}
.site-card:hover { transform: translateY(-2px); box-shadow: var(--shadow-lg); }
.site-card.disabled { opacity: .74; }
.site-card.disabled::after {
  content: ""; position: absolute; left: 0; right: 0; top: 0;
  height: 3px; background: var(--danger);
}
.site-card-top { display: flex; align-items: flex-start; gap: 10px; margin-bottom: 12px; }
.site-card-ico {
  width: 36px; height: 36px; flex: 0 0 36px; border-radius: 10px;
  display: flex; align-items: center; justify-content: center;
  background: var(--accent-soft); color: var(--accent);
}
.site-card-ico svg { width: 18px; height: 18px; stroke-width: 2; }
.site-card-title { min-width: 0; flex: 1; }
.site-card-title .n {
  font-size: 14.5px; font-weight: 600;
  overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}
.site-card-title .p {
  font-size: 11.5px; color: var(--text-3); font-family: var(--mono);
  overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}
.site-card-tags { display: flex; flex-wrap: wrap; gap: 6px; margin-bottom: 13px; }
.site-card-meta {
  display: flex; gap: 14px; font-size: 12px; color: var(--text-3);
  padding-bottom: 13px; margin-bottom: 13px; border-bottom: 1px solid var(--line-soft);
}
.site-card-meta span { display: inline-flex; align-items: center; gap: 4px; }
.site-card-meta svg { width: 13px; height: 13px; stroke-width: 2; }
.site-card-actions { display: flex; gap: 7px; }
.site-card-actions .btn { flex: 1; justify-content: center; }

/* 开关按钮 */
.toggle {
  position: relative; width: 38px; height: 22px; flex: 0 0 38px;
  border-radius: 22px; background: var(--line); cursor: pointer;
  transition: background .2s var(--ease); border: 0; padding: 0;
}
.toggle::after {
  content: ""; position: absolute; top: 2px; left: 2px;
  width: 18px; height: 18px; border-radius: 50%; background: #fff;
  box-shadow: 0 1px 3px rgba(0,0,0,.25);
  transition: transform .2s var(--ease);
}
.toggle.on { background: var(--ok); }
.toggle.on::after { transform: translateX(16px); }
