/* =====================================================
   考研错题本 · 样式
   设计灵感来自参考图：紫色主题 · 卡片式 · 左侧导航
   ===================================================== */

/* 关键：HTML5 [hidden] 属性被 .auth-page / .app 的 display:flex 覆盖，
   必须用更高优先级强制隐藏，否则两个 root 会同时渲染叠加在一起。 */
[hidden] { display: none !important; }

:root {
  /* 主色 */
  --c-primary: #6366f1;          /* 主紫 */
  --c-primary-dark: #4f46e5;
  --c-primary-light: #eef2ff;
  --c-primary-soft: #f5f3ff;

  /* 背景与文字 */
  --c-bg:        #f5f7fb;        /* 页面背景 */
  --c-bg-soft:   #eef0f4;
  --c-card:      #ffffff;
  --c-text:      #1f2937;
  --c-text-soft: #6b7280;
  --c-text-dim:  #9ca3af;
  --c-border:    #e5e7eb;

  /* 状态色 */
  --c-green:  #22c55e;
  --c-orange: #f59e0b;
  --c-red:    #ef4444;
  --c-blue:   #3b82f6;
  --c-violet: #8b5cf6;
  --c-cyan:   #06b6d4;
  --c-pink:   #ec4899;
  --c-teal:   #14b8a6;

  /* 阴影与圆角 */
  --r-sm: 6px;
  --r-md: 10px;
  --r-lg: 14px;
  --r-xl: 18px;
  --shadow-sm: 0 1px 2px rgba(15, 23, 42, .04);
  --shadow-md: 0 4px 14px rgba(15, 23, 42, .06);
  --shadow-lg: 0 12px 30px rgba(99, 102, 241, .12);

  --sidebar-w: 240px;
}

* { box-sizing: border-box; }
html, body { height: 100%; }
body {
  margin: 0;
  font-family: -apple-system, BlinkMacSystemFont, "PingFang SC", "Microsoft YaHei",
               "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  color: var(--c-text);
  background: var(--c-bg);
  font-size: 14px;
  line-height: 1.55;
  -webkit-font-smoothing: antialiased;
}

a { color: inherit; text-decoration: none; }
button { font-family: inherit; cursor: pointer; }
input, select, textarea, button { font-family: inherit; font-size: 14px; }

/* =====================================================
   登录 / 注册页
   ===================================================== */
.auth-page {
  min-height: 100vh;
  display: flex; align-items: center; justify-content: center;
  background: linear-gradient(135deg, #6366f1 0%, #8b5cf6 50%, #a78bfa 100%);
  padding: 24px;
}
.auth-card {
  width: 100%; max-width: 420px;
  background: #fff; border-radius: var(--r-xl);
  box-shadow: 0 30px 60px rgba(31, 41, 55, .25);
  padding: 36px 32px 28px;
}
.auth-card h1 {
  margin: 0 0 6px;
  font-size: 22px; font-weight: 700;
  display: flex; align-items: center; gap: 8px;
}
.auth-card .logo {
  width: 32px; height: 32px; border-radius: 8px;
  background: var(--c-primary); color: #fff;
  display: flex; align-items: center; justify-content: center;
  font-weight: 700; font-size: 16px;
}
.auth-card .sub { color: var(--c-text-soft); font-size: 13px; margin-bottom: 22px; }
.auth-card .field { margin-bottom: 14px; }
.auth-card label {
  display: block; font-size: 12px; color: var(--c-text-soft);
  margin-bottom: 4px;
}
.auth-card input {
  width: 100%; padding: 10px 12px;
  border: 1px solid var(--c-border); border-radius: var(--r-md);
  outline: none; transition: border-color .15s, box-shadow .15s;
}
.auth-card input:focus {
  border-color: var(--c-primary);
  box-shadow: 0 0 0 3px var(--c-primary-light);
}
.auth-card .btn-primary {
  width: 100%; padding: 11px; border: none; border-radius: var(--r-md);
  background: var(--c-primary); color: #fff; font-weight: 600;
  margin-top: 8px; transition: background .15s;
}
.auth-card .btn-primary:hover { background: var(--c-primary-dark); }
.auth-card .btn-primary:disabled { background: #a5b4fc; cursor: not-allowed; }
.auth-card .switch-link {
  text-align: center; margin-top: 14px; color: var(--c-text-soft); font-size: 13px;
}
.auth-card .switch-link a { color: var(--c-primary); cursor: pointer; }
.auth-card .err {
  background: #fef2f2; color: #b91c1c; border: 1px solid #fecaca;
  padding: 8px 10px; border-radius: var(--r-md); margin-bottom: 12px;
  font-size: 13px;
}
.auth-card .hint {
  background: #fff7ed; color: #9a3412; border: 1px solid #fed7aa;
  padding: 8px 10px; border-radius: var(--r-md); margin-bottom: 12px;
  font-size: 13px;
}

/* =====================================================
   主页布局：左侧导航 + 顶部栏 + 内容
   ===================================================== */
.app { display: flex; min-height: 100vh; }

/* ---------- 左侧栏 ---------- */
.sidebar {
  width: var(--sidebar-w);
  background: #fff;
  border-right: 1px solid var(--c-border);
  display: flex; flex-direction: column;
  position: sticky; top: 0; height: 100vh; overflow-y: auto;
}
.sidebar .brand {
  padding: 18px 20px 14px;
  display: flex; align-items: center; gap: 10px;
  border-bottom: 1px solid var(--c-border);
}
.sidebar .brand .logo {
  width: 32px; height: 32px; border-radius: 8px;
  background: var(--c-primary); color: #fff;
  display: flex; align-items: center; justify-content: center;
  font-weight: 700; font-size: 16px;
}
.sidebar .brand .name {
  font-weight: 700; font-size: 15px; color: var(--c-text);
}
.sidebar .brand .tag { font-size: 11px; color: var(--c-text-dim); }

.nav { padding: 12px 8px; }
.nav-group { margin-bottom: 6px; }
.nav-title {
  padding: 6px 12px; font-size: 11px; color: var(--c-text-dim);
  text-transform: none; letter-spacing: .04em;
}
.nav-item {
  display: flex; align-items: center; gap: 10px;
  padding: 8px 12px; border-radius: var(--r-md);
  color: var(--c-text-soft); cursor: pointer; user-select: none;
  font-size: 13.5px; transition: background .12s, color .12s;
  position: relative;
}
.nav-item .dot { width: 8px; height: 8px; border-radius: 50%; flex-shrink: 0; }
.nav-item .count {
  margin-left: auto; font-size: 12px; color: var(--c-text-dim);
}
.nav-item:hover { background: var(--c-bg-soft); color: var(--c-text); }
.nav-item.active {
  background: var(--c-primary-soft); color: var(--c-primary-dark);
  font-weight: 600;
}

.sidebar .footer-card {
  margin: auto 12px 16px; padding: 12px 14px;
  background: linear-gradient(135deg, #fef3c7, #fed7aa);
  border-radius: var(--r-md); font-size: 12px; color: #7c2d12;
  line-height: 1.65;
}
.sidebar .footer-card .title { font-weight: 700; color: #7c2d12; margin-bottom: 4px; display: flex; align-items: center; gap: 4px; }

/* ---------- 主区 ---------- */
.main { flex: 1; min-width: 0; display: flex; flex-direction: column; }

.topbar {
  height: 60px; padding: 0 24px;
  background: #fff; border-bottom: 1px solid var(--c-border);
  display: flex; align-items: center; gap: 14px;
  position: sticky; top: 0; z-index: 20;
}
.topbar .title {
  font-size: 17px; font-weight: 700;
}
.topbar .search {
  flex: 1; max-width: 360px;
  position: relative;
}
.topbar .search input {
  width: 100%; padding: 8px 10px 8px 32px;
  border: 1px solid var(--c-border); border-radius: var(--r-md);
  background: var(--c-bg);
  outline: none;
}
.topbar .search input:focus {
  border-color: var(--c-primary); background: #fff;
  box-shadow: 0 0 0 3px var(--c-primary-light);
}
.topbar .search svg {
  position: absolute; left: 10px; top: 50%;
  transform: translateY(-50%); color: var(--c-text-dim);
}
.topbar .spacer { flex: 1; }
.topbar .user {
  display: flex; align-items: center; gap: 8px; padding: 4px 10px;
  border-radius: var(--r-md); cursor: pointer; position: relative;
}
.topbar .user:hover { background: var(--c-bg); }
.topbar .user .avatar {
  width: 28px; height: 28px; border-radius: 50%;
  background: var(--c-primary); color: #fff;
  display: flex; align-items: center; justify-content: center;
  font-weight: 600; font-size: 12px;
}
.topbar .user .menu {
  position: absolute; right: 0; top: calc(100% + 6px);
  background: #fff; border: 1px solid var(--c-border);
  border-radius: var(--r-md); box-shadow: var(--shadow-md);
  min-width: 160px; padding: 4px 0;
  display: none; z-index: 50;
}
.topbar .user.open .menu { display: block; }
.topbar .user .menu .item {
  padding: 8px 12px; font-size: 13px; color: var(--c-text);
  cursor: pointer;
}
.topbar .user .menu .item:hover { background: var(--c-bg); }
.topbar .user .menu .item.danger { color: var(--c-red); }

.btn {
  display: inline-flex; align-items: center; gap: 6px;
  padding: 8px 14px; border-radius: var(--r-md);
  border: 1px solid transparent; background: transparent;
  font-size: 13.5px; font-weight: 500;
  transition: background .15s, border-color .15s, color .15s, box-shadow .15s;
  white-space: nowrap;
}
.btn-primary { background: var(--c-primary); color: #fff; }
.btn-primary:hover { background: var(--c-primary-dark); }
.btn-ghost   { background: #fff; color: var(--c-text); border-color: var(--c-border); }
.btn-ghost:hover { background: var(--c-bg); border-color: #d1d5db; }
.btn-soft    { background: var(--c-primary-soft); color: var(--c-primary-dark); }
.btn-soft:hover { background: #e0e7ff; }
.btn-danger  { background: #fff; color: var(--c-red); border-color: #fecaca; }
.btn-danger:hover { background: #fef2f2; }

/* ---------- 内容区 ---------- */
.content { padding: 24px; flex: 1; }
.page-header {
  display: flex; align-items: center; justify-content: space-between;
  margin-bottom: 18px;
}
.page-header h2 { margin: 0; font-size: 18px; font-weight: 700; }
.page-header .filters {
  display: flex; gap: 10px; align-items: center;
}
.page-header .filters select,
.page-header .filters input {
  padding: 7px 10px; border: 1px solid var(--c-border);
  border-radius: var(--r-md); background: #fff; outline: none;
}

/* ---------- 概览卡片 ---------- */
.stats-grid {
  display: grid; gap: 16px;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  margin-bottom: 18px;
}
.stat-card {
  position: relative; overflow: hidden;
  background: #fff; border-radius: var(--r-lg);
  padding: 18px 18px 16px; box-shadow: var(--shadow-sm);
  border: 1px solid var(--c-border);
}
.stat-card .label { font-size: 13px; color: var(--c-text-soft); }
.stat-card .value { font-size: 28px; font-weight: 700; margin: 6px 0 2px; color: var(--c-text); }
.stat-card .desc  { font-size: 12px; color: var(--c-text-dim); }
.stat-card .blob {
  position: absolute; right: -30px; top: -30px;
  width: 110px; height: 110px; border-radius: 50%;
  opacity: .15;
}

.panel {
  background: #fff; border-radius: var(--r-lg);
  padding: 18px; margin-bottom: 18px;
  border: 1px solid var(--c-border); box-shadow: var(--shadow-sm);
}
.panel h3 { margin: 0 0 14px; font-size: 15px; font-weight: 700; }

/* 各科目掌握进度条 */
.subj-row {
  display: flex; align-items: center; gap: 12px;
  padding: 10px 0; border-bottom: 1px dashed var(--c-border);
}
.subj-row:last-child { border-bottom: none; }
.subj-row .name { width: 80px; font-weight: 500; display: flex; align-items: center; gap: 8px; }
.subj-row .name .dot { width: 10px; height: 10px; border-radius: 50%; }
.subj-row .bar  { flex: 1; height: 8px; background: var(--c-bg); border-radius: 999px; overflow: hidden; }
.subj-row .bar  .fill { height: 100%; background: var(--c-primary); border-radius: 999px; transition: width .4s; }
.subj-row .num  { width: 90px; text-align: right; font-size: 12.5px; color: var(--c-text-soft); }

/* 复习日历 */
.calendar {
  display: grid; grid-template-columns: repeat(14, 1fr);
  gap: 6px;
}
.calendar .day {
  aspect-ratio: 1 / 1;
  border-radius: 6px;
  background: var(--c-bg);
  display: flex; flex-direction: column; align-items: center; justify-content: center;
  font-size: 11px; color: var(--c-text-soft);
  position: relative;
  border: 1px solid transparent;
}
.calendar .day .d { font-size: 12px; font-weight: 600; color: var(--c-text); }
.calendar .day .c { font-size: 10px; color: var(--c-text-dim); }
.calendar .day .l0 { background: var(--c-bg); }
.calendar .day .l1 { background: #e0e7ff; }
.calendar .day .l2 { background: #c7d2fe; }
.calendar .day .l3 { background: #a5b4fc; }
.calendar .day .l4 { background: #818cf8; color: #fff; }
.calendar .day .l5 { background: #6366f1; color: #fff; }
.calendar .day.today { border-color: var(--c-primary); }

/* 今日优先复习列表 */
.priority-list { display: grid; gap: 10px; }
.priority-row {
  display: flex; align-items: center; gap: 10px;
  padding: 10px 12px; border: 1px solid var(--c-border);
  border-radius: var(--r-md); background: #fafbff;
}
.priority-row .dot { width: 8px; height: 8px; border-radius: 50%; }
.priority-row .meta { flex: 1; min-width: 0; }
.priority-row .meta .t {
  font-weight: 600; white-space: nowrap; overflow: hidden;
  text-overflow: ellipsis; max-width: 100%;
}
.priority-row .meta .s { font-size: 12px; color: var(--c-text-soft); }
.priority-row .lv  { font-size: 12px; }

/* ---------- 错题列表（卡片） ---------- */
.mistake-grid {
  display: grid; gap: 14px;
  grid-template-columns: repeat(auto-fill, minmax(290px, 1fr));
}
.mistake-card {
  background: #fff; border-radius: var(--r-lg);
  border: 1px solid var(--c-border);
  border-left: 4px solid var(--c-primary);
  padding: 14px 16px 12px;
  cursor: pointer; position: relative;
  transition: box-shadow .15s, transform .15s;
}
.mistake-card:hover { box-shadow: var(--shadow-md); transform: translateY(-1px); }
.mistake-card .top {
  display: flex; align-items: center; gap: 8px;
  font-size: 12px; color: var(--c-text-soft); margin-bottom: 8px;
}
.mistake-card .pill {
  display: inline-flex; align-items: center; gap: 4px;
  padding: 2px 8px; border-radius: 999px;
  background: var(--c-primary-soft); color: var(--c-primary-dark);
  font-size: 11.5px; font-weight: 500;
}
.mistake-card .lv { font-size: 11.5px; }
.mistake-card .q {
  font-size: 13.5px; line-height: 1.6; color: var(--c-text);
  max-height: 4.8em; overflow: hidden; position: relative;
  display: -webkit-box; -webkit-line-clamp: 3; -webkit-box-orient: vertical;
  white-space: pre-wrap; word-break: break-word;
}
.mistake-card .q img { max-width: 100%; border-radius: 6px; margin: 4px 0; }
.mistake-card .q .marker {
  background: rgba(255, 230, 0, .35);
  padding: 0 1px; border-radius: 2px;
}
.mistake-card .tags {
  display: flex; flex-wrap: wrap; gap: 4px; margin-top: 8px;
}
.mistake-card .tag {
  background: var(--c-bg-soft); color: var(--c-text-soft);
  padding: 1px 8px; border-radius: 999px; font-size: 11px;
}
.mistake-card .foot {
  display: flex; align-items: center; justify-content: space-between;
  margin-top: 10px; padding-top: 8px;
  border-top: 1px dashed var(--c-border);
  font-size: 12px; color: var(--c-text-dim);
}
.mistake-card .foot .act { display: flex; gap: 4px; }
.mistake-card .foot .act .icon-btn {
  width: 24px; height: 24px; border-radius: 6px;
  display: flex; align-items: center; justify-content: center;
  color: var(--c-text-dim);
}
.mistake-card .foot .act .icon-btn:hover { background: var(--c-bg); color: var(--c-text); }

/* 颜色辅助类 */
.c-math     { color: var(--c-orange); }
.c-english  { color: var(--c-red); }
.c-politic  { color: var(--c-violet); }
.c-major    { color: var(--c-green); }
.c-other    { color: var(--c-cyan); }
.bg-math      { background: var(--c-orange); }
.bg-english   { background: var(--c-red); }
.bg-politic   { background: var(--c-violet); }
.bg-major     { background: var(--c-green); }
.bg-other     { background: var(--c-cyan); }
.bg-chinese   { background: var(--c-pink); }
.bg-physics   { background: var(--c-blue); }
.bg-chemistry { background: var(--c-violet); }
.bg-biology   { background: var(--c-teal); }

.lv-pill {
  display: inline-flex; align-items: center; gap: 4px;
  padding: 2px 8px; border-radius: 999px;
  font-size: 11.5px; font-weight: 500;
}
.lv-完全不会 { background: #fee2e2; color: #b91c1c; }
.lv-陌生     { background: #ffedd5; color: #c2410c; }
.lv-模糊     { background: #fef9c3; color: #a16207; }
.lv-熟悉     { background: #dbeafe; color: #1d4ed8; }
.lv-已掌握   { background: #dcfce7; color: #166534; }

/* ---------- 空状态 ---------- */
.empty {
  text-align: center; padding: 64px 20px;
  color: var(--c-text-soft);
}
.empty .ic {
  font-size: 56px; margin-bottom: 8px; color: var(--c-text-dim);
}
.empty .t { font-size: 15px; font-weight: 600; color: var(--c-text); margin-bottom: 4px; }
.empty .s { font-size: 13px; margin-bottom: 16px; }

/* ---------- 模态框 / 弹窗 ---------- */
.modal-mask {
  position: fixed; inset: 0; background: rgba(15, 23, 42, .4);
  display: flex; align-items: center; justify-content: center;
  z-index: 100; padding: 16px;
  animation: fadeIn .15s ease;
}
@keyframes fadeIn { from { opacity: 0; } to { opacity: 1; } }
.modal {
  background: #fff; border-radius: var(--r-lg);
  width: 100%; max-width: 640px; max-height: 90vh;
  overflow: auto; box-shadow: var(--shadow-lg);
}
.modal .modal-head {
  padding: 16px 20px; border-bottom: 1px solid var(--c-border);
  display: flex; align-items: center; justify-content: space-between;
}
.modal .modal-head .title { font-size: 15px; font-weight: 700; }
.modal .modal-head .close {
  width: 28px; height: 28px; border-radius: 6px;
  display: flex; align-items: center; justify-content: center;
  color: var(--c-text-soft); cursor: pointer;
}
.modal .modal-head .close:hover { background: var(--c-bg); color: var(--c-text); }
.modal .modal-body { padding: 20px; }
.modal .modal-foot {
  padding: 12px 20px; border-top: 1px solid var(--c-border);
  display: flex; justify-content: flex-end; gap: 8px;
}

/* 表单 */
.form-row { margin-bottom: 14px; }
.form-grid {
  display: grid; grid-template-columns: 1fr 1fr; gap: 14px;
  margin-bottom: 14px;
}
.form-grid .form-row { margin-bottom: 0; }
.form-row label {
  display: block; font-size: 12px; color: var(--c-text-soft);
  margin-bottom: 6px;
}
.form-row label .req { color: var(--c-red); }
.form-row input,
.form-row select,
.form-row textarea {
  width: 100%; padding: 9px 11px;
  border: 1px solid var(--c-border); border-radius: var(--r-md);
  background: #fff; outline: none;
}
.form-row input:focus,
.form-row select:focus,
.form-row textarea:focus {
  border-color: var(--c-primary);
  box-shadow: 0 0 0 3px var(--c-primary-light);
}
.form-row textarea { min-height: 96px; resize: vertical; line-height: 1.6; }

/* 图片预览 */
.img-previews { display: flex; flex-wrap: wrap; gap: 8px; }
.img-previews .item {
  position: relative; width: 84px; height: 84px;
  border: 1px solid var(--c-border); border-radius: var(--r-md);
  overflow: hidden; background: var(--c-bg-soft);
}
.img-previews .item img { width: 100%; height: 100%; object-fit: cover; }
.img-previews .item .del {
  position: absolute; top: 2px; right: 2px;
  width: 18px; height: 18px; border-radius: 50%;
  background: rgba(0,0,0,.5); color: #fff;
  display: flex; align-items: center; justify-content: center;
  font-size: 11px; cursor: pointer;
}
.img-previews .uploader {
  width: 84px; height: 84px;
  border: 1.5px dashed var(--c-border); border-radius: var(--r-md);
  display: flex; align-items: center; justify-content: center;
  color: var(--c-text-dim); cursor: pointer; font-size: 22px;
  background: var(--c-bg-soft);
  transition: all .15s;
}
.img-previews .uploader:hover {
  border-color: var(--c-primary); color: var(--c-primary);
  background: var(--c-primary-soft);
}

/* 题目内容工具栏：上传按钮 + 提示 */
.upload-toolbar {
  display: flex; align-items: center; gap: 10px;
  margin-bottom: 6px;
}
.upload-hint { color: var(--c-text-dim); font-size: 12px; }
.btn-sm { padding: 4px 10px; font-size: 13px; }
.btn-sm svg { vertical-align: -2px; }

/* 拖拽到文本框时的视觉反馈 */
textarea.drag-over {
  border-color: var(--c-primary);
  background: var(--c-primary-soft);
  outline: 2px dashed var(--c-primary);
  outline-offset: -2px;
}

/* ---------- 详情抽屉（右侧滑出） ---------- */
.drawer-mask {
  position: fixed; inset: 0; background: rgba(15, 23, 42, .35);
  z-index: 90; animation: fadeIn .15s;
}
.drawer {
  position: fixed; top: 0; right: 0; bottom: 0;
  width: 520px; max-width: 95vw; background: #fff;
  box-shadow: -10px 0 30px rgba(15, 23, 42, .1);
  display: flex; flex-direction: column;
  animation: slideIn .2s ease;
  z-index: 91;
}
@keyframes slideIn { from { transform: translateX(20px); opacity: 0; } to { transform: none; opacity: 1; } }
.drawer .head {
  padding: 14px 20px; border-bottom: 1px solid var(--c-border);
  display: flex; align-items: center; gap: 8px;
}
.drawer .head .t { font-weight: 700; font-size: 15px; }
.drawer .head .close {
  margin-left: auto; cursor: pointer;
  width: 28px; height: 28px; border-radius: 6px;
  display: flex; align-items: center; justify-content: center;
  color: var(--c-text-soft);
}
.drawer .head .close:hover { background: var(--c-bg); }
.drawer .body { padding: 18px 20px; overflow-y: auto; flex: 1; }
.drawer .body section { margin-bottom: 18px; }
.drawer .body .label {
  font-size: 12px; color: var(--c-text-soft);
  margin-bottom: 6px;
}
.drawer .body .content-box {
  border: 1px solid var(--c-border); border-radius: var(--r-md);
  padding: 10px 12px; background: #fafbff; white-space: pre-wrap;
  line-height: 1.7; word-break: break-word;
}
.drawer .body .content-box img { max-width: 100%; border-radius: 6px; margin: 4px 0; }
.drawer .body .row { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; margin-bottom: 8px; font-size: 12px; color: var(--c-text-soft); }
.drawer .foot {
  padding: 12px 20px; border-top: 1px solid var(--c-border);
  display: flex; gap: 8px; justify-content: flex-end;
}

/* ---------- Toast ---------- */
.toast-stack {
  position: fixed; top: 20px; left: 50%; transform: translateX(-50%);
  z-index: 999; display: flex; flex-direction: column; gap: 8px;
  pointer-events: none;
}
.toast {
  background: rgba(17, 24, 39, .9); color: #fff;
  padding: 9px 14px; border-radius: var(--r-md);
  font-size: 13px; pointer-events: auto;
  box-shadow: var(--shadow-md);
  animation: slideDown .2s;
}
.toast.success { background: rgba(34, 197, 94, .92); }
.toast.error   { background: rgba(239, 68, 68, .92); }
@keyframes slideDown { from { opacity: 0; transform: translateY(-8px); } to { opacity: 1; transform: none; } }

/* ---------- 复习记录时间线 ---------- */
.timeline { padding-left: 6px; }
.timeline .ev {
  position: relative; padding: 8px 0 12px 16px;
  border-left: 2px solid var(--c-border);
  margin-left: 6px;
}
.timeline .ev::before {
  content: ''; position: absolute; left: -6px; top: 12px;
  width: 10px; height: 10px; border-radius: 50%;
  background: var(--c-primary);
}
.timeline .ev .when { font-size: 12px; color: var(--c-text-dim); }
.timeline .ev .what { font-size: 13px; }

/* ---------- 管理员后台 ---------- */
.admin-grid {
  display: grid; grid-template-columns: 1fr 1fr; gap: 14px;
}
@media (max-width: 800px) { .admin-grid { grid-template-columns: 1fr; } }
.admin-table {
  width: 100%; border-collapse: collapse; font-size: 13px;
}
.admin-table th, .admin-table td {
  padding: 10px 12px; text-align: left;
  border-bottom: 1px solid var(--c-border);
}
.admin-table th { color: var(--c-text-soft); font-weight: 600; background: var(--c-bg); }
.admin-table tr:last-child td { border-bottom: none; }

/* 开关 */
.switch {
  display: inline-flex; align-items: center; gap: 8px; cursor: pointer;
}
.switch input { display: none; }
.switch .track {
  width: 38px; height: 22px; border-radius: 999px;
  background: #d1d5db; position: relative;
  transition: background .15s;
}
.switch .track::after {
  content: ''; position: absolute; left: 2px; top: 2px;
  width: 18px; height: 18px; border-radius: 50%;
  background: #fff; transition: left .15s;
  box-shadow: 0 1px 3px rgba(0,0,0,.2);
}
.switch input:checked + .track { background: var(--c-primary); }
.switch input:checked + .track::after { left: 18px; }

/* 列表/网格切换 */
.view-toggle {
  display: inline-flex; border: 1px solid var(--c-border);
  border-radius: var(--r-md); overflow: hidden;
}
.view-toggle button {
  background: #fff; border: none; padding: 6px 10px;
  color: var(--c-text-soft);
}
.view-toggle button.active {
  background: var(--c-primary); color: #fff;
}

/* 加载 */
.loading {
  display: flex; align-items: center; justify-content: center;
  padding: 40px; color: var(--c-text-soft); font-size: 13px;
}
.loading::before {
  content: ''; width: 14px; height: 14px; border-radius: 50%;
  border: 2px solid var(--c-primary); border-top-color: transparent;
  animation: spin .8s linear infinite; margin-right: 8px;
}
@keyframes spin { to { transform: rotate(360deg); } }

/* 小屏适配 */
@media (max-width: 900px) {
  :root { --sidebar-w: 200px; }
  .form-grid { grid-template-columns: 1fr; }
}
@media (max-width: 700px) {
  .sidebar { display: none; }
  .topbar .title { display: none; }
  .topbar .search { max-width: none; }
  .drawer { width: 100%; }
}