/* ============================================================
   PHP DNS 管理台 · 运维后台样式
   方向：深靛墨蓝侧栏 + 暖白工作面 + 克制青绿状态 + 橙色重点
   纯 CSS，无 CDN 字体 / 无 Node 构建。DNS 字段用 monospace。
   ============================================================ */

:root {
  /* 侧栏 / 墨蓝 */
  --nav-bg: #111a2e;
  --nav-fg: #c3cee0;
  --nav-muted: #8494ad;
  --nav-hover-bg: #1a2740;
  --nav-active-bg: #1b2b4d;
  --nav-active-fg: #ffffff;
  --nav-accent: #38bdf8;
  --nav-border: #1f2c47;

  /* 工作面（暖白） */
  --bg: #f5f6f8;
  --surface: #ffffff;
  --surface-2: #fafbfc;
  --border: #e4e8ef;
  --border-strong: #d3dae5;

  /* 文本 */
  --text: #1a2230;
  --text-muted: #5b6675;
  --text-faint: #8a94a4;

  /* 主操作：深靛 */
  --action: #2f3e6e;
  --action-hover: #27345c;
  --action-active: #1f2a4a;
  --action-fg: #ffffff;

  /* 语义状态 */
  --ok-fg: #0f766e;
  --ok-bg: #e6f4f1;
  --ok-border: #bfe3dd;
  --warn-fg: #b45309;
  --warn-bg: #fff4e5;
  --warn-border: #f3d9b0;
  --err-fg: #b42318;
  --err-bg: #fdeceb;
  --err-border: #f3c6c2;
  --info-fg: #3b4a63;
  --info-bg: #eef1f6;
  --info-border: #d8dee8;
  --accent: #ea7a1f;
  --accent-bg: #fff3e8;

  /* 形状 / 间距 */
  --r-sm: 6px;
  --r-md: 8px;
  --r-lg: 12px;
  --sp-1: 4px;
  --sp-2: 8px;
  --sp-3: 12px;
  --sp-4: 16px;
  --sp-5: 24px;
  --sp-6: 32px;
  --shadow-1: 0 1px 2px rgba(16, 24, 40, .05);
  --shadow-2: 0 6px 18px rgba(16, 24, 40, .10);

  --font-sans: "PingFang SC", "Microsoft YaHei", system-ui, -apple-system, "Segoe UI", sans-serif;
  --font-mono: ui-monospace, SFMono-Regular, Menlo, Consolas, "Liberation Mono", monospace;
  --fs-base: 14px;
  --fs-sm: 13px;
  --fs-xs: 12px;
  --fs-h1: 20px;
  --fs-h2: 15px;

  --sidebar-w: 216px;
}

* { box-sizing: border-box; }

html { -webkit-text-size-adjust: 100%; }

body {
  margin: 0;
  font-family: var(--font-sans);
  font-size: var(--fs-base);
  line-height: 1.55;
  background: var(--bg);
  color: var(--text);
}

a { color: var(--action); text-decoration: none; }
a:hover { text-decoration: underline; }

h1 { font-size: var(--fs-h1); margin: 0 0 var(--sp-3); font-weight: 600; }
h2 { font-size: var(--fs-h2); margin: 0 0 var(--sp-3); font-weight: 600; }
h3 { font-size: var(--fs-sm); margin: var(--sp-4) 0 var(--sp-2); font-weight: 600; color: var(--text-muted); }

p { margin: 0 0 var(--sp-3); }
code, .mono, .fqdn { font-family: var(--font-mono); font-size: var(--fs-xs); }
.muted { color: var(--text-muted); }
.faint { color: var(--text-faint); }
.error-text { color: var(--err-fg); }
.nowrap { white-space: nowrap; }
.tnum { font-variant-numeric: tabular-nums; }

/* 可见焦点（键盘可达） */
:focus-visible {
  outline: 2px solid var(--nav-accent);
  outline-offset: 2px;
  border-radius: var(--r-sm);
}
a:focus-visible, button:focus-visible, summary:focus-visible,
input:focus-visible, select:focus-visible, textarea:focus-visible {
  outline: 2px solid var(--nav-accent);
  outline-offset: 2px;
}

.skip-link {
  position: absolute;
  left: var(--sp-3);
  top: -60px;
  z-index: 100;
  background: var(--action);
  color: var(--action-fg);
  padding: 8px 14px;
  border-radius: var(--r-sm);
  transition: top .12s ease;
}
.skip-link:focus { top: var(--sp-3); }

.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;
}

/* ===================== 布局骨架 ===================== */
.layout { display: flex; min-height: 100vh; }

.sidebar {
  width: var(--sidebar-w);
  background: var(--nav-bg);
  color: var(--nav-fg);
  flex-shrink: 0;
  display: flex;
  flex-direction: column;
  position: sticky;
  top: 0;
  height: 100vh;
  overflow-y: auto;
}

.brand {
  font-weight: 700;
  font-size: 15px;
  color: #fff;
  padding: var(--sp-4) var(--sp-4) var(--sp-3);
  border-bottom: 1px solid var(--nav-border);
  display: flex;
  align-items: center;
  gap: var(--sp-2);
}
.brand .brand-sub { font-size: 11px; font-weight: 400; color: var(--nav-muted); }

.sidebar nav { flex: 1; padding: var(--sp-2) 0; }

.nav-group { margin-bottom: var(--sp-2); }
.nav-group-label {
  font-size: 11px;
  letter-spacing: .06em;
  color: var(--nav-muted);
  padding: var(--sp-2) var(--sp-4) var(--sp-1);
  text-transform: none;
}
.sidebar nav a {
  display: flex;
  align-items: center;
  gap: var(--sp-2);
  padding: 8px var(--sp-4) 8px calc(var(--sp-4) - 2px);
  color: var(--nav-fg);
  text-decoration: none;
  font-size: var(--fs-sm);
  border-left: 2px solid transparent;
}
.sidebar nav a:hover { background: var(--nav-hover-bg); color: #fff; text-decoration: none; }
.sidebar nav a[aria-current="page"] {
  background: var(--nav-active-bg);
  color: var(--nav-active-fg);
  border-left-color: var(--nav-accent);
  font-weight: 600;
}

.user-box {
  padding: var(--sp-3) var(--sp-4);
  border-top: 1px solid var(--nav-border);
  font-size: var(--fs-sm);
}
.user-box .user-name { color: #fff; margin-bottom: var(--sp-2); word-break: break-all; }
.user-box .user-role {
  display: inline-block;
  font-size: 11px;
  color: var(--nav-muted);
  border: 1px solid var(--nav-border);
  border-radius: 999px;
  padding: 0 6px;
  margin-left: 4px;
}
.user-box a { display: block; color: var(--nav-muted); text-decoration: none; padding: 3px 0; }
.user-box a:hover { color: #fff; }
.link-btn {
  background: none; border: none; color: var(--nav-muted);
  padding: 3px 0; font-size: var(--fs-sm); cursor: pointer;
  display: block; text-align: left; font-family: inherit;
}
.link-btn:hover { color: #fff; }

.main {
  flex: 1;
  min-width: 0;
  padding: var(--sp-5) var(--sp-5) var(--sp-6);
  max-width: 1280px;
  width: 100%;
}

/* 移动端顶部条 + 抽屉 */
.mobile-topbar { display: none; }
.sidebar-backdrop { display: none; }

.page-head {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: var(--sp-3);
  margin-bottom: var(--sp-4);
  flex-wrap: wrap;
}
.page-head h1 { margin: 0; }
.page-head .page-actions { display: flex; gap: var(--sp-2); align-items: center; flex-wrap: wrap; }

.breadcrumbs { font-size: var(--fs-xs); color: var(--text-faint); margin-bottom: var(--sp-1); }
.breadcrumbs ol { list-style: none; display: flex; flex-wrap: wrap; gap: 6px; padding: 0; margin: 0; }
.breadcrumbs li { display: flex; gap: 6px; align-items: center; }
.breadcrumbs li + li::before { content: "/"; color: var(--border-strong); }
.breadcrumbs a { color: var(--text-muted); }

/* ===================== 卡片 ===================== */
.card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--r-md);
  padding: var(--sp-4);
  margin-bottom: var(--sp-4);
  box-shadow: var(--shadow-1);
}
.card > h2:first-child, .card > h3:first-child { margin-top: 0; }
.card-head {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: var(--sp-2);
  margin-bottom: var(--sp-3);
  flex-wrap: wrap;
}
.card-head h2 { margin: 0; }

.cards { display: flex; gap: var(--sp-3); margin-bottom: var(--sp-4); flex-wrap: wrap; }
.cards .card { flex: 1 1 160px; margin: 0; }
.stat { text-align: center; }
.stat-num { font-size: 26px; font-weight: 700; color: var(--action); font-variant-numeric: tabular-nums; }
.stat-label { color: var(--text-muted); font-size: var(--fs-sm); }
.stat.accent .stat-num { color: var(--accent); }

.grid-2 { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: var(--sp-4); align-items: start; }
.grid-3 { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: var(--sp-4); }
.grid-2 > *, .grid-3 > * { min-width: 0; }

/* ===================== 按钮 ===================== */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  padding: 7px 13px;
  border: 1px solid var(--border-strong);
  border-radius: var(--r-sm);
  background: var(--surface);
  color: var(--text);
  font-size: var(--fs-sm);
  font-family: inherit;
  cursor: pointer;
  text-decoration: none;
  line-height: 1.3;
  min-height: 34px;
  white-space: nowrap;
}
.btn:hover { background: var(--surface-2); text-decoration: none; }
.btn:active { background: var(--info-bg); }
.btn.primary { background: var(--action); border-color: var(--action); color: var(--action-fg); }
.btn.primary:hover { background: var(--action-hover); }
.btn.primary:active { background: var(--action-active); }
.btn.danger { background: var(--err-bg); border-color: var(--err-border); color: var(--err-fg); }
.btn.danger:hover { background: #fbdad8; }
.btn.danger-solid { background: var(--err-fg); border-color: var(--err-fg); color: #fff; }
.btn.danger-solid:hover { background: #96160f; }
.btn.ghost { background: transparent; border-color: transparent; color: var(--text-muted); }
.btn.ghost:hover { background: var(--info-bg); color: var(--text); }
.btn.small { padding: 4px 9px; font-size: var(--fs-xs); min-height: 28px; }
.btn.block { width: 100%; }
.btn[disabled], .btn[aria-disabled="true"] { opacity: .5; cursor: not-allowed; }
.btn.is-loading { pointer-events: none; opacity: .7; }
.btn.is-loading::before {
  content: "";
  width: 12px; height: 12px;
  border: 2px solid currentColor;
  border-right-color: transparent;
  border-radius: 50%;
  animation: spin .7s linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }

.btn-group { display: flex; gap: var(--sp-2); flex-wrap: wrap; align-items: center; }
.btn-group.right { justify-content: flex-end; }
.inline { display: inline; }
.inline-form { display: inline-flex; }

/* ===================== 表单 ===================== */
.form label, .field { display: block; margin-bottom: var(--sp-3); font-size: var(--fs-sm); color: var(--text-muted); }
.form input, .form select, .form textarea,
.field input, .field select, .field textarea {
  display: block;
  width: 100%;
  margin-top: var(--sp-1);
  padding: 8px 10px;
  border: 1px solid var(--border-strong);
  border-radius: var(--r-sm);
  font-size: var(--fs-base);
  font-family: inherit;
  color: var(--text);
  background: var(--surface);
  min-height: 36px;
}
.form textarea, .field textarea { min-height: 0; line-height: 1.5; }
.form input:focus, .form select:focus, .form textarea:focus { border-color: var(--action); }
.form input[readonly] { background: var(--info-bg); color: var(--text-muted); }
.field-help { display: block; color: var(--text-faint); font-size: var(--fs-xs); margin-top: 2px; }
.req::after { content: " *"; color: var(--err-fg); }

/* 字段并排（响应式，不拉满宽） */
.form-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(220px, 1fr)); gap: 0 var(--sp-4); }
.form-grid .span-2 { grid-column: span 2; }
.form-grid .span-all { grid-column: 1 / -1; }
.form-actions { display: flex; gap: var(--sp-2); align-items: center; flex-wrap: wrap; margin-top: var(--sp-2); }

/* 单选/复选行 */
.check-row, .radio-row {
  display: flex;
  align-items: flex-start;
  gap: var(--sp-2);
  font-size: var(--fs-sm);
  color: var(--text);
  margin-bottom: var(--sp-2);
  cursor: pointer;
}
.check-row input, .radio-row input {
  width: auto;
  margin: 2px 0 0;
  min-height: 0;
  flex: 0 0 auto;
}
.radio-row { display: inline-flex; margin-right: var(--sp-4); }
.field-group { border: 1px solid var(--border); border-radius: var(--r-sm); padding: var(--sp-3); margin-bottom: var(--sp-3); }
.field-group > legend { font-size: var(--fs-xs); color: var(--text-muted); padding: 0 4px; }

.form.inline { display: flex; gap: var(--sp-2); align-items: flex-end; flex-wrap: wrap; }
.form.inline label { margin-bottom: 0; }
.form.inline input, .form.inline select { width: auto; margin-top: var(--sp-1); }

/* 内嵌编辑弹层 */
.inline-details { display: inline-block; position: relative; }
.inline-details > summary { cursor: pointer; list-style: none; display: inline-flex; }
.inline-details > summary::-webkit-details-marker { display: none; }
.edit-form {
  position: absolute;
  z-index: 30;
  top: calc(100% + 6px);
  right: 0;
  width: min(360px, 90vw);
  background: var(--surface);
  border: 1px solid var(--border-strong);
  border-radius: var(--r-md);
  padding: var(--sp-4);
  box-shadow: var(--shadow-2);
}
.edit-form::before {
  content: "";
  position: absolute;
  top: -6px;
  right: 18px;
  width: 10px; height: 10px;
  background: var(--surface);
  border-left: 1px solid var(--border-strong);
  border-top: 1px solid var(--border-strong);
  transform: rotate(45deg);
}

/* ===================== 表格 ===================== */
.table-wrap {
  width: 100%;
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
  border: 1px solid var(--border);
  border-radius: var(--r-md);
  background: var(--surface);
}
.table { width: 100%; border-collapse: collapse; font-size: var(--fs-sm); min-width: 560px; }
.table th, .table td {
  text-align: left;
  padding: 9px 12px;
  border-bottom: 1px solid var(--border);
  vertical-align: top;
}
.table thead th {
  position: sticky;
  top: 0;
  z-index: 2;
  background: var(--surface-2);
  color: var(--text-muted);
  font-weight: 600;
  font-size: var(--fs-xs);
  white-space: nowrap;
  border-bottom: 1px solid var(--border-strong);
}
.table tbody tr:nth-child(even) { background: var(--surface-2); }
.table tbody tr:hover { background: #f0f4fa; }
.table td.actions, .table th.actions { white-space: nowrap; }
.table td.actions .btn { margin: 0 2px 2px 0; }
.table .row-actions { display: flex; gap: 6px; flex-wrap: wrap; align-items: center; }
.table caption { caption-side: top; text-align: left; padding: 8px 12px; color: var(--text-muted); font-size: var(--fs-xs); }

.cell-clip {
  display: block;
  max-width: 320px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.cell-value { position: relative; display: inline-flex; align-items: center; gap: 4px; max-width: 100%; }
.cell-value .val { display: inline-block; max-width: 300px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; vertical-align: bottom; }
.copy-btn {
  border: 1px solid transparent;
  background: transparent;
  color: var(--text-faint);
  cursor: pointer;
  font-size: 11px;
  padding: 1px 4px;
  border-radius: 4px;
  font-family: inherit;
}
.copy-btn:hover { background: var(--info-bg); color: var(--action); border-color: var(--border); }
.copy-btn.copied { color: var(--ok-fg); border-color: var(--ok-border); background: var(--ok-bg); }

/* ===================== 徽章 / 状态 ===================== */
.badge {
  display: inline-block;
  padding: 1px 8px;
  border-radius: 999px;
  font-size: var(--fs-xs);
  line-height: 1.7;
  border: 1px solid transparent;
  white-space: nowrap;
}
.badge-ok, .badge-success, .badge-done, .badge-active, .badge-complete { background: var(--ok-bg); color: var(--ok-fg); border-color: var(--ok-border); }
.badge-failed, .badge-error, .badge-deleted { background: var(--err-bg); color: var(--err-fg); border-color: var(--err-border); }
.badge-running, .badge-partial, .badge-deleting { background: var(--warn-bg); color: var(--warn-fg); border-color: var(--warn-border); }
.badge-partial { border-style: dashed; }
.badge-pending, .badge-unknown, .badge-disabled, .badge-idle { background: var(--info-bg); color: var(--info-fg); border-color: var(--info-border); }
.badge-cancelled, .badge-skipped { background: #eceff3; color: #5a6678; }
.badge-permanent { background: var(--accent-bg); color: #b45309; border-color: #f3d9b0; }
.badge-counted { background: var(--info-bg); color: var(--info-fg); border-color: var(--info-border); }
.badge-danger { background: var(--err-bg); color: var(--err-fg); border-color: var(--err-border); }

/* ===================== 提示 / 状态块 ===================== */
.flash, .alert {
  padding: 10px 14px;
  border-radius: var(--r-sm);
  margin-bottom: var(--sp-4);
  font-size: var(--fs-sm);
  border: 1px solid transparent;
}
.flash-success, .alert.ok, .alert.success { background: var(--ok-bg); color: var(--ok-fg); border-color: var(--ok-border); }
.flash-error, .alert.error, .alert.failed { background: var(--err-bg); color: var(--err-fg); border-color: var(--err-border); }
.alert.warn, .alert.partial { background: var(--warn-bg); color: var(--warn-fg); border-color: var(--warn-border); }
.alert.info { background: var(--info-bg); color: var(--info-fg); border-color: var(--info-border); }
.flash a, .alert a { color: inherit; text-decoration: underline; }

.empty {
  text-align: center;
  padding: var(--sp-6) var(--sp-4);
  color: var(--text-muted);
}
.empty .empty-mark {
  width: 42px; height: 42px;
  margin: 0 auto var(--sp-3);
  border: 2px dashed var(--border-strong);
  border-radius: 50%;
  position: relative;
}
.empty .empty-mark::after {
  content: "";
  position: absolute; inset: 13px;
  border: 2px solid var(--border-strong);
  border-radius: 3px;
}
.empty .empty-title { color: var(--text); font-weight: 600; margin-bottom: var(--sp-1); }
.empty .empty-actions { margin-top: var(--sp-3); }

.skeleton { padding: var(--sp-2) 0; }
.skeleton .sk-row {
  height: 14px;
  border-radius: 4px;
  background: linear-gradient(90deg, #eef1f5 25%, #e3e8ef 37%, #eef1f5 63%);
  background-size: 400% 100%;
  animation: sk 1.3s ease infinite;
  margin-bottom: 10px;
}
.skeleton .sk-row:nth-child(2) { width: 85%; }
.skeleton .sk-row:nth-child(3) { width: 70%; }
@keyframes sk { 0% { background-position: 100% 50%; } 100% { background-position: 0 50%; } }

/* ===================== 分页 ===================== */
.pager {
  display: flex;
  gap: var(--sp-3);
  align-items: center;
  margin-top: var(--sp-3);
  font-size: var(--fs-sm);
  flex-wrap: wrap;
}
.pager a, .pager button { color: var(--action); }
.pager .pager-info { color: var(--text-muted); }
.pager form { display: inline-flex; gap: 6px; align-items: center; }
.pager select, .pager input {
  padding: 4px 6px;
  border: 1px solid var(--border-strong);
  border-radius: var(--r-sm);
  font-size: var(--fs-sm);
  font-family: inherit;
}

/* ===================== 批量操作条 ===================== */
.batch-bar {
  display: flex;
  gap: var(--sp-2);
  align-items: center;
  margin-bottom: var(--sp-3);
  flex-wrap: wrap;
}
.batch-bar .spacer { flex: 1; }
.bulk-bar {
  position: sticky;
  bottom: 0;
  z-index: 5;
  display: flex;
  gap: var(--sp-3);
  align-items: center;
  background: var(--nav-bg);
  color: #fff;
  padding: 10px var(--sp-4);
  border-radius: var(--r-md);
  margin-top: var(--sp-3);
  flex-wrap: wrap;
}
.bulk-bar[hidden] { display: none; }
.bulk-bar .bulk-count { font-weight: 600; }
.bulk-bar .bulk-spacer { flex: 1; }
.bulk-bar .btn { background: transparent; border-color: #3a4a6b; color: #e6ecf7; }
.bulk-bar .btn:hover { background: #1e2c49; }
.bulk-bar .btn.danger { background: var(--err-fg); border-color: var(--err-fg); color: #fff; }

/* ===================== 进度条 ===================== */
.progress {
  height: 10px;
  border-radius: 999px;
  background: var(--info-bg);
  overflow: hidden;
  border: 1px solid var(--border);
  min-width: 140px;
}
.progress > .progress-fill {
  height: 100%;
  width: 0%;
  background: var(--ok-fg);
  transition: width .3s ease;
}
.progress.is-running > .progress-fill { background: var(--warn-fg); }
.progress.is-partial > .progress-fill { background: var(--warn-fg); }
.progress.is-failed > .progress-fill { background: var(--err-fg); }
.progress.is-indeterminate > .progress-fill {
  width: 35% !important;
  background: linear-gradient(90deg, var(--warn-bg), var(--warn-fg), var(--warn-bg));
  animation: indet 1.4s ease-in-out infinite;
}
@keyframes indet {
  0% { margin-left: -35%; }
  100% { margin-left: 100%; }
}
.progress-meta { display: flex; gap: var(--sp-3); align-items: baseline; flex-wrap: wrap; font-size: var(--fs-sm); margin-top: 6px; }
.progress-meta .phase { color: var(--text-muted); }

.timeline { list-style: none; padding: 0; margin: 0; font-size: var(--fs-sm); }
.timeline li { display: grid; grid-template-columns: 140px 1fr; gap: var(--sp-3); padding: 5px 0; border-bottom: 1px dashed var(--border); }
.timeline li:last-child { border-bottom: 0; }
.timeline .t-label { color: var(--text-muted); }

.kv { display: grid; grid-template-columns: 140px 1fr; gap: 4px var(--sp-3); font-size: var(--fs-sm); }
.kv dt { color: var(--text-muted); }
.kv dd { margin: 0; }

/* ===================== 登录 ===================== */
.login-body {
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: 100vh;
  background: radial-gradient(1200px 600px at 70% -10%, #1d3055 0%, var(--nav-bg) 55%);
  padding: var(--sp-4);
}
.login-card {
  background: var(--surface);
  border-radius: var(--r-lg);
  padding: var(--sp-6);
  width: 100%;
  max-width: 380px;
  box-shadow: var(--shadow-2);
}
.login-card .login-brand { text-align: center; margin-bottom: var(--sp-2); }
.login-card .login-sub { text-align: center; color: var(--text-muted); font-size: var(--fs-sm); margin-bottom: var(--sp-4); }

/* ===================== 杂项 ===================== */
.scope-list {
  max-height: 340px;
  overflow-y: auto;
  border: 1px solid var(--border);
  border-radius: var(--r-sm);
  padding: var(--sp-2);
  margin-bottom: var(--sp-3);
  background: var(--surface-2);
}
.scope-item {
  display: flex;
  gap: var(--sp-2);
  align-items: flex-start;
  font-size: var(--fs-sm);
  padding: 4px 2px;
  color: var(--text);
  cursor: pointer;
}
.scope-item input { width: auto; margin: 3px 0 0; min-height: 0; }
.scope-item .scope-name { font-family: var(--font-mono); font-size: var(--fs-xs); }

#ai-result { margin-top: var(--sp-4); }
.mock-banner {
  background: var(--accent-bg);
  border: 1px dashed var(--accent);
  color: #9a4a05;
  padding: 8px 12px;
  border-radius: var(--r-sm);
  margin-bottom: var(--sp-4);
  font-size: var(--fs-sm);
}

details.disclosure { border: 1px solid var(--border); border-radius: var(--r-sm); padding: var(--sp-2) var(--sp-3); margin-top: var(--sp-2); }
details.disclosure > summary { cursor: pointer; color: var(--text-muted); font-size: var(--fs-sm); }
details.disclosure[open] > summary { margin-bottom: var(--sp-2); }

.table-actions-menu { position: relative; display: inline-block; }
.table-actions-menu > summary { cursor: pointer; list-style: none; }
.table-actions-menu > summary::-webkit-details-marker { display: none; }
.table-actions-menu .menu {
  position: absolute;
  right: 0;
  top: calc(100% + 4px);
  z-index: 30;
  background: var(--surface);
  border: 1px solid var(--border-strong);
  border-radius: var(--r-sm);
  box-shadow: var(--shadow-2);
  padding: 4px;
  min-width: 150px;
}
.table-actions-menu .menu form { display: block; }
.table-actions-menu .menu .btn { display: flex; width: 100%; justify-content: flex-start; border-color: transparent; }

.mono-wrap { word-break: break-all; font-family: var(--font-mono); font-size: var(--fs-xs); }

/* ===================== 响应式 ===================== */
@media (max-width: 1024px) {
  :root { --sidebar-w: 196px; }
  .grid-2, .grid-3 { grid-template-columns: minmax(0, 1fr); }
}

@media (max-width: 768px) {
  .layout { display: block; }
  .mobile-topbar {
    display: flex;
    align-items: center;
    gap: var(--sp-2);
    position: sticky;
    top: 0;
    z-index: 40;
    background: var(--nav-bg);
    color: #fff;
    padding: 10px var(--sp-3);
  }
  .mobile-topbar .mt-title { font-weight: 600; font-size: var(--fs-sm); }
  .drawer-toggle {
    display: inline-flex;
    flex-direction: column;
    justify-content: center;
    gap: 4px;
    width: 38px;
    height: 34px;
    background: transparent;
    border: 1px solid var(--nav-border);
    border-radius: var(--r-sm);
    cursor: pointer;
    padding: 0 9px;
  }
  .drawer-toggle span { display: block; height: 2px; background: #dbe4f2; border-radius: 2px; }
  .sidebar {
    position: fixed;
    top: 0;
    left: 0;
    bottom: 0;
    height: 100%;
    width: min(84vw, 300px);
    z-index: 60;
    transform: translateX(-102%);
    transition: transform .18s ease;
    box-shadow: var(--shadow-2);
  }
  .sidebar.is-open { transform: translateX(0); }
  .sidebar-backdrop {
    display: block;
    position: fixed;
    inset: 0;
    background: rgba(13, 20, 36, .5);
    z-index: 50;
    opacity: 0;
    pointer-events: none;
    transition: opacity .18s ease;
  }
  .sidebar-backdrop.is-open { opacity: 1; pointer-events: auto; }
  .main { padding: var(--sp-4) var(--sp-3) var(--sp-6); max-width: 100%; }

  /* 表格转卡片：data-label 键值 */
  .table--cards { min-width: 0; }
  .table--cards thead { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); }
  .table--cards tbody tr {
    display: block;
    border: 1px solid var(--border);
    border-radius: var(--r-md);
    margin-bottom: var(--sp-3);
    padding: var(--sp-3);
    background: var(--surface);
  }
  .table--cards tbody tr:nth-child(even) { background: var(--surface); }
  .table--cards tbody td {
    display: grid;
    grid-template-columns: 96px 1fr;
    gap: var(--sp-2);
    border: 0;
    padding: 4px 0;
    white-space: normal;
  }
  .table--cards tbody td::before {
    content: attr(data-label);
    color: var(--text-muted);
    font-size: var(--fs-xs);
    font-weight: 600;
  }
  .table--cards tbody td[data-label=""]::before,
  .table--cards tbody td.no-label::before { content: none; }
  .table--cards tbody td.actions { grid-template-columns: 1fr; padding-top: var(--sp-2); }
  .table--cards .cell-clip, .table--cards .cell-value .val { max-width: none; white-space: normal; word-break: break-all; }
  .table--cards .row-actions { flex-wrap: wrap; }

  .form-grid { grid-template-columns: 1fr; }
  .form-grid .span-2, .form-grid .span-all { grid-column: auto; }
  .checkboxes-row { flex-direction: column; }
  .page-head { flex-direction: column; align-items: stretch; }
  .edit-form { position: fixed; left: var(--sp-3); right: var(--sp-3); bottom: var(--sp-3); top: auto; width: auto; max-height: 80vh; overflow-y: auto; }
  .edit-form::before { display: none; }
}

@media (max-width: 480px) {
  .cards .card { flex: 1 1 100%; }
  .timeline li, .kv { grid-template-columns: 1fr; gap: 2px; }
  .timeline .t-label { font-size: var(--fs-xs); }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: .001ms !important; animation-iteration-count: 1 !important; transition-duration: .001ms !important; }
}

@media print {
  .sidebar, .mobile-topbar, .page-actions, .btn { display: none !important; }
  .main { max-width: 100%; padding: 0; }
}
