/* =========================================================
   惠报员后台 · Corporate Clean（企业简洁风）
   主色 blue-600 / 页面 slate-50 / 卡片 white + shadow-sm
   交互：hover 上浮、active 按压、focus 环偏移，时长 ≤ 200ms
   ========================================================= */
:root {
  /* 主色：蓝色系 */
  --primary: #2563eb;        /* blue-600 */
  --primary-dark: #1d4ed8;   /* blue-700 */
  --primary-soft: #eff6ff;   /* blue-50 */
  --ring: #3b82f6;           /* blue-500 */

  /* 背景与边框：灰色系 */
  --bg: #f8fafc;             /* slate-50 */
  --card: #ffffff;
  --gray-50: #f9fafb;
  --gray-100: #f3f4f6;
  --border: #e5e7eb;         /* gray-200 */
  --border-strong: #d1d5db;  /* gray-300 */

  /* 文字层级 */
  --text: #111827;           /* gray-900 标题 */
  --text-2: #4b5563;         /* gray-600 正文 */
  --text-3: #6b7280;         /* gray-500 次要 */
  --text-4: #9ca3af;         /* gray-400 占位 */

  /* 语义色 */
  --danger: #dc2626;         /* red-600 */
  --danger-soft: #fef2f2;    /* red-50 */
  --success: #16a34a;        /* green-600 */
  --success-soft: #f0fdf4;   /* green-50 */

  /* 阴影（克制，不超过 md） */
  --shadow-sm: 0 1px 2px rgba(0, 0, 0, 0.05);
  --shadow: 0 1px 3px rgba(0, 0, 0, 0.1), 0 1px 2px rgba(0, 0, 0, 0.06);
  --shadow-md: 0 4px 6px -1px rgba(0, 0, 0, 0.1), 0 2px 4px -2px rgba(0, 0, 0, 0.1);

  --radius: 8px;             /* rounded-lg */
  --radius-lg: 12px;         /* rounded-xl */
}

* { box-sizing: border-box; }

html, body {
  margin: 0;
  padding: 0;
  background: var(--bg);
  color: var(--text);
  font-family: -apple-system, BlinkMacSystemFont, "PingFang SC", "Microsoft YaHei", sans-serif;
  font-size: 14px;
  line-height: 1.6;
}

a { color: inherit; text-decoration: none; }

/* ---------- 登录页 ---------- */
.login-body {
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  background: var(--bg);
  padding: 16px;
}
.login-card {
  width: 100%;
  max-width: 360px;
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-sm);
  padding: 40px 32px 36px;
}
.login-title {
  margin: 0;
  font-size: 22px;
  font-weight: 600;
  letter-spacing: -0.01em;
  text-align: center;
  color: var(--text);
}
.login-sub {
  margin: 6px 0 28px;
  text-align: center;
  color: var(--text-3);
  font-size: 13px;
}
.login-error { min-height: 20px; margin-bottom: 10px; color: var(--danger); font-size: 13px; }

/* ---------- 布局 ---------- */
.layout { display: flex; min-height: 100vh; }
.sidebar {
  width: 220px;
  background: var(--card);
  border-right: 1px solid var(--border);
  display: flex;
  flex-direction: column;
  flex-shrink: 0;
}
.brand {
  height: 60px;
  display: flex;
  align-items: center;
  padding: 0 20px;
  font-weight: 600;
  font-size: 16px;
  letter-spacing: -0.01em;
  color: var(--text);
  border-bottom: 1px solid var(--border);
}
.nav { flex: 1; padding: 12px 0; }
.nav a {
  display: block;
  margin: 2px 8px;
  padding: 9px 12px;
  border-radius: var(--radius);
  color: var(--text-2);
  cursor: pointer;
  transition: background-color 150ms ease-out, color 150ms ease-out;
}
.nav a:hover { background: var(--gray-100); color: var(--text); }
.nav a:focus-visible {
  outline: none;
  box-shadow: 0 0 0 2px #fff, 0 0 0 4px var(--ring);
}
.nav a.active {
  background: var(--primary-soft);
  color: var(--primary-dark);
  font-weight: 500;
}
.sidebar-footer { padding: 16px; border-top: 1px solid var(--border); }

.main { flex: 1; padding: 32px; min-width: 0; }
.loading { color: var(--text-3); padding: 40px; text-align: center; }

/* ---------- 通用 ---------- */
.page-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  margin-bottom: 24px;
}
.page-title {
  font-size: 20px;
  font-weight: 600;
  letter-spacing: -0.01em;
  margin: 0;
  color: var(--text);
}
.card {
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-sm);
  padding: 24px;
  margin-bottom: 24px;
}

/* 统计卡片（指标卡：hover 上浮 + 阴影微升） */
.stat-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(160px, 1fr));
  gap: 16px;
  margin-bottom: 24px;
}
.stat-card {
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-sm);
  padding: 20px;
  transition: transform 200ms ease-out, box-shadow 200ms ease-out;
}
.stat-card:hover {
  transform: translateY(-2px);
  box-shadow: var(--shadow-md);
}
.stat-num { font-size: 28px; font-weight: 600; letter-spacing: -0.01em; color: var(--text); }
.stat-label { color: var(--text-3); font-size: 13px; margin-top: 4px; }

/* ---------- 按钮 ---------- */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 8px 16px;
  border: 1px solid var(--border-strong);
  border-radius: var(--radius);
  background: var(--card);
  color: var(--text-2);
  cursor: pointer;
  font-size: 14px;
  font-weight: 500;
  font-family: inherit;
  box-shadow: var(--shadow-sm);
  transition: all 150ms ease-out;
}
.btn:hover {
  transform: translateY(-2px);
  box-shadow: var(--shadow);
  border-color: var(--text-4);
  color: var(--text);
}
.btn:active {
  transform: translateY(0) scale(0.98);
  box-shadow: var(--shadow-sm);
}
.btn:focus-visible {
  outline: none;
  box-shadow: 0 0 0 2px #fff, 0 0 0 4px var(--ring);
}
.btn-primary { background: var(--primary); border-color: var(--primary); color: #fff; }
.btn-primary:hover { background: var(--primary-dark); border-color: var(--primary-dark); color: #fff; }
.btn-ghost { background: transparent; border-color: transparent; color: var(--text-2); box-shadow: none; }
.btn-ghost:hover { background: var(--gray-100); border-color: transparent; color: var(--text); transform: none; box-shadow: none; }
.btn-ghost:active { transform: scale(0.98); }
.btn-danger { background: var(--card); border-color: var(--danger); color: var(--danger); }
.btn-danger:hover { background: var(--danger); border-color: var(--danger); color: #fff; }
.btn-sm { padding: 5px 12px; font-size: 13px; }
.btn-block { width: 100%; }
.btn:disabled {
  opacity: 0.5;
  cursor: not-allowed;
  transform: none !important;
  box-shadow: var(--shadow-sm) !important;
}

/* ---------- 表单 ---------- */
.field { display: block; margin-bottom: 16px; }
.field > span {
  display: block;
  margin-bottom: 6px;
  color: var(--text-2);
  font-size: 13px;
  font-weight: 500;
}
.field em { font-style: normal; color: var(--danger); }
.input, .textarea, .select {
  width: 100%;
  padding: 8px 12px;
  border: 1px solid var(--border-strong);
  border-radius: var(--radius);
  font-size: 14px;
  color: var(--text);
  background: var(--card);
  font-family: inherit;
  transition: border-color 150ms ease-out, box-shadow 150ms ease-out;
}
.input::placeholder, .textarea::placeholder { color: var(--text-4); }
.input:focus, .textarea:focus, .select:focus {
  outline: none;
  border-color: var(--ring);
  box-shadow: 0 0 0 2px #fff, 0 0 0 4px var(--ring);
}
.textarea {
  min-height: 260px;
  resize: vertical;
  line-height: 1.7;
  font-family: "SFMono-Regular", Consolas, monospace;
  font-size: 13px;
}
.inline-field { display: flex; gap: 8px; align-items: center; }
.inline-field .input { flex: 1; }
.checkbox-line { display: flex; align-items: center; gap: 8px; color: var(--text-2); cursor: pointer; }
.checkbox-line input[type="checkbox"] { accent-color: var(--primary); width: 16px; height: 16px; cursor: pointer; }
.checkbox-line input[type="checkbox"]:focus-visible {
  outline: 2px solid var(--ring);
  outline-offset: 2px;
  border-radius: 4px;
}
.form-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 0 16px; }

/* ---------- 工具栏 ---------- */
.toolbar { display: flex; gap: 12px; align-items: center; flex-wrap: wrap; margin-bottom: 16px; }
.toolbar .input, .toolbar .select { width: auto; min-width: 140px; }

/* ---------- 表格 ---------- */
.table { width: 100%; border-collapse: collapse; }
.table th, .table td {
  padding: 12px;
  border-bottom: 1px solid var(--border);
  text-align: left;
  vertical-align: middle;
}
.table th {
  color: var(--text-3);
  font-weight: 500;
  font-size: 13px;
  background: var(--gray-50);
}
.table tbody tr { transition: background-color 150ms ease-out; }
.table tbody tr:hover { background: var(--gray-50); }
.table tr:last-child td { border-bottom: none; }
.actions { white-space: nowrap; }
.actions .btn { margin-right: 8px; }
.actions .btn:last-child { margin-right: 0; }

/* ---------- 状态徽标 ---------- */
.badge {
  display: inline-block;
  padding: 2px 10px;
  border-radius: 9999px;
  font-size: 12px;
  font-weight: 500;
  line-height: 1.6;
}
.badge-draft { background: var(--gray-100); color: var(--text-2); }
.badge-published { background: var(--success-soft); color: var(--success); }
.badge-offline { background: var(--danger-soft); color: var(--danger); }

/* ---------- 列表行（分类/轮播图/公告） ---------- */
.item-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  padding: 14px 4px;
  border-bottom: 1px solid var(--border);
}
.item-row:last-child { border-bottom: none; }
.item-main { flex: 1; min-width: 0; }
.item-title { font-weight: 500; color: var(--text); }
.item-meta { color: var(--text-3); font-size: 12px; margin-top: 2px; }
.thumb-preview {
  width: 72px;
  height: 40px;
  object-fit: cover;
  border-radius: var(--radius);
  border: 1px solid var(--border);
}

/* ---------- 分页 ---------- */
.pager {
  display: flex;
  gap: 12px;
  align-items: center;
  justify-content: flex-end;
  margin-top: 16px;
  color: var(--text-2);
}

/* ---------- 活动编辑表单 ---------- */
.editor-wrap { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; margin-top: 6px; }
.preview {
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 16px;
  min-height: 260px;
  overflow: auto;
  line-height: 1.8;
}
.preview img { max-width: 100%; border-radius: var(--radius); }
.preview h1, .preview h2, .preview h3 { margin: 16px 0 8px; letter-spacing: -0.01em; }
.preview p { margin: 0 0 10px; }
.preview a { color: var(--primary); }
.preview a:hover { text-decoration: underline; }
.preview code { background: var(--gray-100); padding: 2px 6px; border-radius: 4px; font-size: 13px; }
.preview pre { background: var(--gray-50); border: 1px solid var(--border); padding: 12px; border-radius: var(--radius); overflow: auto; }
.preview pre code { background: none; padding: 0; }
.preview hr { border: none; border-top: 1px solid var(--border); margin: 16px 0; }

/* ---------- 工具类 ---------- */
.muted { color: var(--text-3); font-size: 12px; }
.mb { margin-bottom: 16px; }
.hint { color: var(--text-3); font-size: 12px; margin-top: 4px; }

/* ---------- 响应式 ---------- */
@media (max-width: 720px) {
  .layout { flex-direction: column; }
  .sidebar {
    width: 100%;
    flex-direction: row;
    align-items: center;
    border-right: none;
    border-bottom: 1px solid var(--border);
  }
  .brand { height: auto; padding: 14px 16px; border-bottom: none; white-space: nowrap; }
  .nav { display: flex; flex: 1; overflow-x: auto; padding: 8px; gap: 4px; }
  .nav a { margin: 0; padding: 8px 12px; white-space: nowrap; }
  .sidebar-footer { border-top: none; padding: 8px 12px; }
  .main { padding: 16px; }
  .form-grid { grid-template-columns: 1fr; }
  .editor-wrap { grid-template-columns: 1fr; }
}

/* ---------- 无障碍：减少动效 ---------- */
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    transition-duration: 0.01ms !important;
    animation-duration: 0.01ms !important;
  }
}
