/* ============================================================================
 * QQboot UI 组件层（Components）
 * ----------------------------------------------------------------------------
 * 只依赖 tokens.css 的变量，不写死任何颜色/尺寸。
 * 桌面端与手机端共用；手机端在 mobile.css 里做尺寸与排布的覆盖。
 *
 * 命名约定：BEM 简化版 —— .btn / .btn--primary / .btn__icon
 * 状态类统一：.is-active / .is-loading / .is-disabled
 * ========================================================================== */

/* hidden 属性必须压过组件自身 display（.empty 等用 flex 会覆盖 hidden） */
[hidden] { display: none !important; }

/* ============================================================================
 * 1. 按钮
 * ========================================================================== */
.btn {
  --btn-h: 36px;
  --btn-px: var(--space-4);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: var(--space-2);
  height: var(--btn-h);
  padding: 0 var(--btn-px);
  border: 1px solid transparent;
  border-radius: var(--radius-md);
  background: var(--secondary);
  color: var(--secondary-foreground);
  font-size: var(--text-sm);
  font-weight: var(--weight-medium);
  line-height: 1;
  white-space: nowrap;
  cursor: pointer;
  user-select: none;
  transition: background var(--duration-fast) var(--ease-out),
              border-color var(--duration-fast) var(--ease-out),
              color var(--duration-fast) var(--ease-out),
              box-shadow var(--duration-fast) var(--ease-out),
              transform var(--duration-fast) var(--ease-out);
}
.btn:hover { background: var(--secondary-hover); text-decoration: none; }
.btn:active { transform: translateY(.5px); }
.btn:disabled,
.btn[aria-disabled="true"] {
  opacity: .5;
  cursor: not-allowed;
  transform: none;
}

/* 尺寸 */
.btn--sm { --btn-h: 30px; --btn-px: var(--space-3); font-size: var(--text-xs); }
.btn--lg { --btn-h: 44px; --btn-px: var(--space-6); font-size: var(--text-md); }
.btn--block { display: flex; width: 100%; }

/* 变体 */
.btn--primary {
  background: var(--primary);
  color: var(--primary-foreground);
  box-shadow: var(--shadow-xs);
}
.btn--primary:hover { background: var(--primary-hover); }

.btn--outline {
  background: var(--card);
  border-color: var(--border-strong);
  color: var(--foreground);
}
.btn--outline:hover { background: var(--muted); border-color: var(--input-hover); }

.btn--ghost { background: transparent; color: var(--muted-foreground); }
.btn--ghost:hover { background: var(--muted); color: var(--foreground); }

.btn--soft {
  background: var(--primary-soft);
  color: var(--primary-soft-foreground);
  border-color: var(--primary-border);
}
.btn--soft:hover { background: var(--accent); }

.btn--danger {
  background: var(--destructive);
  color: var(--destructive-foreground);
}
.btn--danger:hover { background: var(--destructive-hover); }

.btn--danger-ghost { background: transparent; color: var(--destructive); }
.btn--danger-ghost:hover { background: var(--destructive-soft); }

/* 玻璃按钮：用于悬浮操作条、弹层头部，不做大面积 */
.btn--glass {
  background: var(--glass-bg);
  border-color: var(--glass-border);
  color: var(--foreground);
  -webkit-backdrop-filter: var(--glass-blur);
  backdrop-filter: var(--glass-blur);
  box-shadow: var(--shadow-sm), var(--glass-inset);
}
.btn--glass:hover { background: var(--glass-bg-strong); }

/* 胶囊：主 CTA 用，符合当下 SaaS 趋势 */
.btn--pill { border-radius: var(--radius-pill); }

/* 图标按钮 */
.btn--icon {
  --btn-px: 0;
  width: var(--btn-h);
  flex: 0 0 auto;
}

.btn__icon { display: inline-flex; flex: 0 0 auto; }
.btn__icon svg { width: 1.1em; height: 1.1em; }

/* 加载态：文字保留宽度，中间换成转圈 */
.btn.is-loading { pointer-events: none; color: transparent; position: relative; }
.btn.is-loading::after {
  content: "";
  position: absolute;
  width: 14px; height: 14px;
  border: 2px solid currentColor;
  border-top-color: transparent;
  border-radius: 50%;
  color: var(--primary-foreground);
  animation: spin .6s linear infinite;
}
.btn--outline.is-loading::after,
.btn--ghost.is-loading::after,
.btn--soft.is-loading::after { color: var(--primary); }

@keyframes spin { to { transform: rotate(360deg); } }

/* 按钮组 */
.btn-group { display: inline-flex; }
.btn-group > .btn { border-radius: 0; margin-left: -1px; }
.btn-group > .btn:first-child {
  border-radius: var(--radius-md) 0 0 var(--radius-md);
  margin-left: 0;
}
.btn-group > .btn:last-child { border-radius: 0 var(--radius-md) var(--radius-md) 0; }

/* ============================================================================
 * 2. 卡片
 * ========================================================================== */
.card {
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-xs);
}
.card--pad { padding: var(--space-5); }
.card--flush { padding: 0; overflow: hidden; }
.card--hover {
  transition: border-color var(--duration-base) var(--ease-out),
              box-shadow var(--duration-base) var(--ease-out);
}
.card--hover:hover { border-color: var(--border-strong); box-shadow: var(--shadow-md); }

.card__header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: var(--space-4);
  padding: var(--space-4) var(--space-5);
  border-bottom: 1px solid var(--border);
}
.card__title {
  font-size: var(--text-md);
  font-weight: var(--weight-semibold);
  letter-spacing: var(--tracking-tight);
}
.card__desc {
  margin-top: var(--space-1);
  font-size: var(--text-sm);
  color: var(--muted-foreground);
  line-height: var(--leading-snug);
}
.card__body { padding: var(--space-5); }
.card__footer {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: var(--space-2);
  padding: var(--space-3) var(--space-5);
  border-top: 1px solid var(--border);
  background: var(--muted);
  border-radius: 0 0 var(--radius-lg) var(--radius-lg);
}

/* ============================================================================
 * 3. 表单
 * ========================================================================== */
.field { display: flex; flex-direction: column; gap: var(--space-2); }
.field__label {
  font-size: var(--text-sm);
  font-weight: var(--weight-medium);
  color: var(--foreground);
}
.field__label .req { color: var(--destructive); margin-left: 2px; }
.field__hint { font-size: var(--text-xs); color: var(--muted-foreground); line-height: var(--leading-snug); }
.field__error {
  display: flex;
  align-items: center;
  gap: var(--space-1);
  font-size: var(--text-xs);
  color: var(--destructive);
}

.input,
.select,
.textarea {
  width: 100%;
  min-height: 38px;
  padding: var(--space-2) var(--space-3);
  background: var(--card);
  border: 1px solid var(--input);
  border-radius: var(--radius-md);
  font-size: var(--text-sm);
  color: var(--foreground);
  transition: border-color var(--duration-fast) var(--ease-out),
              box-shadow var(--duration-fast) var(--ease-out);
  appearance: none;
}
.input::placeholder,
.textarea::placeholder { color: var(--subtle-foreground); }

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

.input:focus,
.select:focus,
.textarea:focus {
  outline: none;
  border-color: var(--ring);
  box-shadow: 0 0 0 3px color-mix(in srgb, var(--ring) 14%, transparent);
}

.input[aria-invalid="true"],
.select[aria-invalid="true"],
.textarea[aria-invalid="true"] {
  border-color: var(--destructive);
}
.input[aria-invalid="true"]:focus,
.textarea[aria-invalid="true"]:focus {
  box-shadow: 0 0 0 3px color-mix(in srgb, var(--destructive) 16%, transparent);
}

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

.textarea { min-height: 88px; resize: vertical; line-height: var(--leading-normal); }

.select {
  padding-right: var(--space-8);
  /* 箭头用 mask 绘制：颜色跟随 --muted-foreground，暗色模式自动适配，
     不再把颜色硬编码进 data-URI */
  background-image: none;
}
.select-wrap {
  position: relative;
  display: flex;
  align-items: center;
}
.select-wrap::after {
  content: "";
  position: absolute;
  right: var(--space-3);
  top: 50%;
  width: 16px; height: 16px;
  margin-top: -8px;
  background: currentColor;
  color: var(--muted-foreground);
  pointer-events: none;
  -webkit-mask-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='black' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='m6 9 6 6 6-6'/%3E%3C/svg%3E");
  mask-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='black' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='m6 9 6 6 6-6'/%3E%3C/svg%3E");
  -webkit-mask-repeat: no-repeat;
  mask-repeat: no-repeat;
  -webkit-mask-position: center;
  mask-position: center;
  -webkit-mask-size: contain;
  mask-size: contain;
}
.select-wrap > .select { padding-right: var(--space-8); }

/* 带前后缀的输入 */
.input-group {
  display: flex;
  align-items: stretch;
  border: 1px solid var(--input);
  border-radius: var(--radius-md);
  background: var(--card);
  overflow: hidden;
  transition: border-color var(--duration-fast) var(--ease-out),
              box-shadow var(--duration-fast) var(--ease-out);
}
.input-group:focus-within {
  border-color: var(--ring);
  box-shadow: 0 0 0 3px color-mix(in srgb, var(--ring) 14%, transparent);
}
.input-group > .input {
  border: 0;
  border-radius: 0;
  box-shadow: none;
  background: transparent;
}
.input-group > .input:focus { box-shadow: none; }
.input-group__prefix,
.input-group__suffix {
  display: flex;
  align-items: center;
  padding: 0 var(--space-3);
  font-size: var(--text-sm);
  color: var(--muted-foreground);
  background: var(--muted);
  border-right: 1px solid var(--border);
  white-space: nowrap;
}
.input-group__suffix { border-right: 0; border-left: 1px solid var(--border); }

/* 后缀当按钮用时（密码显隐、复制密钥）：补齐语义与点击尺寸 */
.input-group__btn {
  display: flex;
  align-items: center;
  justify-content: center;
  flex: 0 0 auto;
  min-width: 38px;
  min-height: 38px;
  padding: 0 var(--space-3);
  border: 0;
  border-left: 1px solid var(--border);
  background: var(--muted);
  color: var(--muted-foreground);
  cursor: pointer;
  transition: background var(--duration-fast) var(--ease-out),
              color var(--duration-fast) var(--ease-out);
}
.input-group__btn:hover { background: var(--secondary-hover); color: var(--foreground); }
.input-group__btn:focus-visible { outline: 2px solid var(--ring); outline-offset: -2px; }
.input-group__btn svg { width: 15px; height: 15px; }

/* 搜索框 */
.search {
  position: relative;
  display: flex;
  align-items: center;
}
.search svg {
  position: absolute;
  left: var(--space-3);
  width: 15px; height: 15px;
  color: var(--subtle-foreground);
  pointer-events: none;
}
.search .input { padding-left: var(--space-8); }

/* 开关 */
.switch {
  position: relative;
  display: inline-flex;
  flex: 0 0 auto;
  width: 40px; height: 22px;
  cursor: pointer;
}
.switch input {
  position: absolute;
  opacity: 0;
  width: 100%; height: 100%;
  margin: 0;
  cursor: pointer;
}
.switch__track {
  width: 100%; height: 100%;
  /* 关闭态用 --muted：--gray-300 不随主题变化，暗色下是浅灰块，
     与深色背景反差过大，看起来像「已开启」。 */
  background: var(--muted);
  border-radius: var(--radius-pill);
  transition: background var(--duration-base) var(--ease-out);
}
.switch__track::after {
  content: "";
  position: absolute;
  top: 3px; left: 3px;
  width: 16px; height: 16px;
  background: var(--card);
  border-radius: 50%;
  box-shadow: var(--shadow-sm);
  transition: transform var(--duration-base) var(--ease-spring);
}
.switch input:checked + .switch__track { background: var(--primary); }
.switch input:checked + .switch__track::after { transform: translateX(18px); }
.switch input:focus-visible + .switch__track {
  outline: 2px solid var(--ring);
  outline-offset: 2px;
}
.switch input:disabled + .switch__track { opacity: .5; cursor: not-allowed; }

/* 复选与单选 */
.checkbox,
.radio {
  display: inline-flex;
  align-items: center;
  gap: var(--space-2);
  font-size: var(--text-sm);
  cursor: pointer;
  user-select: none;
}
.checkbox input,
.radio input {
  width: 16px; height: 16px;
  margin: 0;
  accent-color: var(--primary);
  cursor: pointer;
}

/* 表单栅格 */
.form-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: var(--space-4) var(--space-5);
}
.form-grid > .span-2 { grid-column: 1 / -1; }

/* ============================================================================
 * 4. 表格
 * ========================================================================== */
.table-wrap {
  overflow-x: auto;
  border-radius: var(--radius-lg);
  -webkit-overflow-scrolling: touch;
}
.table {
  width: 100%;
  border-collapse: separate;
  border-spacing: 0;
  font-size: var(--text-sm);
}
.table thead th {
  position: sticky;
  top: 0;
  z-index: 1;
  padding: var(--space-3) var(--space-4);
  background: var(--muted);
  border-bottom: 1px solid var(--border);
  font-size: var(--text-xs);
  font-weight: var(--weight-semibold);
  color: var(--muted-foreground);
  text-align: left;
  white-space: nowrap;
  letter-spacing: var(--tracking-wide);
}
.table tbody td {
  padding: var(--space-3) var(--space-4);
  border-bottom: 1px solid var(--border);
  vertical-align: middle;
  color: var(--foreground);
}
.table tbody tr:last-child td { border-bottom: 0; }
.table tbody tr { transition: background var(--duration-fast) var(--ease-out); }
.table tbody tr:hover { background: var(--muted); }
.table .num { text-align: right; font-variant-numeric: tabular-nums; }
.table .actions {
  display: flex;
  gap: var(--space-1);
  justify-content: flex-end;
}

/* ============================================================================
 * 5. 徽标与标签
 * ========================================================================== */
.badge {
  display: inline-flex;
  align-items: center;
  gap: var(--space-1);
  height: 22px;
  padding: 0 var(--space-2);
  border: 1px solid transparent;
  border-radius: var(--radius-sm);
  font-size: var(--text-xs);
  font-weight: var(--weight-medium);
  line-height: 1;
  white-space: nowrap;
}
.badge--neutral { background: var(--muted); color: var(--muted-foreground); border-color: var(--border); }
.badge--primary { background: var(--primary-soft); color: var(--primary-soft-foreground); border-color: var(--primary-border); }
.badge--success { background: var(--success-soft); color: var(--success); border-color: var(--success-border); }
.badge--warning { background: var(--warning-soft); color: var(--warning); border-color: var(--warning-border); }
.badge--danger  { background: var(--destructive-soft); color: var(--destructive); border-color: var(--destructive-border); }
.badge--info    { background: var(--info-soft); color: var(--info); border-color: var(--info-border); }
.badge--pill { border-radius: var(--radius-pill); padding: 0 var(--space-3); }

/* 状态点 */
.dot {
  width: 6px; height: 6px;
  border-radius: 50%;
  background: currentColor;
  flex: 0 0 auto;
}
.dot--pulse { animation: pulse 2s var(--ease-in-out) infinite; }
@keyframes pulse {
  0%, 100% { opacity: 1; }
  50% { opacity: .35; }
}

/* ============================================================================
 * 6. 统计卡
 * ========================================================================== */
.stat {
  display: flex;
  flex-direction: column;
  gap: var(--space-2);
  padding: var(--space-4);
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-xs);
  transition: border-color var(--duration-base) var(--ease-out),
              box-shadow var(--duration-base) var(--ease-out);
}
.stat:hover { border-color: var(--border-strong); box-shadow: var(--shadow-sm); }
.stat__head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--space-2);
}
.stat__label { font-size: var(--text-xs); color: var(--muted-foreground); font-weight: var(--weight-medium); }
.stat__icon {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 28px; height: 28px;
  border-radius: var(--radius-sm);
  background: var(--primary-soft);
  color: var(--primary-soft-foreground);
}
.stat__icon svg { width: 15px; height: 15px; }
.stat__value {
  font-size: var(--text-2xl);
  font-weight: var(--weight-semibold);
  letter-spacing: var(--tracking-tight);
  font-variant-numeric: tabular-nums;
  line-height: 1.1;
}
.stat__meta { display: flex; align-items: center; gap: var(--space-1); font-size: var(--text-xs); color: var(--muted-foreground); }
.stat__trend--up { color: var(--success); }
.stat__trend--down { color: var(--destructive); }

/* ============================================================================
 * 7. 空状态
 * ========================================================================== */
.empty {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: var(--space-3);
  padding: var(--space-12) var(--space-5);
  text-align: center;
}
.empty__icon {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 48px; height: 48px;
  border-radius: var(--radius-xl);
  background: var(--muted);
  color: var(--subtle-foreground);
}
.empty__icon svg { width: 22px; height: 22px; }
.empty__title { font-size: var(--text-md); font-weight: var(--weight-medium); }
.empty__desc { font-size: var(--text-sm); color: var(--muted-foreground); max-width: 40ch; }

/* ============================================================================
 * 8. 提示条
 * ========================================================================== */
.alert {
  display: flex;
  align-items: flex-start;
  gap: var(--space-3);
  padding: var(--space-3) var(--space-4);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  font-size: var(--text-sm);
  line-height: var(--leading-snug);
}
.alert__icon { flex: 0 0 auto; margin-top: 1px; }
.alert__icon svg { width: 16px; height: 16px; }
.alert__body { flex: 1; min-width: 0; }
.alert__title { font-weight: var(--weight-semibold); margin-bottom: var(--space-1); }
.alert--info { background: var(--info-soft); border-color: var(--info-border); color: var(--info); }
.alert--success { background: var(--success-soft); border-color: var(--success-border); color: var(--success); }
.alert--warning { background: var(--warning-soft); border-color: var(--warning-border); color: var(--warning); }
.alert--danger { background: var(--destructive-soft); border-color: var(--destructive-border); color: var(--destructive); }

/* ============================================================================
 * 9. 标签页
 * ========================================================================== */
.tabs {
  display: flex;
  align-items: center;
  gap: var(--space-1);
  border-bottom: 1px solid var(--border);
  overflow-x: auto;
  scrollbar-width: none;
}
.tabs::-webkit-scrollbar { display: none; }
.tab {
  position: relative;
  display: inline-flex;
  align-items: center;
  gap: var(--space-2);
  padding: var(--space-3) var(--space-3);
  border: 0;
  background: transparent;
  font-size: var(--text-sm);
  font-weight: var(--weight-medium);
  color: var(--muted-foreground);
  white-space: nowrap;
  cursor: pointer;
  transition: color var(--duration-fast) var(--ease-out);
}
.tab:hover { color: var(--foreground); }
.tab[aria-selected="true"],
.tab[aria-pressed="true"] { color: var(--primary); }
.tab[aria-selected="true"]::after,
.tab[aria-pressed="true"]::after {
  content: "";
  position: absolute;
  left: var(--space-2); right: var(--space-2);
  bottom: -1px;
  height: 2px;
  background: var(--primary);
  border-radius: var(--radius-pill) var(--radius-pill) 0 0;
}
.tab__count {
  margin-left: var(--space-1);
  min-width: 18px;
  padding: 0 5px;
  height: 17px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  background: var(--muted);
  border-radius: var(--radius-pill);
  font-size: var(--text-2xs);
  font-variant-numeric: tabular-nums;
}
.tab[aria-selected="true"] .tab__count,
.tab[aria-pressed="true"] .tab__count {
  background: var(--primary-soft);
  color: var(--primary-soft-foreground);
}

/* 分段控件：手机端主要分类切换方式 */
.segmented {
  display: inline-flex;
  padding: 3px;
  background: var(--muted);
  border-radius: var(--radius-md);
  gap: 2px;
  max-width: 100%;
}
/* 分类多到放不下时横向滚动，不撑破容器 */
.segmented--scroll {
  display: flex;
  overflow-x: auto;
  scrollbar-width: none;
  -webkit-overflow-scrolling: touch;
}
.segmented--scroll::-webkit-scrollbar { display: none; }
.segmented--scroll .segmented__item { flex: 0 0 auto; }
.segmented__item {
  padding: var(--space-1) var(--space-3);
  border: 0;
  border-radius: var(--radius-sm);
  background: transparent;
  font-size: var(--text-xs);
  font-weight: var(--weight-medium);
  color: var(--muted-foreground);
  cursor: pointer;
  white-space: nowrap;
  transition: background var(--duration-fast) var(--ease-out),
              color var(--duration-fast) var(--ease-out);
}
.segmented__item[aria-selected="true"] {
  background: var(--card);
  color: var(--foreground);
  box-shadow: var(--shadow-xs);
}

/* ============================================================================
 * 10. 头像
 * ========================================================================== */
.avatar {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  flex: 0 0 auto;
  width: 32px; height: 32px;
  border-radius: 50%;
  background: var(--primary-soft);
  color: var(--primary-soft-foreground);
  font-size: var(--text-xs);
  font-weight: var(--weight-semibold);
  text-transform: uppercase;
  overflow: hidden;
}
.avatar--sm { width: 24px; height: 24px; font-size: var(--text-2xs); }
.avatar--lg { width: 40px; height: 40px; font-size: var(--text-base); }
.avatar img { width: 100%; height: 100%; object-fit: cover; }

/* ============================================================================
 * 11. 弹窗与抽屉
 * ========================================================================== */
.overlay {
  position: fixed;
  inset: 0;
  z-index: var(--z-modal);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: var(--space-4);
  background: rgba(15, 21, 32, .45);
  -webkit-backdrop-filter: blur(3px);
  backdrop-filter: blur(3px);
  animation: fade-in var(--duration-base) var(--ease-out);
}
@keyframes fade-in { from { opacity: 0; } to { opacity: 1; } }

.modal {
  width: 100%;
  max-width: 520px;
  max-height: calc(100vh - var(--space-8));
  display: flex;
  flex-direction: column;
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: var(--radius-xl);
  box-shadow: var(--shadow-xl);
  animation: modal-in var(--duration-slow) var(--ease-spring);
  overflow: hidden;
}
@keyframes modal-in {
  from { opacity: 0; transform: translateY(8px) scale(.98); }
  to { opacity: 1; transform: translateY(0) scale(1); }
}
.modal--wide { max-width: 720px; }
.modal__header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--space-3);
  padding: var(--space-4) var(--space-5);
  border-bottom: 1px solid var(--border);
}
.modal__title { font-size: var(--text-md); font-weight: var(--weight-semibold); }
.modal__body {
  padding: var(--space-5);
  overflow-y: auto;
  -webkit-overflow-scrolling: touch;
}
.modal__footer {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: var(--space-2);
  padding: var(--space-3) var(--space-5);
  border-top: 1px solid var(--border);
  background: var(--muted);
}

/* 底部抽屉（手机端替代居中弹窗） */
/* 弹层用底部抽屉时的 overlay 组合：贴底、去掉内边距 */
.overlay--sheet {
  align-items: flex-end;
  padding: 0;
}

.sheet {
  position: fixed;
  inset: auto 0 0 0;
  z-index: var(--z-modal);
  max-height: 88vh;
  /* 左右必须留出安全边距：移动端 .sheet 贴满屏宽，内容区再加内边距，
     否则输入框、按钮会顶到屏幕边缘，看起来拥挤且容易误触。 */
  width: 100%;
  box-sizing: border-box;
  display: flex;
  flex-direction: column;
  background: var(--card);
  border-radius: var(--radius-2xl) var(--radius-2xl) 0 0;
  box-shadow: var(--shadow-xl);
  padding-bottom: var(--safe-bottom);
  animation: sheet-in var(--duration-slow) var(--ease-out);
  /* 内容超出时由面板自身滚动；配合下方 [id] 内容区的 flex 约束，
     避免滚动穿透到下层页面。 */
  overflow: hidden;
  overscroll-behavior: contain;
}
@keyframes sheet-in { from { transform: translateY(100%); } to { transform: translateY(0); } }
.sheet__handle {
  width: 36px; height: 4px;
  margin: var(--space-2) auto var(--space-1);
  background: var(--border-strong);
  border-radius: var(--radius-pill);
  flex: 0 0 auto;
}

/* ============================================================================
 * 12. 提示消息
 * ========================================================================== */
.toast {
  position: fixed;
  bottom: calc(var(--space-6) + var(--safe-bottom));
  left: 50%;
  transform: translateX(-50%);
  z-index: var(--z-toast);
  display: flex;
  align-items: center;
  gap: var(--space-2);
  max-width: min(92vw, 420px);
  padding: var(--space-3) var(--space-4);
  /* 用 --popover：暗色下比 --card 亮一档，toast 与背景能分出层次；
     --gray-900 在暗色主题里和卡片几乎同色，看不出浮层边界。 */
  background: var(--popover);
  color: var(--popover-foreground);
  border: 1px solid var(--border-strong);
  border-radius: var(--radius-md);
  box-shadow: var(--shadow-lg);
  font-size: var(--text-sm);
  animation: toast-in var(--duration-slow) var(--ease-spring);
}
@keyframes toast-in {
  from { opacity: 0; transform: translate(-50%, 10px); }
  to { opacity: 1; transform: translate(-50%, 0); }
}
.toast--error { background: var(--destructive); }
.toast--success { background: var(--success); }

/* ============================================================================
 * 13. 骨架屏
 * ========================================================================== */
.skeleton {
  background: linear-gradient(90deg, var(--muted) 25%, var(--border) 37%, var(--muted) 63%);
  background-size: 400% 100%;
  border-radius: var(--radius-sm);
  animation: shimmer 1.4s var(--ease-in-out) infinite;
}
@keyframes shimmer {
  0% { background-position: 100% 50%; }
  100% { background-position: 0 50%; }
}
.skeleton--text { height: 12px; margin: var(--space-2) 0; }
.skeleton--title { height: 18px; width: 40%; margin-bottom: var(--space-4); }
.skeleton--circle { border-radius: 50%; }

/* ============================================================================
 * 14. 工具类
 * ========================================================================== */
.stack { display: flex; flex-direction: column; }
.row { display: flex; align-items: center; }
.row--between { justify-content: space-between; }
.row--wrap { flex-wrap: wrap; }
.gap-1 { gap: var(--space-1); }
.gap-2 { gap: var(--space-2); }
.gap-3 { gap: var(--space-3); }
.gap-4 { gap: var(--space-4); }
.gap-6 { gap: var(--space-6); }
.flex-1 { flex: 1; min-width: 0; }
.grow { flex-grow: 1; }
.truncate { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.mono { font-family: var(--font-mono); font-size: .92em; }
.text-xs { font-size: var(--text-xs); }
.text-sm { font-size: var(--text-sm); }
.text-muted { color: var(--muted-foreground); }
.text-subtle { color: var(--subtle-foreground); }
.text-strong { font-weight: var(--weight-semibold); }
.text-right { text-align: right; }
.text-center { text-align: center; }
.mt-2 { margin-top: var(--space-2); }
.mt-4 { margin-top: var(--space-4); }
.mt-6 { margin-top: var(--space-6); }
.mb-4 { margin-bottom: var(--space-4); }
.w-full { width: 100%; }
.hidden { display: none !important; }
.nowrap { white-space: nowrap; }
.tabular { font-variant-numeric: tabular-nums; }

/* 响应式显示 */
.only-mobile { display: none; }
@media (max-width: 767px) {
  .only-desktop { display: none !important; }
  .only-mobile { display: revert; }
}
