/* ==========================================================================
   三电互闻 · 公告问答平台
   Design tokens + component stylesheet
   继承自导出稿 wechat-announcement-qa.html 的视觉系统
   ========================================================================== */

/* --------------------------------------------------------------------------
   1. Tokens
   -------------------------------------------------------------------------- */
:root {
  /* 中性色 */
  --bg: #ffffff;
  --surface: #f5f5f7;
  --surface-2: #fbfbfd;
  --surface-3: #f0f0f2;
  --fg: #1d1d1f;
  --fg-2: #424245;
  --muted: #6e6e73;
  /* 白底对比度 4.65:1（AA 达标）；原来的 #86868b 只有 3.28:1，小字不达标 */
  --meta: #74747a;
  --border: #d2d2d7;
  --border-soft: #e8e8ed;

  /* 品牌与语义色 */
  --accent: #0071e3;
  --accent-hover: #0077ed;
  --accent-active: #0066cc;
  --accent-soft: #eaf3fe;
  --success: #16a34a;
  --success-soft: #e9f7ef;
  --warn: #b45309;
  --warn-soft: #fdf3e3;
  --danger: #dc2626;
  --danger-soft: #fdecec;

  /* 深色面板（hero / 品牌区） */
  --ink: #1d1d1f;
  --ink-2: #2a2a2d;
  --ink-3: #3a3a3d;
  --ink-fg: #f5f5f7;
  --ink-muted: #a1a1a6;
  /* 深色面板上对比度 5.16:1；原来的 #7c7c81 只有 4.05:1 */
  --ink-meta: #8e8e93;
  --ink-accent: #4da3ff;

  /* 圆角 */
  --radius-sm: 8px;
  --radius-md: 12px;
  --radius-lg: 18px;
  --radius-xl: 24px;
  --radius-pill: 980px;

  /* 阴影 */
  --elev-ring: 0 0 0 1px var(--border-soft);
  --elev-card: 0 1px 2px rgba(0, 0, 0, .04), 0 10px 28px -16px rgba(0, 0, 0, .18);
  --elev-raised: 0 12px 32px rgba(0, 0, 0, .08);
  --elev-lift: 0 2px 4px rgba(0, 0, 0, .05), 0 18px 40px -18px rgba(0, 0, 0, .24);
  --focus-ring: 0 0 0 4px rgba(0, 113, 227, .26);

  /* 动效 */
  --motion-fast: 150ms;
  --motion-base: 220ms;
  --ease: cubic-bezier(.28, 0, .22, 1);

  /* 字体 */
  --font-body: -apple-system, BlinkMacSystemFont, "SF Pro Text", "Segoe UI",
    "PingFang SC", "Hiragino Sans GB", "Microsoft YaHei", "Noto Sans SC", sans-serif;
  --font-display: -apple-system, BlinkMacSystemFont, "SF Pro Display", "Segoe UI",
    "PingFang SC", "Hiragino Sans GB", "Microsoft YaHei", "Noto Sans SC", sans-serif;
  --font-mono: ui-monospace, "SF Mono", "JetBrains Mono", Menlo, Consolas, monospace;

  /* 字阶（流体） */
  --text-xs: 12px;
  --text-sm: 13px;
  --text-base: 15px;
  --text-md: 17px;
  --text-lg: clamp(19px, 1.1vw + 15px, 22px);
  --text-xl: clamp(24px, 1.8vw + 18px, 30px);
  --text-2xl: clamp(30px, 3.1vw + 18px, 44px);

  /* 布局 */
  --container: 1200px;
  --gutter: clamp(16px, 4vw, 40px);
  --topbar-h: 68px;
}

/* --------------------------------------------------------------------------
   2. Reset & base
   -------------------------------------------------------------------------- */
*,
*::before,
*::after { box-sizing: border-box; }

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

body {
  margin: 0;
  min-height: 100%;
  background: var(--bg);
  color: var(--fg);
  font-family: var(--font-body);
  font-size: var(--text-base);
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}

h1, h2, h3, h4 { margin: 0; font-family: var(--font-display); font-weight: 600; letter-spacing: -.015em; }
p { margin: 0; }
a { color: var(--accent-active); text-decoration: none; }
a:hover { text-decoration: underline; }
ul, ol { margin: 0; padding: 0; list-style: none; }
img { max-width: 100%; display: block; }

button, input, textarea, select { font: inherit; color: inherit; }
button { cursor: pointer; background: none; border: 0; padding: 0; }

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

.sr-only {
  position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px;
  overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; border: 0;
}

/* 跳转链接：键盘 Tab 聚焦时必须重新可见，否则键盘用户永远看不到它 */
.skip-link:focus,
.skip-link:focus-visible {
  position: fixed;
  top: 12px; left: 12px;
  z-index: 100;
  width: auto; height: auto;
  margin: 0; padding: 10px 16px;
  overflow: visible; clip: auto;
  white-space: normal;
  background: var(--ink);
  color: #fff;
  border-radius: var(--radius-md);
  font-size: var(--text-sm);
  text-decoration: none;
}

/* --------------------------------------------------------------------------
   3. Layout primitives
   -------------------------------------------------------------------------- */
.container {
  width: 100%;
  max-width: var(--container);
  margin-inline: auto;
  padding-inline: var(--gutter);
}

.stack { display: flex; flex-direction: column; }
.row { display: flex; align-items: center; }
.row-top { display: flex; align-items: flex-start; }
.wrap { display: flex; flex-wrap: wrap; align-items: center; }
.grow { flex: 1 1 0; min-width: 0; }
.spacer { flex: 1 1 auto; }

.gap-4 { gap: 4px; } .gap-6 { gap: 6px; } .gap-8 { gap: 8px; }
.gap-12 { gap: 12px; } .gap-16 { gap: 16px; } .gap-20 { gap: 20px; }
.gap-24 { gap: 24px; } .gap-32 { gap: 32px; } .gap-40 { gap: 40px; }

.page { padding-block: clamp(28px, 4vw, 56px) clamp(56px, 8vw, 96px); }

/* 双栏骨架：桌面侧栏在右，平板及以下堆叠 */
.split {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 340px;
  gap: clamp(20px, 3vw, 40px);
  align-items: start;
}
.split-narrow { grid-template-columns: minmax(0, 1fr) 320px; }
.split-flip { grid-template-columns: 320px minmax(0, 1fr); }

@media (max-width: 1023px) {
  .split, .split-narrow, .split-flip { grid-template-columns: minmax(0, 1fr); }
}

.sticky-side { position: sticky; top: calc(var(--topbar-h) + 24px); }
@media (max-width: 1023px) { .sticky-side { position: static; } }

/* --------------------------------------------------------------------------
   4. Topbar
   -------------------------------------------------------------------------- */
.topbar {
  position: sticky;
  top: 0;
  z-index: 40;
  background: rgba(255, 255, 255, .82);
  backdrop-filter: saturate(180%) blur(20px);
  -webkit-backdrop-filter: saturate(180%) blur(20px);
  border-bottom: 1px solid var(--border-soft);
}

.topbar-inner {
  display: flex;
  align-items: center;
  gap: 16px;
  min-height: var(--topbar-h);
}

.brand { display: flex; align-items: center; gap: 10px; flex: none; }
.brand-mark {
  display: grid; place-items: center;
  width: 34px; height: 34px;
  border-radius: 10px;
  background: var(--ink);
  color: #fff;
  font-family: var(--font-display);
  font-size: 16px;
  font-weight: 600;
}
.brand-mark svg { display: block; width: 24px; height: 24px; }
.brand-text { display: flex; flex-direction: column; line-height: 1.15; }
.brand-name { font-family: var(--font-display); font-size: 16px; font-weight: 600; letter-spacing: -.02em; color: var(--fg); }
.brand-sub { font-size: 11px; color: var(--meta); letter-spacing: .01em; }

.nav { display: flex; align-items: center; gap: 4px; margin-left: 8px; }
.nav-link {
  padding: 8px 12px;
  border-radius: var(--radius-sm);
  color: var(--fg-2);
  font-size: 14px;
  white-space: nowrap;
  transition: background var(--motion-fast) var(--ease), color var(--motion-fast) var(--ease);
}
.nav-link:hover { background: var(--surface); color: var(--fg); text-decoration: none; }
.nav-link.is-active { background: var(--surface-3); color: var(--fg); font-weight: 500; }

.topbar-actions { display: flex; align-items: center; gap: 10px; margin-left: auto; }

.role-pill {
  display: inline-flex; align-items: center; gap: 6px;
  height: 32px; padding: 0 12px;
  border: 1px solid var(--border);
  border-radius: var(--radius-pill);
  background: var(--bg);
  font-size: 12px;
  color: var(--fg-2);
  white-space: nowrap;
}
.role-pill b { font-weight: 600; }
.role-pill.is-student b { color: var(--muted); }
.role-pill.is-counselor { border-color: rgba(0, 113, 227, .35); background: var(--accent-soft); color: var(--accent-active); }
.role-pill.is-counselor b { color: var(--accent-active); }

.icon-btn {
  position: relative;
  display: grid; place-items: center;
  width: 36px; height: 36px;
  border-radius: var(--radius-sm);
  color: var(--fg-2);
  transition: background var(--motion-fast) var(--ease);
}
.icon-btn:hover { background: var(--surface); }
.icon-btn .dot {
  position: absolute; top: 3px; right: 2px;
  min-width: 17px; height: 17px; padding: 0 4px;
  border-radius: var(--radius-pill);
  background: var(--danger); color: #fff;
  font-size: 10px; font-weight: 600; line-height: 17px; text-align: center;
  border: 2px solid #fff;
}

.avatar {
  display: grid; place-items: center;
  width: 34px; height: 34px;
  border-radius: 50%;
  background: var(--surface-3);
  color: var(--fg-2);
  font-size: 13px; font-weight: 600;
  flex: none;
}
.avatar-lg { width: 56px; height: 56px; font-size: 20px; }
.avatar-sm { width: 30px; height: 30px; font-size: 12px; }

/* 移动端底部导航 */
.tabbar { display: none; }

@media (max-width: 767px) {
  .nav { display: none; }
  .topbar-actions .role-pill { display: none; }
  .brand-sub { display: none; }

  .tabbar {
    display: grid;
    grid-auto-flow: column;
    grid-auto-columns: 1fr;
    position: fixed;
    left: 0; right: 0; bottom: 0;
    z-index: 45;
    padding-bottom: env(safe-area-inset-bottom, 0);
    background: rgba(255, 255, 255, .92);
    backdrop-filter: saturate(180%) blur(20px);
    -webkit-backdrop-filter: saturate(180%) blur(20px);
    border-top: 1px solid var(--border-soft);
  }
  .tab-item {
    display: flex; flex-direction: column; align-items: center; justify-content: center;
    gap: 3px;
    min-height: 56px;
    color: var(--muted);
    font-size: 10px;
    text-decoration: none;
  }
  .tab-item:hover { text-decoration: none; }
  .tab-item.is-active { color: var(--accent-active); }
  .tab-item svg { width: 21px; height: 21px; }
  .tab-badge {
    position: absolute; transform: translate(11px, -8px);
    min-width: 15px; height: 15px; padding: 0 3px;
    border-radius: var(--radius-pill);
    background: var(--danger); color: #fff;
    font-size: 9px; font-weight: 600; line-height: 15px; text-align: center;
  }
  body { padding-bottom: 56px; }
}

/* --------------------------------------------------------------------------
   5. Typography helpers
   -------------------------------------------------------------------------- */
.eyebrow {
  font-size: var(--text-xs);
  font-weight: 600;
  letter-spacing: .08em;
  color: var(--accent-active);
  text-transform: uppercase;
}
.eyebrow-plain { color: var(--accent-active); text-transform: none; letter-spacing: .06em; }

.page-title { font-size: var(--text-2xl); line-height: 1.12; color: var(--fg); }
.page-sub { margin-top: 10px; max-width: 62ch; color: var(--muted); font-size: var(--text-md); line-height: 1.55; }
.section-title { font-size: var(--text-lg); }
.muted { color: var(--muted); }
.meta-text { color: var(--meta); font-size: var(--text-sm); }
.mono { font-family: var(--font-mono); font-size: var(--text-xs); letter-spacing: .04em; }

.section-head {
  display: flex; align-items: baseline; justify-content: space-between;
  gap: 16px;
  margin-bottom: 14px;
}
.section-head .count { color: var(--meta); font-size: var(--text-sm); }

/* --------------------------------------------------------------------------
   6. Buttons
   -------------------------------------------------------------------------- */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  min-height: 44px;
  padding: 0 20px;
  border-radius: var(--radius-md);
  font-size: var(--text-base);
  font-weight: 500;
  white-space: nowrap;
  border: 1px solid transparent;
  transition: background var(--motion-fast) var(--ease),
              border-color var(--motion-fast) var(--ease),
              color var(--motion-fast) var(--ease),
              box-shadow var(--motion-fast) var(--ease),
              transform var(--motion-fast) var(--ease);
}
.btn:active { transform: translateY(1px); }
.btn[disabled], .btn.is-disabled { opacity: .45; cursor: not-allowed; transform: none; }

.btn-primary { background: var(--accent); color: #fff; }
.btn-primary:hover:not([disabled]) { background: var(--accent-hover); }
.btn-primary:active:not([disabled]) { background: var(--accent-active); }

.btn-secondary { background: var(--bg); color: var(--fg); border-color: var(--border); }
.btn-secondary:hover:not([disabled]) { background: var(--surface); border-color: var(--meta); }

.btn-ghost { background: transparent; color: var(--accent-active); padding-inline: 12px; }
.btn-ghost:hover:not([disabled]) { background: var(--accent-soft); }

.btn-quiet { background: transparent; color: var(--muted); min-height: 36px; padding-inline: 10px; font-size: var(--text-sm); }
.btn-quiet:hover:not([disabled]) { background: var(--surface); color: var(--fg); }

.btn-danger { background: var(--bg); color: var(--danger); border-color: rgba(220, 38, 38, .3); }
.btn-danger:hover:not([disabled]) { background: var(--danger-soft); }

.btn-sm { min-height: 34px; padding: 0 14px; font-size: var(--text-sm); border-radius: var(--radius-sm); }
.btn-lg { min-height: 50px; padding: 0 28px; font-size: var(--text-md); }
.btn-block { width: 100%; }

/* 深色面板上的按钮 */
.on-ink .btn-secondary { background: #fff; color: var(--ink); border-color: transparent; }
.on-ink .btn-secondary:hover { background: #f0f0f2; }

/* 加载态 */
.btn.is-loading { position: relative; color: transparent !important; pointer-events: none; }
.btn.is-loading::after {
  content: ""; position: absolute; inset: 0; margin: auto;
  width: 16px; height: 16px;
  border: 2px solid rgba(255, 255, 255, .4);
  border-top-color: #fff;
  border-radius: 50%;
  animation: spin .7s linear infinite;
}
.btn-secondary.is-loading::after, .btn-ghost.is-loading::after {
  border-color: rgba(0, 0, 0, .18); border-top-color: var(--fg);
}
@keyframes spin { to { transform: rotate(360deg); } }

/* --------------------------------------------------------------------------
   7. Surfaces
   -------------------------------------------------------------------------- */
.card {
  background: var(--bg);
  border: 1px solid var(--border-soft);
  border-radius: var(--radius-lg);
  padding: 20px;
}
.card-pad-lg { padding: 28px; }
.card-flush { padding: 0; overflow: hidden; }
.card-surface { background: var(--surface); border-color: transparent; }
.card-interactive {
  display: block; width: 100%; text-align: left;
  transition: border-color var(--motion-fast) var(--ease),
              box-shadow var(--motion-base) var(--ease),
              transform var(--motion-base) var(--ease);
}
.card-interactive:hover {
  border-color: var(--border);
  box-shadow: var(--elev-card);
  transform: translateY(-2px);
  text-decoration: none;
}

.panel-title { font-size: var(--text-md); font-weight: 600; }

/* 深色 hero 面板 */
.hero-panel {
  position: relative;
  overflow: hidden;
  padding: clamp(24px, 3.4vw, 40px);
  border-radius: var(--radius-xl);
  background: var(--ink);
  color: var(--ink-fg);
}
.hero-panel::after {
  content: "";
  position: absolute; right: -90px; top: -120px;
  width: 420px; height: 420px;
  border-radius: 50%;
  /* 末端色必须写成同色 0 透明度；写 transparent 会被插值成半透明黑，产生可见的灰边 */
  background: radial-gradient(circle at 34% 34%, rgba(0, 113, 227, .36), rgba(0, 113, 227, 0) 62%);
  pointer-events: none;
}
.hero-panel > * { position: relative; z-index: 1; }
.hero-panel .eyebrow { color: var(--ink-accent); }
.hero-panel h2 { margin-top: 10px; font-size: var(--text-xl); line-height: 1.2; color: #fff; }
.hero-panel p { margin-top: 12px; max-width: 56ch; color: var(--ink-muted); font-size: var(--text-base); line-height: 1.6; }
.hero-actions { display: flex; flex-wrap: wrap; gap: 12px; margin-top: 24px; }

.hero-panel-lg { border-radius: 28px; padding: clamp(32px, 4.4vw, 56px); }
.hero-panel-lg h1 { margin-top: 14px; font-size: var(--text-2xl); line-height: 1.14; color: #fff; }
.hero-panel-lg p { font-size: var(--text-md); }

.ink-divider { height: 1px; background: rgba(255, 255, 255, .12); margin: 4px 0; }

.feature-row { display: flex; gap: 14px; align-items: flex-start; }
.feature-icon {
  display: grid; place-items: center;
  width: 36px; height: 36px; flex: none;
  border-radius: 10px;
  background: var(--ink-2);
  color: var(--ink-accent);
}
.feature-icon svg { width: 18px; height: 18px; }
.feature-row strong { display: block; font-size: var(--text-base); font-weight: 600; color: #fff; }
.feature-row span { display: block; margin-top: 2px; font-size: var(--text-sm); color: var(--ink-meta); line-height: 1.5; }

/* --------------------------------------------------------------------------
   8. Badges / chips / status
   -------------------------------------------------------------------------- */
.badge {
  display: inline-flex; align-items: center; gap: 6px;
  height: 24px; padding: 0 10px;
  border-radius: var(--radius-pill);
  font-size: var(--text-xs);
  font-weight: 500;
  white-space: nowrap;
  background: var(--surface-3);
  color: var(--fg-2);
}
.badge::before { content: ""; width: 6px; height: 6px; border-radius: 50%; background: currentColor; }
.badge-plain::before { display: none; }
.badge-open { background: var(--accent-soft); color: var(--accent-active); }
.badge-closed { background: var(--surface-3); color: var(--muted); }
.badge-pending { background: var(--warn-soft); color: var(--warn); }
.badge-answered { background: var(--accent-soft); color: var(--accent-active); }
.badge-resolved { background: var(--success-soft); color: var(--success); }
.badge-hidden { background: var(--danger-soft); color: var(--danger); }
.badge-ink { background: rgba(255, 255, 255, .12); color: #fff; }

.tag-pin {
  display: inline-flex; align-items: center;
  height: 22px; padding: 0 9px;
  border-radius: 6px;
  background: var(--ink);
  color: #fff;
  font-size: 11px; font-weight: 500;
}
.tag-cat {
  display: inline-flex; align-items: center;
  height: 22px; padding: 0 9px;
  border-radius: 6px;
  background: var(--surface-3);
  color: var(--fg-2);
  font-size: 11px;
}

.chips { display: flex; gap: 8px; flex-wrap: wrap; }
.chips-scroll {
  display: flex; gap: 8px;
  overflow-x: auto;
  padding-bottom: 4px;
  scrollbar-width: none;
}
.chips-scroll::-webkit-scrollbar { display: none; }
.chip {
  display: inline-flex; align-items: center;
  height: 34px; padding: 0 14px;
  border: 1px solid var(--border);
  border-radius: var(--radius-pill);
  background: var(--bg);
  color: var(--fg-2);
  font-size: var(--text-sm);
  white-space: nowrap;
  transition: all var(--motion-fast) var(--ease);
}
.chip:hover { border-color: var(--meta); background: var(--surface-2); }
.chip.is-selected { background: var(--ink); border-color: var(--ink); color: #fff; }

/* --------------------------------------------------------------------------
   9. Forms
   -------------------------------------------------------------------------- */
.field { display: flex; flex-direction: column; gap: 8px; }
.field label { font-size: var(--text-sm); font-weight: 600; color: var(--fg); }
.field-help { font-size: var(--text-xs); color: var(--meta); }
.field-error { font-size: var(--text-xs); color: var(--danger); }

.input, .textarea, .select {
  width: 100%;
  min-height: 46px;
  padding: 11px 14px;
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  background: var(--bg);
  color: var(--fg);
  font-size: var(--text-base);
  transition: border-color var(--motion-fast) var(--ease), box-shadow var(--motion-fast) var(--ease);
}
.input::placeholder, .textarea::placeholder { color: var(--meta); }
.input:focus, .textarea:focus, .select:focus {
  outline: none;
  border-color: var(--accent);
  box-shadow: var(--focus-ring);
}
.input[readonly], .textarea[readonly] { background: var(--surface); color: var(--muted); }
.textarea { min-height: 148px; resize: vertical; line-height: 1.6; }
.textarea-tall { min-height: 240px; }
.select { appearance: none; padding-right: 38px;
  background-image: linear-gradient(45deg, transparent 50%, var(--muted) 50%),
                    linear-gradient(135deg, var(--muted) 50%, transparent 50%);
  background-position: calc(100% - 19px) 21px, calc(100% - 14px) 21px;
  background-size: 5px 5px, 5px 5px;
  background-repeat: no-repeat;
}
.input[type="file"] { padding-block: 9px; font-size: var(--text-sm); }

.char-count { font-size: var(--text-xs); color: var(--meta); font-variant-numeric: tabular-nums; }
.char-count.is-warn { color: var(--danger); }

.switch-row {
  display: flex; align-items: center; justify-content: space-between;
  gap: 16px;
  padding: 14px 0;
}
.switch-row .switch-copy strong { display: block; font-size: var(--text-base); font-weight: 500; }
.switch-row .switch-copy small { display: block; margin-top: 3px; font-size: var(--text-xs); color: var(--meta); }

.switch {
  position: relative; flex: none;
  width: 48px; height: 28px;
  border-radius: var(--radius-pill);
  background: var(--border);
  transition: background var(--motion-base) var(--ease);
}
.switch::after {
  content: ""; position: absolute; top: 3px; left: 3px;
  width: 22px; height: 22px;
  border-radius: 50%;
  background: #fff;
  box-shadow: 0 1px 3px rgba(0, 0, 0, .28);
  transition: transform var(--motion-base) var(--ease);
}
.switch[aria-checked="true"] { background: var(--accent); }
.switch[aria-checked="true"]::after { transform: translateX(20px); }

.form-actions { display: flex; flex-wrap: wrap; gap: 12px; padding-top: 4px; }
.form-actions-end { justify-content: flex-end; }

.notice {
  display: flex; gap: 10px; align-items: flex-start;
  padding: 12px 14px;
  border-radius: var(--radius-md);
  background: var(--surface);
  color: var(--fg-2);
  font-size: var(--text-sm);
  line-height: 1.55;
}
.notice svg { width: 16px; height: 16px; flex: none; margin-top: 2px; color: var(--muted); }
.notice-info { background: var(--accent-soft); color: var(--accent-active); }
.notice-info svg { color: var(--accent-active); }
.notice-warn { background: var(--warn-soft); color: var(--warn); }
.notice-warn svg { color: var(--warn); }
.notice-danger { background: var(--danger-soft); color: var(--danger); }
.notice-danger svg { color: var(--danger); }

/* 顶部通告：内容由管理面板的「站点文案」下发，没有内容时整块保持隐藏 */
.site-banner { padding: 12px 16px 0; }
.site-banner[hidden] { display: none; }
.site-banner .notice-banner {
  max-width: 1180px;
  margin: 0 auto;
  background: var(--accent-soft);
  color: var(--accent-active);
}
.site-banner .notice-banner svg { color: var(--accent-active); }

/* 分段控件 */
.segmented {
  display: inline-flex;
  padding: 3px;
  border-radius: var(--radius-md);
  background: var(--surface-3);
}
.segmented button {
  padding: 7px 16px;
  border-radius: 9px;
  font-size: var(--text-sm);
  color: var(--fg-2);
  transition: all var(--motion-fast) var(--ease);
}
.segmented button.is-selected { background: var(--bg); color: var(--fg); font-weight: 600; box-shadow: 0 1px 2px rgba(0, 0, 0, .08); }

/* --------------------------------------------------------------------------
   10. List rows
   -------------------------------------------------------------------------- */
.list-row {
  display: flex; align-items: center; gap: 16px;
  width: 100%;
  padding: 16px 0;
  text-align: left;
  border-bottom: 1px solid var(--border-soft);
}
.list-row:last-child { border-bottom: 0; }
.list-row .lr-main { min-width: 0; flex: 1 1 auto; }
.list-row strong { display: block; font-size: var(--text-base); font-weight: 500; }
.list-row small { display: block; margin-top: 3px; font-size: var(--text-xs); color: var(--meta); }
.list-row .lr-chev { color: var(--meta); flex: none; }
.list-row.is-interactive { transition: background var(--motion-fast) var(--ease); border-radius: var(--radius-sm); }
.list-row.is-interactive:hover { background: var(--surface); }

/* --------------------------------------------------------------------------
   11. Announcement card
   -------------------------------------------------------------------------- */
.anno-list { display: flex; flex-direction: column; gap: 12px; }

.anno-card {
  display: block;
  width: 100%;
  text-align: left;
  padding: 20px;
  border: 1px solid var(--border-soft);
  border-radius: var(--radius-lg);
  background: var(--bg);
  text-decoration: none;
  transition: border-color var(--motion-fast) var(--ease),
              box-shadow var(--motion-base) var(--ease),
              transform var(--motion-base) var(--ease);
}
.anno-card:hover { border-color: var(--border); box-shadow: var(--elev-card); transform: translateY(-2px); text-decoration: none; }
.anno-card.is-closed { background: var(--surface-2); }
.anno-card h3 { text-decoration: none; }

.anno-head { display: flex; align-items: flex-start; gap: 10px; justify-content: space-between; }
.anno-title { font-size: var(--text-md); font-weight: 600; line-height: 1.35; color: var(--fg); }
.anno-desc {
  margin-top: 10px;
  color: var(--muted);
  font-size: var(--text-base);
  line-height: 1.55;
  display: -webkit-box; -webkit-box-orient: vertical; -webkit-line-clamp: 2; overflow: hidden;
}
.anno-meta {
  display: flex; flex-wrap: wrap; align-items: center; gap: 10px;
  margin-top: 14px;
  font-size: var(--text-xs);
  color: var(--meta);
}
.anno-meta .dot-sep { width: 3px; height: 3px; border-radius: 50%; background: var(--border); }

/* --------------------------------------------------------------------------
   12. Q&A
   -------------------------------------------------------------------------- */
.qa-list { display: flex; flex-direction: column; gap: 14px; }

.qa-card {
  padding: 20px;
  border: 1px solid var(--border-soft);
  border-radius: var(--radius-lg);
  background: var(--bg);
}
.qa-card-head { display: flex; align-items: center; gap: 12px; }
.qa-author { display: flex; align-items: center; gap: 10px; min-width: 0; }
.qa-author-text { display: flex; flex-direction: column; line-height: 1.3; min-width: 0; }
.qa-author-text b { font-size: var(--text-sm); font-weight: 600; }
.qa-author-text span { font-size: var(--text-xs); color: var(--meta); }
.qa-question { margin-top: 14px; font-size: var(--text-md); line-height: 1.55; color: var(--fg); }

.qa-answer {
  margin-top: 16px;
  padding: 16px;
  border-radius: var(--radius-md);
  background: var(--surface);
  border-left: 3px solid var(--accent);
}
.qa-answer-label {
  display: flex; align-items: center; gap: 7px;
  font-size: var(--text-xs); font-weight: 600; color: var(--accent-active);
}
.qa-answer-label .avatar-tiny {
  display: grid; place-items: center; width: 18px; height: 18px;
  border-radius: 50%; background: var(--accent); color: #fff; font-size: 10px; font-weight: 600;
}
.qa-answer p { margin-top: 8px; font-size: var(--text-base); line-height: 1.6; color: var(--fg-2); }
.qa-answer-meta { margin-top: 10px; font-size: var(--text-xs); color: var(--meta); }

.qa-foot { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; margin-top: 14px; }

/* --------------------------------------------------------------------------
   13. States: empty / loading / error / denied
   -------------------------------------------------------------------------- */
.state {
  display: flex; flex-direction: column; align-items: center; justify-content: center;
  gap: 10px;
  padding: 56px 24px;
  text-align: center;
  border: 1px dashed var(--border);
  border-radius: var(--radius-lg);
  background: var(--surface-2);
}
.state-icon {
  display: grid; place-items: center;
  width: 44px; height: 44px;
  border-radius: 14px;
  background: var(--surface-3);
  color: var(--muted);
  margin-bottom: 2px;
}
.state strong { font-size: var(--text-md); font-weight: 600; }
.state span { color: var(--muted); font-size: var(--text-base); max-width: 46ch; line-height: 1.55; }
.state .btn { margin-top: 8px; }

.skeleton {
  border-radius: var(--radius-lg);
  background: linear-gradient(90deg, var(--surface-3) 25%, #e6e6e9 37%, var(--surface-3) 63%);
  background-size: 400% 100%;
  animation: shimmer 1.3s ease infinite;
}
@keyframes shimmer { 0% { background-position: 100% 50%; } 100% { background-position: 0 50%; } }
.sk-card { height: 116px; }
.sk-line { height: 14px; border-radius: 6px; }

.denied { border-style: solid; border-color: rgba(220, 38, 38, .22); background: var(--danger-soft); }
.denied .state-icon { background: #fff; color: var(--danger); }

/* --------------------------------------------------------------------------
   14. Stats
   -------------------------------------------------------------------------- */
.stat-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(160px, 1fr));
  gap: 12px;
}
.stat {
  padding: 18px;
  border: 1px solid var(--border-soft);
  border-radius: var(--radius-lg);
  background: var(--bg);
}
.stat b { display: block; font-family: var(--font-display); font-size: 30px; font-weight: 600; letter-spacing: -.02em; line-height: 1.1; }
.stat span { display: block; margin-top: 6px; font-size: var(--text-sm); color: var(--muted); }
.stat.is-accent { border-color: rgba(0, 113, 227, .3); background: var(--accent-soft); }
.stat.is-accent b { color: var(--accent-active); }
.stat.is-accent span { color: var(--accent-active); opacity: .8; }

/* --------------------------------------------------------------------------
   15. Login
   -------------------------------------------------------------------------- */
.login-page { min-height: 100dvh; background: var(--surface); }

.login-split {
  display: grid;
  grid-template-columns: minmax(0, 1.15fr) minmax(0, 1fr);
  gap: clamp(20px, 2.6vw, 36px);
  align-items: start;
}
@media (max-width: 1023px) { .login-split { grid-template-columns: minmax(0, 1fr); } }

.auth-card {
  padding: clamp(22px, 2.4vw, 30px);
  border: 1px solid var(--border-soft);
  border-radius: var(--radius-xl);
  background: var(--bg);
}
.auth-card.is-primary { border-color: rgba(0, 113, 227, .4); box-shadow: 0 14px 40px -22px rgba(0, 113, 227, .5); }

.perm-list { display: flex; flex-direction: column; gap: 10px; margin-top: 4px; }
.perm-item { display: flex; align-items: center; gap: 9px; font-size: var(--text-sm); color: var(--fg-2); }
.perm-item svg { width: 16px; height: 16px; flex: none; }
.perm-item.is-on svg { color: var(--success); }
.perm-item.is-off { color: var(--meta); }
.perm-item.is-off svg { color: var(--border); }

.auth-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; }
.auth-title { margin-top: 14px; font-size: 24px; }
.auth-desc { margin-top: 8px; color: var(--muted); font-size: var(--text-sm); line-height: 1.6; }
.auth-body { margin-top: 18px; display: flex; flex-direction: column; gap: 14px; }
.auth-foot { margin-top: 14px; font-size: var(--text-xs); color: var(--meta); line-height: 1.6; }

/* --------------------------------------------------------------------------
   16. Toast
   -------------------------------------------------------------------------- */
.toast {
  position: fixed;
  left: 50%; bottom: calc(28px + env(safe-area-inset-bottom, 0px));
  z-index: 90;
  transform: translate(-50%, 16px);
  max-width: min(92vw, 420px);
  padding: 12px 20px;
  border-radius: var(--radius-pill);
  background: rgba(29, 29, 31, .94);
  backdrop-filter: blur(12px);
  color: #fff;
  font-size: var(--text-sm);
  text-align: center;
  opacity: 0;
  pointer-events: none;
  transition: opacity var(--motion-base) var(--ease), transform var(--motion-base) var(--ease);
}
.toast.is-show { opacity: 1; transform: translate(-50%, 0); }
@media (max-width: 767px) { .toast { bottom: calc(72px + env(safe-area-inset-bottom, 0px)); } }

/* --------------------------------------------------------------------------
   17. Misc
   -------------------------------------------------------------------------- */
.breadcrumb { display: flex; align-items: center; gap: 8px; font-size: var(--text-sm); color: var(--meta); margin-bottom: 18px; }
.breadcrumb a { color: var(--meta); }
.breadcrumb a:hover { color: var(--accent-active); text-decoration: none; }
.breadcrumb .sep { color: var(--border); }

.back-link {
  display: inline-flex; align-items: center; gap: 6px;
  min-height: 34px;
  margin-bottom: 14px;
  color: var(--muted);
  font-size: var(--text-sm);
}
.back-link:hover { color: var(--fg); text-decoration: none; }
.back-link svg { width: 16px; height: 16px; }

.divider { height: 1px; background: var(--border-soft); margin-block: 20px; }

.cover {
  aspect-ratio: 16 / 7;
  border-radius: var(--radius-lg);
  background: var(--surface-3);
  display: grid; place-items: center;
  color: var(--meta);
  font-size: var(--text-sm);
  overflow: hidden;
}

.attach {
  display: flex; align-items: center; gap: 12px;
  padding: 12px 14px;
  border: 1px solid var(--border-soft);
  border-radius: var(--radius-md);
  background: var(--surface-2);
}
.attach + .attach { margin-top: 8px; }
.attach svg { width: 18px; height: 18px; flex: none; color: var(--accent-active); }
.attach .grow { font-size: var(--text-sm); }

.prose { color: var(--fg-2); font-size: var(--text-md); line-height: 1.75; }
.prose p + p { margin-top: 16px; }
.prose h3 { margin-top: 28px; margin-bottom: 10px; font-size: var(--text-md); color: var(--fg); }
.prose ul { margin-top: 10px; display: flex; flex-direction: column; gap: 8px; }
.prose ul li { position: relative; padding-left: 18px; }
.prose ul li::before {
  content: ""; position: absolute; left: 2px; top: 11px;
  width: 5px; height: 5px; border-radius: 50%; background: var(--border);
}
.prose ol { margin-top: 10px; display: flex; flex-direction: column; gap: 8px; counter-reset: n; }
.prose ol li { position: relative; padding-left: 26px; counter-increment: n; }
.prose ol li::before {
  content: counter(n);
  position: absolute; left: 0; top: 3px;
  display: grid; place-items: center; width: 18px; height: 18px;
  border-radius: 50%; background: var(--surface-3); color: var(--fg-2);
  font-size: 11px; font-weight: 600;
}

/* 表格 */
.table-wrap { overflow-x: auto; border: 1px solid var(--border-soft); border-radius: var(--radius-lg); }
table.data { width: 100%; border-collapse: collapse; min-width: 640px; }
table.data th {
  padding: 12px 16px;
  text-align: left;
  font-size: var(--text-xs);
  font-weight: 600;
  color: var(--muted);
  background: var(--surface-2);
  border-bottom: 1px solid var(--border-soft);
  white-space: nowrap;
}
table.data td {
  padding: 14px 16px;
  border-bottom: 1px solid var(--border-soft);
  font-size: var(--text-sm);
  vertical-align: middle;
}
table.data tr:last-child td { border-bottom: 0; }
table.data tbody tr:hover { background: var(--surface-2); }

/* --------------------------------------------------------------------------
   18. 匿名树洞
   -------------------------------------------------------------------------- */
.tree-list { display: flex; flex-direction: column; gap: 14px; }

.tree-card {
  display: block;
  padding: 20px;
  border: 1px solid var(--border-soft);
  border-radius: var(--radius-lg);
  background: var(--bg);
  transition: border-color var(--motion-fast) var(--ease),
              box-shadow var(--motion-base) var(--ease),
              transform var(--motion-base) var(--ease);
}
.tree-card:hover { border-color: var(--border); box-shadow: var(--elev-card); transform: translateY(-2px); text-decoration: none; }
.tree-card.is-hidden { background: var(--surface-2); border-style: dashed; }
.tree-card h3 { text-decoration: none; }

/* 卡片主体是链接（可进详情），底部共鸣按钮独立可点，因此卡片本身不能是 <a> */
.tree-card-main { display: block; color: inherit; text-decoration: none; }
.tree-card-main:hover { text-decoration: none; }
.tree-card-main:focus-visible { outline: 2px solid var(--accent); outline-offset: 4px; border-radius: var(--radius-sm); }

.card.is-hidden { background: var(--surface-2); border-style: dashed; }

.tree-card-head { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
.tree-alias {
  display: inline-flex; align-items: center; gap: 6px;
  font-size: var(--text-xs);
  color: var(--meta);
}
.tree-alias .sep-dot { width: 3px; height: 3px; border-radius: 50%; background: var(--border); }

.tree-topic {
  display: inline-flex; align-items: center;
  height: 22px; padding: 0 9px;
  border-radius: 6px;
  background: var(--accent-soft);
  color: var(--accent-active);
  font-size: 11px; font-weight: 500;
  white-space: nowrap;
}
.tree-topic.is-help { background: var(--warn-soft); color: var(--warn); }

.tree-content {
  margin-top: 12px;
  font-size: var(--text-base);
  line-height: 1.7;
  color: var(--fg);
  white-space: pre-wrap;
  overflow-wrap: anywhere;
}
.tree-content.is-clamped {
  display: -webkit-box; -webkit-box-orient: vertical;
  -webkit-line-clamp: 3; overflow: hidden;
}

.tree-actions { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; margin-top: 16px; }

.react-btn {
  display: inline-flex; align-items: center; gap: 6px;
  height: 32px; padding: 0 12px;
  border: 1px solid var(--border);
  border-radius: var(--radius-pill);
  background: var(--bg);
  color: var(--fg-2);
  font-size: var(--text-xs);
  transition: background var(--motion-fast) var(--ease),
              border-color var(--motion-fast) var(--ease),
              color var(--motion-fast) var(--ease);
}
.react-btn:hover { border-color: var(--meta); background: var(--surface-2); }
.react-btn.is-on { border-color: rgba(0, 113, 227, .4); background: var(--accent-soft); color: var(--accent-active); font-weight: 600; }
.react-btn svg { width: 14px; height: 14px; }
.react-count { font-variant-numeric: tabular-nums; }

.tree-replies { display: flex; flex-direction: column; }
.tree-reply { padding: 16px 0; border-top: 1px solid var(--border-soft); }
.tree-reply:first-child { border-top: 0; padding-top: 4px; }

/* 导员官方回应：整块高亮，视觉上必须比同学回应更“重” */
.tree-reply.is-counselor {
  margin: 12px 0;
  padding: 16px 18px;
  border: 0;
  border-left: 3px solid var(--accent);
  border-radius: var(--radius-md);
  background: var(--accent-soft);
}
.tree-reply.is-hidden { opacity: .55; }

.tree-reply-head { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.tree-reply-body {
  margin-top: 8px;
  font-size: var(--text-base);
  line-height: 1.65;
  color: var(--fg-2);
  white-space: pre-wrap;
  overflow-wrap: anywhere;
}
.tree-reply.is-counselor .tree-reply-body { color: var(--fg); }

.badge-official {
  display: inline-flex; align-items: center; gap: 5px;
  height: 20px; padding: 0 8px;
  border-radius: 6px;
  background: var(--accent);
  color: #fff;
  font-size: 11px; font-weight: 600;
}
.badge-official svg { width: 12px; height: 12px; }
.badge-op {
  display: inline-flex; align-items: center;
  height: 20px; padding: 0 8px;
  border-radius: 6px;
  background: var(--ink);
  color: #fff;
  font-size: 11px;
}

/* 求助类内容的安全提示 */
.support-card {
  display: flex; gap: 14px; align-items: flex-start;
  padding: 16px 18px;
  border-radius: var(--radius-lg);
  background: var(--warn-soft);
  border: 1px solid rgba(180, 83, 9, .18);
}
.support-card svg { width: 20px; height: 20px; flex: none; color: var(--warn); margin-top: 2px; }
.support-card strong { display: block; font-size: var(--text-sm); font-weight: 600; color: var(--warn); }
.support-card p { margin-top: 5px; font-size: var(--text-sm); line-height: 1.65; color: var(--fg-2); }

.reply-composer { margin-top: 20px; }
.reply-composer .field + .board-actions { margin-top: 14px; }

/* --------------------------------------------------------------------------
   19. 动画偏好
   -------------------------------------------------------------------------- */
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    animation-duration: .001ms !important;
    transition-duration: .001ms !important;
  }
}

/* 打印 */
@media print {
  .topbar, .tabbar, .toast, .hero-actions { display: none !important; }
}
