/* 家缘亲家 — 后台管理 */
:root {
  --primary: #f26d6d;
  --primary-dark: #e05555;
  --bg: #f5f6f8;
  --card: #fff;
  --text: #1f2937;
  --muted: #6b7280;
  --border: #e5e7eb;
  --sidebar: #1e1e2d;
  --sidebar-text: #a2a3b7;
  --sidebar-active: #fff;
  --success: #10b981;
  --warning: #f59e0b;
  --danger: #ef4444;
}

* { box-sizing: border-box; margin: 0; padding: 0; }

body {
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'PingFang SC', 'Microsoft YaHei', sans-serif;
  background: var(--bg);
  color: var(--text);
  min-height: 100vh;
}

.hidden { display: none !important; }

/* ── 登录页 ── */
.login-page {
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  background: linear-gradient(135deg, #ffe8e8 0%, #fff5f5 50%, #f5f6f8 100%);
  padding: 24px;
}

.login-card {
  width: 100%;
  max-width: 400px;
  background: var(--card);
  border-radius: 16px;
  padding: 40px 32px;
  box-shadow: 0 8px 32px rgba(242, 109, 109, 0.12);
}

.login-logo {
  text-align: center;
  font-size: 28px;
  font-weight: 700;
  color: var(--primary);
  margin-bottom: 8px;
}

.login-sub {
  text-align: center;
  color: var(--muted);
  font-size: 14px;
  margin-bottom: 32px;
}

.form-group { margin-bottom: 20px; }

.form-group label {
  display: block;
  font-size: 13px;
  font-weight: 600;
  margin-bottom: 8px;
  color: var(--muted);
}

.form-group input, .form-group select, .form-group textarea {
  width: 100%;
  padding: 12px 14px;
  border: 1px solid var(--border);
  border-radius: 10px;
  font-size: 14px;
  outline: none;
  transition: border-color 0.2s;
}

.form-group input:focus, .form-group textarea:focus {
  border-color: var(--primary);
}

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  padding: 10px 18px;
  border: none;
  border-radius: 10px;
  font-size: 14px;
  font-weight: 600;
  cursor: pointer;
  transition: opacity 0.2s, transform 0.1s;
}

.btn:active { transform: scale(0.98); }
.btn:disabled { opacity: 0.6; cursor: not-allowed; }

.btn-primary {
  background: var(--primary);
  color: #fff;
  width: 100%;
  padding: 13px;
}

.btn-primary:hover { background: var(--primary-dark); }

.btn-sm {
  padding: 6px 12px;
  font-size: 12px;
  border-radius: 8px;
}

.btn-outline {
  background: #fff;
  border: 1px solid var(--border);
  color: var(--text);
}

.btn-danger { background: #fee2e2; color: var(--danger); }
.btn-success { background: #d1fae5; color: var(--success); }

.error-msg {
  color: var(--danger);
  font-size: 13px;
  margin-top: 12px;
  text-align: center;
}

/* ── 主布局 ── */
.app-shell {
  display: flex;
  min-height: 100vh;
}

.sidebar {
  width: 220px;
  background: var(--sidebar);
  color: var(--sidebar-text);
  flex-shrink: 0;
  display: flex;
  flex-direction: column;
}

.sidebar-brand {
  padding: 24px 20px;
  font-size: 18px;
  font-weight: 700;
  color: #fff;
  border-bottom: 1px solid rgba(255,255,255,0.06);
}

.sidebar-nav { flex: 1; padding: 16px 12px; }

.nav-item {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 12px 14px;
  border-radius: 10px;
  cursor: pointer;
  font-size: 14px;
  margin-bottom: 4px;
  transition: background 0.2s, color 0.2s;
}

.nav-item:hover { background: rgba(255,255,255,0.06); color: #fff; }
.nav-item.active { background: var(--primary); color: #fff; }

.sidebar-footer {
  padding: 16px;
  border-top: 1px solid rgba(255,255,255,0.06);
}

.main {
  flex: 1;
  display: flex;
  flex-direction: column;
  min-width: 0;
}

.topbar {
  background: var(--card);
  padding: 16px 28px;
  border-bottom: 1px solid var(--border);
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.topbar-title { font-size: 18px; font-weight: 700; }

.content { padding: 24px 28px; flex: 1; }

/* ── 统计卡片 ── */
.stats-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(180px, 1fr));
  gap: 16px;
  margin-bottom: 24px;
}

.stat-card {
  background: var(--card);
  border-radius: 14px;
  padding: 20px;
  box-shadow: 0 2px 8px rgba(0,0,0,0.04);
}

.stat-card .value {
  font-size: 28px;
  font-weight: 700;
  color: var(--primary);
  line-height: 1.2;
}

.stat-card .label {
  font-size: 13px;
  color: var(--muted);
  margin-top: 6px;
}

/* ── 表格 ── */
.panel {
  background: var(--card);
  border-radius: 14px;
  box-shadow: 0 2px 8px rgba(0,0,0,0.04);
  overflow: hidden;
}

.panel-header {
  padding: 16px 20px;
  border-bottom: 1px solid var(--border);
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 12px;
}

.panel-header h3 { font-size: 16px; font-weight: 700; }

.toolbar {
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
  align-items: center;
}

.toolbar input, .toolbar select {
  padding: 8px 12px;
  border: 1px solid var(--border);
  border-radius: 8px;
  font-size: 13px;
}

.table-wrap { overflow-x: auto; }

table {
  width: 100%;
  border-collapse: collapse;
  font-size: 13px;
}

th, td {
  padding: 12px 16px;
  text-align: left;
  border-bottom: 1px solid var(--border);
}

th {
  background: #fafafa;
  font-weight: 600;
  color: var(--muted);
  white-space: nowrap;
}

tr:hover td { background: #fafafa; }
tr.row-selected td { background: #fffbeb; }
tr.row-selected:hover td { background: #fef3c7; }

.panel-hint {
  padding: 0 20px 12px;
  margin: 0;
}

.table-wide table {
  min-width: 960px;
}

.col-id {
  font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, monospace;
  font-size: 12px;
  color: #6b7280;
}

.col-profile {
  min-width: 160px;
  white-space: normal;
}

.col-message {
  min-width: 180px;
  max-width: 280px;
  white-space: normal;
}

.cell-message {
  line-height: 1.45;
  word-break: break-word;
}

.cell-sub {
  margin-top: 4px;
  font-size: 12px;
  color: #9ca3af;
  line-height: 1.4;
}

.tag {
  display: inline-block;
  padding: 2px 8px;
  border-radius: 6px;
  font-size: 12px;
  font-weight: 600;
}

.tag-active { background: #d1fae5; color: #065f46; }
.tag-hidden { background: #fef3c7; color: #92400e; }
.tag-deleted { background: #fee2e2; color: #991b1b; }
.tag-pending { background: #fef3c7; color: #92400e; }
.tag-accepted { background: #d1fae5; color: #065f46; }
.tag-rejected { background: #f3f4f6; color: #6b7280; }
.tag-verified { background: #dbeafe; color: #1e40af; }
.tag-real { background: #d1fae5; color: #065f46; }
.tag-test { background: #fef3c7; color: #92400e; }
.tag-excel { background: #dbeafe; color: #1e40af; margin-right: 4px; }

.modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.45);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 1000;
  padding: 24px;
}

.modal-card {
  background: var(--card);
  border-radius: 14px;
  width: 100%;
  max-width: 480px;
  max-height: 90vh;
  overflow-y: auto;
  box-shadow: 0 16px 48px rgba(0, 0, 0, 0.15);
}

.modal-header {
  padding: 18px 20px;
  border-bottom: 1px solid var(--border);
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.modal-header h3 { font-size: 16px; font-weight: 700; }

.modal-body { padding: 20px; }

.modal-footer {
  padding: 16px 20px;
  border-top: 1px solid var(--border);
  display: flex;
  justify-content: flex-end;
  gap: 10px;
}

.form-row {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
}

.form-hint {
  font-size: 12px;
  color: var(--muted);
  margin-top: 8px;
  line-height: 1.5;
}

.btn-warning { background: #fef3c7; color: #92400e; }

.batch-bar {
  display: none;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  flex-wrap: wrap;
  padding: 12px 20px;
  background: #fffbeb;
  border-bottom: 1px solid #fde68a;
}

.batch-bar.visible { display: flex; }

.batch-bar-info {
  font-size: 13px;
  font-weight: 600;
  color: #92400e;
}

.batch-bar-actions {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
}

.row-check {
  width: 16px;
  height: 16px;
  cursor: pointer;
}

th.col-check, td.col-check {
  width: 40px;
  text-align: center;
}

th.col-no, td.col-no {
  width: 52px;
  text-align: center;
  color: var(--muted);
  font-variant-numeric: tabular-nums;
}

.panel-footer-pagination {
  justify-content: center;
}

.pagination {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
  width: 100%;
  justify-content: center;
}

.pagination-info {
  font-size: 13px;
  color: var(--muted);
  min-width: 200px;
  text-align: center;
}

.pagination-jump {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-size: 13px;
  color: var(--muted);
  margin-left: 4px;
}

.pagination-jump-input {
  width: 56px;
  padding: 4px 8px;
  border: 1px solid var(--border);
  border-radius: 6px;
  font-size: 13px;
  text-align: center;
}

.pagination-jump-input:focus {
  outline: none;
  border-color: var(--primary);
}

td.col-openid {
  font-family: Consolas, Monaco, 'Courier New', monospace;
  font-size: 12px;
  word-break: break-all;
  min-width: 220px;
  max-width: 320px;
  line-height: 1.45;
  color: #374151;
}

.profile-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 4px;
}

.panel-footer {
  padding: 14px 20px;
  display: flex;
  justify-content: space-between;
  align-items: center;
  border-top: 1px solid var(--border);
  font-size: 13px;
  color: var(--muted);
}

.empty {
  padding: 48px;
  text-align: center;
  color: var(--muted);
}

.loading {
  padding: 40px;
  text-align: center;
  color: var(--muted);
}

.config-editor {
  padding: 20px;
}

.config-editor textarea {
  width: 100%;
  min-height: 360px;
  font-family: 'Consolas', 'Monaco', monospace;
  font-size: 13px;
  line-height: 1.5;
  padding: 14px;
  border: 1px solid var(--border);
  border-radius: 10px;
  resize: vertical;
}

.verify-intro-page {
  padding: 20px;
}

.verify-intro-hint {
  color: var(--muted);
  font-size: 13px;
  line-height: 1.6;
  margin-bottom: 20px;
}

.verify-intro-preview {
  margin-bottom: 24px;
  padding: 16px;
  border: 1px solid var(--border);
  border-radius: 12px;
  background: #fafafa;
}

.verify-intro-preview-title {
  font-size: 14px;
  font-weight: 600;
  margin-bottom: 12px;
}

.verify-intro-preview video {
  width: 100%;
  max-width: 480px;
  border-radius: 10px;
  background: #111;
}

.verify-intro-meta {
  margin-top: 10px;
  font-size: 12px;
  color: var(--muted);
  word-break: break-all;
}

.verify-intro-status {
  margin-top: 16px;
  font-size: 13px;
  color: var(--primary);
  min-height: 20px;
}

.share-settings-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(320px, 1fr));
  gap: 16px;
}

.share-settings-card {
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 16px;
  background: #fff;
}

.share-settings-card-head {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 8px;
  margin-bottom: 8px;
}

.share-settings-card-head h4 {
  margin: 0;
  font-size: 15px;
}

.share-settings-key {
  font-size: 11px;
  color: var(--muted);
  font-family: ui-monospace, monospace;
}

.share-settings-hint {
  font-size: 12px;
  color: var(--muted);
  line-height: 1.5;
  margin: 0 0 12px;
}

.share-settings-image-block {
  margin: 12px 0;
  padding: 12px;
  border: 1px dashed var(--border);
  border-radius: 10px;
  background: #fafafa;
}

.share-settings-preview {
  display: block;
  max-width: 100%;
  max-height: 160px;
  border-radius: 8px;
  border: 1px solid var(--border);
  object-fit: contain;
  background: #fff;
}

.share-settings-no-image {
  font-size: 13px;
  color: var(--muted);
  padding: 16px 0;
}

.share-settings-actions {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
}

.panel-meta {
  font-size: 13px;
  color: var(--muted);
  font-weight: normal;
}

.modal-wide {
  max-width: 760px;
}

.detail-section-title {
  margin: 16px 0 10px;
  font-size: 14px;
  font-weight: 700;
  color: var(--text);
}

.detail-section-title:first-child {
  margin-top: 0;
}

.detail-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 13px;
}

.detail-table th,
.detail-table td {
  border: 1px solid var(--border);
  padding: 10px 12px;
  text-align: left;
  vertical-align: top;
}

.detail-table th {
  width: 140px;
  background: #f9fafb;
  color: #6b7280;
  font-weight: 600;
}

.order-json {
  margin: 0;
  padding: 12px;
  background: #f8fafc;
  border: 1px solid var(--border);
  border-radius: 8px;
  font-size: 12px;
  line-height: 1.5;
  overflow-x: auto;
  white-space: pre-wrap;
  word-break: break-all;
}

.mono {
  font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  font-size: 12px;
}

@media (max-width: 768px) {
  .app-shell { flex-direction: column; }
  .sidebar { width: 100%; }
  .sidebar-nav { display: flex; overflow-x: auto; padding: 8px; }
  .nav-item { white-space: nowrap; margin-bottom: 0; margin-right: 4px; }
}
