:root {
  --bg: #f5f6f8;
  --glow: rgba(58, 79, 209, 0.08);
  --surface: #ffffff;
  --surface-2: #f6f7f9;
  --border: #e3e6eb;
  --border-strong: #cdd2da;
  --control: #858c98;
  --text: #15171c;
  --text-2: #474d58;
  --text-3: #636b78;
  --accent: #3a4fd1;
  --accent-hover: #3043bc;
  --accent-ink: #ffffff;
  --accent-text: #3447c6;
  --accent-soft: #eef0fd;
  --neutral-text: #474d58;
  --neutral-soft: #f1f3f6;
  --neutral-line: #cdd2da;
  --warn-text: #7a4a00;
  --warn-soft: #fdf4e1;
  --warn-line: #ebcd8c;
  --ok-text: #1d6b3a;
  --ok-soft: #e7f6ec;
  --ok-line: #a9d9b8;
  --danger: #c42b1c;
  --danger-hover: #a82416;
  --danger-text: #b42318;
  --danger-soft: #fdeceb;
  --danger-line: #f0b9b2;
  --focus: #3a4fd1;
  --ring: rgba(58, 79, 209, 0.22);
  --topbar-bg: rgba(255, 255, 255, 0.86);
  --shadow-sm: 0 1px 2px rgba(17, 20, 28, 0.05);
  --shadow: 0 1px 2px rgba(17, 20, 28, 0.04), 0 12px 32px -18px rgba(17, 20, 28, 0.18);
  --scroll-shadow: rgba(17, 20, 28, 0.16);
  --sans: -apple-system, BlinkMacSystemFont, "PingFang SC", "Hiragino Sans GB", "Microsoft YaHei", "Noto Sans CJK SC", sans-serif;
  --mono: ui-monospace, SFMono-Regular, Menlo, monospace;
  color-scheme: light dark;
}

@media (prefers-color-scheme: dark) {
  :root {
    --bg: #0d0f13;
    --glow: rgba(110, 126, 255, 0.10);
    --surface: #15181e;
    --surface-2: #1a1e25;
    --border: #272c35;
    --border-strong: #363c47;
    --control: #6b7380;
    --text: #eceef2;
    --text-2: #b4bac5;
    --text-3: #8e96a4;
    --accent: #4558dc;
    --accent-hover: #5568ea;
    --accent-ink: #ffffff;
    --accent-text: #9ba7ff;
    --accent-soft: #1c2142;
    --neutral-text: #c0c6d1;
    --neutral-soft: #1d2129;
    --neutral-line: #363c47;
    --warn-text: #f0c46e;
    --warn-soft: #271e0f;
    --warn-line: #5b4417;
    --ok-text: #7fd49b;
    --ok-soft: #11261a;
    --ok-line: #285536;
    --danger: #c8392b;
    --danger-hover: #d94a3c;
    --danger-text: #ff9d92;
    --danger-soft: #2d1513;
    --danger-line: #6b2c25;
    --focus: #8f9cff;
    --ring: rgba(143, 156, 255, 0.28);
    --topbar-bg: rgba(21, 24, 30, 0.86);
    --shadow-sm: 0 1px 2px rgba(0, 0, 0, 0.3);
    --shadow: 0 1px 2px rgba(0, 0, 0, 0.3), 0 16px 40px -20px rgba(0, 0, 0, 0.6);
    --scroll-shadow: rgba(0, 0, 0, 0.55);
  }
}

/* ---------- 基础 ---------- */
*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; text-size-adjust: 100%; }
body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font: 14px/1.6 var(--sans);
  -webkit-font-smoothing: antialiased;
}
a { color: var(--accent-text); text-decoration: none; }
a:hover { text-decoration: underline; text-underline-offset: 2px; }
:focus-visible { outline: 2px solid var(--focus); outline-offset: 2px; }
h1 { font-size: 22px; line-height: 1.35; font-weight: 650; letter-spacing: -0.01em; margin: 0 0 16px; }
h2 { font-size: 15px; line-height: 1.4; font-weight: 600; margin: 32px 0 12px; }
h3 { font-size: 14px; font-weight: 600; margin: 16px 0 8px; }
p { margin: 0 0 12px; }
ol, ul { margin: 0 0 12px; padding-left: 20px; }
strong { font-weight: 600; }
.muted { color: var(--text-3); }
/* 长 id、路径、镜像名：只在一个词放不下时才从中间断（break-all 会把 build.1842 断成 b|uild.1842） */
.mono { font-family: var(--mono); font-size: 12.5px; word-break: normal; overflow-wrap: anywhere; }
code { font-family: var(--mono); font-size: 0.9em; padding: 1px 5px; border-radius: 4px; background: var(--surface-2); border: 1px solid var(--border); word-break: normal; overflow-wrap: anywhere; }
pre, pre.mono {
  margin: 0 0 12px;
  padding: 12px 14px;
  overflow: auto;
  max-height: 520px;
  background: var(--surface-2);
  border: 1px solid var(--border);
  border-radius: 8px;
  font: 12.5px/1.6 var(--mono);
  white-space: pre;
  word-break: normal;
  tab-size: 4;
}
/* 给人看的规则文本（出网规则预览）：折行不改变含义，比藏在横向滚动里好读 */
pre.plan { white-space: pre-wrap; overflow-wrap: anywhere; }
.hint { font-size: 12.5px; color: var(--text-3); margin: 8px 0 0; }
.scroll { overflow-x: auto; }
/* 内部 id 作次要信息：灰色小字，点击全选 */
.id-ref { color: var(--text-3); font-size: 12px; }
.id-ref .mono { font-size: 12px; -webkit-user-select: all; user-select: all; }
/* 单元格里的第二行（工作区路径、内部 id、动作代码） */
.sub { display: block; margin-top: 2px; color: var(--text-3); font-size: 12px; }
/* 等宽的长 id 在窄列里单行截断，完整值在 title 里 */
.clip { display: block; max-width: 14em; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.clip.short { max-width: 8em; }
.clip.inline { display: inline-block; vertical-align: bottom; }
/* 卡头标题里的补充说明（期望状态）：正文字号、不加粗 */
.card-head h2 .muted { font-size: 13px; font-weight: 400; }
/* 链接做成按钮（404 页「返回首页」） */
a.button {
  display: inline-flex;
  align-items: center;
  height: 34px;
  padding: 0 14px;
  border: 1px solid var(--accent);
  border-radius: 8px;
  background: var(--accent);
  color: var(--accent-ink);
  font-weight: 500;
  white-space: nowrap;
}
a.button:hover { background: var(--accent-hover); border-color: var(--accent-hover); text-decoration: none; }
/* 折叠的说明与次要操作（档位说明、查看公钥、重设口令） */
details > summary { cursor: pointer; color: var(--accent-text); font-size: 13px; }
details > summary:hover { text-decoration: underline; text-underline-offset: 2px; }
details[open] > summary { margin-bottom: 8px; }

/* ---------- 顶栏 ---------- */
.topbar {
  position: sticky;
  top: 0;
  z-index: 10;
  background: var(--topbar-bg);
  -webkit-backdrop-filter: saturate(180%) blur(10px);
  backdrop-filter: saturate(180%) blur(10px);
  border-bottom: 1px solid var(--border);
}
.topbar-in {
  max-width: 1120px;
  margin: 0 auto;
  padding: 0 24px;
  min-height: 56px;
  display: flex;
  align-items: center;
  gap: 8px 28px;
}
.brand {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  color: var(--text);
  font-size: 15px;
  font-weight: 650;
  letter-spacing: 0.01em;
  white-space: nowrap;
}
a.brand:hover { text-decoration: none; }
.brand-sub { color: var(--text-3); font-weight: 500; }
/* 字标：圆角方块里一前一后两个圆点（ottowork = 双人车） */
.brand-mark {
  position: relative;
  flex: none;
  width: 24px;
  height: 24px;
  border-radius: 7px;
  background: var(--accent);
  box-shadow: inset 0 0 0 1px rgba(255, 255, 255, 0.12);
}
.brand-mark::before, .brand-mark::after {
  content: "";
  position: absolute;
  top: 9px;
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: var(--accent-ink);
}
.brand-mark::before { left: 5px; }
.brand-mark::after { right: 5px; opacity: 0.65; }
.topbar nav { display: flex; align-items: center; gap: 2px; }
.topbar nav a {
  padding: 6px 12px;
  border-radius: 8px;
  color: var(--text-2);
  font-weight: 500;
  white-space: nowrap;
}
.topbar nav a:hover { background: var(--surface-2); color: var(--text); text-decoration: none; }
.topbar nav a[aria-current="page"] { background: var(--accent-soft); color: var(--accent-text); }
.topbar form.account { margin-left: auto; display: flex; align-items: center; gap: 10px; }
.avatar {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 26px;
  height: 26px;
  border-radius: 50%;
  background: var(--accent-soft);
  color: var(--accent-text);
  font-size: 12px;
  font-weight: 650;
  text-transform: uppercase;
  position: relative;
  overflow: hidden;
  vertical-align: middle;
  flex: none;
}
.avatar img { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; }
.avatar.sm { width: 20px; height: 20px; font-size: 10px; }
.user { color: var(--text-2); font-size: 13px; max-width: 160px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.topbar form.account button { height: 30px; padding: 0 12px; font-size: 13px; }

/* ---------- 主区 ---------- */
main { max-width: 1120px; margin: 0 auto; padding: 28px 24px 72px; }

/* 页头：面包屑 → 标题（+ 标签）→ 副标题；右侧操作 */
.page-head {
  display: flex;
  flex-wrap: wrap;
  align-items: flex-end;
  justify-content: space-between;
  gap: 12px 24px;
  margin: 0 0 24px;
}
.page-head .title { min-width: 0; flex: 1 1 320px; }
.page-head h1 { display: flex; flex-wrap: wrap; align-items: center; gap: 6px 10px; margin: 0; }
.page-head .sub { margin: 6px 0 0; color: var(--text-3); font-size: 13px; }
.page-head > .actions { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; }
/* 面包屑只占一行：长名字按省略号截断（链接带 title），分隔符是独立元素，不跟着名字换行 */
.crumbs { display: flex; flex-wrap: nowrap; align-items: center; gap: 4px; min-width: 0; margin: 0 0 6px; font-size: 13px; }
.crumbs a { color: var(--text-3); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; min-width: 0; flex: 0 1 auto; }
.crumbs a:first-of-type { flex-shrink: 0; }
.crumbs a:hover { color: var(--accent-text); }
.crumbs .sep { flex: none; color: var(--border-strong); }

/* 页内标签页 */
.tabs {
  display: flex;
  gap: 4px;
  margin: 0 0 24px;
  box-shadow: inset 0 -1px 0 var(--border);
  overflow-x: auto;
  overflow-y: hidden;
  scrollbar-width: none;
}
.tabs a {
  padding: 8px 12px;
  border-bottom: 2px solid transparent;
  color: var(--text-3);
  font-weight: 500;
  white-space: nowrap;
}
.tabs a:hover { color: var(--text); text-decoration: none; }
.tabs a[aria-current="page"] { color: var(--accent-text); border-bottom-color: var(--accent); }
/* 横向滚动的容器会裁掉盒外的焦点环，收进盒内 */
.tabs a:focus-visible, .topbar nav a:focus-visible { outline-offset: -2px; }

/* ---------- 卡片 ---------- */
/* 裸 section 也按卡片画（旧标记还在用） */
section {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 10px;
  box-shadow: var(--shadow-sm);
  padding: 16px 20px;
  margin: 0 0 16px;
}
section > :last-child { margin-bottom: 0; }
.card { padding: 0; overflow: hidden; }
/* 写操作后 303 带 #卡片 id 回来：吸顶顶栏不盖住卡头 */
.card[id] { scroll-margin-top: 72px; }
.card-head {
  display: flex;
  flex-wrap: wrap;
  align-items: flex-start;
  justify-content: space-between;
  gap: 8px 16px;
  padding: 14px 20px;
  border-bottom: 1px solid var(--border);
}
.card-head h2 { display: flex; flex-wrap: wrap; align-items: center; gap: 4px 8px; margin: 0; font-size: 15px; }
.card-head .desc { margin: 2px 0 0; color: var(--text-3); font-size: 13px; }
.card-head > .actions { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; }
.card-body { padding: 16px 20px; }
.card-body > :last-child { margin-bottom: 0; }
/* 卡片里的表格贴边 */
.card-body > .table-wrap { margin-left: -20px; margin-right: -20px; }
.card-body > .table-wrap:first-child { margin-top: -16px; }
.card-body > .table-wrap:last-child { margin-bottom: -16px; }
.card-body > .table-wrap th:first-child, .card-body > .table-wrap td:first-child { padding-left: 20px; }
.card-body > .table-wrap th:last-child, .card-body > .table-wrap td:last-child { padding-right: 20px; }
.card-body > .table-wrap + *, .card-body > .empty + * { margin-top: 16px; }
.card-body > .flash:first-child { margin-bottom: 16px; }
.flash form.inline { margin-left: 8px; }

/* ---------- 排版组件 ---------- */
.stack { display: flex; flex-direction: column; gap: 16px; }
.stack > * { margin: 0; }
.grid-2 { display: grid; grid-template-columns: minmax(0, 1fr); gap: 16px; align-items: start; margin: 0 0 16px; }
.grid-2 > * { margin: 0; }
.meta { display: flex; flex-wrap: wrap; align-items: center; gap: 4px 16px; margin: 0 0 12px; color: var(--text-3); font-size: 13px; }
.meta b, .meta strong { color: var(--text-2); font-weight: 500; }
/* 页头副标题里的 meta 行：不要自己的下边距 */
.page-head .sub .meta { margin: 0; }
dl.kv { display: grid; grid-template-columns: max-content minmax(0, 1fr); gap: 8px 24px; margin: 0 0 12px; }
dl.kv dt { color: var(--text-3); font-size: 13px; }
dl.kv dd { margin: 0; min-width: 0; }
.empty {
  padding: 28px 16px;
  text-align: center;
  color: var(--text-3);
  font-size: 13px;
  background: var(--surface-2);
  border: 1px dashed var(--border-strong);
  border-radius: 8px;
}

/* ---------- 提示条 ---------- */
.flash {
  --tone-text: var(--neutral-text);
  --tone-soft: var(--neutral-soft);
  --tone-line: var(--neutral-line);
  margin: 0 0 16px;
  padding: 10px 14px;
  border: 1px solid var(--tone-line);
  border-left: 3px solid var(--tone-text);
  border-radius: 8px;
  background: var(--tone-soft);
  color: var(--tone-text);
}
.flash.ok { --tone-text: var(--ok-text); --tone-soft: var(--ok-soft); --tone-line: var(--ok-line); }
.flash.error { --tone-text: var(--danger-text); --tone-soft: var(--danger-soft); --tone-line: var(--danger-line); }
.flash.warn { --tone-text: var(--warn-text); --tone-soft: var(--warn-soft); --tone-line: var(--warn-line); }
.flash a { color: inherit; text-decoration: underline; text-underline-offset: 2px; }

/* ---------- 标签 ---------- */
.tag {
  --tone-text: var(--neutral-text);
  --tone-soft: var(--neutral-soft);
  --tone-line: var(--neutral-line);
  display: inline-flex;
  align-items: center;
  gap: 5px;
  height: 22px;
  padding: 0 9px;
  border: 1px solid var(--tone-line);
  border-radius: 999px;
  background: var(--tone-soft);
  color: var(--tone-text);
  font-size: 12px;
  font-weight: 500;
  line-height: 1;
  letter-spacing: 0;
  white-space: nowrap;
  vertical-align: middle;
}
.tag::before { content: ""; flex: none; width: 6px; height: 6px; border-radius: 50%; background: currentColor; opacity: 0.75; }
.tag.ok { --tone-text: var(--ok-text); --tone-soft: var(--ok-soft); --tone-line: var(--ok-line); }
.tag.bad { --tone-text: var(--danger-text); --tone-soft: var(--danger-soft); --tone-line: var(--danger-line); }
.tag.warn { --tone-text: var(--warn-text); --tone-soft: var(--warn-soft); --tone-line: var(--warn-line); }

/* ---------- 按钮 ---------- */
button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  height: 34px;
  padding: 0 14px;
  border: 1px solid var(--accent);
  border-radius: 8px;
  background: var(--accent);
  color: var(--accent-ink);
  font: 500 14px/1 var(--sans);
  white-space: nowrap;
  cursor: pointer;
  box-shadow: var(--shadow-sm);
}
button:hover { background: var(--accent-hover); border-color: var(--accent-hover); }
button:disabled { opacity: 0.55; cursor: not-allowed; }
button.plain { background: var(--surface); border-color: var(--border-strong); color: var(--text); }
button.plain:hover { background: var(--surface-2); border-color: var(--control); }
button.danger { background: var(--surface); border-color: var(--danger-line); color: var(--danger-text); }
button.danger:hover { background: var(--danger); border-color: var(--danger); color: #ffffff; }

/* ---------- 表单 ---------- */
label {
  display: flex;
  flex-direction: column;
  gap: 4px;
  color: var(--text-3);
  font-size: 12.5px;
  font-weight: 500;
}
input:not([type="checkbox"]):not([type="radio"]):not([type="hidden"]), select, textarea {
  min-width: 0;
  height: 34px;
  padding: 0 10px;
  border: 1px solid var(--border-strong);
  border-radius: 8px;
  background: var(--surface);
  color: var(--text);
  font: 400 14px/1.4 var(--sans);
}
/* 占位文字与说明文字同一档灰（--control 在白底上只有约 3.4:1） */
input::placeholder, textarea::placeholder { color: var(--text-3); }
input:not([type="checkbox"]):not([type="radio"]):focus, select:focus, textarea:focus {
  outline: none;
  border-color: var(--accent);
  box-shadow: 0 0 0 3px var(--ring);
}
/* 原生下拉箭头换成两段渐变画的 V（CSP 不许 data: 图片） */
select {
  -webkit-appearance: none;
  appearance: none;
  padding-right: 30px;
  background-image: linear-gradient(45deg, transparent 50%, var(--control) 50%), linear-gradient(135deg, var(--control) 50%, transparent 50%);
  background-position: calc(100% - 16px) 50%, calc(100% - 11px) 50%;
  background-size: 5px 5px, 5px 5px;
  background-repeat: no-repeat;
  /* 宽度不跟最长的选项走（长租户名、长仓库名会把下拉撑到六百多像素）：表单行里定宽，截断的选项文字带 title */
  max-width: 100%;
  text-overflow: ellipsis;
}
textarea { display: block; width: 100%; height: auto; min-height: 88px; padding: 8px 10px; resize: vertical; font: 13px/1.55 var(--mono); }
input[type="checkbox"], input[type="radio"] { flex: none; width: 16px; height: 16px; margin: 3px 0 0; accent-color: var(--accent); }
.checks { display: flex; flex-wrap: wrap; gap: 6px 16px; }
/* 勾选框对齐首行文字（标签折成两行时不居中） */
label.check { flex-direction: row; align-items: flex-start; gap: 6px; color: var(--text); font-size: 13.5px; font-weight: 400; line-height: 1.6; cursor: pointer; }
label.check code { font-size: 12px; }
/* 「全部能力」勾上时，下面各项照样显示为勾上，但变灰：取消「全部能力」后按它们保存 */
.checks:has(input[value="*"]:checked) label.check:not(.all) { opacity: 0.55; }
form.inline { display: inline-flex; flex-wrap: wrap; align-items: center; gap: 6px; margin: 0; vertical-align: middle; }
form.row { display: flex; flex-wrap: wrap; align-items: flex-end; gap: 12px; margin: 0 0 12px; }
form.row > label { min-width: 0; max-width: 100%; }
form.row > label > select, .toolbar select { width: 16em; }
form.row > label:has(textarea), form.row > .checks, form.row > fieldset { flex-basis: 100%; }
/* 撑开的输入框（改名：长群名要看得全），独占一行 */
form.row > label.grow { flex: 1 1 100%; }
form.row > label.grow input { width: 100%; }
/* 同一表单里并排的几个按钮（保存 + 删除） */
form.row > .btns { display: flex; flex-wrap: wrap; gap: 8px; }
fieldset { min-width: 0; margin: 0; padding: 0; border: 0; }
fieldset > legend { padding: 0; margin: 0 0 6px; color: var(--text-3); font-size: 12.5px; font-weight: 500; }
/* 出网选「全放公网」时，额外放行名单不生效，不显示 */
form:has(select[name="mode"] option[value="open"]:checked) label.extra { display: none; }
/* 行内的标签（重设口令） */
label.inline { flex-direction: row; align-items: center; gap: 6px; white-space: nowrap; }
.toolbar {
  display: flex;
  flex-wrap: wrap;
  align-items: flex-end;
  gap: 12px;
  margin: 0 0 16px;
  padding: 12px 16px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 10px;
  box-shadow: var(--shadow-sm);
}

/* ---------- 表格 ---------- */
/*
 * 横向内滚的表：左右边缘按能不能再滚出现渐隐阴影（不用脚本：前两层随内容滚动、盖住后两层固定的阴影）
 */
.table-wrap {
  overflow-x: auto;
  margin: 0 0 12px;
  background:
    linear-gradient(to right, var(--surface) 30%, transparent) left center / 40px 100% no-repeat,
    linear-gradient(to left, var(--surface) 30%, transparent) right center / 40px 100% no-repeat,
    radial-gradient(farthest-side at 0 50%, var(--scroll-shadow), transparent) left center / 14px 100% no-repeat,
    radial-gradient(farthest-side at 100% 50%, var(--scroll-shadow), transparent) right center / 14px 100% no-repeat;
  background-attachment: local, local, scroll, scroll;
}
table { width: 100%; border-collapse: collapse; font-size: 13px; }
th, td { padding: 10px 12px; text-align: left; vertical-align: middle; border-bottom: 1px solid var(--border); }
th {
  background: var(--surface-2);
  color: var(--text-3);
  font-size: 12px;
  font-weight: 600;
  letter-spacing: 0.02em;
  white-space: nowrap;
}
tr:last-child > td { border-bottom: 0; }
tr:hover > td { background: var(--surface-2); }
/* 表格里的 id 只在一个词放不下时才断，不参与列的最小宽度计算之外的挤压（短 id 另标 nowrap） */
td.mono, td .mono { word-break: normal; overflow-wrap: break-word; }
td.nowrap, td .nowrap, th.nowrap { white-space: nowrap; }
/* 长文本列：不被别的列挤成一字一行；说明列里的长串（指纹、拼在一起的域名）在列内断开，不撑大整表 */
th.col-text { min-width: 14em; }
th.col-name { min-width: 7em; }
th.col-tenant { min-width: 6em; }
th.col-target { min-width: 8em; }
td.detail { min-width: 18em; overflow-wrap: anywhere; }
td.fp .mono { overflow-wrap: anywhere; }
/* 行内操作：同一行、不换行，按钮靠右排齐 */
td.row-actions { white-space: nowrap; }
.row-actions-in { display: flex; align-items: flex-start; justify-content: flex-end; gap: 8px; }
.row-actions-in form.inline { flex-wrap: nowrap; }
.row-actions-in details > summary { display: inline-flex; align-items: center; height: 28px; }
.row-actions-in .slot { display: inline-flex; align-items: center; height: 28px; color: var(--text-3); font-size: 12.5px; }
pre.key { max-width: 36em; white-space: pre-wrap; overflow-wrap: anywhere; margin: 4px 0 0; padding: 8px 10px; font-size: 12px; }
ul.caps { margin: 0; padding: 0; list-style: none; }
ul.caps li { margin: 0 0 2px; }
ul.caps code { margin-right: 6px; }
/* 行末只有一个操作按钮的列：收窄到按钮宽、靠右 */
td:last-child:has(> form.inline:only-child) { width: 1%; text-align: right; white-space: nowrap; }
td button { height: 28px; padding: 0 10px; font-size: 12.5px; box-shadow: none; }
td input:not([type="checkbox"]):not([type="radio"]):not([type="hidden"]), td select { height: 28px; max-width: 200px; font-size: 12.5px; }
td form.row { margin: 8px 0 0; gap: 8px; }



/* ---------- 未登录：居中窄卡 ---------- */
body.auth {
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  background-image: radial-gradient(ellipse 60% 360px at 50% 0, var(--glow), transparent);
  background-repeat: no-repeat;
}
.auth-wrap { width: 100%; max-width: 400px; padding: 40px 16px; }
.auth-wrap > .brand { display: flex; justify-content: center; margin: 0 0 20px; }
.auth main { max-width: none; padding: 0; }
.auth h1 { text-align: center; font-size: 20px; }
.auth section { padding: 24px; box-shadow: var(--shadow); }
.auth form.row { flex-direction: column; align-items: stretch; margin: 0; gap: 14px; }
.auth form.row button { width: 100%; height: 38px; }
.auth input:not([type="checkbox"]):not([type="radio"]):not([type="hidden"]) { height: 38px; }

/* ---------- 宽屏 / 窄屏 ---------- */
@media (min-width: 900px) {
  .grid-2 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}
@media (max-width: 720px) {
  .topbar-in { flex-wrap: wrap; padding: 10px 16px 0; min-height: 0; gap: 8px 16px; }
  .topbar nav {
    order: 3;
    flex-basis: 100%;
    margin: 0 -16px;
    padding: 0 12px 8px;
    overflow-x: auto;
    scrollbar-width: none;
  }
  .topbar form.account { gap: 8px; }
  /* 窄屏表格横向滚动，不把列挤成一字一行；首列可以折行（长名字不再把整表撑到上千像素），短 id 与时间各自标 nowrap */
  .table-wrap > table.wide, .scroll > table { min-width: 640px; }
  .table-wrap > table.wide td:first-child { min-width: 7em; }
  .table-wrap > table.wide th.col-name { width: 28%; }
  .user { max-width: 110px; }
  .card[id] { scroll-margin-top: 104px; }
}
@media (max-width: 640px) {
  main { padding: 20px 16px 56px; }
  h1 { font-size: 20px; }
  section, .card-head, .card-body { padding-left: 16px; padding-right: 16px; }
  .card { padding: 0; }
  .card-body > .table-wrap { margin-left: -16px; margin-right: -16px; }
  .card-body > .table-wrap th:first-child, .card-body > .table-wrap td:first-child { padding-left: 16px; }
  .card-body > .table-wrap th:last-child, .card-body > .table-wrap td:last-child { padding-right: 16px; }
  th, td { padding: 8px; }
  form.row, .toolbar { flex-direction: column; align-items: stretch; }
  form.row > *, .toolbar > * { width: 100%; }
  form.row > label > select, .toolbar select { width: 100%; }
  /* 竖排时 flex-basis 会变成高度 */
  form.row > label.grow { flex: none; }
  /* 表格行里折叠区展开的选择框（人员页「改绑给…」）：收窄，免得把整表撑出卡片 */
  td details select { max-width: 9em; }
  /* 卡头：标题一行、操作换到下一行左对齐（短标题与长标题的卡一致） */
  .card-head { flex-direction: column; align-items: stretch; }
  .card-head > .actions { justify-content: flex-start; }
  dl.kv { grid-template-columns: minmax(0, 1fr); gap: 2px; }
  dl.kv dd { margin-bottom: 8px; }
}

/* 仅在用户未要求减少动效时启用动效 */
@media (prefers-reduced-motion: no-preference) {
  a, button, input, select, textarea, .topbar nav a, .tabs a, tr > td {
    transition: color 120ms ease, background-color 120ms ease, border-color 120ms ease, box-shadow 120ms ease;
  }
}
