/* ============ 基础 ============ */
* { box-sizing: border-box; }
html, body { margin: 0; padding: 0; }
body {
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", "PingFang SC",
    "Hiragino Sans GB", "Microsoft YaHei", sans-serif;
  background: #f3f5f9;
  color: #1f2937;
  font-size: 14px;
  line-height: 1.6;
}
.container { max-width: 1200px; margin: 0 auto; padding: 0 16px; }
a { color: #2563eb; text-decoration: none; }
a:hover { text-decoration: underline; }
.muted { color: #6b7280; }
.small { font-size: 12px; }
.mono { font-family: ui-monospace, SFMono-Regular, Consolas, "Courier New", monospace; }
code { background: #eef2ff; color: #4338ca; padding: 1px 5px; border-radius: 4px; font-size: 12px; }

/* ============ 顶栏 ============ */
.topbar { background: #fff; border-bottom: 1px solid #e5e7eb; position: sticky; top: 0; z-index: 50; }
.topbar-inner {
  display: flex; align-items: center; gap: 8px 18px;
  min-height: 56px; padding: 8px 0; flex-wrap: wrap;
}
.brand { font-weight: 700; font-size: 16px; color: #111827; white-space: nowrap; flex: 0 0 auto; }
.brand:hover { text-decoration: none; }
/* 菜单项较多时整体换行到第二行，保证每项都可见（绝不压缩成竖排单字） */
.nav { display: flex; gap: 4px; flex: 1 1 520px; flex-wrap: wrap; }
.nav a {
  color: #4b5563; padding: 6px 10px; border-radius: 8px; font-size: 13.5px;
  white-space: nowrap; flex: 0 0 auto;
}
.nav a:hover { background: #f3f4f6; text-decoration: none; }
.nav a.active { background: #2563eb; color: #fff; }

/* ============ 分组下拉菜单 ============ */
.nav-group { position: relative; flex: 0 0 auto; }
.nav-toggle {
  display: inline-flex; align-items: center; gap: 4px;
  background: none; border: 0; font: inherit; font-size: 13.5px; color: #4b5563;
  padding: 6px 10px; border-radius: 8px; cursor: pointer; white-space: nowrap;
}
.nav-toggle:hover { background: #f3f4f6; }
.nav-group.active > .nav-toggle { background: #eff6ff; color: #2563eb; font-weight: 600; }
.caret { font-size: 10px; opacity: .7; }
.nav-menu {
  display: none; position: absolute; top: calc(100% + 6px); left: 0; z-index: 80;
  min-width: 172px; background: #fff; border: 1px solid #e5e7eb; border-radius: 10px;
  box-shadow: 0 12px 32px rgba(15, 23, 42, .14); padding: 6px;
}
.nav-menu-right { left: auto; right: 0; }
.nav-group.open > .nav-menu { display: block; }
.nav-menu a {
  display: block; padding: 8px 10px; border-radius: 8px; font-size: 13.5px;
  color: #374151; white-space: nowrap;
}
.nav-menu a:hover { background: #f3f4f6; text-decoration: none; }
.nav-menu a.active { background: #2563eb; color: #fff; }

/* 右上角账号下拉 */
.user-group .user-toggle { padding: 4px 8px; }
.user-group .email { max-width: 160px; overflow: hidden; text-overflow: ellipsis; }

/* 落地页顶栏（已登录时多出一排链接） */
.landing-nav-links { display: flex; gap: 2px; flex: 1 1 auto; flex-wrap: wrap; }
.landing-nav-links a {
  color: #4b5563; padding: 6px 10px; border-radius: 8px; font-size: 13.5px; white-space: nowrap;
}
.landing-nav-links a:hover { background: #f3f4f6; text-decoration: none; }

/* 保留前缀的标签云 */
.reserved-chips { display: flex; flex-wrap: wrap; gap: 6px; }
.chip {
  background: #f1f5f9; color: #334155; border: 1px solid #e2e8f0;
  padding: 2px 9px; border-radius: 999px; font-size: 12.5px;
  font-family: ui-monospace, Consolas, monospace;
}

/* 注册赠送积分提示 */
.gift-banner {
  background: #fffbeb; border: 1px solid #fde68a; color: #92400e;
  border-radius: 8px; padding: 9px 12px; font-size: 13.5px; margin: 0 0 14px; text-align: center;
}
.gift-banner strong { color: #b45309; }
.landing-gift { margin: 14px 0 0; color: #92400e; font-size: 14px; }
.landing-gift strong { color: #b45309; }

/* 推广卡片 */
.referral-card { border-color: #bfdbfe; background: linear-gradient(180deg, #f8fbff 0%, #fff 60%); }
.copy-row { display: flex; gap: 6px; margin-top: 4px; }
.copy-row input {
  flex: 1; padding: 8px 10px; border: 1px solid #d1d5db; border-radius: 8px;
  background: #f9fafb; font-family: ui-monospace, Consolas, monospace; font-size: 13px; color: #374151;
}
.userbox { display: flex; align-items: center; gap: 8px; }
.userbox .email { color: #374151; }

/* ============ 布局 ============ */
.page { padding: 20px 16px 40px; }
.page-head {
  display: flex; align-items: center; justify-content: space-between;
  gap: 12px; flex-wrap: wrap; margin: 4px 0 16px;
}
.page-head h2 { margin: 0; font-size: 20px; }
.head-actions { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.footer { color: #9ca3af; font-size: 12px; padding: 20px 0 30px; text-align: center; }

/* ============ 卡片 ============ */
.card {
  background: #fff; border: 1px solid #e5e7eb; border-radius: 12px;
  padding: 16px 18px; margin-bottom: 16px; box-shadow: 0 1px 2px rgba(0,0,0,.03);
}
.card-head {
  display: flex; align-items: center; justify-content: space-between;
  gap: 10px; flex-wrap: wrap; margin-bottom: 12px;
}
.card-head h3 { margin: 0; font-size: 15px; }

/* ============ 提示条 ============ */
.alert {
  border-radius: 8px; padding: 10px 14px; margin: 0 0 14px; font-size: 14px;
  border: 1px solid transparent;
}
.alert-success { background: #ecfdf5; color: #065f46; border-color: #a7f3d0; }
.alert-error   { background: #fef2f2; color: #991b1b; border-color: #fecaca; }
.alert-info    { background: #eff6ff; color: #1e40af; border-color: #bfdbfe; }
.alert-warning { background: #fffbeb; color: #92400e; border-color: #fde68a; }

/* 未备案域名警告：比普通提示更醒目（左侧橙色描边 + 淡斜纹底） */
.unfiled-alert {
  border-left: 5px solid #f59e0b;
  background-image: repeating-linear-gradient(135deg, rgba(245, 158, 11, .07) 0 10px, transparent 10px 20px);
  line-height: 1.7;
}
.unfiled-alert strong { color: #b45309; }
.unfiled-agree { border: 1px solid #fde68a; background: #fffbeb; border-radius: 8px; padding: 10px 12px; }
.unfiled-agree input[type="checkbox"] { margin-top: 3px; }

/* ============ 通用弹窗 ============ */
body.modal-open { overflow: hidden; }

.modal-mask {
  position: fixed; inset: 0; z-index: 1000;
  display: none; align-items: center; justify-content: center;
  padding: 20px; background: rgba(15, 23, 42, .58);
  -webkit-backdrop-filter: blur(2px); backdrop-filter: blur(2px);
}
.modal-mask.open { display: flex; }

.modal {
  width: 100%; max-width: 640px; max-height: 90vh; overflow: auto;
  background: #fff; border-radius: 14px;
  box-shadow: 0 24px 64px rgba(15, 23, 42, .35);
  animation: modal-in .18s ease-out;
}
@keyframes modal-in {
  from { transform: translateY(14px) scale(.99); opacity: 0; }
  to   { transform: none; opacity: 1; }
}

.modal-head {
  display: flex; align-items: center; justify-content: space-between; gap: 12px;
  padding: 15px 20px; border-bottom: 1px solid #eef2f7;
}
.modal-head h3 { margin: 0; font-size: 17px; }
.modal-close {
  background: none; border: none; cursor: pointer; padding: 0 4px;
  font-size: 26px; line-height: 1; color: #9ca3af;
}
.modal-close:hover { color: #374151; }

.modal-body { padding: 18px 20px; }
.modal-foot {
  display: flex; justify-content: flex-end; flex-wrap: wrap; gap: 10px;
  padding: 14px 20px; border-top: 1px solid #eef2f7; background: #fafbfc;
  border-radius: 0 0 14px 14px;
}

/* API 密钥展示框 */
.key-box { display: flex; gap: 10px; align-items: stretch; margin: 12px 0 6px; }
.key-box code {
  flex: 1; min-width: 0; display: block; padding: 13px 15px;
  background: #0f172a; color: #7dd3fc; border-radius: 10px;
  font-size: 13px; line-height: 1.65; word-break: break-all;
  user-select: all; -webkit-user-select: all;
}
.key-box .btn { flex: none; align-self: center; }
.key-state { min-height: 20px; font-size: 13px; }
.key-state.ok  { color: #059669; font-weight: 600; }
.key-state.bad { color: #b45309; }
.key-held { font-weight: 600; }
@media (max-width: 560px) {
  .key-box { flex-direction: column; }
  .key-box .btn { align-self: stretch; }
}

/* ============ 权限组编辑 ============ */
.perm-group {
  border: 1px solid #eef2f7; border-radius: 10px;
  padding: 10px 12px; margin: 0 0 12px; background: #fcfdff;
}
.perm-group-head { margin-bottom: 8px; padding-bottom: 6px; border-bottom: 1px dashed #eef2f7; }
.perm-items { display: grid; grid-template-columns: repeat(auto-fill, minmax(280px, 1fr)); gap: 6px; }
.perm-item {
  display: flex; align-items: flex-start; gap: 8px;
  padding: 7px 9px; border: 1px solid transparent; border-radius: 8px;
  font-size: 13px; line-height: 1.5; cursor: pointer;
}
.perm-item:hover { background: #fff; border-color: #e5e7eb; }
.perm-item input[type="checkbox"] { margin-top: 3px; flex: none; }
.perm-item > span { display: block; min-width: 0; }
.perm-item strong { display: block; }
.perm-item .small { display: block; }
.perm-item .mono { display: block; font-size: 11px; opacity: .75; }
.perm-risk { display: block; color: #b91c1c; font-size: 12px; }

/* ============ 按钮 ============ */
.btn {
  display: inline-block; padding: 7px 14px; border: 1px solid #d1d5db;
  background: #fff; color: #374151; border-radius: 8px; cursor: pointer;
  font-size: 14px; line-height: 1.4; text-decoration: none !important;
  transition: all .15s; vertical-align: middle;
}
.btn:hover { background: #f9fafb; border-color: #9ca3af; }
.btn-primary { background: #2563eb; border-color: #2563eb; color: #fff; }
.btn-primary:hover { background: #1d4ed8; border-color: #1d4ed8; }
.btn-danger { background: #dc2626; border-color: #dc2626; color: #fff; }
.btn-danger:hover { background: #b91c1c; border-color: #b91c1c; }
.btn-outline { background: transparent; }
.btn-sm { padding: 4px 10px; font-size: 13px; border-radius: 6px; }
.btn-block { width: 100%; }

/* ============ 表格 ============ */
.table-scroll { overflow-x: auto; }
.table { width: 100%; border-collapse: collapse; }
.table th, .table td { padding: 9px 10px; text-align: left; border-bottom: 1px solid #f0f1f4; vertical-align: middle; }
.table thead th { font-weight: 600; color: #6b7280; font-size: 12.5px; background: #fafbfc; white-space: nowrap; }
.table tr:hover td { background: #fafbff; }
.table-compact td { font-size: 13px; }
.td-actions { white-space: nowrap; }
.td-actions .btn { margin-right: 2px; }
.content-cell { max-width: 320px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.empty { color: #9ca3af; text-align: center; padding: 36px 0; margin: 0; }
.filter-form { display: flex; gap: 8px; flex-wrap: wrap; }
.filter-form input[type="text"], .filter-form select { padding: 6px 10px; }

/* ============ 徽章 ============ */
.badge {
  display: inline-block; padding: 2px 9px; border-radius: 999px; font-size: 12px;
  font-weight: 500; line-height: 1.5; white-space: nowrap;
}
.badge-green  { background: #d1fae5; color: #065f46; }
.badge-red    { background: #fee2e2; color: #991b1b; }
.badge-orange { background: #ffedd5; color: #9a3412; }
.badge-gray   { background: #f3f4f6; color: #4b5563; }
.badge-blue   { background: #dbeafe; color: #1e40af; }
.type-A, .type-AAAA { background: #e0e7ff; color: #3730a3; }
.type-CNAME { background: #cffafe; color: #155e75; }
.type-TXT   { background: #fce7f3; color: #9d174d; }
.type-MX    { background: #fef3c7; color: #92400e; }
.type-NS    { background: #e5e7eb; color: #374151; }
.role-badge { padding: 2px 8px; border-radius: 6px; font-size: 12px; background: #f3f4f6; color: #4b5563; }
.role-badge.admin { background: #fee2e2; color: #991b1b; }

/* ============ 统计卡 ============ */
.stat-grid {
  display: grid; grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
  gap: 12px; margin-bottom: 16px;
}
.stat-card {
  background: #fff; border: 1px solid #e5e7eb; border-radius: 12px;
  padding: 16px; text-align: center;
}
.stat-num { font-size: 26px; font-weight: 700; color: #2563eb; }
.stat-label { color: #6b7280; font-size: 13px; margin-top: 2px; }
.quick-links { display: flex; gap: 8px; flex-wrap: wrap; align-items: center; }

/* ============ 表单 ============ */
.form-card { max-width: 760px; }
.form-stack { display: flex; flex-direction: column; gap: 14px; }
.form-stack label { display: block; font-size: 13px; color: #374151; font-weight: 500; }
.form-stack input[type="text"], .form-stack input[type="email"], .form-stack input[type="password"],
.form-stack input[type="number"], .form-stack select, .form-stack textarea,
.auth-card input[type="email"], .auth-card input[type="password"], .auth-card input[type="text"] {
  width: 100%; margin-top: 4px; padding: 8px 10px; border: 1px solid #d1d5db;
  border-radius: 8px; font-size: 14px; background: #fff; color: #111827; outline: none;
}
.form-stack input:focus, .form-stack select:focus, .form-stack textarea:focus,
.auth-card input:focus { border-color: #2563eb; box-shadow: 0 0 0 3px rgba(37,99,235,.12); }
.form-stack textarea { resize: vertical; font-family: inherit; }
.form-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; }
.field-hint { display: block; font-weight: 400; color: #9ca3af; font-size: 12px; margin-top: 3px; }
.check-row { display: flex !important; align-items: center; gap: 8px; flex-direction: row !important; }
.check-row input { width: auto !important; margin: 0 !important; }
.form-actions { display: flex; gap: 10px; margin-top: 6px; }
.select, select { padding: 6px 10px; border: 1px solid #d1d5db; border-radius: 8px; background: #fff; }
.inline-form { display: flex; gap: 6px; align-items: center; flex-wrap: wrap; }
.code-row { display: flex; gap: 10px; align-items: flex-end; }

/* ============ 分页 ============ */
.pagination { display: flex; align-items: center; gap: 10px; margin-top: 14px; }

/* ============ 登录页 ============ */
.auth-body { background: linear-gradient(135deg, #eff6ff 0%, #f5f3ff 100%); min-height: 100vh; }
.auth-wrap { display: flex; align-items: center; justify-content: center; min-height: 100vh; padding: 20px; }
.auth-card {
  background: #fff; border-radius: 16px; box-shadow: 0 12px 40px rgba(15, 23, 42, .12);
  padding: 32px 34px; width: 100%; max-width: 400px;
}
.auth-title { margin: 0 0 4px; font-size: 20px; text-align: center; }
.auth-sub { text-align: center; color: #9ca3af; margin: 0 0 18px; font-size: 13px; }
.auth-foot { text-align: center; color: #9ca3af; font-size: 13px; margin: 16px 0 0; }
.auth-tip { color: #6b7280; font-size: 12.5px; text-align: center; margin: 8px 0 0; }
.tabs { display: flex; border-bottom: 1px solid #e5e7eb; margin-bottom: 18px; }
.tab { flex: 1; text-align: center; padding: 9px 0; color: #6b7280; border-bottom: 2px solid transparent; }
.tab:hover { text-decoration: none; color: #2563eb; }
.tab.on { color: #2563eb; border-bottom-color: #2563eb; font-weight: 600; }

/* ============ 套餐商店 ============ */
.plan-grid {
  display: grid; grid-template-columns: repeat(auto-fill, minmax(230px, 1fr)); gap: 14px;
}
.plan-card {
  border: 1px solid #e5e7eb; border-radius: 12px; padding: 16px;
  display: flex; flex-direction: column; background: #fff;
  transition: box-shadow .15s, transform .15s;
}
.plan-card:hover { box-shadow: 0 8px 24px rgba(15, 23, 42, .08); transform: translateY(-2px); }
.plan-name { font-weight: 600; font-size: 15px; margin-bottom: 6px; }
.plan-price { font-size: 22px; font-weight: 700; color: #dc2626; margin-bottom: 10px; }
.plan-unit { font-size: 12px; color: #9ca3af; font-weight: 400; }
.plan-features { list-style: none; padding: 0; margin: 0 0 12px; color: #4b5563; font-size: 13px; flex: 1; }
.plan-features li { padding: 3px 0 3px 16px; position: relative; }
.plan-features li::before { content: '·'; position: absolute; left: 4px; color: #2563eb; font-weight: 700; }

/* ============ 顶栏余额 / 前缀输入 ============ */
.balance-chip {
  background: #ecfdf5; color: #065f46; border: 1px solid #a7f3d0;
  padding: 2px 10px; border-radius: 999px; font-size: 13px; font-weight: 600; white-space: nowrap;
}
.prefix-row { display: flex; align-items: center; gap: 6px; }
.prefix-row input { flex: 1; }
.prefix-suffix {
  color: #6b7280; font-family: ui-monospace, Consolas, monospace; font-size: 13px;
  background: #f3f4f6; padding: 8px 10px; border-radius: 8px; white-space: nowrap;
}
.amount-in { color: #059669; font-weight: 600; }
.amount-out { color: #dc2626; font-weight: 600; }
.pay-methods { display: flex; flex-direction: column; gap: 6px; margin-top: 6px; }
.pay-methods .check-row { font-weight: 400; font-size: 13.5px; }

/* ============ 落地页（未登录首页） ============ */
.landing-body { background: #f7f8fb; }
.landing-nav {
  background: #fff; border-bottom: 1px solid #e5e7eb; position: sticky; top: 0; z-index: 20;
}
.landing-nav-inner { display: flex; align-items: center; justify-content: space-between; height: 60px; }
.landing-nav-actions { display: flex; gap: 8px; }
.landing-hero {
  background: linear-gradient(135deg, #eef2ff 0%, #f5f3ff 55%, #ecfeff 100%);
  padding: 64px 0 52px; text-align: center;
}
.landing-hero h1 { font-size: 34px; line-height: 1.3; margin: 0 0 14px; color: #111827; }
.landing-sub { max-width: 720px; margin: 0 auto 26px; color: #4b5563; font-size: 15px; }
.landing-cta { display: flex; gap: 12px; justify-content: center; flex-wrap: wrap; margin-bottom: 30px; }
.btn-lg { padding: 11px 22px; font-size: 15px; }
.landing-query {
  background: #fff; border: 1px solid #e5e7eb; border-radius: 14px; padding: 18px 20px;
  max-width: 720px; margin: 0 auto; box-shadow: 0 10px 30px rgba(15,23,42,.06); text-align: left;
}
.landing-query-title { font-weight: 600; margin-bottom: 12px; }
.landing-query-form { display: flex; gap: 8px; flex-wrap: wrap; }
.landing-query-form input {
  flex: 1; min-width: 180px; padding: 9px 12px; border: 1px solid #d1d5db; border-radius: 8px; font-size: 14px;
}
.landing-query-result { margin-top: 10px; font-size: 14px; min-height: 20px; color: #6b7280; }
.landing-query-result.ok { color: #059669; font-weight: 600; }
.landing-query-result.bad { color: #dc2626; font-weight: 600; }
.landing-query-result.warn { color: #b45309; }
.landing-features {
  display: grid; grid-template-columns: repeat(auto-fit, minmax(220px, 1fr)); gap: 16px;
  margin: 44px auto;
}
.feature-card { background: #fff; border: 1px solid #e5e7eb; border-radius: 12px; padding: 20px; }
.feature-card h3 { margin: 8px 0 6px; font-size: 15px; }
.feature-card p { margin: 0; color: #6b7280; font-size: 13.5px; }
.feature-icon { font-size: 22px; }
.landing-section { margin: 40px auto; }
.landing-h2 { font-size: 20px; margin: 0 0 16px; }
.landing-faq p { margin: 0 0 14px; color: #4b5563; font-size: 14px; }
.landing-footer { border-top: 1px solid #e5e7eb; padding: 22px 0 34px; color: #9ca3af; font-size: 13px; text-align: center; }

/* 公告条目 */
.announcement-item { padding: 12px 0; border-bottom: 1px solid #f0f1f4; }
.announcement-item:last-child { border-bottom: none; }
.announcement-head { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; margin-bottom: 6px; }
.announcement-body { color: #4b5563; font-size: 13.5px; line-height: 1.7; }

/* 代码块（API 文档） */
.code-block {
  background: #0f172a; color: #e2e8f0; padding: 14px 16px; border-radius: 10px;
  font-family: ui-monospace, SFMono-Regular, Consolas, monospace; font-size: 12.5px;
  line-height: 1.65; overflow-x: auto; white-space: pre; margin: 10px 0;
}

/* 顶栏项目较多时的收敛（规则已合并到上方 .nav 定义中） */

@media (max-width: 700px) {
  .form-grid { grid-template-columns: 1fr; }
  .nav a { padding: 6px 8px; font-size: 13px; }
  .userbox .email { display: none; }
  .topbar-inner { height: auto; flex-wrap: wrap; padding: 8px 0; gap: 10px; }
}
