/* ============================================================
 * style.css — 全局样式（移动端优先 Mobile-First）
 * ============================================================
 * 教学要点：
 *  1. CSS 变量集中管理主题色 —— 换肤只改变量，不改业务样式
 *  2. [data-theme="dark"] 一套变量覆盖即完成暗色模式
 *  3. 动画只动 transform / opacity（合成层属性），保证 60fps
 *  4. 安全区适配：env(safe-area-inset-*) 兼容 iPhone 刘海与底部横条
 * ============================================================ */

/* ---------- 主题变量（浅色为默认） ---------- */
:root {
  --brand: #0066cc;
  --brand-2: #00a3ff;
  --brand-gradient: linear-gradient(135deg, #0066cc 0%, #00a3ff 100%);
  --bg: #f4f6fa;
  --bg-elevated: #ffffff;
  --text: #1a2333;
  --text-2: #5a6b85;
  --text-3: #93a1b8;
  --border: #e4e9f2;
  --shadow-sm: 0 1px 3px rgba(20, 40, 80, .06), 0 4px 14px rgba(20, 40, 80, .06);
  --shadow-md: 0 6px 24px rgba(0, 102, 204, .14);
  --radius: 16px;
  --pending: #f59e0b;
  --processing: #3b82f6;
  --completed: #10b981;
  --closed: #94a3b8;
  --urgent: #ef4444;
  --high: #f97316;
  --medium: #3b82f6;
  --low: #94a3b8;
}

/* ---------- 暗色主题：只覆盖变量 ---------- */
[data-theme="dark"] {
  --bg: #0d1420;
  --bg-elevated: #16202f;
  --text: #e8eef7;
  --text-2: #9db0ca;
  --text-3: #64748b;
  --border: #263349;
  --shadow-sm: 0 1px 3px rgba(0, 0, 0, .3), 0 4px 14px rgba(0, 0, 0, .25);
  --shadow-md: 0 6px 24px rgba(0, 0, 0, .4);
}

/* ---------- 基础重置 ---------- */
* { margin: 0; padding: 0; box-sizing: border-box; -webkit-tap-highlight-color: transparent; }
html { font-size: 16px; }
body {
  font-family: -apple-system, BlinkMacSystemFont, "PingFang SC", "HarmonyOS Sans SC", "Microsoft YaHei", sans-serif;
  background: var(--bg);
  color: var(--text);
  line-height: 1.6;
  transition: background .3s ease, color .3s ease;
}
button, input, select, textarea { font: inherit; color: inherit; }
button { cursor: pointer; border: none; background: none; }
a { text-decoration: none; color: inherit; }

#app {
  max-width: 560px;            /* 移动端优先：PC 上限制宽度居中，保持 H5 观感 */
  margin: 0 auto;
  min-height: 100vh;
  min-height: 100dvh;
  display: flex;
  flex-direction: column;
  background: var(--bg);
  position: relative;
}
@media (min-width: 600px) {
  #app { box-shadow: 0 0 40px rgba(20, 40, 80, .08); }
}

/* ---------- 顶部栏 ---------- */
.app-header {
  position: sticky;
  top: 0;
  z-index: 20;
  background: var(--bg-elevated);   /* color-mix 不支持时的兜底（老浏览器纯色背景） */
  background: color-mix(in srgb, var(--bg-elevated) 88%, transparent);
  backdrop-filter: blur(16px) saturate(180%);
  -webkit-backdrop-filter: blur(16px) saturate(180%);
  border-bottom: 1px solid var(--border);
  padding-top: env(safe-area-inset-top);
}
.header-inner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 12px 16px;
  gap: 8px;
}
.brand { display: flex; align-items: center; gap: 10px; min-width: 0; }
.brand-logo {
  width: 38px; height: 38px;
  border-radius: 11px;
  background: var(--brand-gradient);
  color: #fff;
  display: grid;
  place-items: center;
  font-size: 19px;
  font-weight: 700;
  box-shadow: 0 4px 12px rgba(0, 102, 204, .35);
  flex-shrink: 0;
}
.brand-text { display: flex; flex-direction: column; line-height: 1.25; }
.brand-text strong { font-size: 15px; }
.brand-text small { font-size: 11px; color: var(--text-3); }

/* 顶部栏右侧区域 */
.header-right {
  display: flex;
  align-items: center;
  gap: 6px;
  flex-shrink: 0;
}

.theme-toggle {
  width: 38px; height: 38px;
  border-radius: 50%;
  display: grid;
  place-items: center;
  color: var(--text-2);
  background: var(--bg);
  border: 1px solid var(--border);
  transition: transform .25s cubic-bezier(.34, 1.56, .64, 1), color .2s;
}
.theme-toggle:active { transform: scale(.88) rotate(30deg); }
[data-theme="dark"] .icon-sun { display: block; }
[data-theme="dark"] .icon-moon { display: none; }
.icon-sun { display: none; }

/* ---------- 用户头像/下拉菜单 ---------- */
.user-avatar-wrap {
  position: relative;
  cursor: pointer;
}
.user-avatar-circle {
  width: 36px; height: 36px;
  border-radius: 50%;
  background: var(--brand-gradient);
  color: #fff;
  display: grid;
  place-items: center;
  font-size: 14px;
  font-weight: 700;
  box-shadow: 0 2px 8px rgba(0, 102, 204, .3);
  transition: transform .2s ease, box-shadow .2s ease;
  user-select: none;
}
.user-avatar-circle:active { transform: scale(.9); }

/* 下拉菜单 */
.user-dropdown {
  position: absolute;
  top: calc(100% + 8px);
  right: 0;
  min-width: 180px;
  background: var(--bg-elevated);
  border: 1px solid var(--border);
  border-radius: 14px;
  box-shadow: 0 12px 36px rgba(0, 0, 0, .15);
  padding: 6px 0;
  z-index: 50;
  animation: dropIn .2s cubic-bezier(.22, 1, .36, 1);
}
.user-dropdown[hidden] { display: none; }
@keyframes dropIn {
  from { opacity: 0; transform: translateY(-8px) scale(.96); }
  to   { opacity: 1; transform: translateY(0) scale(1); }
}
.user-dropdown-header {
  padding: 10px 14px 8px;
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 14px;
}
.user-dropdown-header strong {
  font-size: 14px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  max-width: 120px;
}
.user-dropdown-divider {
  height: 1px;
  background: var(--border);
  margin: 4px 0;
}
.user-dropdown-item {
  display: flex;
  align-items: center;
  gap: 8px;
  width: 100%;
  padding: 10px 14px;
  font-size: 14px;
  color: var(--text-2);
  transition: background .15s;
  text-align: left;
}
.user-dropdown-item:hover,
.user-dropdown-item:active { background: var(--bg); }
.user-dropdown-item-danger { color: var(--urgent); }

/* ---------- 登录页样式 ---------- */
.login-view {
  min-height: 100vh;
  min-height: 100dvh;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 24px;
  background: var(--bg);
}
.login-view[hidden] { display: none; }

.login-card {
  width: 100%;
  max-width: 380px;
  background: var(--bg-elevated);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow-md);
  padding: 36px 24px 28px;
  animation: modalUp .4s cubic-bezier(.34, 1.3, .64, 1);
}
.login-brand {
  text-align: center;
  margin-bottom: 28px;
}
.login-logo {
  width: 56px; height: 56px;
  font-size: 26px;
  border-radius: 16px;
  margin: 0 auto 14px;
  display: grid;
  place-items: center;
}
.login-brand h2 {
  font-size: 20px;
  margin-bottom: 4px;
}
.login-brand p {
  font-size: 13px;
  color: var(--text-3);
}
.login-form .field { margin-bottom: 18px; }
.login-btn {
  margin-top: 6px;
  height: 48px;
  font-size: 16px;
  border-radius: 14px;
}
.login-tip {
  text-align: center;
  font-size: 12px;
  color: var(--text-3);
  margin-top: 18px;
}

/* ---------- 视图区 ---------- */
.view {
  flex: 1;
  padding: 16px 16px calc(72px + env(safe-area-inset-bottom));
  animation: viewIn .32s cubic-bezier(.22, 1, .36, 1);
}
@keyframes viewIn {
  from { opacity: 0; transform: translateY(12px); }
  to   { opacity: 1; transform: translateY(0); }
}

.view-title { font-size: 20px; font-weight: 700; margin-bottom: 4px; }
.view-sub { font-size: 13px; color: var(--text-3); margin-bottom: 16px; }

/* ---------- 卡片 ---------- */
.card {
  background: var(--bg-elevated);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow-sm);
  padding: 16px;
  margin-bottom: 12px;
  transition: transform .25s ease, box-shadow .25s ease;
}
.card:active { transform: scale(.985); }

/* ---------- 看板统计卡 ---------- */
.stats-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 12px;
  margin-bottom: 12px;
}
.stat-card {
  border-radius: var(--radius);
  padding: 16px;
  color: #fff;
  position: relative;
  overflow: hidden;
  box-shadow: var(--shadow-md);
  animation: popIn .4s cubic-bezier(.34, 1.4, .64, 1) backwards;
}
.stat-card:nth-child(2) { animation-delay: .06s; }
.stat-card:nth-child(3) { animation-delay: .12s; }
.stat-card:nth-child(4) { animation-delay: .18s; }
@keyframes popIn {
  from { opacity: 0; transform: scale(.9) translateY(10px); }
  to   { opacity: 1; transform: scale(1) translateY(0); }
}
.stat-card::after {           /* 装饰性光斑，制造层次感 */
  content: "";
  position: absolute;
  right: -24px; top: -24px;
  width: 90px; height: 90px;
  border-radius: 50%;
  background: rgba(255, 255, 255, .16);
}
.stat-card .num { font-size: 30px; font-weight: 800; line-height: 1.2; font-variant-numeric: tabular-nums; }
.stat-card .label { font-size: 12px; opacity: .92; }
.stat-total { background: var(--brand-gradient); }
.stat-pending { background: linear-gradient(135deg, #f59e0b, #fbbf24); }
.stat-processing { background: linear-gradient(135deg, #3b82f6, #60a5fa); }
.stat-urgent { background: linear-gradient(135deg, #ef4444, #f87171); }

/* ---------- 7日趋势迷你柱状图 ---------- */
.trend-card h4, .type-card h4 { font-size: 14px; margin-bottom: 12px; color: var(--text-2); }
.trend-bars { display: flex; align-items: flex-end; gap: 8px; height: 84px; }
.trend-col { flex: 1; display: flex; flex-direction: column; align-items: center; gap: 6px; height: 100%; justify-content: flex-end; }
.trend-bar {
  width: 100%;
  max-width: 30px;
  border-radius: 6px 6px 3px 3px;
  background: var(--brand-gradient);
  min-height: 4px;
  transition: height .6s cubic-bezier(.22, 1, .36, 1);
  position: relative;
}
.trend-bar:hover::after {
  content: attr(data-count);
  position: absolute;
  top: -24px; left: 50%;
  transform: translateX(-50%);
  font-size: 11px;
  background: var(--text);
  color: var(--bg-elevated);
  padding: 1px 7px;
  border-radius: 6px;
  white-space: nowrap;
}
.trend-day { font-size: 10px; color: var(--text-3); }

.type-row { display: flex; align-items: center; gap: 10px; margin-bottom: 10px; font-size: 13px; }
.type-row .name { width: 62px; color: var(--text-2); flex-shrink: 0; }
.type-row .bar-track { flex: 1; height: 8px; border-radius: 4px; background: var(--bg); overflow: hidden; }
.type-row .bar-fill { height: 100%; border-radius: 4px; transition: width .6s ease; }
.type-row .count { width: 26px; text-align: right; color: var(--text-3); font-variant-numeric: tabular-nums; }

/* ---------- 表单 ---------- */
.form-card { padding: 20px 16px; }
.field { margin-bottom: 18px; }
.field-label {
  display: flex;
  align-items: center;
  font-size: 14px;
  font-weight: 600;
  margin-bottom: 8px;
}
.field-label .req { color: var(--urgent); margin-left: 3px; }
.field-input, .field-select, .field-textarea {
  width: 100%;
  padding: 12px 14px;
  border-radius: 12px;
  border: 1.5px solid var(--border);
  background: var(--bg);
  transition: border-color .2s, box-shadow .2s;
  font-size: 15px;              /* iOS 上 <16px 会触发自动放大 */
}
.field-input:focus, .field-select:focus, .field-textarea:focus {
  outline: none;
  border-color: var(--brand);
  box-shadow: 0 0 0 3px rgba(0, 102, 204, .12);
}
.field-input.error, .field-textarea.error { border-color: var(--urgent); }
.field-textarea { min-height: 110px; resize: vertical; }
.field-error { font-size: 12px; color: var(--urgent); margin-top: 5px; display: none; }
.field-error.show { display: block; animation: shake .3s ease; }
@keyframes shake {
  0%, 100% { transform: translateX(0); }
  25% { transform: translateX(-4px); }
  75% { transform: translateX(4px); }
}
.field-row { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }

/* 分段选择器（优先级/类型） */
.seg-group { display: flex; gap: 8px; flex-wrap: wrap; }
.seg-item {
  padding: 8px 16px;
  border-radius: 999px;
  border: 1.5px solid var(--border);
  background: var(--bg);
  font-size: 13px;
  color: var(--text-2);
  transition: all .2s cubic-bezier(.34, 1.3, .64, 1);
  user-select: none;
}
.seg-item:active { transform: scale(.94); }
.seg-item.active {
  border-color: var(--brand);
  color: var(--brand);
  background: rgba(0, 102, 204, .08);
  font-weight: 600;
}
.seg-item.active[data-value="urgent"] { border-color: var(--urgent); color: var(--urgent); background: rgba(239, 68, 68, .08); }
.seg-item.active[data-value="high"] { border-color: var(--high); color: var(--high); background: rgba(249, 115, 22, .08); }
.seg-item.active[data-value="bug"] { border-color: var(--urgent); color: var(--urgent); background: rgba(239, 68, 68, .08); }

/* ---------- 按钮 ---------- */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  padding: 12px 22px;
  border-radius: 12px;
  font-size: 15px;
  font-weight: 600;
  transition: transform .2s cubic-bezier(.34, 1.4, .64, 1), box-shadow .2s, opacity .2s;
}
.btn:active { transform: scale(.96); }
.btn-primary {
  background: var(--brand-gradient);
  color: #fff;
  box-shadow: 0 4px 14px rgba(0, 102, 204, .35);
}
.btn-primary:disabled { opacity: .6; box-shadow: none; }
.btn-ghost { background: var(--bg); color: var(--text-2); border: 1px solid var(--border); }
.btn-block { width: 100%; }
.btn-sm { padding: 7px 14px; font-size: 13px; border-radius: 9px; }
.btn-danger { background: var(--urgent); color: #fff; box-shadow: 0 4px 14px rgba(239, 68, 68, .3); }

/* ---------- 工单列表 ---------- */
.filter-bar { display: flex; gap: 8px; margin-bottom: 12px; overflow-x: auto; padding-bottom: 4px; scrollbar-width: none; }
.filter-bar::-webkit-scrollbar { display: none; }
.filter-chip {
  flex-shrink: 0;
  padding: 7px 15px;
  border-radius: 999px;
  font-size: 13px;
  background: var(--bg-elevated);
  border: 1.5px solid var(--border);
  color: var(--text-2);
  transition: all .2s;
}
.filter-chip.active {
  background: var(--brand-gradient);
  color: #fff;
  border-color: transparent;
  font-weight: 600;
  box-shadow: 0 3px 10px rgba(0, 102, 204, .3);
}

.search-box { position: relative; margin-bottom: 12px; }
.search-box svg { position: absolute; left: 13px; top: 50%; transform: translateY(-50%); color: var(--text-3); }
.search-box input {
  width: 100%;
  padding: 11px 14px 11px 40px;
  border-radius: 12px;
  border: 1.5px solid var(--border);
  background: var(--bg-elevated);
  font-size: 14px;
}
.search-box input:focus { outline: none; border-color: var(--brand); box-shadow: 0 0 0 3px rgba(0, 102, 204, .12); }

.ticket-card { display: block; animation: viewIn .3s ease backwards; }
.ticket-head { display: flex; justify-content: space-between; align-items: flex-start; gap: 10px; margin-bottom: 8px; }
.ticket-title { font-size: 15px; font-weight: 650; flex: 1; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
.ticket-no { font-size: 11px; color: var(--text-3); font-family: ui-monospace, "SF Mono", Consolas, monospace; }
.ticket-meta { display: flex; flex-wrap: wrap; gap: 6px; align-items: center; margin-top: 10px; }
.ticket-desc {
  font-size: 13px; color: var(--text-2);
  display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden;
}
.ticket-foot { display: flex; justify-content: space-between; align-items: center; margin-top: 10px; font-size: 12px; color: var(--text-3); }

/* 状态 / 优先级 / 类型徽章 */
.badge {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 3px 10px;
  border-radius: 999px;
  font-size: 11px;
  font-weight: 600;
  flex-shrink: 0;
}
.badge::before { content: ""; width: 5px; height: 5px; border-radius: 50%; background: currentColor; }
.badge-pending    { color: var(--pending);    background: rgba(245, 158, 11, .12); }
.badge-processing { color: var(--processing); background: rgba(59, 130, 246, .12); }
.badge-completed  { color: var(--completed);  background: rgba(16, 185, 129, .12); }
.badge-closed     { color: var(--closed);     background: rgba(148, 163, 184, .15); }
.badge-urgent { color: var(--urgent); background: rgba(239, 68, 68, .1); }
.badge-high   { color: var(--high);   background: rgba(249, 115, 22, .1); }
.badge-medium { color: var(--medium); background: rgba(59, 130, 246, .1); }
.badge-low    { color: var(--low);    background: rgba(148, 163, 184, .15); }
.badge-type { color: var(--text-2); background: var(--bg); border: 1px solid var(--border); }
.badge-type::before { display: none; }
.badge-admin { color: var(--brand); background: rgba(0, 102, 204, .1); }

/* ---------- 工单详情 ---------- */
.detail-header { position: relative; overflow: hidden; }
.detail-header .ticket-title { font-size: 18px; -webkit-line-clamp: 3; }
.detail-grid { display: grid; grid-template-columns: auto 1fr; gap: 8px 14px; font-size: 13.5px; margin-top: 14px; }
.detail-grid dt { color: var(--text-3); white-space: nowrap; }
.detail-grid dd { color: var(--text); word-break: break-all; }
.detail-desc {
  margin-top: 14px;
  padding: 14px;
  background: var(--bg);
  border-radius: 12px;
  font-size: 14px;
  white-space: pre-wrap;
  word-break: break-word;
}

/* 时间线 */
.timeline { position: relative; padding-left: 22px; }
.timeline::before {
  content: "";
  position: absolute;
  left: 6px; top: 8px; bottom: 8px;
  width: 2px;
  background: var(--border);
  border-radius: 2px;
}
.timeline-item { position: relative; padding-bottom: 18px; animation: viewIn .3s ease backwards; }
.timeline-item::before {
  content: "";
  position: absolute;
  left: -22px; top: 6px;
  width: 14px; height: 14px;
  border-radius: 50%;
  background: var(--bg-elevated);
  border: 3px solid var(--brand);
  z-index: 1;
}
.timeline-item.action-created::before { border-color: var(--brand); }
.timeline-item.action-status_change::before { border-color: var(--completed); }
.timeline-item.action-comment::before { border-color: var(--text-3); }
.timeline-head { display: flex; justify-content: space-between; gap: 8px; font-size: 13px; }
.timeline-head strong { font-weight: 600; }
.timeline-time { color: var(--text-3); font-size: 11.5px; flex-shrink: 0; }
.timeline-content {
  margin-top: 5px;
  font-size: 13px;
  color: var(--text-2);
  background: var(--bg);
  padding: 10px 12px;
  border-radius: 10px;
  white-space: pre-wrap;
  word-break: break-word;
}
.timeline-content:empty { display: none; }

.action-bar { display: flex; gap: 10px; flex-wrap: wrap; margin-top: 4px; }
.action-bar .btn { flex: 1; min-width: 110px; }

/* ---------- 附件列表样式 ---------- */
.attach-card { margin-top: 0; }
.attach-card h4 { font-size: 14px; margin-bottom: 12px; color: var(--text-2); display: flex; align-items: center; gap: 6px; }
.attach-list { list-style: none; }
.attach-item {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 0;
  border-bottom: 1px solid var(--border);
}
.attach-item:last-child { border-bottom: none; }

/* 文件图标 */
.attach-icon {
  width: 38px; height: 38px;
  border-radius: 10px;
  background: var(--bg);
  border: 1px solid var(--border);
  display: grid;
  place-items: center;
  color: var(--brand);
  flex-shrink: 0;
}
.attach-info { flex: 1; min-width: 0; }
.attach-name {
  font-size: 14px;
  font-weight: 500;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  display: block;
}
.attach-meta {
  font-size: 11px;
  color: var(--text-3);
  margin-top: 2px;
}
.attach-actions {
  display: flex;
  gap: 6px;
  flex-shrink: 0;
}
.attach-actions .btn-sm {
  padding: 5px 10px;
  font-size: 12px;
  border-radius: 8px;
}

/* 上传按钮 */
.attach-upload-bar {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-top: 12px;
  padding-top: 10px;
  border-top: 1px dashed var(--border);
}
.upload-progress {
  font-size: 12px;
  color: var(--text-3);
}

/* ---------- 审计日志样式 ---------- */
.audit-filter-bar {
  display: flex;
  gap: 8px;
  margin-bottom: 12px;
  flex-wrap: wrap;
}
.audit-filter-bar .field-select,
.audit-filter-bar .field-input {
  padding: 8px 12px;
  font-size: 13px;
  border-radius: 10px;
  min-width: 0;
}
.audit-filter-bar .field-select { flex: 1; min-width: 100px; }
.audit-filter-bar .field-input { flex: 1.5; min-width: 120px; }

.audit-list { list-style: none; }
.audit-item {
  padding: 12px 0;
  border-bottom: 1px solid var(--border);
  animation: viewIn .3s ease backwards;
}
.audit-item:last-child { border-bottom: none; }
.audit-head {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 8px;
  margin-bottom: 4px;
}
.audit-action {
  font-size: 14px;
  font-weight: 600;
  color: var(--text);
}
.audit-time {
  font-size: 11px;
  color: var(--text-3);
  flex-shrink: 0;
  font-family: ui-monospace, "SF Mono", Consolas, monospace;
}
.audit-user {
  font-size: 12px;
  color: var(--text-2);
  margin-bottom: 3px;
}
.audit-target {
  font-size: 13px;
  color: var(--text-2);
  background: var(--bg);
  padding: 6px 10px;
  border-radius: 8px;
  word-break: break-all;
}
.audit-detail {
  font-size: 12px;
  color: var(--text-3);
  margin-top: 4px;
  font-family: ui-monospace, "SF Mono", Consolas, monospace;
  white-space: pre-wrap;
  word-break: break-word;
}

/* ---------- 用户管理样式 ---------- */
.user-table-wrap { overflow-x: auto; -webkit-overflow-scrolling: touch; }
.user-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 13px;
}
.user-table th, .user-table td {
  text-align: left;
  padding: 10px 10px;
  border-bottom: 1px solid var(--border);
  white-space: nowrap;
}
.user-table th { color: var(--text-3); font-weight: 600; font-size: 12px; }
.user-table td { color: var(--text-2); }
.user-table tr:last-child td { border-bottom: none; }

/* ---------- 底部标签栏 ---------- */
.tabbar {
  position: fixed;
  bottom: 0;
  left: 50%;
  transform: translateX(-50%);
  width: 100%;
  max-width: 560px;
  display: flex;
  background: var(--bg-elevated);   /* color-mix 不支持时的兜底（老浏览器纯色背景） */
  background: color-mix(in srgb, var(--bg-elevated) 92%, transparent);
  backdrop-filter: blur(16px) saturate(180%);
  -webkit-backdrop-filter: blur(16px) saturate(180%);
  border-top: 1px solid var(--border);
  padding-bottom: env(safe-area-inset-bottom);
  z-index: 30;
}
.tab {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 3px;
  padding: 9px 0 7px;
  font-size: 11px;
  color: var(--text-3);
  transition: color .2s;
}
.tab.active { color: var(--brand); font-weight: 600; }

/* ---------- Toast 轻提示 ---------- */
.toast {
  position: fixed;
  top: calc(20px + env(safe-area-inset-top));
  left: 50%;
  transform: translateX(-50%) translateY(-80px);
  background: var(--text);
  color: var(--bg-elevated);
  padding: 11px 22px;
  border-radius: 999px;
  font-size: 14px;
  box-shadow: 0 8px 24px rgba(0, 0, 0, .18);
  opacity: 0;
  transition: transform .35s cubic-bezier(.22, 1, .36, 1), opacity .3s;
  z-index: 100;
  pointer-events: none;
  max-width: 86vw;
  text-align: center;
}
.toast.show { transform: translateX(-50%) translateY(0); opacity: 1; }
.toast.success { background: var(--completed); color: #fff; }
.toast.error { background: var(--urgent); color: #fff; }

/* ---------- 弹层 ---------- */
.modal-mask {
  position: fixed;
  top: 0; right: 0; bottom: 0; left: 0;  /* inset 老浏览器兜底 */
  inset: 0;
  background: rgba(10, 20, 40, .45);
  backdrop-filter: blur(4px);
  display: grid;
  place-items: center;
  z-index: 90;
  animation: fadeIn .2s ease;
  padding: 24px;
}
/* 关键修复：开发者写的 display:grid 会覆盖浏览器对 [hidden] 属性的
   默认样式 display:none，导致弹层永远可见、挡住整页点击。
   必须显式还原 hidden 的隐藏语义（教学红线：自定义 display 的元素配 hidden 时必查此坑）。 */
.modal-mask[hidden] { display: none; }
@keyframes fadeIn { from { opacity: 0; } }
.modal-card {
  width: 100%;
  max-width: 400px;
  background: var(--bg-elevated);
  border-radius: 20px;
  padding: 22px 20px;
  box-shadow: 0 20px 60px rgba(0, 0, 0, .25);
  animation: modalUp .3s cubic-bezier(.34, 1.3, .64, 1);
}
@keyframes modalUp {
  from { opacity: 0; transform: translateY(30px) scale(.95); }
  to   { opacity: 1; transform: translateY(0) scale(1); }
}
.modal-card h3 { font-size: 16px; margin-bottom: 14px; }
.modal-card .field-input, .modal-card .field-textarea { background: var(--bg); }
.modal-card textarea { min-height: 80px; }
.modal-actions { display: flex; gap: 10px; margin-top: 18px; }
.modal-actions .btn { flex: 1; }

/* ---------- 空状态 & 骨架屏 ---------- */
.empty {
  text-align: center;
  padding: 60px 20px;
  color: var(--text-3);
}
.empty svg { opacity: .35; margin-bottom: 14px; }
.empty p { font-size: 14px; }

.skeleton { position: relative; overflow: hidden; background: var(--bg-elevated); }
.skeleton::after {
  content: "";
  position: absolute;
  top: 0; right: 0; bottom: 0; left: 0;  /* inset 老浏览器兜底 */
  inset: 0;
  background: linear-gradient(90deg, transparent, rgba(150, 170, 200, .12), transparent);
  animation: shimmer 1.4s infinite;
}
@keyframes shimmer {
  from { transform: translateX(-100%); }
  to   { transform: translateX(100%); }
}
.skel-line { height: 14px; border-radius: 7px; background: var(--bg); margin-bottom: 10px; }

/* ---------- 加载更多 ---------- */
.load-more { text-align: center; padding: 6px 0 14px; }

/* ---------- 成功页动画 ---------- */
.success-wrap { text-align: center; padding: 50px 20px 30px; }
.success-icon {
  width: 84px; height: 84px;
  margin: 0 auto 20px;
  border-radius: 50%;
  background: linear-gradient(135deg, #10b981, #34d399);
  display: grid;
  place-items: center;
  box-shadow: 0 10px 30px rgba(16, 185, 129, .4);
  animation: successPop .5s cubic-bezier(.34, 1.56, .64, 1);
}
@keyframes successPop {
  0% { transform: scale(0); }
  70% { transform: scale(1.12); }
  100% { transform: scale(1); }
}
.success-icon svg { width: 42px; height: 42px; }
.success-icon path {
  stroke-dasharray: 40;
  stroke-dashoffset: 40;
  animation: drawCheck .45s .3s ease forwards;
}
@keyframes drawCheck { to { stroke-dashoffset: 0; } }
.success-no {
  display: inline-block;
  margin: 10px 0 24px;
  padding: 8px 18px;
  border-radius: 10px;
  background: var(--bg);
  border: 1px dashed var(--border);
  font-family: ui-monospace, "SF Mono", Consolas, monospace;
  font-size: 15px;
  color: var(--brand);
  font-weight: 700;
}

/* ---------- 分页 ---------- */
.pagination {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  margin-top: 12px;
  padding: 8px 0;
}
.pagination .page-info {
  font-size: 13px;
  color: var(--text-3);
}

/* ---------- 无障碍：减少动态效果偏好 ---------- */
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: .01ms !important; transition-duration: .01ms !important; }
}
