/* =============================================================================
   企微系统 · 总后台样式（主域名 llij.cn/admin）
   开账号 · 配专属域名 · 站点设置
   ============================================================================= */

* { margin: 0; padding: 0; box-sizing: border-box; }

body {
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', 'Roboto', 'Helvetica Neue', 'PingFang SC', 'Microsoft YaHei', sans-serif;
  min-height: 100vh;
  background: #f5f7fa;
  padding: 20px;
  color: #1e293b;
}

.hidden { display: none !important; }

/* ==================== 容器 ==================== */

.shell {
  width: 100%;
  max-width: 1400px;
  margin: 0 auto;
}

.card {
  background: #fff;
  border: 1px solid #e2e8f0;
  border-radius: 20px;
  box-shadow: 0 10px 40px rgba(0, 0, 0, .05);
  padding: 28px 32px;
  margin-bottom: 20px;
}

/* ==================== 顶部 ==================== */

.topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  flex-wrap: wrap;
  margin-bottom: 20px;
}

.brand { display: flex; align-items: center; gap: 10px; }
.brand .dot {
  width: 10px; height: 10px; border-radius: 50%;
  background: #3b82f6; box-shadow: 0 0 0 4px rgba(59, 130, 246, .14);
}
.brand-name { font-size: 17px; font-weight: 600; }
.brand-sub {
  font-size: 12.5px; color: #64748b;
  padding-left: 12px; border-left: 1px solid #e2e8f0;
}
.topbar-right { display: flex; align-items: center; gap: 10px; }
.topbar-user { font-size: 13.5px; color: #475569; }

/* ==================== 按钮 ==================== */

.btn {
  padding: 10px 18px;
  border: none;
  border-radius: 10px;
  font-size: 13.5px;
  font-weight: 500;
  cursor: pointer;
  transition: all .2s ease;
  font-family: inherit;
  white-space: nowrap;
}

.btn-primary { background: #3b82f6; color: #fff; }
.btn-primary:hover { background: #2563eb; box-shadow: 0 4px 12px rgba(59, 130, 246, .28); }

.btn-ghost { background: #fff; color: #475569; border: 1px solid #e2e8f0; }
.btn-ghost:hover { border-color: #3b82f6; color: #3b82f6; }

.btn-green { background: #10b981; color: #fff; }
.btn-green:hover { background: #059669; }

.btn-danger { background: #ef4444; color: #fff; }
.btn-danger:hover { background: #dc2626; }

.btn:disabled { opacity: .55; cursor: not-allowed; box-shadow: none; }

/* ==================== 统计卡 ==================== */

.stat-row {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 16px;
  margin-bottom: 20px;
}

.stat-card {
  background: #fff;
  border: 1px solid #e2e8f0;
  border-radius: 16px;
  padding: 20px 22px;
}

.stat-num { font-size: 28px; font-weight: 700; line-height: 1.2; color: #1e293b; }
.stat-cap { font-size: 12.5px; color: #64748b; margin-top: 4px; }

/* ==================== 标签页 ==================== */

.tabs { display: flex; gap: 8px; margin-bottom: 18px; flex-wrap: wrap; }

.tab-btn {
  padding: 10px 18px;
  background: #fff;
  border: 1px solid #e2e8f0;
  border-radius: 10px;
  font-size: 13.5px;
  cursor: pointer;
  font-family: inherit;
  color: #475569;
  transition: all .2s ease;
}

.tab-btn.active {
  color: #3b82f6;
  border-color: rgba(59, 130, 246, .45);
  background: rgba(59, 130, 246, .06);
}

/* ==================== 工具栏 ==================== */

.toolbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
  flex-wrap: wrap;
  margin-bottom: 16px;
}

.toolbar-left { display: flex; gap: 10px; align-items: center; flex: 1; flex-wrap: wrap; }

.input-group { margin-bottom: 18px; }

.input-group label {
  display: block;
  margin-bottom: 7px;
  font-size: 13.5px;
  font-weight: 500;
  color: #334155;
}

.input-group input,
.input-group select {
  width: 100%;
  padding: 12px 14px;
  border: 1.5px solid #e2e8f0;
  border-radius: 10px;
  font-size: 14px;
  color: #1e293b;
  background: #fafbfc;
  outline: none;
  transition: all .2s ease;
  font-family: inherit;
}

.input-group input:focus,
.input-group select:focus {
  border-color: #3b82f6;
  background: #fff;
  box-shadow: 0 0 0 3px rgba(59, 130, 246, .1);
}

.input-group .hint { font-size: 12px; color: #94a3b8; margin-top: 6px; }

.search {
  width: 100%;
  max-width: 280px;
  padding: 11px 14px;
  border: 1.5px solid #e2e8f0;
  border-radius: 10px;
  font-size: 13.5px;
  background: #fafbfc;
  outline: none;
  font-family: inherit;
}

.search:focus { border-color: #3b82f6; background: #fff; }

.filter-select {
  padding: 11px 12px;
  border: 1.5px solid #e2e8f0;
  border-radius: 10px;
  font-size: 13.5px;
  background: #fff;
  color: #475569;
  font-family: inherit;
  outline: none;
}

/* ==================== 表格 ==================== */

.table-wrap {
  border: 1px solid #e2e8f0;
  border-radius: 14px;
  overflow: auto;
  background: #fff;
}

table { width: 100%; border-collapse: collapse; font-size: 13.5px; }

th {
  text-align: left;
  font-size: 12px;
  color: #64748b;
  font-weight: 500;
  padding: 13px 14px;
  border-bottom: 1px solid #e2e8f0;
  white-space: nowrap;
  background: #f8fafc;
}

td { padding: 13px 14px; border-bottom: 1px solid #f1f5f9; vertical-align: middle; }
tbody tr:last-child td { border-bottom: none; }
tbody tr:hover { background: #fafcff; }

.mono { font-family: ui-monospace, Menlo, Consolas, monospace; font-size: 12.5px; }

.badge {
  display: inline-block;
  padding: 2px 10px;
  border-radius: 999px;
  font-size: 11.5px;
  font-weight: 600;
  white-space: nowrap;
}

.badge.admin { background: #dbeafe; color: #1d4ed8; }
.badge.tenant { background: #ede9fe; color: #6d28d9; }
.badge.user { background: #ecfdf5; color: #047857; }
.badge.on { background: #d1fae5; color: #047857; }
.badge.off { background: #fee2e2; color: #b91c1c; }
.badge.exp { background: #fef3c7; color: #b45309; }
.badge.id { background: #f1f5f9; color: #475569; }

.ops { display: flex; gap: 7px; flex-wrap: wrap; }

.op-btn {
  padding: 6px 12px;
  background: #fff;
  border: 1px solid #e2e8f0;
  color: #475569;
  border-radius: 8px;
  font-size: 12.5px;
  cursor: pointer;
  font-family: inherit;
  transition: all .2s ease;
  white-space: nowrap;
}

.op-btn:hover { border-color: #3b82f6; color: #3b82f6; }
.op-btn.primary { color: #3b82f6; border-color: rgba(59, 130, 246, .4); }
.op-btn.danger:hover { border-color: #ef4444; color: #ef4444; }

.empty { padding: 50px 20px; text-align: center; color: #94a3b8; font-size: 13.5px; }

/* ==================== 设置表单 ==================== */

.settings-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 0 22px;
}

.settings-grid .full { grid-column: 1 / -1; }

/* ==================== 日志 ==================== */

.log-list { display: flex; flex-direction: column; gap: 10px; max-height: 560px; overflow-y: auto; }

.log-row {
  border: 1px solid #e2e8f0;
  border-radius: 12px;
  padding: 13px 16px;
  background: #fff;
  display: flex;
  justify-content: space-between;
  gap: 14px;
  align-items: flex-start;
}

.log-main { flex: 1; min-width: 0; }
.log-title { font-size: 13.5px; font-weight: 600; color: #1e293b; margin-bottom: 3px; }
.log-detail { font-size: 12.5px; color: #64748b; word-break: break-all; }
.log-time { font-size: 12px; color: #94a3b8; white-space: nowrap; }

/* ==================== 弹窗 ==================== */

.modal {
  display: none;
  position: fixed;
  top: 0; left: 0;
  width: 100%; height: 100%;
  background: rgba(0, 0, 0, .4);
  align-items: center;
  justify-content: center;
  z-index: 1000;
  padding: 20px;
}

.modal.active { display: flex; }

.modal-content {
  background: #fff;
  border-radius: 20px;
  padding: 32px;
  width: 90%;
  max-width: 480px;
  max-height: 90vh;
  overflow-y: auto;
  box-shadow: 0 20px 40px rgba(0, 0, 0, .15);
  border: 1px solid #e2e8f0;
}

.modal-content h2 { font-size: 21px; font-weight: 600; color: #1e293b; margin-bottom: 22px; }

.modal-actions { display: flex; gap: 12px; margin-top: 26px; }
.modal-actions .btn { flex: 1; padding: 13px; font-size: 14px; font-weight: 600; }

.close-btn {
  width: 32px; height: 32px;
  background: #f1f5f9;
  color: #475569;
  border: none;
  border-radius: 8px;
  font-size: 18px;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  float: right;
}

.close-btn:hover { background: #e2e8f0; }

/* ==================== 详情弹窗 ==================== */

.detail-list {
  display: flex;
  flex-direction: column;
  gap: 10px;
  background: #f8fafc;
  border: 1px solid #e2e8f0;
  border-radius: 14px;
  padding: 14px 16px;
}

.detail-item {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 7px 0;
  border-bottom: 1px dashed #e6ebf2;
}

.detail-item:last-child { border-bottom: none; }

.detail-label {
  width: 84px;
  flex: none;
  font-size: 12.5px;
  color: #94a3b8;
}

.detail-value {
  flex: 1;
  min-width: 0;
  font-size: 13.5px;
  color: #1e293b;
  word-break: break-all;
  font-weight: 500;
}

.detail-value.mono {
  font-family: ui-monospace, Menlo, Consolas, monospace;
  font-size: 13px;
}

.detail-value.link { color: #3b82f6; text-decoration: none; }
.detail-value.link:hover { text-decoration: underline; }

.detail-copy {
  flex: none;
  padding: 4px 11px;
  background: #eff6ff;
  color: #2563eb;
  border: 1px solid #bfdbfe;
  border-radius: 7px;
  font-size: 12px;
  font-weight: 500;
  cursor: pointer;
  font-family: inherit;
  transition: all .2s ease;
}

.detail-copy:hover { background: #dbeafe; }

.detail-empty { color: #94a3b8; font-size: 13px; padding: 10px 0; }

/* ==================== 提示条 ==================== */

.toast {
  position: fixed;
  left: 50%; top: 26px;
  transform: translateX(-50%);
  background: rgba(15, 23, 42, .93);
  color: #fff;
  padding: 11px 20px;
  border-radius: 10px;
  font-size: 13.5px;
  z-index: 1200;
  display: none;
  max-width: 88vw;
}

.toast.show { display: block; }
.toast.bad { background: rgba(220, 38, 38, .95); }
.toast.ok { background: rgba(22, 163, 74, .95); }

/* ==================== 登录页 ==================== */

.login-wrap {
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 20px;
}

.login-card {
  background: #fff;
  border-radius: 20px;
  padding: 48px 40px;
  box-shadow: 0 10px 40px rgba(0, 0, 0, .06);
  width: 100%;
  max-width: 420px;
  border: 1px solid #e2e8f0;
}

.login-card h1 { font-size: 28px; font-weight: 600; color: #1e293b; text-align: center; margin-bottom: 8px; }
.login-card .sub { text-align: center; font-size: 14px; color: #64748b; margin-bottom: 30px; }

.error-message {
  background: #fef2f2;
  border: 1px solid #fecaca;
  color: #dc2626;
  padding: 13px 16px;
  border-radius: 12px;
  margin-bottom: 22px;
  font-size: 14px;
  font-weight: 500;
}

.error-message:empty { display: none; }

@media (max-width: 900px) {
  .stat-row { grid-template-columns: repeat(2, 1fr); }
  .settings-grid { grid-template-columns: 1fr; }
  .card { padding: 20px 18px; }
}
