/* 超算工作台 — 浅色工具风（视觉沿用 CDU 工作台）
   白/暖灰为底，橙色只用于强调；动效只做颜色与透明度。 */

:root {
  color-scheme: light;
  --bg-rail: #f4f3f1;
  --bg-sub: #fafaf9;
  --surface: #ffffff;
  --surface-2: #fafaf9;
  --surface-3: #f4f3f1;
  --hover: rgba(28, 25, 23, .045);
  --press: rgba(28, 25, 23, .08);
  --line: #e9e7e4;
  --line-2: #dcd9d5;
  --text: #1c1917;
  --text-2: #4d4843;
  --muted: #78716c;
  --faint: #a8a29e;

  --accent: #ea580c;
  --accent-2: #c2410c;
  --accent-soft: #fff5ee;
  --accent-line: #fcd9bd;

  --good: #15803d;   --good-soft: #effaf2;
  --warn: #b45309;   --warn-soft: #fff8eb;
  --bad: #dc2626;    --bad-soft: #fef2f2;
  --info: #2563eb;   --info-soft: #eff5ff;

  --r-sm: 6px; --r: 8px; --r-lg: 12px;
  --shadow-1: 0 1px 2px rgba(28,25,23,.05);
  --shadow-2: 0 1px 2px rgba(28,25,23,.04), 0 6px 20px rgba(28,25,23,.07);
  --shadow-pop: 0 2px 6px rgba(28,25,23,.06), 0 16px 40px rgba(28,25,23,.14);

  --font: "Segoe UI Variable Text", "Segoe UI", -apple-system, BlinkMacSystemFont, "PingFang SC",
          "Microsoft YaHei UI", "Microsoft YaHei", "Noto Sans CJK SC", sans-serif;
  --mono: "Cascadia Mono", "JetBrains Mono", "SFMono-Regular", Consolas, "Sarasa Mono SC", monospace;
  --ease: cubic-bezier(.2, 0, 0, 1);
  --t: 120ms;
}

* { box-sizing: border-box; }
html, body { height: 100%; }
body {
  margin: 0; background: var(--surface); color: var(--text);
  font: 14px/1.55 var(--font); -webkit-font-smoothing: antialiased;
}
button, input, textarea, select { font: inherit; color: inherit; }
button { cursor: pointer; }
:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; border-radius: 4px; }
::selection { background: #fde2cf; }
[hidden] { display: none !important; }
h1, h2, h3, p { margin: 0; }
a { color: var(--accent-2); text-underline-offset: 3px; }
table, .tabular { font-variant-numeric: tabular-nums; }
code, pre, .mono { font-family: var(--mono); }
#root { height: 100%; }

* { scrollbar-width: thin; scrollbar-color: #d6d3d1 transparent; }
::-webkit-scrollbar { width: 10px; height: 10px; }
::-webkit-scrollbar-thumb { background: #dcd9d5; border-radius: 10px; border: 3px solid transparent; background-clip: padding-box; }
::-webkit-scrollbar-thumb:hover { background-color: #c7c2bd; }

/* ---------------------------------------------------------------- 布局 */
.app { display: grid; grid-template-columns: 216px 248px minmax(0, 1fr); height: 100vh; height: 100dvh; overflow: hidden; }
.rail { background: var(--bg-rail); border-right: 1px solid var(--line); display: flex; flex-direction: column; padding: 14px 10px 10px; min-height: 0; }
.sub  { background: var(--bg-sub); border-right: 1px solid var(--line); display: flex; flex-direction: column; min-height: 0; }
.main { min-width: 0; min-height: 0; position: relative; display: flex; flex-direction: column; }
.pane { display: flex; flex-direction: column; min-height: 0; flex: 1; position: relative; }

/* 品牌 */
.brand { display: flex; align-items: center; gap: 10px; padding: 4px 8px 18px; }
.brand-mark { width: 22px; height: 22px; border-radius: 6px; background: var(--accent); position: relative; flex: none; }
.brand-mark::after { content: ""; position: absolute; inset: 6px; border: 2px solid #fff; transform: rotate(45deg); border-radius: 1px; }
.brand-name { font-weight: 650; font-size: 15px; letter-spacing: -.01em; white-space: nowrap; }

/* 一级导航 */
.rail-nav { display: flex; flex-direction: column; gap: 2px; }
.nav-item {
  display: flex; align-items: center; gap: 10px; height: 34px; padding: 0 10px;
  border: 0; border-radius: var(--r); background: transparent; color: var(--text-2);
  text-align: left; text-decoration: none; font-weight: 500; white-space: nowrap;
  transition: background-color var(--t) var(--ease), color var(--t) var(--ease);
}
.nav-item:hover { background: var(--hover); color: var(--text); }
.nav-item:active { background: var(--press); }
.nav-item .i { color: var(--muted); }
.nav-item[aria-current="page"] { background: var(--surface); color: var(--text); box-shadow: var(--shadow-1), inset 0 0 0 1px var(--line); }
.nav-item[aria-current="page"] .i { color: var(--accent); }

.rail-foot { margin-top: auto; padding-top: 10px; border-top: 1px solid var(--line); display: flex; flex-direction: column; gap: 6px; }
.identity { display: flex; align-items: center; gap: 10px; padding: 6px 8px; min-width: 0; }
.avatar { width: 30px; height: 30px; border-radius: 50%; display: grid; place-items: center; flex: none;
  background: #292524; color: #fff; font-weight: 650; font-size: 13px; }
.identity-text { display: flex; flex-direction: column; min-width: 0; line-height: 1.3; }
.identity-name { font-weight: 600; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.identity-role { font-size: 12px; color: var(--muted); }
.vpn-action { display: grid; gap: 5px; padding-bottom: 4px; }
.vpn-feedback { font-size: 12px; color: var(--muted); padding: 0 4px; line-height: 1.5; overflow-wrap: anywhere; }
.vpn-feedback.error { color: var(--bad); }

.dot { width: 7px; height: 7px; border-radius: 50%; background: #c7c2bd; flex: none; display: inline-block; }
.dot.on { background: #22a559; box-shadow: 0 0 0 3px rgba(34,165,89,.14); }
.dot.busy { background: #e5a100; animation: pulse 1.2s ease-in-out infinite; }
.dot.err { background: var(--bad); }
@keyframes pulse { 50% { opacity: .35; } }

/* 二级栏 */
.sub-head { padding: 18px 16px 10px; }
.sub-title { font-size: 13px; font-weight: 650; color: var(--text); }
.sub-kicker { font-size: 12px; color: var(--muted); margin-top: 2px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.sub-body { flex: 1; min-height: 0; overflow-y: auto; padding: 4px 8px 12px; }
.sub-nav { display: flex; flex-direction: column; gap: 1px; }
.sub-group { font-size: 11.5px; color: var(--faint); font-weight: 600; padding: 14px 8px 6px; letter-spacing: .02em; }
.sub-item {
  width: 100%; display: flex; align-items: center; gap: 9px; height: 32px; padding: 0 8px; border: 0; border-radius: var(--r-sm);
  background: transparent; color: var(--text-2); text-align: left; min-width: 0; text-decoration: none;
  transition: background-color var(--t) var(--ease), color var(--t) var(--ease);
}
.sub-item:hover { background: var(--hover); color: var(--text); }
.sub-item:active { background: var(--press); }
.sub-item[aria-current="page"] { background: var(--accent-soft); color: var(--accent-2); font-weight: 550; }
.sub-item[aria-current="page"] .i { color: var(--accent); }
.sub-item .i { color: var(--muted); }
.sub-item .label { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.sub-note { margin: 10px 8px 0; font-size: 12px; color: var(--muted); line-height: 1.6; }

/* 文件夹树 */
.tree-group { display: flex; align-items: center; justify-content: space-between; padding-right: 2px; }
.tree-tools .btn { width: 26px; height: 26px; }
.tree-tools .i svg { width: 14px; height: 14px; }
.tree { display: flex; flex-direction: column; gap: 1px; }
.tree-row {
  display: flex; align-items: center; gap: 4px; height: 30px; padding-right: 8px; border-radius: var(--r-sm); min-width: 0;
  color: var(--text-2); cursor: pointer; user-select: none;
  transition: background-color var(--t) var(--ease), color var(--t) var(--ease);
}
.tree-row:hover { background: var(--hover); color: var(--text); }
.tree-row:active { background: var(--press); }
.tree-row[aria-current="true"] { background: var(--accent-soft); color: var(--accent-2); font-weight: 550; }
.tree-row[aria-current="true"] .tree-ico { color: var(--accent); }
.tree-ico { color: var(--muted); margin: 0 2px; }
.tree-label { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.tree-chev { width: 20px; height: 24px; display: grid; place-items: center; flex: none; padding: 0; border: 0; border-radius: 4px; background: transparent; color: var(--faint); }
.tree-chev:hover { background: var(--press); color: var(--text-2); }
.tree-chev .i svg { width: 12px; height: 12px; stroke-width: 2.2; transition: transform var(--t) var(--ease); }
.tree-node[data-open="true"] > .tree-row .tree-chev .i svg { transform: rotate(90deg); }
.tree-chev.leaf { visibility: hidden; }

/* 二级栏与主区的容器：常驻页面和临时页面叠放，只显示一个 */
.sub-stack { display: flex; flex-direction: column; min-height: 0; background: var(--bg-sub); border-right: 1px solid var(--line); }
.sub-stack > .sub-slot { flex: 1; min-height: 0; display: flex; flex-direction: column; }
.sub-stack .sub { flex: 1; border-right: 0; }
.main-slot { flex: 1; min-height: 0; display: flex; flex-direction: column; }

/* ---------------------------------------------------------------- 主区 */
.page-head { display: flex; align-items: flex-start; gap: 16px; padding: 22px 32px 14px; flex: none; }
.page-title { font-size: 20px; line-height: 1.3; font-weight: 650; letter-spacing: -.015em; }
.page-meta { font-size: 12.5px; color: var(--muted); margin-top: 3px; display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.page-actions { margin-left: auto; display: flex; align-items: center; gap: 8px; flex-wrap: wrap; justify-content: flex-end; }
.page-body { flex: 1; min-height: 0; overflow-y: auto; padding: 4px 32px 32px; }
.page-body.flush { padding: 0; overflow: hidden; display: flex; flex-direction: column; }
.stack { display: flex; flex-direction: column; gap: 16px; }
.row { display: flex; align-items: center; gap: 8px; }
.grow { flex: 1; min-width: 0; }
.muted { color: var(--muted); }
.fine { font-size: 12px; color: var(--muted); line-height: 1.6; }

/* 标签与状态 */
.tag { display: inline-flex; align-items: center; gap: 6px; height: 22px; padding: 0 9px; border-radius: 11px; font-size: 12px; font-weight: 550; white-space: nowrap; background: var(--surface-3); color: var(--text-2); }
.tag::before { content: ""; width: 6px; height: 6px; border-radius: 50%; background: currentColor; }
.tag.good { background: var(--good-soft); color: var(--good); }
.tag.warn { background: var(--warn-soft); color: var(--warn); }
.tag.bad { background: var(--bad-soft); color: var(--bad); }
.state { display: inline-flex; align-items: center; gap: 6px; font-size: 12.5px; font-weight: 550; white-space: nowrap; color: var(--text-2); }
.state::before { content: ""; width: 7px; height: 7px; border-radius: 50%; background: currentColor; }
.state.good { color: var(--good); } .state.warn { color: var(--warn); } .state.bad { color: var(--bad); }
.state.info { color: var(--info); } .state.muted { color: var(--muted); }

/* 按钮 */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 6px; height: 32px; padding: 0 12px;
  border: 1px solid var(--line-2); border-radius: var(--r); background: var(--surface); color: var(--text);
  font-weight: 550; font-size: 13px; white-space: nowrap; box-shadow: var(--shadow-1); text-decoration: none;
  transition: background-color var(--t) var(--ease), border-color var(--t) var(--ease), color var(--t) var(--ease);
}
.btn:hover { background: var(--surface-2); border-color: #cfcbc6; }
.btn:active { background: var(--surface-3); }
.btn:disabled { opacity: .5; cursor: not-allowed; }
.btn.primary { background: var(--accent); border-color: var(--accent); color: #fff; box-shadow: 0 1px 2px rgba(194,65,12,.25); }
.btn.primary:hover { background: #dc4f08; border-color: #dc4f08; }
.btn.primary:active { background: var(--accent-2); }
.btn.ghost { border-color: transparent; background: transparent; box-shadow: none; color: var(--text-2); }
.btn.ghost:hover { background: var(--hover); color: var(--text); }
.btn.ghost:active { background: var(--press); }
.btn.danger { color: var(--bad); }
.btn.block { width: 100%; }
.btn.sm { height: 28px; padding: 0 10px; font-size: 12.5px; }
.icon-btn { width: 32px; padding: 0; }
.icon-btn.sm { width: 28px; height: 28px; }
.icon-btn[aria-pressed="true"] { color: var(--accent); }
.spin .i svg, .i.spin svg { animation: spin .8s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }

.i { display: inline-grid; place-items: center; flex: none; line-height: 0; }
.i svg { width: 16px; height: 16px; stroke: currentColor; fill: none; stroke-width: 1.75; stroke-linecap: round; stroke-linejoin: round; }
.i.xl svg { width: 28px; height: 28px; stroke-width: 1.5; }

/* 分段控件 */
.seg { display: inline-flex; padding: 2px; gap: 2px; border-radius: var(--r); background: var(--surface-3); border: 1px solid var(--line); }
.seg button {
  height: 26px; padding: 0 9px; border: 0; border-radius: 6px; background: transparent; color: var(--text-2);
  font-size: 12.5px; font-weight: 550; display: inline-flex; align-items: center; gap: 6px;
  transition: background-color var(--t) var(--ease), color var(--t) var(--ease);
}
.seg button:hover { color: var(--text); }
.seg button[aria-pressed="true"] { background: var(--surface); color: var(--text); box-shadow: var(--shadow-1), 0 0 0 1px var(--line); }

/* 卡片 */
.card { min-width: 0; background: var(--surface); border: 1px solid var(--line); border-radius: var(--r-lg); overflow: hidden; }
.card-head { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; padding: 12px 18px; border-bottom: 1px solid var(--line); min-height: 52px; }
.card-title { font-weight: 600; font-size: 13.5px; }
.card-head .toolbar { margin-left: auto; }
.card > .table-wrap { border: 0; border-radius: 0; }
.toolbar { display: flex; flex-wrap: wrap; align-items: center; gap: 6px; }

/* 统计块 */
.stats { display: grid; grid-template-columns: repeat(auto-fit, minmax(170px, 1fr)); gap: 12px; }
.stat { padding: 14px 16px; border: 1px solid var(--line); border-radius: var(--r-lg); background: var(--surface); }
.stat-label { font-size: 12px; color: var(--muted); display: flex; align-items: center; gap: 6px; }
.stat-label .i { color: var(--faint); }
.stat-value { font-size: 24px; font-weight: 600; letter-spacing: -.02em; margin-top: 4px; font-variant-numeric: tabular-nums; }

/* 提示条 */
.note { display: flex; gap: 10px; align-items: flex-start; padding: 10px 14px; border-radius: var(--r); font-size: 13px; line-height: 1.6; background: var(--surface-2); border: 1px solid var(--line); color: var(--text-2); }
.note .i { margin-top: 2px; }
.note.warn { background: var(--warn-soft); border-color: #f8e3bd; color: #78350f; } .note.warn .i { color: var(--warn); }
.note.bad  { background: var(--bad-soft);  border-color: #fbd5d5; color: #7f1d1d; } .note.bad .i  { color: var(--bad); }
.note.info { background: var(--info-soft); border-color: #d6e4ff; color: #1e3a8a; } .note.info .i { color: var(--info); }

/* 空状态 */
.empty { flex: 1; display: flex; flex-direction: column; align-items: center; justify-content: center; text-align: center; padding: 44px 24px; color: var(--muted); gap: 6px; min-height: 200px; }
.empty .i { color: var(--faint); margin-bottom: 6px; }
.empty-title { color: var(--text); font-weight: 600; font-size: 15px; }
.empty-text { max-width: 420px; font-size: 13px; line-height: 1.7; }
.empty .btn { margin-top: 12px; }
.empty.compact { min-height: 0; padding: 28px 16px; }

/* 表格 */
.table-wrap { border: 1px solid var(--line); border-radius: var(--r-lg); overflow: auto; background: var(--surface); }
table { width: 100%; border-collapse: collapse; font-size: 13px; }
th { text-align: left; font-weight: 550; color: var(--muted); font-size: 12px; background: var(--surface-2); padding: 8px 18px; border-bottom: 1px solid var(--line); white-space: nowrap; position: sticky; top: 0; }
td { padding: 9px 18px; border-bottom: 1px solid var(--line); white-space: nowrap; vertical-align: middle; }
tr:last-child td { border-bottom: 0; }
tbody tr { transition: background-color var(--t); }
tbody tr:hover { background: var(--surface-2); }
td code { font-size: 12.5px; background: var(--surface-3); padding: 1px 6px; border-radius: 4px; }
td .toolbar { flex-wrap: nowrap; }

/* 骨架 */
.skel { background: linear-gradient(90deg, #f1efed 0%, #f8f7f5 50%, #f1efed 100%); background-size: 200% 100%; animation: shimmer 1.3s linear infinite; border-radius: 6px; }
@keyframes shimmer { to { background-position: -200% 0; } }

/* 输入 */
.input { width: 100%; height: 36px; border: 1px solid var(--line-2); border-radius: var(--r); padding: 0 12px; background: var(--surface); outline: 0; transition: border-color var(--t), box-shadow var(--t); }
.input:focus { border-color: var(--accent); box-shadow: 0 0 0 3px rgba(234,88,12,.12); }
.input.select { appearance: none; width: auto; min-width: 200px; max-width: 340px; height: 32px; padding-right: 30px; text-overflow: ellipsis;
  background: var(--surface) url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%2378716c' stroke-width='2' stroke-linecap='round'%3E%3Cpath d='m6 9 6 6 6-6'/%3E%3C/svg%3E") no-repeat right 9px center / 14px; }
.form { display: grid; gap: 14px; }
.form label { display: grid; gap: 6px; font-size: 13px; font-weight: 600; color: var(--text-2); }
.form label .input { font-weight: 400; color: var(--text); }
.form input[type="file"] { height: auto; padding: 8px; }
.form-actions { display: flex; justify-content: flex-end; gap: 8px; margin-top: 2px; }

/* 日志输出 */
.console { margin: 0; min-height: 280px; max-height: calc(100vh - 260px); overflow: auto; padding: 14px 16px; background: #111113; color: #e4e4e7;
  font-size: 12.5px; line-height: 1.65; white-space: pre-wrap; overflow-wrap: anywhere; }
.downloads { display: flex; flex-wrap: wrap; gap: 6px; padding: 12px 18px; border-top: 1px solid var(--line); background: var(--surface-2); align-items: center; }
.downloads .fine { margin-right: 4px; }

/* ---------------------------------------------------------------- 文件管理 */
.fm-bar { display: flex; flex-wrap: wrap; align-items: center; gap: 8px 6px; padding: 0 24px 10px; flex: none; }
.crumbs { flex: 1; min-width: 140px; display: flex; align-items: center; height: 34px; padding: 0 6px; border: 1px solid var(--line); border-radius: var(--r); background: var(--surface-2); overflow: hidden; }
.crumb { border: 0; background: transparent; height: 26px; padding: 0 7px; border-radius: 5px; color: var(--text-2); white-space: nowrap; font-size: 13px; display: inline-flex; align-items: center; gap: 6px; max-width: 220px; overflow: hidden; text-overflow: ellipsis; flex: none; }
.crumb:hover { background: var(--hover); color: var(--text); }
.crumb:last-child { color: var(--text); font-weight: 600; }
.crumb-sep { color: #cfcac5; font-size: 12px; padding: 0 1px; flex: none; }
.fm-split { flex: 1; min-height: 0; display: flex; }
.fm-left { flex: 1; min-width: 0; display: flex; flex-direction: column; }
.fm-files { flex: 1; min-height: 110px; min-width: 0; display: flex; flex-direction: column; position: relative; }
.fm-body { flex: 1; min-height: 0; overflow-y: auto; padding: 6px 24px 16px; position: relative; outline: none; }
.fm-status { flex: none; display: flex; align-items: center; gap: 10px; height: 34px; padding: 0 24px; border-top: 1px solid var(--line); font-size: 12px; color: var(--muted); background: var(--surface); white-space: nowrap; overflow: hidden; }
.fm-status b { color: var(--text-2); font-weight: 550; }
.fm-status .sep { color: #d6d3d1; }

.tiles { display: grid; grid-template-columns: repeat(auto-fill, minmax(112px, 1fr)); gap: 4px; }
.tile { border: 1px solid transparent; background: transparent; border-radius: var(--r-lg); padding: 14px 8px 10px; display: flex; flex-direction: column; align-items: center; gap: 8px; color: var(--text-2); min-width: 0; user-select: none;
  transition: background-color var(--t) var(--ease), border-color var(--t) var(--ease); }
.tile:hover { background: var(--surface-2); }
.tile[aria-selected="true"] { background: var(--accent-soft); border-color: var(--accent-line); color: var(--text); }
.tile-name { font-size: 12.5px; line-height: 1.35; text-align: center; width: 100%; overflow: hidden; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; word-break: break-all; }

.ficon { position: relative; width: 44px; height: 44px; display: grid; place-items: center; flex: none; }
.ficon svg { width: 44px; height: 44px; }
.ficon .ext { position: absolute; bottom: 7px; left: 50%; transform: translateX(-50%); font: 700 8.5px/1 var(--font); letter-spacing: .02em; color: #fff; padding: 2px 3px; border-radius: 3px; background: #78716c; max-width: 34px; overflow: hidden; }
.ficon.sm { width: 20px; height: 20px; }
.ficon.sm svg { width: 20px; height: 20px; }
.ficon.sm .ext { display: none; }

.flist { width: 100%; border-collapse: separate; border-spacing: 0; }
.flist th { background: var(--surface); z-index: 1; padding: 8px 14px; }
.flist td { border-bottom: 1px solid #f1efec; padding: 6px 14px; cursor: default; user-select: none; }
.flist td.name { display: flex; align-items: center; gap: 10px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; max-width: 0; min-width: 100%; }
.flist td.name span { overflow: hidden; text-overflow: ellipsis; }
.flist tr[aria-selected="true"] td { background: var(--accent-soft); }
.flist td.dim { color: var(--muted); font-size: 12.5px; }
.flist .r { text-align: right; }

.drop { position: absolute; inset: 8px; border: 2px dashed var(--accent); border-radius: var(--r-lg); background: rgba(255,245,238,.9); display: grid; place-items: center; color: var(--accent-2); font-weight: 600; z-index: 5; pointer-events: none; }
.drop > div { display: flex; flex-direction: column; align-items: center; gap: 8px; }

.fm-vres, .fm-hres { flex: none; position: relative; z-index: 2; }
.fm-vres { height: 12px; cursor: row-resize; }
.fm-hres { width: 12px; cursor: col-resize; }
.fm-vres::after, .fm-hres::after { content: ''; position: absolute; background: var(--line); border-radius: 2px; transition: background-color var(--t) var(--ease); }
.fm-vres::after { left: 24px; right: 24px; top: 5px; height: 2px; }
.fm-hres::after { top: 0; bottom: 16px; left: 5px; width: 2px; }
.fm-vres:hover::after, .fm-hres:hover::after, .fm-vres.drag::after, .fm-hres.drag::after { background: var(--accent); }
.fm-term { flex: none; height: var(--term-h, 300px); padding: 0 24px 16px; display: flex; min-height: 0; }
.fm-term .term-wrap { margin: 0; }
.fm-term.fold { height: auto; }
.fm-term.fold .term-wrap { flex: none; }
.fm-term.fold .term-host, .fm-term.fold .term-over { display: none; }
.fm-left.max .fm-files { display: none; }
.fm-left.max .fm-term { flex: 1; height: auto; }
.fm-preview { flex: none; width: var(--prev-w, 440px); min-width: 0; padding: 0 24px 16px 0; display: flex; }

/* 文件内容预览 */
.fp { flex: 1; min-width: 0; min-height: 0; display: flex; flex-direction: column; border: 1px solid var(--line); border-radius: var(--r-lg); background: var(--surface); overflow: hidden; box-shadow: var(--shadow-1); }
.fp-head { flex: none; display: flex; align-items: center; gap: 8px; padding: 10px 10px 10px 14px; border-bottom: 1px solid var(--line); min-height: 52px; }
.fp-title { flex: 1; min-width: 0; }
.fp-name { display: flex; align-items: center; gap: 8px; font-weight: 600; font-size: 13.5px; min-width: 0; }
.fp-fname { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.fp-meta { font-size: 12px; color: var(--muted); margin-top: 2px; }
.fp-tools { display: flex; align-items: center; gap: 2px; flex: none; }
.fp-body { flex: 1; min-height: 0; overflow: auto; }
.fp-body .empty { padding: 48px 20px; }
.fp-note { display: flex; align-items: center; justify-content: space-between; gap: 8px; padding: 8px 14px; font-size: 12px; color: var(--muted); }
.fp-pane[hidden] { display: none; }
.fp-img { padding: 14px; display: grid; place-items: center; }
.fp-img img { max-width: 100%; height: auto; border-radius: var(--r); border: 1px solid var(--line); background: repeating-conic-gradient(#f3f2f0 0 25%, #fff 0 50%) 0 0 / 16px 16px; }
.fp-struct { padding: 0 12px 12px; }
.tree-kids[hidden] { display: none; }
pre.code { margin: 0; font-size: 12.5px; line-height: 1.65; color: #3a3531; }
pre.code.lines { counter-reset: ln; padding: 4px 0 12px; white-space: pre-wrap; overflow-wrap: anywhere; }
pre.code.lines .ln { display: flex; padding-left: 12px; padding-right: 14px; }
pre.code.lines .ln::before { counter-increment: ln; content: counter(ln); flex: none; width: 4ch; margin-right: 12px; text-align: right; color: #c2bcb6; user-select: none; }

/* ---------------------------------------------------------------- 终端 */
.term-page { padding: 0 24px 20px; }
.term-wrap { flex: 1; min-height: 0; border-radius: var(--r-lg); background: #111113; border: 1px solid #1f1f22; overflow: hidden; position: relative; box-shadow: var(--shadow-2); display: flex; flex-direction: column; }
.term-bar { flex: none; height: 36px; display: flex; align-items: center; gap: 10px; padding: 0 8px 0 14px; border-bottom: 1px solid #232326; color: #a1a1aa; font-size: 12px; font-family: var(--mono); }
.term-bar .dot.on { box-shadow: 0 0 0 3px rgba(34,165,89,.2); }
.term-bar .btn { background: #1c1c1f; border-color: #2e2e33; color: #d4d4d8; box-shadow: none; height: 26px; font-family: var(--font); }
.term-bar .btn:hover { background: #26262a; }
.term-bar .btn.icon-btn { width: 26px; padding: 0; background: transparent; border-color: transparent; color: #a1a1aa; }
.term-bar .btn.icon-btn:hover { background: #26262a; color: #e4e4e7; }
.term-bar .btn.icon-btn .i svg { width: 14px; height: 14px; }
.term-name { white-space: nowrap; flex: none; }
.term-bar > .grow { flex: 1; }
.term-cwd { min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; color: #e4e4e7; }
.term-cwd:not(:empty)::before { content: '·'; margin-right: 10px; color: #52525b; }
.term-hint { color: #fbbf24; font-family: var(--font); white-space: nowrap; }
.term-bar .btn.icon-btn[aria-pressed="true"] { color: #fb923c; }
.term-tools { display: flex; align-items: center; gap: 2px; flex: none; }
.term-host { flex: 1; min-height: 0; padding: 10px 4px 6px 14px; overflow: hidden; }
.term-host .xterm { height: 100%; }
.term-host .xterm-viewport { scrollbar-color: #3f3f46 transparent; }
.term-over { position: absolute; inset: 36px 0 0; display: grid; place-items: center; background: rgba(17,17,19,.72); color: #e4e4e7; text-align: center; }
.term-over .btn { margin-top: 12px; }

/* ---------------------------------------------------------------- 登录 */
.login-page { min-height: 100vh; min-height: 100dvh; display: grid; place-items: center; padding: 18px; background: var(--bg-rail); }
.login { width: min(100%, 400px); padding: 28px 28px 24px; background: var(--surface); border: 1px solid var(--line); border-radius: 16px; box-shadow: var(--shadow-2); display: grid; gap: 22px; }
.login .brand { padding: 0; }
.login-title { font-size: 20px; font-weight: 650; letter-spacing: -.015em; }
.login-sub { font-size: 13px; color: var(--muted); margin-top: 4px; }
.login .form-actions .btn { width: 100%; height: 38px; font-size: 14px; }

/* ---------------------------------------------------------------- 浮层 */
dialog { width: min(92vw, 480px); max-height: 90vh; border: 1px solid var(--line); border-radius: var(--r-lg); padding: 0; color: var(--text); background: var(--surface); box-shadow: var(--shadow-pop); }
dialog[open] { animation: pop 140ms var(--ease); }
dialog::backdrop { background: rgba(28,25,23,.32); }
@keyframes pop { from { opacity: 0; } }
.dialog-head { display: flex; align-items: center; justify-content: space-between; padding: 12px 12px 12px 18px; border-bottom: 1px solid var(--line); }
.dialog-head h2 { font-size: 15px; font-weight: 650; }
.dialog-head form { margin: 0; }
#dialog-body { padding: 16px 18px 18px; }
#dialog-body p { font-size: 13.5px; color: var(--text-2); }

.toasts { position: fixed; left: 50%; bottom: 24px; transform: translateX(-50%); display: flex; flex-direction: column; align-items: center; gap: 8px; z-index: 60; pointer-events: none; }
.toast { pointer-events: auto; display: flex; align-items: center; gap: 8px; padding: 9px 14px; border-radius: 10px; background: #1c1917; color: #fafaf9; font-size: 13px; box-shadow: var(--shadow-pop); animation: toast-in 180ms var(--ease); max-width: min(520px, 92vw); }
.toast.out { opacity: 0; transition: opacity 200ms; }
.toast .i { color: #a8a29e; } .toast.good .i { color: #4ade80; } .toast.bad .i { color: #f87171; }
@keyframes toast-in { from { opacity: 0; transform: translateY(6px); } }

/* ---------------------------------------------------------------- 自适应 */
@media (max-width: 1080px) {
  .app { grid-template-columns: 64px 220px minmax(0, 1fr); }
  .rail .brand-name, .nav-item span:not(.i), .identity-text, .rail-foot .btn span { display: none; }
  .rail .brand { justify-content: center; padding-left: 0; padding-right: 0; }
  .nav-item { justify-content: center; padding: 0; }
  .identity { justify-content: center; padding: 6px 0; }
  .rail-foot .btn { padding: 0; }
  .vpn-feedback { display: none; }
}
@media (max-width: 900px) {
  .fm-hres, .fm-preview { display: none !important; }
}
@media (max-width: 760px) {
  .app { grid-template-columns: minmax(0, 1fr); grid-template-rows: auto minmax(0, 1fr) auto; }
  .rail { grid-row: 3; flex-direction: row; align-items: center; padding: 4px 6px calc(4px + env(safe-area-inset-bottom)); border-right: 0; border-top: 1px solid var(--line); }
  .rail .brand { display: none; }
  .rail-nav { flex-direction: row; flex: 1; gap: 0; justify-content: space-around; }
  .nav-item { flex: 1; flex-direction: column; justify-content: center; gap: 2px; height: auto; padding: 6px 2px; font-size: 11px; }
  .nav-item span:not(.i) { display: block; }
  .nav-item[aria-current="page"] { box-shadow: none; background: transparent; color: var(--accent-2); }
  .rail-foot { margin: 0; padding: 0 0 0 4px; border-top: 0; flex-direction: row; align-items: center; }
  .identity { display: none; }
  .vpn-action { padding: 0; }
  .rail-foot .btn { width: 36px; height: 36px; }
  .sub-stack { grid-row: 1; border-right: 0; border-bottom: 1px solid var(--line); }
  .sub-head, .sub-extra { display: none; }
  .sub-body { padding: 6px 8px; overflow-x: auto; }
  .sub-nav { flex-direction: row; }
  .sub-item { width: auto; flex: none; }
  .main { grid-row: 2; }
  .page-head { padding: 14px 12px 10px; gap: 8px; flex-wrap: wrap; }
  .page-title { font-size: 18px; }
  .page-actions { margin-left: 0; justify-content: flex-start; }
  .page-body { padding: 4px 12px 20px; }
  .fm-bar { padding: 0 12px 8px; }
  .fm-body { padding: 6px 12px 12px; }
  .fm-status { padding: 0 12px; }
  .term-page { padding: 0 12px 12px; }
  .fm-term { padding: 0 12px 12px; }
  .toasts { bottom: 76px; }
}
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: 1ms !important; transition-duration: 1ms !important; }
}
