/* ==========================================================================
   WebVPS — 暖色纸面 + 衬线标题 + 细线分隔
   ========================================================================== */

:root {
  --bg: #FAF9F5;
  --bg-2: #F2F0E8;
  --surface: #FFFFFF;
  --surface-2: #F7F6F1;
  --hover: rgba(20, 20, 19, 0.045);
  --press: rgba(20, 20, 19, 0.08);
  --line: #E7E4DA;
  --line-2: #D9D5C9;
  --text: #141413;
  --text-2: #3D3D3A;
  --muted: #6E6D68;
  --faint: #9D9B93;

  --accent: #D97757;
  --accent-2: #C2603F;
  --accent-soft: #F6E4DB;

  --ok: #5B7A47;
  --ok-soft: #E3EADA;
  --warn: #A97A2C;
  --warn-soft: #F3E8D1;
  --bad: #B0473C;
  --bad-soft: #F5DFDA;
  --info: #5A7590;
  --info-soft: #E2E8EE;

  --ink: #141413;
  --on-ink: #FAF9F5;
  --ink-hover: #2B2A28;

  --term-bg: #1F1E1D;
  --term-fg: #E8E6DC;

  --serif: "Source Serif 4 Variable", "Noto Serif SC", "Source Han Serif SC", "Songti SC", "STSong", Georgia, serif;
  --sans: "Hanken Grotesk Variable", -apple-system, BlinkMacSystemFont, "PingFang SC", "Hiragino Sans GB", "Microsoft YaHei", "Noto Sans SC", sans-serif;
  --mono: "JetBrains Mono Variable", ui-monospace, "SF Mono", Menlo, Consolas, "Noto Sans Mono CJK SC", monospace;

  --r-lg: 14px;
  --r: 10px;
  --r-sm: 7px;
  --shadow-pop: 0 1px 2px rgba(20, 20, 19, .05), 0 12px 32px -8px rgba(20, 20, 19, .16);
  --sidebar-w: 256px;
  --ease: cubic-bezier(.2, .7, .2, 1);
  color-scheme: light;
}

:root[data-theme="dark"] {
  --bg: #1F1E1D;
  --bg-2: #1A1918;
  --surface: #262624;
  --surface-2: #2C2B29;
  --hover: rgba(250, 249, 245, 0.05);
  --press: rgba(250, 249, 245, 0.09);
  --line: #34332F;
  --line-2: #45433E;
  --text: #F2F0E8;
  --text-2: #D6D3C9;
  --muted: #A3A097;
  --faint: #7A776F;

  --accent: #E08664;
  --accent-2: #EA9A7A;
  --accent-soft: #3A2A23;

  --ok: #93B07C;
  --ok-soft: #2A3224;
  --warn: #D6A859;
  --warn-soft: #3A3020;
  --bad: #E07B6E;
  --bad-soft: #3E2522;
  --info: #93AFC9;
  --info-soft: #243039;

  --ink: #F2F0E8;
  --on-ink: #1F1E1D;
  --ink-hover: #FFFFFF;

  --term-bg: #181716;
  --shadow-pop: 0 1px 2px rgba(0, 0, 0, .3), 0 16px 40px -8px rgba(0, 0, 0, .5);
  color-scheme: dark;
}

*, *::before, *::after { box-sizing: border-box; }
html, body { height: 100%; }
body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font-family: var(--sans);
  font-size: 14px;
  line-height: 1.55;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  text-rendering: optimizeLegibility;
}
#app { min-height: 100%; }

h1, h2, h3, h4 { margin: 0; font-weight: 450; color: var(--text); }
p { margin: 0; }
a { color: inherit; }
button, input, select, textarea { font: inherit; color: inherit; }
::selection { background: var(--accent-soft); }

.serif { font-family: var(--serif); font-optical-sizing: auto; }
.mono { font-family: var(--mono); font-size: 0.92em; }
.muted { color: var(--muted); }
.faint { color: var(--faint); }
.num { font-variant-numeric: tabular-nums; }
.nowrap { white-space: nowrap; }
.ellipsis { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; min-width: 0; }
.grow { flex: 1; min-width: 0; }
.row { display: flex; align-items: center; gap: 8px; }
.row-wrap { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; }
.stack { display: flex; flex-direction: column; gap: 12px; }
.spacer { flex: 1; }
.hidden { display: none !important; }

:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; border-radius: 4px; }

/* Scrollbars */
* { scrollbar-width: thin; scrollbar-color: var(--line-2) transparent; }
*::-webkit-scrollbar { width: 10px; height: 10px; }
*::-webkit-scrollbar-thumb { background: var(--line-2); border-radius: 10px; border: 3px solid transparent; background-clip: content-box; }

/* ==========================================================================
   Shell layout
   ========================================================================== */

.shell { display: flex; min-height: 100vh; }

.sidebar {
  width: var(--sidebar-w);
  flex: none;
  background: var(--bg-2);
  border-right: 1px solid var(--line);
  display: flex;
  flex-direction: column;
  position: sticky;
  top: 0;
  height: 100vh;
}
.brand {
  display: flex; align-items: center; gap: 10px;
  padding: 20px 20px 18px;
  text-decoration: none;
}
.brand-mark { width: 26px; height: 26px; flex: none; }
.brand-name { font-family: var(--serif); font-size: 21px; letter-spacing: -0.01em; font-weight: 500; }

.nav { padding: 4px 10px; display: flex; flex-direction: column; gap: 1px; }
.nav-label {
  font-size: 11.5px; color: var(--faint); letter-spacing: .04em;
  padding: 18px 10px 6px; display: flex; align-items: center; justify-content: space-between;
}
.nav-item {
  display: flex; align-items: center; gap: 10px;
  padding: 7px 10px; border-radius: var(--r-sm);
  text-decoration: none; color: var(--text-2);
  cursor: pointer; border: 0; background: none; width: 100%; text-align: left;
  min-height: 34px;
}
.nav-item:hover { background: var(--hover); color: var(--text); }
.nav-item.active { background: var(--surface); color: var(--text); box-shadow: 0 0 0 1px var(--line); }
.nav-item .ic { color: var(--muted); }
.nav-item.active .ic { color: var(--text); }
.nav-server { gap: 10px; }
.nav-server .meta { display: flex; flex-direction: column; min-width: 0; line-height: 1.3; }
.nav-server .meta small { color: var(--faint); font-family: var(--mono); font-size: 11px; }
.sidebar-scroll { flex: 1; overflow-y: auto; padding-bottom: 12px; }
.sidebar-foot { border-top: 1px solid var(--line); padding: 10px; display: flex; gap: 2px; flex-direction: column; }

.main { flex: 1; min-width: 0; display: flex; flex-direction: column; }
.page { width: 100%; max-width: 1240px; margin: 0 auto; padding: 40px 48px 72px; }
.page-wide { max-width: none; }

.page-head { display: flex; align-items: flex-end; gap: 16px; margin-bottom: 28px; flex-wrap: wrap; }
.page-head h1 { font-family: var(--serif); font-size: 38px; line-height: 1.12; letter-spacing: -0.018em; font-weight: 420; }
.page-head .sub { color: var(--muted); margin-top: 8px; font-size: 15px; }
.eyebrow { font-size: 12px; color: var(--muted); letter-spacing: .03em; margin-bottom: 8px; display: flex; align-items: center; gap: 6px; }
.eyebrow a { text-decoration: none; color: var(--muted); }
.eyebrow a:hover { color: var(--text); }

.topbar { display: none; }

/* Mobile */
@media (max-width: 900px) {
  .sidebar {
    position: fixed; z-index: 60; left: 0; top: 0; bottom: 0;
    transform: translateX(-100%); transition: transform .25s var(--ease);
    box-shadow: var(--shadow-pop);
  }
  .shell.nav-open .sidebar { transform: none; }
  .scrim { position: fixed; inset: 0; background: rgba(20, 20, 19, .32); z-index: 55; }
  .topbar {
    display: flex; align-items: center; gap: 10px;
    padding: 10px 16px; border-bottom: 1px solid var(--line);
    background: var(--bg); position: sticky; top: 0; z-index: 40;
  }
  .page { padding: 24px 16px 56px; }
  .page-head h1 { font-size: 30px; }
}

/* ==========================================================================
   Buttons & inputs
   ========================================================================== */

.btn {
  --btn-bg: var(--surface);
  --btn-fg: var(--text);
  --btn-bd: var(--line-2);
  display: inline-flex; align-items: center; justify-content: center; gap: 7px;
  height: 34px; padding: 0 14px;
  border-radius: var(--r-sm);
  border: 1px solid var(--btn-bd);
  background: var(--btn-bg); color: var(--btn-fg);
  font-weight: 500; font-size: 13.5px; white-space: nowrap;
  cursor: pointer; user-select: none;
  transition: background .15s, border-color .15s, color .15s, transform .05s;
  text-decoration: none;
}
.btn:hover { background: var(--surface-2); border-color: var(--faint); }
.btn:active { transform: translateY(.5px); }
.btn[disabled] { opacity: .5; cursor: not-allowed; }
.btn-primary { --btn-bg: var(--ink); --btn-fg: var(--on-ink); --btn-bd: var(--ink); }
.btn-primary:hover { background: var(--ink-hover); border-color: var(--ink-hover); }
.btn-accent { --btn-bg: var(--accent); --btn-fg: #fff; --btn-bd: var(--accent); }
.btn-accent:hover { background: var(--accent-2); border-color: var(--accent-2); }
.btn-ghost { --btn-bg: transparent; --btn-bd: transparent; color: var(--text-2); }
.btn-ghost:hover { background: var(--hover); border-color: transparent; color: var(--text); }
.btn-danger { --btn-fg: var(--bad); }
.btn-danger:hover { background: var(--bad-soft); border-color: var(--bad); }
.btn-sm { height: 28px; padding: 0 10px; font-size: 12.5px; gap: 5px; }
.btn-lg { height: 42px; padding: 0 20px; font-size: 14.5px; }
.btn-icon { width: 34px; padding: 0; }
.btn-icon.btn-sm { width: 28px; }
.btn .spin { margin-left: -2px; }

.input, .select, .textarea {
  width: 100%;
  height: 36px; padding: 0 11px;
  border: 1px solid var(--line-2); border-radius: var(--r-sm);
  background: var(--surface); color: var(--text);
  transition: border-color .15s, box-shadow .15s;
  outline: none;
}
.input::placeholder, .textarea::placeholder { color: var(--faint); }
.input:focus, .select:focus, .textarea:focus { border-color: var(--text-2); box-shadow: 0 0 0 3px var(--hover); }
.textarea { height: auto; padding: 9px 11px; resize: vertical; line-height: 1.5; }
.textarea.mono { font-size: 12.5px; }
.select { appearance: none; padding-right: 30px; background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 24 24' fill='none' stroke='%236E6D68' stroke-width='2' stroke-linecap='round'%3E%3Cpath d='m6 9 6 6 6-6'/%3E%3C/svg%3E"); background-repeat: no-repeat; background-position: right 10px center; }
.input-sm { height: 30px; font-size: 13px; }

.field { display: flex; flex-direction: column; gap: 6px; }
.field > label { font-size: 13px; font-weight: 500; color: var(--text-2); }
.field .hint { font-size: 12px; color: var(--muted); }
.field-row { display: grid; grid-template-columns: 1fr 110px; gap: 12px; }
.form { display: flex; flex-direction: column; gap: 16px; }

.seg {
  display: inline-flex; padding: 3px; gap: 2px;
  background: var(--bg-2); border: 1px solid var(--line); border-radius: 9px;
}
.seg button {
  border: 0; background: none; padding: 5px 12px; border-radius: 6px;
  font-size: 13px; color: var(--muted); cursor: pointer; font-weight: 500;
}
.seg button:hover { color: var(--text); }
.seg button.on { background: var(--surface); color: var(--text); box-shadow: 0 0 0 1px var(--line), 0 1px 2px rgba(0,0,0,.04); }

.switch { position: relative; width: 34px; height: 20px; flex: none; cursor: pointer; display: inline-block; }
.switch input { opacity: 0; width: 0; height: 0; position: absolute; }
.switch span { position: absolute; inset: 0; background: var(--line-2); border-radius: 20px; transition: background .2s; }
.switch span::after { content: ""; position: absolute; left: 2px; top: 2px; width: 16px; height: 16px; border-radius: 50%; background: #fff; transition: transform .2s var(--ease); box-shadow: 0 1px 2px rgba(0,0,0,.2); }
.switch input:checked + span { background: var(--ok); }
.switch input:checked + span::after { transform: translateX(14px); }
.switch input:disabled + span { opacity: .5; }

.check { display: inline-flex; align-items: center; gap: 8px; cursor: pointer; font-size: 13px; color: var(--text-2); }
.check input { accent-color: var(--ink); width: 15px; height: 15px; }

/* ==========================================================================
   Surfaces
   ========================================================================== */

.card {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--r-lg);
}
.card-pad { padding: 20px 22px; }
.section { margin-top: 36px; }
.section:first-child, .grid > .section { margin-top: 0; }
.section-head { display: flex; align-items: baseline; gap: 12px; margin-bottom: 14px; flex-wrap: wrap; }
.section-head h2 { font-family: var(--serif); font-size: 22px; letter-spacing: -0.01em; font-weight: 450; }
.section-head .desc { color: var(--muted); font-size: 13px; }
.section-head .actions { margin-left: auto; display: flex; gap: 8px; align-items: center; }

.grid { display: grid; gap: 16px; }
.grid-2 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.grid-3 { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.grid-4 { grid-template-columns: repeat(4, minmax(0, 1fr)); }
@media (max-width: 1100px) { .grid-4 { grid-template-columns: repeat(2, minmax(0, 1fr)); } .grid-3 { grid-template-columns: repeat(2, minmax(0, 1fr)); } }
@media (max-width: 640px) { .grid-2, .grid-3, .grid-4 { grid-template-columns: minmax(0, 1fr); } }

.kv { display: grid; grid-template-columns: max-content 1fr; gap: 8px 20px; font-size: 13.5px; }
.kv dt { color: var(--muted); }
.kv dd { margin: 0; min-width: 0; overflow-wrap: anywhere; }

.notice {
  display: flex; gap: 12px; align-items: flex-start;
  padding: 12px 16px; border-radius: var(--r);
  background: var(--warn-soft); color: var(--text);
  border: 1px solid color-mix(in srgb, var(--warn) 30%, transparent);
  font-size: 13.5px;
}
.notice .ic { color: var(--warn); margin-top: 2px; flex: none; }
.notice.info { background: var(--info-soft); border-color: color-mix(in srgb, var(--info) 30%, transparent); }
.notice.info .ic { color: var(--info); }
.notice.bad { background: var(--bad-soft); border-color: color-mix(in srgb, var(--bad) 30%, transparent); }
.notice.bad .ic { color: var(--bad); }
.notice.ok { background: var(--ok-soft); border-color: color-mix(in srgb, var(--ok) 30%, transparent); }
.notice.ok .ic { color: var(--ok); }
.notice b { font-weight: 600; }

.badge {
  display: inline-flex; align-items: center; gap: 5px;
  height: 22px; padding: 0 8px; border-radius: 6px;
  font-size: 12px; font-weight: 500; white-space: nowrap;
  background: var(--bg-2); color: var(--text-2); border: 1px solid var(--line);
}
.badge.ok { background: var(--ok-soft); color: var(--ok); border-color: transparent; }
.badge.warn { background: var(--warn-soft); color: var(--warn); border-color: transparent; }
.badge.bad { background: var(--bad-soft); color: var(--bad); border-color: transparent; }
.badge.info { background: var(--info-soft); color: var(--info); border-color: transparent; }
.badge.accent { background: var(--accent-soft); color: var(--accent-2); border-color: transparent; }

.dot { width: 8px; height: 8px; border-radius: 50%; background: var(--faint); flex: none; display: inline-block; }
.dot.ok { background: var(--ok); box-shadow: 0 0 0 3px var(--ok-soft); }
.dot.bad { background: var(--bad); box-shadow: 0 0 0 3px var(--bad-soft); }
.dot.wait { background: var(--warn); animation: pulse 1.4s ease-in-out infinite; }
@keyframes pulse { 50% { opacity: .35; } }

.empty {
  padding: 56px 24px; text-align: center;
  display: flex; flex-direction: column; align-items: center; gap: 10px;
}
.empty h3 { font-family: var(--serif); font-size: 22px; font-weight: 450; }
.empty p { color: var(--muted); max-width: 440px; }
.empty .actions { margin-top: 10px; display: flex; gap: 8px; flex-wrap: wrap; justify-content: center; }
.empty-mark { color: var(--faint); margin-bottom: 4px; }

/* Tables */
.table-wrap { overflow-x: auto; }
.table { width: 100%; border-collapse: collapse; font-size: 13.5px; }
.table th {
  text-align: left; font-weight: 500; color: var(--muted); font-size: 12.5px;
  padding: 10px 14px; border-bottom: 1px solid var(--line); white-space: nowrap;
  background: var(--surface);
}
.table td { padding: 10px 14px; border-bottom: 1px solid var(--line); vertical-align: middle; }
.table tr:last-child td { border-bottom: 0; }
.table tbody tr:hover td { background: var(--surface-2); }
.table .r { text-align: right; }
.table .actions-cell { text-align: right; white-space: nowrap; width: 1%; }
.row-actions { display: inline-flex; gap: 2px; opacity: 0; transition: opacity .12s; }
.table tr:hover .row-actions, .row-actions:focus-within { opacity: 1; }
@media (hover: none) { .row-actions { opacity: 1; } }

/* Code / logs */
.code {
  font-family: var(--mono); font-size: 12.5px; line-height: 1.6;
  background: var(--surface-2); border: 1px solid var(--line); border-radius: var(--r);
  padding: 12px 14px; margin: 0;
  white-space: pre-wrap; word-break: break-all;
  overflow: auto; max-height: 360px; color: var(--text-2);
}
.code.dark { background: var(--term-bg); color: var(--term-fg); border-color: transparent; }
.code-wrap { position: relative; }
.code-wrap .copy-btn { position: absolute; top: 8px; right: 8px; opacity: 0; transition: opacity .15s; }
.code-wrap:hover .copy-btn { opacity: 1; }
code.inline { font-family: var(--mono); font-size: .9em; background: var(--bg-2); border: 1px solid var(--line); padding: 1px 5px; border-radius: 5px; }

/* Meter */
.meter { height: 6px; border-radius: 6px; background: var(--bg-2); overflow: hidden; }
.meter > i { display: block; height: 100%; border-radius: 6px; background: var(--text-2); transition: width .6s var(--ease); }
.meter.warn > i { background: var(--warn); }
.meter.bad > i { background: var(--bad); }
.meter.lg { height: 8px; }

/* Tabs */
.tabs {
  display: flex; gap: 2px; border-bottom: 1px solid var(--line);
  margin-bottom: 28px; overflow-x: auto; scrollbar-width: none;
}
.tabs::-webkit-scrollbar { display: none; }
.tab {
  position: relative; padding: 10px 14px 12px; border: 0; background: none;
  color: var(--muted); font-weight: 500; cursor: pointer; white-space: nowrap;
  display: inline-flex; align-items: center; gap: 7px; text-decoration: none; font-size: 14px;
}
.tab:hover { color: var(--text); }
.tab.on { color: var(--text); }
.tab.on::after { content: ""; position: absolute; left: 10px; right: 10px; bottom: -1px; height: 2px; background: var(--text); border-radius: 2px; }

/* Spinner */
.spin { width: 14px; height: 14px; border-radius: 50%; border: 1.6px solid currentColor; border-right-color: transparent; animation: rot .7s linear infinite; display: inline-block; flex: none; opacity: .8; }
.spin.lg { width: 22px; height: 22px; border-width: 2px; }
@keyframes rot { to { transform: rotate(360deg); } }
.loading-block { display: flex; align-items: center; justify-content: center; gap: 10px; color: var(--muted); padding: 48px 0; }

.skeleton { background: linear-gradient(90deg, var(--bg-2), var(--surface-2), var(--bg-2)); background-size: 200% 100%; animation: shimmer 1.4s infinite; border-radius: 6px; }
@keyframes shimmer { to { background-position: -200% 0; } }

/* ==========================================================================
   Modal / dialogs / toasts
   ========================================================================== */

.modal-back {
  position: fixed; inset: 0; z-index: 100;
  background: rgba(20, 20, 19, .36);
  display: flex; align-items: flex-start; justify-content: center;
  padding: 8vh 16px 16px; overflow-y: auto;
  animation: fade .15s ease-out;
}
:root[data-theme="dark"] .modal-back { background: rgba(0, 0, 0, .55); }
.modal {
  width: 100%; max-width: 520px;
  background: var(--surface); border: 1px solid var(--line);
  border-radius: 16px; box-shadow: var(--shadow-pop);
  animation: rise .2s var(--ease);
  display: flex; flex-direction: column; max-height: calc(100vh - 10vh - 16px);
}
.modal.wide { max-width: 860px; }
.modal.full { max-width: 1180px; height: calc(100vh - 6vh - 16px); max-height: none; }
.modal-back.top { padding-top: 3vh; }
.modal-head { display: flex; align-items: center; gap: 12px; padding: 20px 22px 4px; }
.modal-head h3 { font-family: var(--serif); font-size: 21px; font-weight: 450; letter-spacing: -0.01em; flex: 1; min-width: 0; }
.modal-body { padding: 14px 22px 20px; overflow-y: auto; flex: 1; min-height: 0; }
.modal-foot { display: flex; gap: 8px; justify-content: flex-end; padding: 14px 22px 18px; border-top: 1px solid var(--line); align-items: center; }
@keyframes fade { from { opacity: 0; } }
@keyframes rise { from { opacity: 0; transform: translateY(8px) scale(.99); } }

.toasts { position: fixed; z-index: 200; bottom: 20px; right: 20px; display: flex; flex-direction: column; gap: 8px; align-items: flex-end; pointer-events: none; }
.toast {
  pointer-events: auto;
  max-width: 420px; padding: 11px 14px 11px 12px;
  background: var(--ink); color: var(--on-ink);
  border-radius: 10px; box-shadow: var(--shadow-pop);
  display: flex; gap: 10px; align-items: flex-start; font-size: 13.5px;
  animation: rise .22s var(--ease);
  white-space: pre-wrap; word-break: break-word;
}
.toast .ic { flex: none; margin-top: 1px; }
.toast.ok .ic { color: #9CC383; }
.toast.bad .ic { color: #F0907F; }
:root[data-theme="dark"] .toast.ok .ic { color: var(--ok); }
:root[data-theme="dark"] .toast.bad .ic { color: var(--bad); }
@media (max-width: 640px) { .toasts { left: 16px; right: 16px; align-items: stretch; } .toast { max-width: none; } }

/* ==========================================================================
   Login
   ========================================================================== */

.login {
  min-height: 100vh; display: grid; grid-template-columns: 1.05fr 1fr;
}
.login-art {
  background: var(--bg-2); border-right: 1px solid var(--line);
  padding: 48px 56px; display: flex; flex-direction: column; justify-content: space-between;
  position: relative; overflow: hidden;
}
.login-art h1 { font-family: var(--serif); font-size: 52px; line-height: 1.06; letter-spacing: -0.025em; font-weight: 400; max-width: 520px; }
.login-art h1 em { font-style: italic; color: var(--accent); }
.login-art p { color: var(--muted); font-size: 16px; max-width: 440px; margin-top: 20px; line-height: 1.6; }
.login-list { margin-top: 40px; display: grid; gap: 0; max-width: 460px; }
.login-list div { display: flex; gap: 16px; padding: 14px 0; border-top: 1px solid var(--line); font-size: 14px; color: var(--text-2); }
.login-list div:last-child { border-bottom: 1px solid var(--line); }
.login-list span:first-child { font-family: var(--mono); font-size: 12px; color: var(--faint); padding-top: 2px; width: 22px; }
.login-form-wrap { display: flex; align-items: center; justify-content: center; padding: 48px 24px; }
.login-form { width: 100%; max-width: 360px; }
.login-form h2 { font-family: var(--serif); font-size: 30px; font-weight: 420; letter-spacing: -0.015em; }
.login-form .sub { color: var(--muted); margin: 8px 0 28px; }
.login-foot { font-size: 12px; color: var(--faint); }
@media (max-width: 900px) {
  .login { grid-template-columns: 1fr; }
  .login-art { padding: 32px 24px; border-right: 0; border-bottom: 1px solid var(--line); }
  .login-art h1 { font-size: 36px; }
  .login-list, .login-foot { display: none; }
}

/* ==========================================================================
   Dashboard
   ========================================================================== */

.summary { display: flex; gap: 40px; flex-wrap: wrap; margin-bottom: 32px; padding-bottom: 28px; border-bottom: 1px solid var(--line); }
.summary .stat .v { font-family: var(--serif); font-size: 34px; line-height: 1; letter-spacing: -0.02em; font-weight: 400; }
.summary .stat .l { color: var(--muted); font-size: 13px; margin-top: 8px; }

.server-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(320px, 1fr)); gap: 16px; }
.scard {
  background: var(--surface); border: 1px solid var(--line); border-radius: var(--r-lg);
  padding: 18px 20px 16px; display: flex; flex-direction: column; gap: 16px;
  text-decoration: none; color: inherit; cursor: pointer;
  transition: border-color .15s, box-shadow .2s, transform .2s var(--ease);
}
.scard:hover { border-color: var(--line-2); box-shadow: 0 1px 2px rgba(20,20,19,.03), 0 10px 28px -16px rgba(20,20,19,.22); }
.scard-head { display: flex; align-items: flex-start; gap: 10px; }
.scard-head h3 { font-family: var(--serif); font-size: 19px; font-weight: 450; line-height: 1.25; letter-spacing: -0.005em; }
.scard-head small { display: block; font-family: var(--mono); font-size: 11.5px; color: var(--faint); margin-top: 3px; }
.scard-metrics { display: grid; grid-template-columns: repeat(3, 1fr); gap: 14px; }
.mini .top { display: flex; justify-content: space-between; align-items: baseline; margin-bottom: 7px; }
.mini .k { font-size: 12px; color: var(--muted); }
.mini .v { font-size: 13px; font-weight: 600; font-variant-numeric: tabular-nums; }
.scard-foot { display: flex; gap: 14px; font-size: 12px; color: var(--muted); padding-top: 12px; border-top: 1px solid var(--line); flex-wrap: wrap; }
.scard-foot span { display: inline-flex; align-items: center; gap: 4px; font-variant-numeric: tabular-nums; }
.scard-err { font-size: 12.5px; color: var(--bad); background: var(--bad-soft); padding: 8px 10px; border-radius: 8px; }
.scard-add {
  border: 1px dashed var(--line-2); border-radius: var(--r-lg);
  display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 8px;
  min-height: 190px; color: var(--muted); cursor: pointer; background: none; font-size: 14px;
  transition: color .15s, border-color .15s, background .15s;
}
.scard-add:hover { color: var(--text); border-color: var(--faint); background: var(--hover); }

/* ==========================================================================
   Server overview
   ========================================================================== */

.metric { padding: 18px 20px; display: flex; flex-direction: column; gap: 10px; min-height: 170px; }
.metric .label { font-size: 13px; color: var(--muted); display: flex; justify-content: space-between; align-items: center; }
.metric .big { font-family: var(--serif); font-size: 36px; line-height: 1; letter-spacing: -0.02em; font-variant-numeric: tabular-nums; font-weight: 400; }
.metric .big small { font-family: var(--sans); font-size: 14px; color: var(--muted); letter-spacing: 0; margin-left: 4px; font-weight: 400; }
.metric .foot { font-size: 12.5px; color: var(--muted); display: flex; justify-content: space-between; gap: 8px; font-variant-numeric: tabular-nums; }
.metric .spark { margin-top: auto; }
.legend { display: inline-flex; gap: 12px; font-size: 12px; color: var(--muted); }
.legend i { display: inline-block; width: 8px; height: 2px; border-radius: 2px; vertical-align: middle; margin-right: 5px; }

.facts { display: flex; flex-wrap: wrap; gap: 8px 28px; margin: -10px 0 28px; color: var(--muted); font-size: 13px; }
.facts b { color: var(--text-2); font-weight: 500; }

/* ==========================================================================
   Terminal
   ========================================================================== */

.term-shell {
  background: var(--term-bg); border-radius: var(--r-lg);
  overflow: hidden; display: flex; flex-direction: column;
  height: calc(100vh - 290px); min-height: 380px;
  border: 1px solid var(--line);
}
:root[data-theme="dark"] .term-shell { border-color: var(--line); }
.term-bar {
  display: flex; align-items: center; gap: 10px;
  padding: 8px 10px 8px 16px; border-bottom: 1px solid rgba(255,255,255,.06);
  color: #A3A097; font-size: 12.5px;
}
.term-bar .btn-ghost { color: #C9C6BC; }
.term-bar .btn-ghost:hover { background: rgba(255,255,255,.07); color: #fff; }
.term-host { width: 100%; flex: 1; min-height: 0; padding: 10px 4px 4px 14px; }
.term-host .xterm { height: 100%; }
.term-host .xterm-viewport { background: transparent !important; }
.term-shell.fullscreen { position: fixed; inset: 0; z-index: 90; height: auto; border-radius: 0; border: 0; }

/* ==========================================================================
   Files
   ========================================================================== */

.fbar { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; margin-bottom: 14px; }
.crumbs {
  flex: 1; min-width: 180px; display: flex; align-items: center;
  height: 36px; padding: 0 6px; border: 1px solid var(--line-2); border-radius: var(--r-sm);
  background: var(--surface); overflow-x: auto; scrollbar-width: none; cursor: text;
}
.crumbs::-webkit-scrollbar { display: none; }
.crumbs button {
  border: 0; background: none; padding: 3px 6px; border-radius: 5px; cursor: pointer;
  font-family: var(--mono); font-size: 12.5px; color: var(--text-2); white-space: nowrap;
}
.crumbs button:hover { background: var(--hover); color: var(--text); }
.crumbs .sep { color: var(--faint); font-size: 12px; }
.crumbs input { border: 0; outline: none; background: none; width: 100%; font-family: var(--mono); font-size: 12.5px; padding: 0 6px; }
.file-table td.name { width: 100%; max-width: 0; }
.fname {
  display: flex; align-items: center; gap: 10px; cursor: pointer;
  border: 0; background: none; padding: 0; text-align: left; width: 100%; color: inherit;
}
.fname:hover span { text-decoration: underline; text-decoration-color: var(--faint); text-underline-offset: 3px; }
.fname .ic { flex: none; color: var(--faint); }
.fname.dir .ic { color: var(--accent); }
.drop-hint {
  position: absolute; inset: 0; border: 2px dashed var(--accent); border-radius: var(--r-lg);
  background: color-mix(in srgb, var(--accent-soft) 80%, transparent);
  display: flex; align-items: center; justify-content: center; font-family: var(--serif); font-size: 20px;
  z-index: 5; pointer-events: none;
}
.uploads { position: fixed; z-index: 150; right: 20px; bottom: 20px; width: 340px; max-width: calc(100vw - 32px); }
.uploads .card { box-shadow: var(--shadow-pop); padding: 12px 14px; display: flex; flex-direction: column; gap: 10px; }
.upl { font-size: 12.5px; display: flex; flex-direction: column; gap: 5px; }
.upl .row { justify-content: space-between; }

.editor { display: flex; flex-direction: column; height: 100%; }
.editor textarea {
  flex: 1; width: 100%; resize: none; border: 0; outline: none;
  font-family: var(--mono); font-size: 13px; line-height: 1.6;
  padding: 16px 20px; background: var(--surface-2); color: var(--text);
  tab-size: 4; white-space: pre; overflow: auto;
}
.editor-status { display: flex; gap: 16px; padding: 8px 20px; font-size: 12px; color: var(--muted); border-top: 1px solid var(--line); }

/* ==========================================================================
   Security
   ========================================================================== */

.bars { display: flex; flex-direction: column; }
.bar-row { display: grid; grid-template-columns: minmax(130px, 170px) 1fr auto; gap: 14px; align-items: center; padding: 9px 0; border-bottom: 1px solid var(--line); }
.bar-row:last-child { border-bottom: 0; }
.bar-row .who { font-family: var(--mono); font-size: 12.5px; }
.bar-row .who small { display: block; font-family: var(--sans); color: var(--faint); font-size: 11.5px; margin-top: 1px; }
.bar-track { position: relative; height: 22px; display: flex; align-items: center; gap: 8px; }
.bar-track i { display: block; height: 8px; border-radius: 3px; background: var(--accent); min-width: 3px; transition: width .5s var(--ease); }
.bar-track b { font-size: 12px; font-weight: 600; font-variant-numeric: tabular-nums; color: var(--text-2); }
.bar-row.muted-bar .bar-track i { background: var(--text-2); opacity: .55; }
@media (max-width: 640px) { .bar-row { grid-template-columns: 1fr auto; } .bar-row .bar-track { grid-column: 1 / -1; grid-row: 2; } }

.peers { display: flex; flex-wrap: wrap; gap: 4px; }
.peers code { font-family: var(--mono); font-size: 11.5px; background: var(--bg-2); padding: 1px 6px; border-radius: 4px; color: var(--text-2); }

.log-lines { font-family: var(--mono); font-size: 12px; line-height: 1.7; max-height: 420px; overflow: auto; }
.log-lines div { padding: 2px 14px; border-bottom: 1px solid var(--line); white-space: pre; color: var(--text-2); }
.log-lines div:hover { background: var(--surface-2); }

details.raw { border: 1px solid var(--line); border-radius: var(--r); background: var(--surface); }
details.raw summary { padding: 12px 16px; cursor: pointer; font-weight: 500; list-style: none; display: flex; align-items: center; gap: 8px; }
details.raw summary::-webkit-details-marker { display: none; }
details.raw summary .chev { transition: transform .15s; color: var(--muted); }
details.raw[open] summary .chev { transform: rotate(90deg); }
details.raw .code { margin: 0 12px 12px; }

/* ==========================================================================
   Sites / Tailscale / MCP
   ========================================================================== */

.site { padding: 18px 20px; display: flex; gap: 18px; align-items: flex-start; }
.site + .site { border-top: 1px solid var(--line); }
.site h3 { font-family: var(--serif); font-size: 19px; font-weight: 450; overflow-wrap: anywhere; }
.site .target { font-family: var(--mono); font-size: 12px; color: var(--muted); margin-top: 4px; overflow-wrap: anywhere; }
.site .tags { display: flex; gap: 6px; margin-top: 10px; flex-wrap: wrap; }
.site .ops { display: flex; gap: 6px; align-items: center; flex-wrap: wrap; justify-content: flex-end; }
.site.off h3, .site.off .target { opacity: .55; }
@media (max-width: 720px) { .site { flex-direction: column; } .site .ops { justify-content: flex-start; } }

.hero-status { display: flex; gap: 20px; align-items: center; padding: 22px 24px; flex-wrap: wrap; }
.hero-status .ip { font-family: var(--serif); font-size: 30px; letter-spacing: -0.01em; font-variant-numeric: tabular-nums; }
.hero-status .meta { color: var(--muted); font-size: 13px; margin-top: 4px; }

.auth-link {
  display: flex; gap: 16px; align-items: center; padding: 18px 20px;
  border-radius: var(--r-lg); border: 1px solid color-mix(in srgb, var(--accent) 40%, transparent);
  background: var(--accent-soft); flex-wrap: wrap;
}
.auth-link .url { font-family: var(--mono); font-size: 12.5px; overflow-wrap: anywhere; color: var(--text-2); }

.steps { counter-reset: step; display: flex; flex-direction: column; }
.steps li { list-style: none; counter-increment: step; display: grid; grid-template-columns: 34px 1fr; gap: 12px; padding: 14px 0; border-top: 1px solid var(--line); }
.steps li:first-child { border-top: 0; padding-top: 0; }
.steps li::before { content: counter(step, decimal-leading-zero); font-family: var(--mono); font-size: 12px; color: var(--faint); padding-top: 2px; }
.steps { padding: 0; margin: 0; }
.steps b { font-weight: 600; }
.steps p { color: var(--muted); margin-top: 3px; font-size: 13px; }

.link-out { display: inline-flex; align-items: center; gap: 6px; color: var(--accent-2); text-decoration: none; font-weight: 500; overflow-wrap: anywhere; }
.link-out:hover { text-decoration: underline; text-underline-offset: 3px; }

.menu { position: relative; display: inline-block; }
.menu-pop {
  position: absolute; right: 0; top: calc(100% + 4px); z-index: 30; min-width: 160px;
  background: var(--surface); border: 1px solid var(--line); border-radius: 10px; box-shadow: var(--shadow-pop);
  padding: 4px; display: flex; flex-direction: column;
}
.menu-pop button { border: 0; background: none; text-align: left; padding: 7px 10px; border-radius: 6px; cursor: pointer; font-size: 13px; display: flex; gap: 8px; align-items: center; }
.menu-pop button:hover { background: var(--hover); }
.menu-pop button.danger { color: var(--bad); }

.divider { height: 1px; background: var(--line); margin: 20px 0; }

/* 窄屏：次要列让位给名称/命令列 */
@media (max-width: 640px) {
  .hide-sm { display: none; }
  .fbar .crumbs { order: 10; flex-basis: 100%; }
  .table th, .table td { padding: 9px 10px; }
}

/* ==========================================================================
   面板式布局（.lp）：参照 1Panel 的排布 —— 侧栏按功能模块、顶部切换当前服务器、
   每页顶部子页按钮条、卡片带标题栏、工具栏 + 表格。配色沿用上面的 token
   ========================================================================== */

.lp {
  --bg: #F0EEE6;
  --surface: #FAF9F5;
  --surface-2: #F4F2EC;
  --line: #E3E0D6;
  --gap: 8px;
}
:root[data-theme="dark"] .lp {
  --bg: #1A1918;
  --surface: #262624;
  --surface-2: #2D2C29;
  --line: #363531;
}
.lp { background: var(--bg); }
.lp .sidebar { width: 208px; background: var(--surface); }
.lp .brand { padding: 14px 16px 8px; }
.lp .brand-name { font-size: 19px; }
.lp .card { border-radius: 8px; }
.lp .table th { background: var(--surface-2); font-weight: 600; height: 40px; padding: 0 12px; }
.lp .table td { padding: 8px 12px; height: 44px; }
.lp .btn { height: 32px; font-size: 13px; }
.lp .btn-sm { height: 26px; }
.lp .btn-icon { width: 32px; }
.lp .btn-icon.btn-sm { width: 26px; }
.lp .input, .lp .select { height: 34px; }
.lp .content { padding: 12px 20px 28px; width: 100%; }
/* 复用的功能页在面板式里收紧：小标题、卡片间距 8px */
.lp .section { margin-top: var(--gap); }
.lp .section:first-child { margin-top: 0; }
.lp .section-head { margin-bottom: 6px; }
.lp .section-head h2 { font-family: var(--sans); font-size: 14px; font-weight: 600; letter-spacing: 0; }
.lp .summary { gap: 28px; margin-bottom: var(--gap); padding: 14px 18px; border: 1px solid var(--line); border-radius: 8px; background: var(--surface); }
.lp .summary .stat .v { font-size: 26px; }
.lp .facts { margin: 0 0 var(--gap); padding: 10px 16px; border: 1px solid var(--line); border-radius: 8px; background: var(--surface); }
.lp .metric { min-height: 150px; padding: 14px 16px; }
.lp .metric .big { font-size: 30px; }
.lp .term-shell { height: calc(100vh - 92px); border-radius: 8px; }
.lp .hero-status { padding: 16px 18px; }
.lp .site { padding: 14px 16px; }
@media (max-width: 900px) { .lp .content { padding: 10px 10px 24px; } }

/* 当前服务器切换器 */
.switcher { position: relative; margin: 2px 10px 6px; }
.switcher-btn {
  width: 100%; display: flex; align-items: center; gap: 9px;
  padding: 8px 10px; border-radius: 8px;
  border: 1px solid var(--line); background: var(--surface-2);
  cursor: pointer; text-align: left;
}
.switcher-btn:hover { border-color: var(--line-2); }
.switcher-btn .meta { display: flex; flex-direction: column; min-width: 0; flex: 1; line-height: 1.3; }
.switcher-btn .meta b { font-weight: 600; font-size: 13px; }
.switcher-btn .meta small { font-family: var(--mono); font-size: 11px; color: var(--faint); }
.switcher-pop {
  position: absolute; left: 0; right: 0; top: calc(100% + 4px); z-index: 50;
  background: var(--surface); border: 1px solid var(--line); border-radius: 8px;
  box-shadow: var(--shadow-pop); padding: 4px; max-height: 360px; overflow-y: auto;
}
.switcher-pop button {
  display: flex; align-items: center; gap: 8px; width: 100%; padding: 7px 8px;
  border: 0; background: none; border-radius: 5px; cursor: pointer; text-align: left; font-size: 13px;
}
.switcher-pop button:hover { background: var(--hover); }
.switcher-pop button.on { background: var(--accent-soft); }
.switcher-pop hr { border: 0; border-top: 1px solid var(--line); margin: 4px 0; }

/* 模块菜单 */
.menu-scroll { flex: 1; overflow-y: auto; padding: 2px 10px 10px; }
.menu-group { font-size: 11.5px; color: var(--faint); padding: 12px 8px 4px; letter-spacing: .03em; }
.menu-item {
  display: flex; align-items: center; gap: 10px; height: 36px; padding: 0 10px; border-radius: 6px;
  text-decoration: none; color: var(--text-2); font-size: 13.5px;
  cursor: pointer; border: 0; background: none; width: 100%; text-align: left;
}
.menu-item .ic { color: var(--muted); flex: none; }
.menu-item:hover { background: var(--hover); color: var(--text); }
.menu-item.active { background: var(--accent-soft); color: var(--accent-2); font-weight: 600; }
.menu-item.active .ic { color: var(--accent-2); }
.menu-item.disabled { opacity: .45; pointer-events: none; }

/* 页面顶部子页按钮条（1Panel RouterButton） */
.pagebar {
  display: flex; align-items: center; gap: 12px; flex-wrap: wrap;
  background: var(--surface); border: 1px solid var(--line); border-radius: 8px;
  padding: 6px; margin-bottom: var(--gap, 8px); min-height: 48px;
}
.pagebar-tabs { display: flex; gap: 2px; flex-wrap: wrap; }
.pagebar-tabs button {
  height: 34px; padding: 0 16px; border-radius: 6px; border: 0; background: none;
  font-size: 14px; color: var(--text-2); cursor: pointer; white-space: nowrap;
}
.pagebar-tabs button:hover { background: var(--hover); color: var(--text); }
.pagebar-tabs button.on { background: var(--ink); color: var(--on-ink); font-weight: 600; }
.pagebar-right { margin-left: auto; display: flex; align-items: center; gap: 8px; flex-wrap: wrap; padding-right: 4px; }
.server-chip { display: inline-flex; align-items: center; gap: 7px; font-size: 13px; color: var(--muted); }
.server-chip b { color: var(--text); font-weight: 600; }

/* 带标题栏的卡片（1Panel CardWithHeader） */
.card-h { display: flex; align-items: center; gap: 10px; min-height: 44px; padding: 8px 16px; border-bottom: 1px solid var(--line); }
.card-h h3 { font-size: 14px; font-weight: 600; font-family: var(--sans); }
.card-h .desc { font-size: 12.5px; color: var(--muted); }
.card-h .extra { margin-left: auto; display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.card-b { padding: 14px 16px; }
.card-b.flush { padding: 0; }
.toolbar { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; padding: 10px 16px; border-bottom: 1px solid var(--line); }
.toolbar .right { margin-left: auto; display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.search { position: relative; width: 220px; }
.search .input { padding-left: 30px; }
.search .ic { position: absolute; left: 9px; top: 9px; color: var(--faint); }
.split { display: grid; gap: 8px; grid-template-columns: minmax(0, 2fr) minmax(0, 1fr); align-items: start; }
.stack-8 { display: flex; flex-direction: column; gap: 8px; min-width: 0; }
@media (max-width: 1100px) { .split { grid-template-columns: minmax(0, 1fr); } }
@media (max-width: 640px) { .search { width: 100%; } }

/* 表格操作列的文字按钮 */
.lbtn { border: 0; background: none; padding: 0 2px; margin: 0 4px; cursor: pointer; color: var(--accent-2); font-size: 13px; text-decoration: none; white-space: nowrap; }
.lbtn:hover { text-decoration: underline; text-underline-offset: 3px; }
.lbtn.danger { color: var(--bad); }
.cell-meter { display: flex; align-items: center; gap: 8px; min-width: 110px; }
.cell-meter .meter { flex: 1; }
.cell-meter span { width: 38px; text-align: right; font-variant-numeric: tabular-nums; font-size: 12.5px; }

/* 首页：概览数字 */
.counts { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); }
.counts > button { border: 0; background: none; text-align: left; padding: 16px 18px; cursor: pointer; border-right: 1px solid var(--line); display: flex; flex-direction: column; gap: 8px; }
.counts > button:last-child { border-right: 0; }
.counts > button:hover { background: var(--hover); }
.counts .k { font-size: 13px; color: var(--muted); }
.counts .v { font-family: var(--serif); font-size: 28px; line-height: 1; font-variant-numeric: tabular-nums; color: var(--accent-2); }
.counts .v small { font-family: var(--sans); font-size: 13px; color: var(--muted); margin-left: 3px; }
@media (max-width: 640px) { .counts { grid-template-columns: repeat(2, 1fr); } .counts > button:nth-child(2) { border-right: 0; } .counts > button:nth-child(-n+2) { border-bottom: 1px solid var(--line); } }

/* 首页：环形仪表 */
.gauges { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 8px; padding: 18px 8px 16px; }
@media (max-width: 640px) { .gauges { grid-template-columns: repeat(2, 1fr); row-gap: 18px; } }
.gauge { display: flex; flex-direction: column; align-items: center; gap: 4px; text-align: center; min-width: 0; }
.gauge svg { display: block; }
.gauge .g-sub { font-size: 12px; color: var(--muted); max-width: 100%; }
.gauge .g-tag { font-size: 12px; font-weight: 600; }

/* 折线图 */
.chart { position: relative; width: 100%; }
.chart svg { display: block; overflow: visible; }
.chart .axis { font-size: 11px; fill: var(--faint); font-variant-numeric: tabular-nums; }
.chart .grid-line { stroke: var(--line); stroke-dasharray: 3 3; }
.chart-tip { position: absolute; pointer-events: none; z-index: 5; background: var(--ink); color: var(--on-ink); border-radius: 6px; padding: 6px 9px; font-size: 12px; white-space: nowrap; font-variant-numeric: tabular-nums; transform: translate(-50%, -110%); }
.chart-tip i { display: inline-block; width: 8px; height: 8px; border-radius: 2px; margin-right: 5px; }
.tags { display: flex; gap: 6px; flex-wrap: wrap; }

/* 统计条 */
.stats { display: grid; grid-template-columns: repeat(auto-fit, minmax(140px, 1fr)); }
.stats > div { padding: 14px 18px; border-right: 1px solid var(--line); }
.stats > div:last-child { border-right: 0; }
.stats .v { font-family: var(--serif); font-size: 26px; line-height: 1.1; font-variant-numeric: tabular-nums; }
.stats .l { color: var(--muted); font-size: 12.5px; margin-top: 4px; }

/* 批量命令结果 */
.exec-result .code { border: 0; border-radius: 0 0 8px 8px; max-height: 300px; }
.table .sel { width: 36px; }
.table-foot { display: flex; align-items: center; gap: 10px; padding: 10px 16px; border-top: 1px solid var(--line); font-size: 12.5px; color: var(--muted); }
/* 面板式里复用卡片式的整页组件（设置页）时去掉大标题和外边距 */
.lp .page { padding: 0; max-width: none !important; }
.lp .page > .page-head { display: none; }
