:root {
  --bg: #ffffff;
  --bg-soft: #f5f5f7;
  --text: #1d1d1f;
  --text-soft: #6e6e73;
  --blue: #0071e3;
  --blue-hover: #0077ed;
  --green: #34c759;
  --red: #ff3b30;
  --orange: #ff9f0a;
  --border: #d2d2d7;
  --card-radius: 18px;
  --shadow: 0 4px 24px rgba(0, 0, 0, 0.06);
  --shadow-lg: 0 18px 60px rgba(0, 0, 0, 0.18);
  font-family: -apple-system, BlinkMacSystemFont, "SF Pro Display", "SF Pro Text",
    "Helvetica Neue", Helvetica, Arial, "PingFang SC", "Microsoft YaHei", sans-serif;
}

* { box-sizing: border-box; }

html, body {
  margin: 0;
  padding: 0;
  background: var(--bg);
  color: var(--text);
  -webkit-font-smoothing: antialiased;
}

.hidden { display: none !important; }

/* Navigation */
.nav {
  position: sticky;
  top: 0;
  z-index: 50;
  background: rgba(255, 255, 255, 0.72);
  backdrop-filter: saturate(180%) blur(20px);
  -webkit-backdrop-filter: saturate(180%) blur(20px);
  border-bottom: 1px solid rgba(0, 0, 0, 0.07);
}
.nav-inner {
  max-width: 1080px;
  margin: 0 auto;
  height: 52px;
  padding: 0 22px;
  display: flex;
  align-items: center;
  justify-content: space-between;
}
.nav-logo {
  font-size: 19px;
  font-weight: 600;
  letter-spacing: -0.02em;
}
.nav-right { display: flex; align-items: center; gap: 14px; font-size: 14px; }
.nav-user { color: var(--text-soft); }
.nav-link { color: var(--blue); cursor: pointer; background: none; border: none; font-size: 14px; }

/* Auth */
.auth-view {
  min-height: calc(100vh - 52px);
  display: flex;
  align-items: center;
  justify-content: center;
  background: radial-gradient(1200px 600px at 50% -10%, #eef4ff 0%, #ffffff 60%);
  padding: 40px 20px;
}
.auth-card {
  width: 100%;
  max-width: 380px;
  background: var(--bg);
  border-radius: 28px;
  padding: 40px 32px;
  box-shadow: var(--shadow-lg);
  text-align: center;
}
.auth-title { font-size: 28px; font-weight: 600; margin: 0 0 6px; letter-spacing: -0.02em; }
.auth-sub { color: var(--text-soft); margin: 0 0 26px; font-size: 15px; }
.auth-tabs { display: flex; background: var(--bg-soft); border-radius: 12px; padding: 3px; margin-bottom: 22px; }
.auth-tab {
  flex: 1; border: none; background: none; padding: 9px 0; border-radius: 10px;
  font-size: 14px; color: var(--text-soft); cursor: pointer; transition: all .2s;
}
.auth-tab.active { background: var(--bg); color: var(--text); box-shadow: var(--shadow); font-weight: 500; }

/* Forms */
.field {
  width: 100%;
  padding: 13px 15px;
  border: 1px solid var(--border);
  border-radius: 12px;
  font-size: 15px;
  margin-bottom: 14px;
  background: var(--bg);
  color: var(--text);
  outline: none;
  transition: border-color .2s, box-shadow .2s;
}
.field:focus { border-color: var(--blue); box-shadow: 0 0 0 4px rgba(0, 113, 227, 0.12); }
.field.area { min-height: 110px; resize: vertical; font-family: ui-monospace, SFMono-Regular, Menlo, monospace; font-size: 13px; }

/* Batch add VPS */
.batch-hint { font-size: 13px; color: var(--text-soft); margin: 0 0 14px; line-height: 1.6; }
.batch-hint code { background: var(--bg); border: 1px solid var(--border); border-radius: 6px; padding: 1px 6px; font-family: ui-monospace, SFMono-Regular, Menlo, monospace; font-size: 12px; color: var(--text); }
.batch-area { min-height: 180px; line-height: 1.6; }
.batch-preview { margin-top: 16px; border: 1px solid var(--border); border-radius: 12px; overflow: hidden; }
.batch-preview table { width: 100%; border-collapse: collapse; font-size: 13px; }
.batch-preview th, .batch-preview td { text-align: left; padding: 9px 12px; border-bottom: 1px solid var(--border); }
.batch-preview th { background: var(--bg); color: var(--text-soft); font-weight: 500; white-space: nowrap; }
.batch-preview tr:last-child td { border-bottom: none; }
.batch-preview .badge-ok { color: #1aa260; font-weight: 600; }
.batch-preview .badge-err { color: #e02424; font-weight: 600; }
.batch-preview .row-err td { color: #e02424; }
.batch-preview .pass-mask { color: var(--text-soft); }
select.field {
  appearance: none;
  -webkit-appearance: none;
  background-image: url("data:image/svg+xml,%3Csvg width='12' height='8' viewBox='0 0 12 8' fill='none' xmlns='http://www.w3.org/2000/svg'%3E%3Cpath d='M1 1.5L6 6.5L11 1.5' stroke='%236e6e73' stroke-width='1.5' stroke-linecap='round' stroke-linejoin='round'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 14px center;
  padding-right: 40px;
  cursor: pointer;
}
.auth-form { text-align: left; }
.auth-error { color: var(--red); font-size: 13px; min-height: 18px; margin-bottom: 4px; }

/* Form groups */
.form-group { margin-bottom: 22px; }
.form-group:last-child { margin-bottom: 0; }
.form-group .field { margin-bottom: 0; }
.form-row { display: grid; grid-template-columns: 1fr 1fr; gap: 20px; align-items: start; }
.form-row .form-group { min-width: 0; }
.lbl { display: block; font-size: 14px; font-weight: 500; color: var(--text); margin-bottom: 10px; }

/* Buttons */
.btn {
  border: none; border-radius: 980px; padding: 11px 22px; font-size: 15px;
  cursor: pointer; transition: background .2s, transform .1s, opacity .2s; font-weight: 400;
}
.btn:active { transform: scale(0.97); }
.btn-primary { background: var(--blue); color: #fff; }
.btn-primary:hover { background: var(--blue-hover); }
.btn-ghost { background: var(--bg-soft); color: var(--text); }
.btn-ghost:hover { background: #ececef; }
.btn-block { width: 100%; }
.btn-danger { background: var(--red); color: #fff; }
.btn-danger:hover { background: #e0352b; }

/* Hero */
.hero { text-align: center; padding: 70px 20px 40px; }
.hero-title { font-size: 48px; font-weight: 600; letter-spacing: -0.03em; margin: 0 0 14px; }
.hero-sub { font-size: 19px; color: var(--text-soft); margin: 0 auto; max-width: 640px; line-height: 1.5; }

/* Layout */
.container { max-width: 1080px; margin: 0 auto; padding: 0 22px 80px; }
/* leave room for the background terminal dock */
.app-view { padding-bottom: 56px; }
.section-head { display: flex; align-items: center; justify-content: space-between; margin: 10px 0 24px; }
.section-title { font-size: 26px; font-weight: 600; letter-spacing: -0.02em; margin: 0; }
.section-actions { display: flex; gap: 10px; }

/* Selection bar */
.selection-bar {
  display: flex; align-items: center; gap: 16px; margin: 6px 0 22px;
  padding: 12px 18px; background: var(--bg); border: 1px solid var(--border);
  border-radius: 14px; box-shadow: var(--shadow);
}
.sel-all { display: flex; align-items: center; gap: 8px; font-size: 14px; cursor: pointer; }
.sel-count { font-size: 14px; color: var(--text-soft); }

/* VPS grid */
.vps-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(320px, 1fr)); gap: 22px; }
.vps-card {
  background: var(--bg); border: 1px solid var(--border); border-radius: var(--card-radius);
  padding: 22px; box-shadow: var(--shadow); cursor: pointer; transition: transform .2s, box-shadow .2s;
  position: relative;
}
.vps-card:hover { transform: translateY(-3px); box-shadow: 0 10px 36px rgba(0, 0, 0, 0.1); }
.vps-select {
  position: absolute; top: 16px; left: 16px; z-index: 2;
  width: 22px; height: 22px; display: flex; align-items: center; justify-content: center;
  background: rgba(255, 255, 255, 0.85); border-radius: 7px;
}
.vps-select input { width: 18px; height: 18px; cursor: pointer; accent-color: var(--blue); }
.vps-card.selecting { padding-left: 46px; }
.vps-card.selecting .vps-select { background: transparent; }
.vps-card-head { display: flex; align-items: center; justify-content: space-between; margin-bottom: 18px; }
.vps-name { font-size: 18px; font-weight: 600; letter-spacing: -0.01em; }
.vps-host { font-size: 13px; color: var(--text-soft); margin-top: 2px; }
.status-dot { width: 9px; height: 9px; border-radius: 50%; background: var(--red); display: inline-block; margin-right: 6px; }
.status-dot.online { background: var(--green); box-shadow: 0 0 0 4px rgba(52, 199, 89, 0.18); }
.status-text { font-size: 12px; color: var(--text-soft); }

.meter { margin-bottom: 14px; }
.meter-top { display: flex; justify-content: space-between; font-size: 13px; margin-bottom: 6px; }
.meter-label { color: var(--text-soft); }
.meter-val { font-variant-numeric: tabular-nums; font-weight: 500; }
.bar { height: 7px; background: var(--bg-soft); border-radius: 99px; overflow: hidden; }
.bar-fill { height: 100%; border-radius: 99px; background: var(--blue); transition: width .6s ease, background .3s; }
.bar-fill.warn { background: var(--orange); }
.bar-fill.crit { background: var(--red); }

.vps-foot { display: flex; justify-content: space-between; font-size: 12px; color: var(--text-soft); margin-top: 16px; border-top: 1px solid var(--border); padding-top: 12px; }
.vps-actions { display: flex; gap: 8px; margin-top: 14px; }
.vps-actions .btn { padding: 7px 14px; font-size: 13px; }

.empty { text-align: center; color: var(--text-soft); padding: 60px 0; font-size: 16px; }

/* Modal */
.modal { position: fixed; inset: 0; z-index: 100; display: flex; align-items: center; justify-content: center; }
.modal-backdrop { position: absolute; inset: 0; background: rgba(0, 0, 0, 0.4); backdrop-filter: blur(4px); }
.modal-card {
  position: relative; background: var(--bg); border-radius: 22px; width: min(820px, 94vw);
  max-height: 90vh; overflow: hidden; box-shadow: var(--shadow-lg); display: flex; flex-direction: column;
}
.modal-sm { width: min(620px, 92vw); }
.modal-sm .modal-head { padding: 32px 44px 12px; }
.modal-sm .modal-body { padding: 20px 44px 40px; }
.modal-head { display: flex; align-items: flex-start; justify-content: space-between; padding: 22px 26px 14px; }
.modal-title { font-size: 22px; font-weight: 600; margin: 0; letter-spacing: -0.02em; }
.modal-host { font-size: 13px; color: var(--text-soft); margin: 4px 0 0; }
.modal-close { background: none; border: none; font-size: 28px; line-height: 1; color: var(--text-soft); cursor: pointer; }
.modal-body { padding: 22px 26px 26px; overflow-y: auto; }
.detail-body { display: flex; flex-direction: column; gap: 24px; }

/* Metrics */
.metric-grid { display: grid; grid-template-columns: repeat(2, 1fr); gap: 14px; margin-bottom: 20px; }
.metric { background: var(--bg-soft); border-radius: 14px; padding: 14px 16px; }
.metric-k { font-size: 12px; color: var(--text-soft); }
.metric-v { font-size: 20px; font-weight: 600; margin-top: 4px; font-variant-numeric: tabular-nums; }
.chart-block { margin-bottom: 18px; }
.chart-title { font-size: 13px; color: var(--text-soft); margin-bottom: 8px; }
.chart { width: 100%; }

/* Terminal + workbench (terminal & files on the same screen) */
.term-status { font-size: 13px; color: var(--text-soft); margin-bottom: 10px; }
.term-toolbar { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin-bottom: 10px; }
.term-toolbar .term-status { margin-bottom: 0; }
.term-actions { display: flex; gap: 8px; flex-shrink: 0; }
.terminal { background: #1e1e1e; border-radius: 12px; padding: 8px; height: 384px; overflow: hidden; }
.xterm { padding: 6px; }
.term-pane { width: 100%; height: 100%; background: #1e1e1e; }
.term-stash { display: none; }
.btn-small { padding: 6px 12px; font-size: 13px; }

/* Modal header actions (minimize + close) */
.modal-head-actions { display: flex; align-items: center; gap: 6px; flex-shrink: 0; }
.modal-icon-btn {
  background: none; border: none; font-size: 22px; line-height: 1; color: var(--text-soft);
  cursor: pointer; width: 32px; height: 32px; border-radius: 50%; transition: background .15s, color .15s;
}
.modal-icon-btn:hover { background: var(--bg-soft); color: var(--text); }

/* Background terminal dock */
.term-dock {
  position: fixed; left: 0; right: 0; bottom: 0; z-index: 90;
  display: flex; align-items: center; gap: 10px; padding: 10px 16px;
  background: rgba(255, 255, 255, 0.86); backdrop-filter: saturate(180%) blur(20px);
  -webkit-backdrop-filter: saturate(180%) blur(20px);
  border-top: 1px solid var(--border); box-shadow: 0 -6px 24px rgba(0, 0, 0, 0.06);
  overflow-x: auto;
}
.dock-label { font-size: 13px; font-weight: 600; color: var(--text-soft); flex-shrink: 0; }
.dock-item {
  display: inline-flex; align-items: center; gap: 8px; flex-shrink: 0;
  background: var(--bg-soft); border: 1px solid var(--border); border-radius: 980px;
  padding: 7px 8px 7px 14px; font-size: 13px; cursor: pointer; transition: border-color .15s, background .15s;
}
.dock-item:hover { border-color: var(--blue); background: rgba(0, 113, 227, 0.05); }
.dock-item.active { border-color: var(--blue); background: rgba(0, 113, 227, 0.08); }
.dock-dot { width: 8px; height: 8px; border-radius: 50%; background: var(--red); flex-shrink: 0; }
.dock-dot.online { background: var(--green); box-shadow: 0 0 0 3px rgba(52, 199, 89, 0.2); }
.dock-name { max-width: 180px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.dock-close {
  border: none; background: none; color: var(--text-soft); font-size: 15px; line-height: 1;
  cursor: pointer; padding: 0 4px; border-radius: 50%;
}
.dock-close:hover { color: var(--red); background: rgba(255, 59, 48, 0.12); }

.modal-wide { width: min(1080px, 96vw); }

/* Stacked panels: terminal -> files -> overview */
.panel { background: var(--bg); border-radius: 16px; }
.panel-head {
  display: flex; align-items: center; justify-content: space-between;
  gap: 16px; margin-bottom: 14px; flex-wrap: wrap;
}
.panel-title { font-size: 16px; font-weight: 600; margin: 0; }

/* command chips bar */
.cmd-bar {
  display: flex; align-items: center; gap: 10px;
  padding: 8px 10px; background: var(--bg-soft); border-radius: 12px; overflow: hidden;
  flex: 1; min-width: 260px;
}
.cmd-title { font-size: 13px; font-weight: 600; color: var(--text-soft); flex-shrink: 0; }
.cmd-chips { flex: 1; display: flex; gap: 8px; overflow-x: auto; min-width: 0; padding: 2px; }
.cmd-chips::-webkit-scrollbar { height: 4px; }
.cmd-chips::-webkit-scrollbar-thumb { background: var(--border); border-radius: 4px; }
.cmd-empty { font-size: 13px; color: var(--text-soft); padding: 4px 8px; }
.cmd-chip {
  display: inline-flex; align-items: center; gap: 4px; flex-shrink: 0;
  background: var(--bg); border: 1px solid var(--border); border-radius: 980px;
  padding: 5px 6px 5px 12px; font-size: 13px; cursor: pointer; transition: background .15s, border-color .15s;
}
.cmd-chip:hover { border-color: var(--blue); background: rgba(0, 113, 227, 0.04); }
.cmd-chip-label { max-width: 170px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.cmd-chip-del {
  border: none; background: none; color: var(--text-soft); font-size: 14px; line-height: 1;
  cursor: pointer; padding: 0 4px; border-radius: 50%;
}
.cmd-chip-del:hover { color: var(--red); background: rgba(255, 59, 48, 0.12); }

/* File manager */
.file-toolbar {
  display: flex; align-items: center; gap: 10px; flex-wrap: wrap;
}
.file-path {
  flex: 1; min-width: 120px; background: var(--bg-soft); border-radius: 10px;
  padding: 9px 14px; font-family: ui-monospace, Menlo, monospace; font-size: 13px;
  overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}
.file-actions { display: flex; gap: 8px; }
.file-table-wrap {
  background: var(--bg-soft); border-radius: 14px; overflow: auto; max-height: 460px;
}
.file-table { width: 100%; border-collapse: collapse; font-size: 14px; }
.file-table th {
  text-align: left; padding: 12px 16px; font-weight: 600; color: var(--text-soft);
  border-bottom: 1px solid var(--border); position: sticky; top: 0; background: var(--bg-soft);
}
.file-table td { padding: 11px 16px; border-bottom: 1px solid rgba(0,0,0,0.04); }
.file-table tr:hover td { background: rgba(0,0,0,0.03); }
.file-table tr:last-child td { border-bottom: none; }
.file-name { display: flex; align-items: center; gap: 10px; cursor: pointer; }
.file-icon { font-size: 18px; }
.file-dir { color: var(--blue); font-weight: 500; }
.file-actions-cell { display: flex; gap: 6px; }
.file-actions-cell .btn { padding: 5px 10px; font-size: 12px; }
.file-empty { text-align: center; color: var(--text-soft); padding: 50px 0; }

/* Editor */
.modal-lg { width: min(900px, 96vw); }
.editor-body { display: flex; flex-direction: column; gap: 14px; }
.editor-wrap {
  display: flex; border: 1px solid var(--border); border-radius: 12px; overflow: hidden;
  background: var(--bg); min-height: 360px; resize: vertical;
}
.editor-wrap:focus-within { border-color: var(--blue); box-shadow: 0 0 0 4px rgba(0, 113, 227, 0.12); }
.line-numbers {
  width: 54px; min-width: 54px; background: var(--bg-soft); border-right: 1px solid var(--border);
  padding: 14px 10px 14px 6px; font-family: ui-monospace, SFMono-Regular, Menlo, monospace;
  font-size: 13px; line-height: 1.5; text-align: right; color: var(--text-soft); overflow: hidden;
  user-select: none; margin: 0;
}
.editor-area {
  flex: 1; min-height: 360px; border: none; border-radius: 0; resize: none;
  padding: 14px; font-family: ui-monospace, SFMono-Regular, Menlo, monospace;
  font-size: 13px; line-height: 1.5; background: var(--bg); color: var(--text); outline: none;
}

/* VPS form */
.vps-form { text-align: left; }
.vps-form .field { padding: 14px 16px; }
select.field { padding-right: 44px; background-position: right 16px center; }
.form-actions { display: flex; justify-content: flex-end; gap: 12px; margin-top: 18px; align-items: center; }
.btn-secondary { background: var(--bg-soft); color: var(--text); }
.btn-secondary:hover { background: #ececef; }
.test-result { font-size: 13px; padding: 10px 12px; border-radius: 10px; margin-bottom: 10px; }
.test-result.ok { background: rgba(52, 199, 89, 0.1); color: #1d7c2b; }
.test-result.err { background: rgba(255, 59, 48, 0.1); color: #c41c14; }
.detail-error { background: rgba(255, 59, 48, 0.08); color: #c41c14; border-radius: 10px; padding: 10px 12px; font-size: 13px; margin-bottom: 14px; }
.vps-error { color: var(--red); font-size: 12px; margin-top: 8px; }

/* Footer */
.footer { text-align: center; padding: 30px; color: var(--text-soft); font-size: 13px; border-top: 1px solid var(--border); }

@media (max-width: 640px) {
  .hero-title { font-size: 34px; }
  .metric-grid { grid-template-columns: 1fr; }
}

/* ---------- Control-room visual system ----------
   A dark, low-glare operations console makes state changes and alerts easier
   to scan during long maintenance sessions. The original component hooks stay
   intact so this is a visual layer, not a feature rewrite. */
:root {
  --bg: #0a1020;
  --bg-soft: #111a2c;
  --bg-raised: #162238;
  --text: #ecf4ff;
  --text-soft: #8fa2bf;
  --blue: #63e6c4;
  --blue-hover: #8af2d6;
  --green: #6fe7a3;
  --red: #ff7d8b;
  --orange: #ffc66d;
  --border: rgba(159, 186, 224, 0.18);
  --card-radius: 16px;
  --shadow: 0 18px 44px rgba(0, 0, 0, .24);
  --shadow-lg: 0 30px 90px rgba(0, 0, 0, .52);
  font-family: "Microsoft YaHei", "微软雅黑", "Microsoft YaHei UI", sans-serif;
}

html, body { min-height: 100%; background: #0a1020; color: var(--text); }
body { position: relative; overflow-x: hidden; }
html { scrollbar-color: #52617a #0a1020; scrollbar-width: thin; }
* { scrollbar-color: #52617a #0a1020; scrollbar-width: thin; }
*::-webkit-scrollbar { width: 9px; height: 9px; }
*::-webkit-scrollbar-button { display: none; width: 0; height: 0; }
*::-webkit-scrollbar-track { background: #0a1020; }
*::-webkit-scrollbar-thumb { background: #52617a; border: 2px solid #0a1020; border-radius: 99px; }
*::-webkit-scrollbar-thumb:hover { background: #70839f; }
body::before {
  content: ""; position: fixed; inset: 0; z-index: -1; pointer-events: none; opacity: .42;
  background-image: linear-gradient(rgba(118, 150, 197, .055) 1px, transparent 1px), linear-gradient(90deg, rgba(118, 150, 197, .055) 1px, transparent 1px);
  background-size: 48px 48px; mask-image: linear-gradient(to bottom, #000, transparent 78%);
}
.nav { background: rgba(10, 16, 32, .78); border-bottom-color: var(--border); }
.nav-inner { height: 64px; max-width: 1240px; }
.nav-logo { color: var(--text); font-size: 16px; letter-spacing: .02em; }
.nav-logo::before { content: "◈"; color: var(--blue); margin-right: 10px; }
.nav-right { gap: 16px; }
.nav-user { color: var(--text-soft); }
.nav-link { color: var(--blue); }
.nav-link:hover { color: var(--blue-hover); }
.auth-view { min-height: calc(100vh - 64px); background: radial-gradient(900px 520px at 12% 8%, rgba(39, 124, 151, .22), transparent 64%), radial-gradient(700px 500px at 92% 88%, rgba(109, 75, 170, .16), transparent 65%), #0a1020; }
.auth-card { max-width: 430px; padding: 44px 38px; border: 1px solid var(--border); background: rgba(16, 27, 47, .88); box-shadow: var(--shadow-lg); backdrop-filter: blur(24px); text-align: left; }
.auth-card::before { content: "SECURE ACCESS / VPS CONTROL"; display: block; margin-bottom: 26px; color: var(--blue); font: 11px/1.2 "IBM Plex Mono", Consolas, monospace; letter-spacing: .16em; }
.auth-title { font-size: 30px; line-height: 1.2; }
.auth-sub { color: var(--text-soft); line-height: 1.7; }
.auth-tabs { background: rgba(7, 13, 25, .65); border: 1px solid var(--border); }
.auth-tab.active { background: var(--bg-raised); color: var(--text); box-shadow: none; }
.field { background: rgba(7, 13, 25, .62); border-color: var(--border); color: var(--text); border-radius: 10px; }
.field::placeholder { color: #60728f; }
.field:focus { border-color: var(--blue); box-shadow: 0 0 0 3px rgba(99, 230, 196, .15); }
.btn { border-radius: 10px; font-weight: 600; letter-spacing: .01em; }
.btn-primary { background: var(--blue); color: #07131b; }
.btn-primary:hover { background: var(--blue-hover); }
.btn-ghost, .btn-secondary { background: var(--bg-raised); color: var(--text); border: 1px solid var(--border); }
.btn-ghost:hover, .btn-secondary:hover { background: #1c2b45; border-color: rgba(99, 230, 196, .42); }
.btn-danger { background: rgba(215, 55, 78, .18); color: #ff9eaa; border: 1px solid rgba(255, 125, 139, .28); }
.btn-danger:hover { background: rgba(215, 55, 78, .3); }
.hero { max-width: 1240px; margin: 0 auto; padding: 74px 28px 48px; text-align: left; }
.hero::before { display: none; }
.hero-title { font-size: clamp(36px, 5vw, 64px); line-height: 1.08; max-width: 760px; color: #f5f9ff; }
.hero-sub { max-width: 680px; margin: 0; color: var(--text-soft); font-size: 16px; }
.hero-meta { display: flex; flex-wrap: wrap; gap: 10px; margin-top: 26px; color: var(--text-soft); font-size: 13px; }
.hero-meta > span { display: inline-flex; align-items: center; gap: 6px; padding: 8px 11px; border: 1px solid var(--border); border-radius: 8px; background: rgba(17, 26, 44, .68); }
.hero-meta b { color: var(--text); font: 600 14px "IBM Plex Mono", Consolas, monospace; }
.summary-live { color: var(--green) !important; }
.summary-live i { width: 7px; height: 7px; border-radius: 50%; background: var(--green); box-shadow: 0 0 0 4px rgba(111, 231, 163, .12); }
.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; }
.container { max-width: 1240px; padding-left: 28px; padding-right: 28px; }
.section-head { margin: 8px 0 22px; }
.section-title { font-size: 21px; letter-spacing: .01em; }
.section-actions { flex-wrap: wrap; justify-content: flex-end; }
.region-chip { background: var(--bg-soft); border-color: var(--border); color: var(--text-soft); border-radius: 8px; }
.region-chip.active { background: rgba(99, 230, 196, .14); border-color: rgba(99, 230, 196, .56); color: var(--blue); }
.selection-bar { background: rgba(17, 26, 44, .86); border-color: var(--border); box-shadow: var(--shadow); }
.vps-grid { grid-template-columns: repeat(auto-fit, minmax(300px, 1fr)); gap: 16px; }
.vps-card { background: linear-gradient(145deg, rgba(22, 34, 56, .96), rgba(14, 24, 42, .96)); border-color: var(--border); box-shadow: 0 10px 34px rgba(0, 0, 0, .22); }
.vps-card:hover { transform: translateY(-4px); border-color: rgba(99, 230, 196, .42); box-shadow: 0 18px 44px rgba(0, 0, 0, .34); }
.vps-name { font-size: 17px; }
.vps-host, .status-text, .meter-label, .vps-foot { color: var(--text-soft); }
.vps-region { color: var(--blue); background: rgba(99, 230, 196, .1); }
.bar { background: #0b1425; }
.bar-fill { background: var(--blue); width: 0; }
.vps-foot { border-top-color: var(--border); }
.empty { border: 1px dashed var(--border); border-radius: 16px; background: rgba(17, 26, 44, .55); }
.loading-state { grid-column: 1 / -1; display: flex; align-items: center; justify-content: center; gap: 12px; min-height: 160px; color: var(--text-soft); border: 1px dashed var(--border); border-radius: 16px; background: rgba(17, 26, 44, .55); }
.loading-orbit { width: 16px; height: 16px; border: 2px solid rgba(99, 230, 196, .22); border-top-color: var(--blue); border-radius: 50%; animation: orbit 800ms linear infinite; }
@keyframes orbit { to { transform: rotate(360deg); } }
.modal-backdrop { background: rgba(3, 7, 15, .72); }
.modal-card { background: #101b2f; border: 1px solid var(--border); }
.modal-host, .term-status, .chart-title { color: var(--text-soft); }
.panel, .metric, .cmd-bar, .file-table-wrap { background: rgba(7, 13, 25, .48); }
.metric { border: 1px solid rgba(159, 186, 224, .12); }
.metric-v { color: #f3f8ff; }
.terminal { border: 1px solid rgba(159, 186, 224, .16); background: #060a12; }
.term-dock { background: rgba(10, 16, 32, .9); border-top-color: var(--border); box-shadow: 0 -12px 30px rgba(0, 0, 0, .26); }
.dock-item { background: var(--bg-raised); border-color: var(--border); }
.dock-item:hover, .dock-item.active { border-color: rgba(99, 230, 196, .55); background: rgba(99, 230, 196, .1); }
.file-path, .file-table th { background: var(--bg-soft); }
.file-table td, .file-table th { border-bottom-color: var(--border); }
.file-table tr:hover td, .admin-table tbody tr:hover { background: rgba(99, 230, 196, .06); }
.editor-wrap, .editor-area { background: #0a1220; border-color: var(--border); color: var(--text); }
.line-numbers { background: var(--bg-soft); border-right-color: var(--border); }
.footer { border-top-color: var(--border); color: #647793; }
.table-wrap, .admin-table { background: rgba(16, 27, 47, .72); border-color: var(--border); }
.admin-table th { background: var(--bg-soft); }
.admin-note { background: rgba(111, 231, 163, .08); border-color: rgba(111, 231, 163, .22); color: var(--text-soft); }
.tag-default { background: #526581; }
button:focus-visible, input:focus-visible, textarea:focus-visible, select:focus-visible { outline: 2px solid var(--blue); outline-offset: 2px; }

@media (max-width: 760px) {
  .nav-inner, .container, .hero { padding-left: 18px; padding-right: 18px; }
  .nav-inner { height: 58px; }
  .hero { padding-top: 48px; }
  .hero-title { font-size: 38px; }
  .section-head { align-items: flex-start; gap: 16px; flex-direction: column; }
  .section-actions { width: 100%; justify-content: flex-start; }
  .section-actions .btn { flex: 1 1 auto; }
  .form-row { grid-template-columns: 1fr; gap: 0; }
  .modal-head, .modal-body { padding-left: 18px; padding-right: 18px; }
  .modal-sm .modal-head, .modal-sm .modal-body { padding-left: 22px; padding-right: 22px; }
  .file-toolbar { align-items: stretch; }
  .file-path { order: -1; flex-basis: 100%; }
}

/* Terminal is a work surface, not a decorative card. */
.terminal {
  height: 384px;
  padding: 0;
  border: 0;
  border-radius: 0;
  background: #05070b;
  box-shadow: none;
}
.term-pane, .terminal .xterm {
  width: 100%;
  height: 100%;
  padding: 0;
  background: #05070b;
}
.terminal .xterm-viewport {
  background: #05070b !important;
  scrollbar-color: #52617a #0b1019;
}

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

/* Final desktop balance: keep the first server row above the fold. */
.hero {
  padding-top: 42px;
  padding-bottom: 28px;
}
.hero::before {
  content: none;
  display: none;
}
.hero-title {
  max-width: 940px;
  font-size: clamp(34px, 4.1vw, 52px);
  line-height: 1.12;
  letter-spacing: -.035em;
  margin-bottom: 12px;
}
.hero-sub { font-size: 15px; line-height: 1.65; }
.hero-meta { margin-top: 18px; }
.section-head { margin-top: 6px; margin-bottom: 16px; }
.section-actions { gap: 8px; }
.section-actions .btn { padding: 10px 16px; }

@media (max-width: 760px) {
  .hero { padding-top: 34px; padding-bottom: 24px; }
  .hero-title { font-size: 34px; }
  .hero-meta { margin-top: 16px; }
}

@media (max-width: 820px) {
  .modal-wide { width: 96vw; }
  .panel-head { flex-direction: column; align-items: flex-start; }
  .cmd-bar { width: 100%; }
  .terminal { height: 312px; }
  .file-table-wrap { max-height: 320px; }
}

/* Prevent flex children inside the workbench from defining the viewport width. */
.modal-body, .detail-body, .panel, .panel-head, .panel-head > *, .metric-grid { min-width: 0; }
.modal-body { overflow-x: hidden; }
.file-head { align-items: flex-start; }
.file-head .panel-title { flex: 0 0 auto; }
.file-head .file-toolbar {
  flex: 1 1 100%;
  width: 100%;
  min-width: 0;
  display: grid;
  grid-template-columns: auto auto minmax(120px, 1fr) auto;
  align-items: center;
}
.file-path { min-width: 0; }
.file-actions { min-width: 0; display: flex; flex-wrap: wrap; justify-content: flex-end; }
.metric-grid { grid-template-columns: repeat(auto-fit, minmax(min(100%, 240px), 1fr)); }
.metric { min-width: 0; overflow: hidden; }
.metric-v { min-width: 0; overflow-wrap: anywhere; }
.cmd-bar { min-width: 0; max-width: 100%; }
.cmd-chips { min-width: 0; max-width: 100%; }
.panel-title { font-size: 15px; }
.metric { padding: 12px 14px; }
.metric-k { font-size: 11px; }
.metric-v { font-size: 16px; line-height: 1.35; }

@media (max-width: 720px) {
  .file-head .file-toolbar {
    grid-template-columns: 1fr 1fr;
  }
  .file-head .file-path,
  .file-head .file-actions { grid-column: 1 / -1; width: 100%; }
  .file-head .file-actions { justify-content: stretch; }
  .file-head .file-actions .btn { flex: 1 1 160px; }
}

/* Region badge on server cards */
.vps-region {
  display: inline-block;
  margin-left: 8px;
  padding: 1px 9px;
  font-size: 11px;
  font-weight: 600;
  line-height: 18px;
  color: var(--blue);
  background: rgba(0, 113, 227, 0.1);
  border-radius: 999px;
  vertical-align: middle;
}

/* Region classification filter */
.region-filter {
  display: flex; flex-wrap: wrap; gap: 8px;
  margin: 4px 0 18px;
}
.region-chip {
  padding: 6px 14px; font-size: 13px; cursor: pointer;
  border: 1px solid var(--border); border-radius: 999px;
  background: var(--bg); color: var(--text-soft);
  transition: all 0.15s ease;
}
.region-chip:hover { border-color: var(--blue); color: var(--blue); }
.region-chip.active { background: var(--blue); border-color: var(--blue); color: #fff; }

/* ---------- Admin console ---------- */
.admin-container { padding-top: 26px; padding-bottom: 40px; max-width: 1080px; }
.admin-section { margin-bottom: 34px; }
.table-wrap { overflow-x: auto; border: 1px solid var(--border); border-radius: 14px; background: var(--bg); }
.admin-table { width: 100%; border-collapse: collapse; font-size: 14px; }
.admin-table th, .admin-table td { padding: 12px 14px; text-align: left; border-bottom: 1px solid var(--border); white-space: nowrap; }
.admin-table th { background: var(--bg-soft); color: var(--text-soft); font-weight: 600; font-size: 13px; }
.admin-table tbody tr:last-child td { border-bottom: none; }
.admin-table tbody tr:hover { background: var(--bg-soft); }
.admin-table code { font-family: ui-monospace, SFMono-Regular, Menlo, monospace; }
.row-empty { text-align: center; color: var(--text-soft); padding: 22px; }
.field-sm { width: 160px; padding: 8px 10px; }
.field-xs { width: 64px; padding: 6px 8px; }

.admin-note { margin: 0 0 22px; padding: 12px 16px; background: rgba(26,162,96,0.08); border: 1px solid rgba(26,162,96,0.3); border-radius: 10px; color: var(--text-soft); font-size: 13px; line-height: 1.7; }
.admin-note strong { color: var(--text); }
.quota-edit { display: inline-flex; align-items: center; gap: 6px; }
.invite-actions { display: flex; gap: 10px; align-items: center; flex-wrap: wrap; }
.section-actions .field-sm { margin-right: 4px; }

.badge-ok { color: #1aa260; font-weight: 600; }
.badge-err { color: #e02424; font-weight: 600; }
.badge-warn { color: #d98200; font-weight: 600; }
.badge-muted { color: var(--text-soft); font-weight: 500; }
.tag-default { display: inline-block; margin-left: 6px; padding: 1px 7px; font-size: 11px; font-weight: 600; color: #fff; background: var(--text-soft); border-radius: 999px; }

.invite-result { margin: 10px 0 16px; display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
.invite-result code.invite-code {
  padding: 6px 12px; background: var(--bg-soft); border-radius: 8px; font-size: 15px; letter-spacing: 0.06em;
}
.invite-ok { color: #1aa260; font-weight: 600; }
.invite-err { color: #e02424; font-weight: 600; }
.invite-meta { color: var(--text-soft); font-size: 13px; }

.invite-ops { vertical-align: top; }
.invite-edit { margin-top: 8px; display: flex; flex-wrap: wrap; align-items: center; gap: 8px; padding: 8px; background: var(--bg-soft); border-radius: 8px; }
.invite-edit label { display: inline-flex; align-items: center; gap: 4px; font-size: 12px; color: var(--text-soft); }
.invite-edit .field-xs { width: 72px; }

.no-perm { padding: 60px 20px; text-align: center; color: var(--text-soft); font-size: 15px; }
