/* ==========================================================================
   托福错题本 · 设计系统
   --------------------------------------------------------------------------
   方向：暖纸 + 墨绿（编辑部 / 学习档案）
   规则：视觉数值只来自第 1 节的 token，组件区不出现裸数值。
   ========================================================================== */

/* ---------- 1. Design Tokens ---------- */
:root {
  /* 表面与线 */
  --paper:        #faf8f3;
  --surface:      #ffffff;
  --surface-sunk: #f4f1e9;
  --line:         #e5e0d4;
  --line-soft:    #f1ede4;

  /* 文字三级 */
  --ink:   #1b2320;
  --ink-2: #55605a;
  --ink-3: #8a938d;

  /* 主色 */
  --accent:       #2f6b4f;
  --accent-hover: #245741;
  --accent-soft:  #e7efe9;

  /* 语义色 */
  --danger:      #a63d33;
  --danger-soft: #faebe8;
  --warn:        #8f6418;
  --warn-soft:   #f9f0df;
  --info:        #2c5a86;
  --info-soft:   #e9f0f8;
  --violet:      #5b4a86;
  --violet-soft: #efecf8;

  /* 科目色：一浅一深 */
  --reading-bg:   var(--info-soft);
  --reading-fg:   var(--info);
  --listening-bg: var(--violet-soft);
  --listening-fg: var(--violet);
  --speaking-bg:  var(--warn-soft);
  --speaking-fg:  var(--warn);
  --writing-bg:   var(--accent-soft);
  --writing-fg:   var(--accent);

  /* 圆角：4 档 */
  --r-xs:   6px;
  --r-sm:   9px;
  --r-md:   12px;
  --r-lg:   16px;
  --r-pill: 999px;

  /* 字号：8 档 */
  --fs-2xs:  11px;
  --fs-xs:   12.5px;
  --fs-sm:   13.5px;
  --fs-base: 15px;
  --fs-md:   16.5px;
  --fs-lg:   21px;
  --fs-xl:   27px;
  --fs-2xl:  34px;

  /* 间距：4 基数 */
  --sp-1: 4px;
  --sp-2: 8px;
  --sp-3: 12px;
  --sp-4: 16px;
  --sp-5: 20px;
  --sp-6: 24px;
  --sp-7: 32px;
  --sp-8: 48px;

  /* 控件与阴影 */
  --control-h: 40px;
  --shadow-sm: 0 1px 2px rgba(27, 35, 32, .05);
  --shadow-md: 0 1px 2px rgba(27, 35, 32, .04), 0 10px 28px -18px rgba(27, 35, 32, .22);
  --ring: 0 0 0 3px rgba(47, 107, 79, .13);

  /* 字体 */
  --serif: "Songti SC", "Noto Serif SC", Georgia, "Times New Roman", serif;
  --sans: -apple-system, BlinkMacSystemFont, "PingFang SC", "Hiragino Sans GB",
          "Microsoft YaHei", "Segoe UI", Roboto, Helvetica, Arial, sans-serif;

  /* 旧变量名映射，避免遗漏引用 */
  --card: var(--surface);
  --radius: var(--r-lg);
  --radius-sm: var(--r-sm);
  --shadow: var(--shadow-md);
  --ink-soft: var(--ink-2);
  --ink-faint: var(--ink-3);
  --accent-ink: var(--accent-hover);
  --blue: var(--info);
  --amber: var(--warn);
  --green: var(--accent);
}

/* ---------- 2. 基础 ---------- */
*, *::before, *::after { box-sizing: border-box; }

html { -webkit-text-size-adjust: 100%; }

body {
  margin: 0;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  background: var(--paper);
  color: var(--ink);
  font-family: var(--sans);
  font-size: var(--fs-base);
  line-height: 1.65;
  -webkit-font-smoothing: antialiased;
}

a { color: var(--accent-hover); text-decoration: none; }
a:hover { text-decoration: underline; }

h1, h2, h3, h4 {
  margin: 0;
  font-family: var(--serif);
  font-weight: 600;
  line-height: 1.3;
  letter-spacing: -.01em;
}
h1 { font-size: var(--fs-xl); }
h2 { font-size: var(--fs-lg); }
h3 { font-size: var(--fs-md); }
h4 { font-size: var(--fs-base); }
p { margin: 0 0 .8em; }
small { color: var(--ink-3); }
strong, b { font-weight: 600; }

:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }

/* ---------- 3. 顶栏 ---------- */
.topbar {
  position: sticky;
  top: 0;
  z-index: 20;
  background: rgba(250, 248, 243, .9);
  backdrop-filter: saturate(180%) blur(12px);
  border-bottom: 1px solid var(--line);
}

.topbar-inner {
  max-width: 1120px;
  margin: 0 auto;
  padding: 0 var(--sp-6);
  height: 62px;
  display: flex;
  align-items: center;
  gap: var(--sp-7);
}

.brand { display: flex; align-items: center; gap: var(--sp-2); color: var(--ink); }
.brand:hover { text-decoration: none; }

.brand-mark {
  width: 28px;
  height: 28px;
  border-radius: var(--r-sm);
  background: var(--accent);
  color: #fff;
  display: grid;
  place-items: center;
  font-family: var(--serif);
  font-size: var(--fs-md);
  font-weight: 700;
}

.brand-text {
  font-family: var(--serif);
  font-size: var(--fs-md);
  font-weight: 600;
  letter-spacing: .02em;
}

.nav { display: flex; gap: var(--sp-1); }

.nav a {
  padding: var(--sp-2) var(--sp-3);
  border-radius: var(--r-sm);
  color: var(--ink-2);
  font-size: var(--fs-sm);
  transition: background .15s ease, color .15s ease;
}
.nav a:hover { background: var(--line-soft); color: var(--ink); text-decoration: none; }
.nav a.active { background: var(--accent-soft); color: var(--accent-hover); font-weight: 600; }

.userbox {
  margin-left: auto;
  display: flex;
  align-items: center;
  gap: var(--sp-2);
  font-size: var(--fs-xs);
  color: var(--ink-3);
}

.avatar {
  width: 26px;
  height: 26px;
  border-radius: 50%;
  background: var(--line);
  color: var(--ink-2);
  display: grid;
  place-items: center;
  font-size: var(--fs-2xs);
  font-weight: 700;
}

.userbox .email {
  max-width: 170px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.linkbtn {
  background: none;
  border: 0;
  padding: 0;
  cursor: pointer;
  color: var(--ink-3);
  font-family: inherit;
  font-size: var(--fs-xs);
}
.linkbtn:hover { color: var(--danger); text-decoration: underline; }

.mode-badge {
  padding: 2px var(--sp-2);
  border-radius: var(--r-pill);
  background: var(--accent-soft);
  color: var(--accent-hover);
  font-size: var(--fs-2xs);
  font-weight: 600;
  letter-spacing: .02em;
}

/* ---------- 4. 布局 ---------- */
.wrap {
  width: 100%;
  max-width: 1120px;
  margin: 0 auto;
  padding: var(--sp-7) var(--sp-6) var(--sp-8);
  flex: 1;
}

.page-head {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: var(--sp-4);
  flex-wrap: wrap;
  margin-bottom: var(--sp-6);
}
.page-head h1 { margin-bottom: 2px; }
.page-head .sub { color: var(--ink-3); font-size: var(--fs-xs); margin-top: var(--sp-1); }

.eyebrow {
  font-size: var(--fs-2xs);
  font-weight: 600;
  letter-spacing: .14em;
  text-transform: uppercase;
  color: var(--ink-3);
  margin-bottom: var(--sp-1);
}

.footer {
  border-top: 1px solid var(--line);
  padding: var(--sp-4) var(--sp-6);
  text-align: center;
  color: var(--ink-3);
  font-size: var(--fs-2xs);
}
.footer .dot { margin: 0 var(--sp-2); }

.grid { display: grid; gap: var(--sp-4); }
/* grid 子项必须允许收缩，否则长英文/nowrap 内容会把列宽顶开 */
.grid > * { min-width: 0; }
.grid-4 { grid-template-columns: repeat(4, 1fr); }
.grid-2 { grid-template-columns: 1fr 1fr; }
.grid-3-1 { grid-template-columns: 1.45fr 1fr; }

.stack-sm > * + * { margin-top: var(--sp-3); }

/* ---------- 5. 卡片 ---------- */
.card {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--r-md);
  box-shadow: var(--shadow-sm);
}

.card-pad { padding: var(--sp-5) var(--sp-6); }

.card-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--sp-3);
  padding: var(--sp-4) var(--sp-6);
  border-bottom: 1px solid var(--line-soft);
}
.card-head h2, .card-head h3 { font-size: var(--fs-md); }

.card-body { padding: var(--sp-4) var(--sp-6); }

/* ---------- 6. 统计块 ---------- */
.stat { padding: var(--sp-4) var(--sp-5); }
.stat .label { font-size: var(--fs-xs); color: var(--ink-3); letter-spacing: .02em; }
.stat .value {
  margin-top: var(--sp-1);
  font-family: var(--serif);
  font-size: var(--fs-2xl);
  font-weight: 600;
  line-height: 1.15;
  color: var(--ink);
  font-variant-numeric: tabular-nums;
}
.stat .value small {
  margin-left: 2px;
  font-family: var(--sans);
  font-size: var(--fs-xs);
  font-weight: 400;
  color: var(--ink-3);
}
.stat .hint { margin-top: 2px; font-size: var(--fs-xs); color: var(--ink-3); }
.stat.accent .value { color: var(--accent); }

/* ---------- 7. 按钮：一套规格，四种语气 ---------- */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: var(--sp-2);
  height: var(--control-h);
  padding: 0 var(--sp-4);
  border: 1px solid transparent;
  border-radius: var(--r-sm);
  background: var(--accent);
  color: #fff;
  font-family: inherit;
  font-size: var(--fs-sm);
  font-weight: 600;
  line-height: 1;
  white-space: nowrap;
  cursor: pointer;
  transition: background .15s ease, border-color .15s ease, color .15s ease;
}
.btn:hover { background: var(--accent-hover); color: #fff; text-decoration: none; }

.btn.ghost {
  background: var(--surface);
  border-color: var(--line);
  color: var(--ink-2);
  font-weight: 500;
}
.btn.ghost:hover { background: var(--line-soft); border-color: var(--line); color: var(--ink); }

.btn.tint {
  background: var(--accent-soft);
  border-color: transparent;
  color: var(--accent-hover);
}
.btn.tint:hover { background: #dbe9e1; color: var(--accent-hover); }

.btn.danger {
  background: var(--surface);
  border-color: #e8cfcb;
  color: var(--danger);
  font-weight: 500;
}
.btn.danger:hover { background: var(--danger-soft); color: var(--danger); }

.btn.sm {
  height: 32px;
  padding: 0 var(--sp-3);
  border-radius: var(--r-xs);
  font-size: var(--fs-xs);
}

.btn.block { display: flex; width: 100%; }
.btn:disabled, .btn[aria-disabled="true"] { opacity: .5; cursor: not-allowed; }

/* ---------- 8. 表单 ---------- */
.field { margin-bottom: var(--sp-4); }
.field > label {
  display: block;
  margin-bottom: var(--sp-2);
  color: var(--ink-2);
  font-size: var(--fs-xs);
  font-weight: 600;
}
.field .help { margin-top: var(--sp-1); font-size: var(--fs-2xs); color: var(--ink-3); }

input[type=text], input[type=email], input[type=password], input[type=search],
input[type=number], select, textarea {
  width: 100%;
  min-height: var(--control-h);
  padding: var(--sp-2) var(--sp-3);
  border: 1px solid var(--line);
  border-radius: var(--r-sm);
  background: var(--surface);
  color: var(--ink);
  font-family: inherit;
  font-size: var(--fs-sm);
  line-height: 1.5;
  transition: border-color .15s ease, box-shadow .15s ease;
}
input::placeholder, textarea::placeholder { color: var(--ink-3); }

input:focus, select:focus, textarea:focus {
  outline: none;
  border-color: var(--accent);
  box-shadow: var(--ring);
}

textarea { resize: vertical; min-height: 92px; }
textarea.tall { min-height: 132px; }

select {
  appearance: none;
  padding-right: var(--sp-7);
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='8' viewBox='0 0 12 8'%3E%3Cpath d='M1 1l5 5 5-5' stroke='%238a938d' stroke-width='1.6' fill='none' stroke-linecap='round'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right var(--sp-3) center;
}

input[type=file] { font-size: var(--fs-sm); }

.row { display: flex; gap: var(--sp-4); }
.row > * { flex: 1; min-width: 0; }

.form-actions {
  display: flex;
  align-items: center;
  gap: var(--sp-3);
  margin-top: var(--sp-6);
  padding-top: var(--sp-5);
  border-top: 1px solid var(--line-soft);
}

.tag-check input { position: absolute; opacity: 0; pointer-events: none; }
.tag-check span {
  display: inline-block;
  padding: var(--sp-1) var(--sp-3);
  border: 1px solid var(--line);
  border-radius: var(--r-pill);
  background: var(--surface);
  color: var(--ink-2);
  font-size: var(--fs-xs);
  cursor: pointer;
  transition: .12s ease;
}
.tag-check span:hover { border-color: var(--ink-3); }
.tag-check input:checked + span {
  background: var(--accent-soft);
  border-color: #cfe0d5;
  color: var(--accent-hover);
  font-weight: 600;
}
.tag-check input:focus-visible + span { box-shadow: var(--ring); }

/* ---------- 9. 筛选与标签 ---------- */
.filters {
  display: flex;
  align-items: center;
  gap: var(--sp-2);
  flex-wrap: wrap;
  margin-bottom: var(--sp-4);
}
.filters input[type=search] { flex: 1; min-width: 200px; }
.filters select { width: auto; min-width: 120px; }

.chips { display: flex; flex-wrap: wrap; gap: var(--sp-1) var(--sp-2); }

.chip {
  display: inline-flex;
  align-items: center;
  padding: var(--sp-1) var(--sp-3);
  border: 1px solid transparent;
  border-radius: var(--r-pill);
  background: var(--surface-sunk);
  color: var(--ink-2);
  font-size: var(--fs-2xs);
}
a.chip:hover { border-color: var(--line); color: var(--ink); text-decoration: none; }
.chip.active {
  background: var(--accent-soft);
  border-color: #cfe0d5;
  color: var(--accent-hover);
  font-weight: 600;
}
.chip-n { margin-left: var(--sp-1); opacity: .55; font-variant-numeric: tabular-nums; }
.chip-block {
  justify-content: space-between;
  width: 100%;
  padding: var(--sp-2) var(--sp-3);
}

/* ---------- 10. 徽标 ---------- */
.badge {
  display: inline-block;
  padding: 1px var(--sp-2);
  border-radius: var(--r-xs);
  background: var(--surface-sunk);
  color: var(--ink-2);
  font-size: var(--fs-2xs);
  font-weight: 600;
  letter-spacing: .02em;
  white-space: nowrap;
}
.badge.blue   { background: var(--reading-bg);   color: var(--reading-fg); }
.badge.violet { background: var(--listening-bg); color: var(--listening-fg); }
.badge.amber  { background: var(--speaking-bg);  color: var(--speaking-fg); }
.badge.green  { background: var(--writing-bg);   color: var(--writing-fg); }
.badge.grey   { background: var(--surface-sunk); color: var(--ink-3); }

.status-new       { background: var(--danger-soft); color: var(--danger); }
.status-reviewing { background: var(--warn-soft);   color: var(--warn); }
.status-mastered  { background: var(--accent-soft); color: var(--accent-hover); }

/* ---------- 11. 列表 ---------- */
.list { display: flex; flex-direction: column; }

.list-item {
  display: block;
  padding: var(--sp-4) var(--sp-6);
  border-bottom: 1px solid var(--line-soft);
  color: var(--ink);
  transition: background .12s ease;
}
.list-item:last-child { border-bottom: 0; }
.list-item:hover { background: #fdfcf8; text-decoration: none; }

.li-top {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: var(--sp-1) var(--sp-2);
  margin-bottom: var(--sp-1);
}
.li-title { font-size: var(--fs-base); font-weight: 600; line-height: 1.45; }
.li-title.clamp1 { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.li-preview {
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
  margin-top: 2px;
  color: var(--ink-2);
  font-size: var(--fs-sm);
}
.li-meta {
  display: flex;
  flex-wrap: wrap;
  gap: var(--sp-1) var(--sp-3);
  margin-top: var(--sp-1);
  color: var(--ink-3);
  font-size: var(--fs-2xs);
}

/* ---------- 12. 条形统计 ---------- */
.bar-row { margin-bottom: var(--sp-3); }
.bar-label {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: var(--sp-2);
  margin-bottom: var(--sp-1);
  color: var(--ink-2);
  font-size: var(--fs-xs);
}
.bar-label b { color: var(--ink); font-weight: 600; font-variant-numeric: tabular-nums; }
.bar-track {
  height: 8px;
  border-radius: var(--r-pill);
  background: var(--surface-sunk);
  overflow: hidden;
}
.bar-fill { height: 100%; border-radius: var(--r-pill); background: var(--accent); }
.bar-fill.blue   { background: var(--reading-fg); }
.bar-fill.violet { background: var(--listening-fg); }
.bar-fill.amber  { background: var(--speaking-fg); }
.bar-fill.green  { background: var(--writing-fg); }
.bar-fill.mastered { background: var(--accent); }
.bar-fill.open { background: #ded6c6; }

.week-chart {
  display: flex;
  align-items: flex-end;
  gap: var(--sp-2);
  height: 120px;
  margin-top: var(--sp-2);
}
.week-col {
  flex: 1;
  height: 100%;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: flex-end;
  gap: var(--sp-1);
}
.week-bar {
  width: 100%;
  max-width: 34px;
  min-height: 3px;
  border-radius: var(--r-xs) var(--r-xs) 2px 2px;
  background: #d6dcd7;
}
.week-bar.now { background: var(--accent); }
.week-label, .week-num { font-size: var(--fs-2xs); color: var(--ink-3); }
.week-num { color: var(--ink-2); }

/* ---------- 13. 空状态 ---------- */
.empty { padding: var(--sp-8) var(--sp-6); text-align: center; color: var(--ink-3); }
.empty .glyph { margin-bottom: var(--sp-3); font-size: var(--fs-xl); line-height: 1; opacity: .5; }
.empty h3 { margin-bottom: var(--sp-1); color: var(--ink-2); }
.empty p { margin-bottom: var(--sp-4); font-size: var(--fs-sm); }
.empty-tall { padding-top: 90px; }

/* ---------- 14. 认证页 ---------- */
.auth-body {
  background: radial-gradient(120% 90% at 50% 0%, #f4f0e6 0%, var(--paper) 55%);
}
.auth { width: 100%; max-width: 420px; margin: 72px auto; }
.auth .card { padding: var(--sp-7) var(--sp-6); }
.auth-brand { margin-bottom: var(--sp-6); text-align: center; }
.auth-brand .brand-mark {
  width: 38px;
  height: 38px;
  margin: 0 auto var(--sp-3);
  border-radius: var(--r-md);
  font-size: var(--fs-lg);
}
.auth-brand h1 { font-size: var(--fs-lg); }
.auth-brand p { margin: var(--sp-1) 0 0; color: var(--ink-3); font-size: var(--fs-xs); }
.auth .form-actions { margin-top: var(--sp-5); padding: 0; border: 0; }
.auth-switch { margin-top: var(--sp-5); text-align: center; color: var(--ink-3); font-size: var(--fs-xs); }

/* ---------- 15. 提示 ---------- */
.flashes { display: flex; flex-direction: column; gap: var(--sp-2); margin-bottom: var(--sp-4); }

.flash {
  padding: var(--sp-3) var(--sp-4);
  border: 1px solid var(--line);
  border-radius: var(--r-sm);
  background: var(--surface);
  font-size: var(--fs-sm);
}
.flash.ok { background: var(--accent-soft); border-color: #cfe0d5; color: var(--accent-hover); }
.flash.error { background: var(--danger-soft); border-color: #ecd2ce; color: var(--danger); }

/* ---------- 16. 详情页 ---------- */
.detail-block { padding: var(--sp-4) 0; border-bottom: 1px solid var(--line-soft); }
.detail-block:last-child { border-bottom: 0; }
.detail-block h4 {
  margin-bottom: var(--sp-2);
  color: var(--ink-3);
  font-family: var(--sans);
  font-size: var(--fs-2xs);
  font-weight: 600;
  letter-spacing: .1em;
  text-transform: uppercase;
}
.detail-block .content {
  font-size: var(--fs-base);
  white-space: pre-wrap;
  word-break: break-word;
}
.answer-wrong { color: var(--danger); }
.answer-right { color: var(--accent); font-weight: 600; }

.advice { margin: 0; padding-left: var(--sp-5); color: var(--ink-2); font-size: var(--fs-sm); }
.advice li { margin-bottom: var(--sp-2); line-height: 1.6; }

/* ---------- 17. 表格与文件 ---------- */
table.data { width: 100%; border-collapse: collapse; font-size: var(--fs-sm); }
.table-scroll { width: 100%; overflow-x: auto; -webkit-overflow-scrolling: touch; }
.card-foot {
  padding: var(--sp-3) var(--sp-6);
  border-top: 1px solid var(--line-soft);
  text-align: right;
  font-size: var(--fs-xs);
}
table.data th {
  padding: var(--sp-3) var(--sp-4);
  border-bottom: 1px solid var(--line);
  color: var(--ink-3);
  font-size: var(--fs-2xs);
  font-weight: 600;
  letter-spacing: .08em;
  text-align: left;
  text-transform: uppercase;
  white-space: nowrap;
}
table.data td {
  padding: var(--sp-3) var(--sp-4);
  border-bottom: 1px solid var(--line-soft);
  vertical-align: middle;
}
table.data tr:last-child td { border-bottom: 0; }
table.data tbody tr:hover td { background: #fdfcf8; }

.cell-file { display: flex; align-items: center; gap: var(--sp-2); min-width: 0; }
.cell-file .name { font-weight: 500; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.cell-file .sub {
  color: var(--ink-3);
  font-size: var(--fs-2xs);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.file-icon {
  flex: none;
  width: 30px;
  height: 30px;
  border-radius: var(--r-xs);
  background: var(--surface-sunk);
  color: var(--ink-2);
  display: grid;
  place-items: center;
  font-size: var(--fs-2xs);
  font-weight: 700;
  text-transform: uppercase;
}

.dropzone {
  padding: var(--sp-6);
  border: 1.5px dashed #d8d0bf;
  border-radius: var(--r-md);
  background: #fdfbf6;
  text-align: center;
}
.dropzone .hint { margin-top: var(--sp-1); font-size: var(--fs-2xs); color: var(--ink-3); }
.file-pick { display: inline-block; }
.file-pick input[type=file] { display: none; }

/* ---------- 18. 分页 ---------- */
.pagination { display: flex; justify-content: center; gap: var(--sp-1); padding: var(--sp-4); }
.pagination a, .pagination span {
  min-width: 32px;
  padding: var(--sp-1) var(--sp-2);
  border: 1px solid var(--line);
  border-radius: var(--r-xs);
  color: var(--ink-2);
  font-size: var(--fs-xs);
  text-align: center;
}
.pagination a:hover { background: var(--line-soft); text-decoration: none; }
.pagination .cur {
  background: var(--accent-soft);
  border-color: #cfe0d5;
  color: var(--accent-hover);
  font-weight: 600;
}

/* ---------- 19. 播放页 ---------- */
.player-note { border-top: 1px solid var(--line-soft); padding-top: var(--sp-4); }
.player-card { max-width: 720px; margin: 0 auto; }
.player-card audio { width: 100%; }

/* ---------- 20. 工具类 ---------- */
.muted { color: var(--ink-3); }
.dim { opacity: .65; }
.nowrap { white-space: nowrap; }
.text-right { text-align: right; }
.text-xs { font-size: var(--fs-xs); }
.text-sm { font-size: var(--fs-sm); }
.text-md { font-size: var(--fs-md); }
.text-xl { font-size: var(--fs-xl); }
.m0 { margin: 0; }
.mt-1 { margin-top: var(--sp-2); }
.mt-2 { margin-top: var(--sp-4); }
.mt-3 { margin-top: var(--sp-6); }
.mb-1 { margin-bottom: var(--sp-2); }
.mb-2 { margin-bottom: var(--sp-4); }
.ml-auto { margin-left: auto; }
.w-full { width: 100%; }
.min-0 { min-width: 0; }
.inline { display: inline-flex; align-items: center; gap: var(--sp-2); }

/* ---------- 21. 响应式 ---------- */
@media (max-width: 900px) {
  .grid-4 { grid-template-columns: 1fr 1fr; }
  .grid-3-1, .grid-2 { grid-template-columns: 1fr; }
}

@media (max-width: 640px) {
  .topbar-inner {
    height: auto;
    padding: var(--sp-2) var(--sp-4);
    flex-wrap: wrap;
    gap: var(--sp-2) var(--sp-4);
  }
  .nav { order: 3; width: 100%; overflow-x: auto; }
  .userbox .email { display: none; }

  .wrap { padding: var(--sp-5) var(--sp-4) var(--sp-7); }
  h1 { font-size: var(--fs-lg); }
  .stat .value { font-size: var(--fs-xl); }
  .auth { margin: 40px auto; }

  .row { flex-direction: column; gap: 0; }
  .filters input[type=search] { min-width: 0; }
  /* 手机端表格改为卡片列表：标题一行，按钮一行 */
  table.data { font-size: var(--fs-xs); }
  table.data thead { display: none; }
  table.data, table.data tbody, table.data tr, table.data td { display: block; width: 100%; }
  table.data tr {
    padding: var(--sp-3) var(--sp-4);
    border-bottom: 1px solid var(--line-soft);
  }
  table.data tr:last-child { border-bottom: 0; }
  table.data td { padding: 0; border: 0; }
  table.data td:nth-child(2), table.data td:nth-child(3), table.data td:nth-child(4) { display: none; }
  table.data td:nth-child(5) { margin-top: var(--sp-2); text-align: left; }
  table.data .btn.sm { padding: 0 var(--sp-2); }
  .cell-file { min-width: 0; }
  .cell-file > div { min-width: 0; }
  .cell-file .name, .cell-file .sub { white-space: normal; overflow: visible; text-overflow: clip; }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    transition-duration: .01ms !important;
    animation-duration: .01ms !important;
  }
}

/* ---------- 22. 小幅补充组件 ---------- */
.bar-stack { display: flex; height: 100%; }
.inline-form { display: inline; }
.section-divide { border-top: 1px solid var(--line-soft); padding-top: var(--sp-4); }
.error-code { font-family: var(--serif); font-size: var(--fs-2xl); opacity: .35; }
