/* 天枢服务器后台：公共样式（2026-11-29 新界面，照用户通过的设计稿 neo-后台设计稿.html）。
   性能优先：不用模糊、大阴影、动画、过渡、渐变、网络字体和图片；图标是页面里画的线条。 */
:root {
  --bg: #f4f5f7;
  --card: #fff;
  --line: #e2e5ea;
  --line2: #eef0f3;
  --text: #1d2330;
  --muted: #6b7280;
  --faint: #9aa1ad;
  --side: #111827;
  --side-text: #c9ced8;
  --side-hl: #1f2937;
  --blue: #2563eb;
  --blue-bg: #eff4ff;
  --green: #15803d;
  --green-bg: #ecf8f0;
  --amber: #b45309;
  --amber-bg: #fdf5e8;
  --red: #c62828;
  --red-bg: #fdeeee;
  --grey-bg: #f1f2f4;
}

* { box-sizing: border-box; }
html, body { margin: 0; padding: 0; }
body {
  background: var(--bg);
  color: var(--text);
  font: 14px/1.5 system-ui, -apple-system, "Segoe UI", "PingFang SC", "Microsoft YaHei", sans-serif;
}
a { color: var(--blue); text-decoration: none; }
a:hover { text-decoration: underline; }
button, input, select, textarea { font: inherit; color: inherit; }
[hidden] { display: none !important; }

/* ── 框架：左边菜单，右边正文 ── */
body.app { display: flex; min-height: 100vh; }
.side { width: 208px; flex: none; background: var(--side); color: var(--side-text); display: flex; flex-direction: column; height: 100vh; position: sticky; top: 0; }
.side .brand { padding: 18px 20px 14px; font-size: 20px; font-weight: 700; color: #fff; letter-spacing: .5px; overflow-wrap: anywhere; }
.side .brand small { display: block; font-size: 12px; font-weight: 400; color: #8a93a3; letter-spacing: 0; margin-top: 2px; }
.side .nav { margin: 6px 0; padding: 0 10px; flex: 1; overflow-y: auto; }
.side .nav a { display: flex; align-items: center; gap: 10px; padding: 9px 12px; border-radius: 6px; color: var(--side-text); margin-bottom: 2px; }
.side .nav a:hover { background: var(--side-hl); color: #fff; text-decoration: none; }
.side .nav a.on { background: var(--side-hl); color: #fff; font-weight: 600; }
.side .nav svg { width: 18px; height: 18px; flex: none; color: #8a93a3; }
.side .nav a.on svg { color: #7aa2ff; }
.side .nav a.danger:hover, .side .nav a.danger.on { background: #3a1d1f; color: #ffb4b4; }
.side .nav a.danger.on svg, .side .nav a.danger:hover svg { color: #ff8a8a; }
.side .nav .count { margin-left: auto; background: #374151; color: #fff; border-radius: 9px; font-size: 11px; padding: 0 7px; line-height: 18px; }
.side-foot { border-top: 1px solid var(--side-hl); padding: 12px 20px; font-size: 12px; color: #8a93a3; display: flex; flex-direction: column; gap: 6px; }
.side-foot b { color: #d6dae2; font-weight: 600; }
.side-foot .who { display: flex; align-items: baseline; gap: 4px; }
.side-foot .who button { margin-left: auto; }
.side-foot button.link { color: #8a93a3; }
.side-foot button.link:hover { color: #fff; }
.side-foot .chip-line { color: #d6dae2; }
.side-foot .row { gap: 8px; }
.side-foot button.small-btn { background: transparent; color: #ffb4b4; border-color: #5b2a2d; padding: 1px 9px; font-size: 12px; }
.side-foot button.small-btn:hover { background: #3a1d1f; }

.content { flex: 1; min-width: 0; display: flex; flex-direction: column; }
main { padding: 22px 28px 60px; max-width: 1280px; width: 100%; }
.extra:empty { display: none; }
.extra > * { margin: 0; border-radius: 0; }
.sub-notes { padding: 6px 28px; }
.sub-notes:has(> .row:empty) { display: none; }

/* 标题、数字块、页签 */
.frame .head { display: flex; align-items: center; gap: 12px; margin-bottom: 16px; }
.frame .head h1 { font-size: 20px; margin: 0; font-weight: 650; }
.grow { flex: 1; }
.tiles { display: grid; gap: 14px; grid-template-columns: repeat(auto-fit, minmax(170px, 1fr)); margin-bottom: 14px; }
.tile { background: var(--card); border: 1px solid var(--line); border-radius: 8px; padding: 12px 16px; }
.tile .k { color: var(--muted); font-size: 12px; }
.tile .v { font-size: 22px; font-weight: 650; margin-top: 2px; font-variant-numeric: tabular-nums; }
.tile .v small { font-size: 13px; font-weight: 400; color: var(--muted); margin-left: 4px; }
.tile .v.good { color: var(--green); }
.tile .v.bad { color: var(--red); }
.tabs { display: flex; gap: 2px; border-bottom: 1px solid var(--line); margin-bottom: 16px; flex-wrap: wrap; }
.tabs a { padding: 8px 14px; color: var(--muted); border-bottom: 2px solid transparent; margin-bottom: -1px; white-space: nowrap; }
.tabs a:hover { color: var(--text); text-decoration: none; }
.tabs a.on { color: var(--text); border-bottom-color: var(--blue); font-weight: 600; }
.tabs.sub-tabs { border-bottom: 0; margin: -8px 0 12px; gap: 6px; }
.tabs.sub-tabs a { border: 1px solid var(--line); border-radius: 14px; padding: 2px 12px; margin: 0; font-size: 13px; }
.tabs.sub-tabs a.on { border-color: var(--blue); background: var(--blue-bg); color: var(--blue); }

/* 状态条（每次操作的结果）、待查询黄条、演示条 */
.status { padding: 6px 28px; border-bottom: 1px solid var(--line); background: var(--card); display: flex; gap: 12px; align-items: center; min-height: 34px; position: sticky; top: 0; z-index: 2; }
.status:empty { display: none; }
.status.s-处理中 { background: var(--grey-bg); }
.status.s-成功 { background: var(--green-bg); color: var(--green); }
.status.s-失败 { background: var(--red-bg); color: var(--red); }
.status.s-结果未知, .status.s-local { background: var(--amber-bg); color: var(--amber); }
.status button { padding: 2px 10px; }
.pending-bar { background: var(--amber-bg); color: var(--amber); border-bottom: 1px solid #f1d9a6; padding: 4px 28px; }
.pending-bar .row { min-height: 28px; }
.demo-bar { background: #fff7d6; color: #6b5300; border-bottom: 1px solid #ecd27a; padding: 5px 28px; display: flex; gap: 10px; align-items: center; flex-wrap: wrap; font-size: 13px; }
.demo-bar select { padding: 1px 4px; }
.demo-bar a { color: #6b5300; text-decoration: underline; }

/* ── 卡片、标题、文字 ── */
.panel { background: var(--card); border: 1px solid var(--line); border-radius: 8px; padding: 16px 18px; margin-bottom: 14px; }
.panel > :last-child { margin-bottom: 0; }
h1 { font-size: 16px; margin: 0 0 12px; font-weight: 650; }
.view h1 { font-size: 15px; }
h2 { font-size: 15px; margin: 0 0 10px; font-weight: 650; }
.panel h2 { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.muted { color: var(--muted); }
.small { font-size: 12px; }
.mono { font-family: ui-monospace, Consolas, "Courier New", monospace; font-size: 12px; }
.break { overflow-wrap: anywhere; }
.row { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; }
.row.end { justify-content: flex-end; }
.toolbar { margin: 0 0 10px; }
.spacer { flex: 1; }
.stack > * + * { margin-top: 10px; }
.grid { display: grid; gap: 14px; }
.grid.g2 { grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); align-items: start; } /* minmax(0, …): a wide table scrolls inside its column, the page never scrolls sideways */
@media (max-width: 1100px) { .grid.g2 { grid-template-columns: 1fr; } }
.kv { display: grid; grid-template-columns: max-content 1fr; gap: 6px 16px; margin: 0 0 10px; font-size: 13px; }
.kv dt { color: var(--muted); }
.kv dd { margin: 0; overflow-wrap: anywhere; }
.stats { display: flex; gap: 10px; flex-wrap: wrap; }
.stat { border: 1px solid var(--line); border-radius: 8px; padding: 10px 16px; background: var(--card); min-width: 120px; }
.stat b { display: block; font-size: 20px; font-weight: 650; }
.stat span { color: var(--muted); font-size: 12px; }
.note { background: var(--blue-bg); color: #244a9e; border-radius: 6px; padding: 8px 12px; font-size: 13px; margin: 0 0 14px; }
.note.warn { background: var(--amber-bg); color: #7a4210; }
.note.bad { background: var(--red-bg); color: #8f1d1d; }
.note h2 { margin-bottom: 4px; }
.hint { margin-top: -4px; }
.loading { padding: 24px 0; }
.view-root { position: relative; }
.view-root[data-refreshing]::before { content: "正在刷新……"; position: absolute; right: 0; top: -14px; font-size: 11px; color: var(--faint); }
.placeholder { padding: 48px; text-align: center; color: var(--faint); }

/* ── 按钮 ── */
.btn, button { border: 1px solid var(--line); background: #fff; color: var(--text); border-radius: 6px; padding: 5px 12px; cursor: pointer; white-space: nowrap; display: inline-flex; align-items: center; gap: 4px; }
.btn:hover, button:hover { border-color: #c5cad3; background: #fafbfc; text-decoration: none; color: var(--text); }
.btn.primary, button.primary { background: var(--blue); border-color: var(--blue); color: #fff; }
.btn.primary:hover, button.primary:hover { background: #1d4fd8; color: #fff; }
.btn.danger, button.danger { background: var(--red); border-color: var(--red); color: #fff; }
.btn.danger:hover, button.danger:hover { background: #ad2020; color: #fff; }
button.red, .btn.red { color: var(--red); border-color: #f0c7c7; }
button.red:hover, .btn.red:hover { background: var(--red-bg); color: var(--red); }
.btn.link, button.link { border: none; background: none; color: var(--blue); padding: 0 4px; }
button:disabled, button:disabled:hover { opacity: .5; cursor: default; background: #fff; border-color: var(--line); }
button.primary:disabled { background: var(--blue); }
button.danger:disabled { background: var(--red); }
.lock { display: inline-flex; align-items: center; color: var(--amber); }
.lock svg { width: 11px; height: 11px; }
button.primary .lock, button.danger .lock, .btn.primary .lock { color: #fff; }

/* ── 表单 ── */
input[type=text], input[type=password], input[type=number], input[type=search], select, textarea {
  border: 1px solid var(--line); border-radius: 6px; padding: 5px 9px; background: #fff; min-width: 0;
}
input[type=search] { width: 240px; }
input:focus, select:focus, textarea:focus, button:focus-visible, a:focus-visible { outline: 2px solid var(--blue); outline-offset: 0; }
input.code { letter-spacing: 6px; font-family: ui-monospace, Consolas, monospace; font-size: 18px; text-align: center; }
.field { display: flex; flex-direction: column; gap: 4px; margin-bottom: 12px; }
.field label { color: var(--muted); font-size: 12px; }
.field label.check { display: flex; gap: 6px; align-items: center; color: var(--text); font-size: 14px; }
.field .help { color: var(--muted); font-size: 12px; }
.error { color: var(--red); font-size: 12px; }

/* ── 表格 ── */
.table-wrap { overflow-x: auto; border: 1px solid var(--line); border-radius: 8px; background: var(--card); margin-bottom: 14px; }
table { border-collapse: collapse; width: 100%; }
th { font-weight: 500; color: var(--muted); text-align: left; font-size: 12px; padding: 8px 10px; border-bottom: 1px solid var(--line); white-space: nowrap; background: #fafbfc; }
td { padding: 9px 10px; border-bottom: 1px solid var(--line2); vertical-align: middle; white-space: nowrap; }
tr:last-child td { border-bottom: 0; }
tbody tr:hover td { background: #fafbfd; }
td.wrap { white-space: normal; min-width: 160px; overflow-wrap: anywhere; }
th.sortable { cursor: pointer; }
th.sorted-asc::after { content: " ↑"; }
th.sorted-desc::after { content: " ↓"; }
td.num, th.num { text-align: right; font-variant-numeric: tabular-nums; }
td.actions > * { margin: 2px 6px 2px 0; }
td.actions button, td.actions .btn { padding: 2px 9px; font-size: 12px; }
.empty { padding: 28px; text-align: center; color: var(--faint); }
.pager { display: flex; gap: 6px; align-items: center; margin: -4px 0 14px; }

/* ── 标签（小圆角块） ── */
.badge { display: inline-block; padding: 0 8px; border-radius: 10px; font-size: 12px; line-height: 20px; white-space: nowrap; background: var(--grey-bg); color: var(--muted); }
.badge + .badge { margin-left: 4px; }
.badge.ok { background: var(--green-bg); color: var(--green); }
.badge.bad { background: var(--red-bg); color: var(--red); }
.badge.warn { background: var(--amber-bg); color: var(--amber); }
.badge.info { background: var(--blue-bg); color: var(--blue); }
.badge.off { background: var(--grey-bg); color: var(--muted); }
.reported { display: inline-block; font-size: 12px; line-height: 18px; color: var(--amber); border: 1px dashed var(--amber); padding: 0 6px; border-radius: 10px; }

/* ── 总后台看某台 ── */
.server-card { padding-top: 14px; }
.server-card .card-head h2 { margin-bottom: 12px; }
.server-card .card-head .name { font-size: 16px; }
.server-card .tabs { margin-bottom: 12px; }
.flags label.row { gap: 10px; }

/* ── 紧急处理 ── */
.targets { display: flex; gap: 8px; flex-wrap: wrap; margin: 6px 0 14px; }
.targets .target { border-radius: 8px; padding: 8px 14px; }
.targets .target.on { border-color: var(--red); background: var(--red-bg); color: #8f1d1d; font-weight: 600; }
.danger-card { border-color: #f1d0d0; }
.danger-card h2 { color: #8f1d1d; }
.danger-card ul { margin: 6px 0 12px; padding-left: 18px; color: #4b5563; font-size: 13px; }
.danger-card.later { opacity: .75; }

/* ── 第二批：开关、小按钮、删除记录的底、倒数、按住 ── */
button.small-btn, .btn.small-btn { padding: 2px 9px; font-size: 12px; }
.switch { display: inline-flex; align-items: center; gap: 8px; }
button.sw { width: 34px; height: 20px; padding: 0; border: 0; border-radius: 10px; background: #cfd4dc; position: relative; flex: none; }
button.sw::after { content: ""; position: absolute; top: 2px; left: 2px; width: 16px; height: 16px; border-radius: 50%; background: #fff; }
button.sw.on { background: var(--green); }
button.sw.on::after { left: 16px; }
button.sw:hover { background: #bfc5ce; }
button.sw.on:hover { background: #136c34; }
tr.del td { color: var(--faint); background: #fbfbfc; }
.protected { margin-top: 2px; }
dialog.countdown .countdown-line { font-size: 15px; }
dialog.countdown .countdown-n { font-size: 28px; color: var(--red); font-variant-numeric: tabular-nums; margin-right: 4px; }
button.danger.holding { background: #7f1414; border-color: #7f1414; }

/* ── 弹窗 ── */
dialog { border: 1px solid var(--line); border-radius: 10px; padding: 0; width: 460px; max-width: 92vw; color: var(--text); }
dialog::backdrop { background: rgba(17, 24, 39, .35); }
dialog .d-head { padding: 18px 22px 4px; font-size: 16px; font-weight: 650; }
dialog .d-body { padding: 8px 22px 4px; max-height: 70vh; overflow: auto; }
dialog .d-body p { margin: 0 0 10px; }
dialog .d-body .field input:not([type=checkbox]), dialog .d-body .field textarea, dialog .d-body .field select { width: 100%; }
/* 填时间：一个数加「天／小时」（2026-11-29） */
.amount-row { display: flex; gap: 8px; }
dialog .d-body .field .amount-row input { flex: 1; width: auto; }
dialog .d-body .field .amount-row select { flex: none; width: auto; }
dialog .d-foot { padding: 12px 22px 18px; display: flex; gap: 8px; justify-content: flex-end; }
dialog.danger .d-head { color: #8f1d1d; }
.consequences { margin: 8px 0; padding-left: 20px; }
.consequences li { margin: 2px 0; }

/* ── 登录页、关机页 ── */
.center-box { max-width: 400px; margin: 72px auto; padding: 0 16px; }
.center-box .panel, .center-box form.panel { padding: 24px 26px; }
.center-box h1 { font-size: 20px; margin-bottom: 16px; }
.center-box .field input { width: 100%; }
.full-note { max-width: 560px; margin: 60px auto; text-align: center; }
.full-note h1 { font-size: 20px; }
.steps { padding-left: 34px; }
