/* ============================================================================
   天启云商 · 运营后台（与 shop.css 搭配使用：复用按钮/表单/面板等基础组件）
   ============================================================================ */

body.admin { background: var(--bg); }

.admin-shell { min-height: 100vh; display: flex; flex-direction: column; }

.admin-header {
  position: sticky; top: 0; z-index: 40;
  display: flex; align-items: center; gap: 18px; flex-wrap: wrap;
  padding: 10px 22px;
  background: var(--surface); border-bottom: 1px solid var(--border);
  box-shadow: var(--shadow-sm);
}
.admin-header .brand-text strong { font-size: 14.5px; }
.admin-header .brand-text small { font-size: 11.5px; }

.tabs { display: flex; gap: 4px; flex-wrap: wrap; }
.tab {
  padding: 7px 13px; font: inherit; font-size: 13px;
  color: var(--text-2); background: transparent;
  border: 1px solid transparent; border-radius: 999px; cursor: pointer;
}
.tab:hover { background: var(--primary-soft); color: var(--primary-dark); }
.tab.active { background: var(--primary); border-color: var(--primary); color: #fff; font-weight: 600; }

.header-actions { margin-left: auto; display: flex; align-items: center; gap: 10px; }
.chip {
  padding: 4px 9px; font-size: 12px; border-radius: 999px;
  background: var(--surface-2); border: 1px solid var(--border); color: var(--muted);
}
.chip code { font-size: 11.5px; }

.admin-main { flex: 1; max-width: 1400px; width: 100%; margin: 0 auto; padding: 18px 22px 60px; }
.admin-main h2 { font-size: 16px; margin-bottom: 12px; }
.section { margin-bottom: 18px; }

/* ---------- 概览 ---------- */
.stat-grid { display: grid; gap: 12px; grid-template-columns: repeat(auto-fill, minmax(180px, 1fr)); }
.stat {
  padding: 14px 16px; border-radius: var(--radius); background: var(--surface);
  border: 1px solid var(--border); box-shadow: var(--shadow-sm);
}
.stat .label { color: var(--muted); font-size: 12.5px; }
.stat .value { font-size: 24px; font-weight: 700; color: var(--text); line-height: 1.3; }
.stat.accent .value { color: var(--primary); }
.stat.warn .value { color: var(--warn); }
.stat.ok .value { color: var(--success); }
.stat.bad .value { color: var(--danger); }

/* ---------- 表格 ---------- */
.table-wrap { overflow: auto; border-radius: var(--radius); }
.table { width: 100%; border-collapse: collapse; font-size: 13px; background: var(--surface); }
.table th, .table td { padding: 9px 11px; text-align: left; border-bottom: 1px solid var(--border); vertical-align: middle; }
.table th { background: var(--surface-2); color: var(--muted); font-weight: 600; white-space: nowrap; }
.table tbody tr:hover td { background: #f8fafc; }
.table td.num, .table th.num { text-align: right; font-variant-numeric: tabular-nums; }
.table td.actions-cell { white-space: nowrap; display: flex; gap: 6px; flex-wrap: wrap; }
.table .mono { font-size: 12px; }
.table .ellipsis { max-width: 260px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

/* ---------- 工具条 / 表单行 ---------- */
.bar { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; margin-bottom: 12px; }
.bar .grow { flex: 1; }
.bar .input, .bar .select { width: auto; min-width: 140px; }

.form-grid { display: grid; gap: 12px; grid-template-columns: repeat(auto-fill, minmax(210px, 1fr)); }
.form-grid .full { grid-column: 1 / -1; }
.form-actions { display: flex; gap: 10px; margin-top: 4px; }

/* ---------- 登录遮罩 ---------- */
.login-mask {
  position: fixed; inset: 0; z-index: 200;
  display: grid; place-items: center;
  background: linear-gradient(160deg, #1e293b, #0f172a);
}
.login-card {
  width: min(380px, 92vw); padding: 26px;
  background: var(--surface); border-radius: var(--radius-lg);
  box-shadow: var(--shadow-lg);
  display: flex; flex-direction: column; gap: 12px;
}
.login-card h1 { font-size: 18px; }
.login-card .help { color: var(--muted); font-size: 12.5px; }

/* ---------- 模态框（改价 / 调余额 / 申诉回复 / 订单明细） ---------- */
.modal-mask {
  position: fixed; inset: 0; z-index: 150;
  display: grid; place-items: center;
  background: rgba(15, 23, 42, 0.45);
  padding: 20px;
}
.modal {
  width: min(560px, 96vw); max-height: 88vh; overflow: auto;
  background: var(--surface); border-radius: var(--radius-lg);
  box-shadow: var(--shadow-lg);
  display: flex; flex-direction: column;
}
.modal-head {
  display: flex; align-items: center; justify-content: space-between;
  padding: 14px 18px; border-bottom: 1px solid var(--border);
}
.modal-body { padding: 16px 18px; display: flex; flex-direction: column; gap: 12px; }
.modal-foot {
  display: flex; justify-content: flex-end; gap: 10px;
  padding: 12px 18px; border-top: 1px solid var(--border); background: var(--surface-2);
}
.modal .kv { grid-template-columns: 110px 1fr; }

/* ---------- 杂项 ---------- */
.muted { color: var(--muted); font-size: 12.5px; }
.err-text { color: var(--danger); font-size: 12.5px; min-height: 18px; }

/* ---------- 窄屏（手机）适配：头部三块各占一行，避免整页被撑宽 ---------- */
@media (max-width: 820px) {
  .admin-header { gap: 10px; padding: 10px 12px; }
  .admin-header .brand { flex: 1 1 100%; }
  .tabs { order: 3; flex: 1 1 100%; }
  .header-actions { flex-wrap: wrap; margin-left: 0; width: 100%; gap: 8px; }
  .site-picker { flex-wrap: wrap; }
  .site-picker .select { min-width: 0; max-width: 150px; }
  .site-picker .input { width: 92px; }
  .table-wrap table { min-width: 560px; }
  .badge { white-space: nowrap; }
  .panel-head { flex-wrap: wrap; }
  .panel-head h3 { flex: 1 1 100%; }
}
/* ---------- 安全检查（系统 · 安全检查） ---------- */
.sec-score { font-size: 34px; font-weight: 800; line-height: 1; }
.sec-risk { background: #fef2f2; border-left: 3px solid #fca5a5; color: #7f1d1d; padding: 8px 10px; border-radius: 8px; font-size: 13px; line-height: 1.7; margin-top: 6px; }
.sec-facts { display: grid; grid-template-columns: repeat(auto-fit, minmax(220px, 1fr)); gap: 10px 18px; font-size: 12.5px; }
.sec-facts .mono { word-break: break-all; }
@media (max-width: 820px) {
  .sec-score { font-size: 28px; }
  .sec-facts { grid-template-columns: 1fr; }
}
/* ---------- 域名管理：证书失败详情 ---------- */
.cert-fail-row > td { background: #fff7f7; }
.cert-fail { display: grid; gap: 8px; padding: 2px 0; }
.cert-fail-line { display: flex; gap: 10px; font-size: 13px; line-height: 1.7; }
.cert-fail-k { flex: 0 0 108px; color: #64748b; font-weight: 600; }
.cert-fix { background: #f0fdf4; border-left: 3px solid #86efac; color: #14532d; padding: 6px 10px; border-radius: 8px; }
@media (max-width: 820px) {
  .cert-fail-line { flex-direction: column; gap: 4px; }
  .cert-fail-k { flex: none; }
}