/* ==========================================================================
   组件库：按钮、表单、卡片、表格、标签、模态框、抽屉、通知、骨架屏、分页…
   ========================================================================== */

/* --------------------------------------------------------------------------
   卡片 / 面板
   -------------------------------------------------------------------------- */
.card {
  position: relative;
  background: var(--bg-surface);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-sm);
  transition: box-shadow var(--dur-normal) var(--ease-out), border-color var(--dur-normal) var(--ease-out),
    transform var(--dur-normal) var(--ease-out);
}

.card--pad { padding: var(--space-6); }
.card--pad-sm { padding: var(--space-4); }
.card--glass {
  /* v5.2.2：玻璃效果改为不透明浮面（去掉 18px 背景模糊） */
  background: var(--bg-surface-raised);
}
.card--interactive { cursor: pointer; }
.card--interactive:hover {
  transform: translateY(-3px);
  box-shadow: var(--shadow-lg);
  border-color: color-mix(in srgb, var(--brand-400) 40%, var(--border-default));
}

.card__header {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: var(--space-3);
  padding: var(--space-5) var(--space-6);
  border-bottom: 1px solid var(--border-subtle);
}

.card__title {
  display: flex;
  align-items: center;
  gap: var(--space-3);
  font-size: var(--text-lg);
  font-weight: 640;
}

.card__title-icon {
  display: grid;
  place-items: center;
  width: 32px;
  height: 32px;
  border-radius: var(--radius-sm);
  background: var(--bg-active);
  color: var(--brand-500);
}

.card__subtitle {
  margin-top: 2px;
  font-size: var(--text-sm);
  color: var(--text-tertiary);
  font-weight: 400;
}

.card__body { padding: var(--space-6); }
.card__footer {
  padding: var(--space-4) var(--space-6);
  border-top: 1px solid var(--border-subtle);
  background: var(--bg-muted);
  border-radius: 0 0 var(--radius-lg) var(--radius-lg);
}

.panel-grid {
  display: grid;
  gap: var(--space-5);
}

/* 高亮描边：用于「执行中/需注意」状态 */
.card--highlight {
  border-color: color-mix(in srgb, var(--brand-400) 45%, var(--border-default));
  box-shadow: var(--shadow-md);
}

/* --------------------------------------------------------------------------
   按钮
   -------------------------------------------------------------------------- */
.btn {
  position: relative;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: var(--space-2);
  padding: 9px var(--space-4);
  min-height: 38px;
  border-radius: var(--radius-sm);
  border: 1px solid transparent;
  font-size: var(--text-base);
  font-weight: 560;
  white-space: nowrap;
  cursor: pointer;
  overflow: hidden;
  isolation: isolate;
  transition: background var(--dur-fast) var(--ease-out), color var(--dur-fast) var(--ease-out),
    border-color var(--dur-fast) var(--ease-out), box-shadow var(--dur-normal) var(--ease-out),
    transform var(--dur-fast) var(--ease-spring);
}

.btn:active:not(:disabled) { transform: scale(0.97); }

.btn:disabled,
.btn.is-loading {
  cursor: not-allowed;
  opacity: 0.62;
}

.btn--primary {
  background: var(--fill-brand);
  color: var(--text-on-brand);
  box-shadow: var(--shadow-brand);
}

.btn--primary:hover:not(:disabled) {
  background: var(--fill-brand-strong);
  box-shadow: 0 14px 34px rgba(99, 102, 241, 0.36);
}

.btn--secondary {
  background: var(--bg-surface);
  border-color: var(--border-default);
  color: var(--text-primary);
  box-shadow: var(--shadow-xs);
}

.btn--secondary:hover:not(:disabled) {
  background: var(--bg-hover);
  border-color: var(--border-strong);
}

.btn--ghost {
  background: transparent;
  color: var(--text-secondary);
}

.btn--ghost:hover:not(:disabled) {
  background: var(--bg-hover);
  color: var(--text-primary);
}

.btn--danger {
  background: var(--danger);
  color: #fff;
  box-shadow: 0 10px 26px rgba(239, 68, 68, 0.3);
}

.btn--danger:hover:not(:disabled) { filter: brightness(1.06); }

.btn--soft-danger {
  background: var(--danger-soft);
  color: var(--danger);
}

.btn--soft-danger:hover:not(:disabled) { background: color-mix(in srgb, var(--danger) 20%, transparent); }

.btn--soft-success { background: var(--success-soft); color: var(--success); }
.btn--soft-success:hover:not(:disabled) { background: color-mix(in srgb, var(--success) 22%, transparent); }

.btn--sm { min-height: 32px; padding: 6px var(--space-3); font-size: var(--text-sm); }
.btn--lg { min-height: 46px; padding: 12px var(--space-6); font-size: var(--text-md); }
.btn--block { width: 100%; }
.btn--icon { padding: 0; width: 38px; min-height: 38px; }
.btn--icon.btn--sm { width: 32px; min-height: 32px; }

/* 波纹反馈 */
.btn__ripple {
  position: absolute;
  border-radius: 50%;
  transform: scale(0);
  background: rgba(255, 255, 255, 0.45);
  pointer-events: none;
  animation: ripple-expand 620ms var(--ease-out) forwards;
  z-index: -1;
}

.btn--secondary .btn__ripple,
.btn--ghost .btn__ripple,
.btn--soft-danger .btn__ripple { background: rgba(99, 102, 241, 0.18); }

@keyframes ripple-expand {
  to { transform: scale(2.6); opacity: 0; }
}

/* 按钮内的加载指示 */
.btn__spinner {
  width: 15px;
  height: 15px;
  border-radius: 50%;
  border: 2px solid currentColor;
  border-top-color: transparent;
  animation: spinner-rotate 700ms linear infinite;
}

/* --------------------------------------------------------------------------
   表单
   -------------------------------------------------------------------------- */
.field { display: flex; flex-direction: column; gap: var(--space-2); }

.field__label {
  display: flex;
  align-items: center;
  gap: var(--space-2);
  font-size: var(--text-sm);
  font-weight: 560;
  color: var(--text-secondary);
}

.field__label .required { color: var(--danger); }

.field__hint { font-size: var(--text-xs); color: var(--text-tertiary); }

.field__error {
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: var(--text-xs);
  color: var(--danger);
  animation: rise-in var(--dur-fast) var(--ease-out) both;
}

.input,
.select,
.textarea {
  width: 100%;
  padding: 10px var(--space-3);
  min-height: 40px;
  background: var(--bg-surface);
  border: 1px solid var(--border-default);
  border-radius: var(--radius-sm);
  color: var(--text-primary);
  font-size: var(--text-base);
  transition: border-color var(--dur-fast) var(--ease-out), box-shadow var(--dur-fast) var(--ease-out),
    background var(--dur-fast) var(--ease-out);
}

.input::placeholder,
.textarea::placeholder { color: var(--text-tertiary); }

.input:hover:not(:disabled),
.select:hover:not(:disabled),
.textarea:hover:not(:disabled) { border-color: var(--border-strong); }

.input:focus,
.select:focus,
.textarea:focus {
  outline: none;
  border-color: var(--brand-400);
  box-shadow: 0 0 0 4px color-mix(in srgb, var(--brand-400) 18%, transparent);
}

.input:disabled,
.select:disabled,
.textarea:disabled {
  background: var(--bg-muted);
  color: var(--text-tertiary);
  cursor: not-allowed;
}

.textarea { min-height: 96px; resize: vertical; line-height: 1.6; }

.select {
  appearance: none;
  padding-right: var(--space-8);
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='16' height='16' viewBox='0 0 24 24' fill='none' stroke='%238593ad' stroke-width='2.4' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='m6 9 6 6 6-6'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right var(--space-3) center;
}

.select[multiple] {
  min-height: 168px;
  padding: var(--space-2);
  background-image: none;
}

.select[multiple] option {
  padding: 6px var(--space-2);
  border-radius: var(--radius-xs);
}

.field.is-invalid .input,
.field.is-invalid .select,
.field.is-invalid .textarea {
  border-color: var(--danger);
  box-shadow: 0 0 0 4px var(--danger-soft);
}

/* 带前后缀的输入框 */
.input-group { position: relative; display: flex; align-items: center; }
.input-group__icon {
  position: absolute;
  left: var(--space-3);
  display: grid;
  place-items: center;
  color: var(--text-tertiary);
  pointer-events: none;
}
.input-group .input { padding-left: 40px; }
.input-group__action {
  position: absolute;
  right: var(--space-2);
}
.input-group__action .icon-button { width: 30px; height: 30px; }

/* 复选框 / 单选 */
.checkbox,
.radio {
  display: inline-flex;
  align-items: center;
  gap: var(--space-2);
  cursor: pointer;
  font-size: var(--text-base);
  user-select: none;
}

.checkbox input,
.radio input {
  appearance: none;
  width: 18px;
  height: 18px;
  flex-shrink: 0;
  border: 1.6px solid var(--border-strong);
  border-radius: var(--radius-xs);
  background: var(--bg-surface);
  transition: background var(--dur-fast) var(--ease-out), border-color var(--dur-fast) var(--ease-out),
    transform var(--dur-fast) var(--ease-spring);
  cursor: pointer;
}

.radio input { border-radius: 50%; }

.checkbox input:checked,
.radio input:checked {
  background: var(--brand-500);
  border-color: var(--brand-500);
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='14' height='14' viewBox='0 0 24 24' fill='none' stroke='white' stroke-width='3.4' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M20 6 9 17l-5-5'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: center;
}

.radio input:checked {
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='10' height='10' viewBox='0 0 24 24' fill='white'%3E%3Ccircle cx='12' cy='12' r='8'/%3E%3C/svg%3E");
}

.checkbox input:active,
.radio input:active { transform: scale(0.9); }

/* 开关 */
.switch {
  position: relative;
  display: inline-flex;
  align-items: center;
  gap: var(--space-3);
  cursor: pointer;
}

.switch input {
  appearance: none;
  position: relative;
  width: 46px;
  height: 26px;
  border-radius: var(--radius-full);
  background: var(--border-default);
  cursor: pointer;
  transition: background var(--dur-normal) var(--ease-out);
  flex-shrink: 0;
}

.switch input::after {
  content: '';
  position: absolute;
  top: 3px;
  left: 3px;
  width: 20px;
  height: 20px;
  border-radius: 50%;
  background: #fff;
  box-shadow: var(--shadow-sm);
  transition: transform var(--dur-normal) var(--ease-spring);
}

.switch input:checked { background: var(--fill-brand); }
.switch input:checked::after { transform: translateX(20px); }
.switch input:disabled { opacity: 0.5; cursor: not-allowed; }

.switch__state { font-size: var(--text-sm); font-weight: 560; }

/* 搜索框 */
.search-box { position: relative; min-width: 200px; }
.search-box .input { padding-left: 38px; padding-right: 38px; }
.search-box__icon {
  position: absolute;
  left: var(--space-3);
  top: 50%;
  transform: translateY(-50%);
  color: var(--text-tertiary);
  pointer-events: none;
}
.search-box__clear {
  position: absolute;
  right: var(--space-2);
  top: 50%;
  transform: translateY(-50%);
  display: grid;
  place-items: center;
  width: 22px;
  height: 22px;
  border-radius: 50%;
  color: var(--text-tertiary);
  transition: background var(--dur-fast) var(--ease-out);
}
.search-box__clear:hover { background: var(--bg-hover); color: var(--text-primary); }

/* 表单布局 */
.form-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
  gap: var(--space-4) var(--space-5);
}

.form-grid--full { grid-column: 1 / -1; }

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

.form-section-title {
  display: flex;
  align-items: center;
  gap: var(--space-2);
  grid-column: 1 / -1;
  margin-top: var(--space-2);
  padding-bottom: var(--space-2);
  border-bottom: 1px dashed var(--border-subtle);
  font-size: var(--text-md);
  font-weight: 620;
  color: var(--text-primary);
}

/* 设置项行（左说明 + 右控件） */
.setting-row {
  display: flex;
  flex-wrap: wrap;
  align-items: flex-start;
  justify-content: space-between;
  gap: var(--space-4);
  padding: var(--space-5) 0;
  border-bottom: 1px solid var(--border-subtle);
}

.setting-row:last-child { border-bottom: none; }

.setting-row__info { flex: 1 1 260px; min-width: 0; }
.setting-row__title { font-size: var(--text-md); font-weight: 600; }
.setting-row__desc { margin-top: 2px; font-size: var(--text-sm); color: var(--text-tertiary); }
.setting-row__control { flex: 0 1 420px; display: flex; align-items: center; gap: var(--space-3); justify-content: flex-end; }
.setting-row__control .input,
.setting-row__control .select { max-width: 340px; }

@media (max-width: 620px) {
  .setting-row__control { justify-content: flex-start; flex-basis: 100%; }
  .setting-row__control .input,
  .setting-row__control .select { max-width: none; }
}

/* --------------------------------------------------------------------------
   表格
   -------------------------------------------------------------------------- */
.table-wrap {
  width: 100%;
  overflow-x: auto;
  border-radius: var(--radius-md);
  border: 1px solid var(--border-subtle);
  background: var(--bg-surface);
}

.table {
  width: 100%;
  border-collapse: separate;
  border-spacing: 0;
  font-size: var(--text-base);
}

.table thead th {
  position: sticky;
  top: 0;
  z-index: 1;
  padding: var(--space-3) var(--space-4);
  background: var(--bg-muted);
  border-bottom: 1px solid var(--border-subtle);
  color: var(--text-secondary);
  font-size: var(--text-xs);
  font-weight: 650;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  text-align: left;
  white-space: nowrap;
}

.table tbody td {
  padding: var(--space-3) var(--space-4);
  border-bottom: 1px solid var(--border-subtle);
  vertical-align: middle;
}

.table tbody tr {
  transition: background var(--dur-fast) var(--ease-out);
}

.table tbody tr:hover { background: var(--bg-hover); }
.table tbody tr:last-child td { border-bottom: none; }
.table tbody tr.is-selected { background: var(--bg-active); }

.table--compact tbody td,
.table--compact thead th { padding: var(--space-2) var(--space-3); }

.table__cell-actions {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: var(--space-1);
}

.table__empty { padding: var(--space-12) var(--space-6); text-align: center; color: var(--text-tertiary); }

.table__number { font-variant-numeric: tabular-nums; font-weight: 600; }
.table__desc { max-width: 320px; color: var(--text-secondary); }

/* 行内操作按钮 */
.row-action {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  padding: 5px 9px;
  border-radius: var(--radius-xs);
  color: var(--text-secondary);
  font-size: var(--text-sm);
  font-weight: 540;
  transition: background var(--dur-fast) var(--ease-out), color var(--dur-fast) var(--ease-out);
}

.row-action:hover { background: var(--bg-hover); color: var(--text-primary); }
.row-action--danger { color: var(--danger); }
.row-action--danger:hover { background: var(--danger-soft); color: var(--danger); }
.row-action--warn { color: var(--warning); }
.row-action--brand { color: var(--brand-500); }

/* v4.8：行内操作改为纯图标按钮（只有 icon，没有文字）时的方形内边距与可见焦点 */
.row-action--icon { padding: 6px; }
.row-action--icon:focus-visible {
  outline: 2px solid var(--brand-500);
  outline-offset: 2px;
  border-radius: var(--radius-xs);
}

/* --------------------------------------------------------------------------
   标签 / 徽章
   -------------------------------------------------------------------------- */
.badge {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  padding: 3px 9px;
  border-radius: var(--radius-full);
  font-size: var(--text-xs);
  font-weight: 620;
  line-height: 1.5;
  white-space: nowrap;
}

.badge--neutral { background: var(--bg-muted); color: var(--text-secondary); }
.badge--brand { background: var(--bg-active); color: var(--brand-500); }
.badge--success { background: var(--success-soft); color: var(--success); }
.badge--warning { background: var(--warning-soft); color: var(--warning); }
.badge--danger { background: var(--danger-soft); color: var(--danger); }
.badge--info { background: var(--info-soft); color: var(--info); }
.badge--violet { background: rgba(139, 92, 246, 0.14); color: var(--accent-violet); }

.badge__dot {
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: currentColor;
}

.badge--pulse .badge__dot { animation: pulse-soft 1.8s var(--ease-in-out) infinite; }

/* 分数徽标（正负） */
.score-pill {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 54px;
  padding: 3px 10px;
  border-radius: var(--radius-full);
  font-variant-numeric: tabular-nums;
  font-weight: 700;
  font-size: var(--text-sm);
}

.score-pill--add { background: var(--success-soft); color: var(--success); }
.score-pill--deduct { background: var(--danger-soft); color: var(--danger); }
.score-pill--neutral { background: var(--bg-muted); color: var(--text-secondary); }

/* 头像 */
.avatar {
  display: grid;
  place-items: center;
  width: 36px;
  height: 36px;
  flex-shrink: 0;
  border-radius: var(--radius-full);
  background: var(--fill-brand);
  color: #fff;
  font-size: var(--text-sm);
  font-weight: 680;
  letter-spacing: 0.02em;
  box-shadow: var(--shadow-xs);
}

.avatar--sm { width: 28px; height: 28px; font-size: var(--text-xs); }
.avatar--lg { width: 52px; height: 52px; font-size: var(--text-lg); }

/* 成员标签 */
.chip {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 4px 10px;
  border-radius: var(--radius-full);
  background: var(--bg-muted);
  border: 1px solid var(--border-subtle);
  font-size: var(--text-sm);
  transition: background var(--dur-fast) var(--ease-out), transform var(--dur-fast) var(--ease-spring);
}

.chip:hover { background: var(--bg-hover); transform: translateY(-1px); }
.chip--brand { background: var(--bg-active); color: var(--brand-500); border-color: transparent; }
.chip__remove { display: grid; place-items: center; width: 15px; height: 15px; border-radius: 50%; color: inherit; opacity: 0.6; }
.chip__remove:hover { opacity: 1; background: rgba(0, 0, 0, 0.08); }

/* --------------------------------------------------------------------------
   统计卡片
   -------------------------------------------------------------------------- */
.stat-card {
  position: relative;
  display: flex;
  flex-direction: column;
  gap: var(--space-3);
  padding: var(--space-5);
  background: var(--bg-surface);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-sm);
  overflow: hidden;
  transition: transform var(--dur-normal) var(--ease-out), box-shadow var(--dur-normal) var(--ease-out);
}

.stat-card::after {
  content: '';
  position: absolute;
  inset: auto -30% -60% auto;
  width: 160px;
  height: 160px;
  border-radius: 50%;
  background: radial-gradient(circle, var(--stat-glow, rgba(99, 102, 241, 0.18)), transparent 70%);
  opacity: 0;
  transition: opacity var(--dur-slow) var(--ease-out), transform var(--dur-slow) var(--ease-out);
  transform: scale(0.6);
}

.stat-card:hover {
  transform: translateY(-4px);
  box-shadow: var(--shadow-lg);
}

.stat-card:hover::after { opacity: 1; transform: scale(1); }

.stat-card__head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--space-3);
}

.stat-card__icon {
  display: grid;
  place-items: center;
  width: 42px;
  height: 42px;
  border-radius: var(--radius-md);
  background: var(--stat-icon-bg, var(--bg-active));
  color: var(--stat-icon-color, var(--brand-500));
}

.stat-card__label { font-size: var(--text-sm); color: var(--text-secondary); font-weight: 540; }

.stat-card__value {
  display: flex;
  align-items: baseline;
  gap: var(--space-2);
  font-size: var(--text-3xl);
  font-weight: 720;
  letter-spacing: -0.03em;
  font-variant-numeric: tabular-nums;
  line-height: 1.1;
}

.stat-card__unit { font-size: var(--text-base); font-weight: 500; color: var(--text-tertiary); }

.stat-card__foot {
  display: flex;
  align-items: center;
  gap: var(--space-2);
  font-size: var(--text-xs);
  color: var(--text-tertiary);
}

.trend-up { color: var(--success); font-weight: 620; }
.trend-down { color: var(--danger); font-weight: 620; }

/* 迷你进度条 */
.meter {
  height: 6px;
  border-radius: var(--radius-full);
  background: var(--bg-muted);
  overflow: hidden;
}

.meter__fill {
  height: 100%;
  border-radius: inherit;
  background: var(--fill-brand);
  transform-origin: left center;
  animation: progress-bar var(--dur-slower) var(--ease-out) both;
}

/* --------------------------------------------------------------------------
   空状态
   -------------------------------------------------------------------------- */
.empty-state {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: var(--space-3);
  padding: var(--space-12) var(--space-6);
  text-align: center;
  color: var(--text-tertiary);
  animation: rise-in var(--dur-slow) var(--ease-out) both;
}

.empty-state__icon {
  display: grid;
  place-items: center;
  width: 76px;
  height: 76px;
  border-radius: var(--radius-xl);
  background: var(--bg-muted);
  color: var(--text-tertiary);
  animation: float-soft 4.5s var(--ease-in-out) infinite;
}

.empty-state__title { font-size: var(--text-md); font-weight: 600; color: var(--text-secondary); }
.empty-state__desc { font-size: var(--text-sm); max-width: 420px; }

/* --------------------------------------------------------------------------
   骨架屏
   -------------------------------------------------------------------------- */
.skeleton {
  position: relative;
  overflow: hidden;
  border-radius: var(--radius-sm);
  background: var(--skeleton-base);
}

.skeleton::after {
  content: '';
  position: absolute;
  inset: 0;
  background: linear-gradient(90deg, transparent, var(--skeleton-shine), transparent);
  animation: shimmer 1.4s infinite linear;
}

.skeleton--text { height: 13px; margin-bottom: 8px; }
.skeleton--title { height: 22px; width: 40%; margin-bottom: 14px; }
.skeleton--card { height: 108px; border-radius: var(--radius-lg); }
.skeleton--row { height: 44px; margin-bottom: 8px; }
.skeleton--circle { border-radius: 50%; }

.skeleton-lines { display: flex; flex-direction: column; gap: 8px; }
.skeleton-lines .skeleton:nth-child(2) { width: 88%; }
.skeleton-lines .skeleton:nth-child(3) { width: 72%; }

/* --------------------------------------------------------------------------
   加载指示器
   -------------------------------------------------------------------------- */
.spinner {
  width: 20px;
  height: 20px;
  border-radius: 50%;
  border: 2.4px solid color-mix(in srgb, var(--brand-400) 30%, transparent);
  border-top-color: var(--brand-500);
  animation: spinner-rotate 700ms linear infinite;
}

.spinner--sm { width: 14px; height: 14px; border-width: 2px; }
.spinner--lg { width: 34px; height: 34px; border-width: 3px; }

/* 顶部进度条（路由/请求进行中） */
.top-progress {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  height: 3px;
  z-index: calc(var(--z-toast) + 1);
  background: transparent;
  pointer-events: none;
  opacity: 0;
  transition: opacity var(--dur-fast) var(--ease-out);
}

.top-progress.is-active { opacity: 1; }

.top-progress__bar {
  height: 100%;
  width: 40%;
  background: var(--fill-brand);
  border-radius: 0 var(--radius-full) var(--radius-full) 0;
  animation: top-progress-run 1.15s var(--ease-in-out) infinite;
}

@keyframes top-progress-run {
  0% { transform: translateX(-100%) scaleX(0.4); }
  50% { transform: translateX(60%) scaleX(0.9); }
  100% { transform: translateX(260%) scaleX(0.4); }
}

/* 局部加载遮罩 */
.loading-overlay {
  position: absolute;
  inset: 0;
  display: grid;
  place-items: center;
  gap: var(--space-3);
  background: color-mix(in srgb, var(--bg-surface) 72%, transparent);
  border-radius: inherit;
  z-index: 5;
  animation: fade-in var(--dur-fast) var(--ease-out) both;
}

.is-loading-host { position: relative; }

/* --------------------------------------------------------------------------
   模态框 / 抽屉
   -------------------------------------------------------------------------- */
.overlay {
  position: fixed;
  inset: 0;
  z-index: var(--z-modal);
  display: grid;
  place-items: center;
  padding: var(--space-4);
  background: rgba(2, 6, 23, 0.52);
  animation: fade-in var(--dur-normal) var(--ease-out) both;
}

.overlay.is-closing { animation: fade-out var(--dur-fast) var(--ease-out) both; }

.modal {
  position: relative;
  width: 100%;
  max-width: 560px;
  max-height: calc(100vh - var(--space-8));
  display: flex;
  flex-direction: column;
  background: var(--bg-surface-raised);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-xl);
  animation: modal-in var(--dur-slow) var(--ease-spring) both;
  overflow: hidden;
}

.overlay.is-closing .modal { animation: modal-out var(--dur-fast) var(--ease-out) both; }

.modal--sm { max-width: 420px; }
.modal--lg { max-width: 760px; }
.modal--xl { max-width: 1040px; }

.modal__header {
  display: flex;
  align-items: flex-start;
  gap: var(--space-3);
  padding: var(--space-5) var(--space-6);
  border-bottom: 1px solid var(--border-subtle);
}

.modal__icon {
  display: grid;
  place-items: center;
  width: 40px;
  height: 40px;
  flex-shrink: 0;
  border-radius: var(--radius-md);
  background: var(--bg-active);
  color: var(--brand-500);
}

.modal__icon--danger { background: var(--danger-soft); color: var(--danger); }
.modal__icon--warning { background: var(--warning-soft); color: var(--warning); }
.modal__icon--success { background: var(--success-soft); color: var(--success); }

.modal__title { font-size: var(--text-lg); font-weight: 660; }
.modal__subtitle { font-size: var(--text-sm); color: var(--text-tertiary); margin-top: 2px; }
.modal__close { margin-left: auto; }

.modal__body {
  padding: var(--space-6);
  overflow-y: auto;
  flex: 1;
}

.modal__footer {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: flex-end;
  gap: var(--space-3);
  padding: var(--space-4) var(--space-6);
  border-top: 1px solid var(--border-subtle);
  background: var(--bg-muted);
}

.modal__footer--split { justify-content: space-between; }

/* 抽屉 */
.drawer {
  position: fixed;
  inset: 0 0 0 auto;
  z-index: var(--z-drawer);
  width: min(520px, 100%);
  display: flex;
  flex-direction: column;
  background: var(--bg-surface-raised);
  border-left: 1px solid var(--border-subtle);
  box-shadow: var(--shadow-xl);
  animation: slide-in-right var(--dur-slow) var(--ease-emphasized) both;
}

.overlay--drawer {
  place-items: stretch;
  padding: 0;
  background: rgba(2, 6, 23, 0.42);
}

.overlay--drawer.is-closing .drawer { animation: slide-out-right var(--dur-fast) var(--ease-out) both; }

/* --------------------------------------------------------------------------
   通知 Toast
   -------------------------------------------------------------------------- */
.toast-stack {
  position: fixed;
  top: var(--space-5);
  right: var(--space-5);
  z-index: var(--z-toast);
  display: flex;
  flex-direction: column;
  gap: var(--space-3);
  width: min(400px, calc(100vw - var(--space-8)));
  pointer-events: none;
}

.toast {
  position: relative;
  display: flex;
  align-items: flex-start;
  gap: var(--space-3);
  padding: var(--space-4);
  border-radius: var(--radius-md);
  background: var(--bg-glass-strong);
  border: 1px solid var(--border-default);
  box-shadow: var(--shadow-lg);
  /* v5.2.2：不透明面，去掉背景模糊 */
  pointer-events: auto;
  overflow: hidden;
  animation: bounce-in-up var(--dur-slow) var(--ease-spring) both;
}

.toast.is-leaving { animation: slide-out-right var(--dur-normal) var(--ease-out) both; }

.toast__icon {
  display: grid;
  place-items: center;
  width: 30px;
  height: 30px;
  flex-shrink: 0;
  border-radius: var(--radius-sm);
}

.toast--success .toast__icon { background: var(--success-soft); color: var(--success); }
.toast--error .toast__icon { background: var(--danger-soft); color: var(--danger); }
.toast--warning .toast__icon { background: var(--warning-soft); color: var(--warning); }
.toast--info .toast__icon { background: var(--info-soft); color: var(--info); }

.toast__content { flex: 1; min-width: 0; }
.toast__title { font-size: var(--text-base); font-weight: 620; }
.toast__message { font-size: var(--text-sm); color: var(--text-secondary); margin-top: 2px; overflow-wrap: anywhere; }
.toast__detail {
  margin-top: var(--space-2);
  padding: var(--space-2) var(--space-3);
  border-radius: var(--radius-xs);
  background: var(--bg-muted);
  font-family: var(--font-mono);
  font-size: var(--text-xs);
  color: var(--text-tertiary);
  max-height: 120px;
  overflow: auto;
  white-space: pre-wrap;
}
.toast__close { flex-shrink: 0; color: var(--text-tertiary); }
.toast__close:hover { color: var(--text-primary); }

/* 底部时间进度条 */
.toast__timer {
  position: absolute;
  left: 0;
  bottom: 0;
  height: 2.5px;
  width: 100%;
  background: currentColor;
  opacity: 0.5;
  transform-origin: left center;
  animation: progress-bar linear forwards;
}

.toast--success .toast__timer { color: var(--success); }
.toast--error .toast__timer { color: var(--danger); }
.toast--warning .toast__timer { color: var(--warning); }
.toast--info .toast__timer { color: var(--info); }

@media (max-width: 620px) {
  .toast-stack { left: var(--space-3); right: var(--space-3); top: var(--space-3); width: auto; }
}

/* --------------------------------------------------------------------------
   分页
   -------------------------------------------------------------------------- */
.pagination {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: var(--space-3);
  padding: var(--space-4) 0 0;
}

.pagination__info { font-size: var(--text-sm); color: var(--text-tertiary); }
.pagination__list { display: flex; align-items: center; gap: var(--space-1); }

.page-btn {
  display: grid;
  place-items: center;
  min-width: 34px;
  height: 34px;
  padding: 0 var(--space-2);
  border-radius: var(--radius-sm);
  border: 1px solid transparent;
  color: var(--text-secondary);
  font-size: var(--text-sm);
  font-weight: 560;
  font-variant-numeric: tabular-nums;
  transition: background var(--dur-fast) var(--ease-out), color var(--dur-fast) var(--ease-out),
    border-color var(--dur-fast) var(--ease-out);
}

.page-btn:hover:not(:disabled):not(.is-active) { background: var(--bg-hover); color: var(--text-primary); }

.page-btn.is-active {
  background: var(--fill-brand);
  color: #fff;
  border-color: transparent;
  box-shadow: var(--shadow-brand);
}

.page-btn:disabled { opacity: 0.4; cursor: not-allowed; }
.pagination__ellipsis { color: var(--text-tertiary); padding: 0 var(--space-1); }

/* --------------------------------------------------------------------------
   标签页
   -------------------------------------------------------------------------- */
.tabs {
  position: relative;
  display: flex;
  gap: var(--space-1);
  padding: var(--space-1);
  border-radius: var(--radius-md);
  background: var(--bg-muted);
  overflow-x: auto;
}

.tab {
  position: relative;
  z-index: 1;
  display: inline-flex;
  align-items: center;
  gap: var(--space-2);
  padding: 8px var(--space-4);
  border-radius: var(--radius-sm);
  color: var(--text-secondary);
  font-size: var(--text-base);
  font-weight: 560;
  white-space: nowrap;
  transition: color var(--dur-fast) var(--ease-out), background var(--dur-normal) var(--ease-out);
}

.tab:hover { color: var(--text-primary); }

.tab.is-active {
  background: var(--bg-surface);
  color: var(--brand-500);
  box-shadow: var(--shadow-xs);
}

.tab__count {
  padding: 0 6px;
  border-radius: var(--radius-full);
  background: var(--bg-active);
  font-size: 11px;
  font-weight: 700;
}

.tabs--underline {
  background: transparent;
  padding: 0;
  border-bottom: 1px solid var(--border-subtle);
  border-radius: 0;
  gap: var(--space-5);
}

.tabs--underline .tab {
  border-radius: 0;
  padding: 10px 0;
  background: transparent;
  box-shadow: none;
}

.tabs--underline .tab.is-active { background: transparent; }
.tabs--underline .tab.is-active::after {
  content: '';
  position: absolute;
  left: 0;
  right: 0;
  bottom: -1px;
  height: 2px;
  border-radius: var(--radius-full);
  background: var(--fill-brand);
  animation: progress-bar var(--dur-normal) var(--ease-out) both;
  transform-origin: left center;
}

/* --------------------------------------------------------------------------
   v5.2.2-alpha.2：标签页**不再有滑动指示器**
   用户反馈「页面卡死 / 吃显存」后要求把 tab 的滑动动画删掉排查，
   于是回到最朴素的实现：选中态由 .tab.is-active 自己画底色（.tabs--underline 用下划线），
   没有额外节点、没有观察器、没有过渡。
   （`bindTabGlider()` 仍保留在 core/ui.js；若以后要恢复滑动，请把 .tab.is-active 的底色改回透明
     并补回 .tabs__glider 样式。）
   -------------------------------------------------------------------------- */

/* --------------------------------------------------------------------------
   下拉菜单
   -------------------------------------------------------------------------- */
.dropdown { position: relative; }

.dropdown__menu {
  position: absolute;
  top: calc(100% + 6px);
  right: 0;
  z-index: var(--z-drawer);
  min-width: 190px;
  padding: var(--space-2);
  border-radius: var(--radius-md);
  background: var(--bg-surface-raised);
  border: 1px solid var(--border-subtle);
  box-shadow: var(--shadow-lg);
  animation: rise-in var(--dur-fast) var(--ease-out) both;
}

.dropdown__item {
  display: flex;
  align-items: center;
  gap: var(--space-3);
  width: 100%;
  padding: 9px var(--space-3);
  border-radius: var(--radius-sm);
  color: var(--text-secondary);
  font-size: var(--text-base);
  text-align: left;
  transition: background var(--dur-fast) var(--ease-out), color var(--dur-fast) var(--ease-out);
}

.dropdown__item:hover { background: var(--bg-hover); color: var(--text-primary); }
.dropdown__item--danger { color: var(--danger); }
.dropdown__item--danger:hover { background: var(--danger-soft); color: var(--danger); }
.dropdown__divider { height: 1px; margin: var(--space-2) 0; background: var(--border-subtle); }
.dropdown__header {
  padding: var(--space-2) var(--space-3);
  font-size: var(--text-xs);
  color: var(--text-tertiary);
}

/* --------------------------------------------------------------------------
   提示气泡
   -------------------------------------------------------------------------- */
.tooltip-host { position: relative; }

.tooltip {
  position: absolute;
  z-index: var(--z-tooltip);
  padding: 6px 10px;
  border-radius: var(--radius-xs);
  background: var(--bg-inverse);
  color: var(--bg-app);
  font-size: var(--text-xs);
  font-weight: 540;
  white-space: nowrap;
  box-shadow: var(--shadow-md);
  pointer-events: none;
  animation: fade-in var(--dur-fast) var(--ease-out) both;
}

/* --------------------------------------------------------------------------
   时间线
   -------------------------------------------------------------------------- */
.timeline { position: relative; padding-left: var(--space-6); }

.timeline::before {
  content: '';
  position: absolute;
  left: 9px;
  top: 6px;
  bottom: 6px;
  width: 2px;
  border-radius: var(--radius-full);
  background: var(--border-subtle);
}

.timeline__item {
  position: relative;
  padding-bottom: var(--space-5);
  animation: rise-in var(--dur-slow) var(--ease-out) both;
  animation-delay: calc(var(--i, 0) * 40ms);
}

.timeline__item:last-child { padding-bottom: 0; }

.timeline__dot {
  position: absolute;
  left: calc(-1 * var(--space-6) + 3px);
  top: 4px;
  width: 14px;
  height: 14px;
  border-radius: 50%;
  border: 2.5px solid var(--bg-surface);
  background: var(--brand-500);
  box-shadow: 0 0 0 2px color-mix(in srgb, var(--brand-500) 28%, transparent);
}

.timeline__dot--add { background: var(--success); box-shadow: 0 0 0 2px var(--success-soft); }
.timeline__dot--deduct { background: var(--danger); box-shadow: 0 0 0 2px var(--danger-soft); }
.timeline__dot--violation { background: var(--warning); box-shadow: 0 0 0 2px var(--warning-soft); }

.timeline__head {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: var(--space-2);
  margin-bottom: var(--space-1);
}

.timeline__time { font-size: var(--text-xs); color: var(--text-tertiary); }
.timeline__title { font-weight: 600; }

/* --------------------------------------------------------------------------
   进度环 / 图表
   -------------------------------------------------------------------------- */
.chart {
  width: 100%;
  overflow: visible;
}

.chart__grid line { stroke: var(--border-subtle); stroke-width: 1; }
.chart__axis-text { fill: var(--text-tertiary); font-size: 11px; }

.chart__line {
  fill: none;
  stroke-width: 2.5;
  stroke-linecap: round;
  stroke-linejoin: round;
  animation: draw-line 1.1s var(--ease-out) both;
}

.chart__area { animation: fade-in var(--dur-slower) var(--ease-out) both; }
.chart__bar {
  transform-origin: bottom center;
  animation: grow-bar var(--dur-slower) var(--ease-spring) both;
  animation-delay: calc(var(--i, 0) * 45ms);
  transform-box: fill-box;
}

.bar-row {
  display: grid;
  grid-template-columns: minmax(72px, 130px) 1fr auto;
  align-items: center;
  gap: var(--space-3);
  padding: var(--space-2) 0;
}

.bar-row__label { font-size: var(--text-sm); color: var(--text-secondary); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.bar-row__value { font-size: var(--text-sm); font-weight: 620; font-variant-numeric: tabular-nums; }

.bar-track {
  position: relative;
  height: 9px;
  border-radius: var(--radius-full);
  background: var(--bg-muted);
  overflow: hidden;
}

.bar-fill {
  position: absolute;
  inset: 0 auto 0 0;
  border-radius: inherit;
  background: var(--bar-from, var(--fill-brand));
  transform-origin: left center;
  animation: progress-bar 900ms var(--ease-out) both;
}

/* --------------------------------------------------------------------------
   文件拖放上传
   -------------------------------------------------------------------------- */
.dropzone {
  position: relative;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: var(--space-3);
  padding: var(--space-10) var(--space-6);
  border: 2px dashed var(--border-default);
  border-radius: var(--radius-lg);
  background: var(--bg-muted);
  text-align: center;
  cursor: pointer;
  transition: border-color var(--dur-normal) var(--ease-out), background var(--dur-normal) var(--ease-out),
    transform var(--dur-normal) var(--ease-out);
}

.dropzone:hover { border-color: var(--brand-400); background: var(--bg-active); }
.dropzone.is-dragover {
  border-color: var(--brand-500);
  background: var(--bg-active);
  transform: scale(1.01);
  box-shadow: var(--shadow-brand);
}

.dropzone__icon {
  display: grid;
  place-items: center;
  width: 62px;
  height: 62px;
  border-radius: var(--radius-lg);
  background: var(--bg-surface);
  color: var(--brand-500);
  box-shadow: var(--shadow-sm);
}

.dropzone__title { font-size: var(--text-md); font-weight: 620; }
.dropzone__hint { font-size: var(--text-sm); color: var(--text-tertiary); }

.file-pill {
  display: flex;
  align-items: center;
  gap: var(--space-3);
  padding: var(--space-3) var(--space-4);
  border-radius: var(--radius-md);
  background: var(--bg-surface);
  border: 1px solid var(--border-default);
  animation: pop-in var(--dur-normal) var(--ease-spring) both;
}

/* --------------------------------------------------------------------------
   步骤条
   -------------------------------------------------------------------------- */
.steps { display: flex; flex-direction: column; gap: var(--space-4); }

.step {
  display: flex;
  gap: var(--space-3);
  opacity: 0.55;
  transition: opacity var(--dur-normal) var(--ease-out);
}

.step.is-active,
.step.is-done { opacity: 1; }

.step__marker {
  display: grid;
  place-items: center;
  flex-shrink: 0;
  width: 28px;
  height: 28px;
  border-radius: 50%;
  border: 2px solid var(--border-default);
  background: var(--bg-surface);
  color: var(--text-tertiary);
  font-size: var(--text-xs);
  font-weight: 700;
  transition: background var(--dur-normal) var(--ease-out), border-color var(--dur-normal) var(--ease-out),
    color var(--dur-normal) var(--ease-out);
}

.step.is-active .step__marker {
  border-color: var(--brand-500);
  color: var(--brand-500);
  animation: count-glow 1.4s var(--ease-out) infinite;
}

.step.is-done .step__marker {
  border-color: transparent;
  background: var(--success);
  color: #fff;
}

.step__body { padding-top: 3px; min-width: 0; }
.step__title { font-weight: 600; }
.step__desc { font-size: var(--text-sm); color: var(--text-tertiary); }

/* --------------------------------------------------------------------------
   提示条
   -------------------------------------------------------------------------- */
.alert {
  display: flex;
  align-items: flex-start;
  gap: var(--space-3);
  padding: var(--space-4);
  border-radius: var(--radius-md);
  border: 1px solid transparent;
  font-size: var(--text-base);
  animation: rise-in var(--dur-normal) var(--ease-out) both;
}

.alert__icon { flex-shrink: 0; margin-top: 1px; }
.alert__body { flex: 1; min-width: 0; }
.alert__title { font-weight: 620; }
.alert__text { font-size: var(--text-sm); color: inherit; opacity: 0.85; margin-top: 2px; }

.alert--info { background: var(--info-soft); border-color: color-mix(in srgb, var(--info) 24%, transparent); color: var(--info); }
.alert--success { background: var(--success-soft); border-color: color-mix(in srgb, var(--success) 24%, transparent); color: var(--success); }
.alert--warning { background: var(--warning-soft); border-color: color-mix(in srgb, var(--warning) 26%, transparent); color: var(--warning); }
.alert--danger { background: var(--danger-soft); border-color: color-mix(in srgb, var(--danger) 24%, transparent); color: var(--danger); }

/* --------------------------------------------------------------------------
   键值展示
   -------------------------------------------------------------------------- */
.info-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
  gap: var(--space-4);
}

.info-item { min-width: 0; }
.info-item__label {
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: var(--text-xs);
  color: var(--text-tertiary);
  margin-bottom: 4px;
  letter-spacing: 0.02em;
}
.info-item__value { font-size: var(--text-md); font-weight: 600; overflow-wrap: anywhere; }

/* --------------------------------------------------------------------------
   代码 / 日志查看
   -------------------------------------------------------------------------- */
.code-block {
  padding: var(--space-4);
  border-radius: var(--radius-md);
  background: var(--bg-surface-sunken);
  border: 1px solid var(--border-subtle);
  font-family: var(--font-mono);
  font-size: var(--text-xs);
  line-height: 1.7;
  color: var(--text-secondary);
  overflow: auto;
  max-height: 380px;
  white-space: pre-wrap;
  overflow-wrap: anywhere;
}

/* --------------------------------------------------------------------------
   命令面板（Ctrl/⌘ + K）
   -------------------------------------------------------------------------- */
.command-palette {
  position: fixed;
  inset: 0;
  z-index: var(--z-modal);
  display: flex;
  justify-content: center;
  padding: 12vh var(--space-4) var(--space-4);
  background: rgba(2, 6, 23, 0.5);
  animation: fade-in var(--dur-fast) var(--ease-out) both;
}

.command-palette__panel {
  width: min(620px, 100%);
  max-height: 62vh;
  display: flex;
  flex-direction: column;
  background: var(--bg-surface-raised);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-xl);
  overflow: hidden;
  animation: modal-in var(--dur-normal) var(--ease-spring) both;
}

.command-palette__input {
  display: flex;
  align-items: center;
  gap: var(--space-3);
  padding: var(--space-4) var(--space-5);
  border-bottom: 1px solid var(--border-subtle);
}

.command-palette__input input {
  flex: 1;
  border: none;
  background: transparent;
  font-size: var(--text-lg);
  outline: none;
}

.command-palette__list { overflow-y: auto; padding: var(--space-2); }

.command-item {
  display: flex;
  align-items: center;
  gap: var(--space-3);
  padding: 10px var(--space-3);
  border-radius: var(--radius-sm);
  color: var(--text-secondary);
  cursor: pointer;
  transition: background var(--dur-fast) var(--ease-out), color var(--dur-fast) var(--ease-out);
}

.command-item.is-active,
.command-item:hover { background: var(--bg-active); color: var(--text-primary); }
.command-item__hint { margin-left: auto; font-size: var(--text-xs); color: var(--text-tertiary); }

.kbd {
  display: inline-flex;
  align-items: center;
  padding: 2px 6px;
  border-radius: var(--radius-xs);
  background: var(--bg-muted);
  border: 1px solid var(--border-default);
  border-bottom-width: 2px;
  font-family: var(--font-mono);
  font-size: 11px;
  color: var(--text-secondary);
}

/* --------------------------------------------------------------------------
   v5.1.0 公告系统（构件层）
   · .ann-banner-* 常驻横幅：挂在 .app-main 里、#pageOutlet 之前（顶栏之下、内容之上），
     不随路由重建，因此「常驻」天然成立；无壳页面由 JS 主动隐藏（见 core/announce.js）。
   · .ann-rich / .md-* 富文本排版：Markdown 渲染器与 HTML 白名单净化器的输出，
     两者共用同一套排版类，颜色只用令牌（日间/夜间自动适配）。
   · .ann-bell 顶栏铃铛：常驻横幅被关掉后，用户仍能从这里重新打开公告。
   -------------------------------------------------------------------------- */
.ann-banner-host {
  display: flex;
  flex-direction: column;
  gap: var(--space-2);
  width: 100%;
  max-width: var(--content-max);
  margin: 0 auto;
  padding: var(--space-4) var(--space-6) 0;
}

.ann-banner {
  display: flex;
  align-items: flex-start;
  gap: var(--space-3);
  padding: var(--space-3) var(--space-4);
  border-radius: var(--radius-lg);
  border: 1px solid var(--border-subtle);
  background: var(--bg-surface);
  box-shadow: var(--shadow-sm);
  animation: rise-in var(--dur-normal) var(--ease-out) both;
  transition: opacity var(--dur-fast) var(--ease-out), transform var(--dur-fast) var(--ease-out);
}

.ann-banner.is-leaving {
  opacity: 0;
  transform: translateY(-6px);
}

.ann-banner__icon {
  display: grid;
  place-items: center;
  flex: none;
  width: 30px;
  height: 30px;
  border-radius: var(--radius-sm);
  background: var(--bg-muted);
  color: var(--brand-500);
}

.ann-banner__text { flex: 1; min-width: 0; }

.ann-banner__title {
  display: flex;
  align-items: center;
  gap: 6px;
  font-weight: 640;
  color: var(--text-primary);
}

.ann-banner__pin { display: inline-grid; place-items: center; color: var(--accent-amber); }

.ann-banner__desc {
  margin-top: 2px;
  font-size: var(--text-sm);
  color: var(--text-secondary);
  overflow: hidden;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
}

.ann-banner__actions { display: flex; align-items: center; gap: var(--space-1); flex: none; }

/* 语气（与服务端 level 枚举一一对应） */
.ann-banner--info { border-color: color-mix(in srgb, var(--info) 26%, transparent); background: var(--info-soft); }
.ann-banner--info .ann-banner__icon { background: color-mix(in srgb, var(--info) 18%, transparent); color: var(--info); }
.ann-banner--success { border-color: color-mix(in srgb, var(--success) 26%, transparent); background: var(--success-soft); }
.ann-banner--success .ann-banner__icon { background: color-mix(in srgb, var(--success) 18%, transparent); color: var(--success); }
.ann-banner--warning { border-color: color-mix(in srgb, var(--warning) 28%, transparent); background: var(--warning-soft); }
.ann-banner--warning .ann-banner__icon { background: color-mix(in srgb, var(--warning) 20%, transparent); color: var(--warning); }
.ann-banner--danger { border-color: color-mix(in srgb, var(--danger) 28%, transparent); background: var(--danger-soft); }
.ann-banner--danger .ann-banner__icon { background: color-mix(in srgb, var(--danger) 20%, transparent); color: var(--danger); }

/* 预览里的静态横幅（不可交互，去掉动画） */
.ann-banner--static { animation: none; }

.ann-popup__meta { display: flex; align-items: center; gap: var(--space-2); flex-wrap: wrap; margin-bottom: var(--space-3); }
.ann-popup__time { font-size: var(--text-xs); color: var(--text-tertiary); }
.ann-popup__footer { display: flex; align-items: center; gap: var(--space-2); width: 100%; }
.ann-popup__hint { font-size: var(--text-sm); color: var(--text-tertiary); }

.ann-bell { position: relative; }
.ann-bell[hidden] { display: none; }

/* --------------------------------------------------------------------------
   公告富文本排版（Markdown / 白名单 HTML 共用）
   -------------------------------------------------------------------------- */
.ann-rich { color: var(--text-primary); font-size: var(--text-base); line-height: 1.75; word-break: break-word; }
.ann-rich > :first-child { margin-top: 0; }
.ann-rich > :last-child { margin-bottom: 0; }
.ann-rich .md-h1 { font-size: var(--text-2xl); font-weight: 700; letter-spacing: -0.02em; margin: var(--space-5) 0 var(--space-3); }
.ann-rich .md-h2 { font-size: var(--text-xl); font-weight: 700; letter-spacing: -0.015em; margin: var(--space-5) 0 var(--space-2); }
.ann-rich .md-h3 { font-size: var(--text-lg); font-weight: 650; margin: var(--space-4) 0 var(--space-2); }
.ann-rich .md-h4,
.ann-rich .md-h5,
.ann-rich .md-h6 { font-size: var(--text-md); font-weight: 650; margin: var(--space-4) 0 var(--space-2); }
.ann-rich .md-p { margin: var(--space-3) 0; }
.ann-rich .md-list { margin: var(--space-3) 0; padding-left: 1.4em; }
.ann-rich .md-list--unordered { list-style: disc; }
.ann-rich .md-list--ordered { list-style: decimal; }
.ann-rich .md-li { margin: 2px 0; }
.ann-rich .md-li--nested { list-style: circle; margin-left: var(--space-4); }
.ann-rich .md-quote {
  margin: var(--space-3) 0;
  padding: var(--space-2) var(--space-4);
  border-left: 3px solid var(--brand-400);
  border-radius: var(--radius-xs);
  background: var(--bg-muted);
  color: var(--text-secondary);
}
.ann-rich .md-hr { margin: var(--space-5) 0; border: none; border-top: 1px solid var(--border-subtle); }
.ann-rich .md-pre {
  margin: var(--space-3) 0;
  padding: var(--space-3) var(--space-4);
  border-radius: var(--radius-md);
  background: var(--bg-surface-sunken);
  box-shadow: var(--shadow-inset-sm);
  overflow-x: auto;
}
.ann-rich .md-code {
  font-family: var(--font-mono);
  font-size: var(--text-sm);
  color: var(--text-primary);
  white-space: pre;
}
.ann-rich code {
  font-family: var(--font-mono);
  font-size: 0.92em;
  padding: 1px 5px;
  border-radius: var(--radius-xs);
  background: var(--bg-muted);
  color: var(--brand-600);
}
.ann-rich .md-pre code { padding: 0; background: none; color: inherit; }
.ann-rich a { color: var(--brand-500); text-decoration: underline; text-underline-offset: 2px; }
.ann-rich a:hover { color: var(--brand-400); }
.ann-rich img { max-width: 100%; height: auto; border-radius: var(--radius-md); margin: var(--space-2) 0; }
.ann-rich strong { font-weight: 680; }
.ann-rich del { color: var(--text-tertiary); }
.ann-rich .md-table-wrap { margin: var(--space-3) 0; overflow-x: auto; border-radius: var(--radius-md); border: 1px solid var(--border-subtle); }
.ann-rich .md-table { width: 100%; border-collapse: collapse; font-size: var(--text-sm); }
.ann-rich .md-table th,
.ann-rich .md-table td { padding: var(--space-2) var(--space-3); border-bottom: 1px solid var(--border-subtle); }
.ann-rich .md-table th { background: var(--bg-muted); font-weight: 640; text-align: left; }
.ann-rich .md-table tr:last-child td { border-bottom: none; }

@media (prefers-reduced-motion: reduce) {
  .ann-banner { animation: none; transition: none; }
  .ann-banner.is-leaving { transform: none; }
}

@media (max-width: 720px) {
  .ann-banner-host { padding: var(--space-3) var(--space-4) 0; }
  .ann-banner__desc { -webkit-line-clamp: 3; }
}
