/* ============================================================
   DNS云解析分发平台  全局样式
   ============================================================ */
:root {
  --primary: #4b6cb7;
  --primary-dark: #1f2d3d;
  --aside-bg: linear-gradient(180deg, #24345a 0%, #141c33 100%);
  --bg: #f2f4f8;
  --card-bg: #ffffff;
  --text: #1f2d3d;
  --text-light: #6b7688;
  --border: #e6eaf0;
  --green: #2eaa5f;
  --red: #e5484d;
  --blue: #2f7cf6;
  --gray: #8a95a5;
  --radius: 10px;
  --shadow: 0 4px 18px rgba(20,32,60,.06);
}
* { box-sizing: border-box; margin: 0; padding: 0; }
html, body { height: 100%; }
body {
  font-family: "Microsoft YaHei", -apple-system, "Segoe UI", Arial, sans-serif;
  color: var(--text);
  font-size: 14px;
  background: var(--bg);
}
a { color: var(--primary); text-decoration: none; }
code { background: #eef1f6; padding: 2px 6px; border-radius: 4px; font-size: 13px; color: #33415c; }
.mono { font-family: Consolas, Menlo, monospace; font-size: 13px; }

/* ============ 登录页 ============ */
.login-body {
  display: flex; align-items: center; justify-content: center;
  min-height: 100vh; padding: 20px;
  background: linear-gradient(135deg, #4b6cb7 0%, #182848 100%);
}
.login-card {
  background: #fff; border-radius: 14px; box-shadow: 0 16px 48px rgba(0,0,0,.35);
  width: 100%; max-width: 400px; padding: 36px 38px 28px;
}
.login-head { text-align: center; margin-bottom: 24px; }
.login-head .logo { font-size: 40px; display: block; margin-bottom: 8px; }
.login-head h1 { font-size: 22px; color: var(--text); }
.login-head p { color: var(--text-light); font-size: 13px; margin-top: 4px; }
.login-card label { display: block; font-size: 13px; color: #4b5563; margin: 16px 0 6px; }
.login-card input {
  width: 100%; padding: 11px 13px; border: 1px solid var(--border); border-radius: 8px;
  font-size: 14px; outline: none; background: #fafbfc;
}
.login-card input:focus { border-color: var(--primary); box-shadow: 0 0 0 3px rgba(75,108,183,.14); background: #fff; }
.login-card .btn { margin-top: 24px; }
.login-err { color: var(--red); font-size: 13px; margin-top: 12px; min-height: 18px; text-align: center; }
/* 登录页底部跳转：按钮分列左右两端，字号加大更清晰 */
.login-foot {
  display: flex; justify-content: space-between; align-items: center; gap: 10px;
  margin-top: 18px; padding-top: 16px; border-top: 1px solid var(--border);
}
.login-card .login-foot .btn {
  flex: 0 0 auto; margin-top: 0; min-width: 92px;
  font-size: 14.5px; font-weight: 500; color: var(--text);
  padding: 11px 16px; white-space: nowrap;
}
.login-card .login-foot .btn:hover { color: var(--primary); border-color: var(--primary); }
.msg.err { background: #fdecea; color: #c0392b; padding: 10px 12px; border-radius: 8px; margin-bottom: 12px; font-size: 13px; }

/* ============ 首页 ============ */
.home-hero { display: flex; align-items: center; justify-content: center; min-height: 100vh; padding: 20px; background: linear-gradient(135deg, #4b6cb7 0%, #182848 100%); }
.home-card { background: #fff; border-radius: 16px; box-shadow: 0 16px 48px rgba(0,0,0,.35); width: 100%; max-width: 460px; padding: 40px 42px 30px; text-align: center; }
.home-logo { font-size: 56px; line-height: 1; }
.home-card h1 { font-size: 26px; margin: 10px 0 6px; color: var(--text); }
.home-tag { color: var(--text-light); font-size: 14px; margin-bottom: 24px; }
.home-features { display: flex; flex-direction: column; gap: 10px; margin: 0 0 28px; }
.home-feat { background: #f5f8ff; border: 1px solid #e5eefb; color: #33415c; border-radius: 8px; padding: 11px 14px; font-size: 14px; text-align: left; }
.home-cta { font-size: 16px; padding: 13px !important; }
.home-note { color: var(--text-light); font-size: 12.5px; margin-top: 16px; }

/* ============ 应用外壳 ============ */
.app { display: flex; min-height: 100vh; }

/* 侧边栏 */
.aside {
  width: 232px; min-width: 232px; background: var(--aside-bg); color: #cbd2e0;
  display: flex; flex-direction: column; position: fixed; top: 0; bottom: 0; left: 0;
}
.brand { display: flex; align-items: center; gap: 10px; padding: 22px 20px; color: #fff; }
.brand-logo { font-size: 22px; }
.brand-name { font-size: 15px; font-weight: 700; letter-spacing: .5px; }
.menu { flex: 1; padding: 8px 12px; overflow-y: auto; }
.menu-item {
  display: flex; align-items: center; gap: 12px; padding: 11px 14px; margin: 3px 0;
  color: #aab4c8; border-radius: 9px; font-size: 14px; transition: .18s;
}
.menu-item:hover { background: rgba(255,255,255,.07); color: #fff; }
.menu-item.active { background: rgba(255,255,255,.13); color: #fff; box-shadow: inset 3px 0 0 var(--green); }
.m-icon { font-size: 16px; width: 20px; text-align: center; }
.aside-foot { padding: 16px; border-top: 1px solid rgba(255,255,255,.08); }
.role-badge {
  display: block; text-align: center; font-size: 12px; padding: 7px;
  background: rgba(255,255,255,.08); border-radius: 6px; color: #9aa6bd;
}

/* 主区域 */
.main { margin-left: 232px; flex: 1; min-height: 100vh; display: flex; flex-direction: column; }
.topbar {
  display: flex; align-items: center; justify-content: space-between;
  background: #fff; padding: 0 26px; height: 62px; border-bottom: 1px solid var(--border);
  position: sticky; top: 0; z-index: 20;
}
.topbar-title { font-size: 17px; font-weight: 700; color: var(--text); }
.topbar-user { display: flex; align-items: center; gap: 10px; font-size: 14px; }
.topbar-user .avatar {
  width: 32px; height: 32px; border-radius: 50%; background: var(--primary); color: #fff;
  display: flex; align-items: center; justify-content: center; font-weight: 700; font-size: 14px;
}
.topbar-user .sep { color: #d0d5dd; margin: 0 4px; }
.topbar-user .logout { color: var(--text-light); }
.topbar-user .logout:hover { color: var(--red); }

.content { padding: 24px 26px; flex: 1; }

/* ============ 卡片 ============ */
.card { background: var(--card-bg); border-radius: var(--radius); box-shadow: var(--shadow); padding: 0; margin-bottom: 22px; overflow: hidden; }
.card-head {
  display: flex; align-items: center; justify-content: space-between;
  padding: 18px 22px; border-bottom: 1px solid var(--border);
}
.card-head h3 { font-size: 15px; }
.card-head .head-right { display: flex; align-items: center; gap: 10px; }
.hint { font-size: 12px; color: var(--text-light); }

/* 卡片顶部搜索栏 */
.card-search {
  display: flex; align-items: center; gap: 12px;
  padding: 14px 22px 4px;
}
.card-search input { max-width: 420px; }
.card-search .hint { white-space: nowrap; }

/* ============ 统计卡 ============ */
.stat-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(180px,1fr)); gap: 18px; margin-bottom: 22px; }
.stat-card {
  background: #fff; border-radius: var(--radius); box-shadow: var(--shadow);
  padding: 22px; text-align: center;
}
.stat-num { font-size: 34px; font-weight: 800; color: var(--primary); }
.stat-card.accent .stat-num { color: var(--green); }
.stat-label { margin-top: 6px; color: var(--text-light); font-size: 13px; }

/* ============ 表格 ============ */
.table { width: 100%; border-collapse: collapse; font-size: 13.5px; }
.table th {
  text-align: left; padding: 12px 14px; background: #f7f9fc; color: #5a6678;
  font-weight: 600; border-bottom: 1px solid var(--border); white-space: nowrap;
}
.table td { padding: 12px 14px; border-bottom: 1px solid #f1f4f8; vertical-align: middle; }
.table tr:last-child td { border-bottom: none; }
.table tbody tr:hover { background: #fafcff; }
/* 可排序表头：手型 + 悬停提示 */
.table th.sortable { cursor: pointer; user-select: none; }
.table th.sortable:hover { color: var(--primary); background: #eef4ff; }
.value-cell { max-width: 260px; word-break: break-all; }
.op { display: flex; justify-content: flex-end; gap: 6px; white-space: nowrap; }
/* 操作列表头与右对齐的操作按钮保持对齐（配合 .op 的 flex-end） */
.table th.op-head { text-align: right; }
.empty { padding: 40px; text-align: center; color: var(--gray); }
.link { color: var(--primary); }
td .link code, a.link code { color: var(--primary); }

/* ============ 按钮 ============ */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 6px;
  padding: 9px 18px; border: 1px solid var(--border); border-radius: 8px;
  background: #fff; color: var(--text); font-size: 14px; cursor: pointer; transition: background-color .15s, border-color .15s, color .15s, opacity .15s;
}
.btn:hover { border-color: var(--primary); color: var(--primary); }
.btn.primary { background: var(--primary); border-color: var(--primary); color: #fff; }
.btn.primary:hover { opacity: .9; }
.btn.danger { color: var(--red); border-color: #f3c2c2; }
.btn.danger:hover { background: var(--red); color: #fff; }
.btn.flat { background: transparent; }
.btn.sm { padding: 6px 11px; font-size: 12.5px; }
/* 证书状态按钮：三态配色 */
.btn.cert { background: #e6f0fe; border-color: #c4d9fb; color: #2f7cf6; }
.btn.cert:hover { background: #2f7cf6; border-color: #2f7cf6; color: #fff; }
.btn.certapplying { background: #fff5e6; border-color: #f7d9a2; color: #d9822b; }
.btn.certok.viewcert { background: #e5f6ec; border-color: #bfe6cc; color: #229350; }
.btn.certok.viewcert:hover { background: #229350; border-color: #229350; color: #fff; }
/* 用户端：下载证书 / 隐藏 / 恢复显示 三色区分 */
.btn.cert-dl { background: #e5f6ec; border-color: #bfe6cc; color: #229350; }
.btn.cert-dl:hover { background: #229350; border-color: #229350; color: #fff; }
.btn.hide-domain { background: #fff5e6; border-color: #f7d9a2; color: #d9822b; }
.btn.hide-domain:hover { background: #d9822b; border-color: #d9822b; color: #fff; }
.btn.restore-domain { background: #e6f7f6; border-color: #b8e6e2; color: #0d9488; }
.btn.restore-domain:hover { background: #0d9488; border-color: #0d9488; color: #fff; }
/* 后台：转移域名所有权 */
.btn.transfer { background: #e6f0fe; border-color: #c4d9fb; color: #2f7cf6; }
.btn.transfer:hover { background: #2f7cf6; border-color: #2f7cf6; color: #fff; }
.btn.block { width: 100%; }
.page-actions { margin-bottom: 18px; display: flex; gap: 10px; }

/* ============ 标签/徽章 ============ */
.tag {
  display: inline-block; padding: 2px 9px; border-radius: 5px; font-size: 12px;
  background: #eef1f6; color: #5a6678; white-space: nowrap; position: relative;
}
.tag-x { position:absolute; top:-7px; left:-7px; width:16px; height:16px; line-height:15px; text-align:center; border-radius:50%; background:var(--red); color:#fff; font-size:11px; padding:0; border:none; cursor:pointer; box-shadow:0 1px 2px rgba(0,0,0,.3); }
.tag-x:hover { background:#c0392b; }
.confirm-text { font-size:14px; line-height:1.8; color:var(--text); }
.cf-msg { font-size:14px; line-height:1.8; color:var(--text); }
.mg-item { display:flex; align-items:center; justify-content:space-between; gap:8px; padding:8px 12px; border-bottom:1px solid var(--border); }
.mg-item:last-child { border-bottom:none; }
.mg-item code { background:transparent; padding:0; }
.site-item { cursor:pointer; }
.site-item:hover { background:#f5f8ff; }
.site-item.active { background:#eaf1ff; color:var(--primary); font-weight:600; box-shadow: inset 3px 0 0 var(--primary); }
.tag.green { background: #e5f6ec; color: #229350; }
.tag.red { background: #fdecec; color: #d3383d; }
.tag.blue { background: #e6f0fe; color: #2f7cf6; }
.tag.gray { background: #eef1f6; color: #6b7688; }
.tag.orange { background: #fff3e0; color: #b26a00; }
/* 状态徽章可点击（封禁/解封） */
.st-toggle { cursor: pointer; transition: .15s; user-select: none; }
/* 域名池状态显示/隐藏徽章 */
.tag.pshow { cursor: pointer; transition: .15s; user-select: none; }
.tag.pshow:hover { filter: brightness(1.04); }
/* 域名池备案类型内联下拉 */
.filing-sel { padding: 3px 6px; border-radius: 5px; border: 1px solid var(--border); font-size: 12px; color: var(--text); background: #fff; max-width: 150px; }
/* 备注点击编辑 */
.remark-ed { cursor: pointer; padding: 2px 6px; border-radius: 5px; display: inline-block; }
.remark-ed:hover { background: #eef1f6; }
/* 可点击复制 */
.copyable { cursor: pointer; position: relative; border-radius: 4px; padding: 1px 4px; transition: background-color .15s, border-color .15s, color .15s, opacity .15s; }
.copyable:hover { background: #eaf1ff; color: var(--primary); }
.copyable::after { content: '📋'; font-size: 11px; margin-left: 4px; opacity: .4; }
.copyable:hover::after { opacity: 1; }
.remark-inp { width: 100%; min-width: 120px; padding: 5px 8px; font-size: 12.5px; }
/* 只读展示输入框（分配/编辑时固定显示的文本） */
.fld-ro { width: 100%; padding: 8px 10px; border: 1px solid var(--border); border-radius: 6px; background: #f5f7fa; color: #5a6678; cursor: not-allowed; }
/* 历史输入：输入框 + 历史按钮 + 下拉列表 */
.hist-wrap { position: relative; display: flex; gap: 6px; align-items: center; }
.hist-wrap input { flex: 1 1 auto; min-width: 0; }
.hist-btn { flex: 0 0 auto; white-space: nowrap; padding: 8px 10px; }
.hist-pop {
  display: none; position: absolute; top: calc(100% + 4px); left: 0; right: 0;
  max-height: 210px; overflow-y: auto; background: #fff; border: 1px solid var(--border);
  border-radius: 8px; box-shadow: 0 8px 24px rgba(16,24,40,.14); z-index: 20; padding: 4px;
}
.hist-pop.show { display: block; }
.hist-item { padding: 7px 10px; border-radius: 6px; font-size: 13px; cursor: pointer; word-break: break-all; }
.hist-item:hover { background: #eaf1ff; color: var(--primary); }
.hist-empty { padding: 12px; text-align: center; color: var(--gray); font-size: 12.5px; }
.st-toggle:hover { filter: brightness(.92); }

/* ============ 表单 ============ */
label { display: block; font-size: 13px; color: #4b5563; margin: 16px 0 6px; }
input, select {
  width: 100%; padding: 10px 12px; border: 1px solid var(--border); border-radius: 8px;
  font-size: 14px; outline: none; background: #fafbfc; color: var(--text);
}
input:focus, select:focus { border-color: var(--primary); box-shadow: 0 0 0 3px rgba(75,108,183,.14); background: #fff; }
select { cursor: pointer; }
.form-col { padding: 22px; max-width: 560px; }
.form-col label { margin-top: 18px; }
.form-col label:first-child { margin-top: 4px; }
.form-actions { margin-top: 22px; }
.readonly { background: #f2f4f8; padding: 10px 12px; border-radius: 8px; color: #5a6678; }
.readonly-wide { width: 100%; }
.row2 { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; }
.form-inline { display: flex; flex-wrap: wrap; gap: 10px; align-items: center; }
.form-inline select, .form-inline input { width: auto; min-width: 140px; }
.filter-card { padding: 16px 20px; }
.filter-card .form-inline { margin: 0; }

/* 域名横幅 */
.domain-banner { padding: 18px 22px; display: flex; flex-direction: column; gap: 8px; background: #f9fbff; border-bottom: 1px solid var(--border); }
.db-row { display: flex; gap: 14px; font-size: 13.5px; }
.db-label { color: var(--text-light); width: 72px; }
.db-value { color: var(--text); }

/* ============ 弹窗 ============ */
dialog {
  border: none; border-radius: var(--radius); padding: 0; box-shadow: 0 20px 60px rgba(0,0,0,.3);
  width: 100%; max-width: 480px; background: #fff;
  /* 全局重置把默认 margin 清成 0，导致弹窗靠左上；这里恢复 auto 使其在顶层层级中水平+垂直居中 */
  margin: auto;
}
dialog::backdrop { background: rgba(20,28,51,.5); }

/* 手动复制兜底框（assets/js/app.js 的 manualCopy 动态创建）：自动写剪贴板被浏览器挡住时用 */
dialog.copy-fallback { max-width: 520px; padding: 20px 22px; }
dialog.copy-fallback .cf-head { font-weight: 600; font-size: 15px; margin-bottom: 8px; word-break: break-all; }
dialog.copy-fallback .hint { color: var(--gray); font-size: 12.5px; margin-bottom: 10px; line-height: 1.6; }
dialog.copy-fallback textarea {
  width: 100%; min-height: 84px; max-height: 220px; resize: vertical; font-family: ui-monospace, Consolas, monospace;
  font-size: 12.5px; line-height: 1.6; padding: 10px 12px; border: 1px solid var(--border);
  border-radius: 8px; background: #f7f9fc; color: var(--text); word-break: break-all;
}
dialog.copy-fallback .cf-foot { display: flex; justify-content: flex-end; gap: 10px; margin-top: 14px; }
.dialog-box { padding: 0; }
.dialog-head { display: flex; align-items: center; justify-content: space-between; padding: 18px 22px; border-bottom: 1px solid var(--border); }
.dialog-head h3 { font-size: 15px; }
.dialog-head .x { border: none; background: none; font-size: 22px; color: var(--gray); cursor: pointer; line-height: 1; }
.dialog-head .x:hover { color: var(--text); }
.dialog-body { padding: 4px 22px 20px; }
.dialog-foot { display: flex; justify-content: flex-end; gap: 10px; padding: 16px 22px; border-top: 1px solid var(--border); }
.im-bar { display: flex; gap: 10px; align-items: center; margin: 14px 0 10px; flex-wrap: wrap; }
/* ⚠️ 通用「藏起来」工具类：不要用 hidden 属性 —— 作者样式里的 display（如 .im-bar{display:flex}）
   优先级高于 UA 的 [hidden]{display:none}，加了 hidden 也会照样显示出来（踩过）。 */
.u-hidden { display: none !important; }
.im-bar .btn { white-space: nowrap; flex: 0 0 auto; }
.im-bar .im-search { flex: 1; min-width: 160px; }

/* ============ 证书签发平台选择（单选卡片） ============ */
/* 注意：全局 input{width:100%} 会把 radio 撑满整行并把文字挤出框外，这里必须显式复位 */
.ca-opt {
  display: flex; align-items: flex-start; gap: 10px;
  padding: 12px 14px; margin: 0 0 10px; cursor: pointer;
  border: 1px solid var(--border); border-radius: 8px; background: #fff;
}
.ca-opt:last-of-type { margin-bottom: 0; }
.ca-opt:hover { border-color: var(--primary); }
.ca-opt:has(input:checked) { border-color: var(--primary); background: #f6f8fd; }
.ca-opt input[type="radio"] {
  width: auto; min-width: 0; flex: 0 0 auto; margin: 3px 0 0; padding: 0;
  accent-color: var(--primary); cursor: pointer;
}
.ca-opt-txt { display: flex; flex-direction: column; gap: 3px; flex: 1 1 auto; min-width: 0; }
.ca-opt-txt b { font-weight: 600; font-size: 13.5px; color: var(--text); line-height: 1.5; overflow-wrap: anywhere; }
.ca-opt-txt small { font-size: 12.5px; color: var(--text-light); line-height: 1.55; overflow-wrap: anywhere; }
/* 开关（无限解析） */
.switch { position: relative; display: inline-block; width: 42px; height: 22px; vertical-align: middle; }
.switch input { opacity: 0; width: 0; height: 0; }
.switch .slider { position: absolute; cursor: pointer; inset: 0; background: #ccd5e2; border-radius: 22px; transition: .2s; }
.switch .slider:before { content:""; position:absolute; height:16px; width:16px; left:3px; top:3px; background:#fff; border-radius:50%; transition:.2s; box-shadow:0 1px 2px rgba(0,0,0,.2); }
.switch input:checked + .slider { background: var(--green); }
.switch input:checked + .slider:before { transform: translateX(20px); }
.im-scroll { max-height: 380px; overflow-y: auto; overflow-x: auto; border: 1px solid var(--border); border-radius: 8px; }
.im-scroll .table th, .im-scroll .table td { padding: 8px 10px; white-space: nowrap; }
.im-scroll .table th:first-child, .im-scroll .table td:first-child { width: 56px; text-align: center; }
/* 上面两条是为「第一列是勾选框」的列表（如域名池导入、用户/域名选择）准备的固定 56px 窄列。
   解析记录表的第一列是「主机记录」，不是勾选框，必须复位，否则列被压成 56px、
   长记录值也会因为 nowrap 而无法换行。加 .rec-table 类做覆盖（特异性更高，桌面/手机都生效）。 */
.im-scroll .table.rec-table th:first-child,
.im-scroll .table.rec-table td:first-child { width: auto; text-align: left; }
.im-scroll .table.rec-table th,
.im-scroll .table.rec-table td { white-space: normal; }
.im-scroll .table.rec-table td.value-cell { word-break: break-all; overflow-wrap: anywhere; }

/* 用户管理弹窗 */
.mg-sec { font-size: 14px; font-weight: 600; color: var(--text); margin: 20px 0 4px; padding-top: 14px; border-top: 1px solid #f1f4f8; }
.mg-sec:first-child { margin-top: 8px; padding-top: 0; border-top: none; }
.mg-sec .hint { font-weight: 400; margin-left: 6px; }
.mg-actions { display: flex; flex-direction: column; gap: 8px; justify-content: flex-end; padding-bottom: 4px; }

/* 域名池「分配」弹窗小控件 */
.pa-actions { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; margin: 12px 0; }
.pa-sel { display: inline-block; width: auto; min-width: 120px; padding: 6px 9px; font-size: 12.5px; }
/* 一键导入弹窗左下角「默认显示」开关 */
.im-show-toggle { display: flex; align-items: center; gap: 8px; margin-right: auto; font-size: 13px; color: var(--text-light); }

/* 嵌入式内容模式（iframe 内复用分配页） */
body.embed { background: #fff; margin: 0; padding: 0; }
body.embed .content { padding: 12px 14px; }
body.embed .page-actions { flex-wrap: wrap; }

/* ============ Toast ============ */
#toast-wrap { position: fixed; top: 20px; right: 20px; z-index: 999; display: flex; flex-direction: column; gap: 10px; }
.toast {
  padding: 12px 18px; border-radius: 8px; color: #fff; font-size: 14px; box-shadow: 0 8px 24px rgba(0,0,0,.2);
  animation: slideIn .25s ease;
}
.toast-success { background: #2eaa5f; }
.toast-error { background: #e5484d; }
.toast-info { background: #2f7cf6; }
.toast.hide { opacity: 0; transition: opacity .4s; }
@keyframes slideIn { from { transform: translateX(30px); opacity: 0; } to { transform: translateX(0); opacity: 1; } }

/* ============ 提示条 ============ */
.alert { padding: 12px 16px; border-radius: 8px; margin-bottom: 18px; font-size: 13.5px; }
.alert-success { background: #e5f6ec; color: #229350; }
.alert-error { background: #fdecec; color: #d3383d; }

/* ============ 分页 ============ */
.pagination { display: flex; align-items: center; gap: 6px; padding: 16px 22px; flex-wrap: wrap; }
.pagination a, .pagination span { padding: 6px 12px; border: 1px solid var(--border); border-radius: 6px; font-size: 13px; color: var(--text); }
.pagination a:hover { border-color: var(--primary); color: var(--primary); }
.pagination .active { background: var(--primary); color: #fff; border-color: var(--primary); }
.pagination .disabled { color: #c2cad6; cursor: not-allowed; }
.pagination .page-total { border: none; color: var(--text-light); }

/* ============ 移动端适配 ============ */
/* 汉堡按钮默认隐藏（仅移动端显示） */
.menu-toggle {
  display: none; align-items: center; justify-content: center;
  width: 38px; height: 38px; border-radius: 8px; border: 1px solid var(--border);
  background: #fff; color: var(--text); font-size: 20px; cursor: pointer; flex: 0 0 auto;
}
.sidebar-backdrop { display: none; }
.topbar-left { display: flex; align-items: center; gap: 12px; }

@media (max-width: 860px) {
  .menu-toggle { display: inline-flex; }
  .sidebar-backdrop {
    display: none; position: fixed; inset: 0; background: rgba(15,23,42,.5);
    z-index: 28; opacity: 0; transition: opacity .2s;
  }
  .sidebar-backdrop.show { display: block; opacity: 1; }

  /* 侧边栏改为抽屉 */
  .aside {
    position: fixed; top: 0; left: 0; bottom: 0; width: 264px; min-width: 264px;
    transform: translateX(-100%); transition: transform .25s ease; z-index: 30; overflow-y: auto;
    box-shadow: 0 0 40px rgba(0,0,0,.4);
  }
  body.sidebar-open .aside { transform: translateX(0); }
  .main { margin-left: 0; min-width: 0; }

  /* 顶栏 */
  .topbar { padding: 0 14px; height: 54px; }
  .topbar-title { font-size: 15px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
  .topbar-user { gap: 6px; font-size: 13px; }
  .topbar-user .user-name { display: none; }
  .topbar-user .avatar { width: 28px; height: 28px; font-size: 13px; }
  .topbar-user .tag.green { font-size: 11px; padding: 1px 7px; }

  /* 内容与卡片 */
  .content { padding: 14px 12px; }
  .card { margin-bottom: 16px; }
  /* 卡片头：窄屏允许换行，标题不收缩、不断行 */
  .card-head { flex-wrap: wrap; gap: 6px; padding: 14px 16px; }
  .card-head h3 { flex: 0 0 auto; white-space: nowrap; font-size: 14.5px; }
  .card-head .hint { flex: 1 1 100%; min-width: 0; margin-top: 2px; }
  /* 卡片搜索栏：窄屏占满一行 */
  .card-search { flex-wrap: wrap; padding: 12px 16px 2px; }
  .card-search input { width: 100%; max-width: none; }
  .card-search .hint { margin-left: auto; }

  /* 统计卡 */
  .stat-grid { grid-template-columns: repeat(2, 1fr); gap: 12px; }
  .stat-card { padding: 16px; }
  .stat-num { font-size: 27px; }

  /* 操作按钮与页面动作 */
  .page-actions { flex-wrap: wrap; gap: 8px; }
  .op { flex-wrap: wrap; white-space: normal; gap: 6px; }

  /* 表格：手机端改为堆叠卡片，避免左右滑动；列名标签由 JS 缓存到 data-label */
  .table { display: block; border: 0; }
  .table thead { display: none; }
  .table tbody { display: block; }
  .table tr { display: block; background: #fff; border: 1px solid var(--border); border-radius: 9px; margin: 0 0 10px; padding: 5px 12px; }
  .table td { display: flex; justify-content: space-between; align-items: flex-start; gap: 12px; padding: 8px 0; border-bottom: 1px solid #f1f4f8; white-space: normal; text-align: right; }
  .table td::before { content: attr(data-label); flex: 0 0 auto; min-width: 82px; color: var(--text-light); font-size: 12px; font-weight: 600; text-align: left; }
  .table td[data-label=""]::before { content: none; }
  .table td:last-child { border-bottom: none; }
  .table td.empty { display: block; text-align: center; padding: 22px; }
  .table td.empty::before { content: none; }
  /* 记录值列：桌面端限宽 260px，手机端要占满整行，否则该行底部分隔线只画一半 */
  .table td.value-cell { max-width: none; text-align: right; overflow-wrap: anywhere; }
  .table td.mono { overflow-wrap: anywhere; }
  /* 可复制单元格里有三个 flex 子项（::before 列名 + 文本 + ::after 复制图标），
     space-between 会把「值」挤到中间、图标孤零零贴在右边。
     改成 flex-end + 列名 margin-right:auto，让「值 + 复制图标」紧贴右侧。 */
  .table td.copyable { justify-content: flex-end; }
  .table td.copyable::before { margin-right: auto; }
  /* .im-scroll 里的窄列/不换行规则是给「勾选框列表」用的，
     手机端整行都变成卡片，必须复位，否则第一格只有 56px 宽会把内容挤到中间 */
  .im-scroll .table th, .im-scroll .table td { padding: 8px 0; white-space: normal; }
  .im-scroll .table th:first-child,
  .im-scroll .table td:first-child { width: auto; text-align: right; }
  /* 右侧统一预留「复制图标」的位置，图标改为绝对定位放进去。
     否则有图标的行（完整域名/记录值）文字被顶开约 29px，
     和没有图标的行（主机记录/类型/创建时间）右边缘对不齐。 */
  .table td, .im-scroll .table td { padding-right: 22px; }
  .table td.op { padding-right: 0; }
  .table td.empty { padding-right: 0; }
  .table td.copyable { position: relative; }
  .table td.copyable::after { position: absolute; right: 0; top: 50%; transform: translateY(-50%); margin-left: 0; }

  /* 操作列：手机端整齐按钮网格，等宽易点（置于 .table td 之后以覆盖其 display:flex） */
  td.op { display: grid; grid-template-columns: repeat(2, 1fr); gap: 8px; padding-top: 10px; }
  td.op::before { content: none; }
  /* 奇数个按钮时最后一个横跨整行，避免落单 */
  td.op .btn:last-child:nth-child(odd) { grid-column: span 2; }
  td.op .btn { width: 100%; min-width: 0; padding: 8px 4px; justify-content: center; white-space: nowrap; box-sizing: border-box; }

  /* 表单与分栏 */
  .row2 { grid-template-columns: 1fr; gap: 12px; }
  .form-inline { flex-direction: column; align-items: stretch; }
  .form-inline select, .form-inline input { width: 100%; min-width: 0; }
  .form-col { max-width: 100%; padding: 16px; }
  .im-bar { flex-wrap: wrap; }
  .im-bar .im-search { min-width: 0; width: 100%; }
  .im-scroll { max-height: 300px; }

  /* 域名横幅 */
  .domain-banner { padding: 14px 16px; }
  .db-row { flex-wrap: wrap; gap: 6px; }
  .db-label { width: auto; }

  /* 弹窗：近全宽 + 纵向可滚动 */
  dialog { width: calc(100vw - 28px); max-width: 480px; max-height: calc(100vh - 32px); }
  .dialog-head, .dialog-body, .dialog-foot { padding-left: 16px; padding-right: 16px; }
  .dialog-body { max-height: calc(100vh - 170px); overflow-y: auto; }
  .dialog-foot { flex-wrap: wrap; }
  .mg-actions { flex-direction: row; flex-wrap: wrap; }

  /* 登录/首页卡片 */
  .login-card, .home-card { padding: 28px 22px; }
}

@media (max-width: 420px) {
  .stat-grid { grid-template-columns: 1fr; }
  .content { padding: 12px 10px; }
  dialog { width: calc(100vw - 20px); }
}

/* 外部域名池：操作栏、搜索栏与批量选择 */
.ext-pool-actions { display: block; }
.ext-pool-actions-top { display: flex; align-items: center; gap: 10px; }
.ext-pool-actions > #ext_search { display: block; margin-top: 10px; }
.ext-pool-actions .hint { margin-left: 0; }
.ext-check-col { width: 42px; text-align: center !important; }
.ext-check-col input { width: 16px; height: 16px; margin: 0; vertical-align: middle; }
.ext-op-col { text-align: right !important; }
.ext-op-col .btn { margin-left: auto; }
@media (max-width: 640px) {
  .ext-pool-actions-top { flex-wrap: wrap; }
  .ext-pool-actions > #ext_search { width: 280px !important; }
}

/* ===== 域名注册局状态：异常时域名后面显示红色「!」，悬停看原因（不额外占 DOM） ===== */
.copyable.ds-hold { position: relative; padding-right: 2px; }
.copyable.ds-hold::after {
  content: '!';
  display: inline-block;
  width: 16px; height: 16px; line-height: 16px;
  margin-left: 6px;
  border-radius: 50%;
  background: #ef4444;
  color: #fff;
  font-size: 11px; font-weight: 700; text-align: center;
  vertical-align: middle;
  cursor: help;
  box-shadow: 0 0 0 2px rgba(239, 68, 68, .14);
}
.copyable.ds-hold:hover::before {
  content: attr(data-ds-tip);
  position: absolute;
  left: 50%; top: 150%;
  transform: translateX(-50%);
  z-index: 60;
  width: max-content;
  max-width: 340px;
  padding: 8px 10px;
  border-radius: 8px;
  background: #1f2937;
  color: #f9fafb;
  font-size: 12px; font-weight: 400; line-height: 1.6;
  white-space: normal;
  text-align: left;
  box-shadow: 0 8px 24px rgba(0, 0, 0, .25);
}
