/* =============================================================
   小芒果 · 设计系统 (Design System)
   —— 令牌驱动：颜色 / 字号 / 间距 / 圆角 / 阴影 / 动效 全部集中在 :root。
   —— 结构分区：令牌 → 基础 → 外壳 → 组件 → 页面 → 响应式。
   —— 纯原生 CSS，移动端优先，支持浅/深色(由 data-theme 切换)。
   ============================================================= */

/* ---------- 1. 设计令牌 ---------- */
:root {
  color-scheme: light;

  /* 品牌强调色 */
  --accent: #5b5bd6;
  --accent-hover: #4f46e5;
  --accent-press: #4338ca;
  --accent-weak: rgba(91, 91, 214, 0.10);
  --accent-weak-2: rgba(91, 91, 214, 0.18);
  --accent-ring: rgba(91, 91, 214, 0.32);
  --on-accent: #ffffff;
  --accent-grad: var(--accent);            /* 兼容旧引用 */

  /* 中性色阶 */
  --bg: #f7f7f9;
  --surface: #ffffff;
  --surface-2: #f1f1f4;
  --surface-3: #e8e8ee;
  --text: #16161a;
  --text-2: #55555f;
  --text-muted: #7c7c88;
  --border: #e6e6eb;
  --border-strong: #d5d5de;
  --hairline: rgba(22, 22, 26, 0.07);      /* 更柔和的分隔线 */

  /* 状态色(+弱色底) */
  --danger: #e5484d;  --danger-weak: rgba(229, 72, 77, 0.12);
  --ok: #2f9e63;      --ok-weak: rgba(47, 158, 99, 0.13);
  --warn: #c97a12;    --warn-weak: rgba(201, 122, 18, 0.14);

  /* 圆角阶梯 */
  --r-xs: 6px; --r-sm: 8px; --r: 10px; --r-md: 12px;
  --r-lg: 16px; --r-xl: 20px; --r-full: 999px;

  /* 间距阶梯(4px 基准) */
  --s1: 4px; --s2: 8px; --s3: 12px; --s4: 16px;
  --s5: 20px; --s6: 24px; --s8: 32px; --s10: 40px;

  /* 字号阶梯 */
  --fs-display: 24px; --fs-h1: 19px; --fs-h2: 16px;
  --fs-body: 15px; --fs-sm: 13.5px; --fs-xs: 12px; --fs-2xs: 11px;

  /* 阴影(多层叠加，避免"脏灰边") */
  --shadow-xs: 0 1px 2px rgba(16, 18, 27, 0.05);
  --shadow-sm: 0 1px 2px rgba(16, 18, 27, 0.05), 0 1px 3px rgba(16, 18, 27, 0.04);
  --shadow-md: 0 4px 12px -2px rgba(16, 18, 27, 0.08), 0 2px 5px -2px rgba(16, 18, 27, 0.05);
  --shadow-lg: 0 18px 40px -12px rgba(16, 18, 27, 0.18), 0 8px 18px -10px rgba(16, 18, 27, 0.10);
  --shadow-xl: 0 32px 64px -20px rgba(16, 18, 27, 0.28), 0 12px 28px -14px rgba(16, 18, 27, 0.14);

  /* 动效曲线 */
  --ease: cubic-bezier(0.32, 0.72, 0, 1);
  --ease-out: cubic-bezier(0.22, 1, 0.36, 1);
  --t-fast: 130ms var(--ease);
  --t: 220ms var(--ease);

  --tabbar-h: 58px;
}

/* ---------- 1b. 配色皮肤 (data-skin) ----------
   aurora   = 默认(靛蓝) —— 不写覆盖, 直接沿用上面的 :root
   sunset   = 暖橙 —— 暖白底 / 大圆角 / 悬浮胶囊底栏
   graphite = 石墨黑白 —— 小圆角 / 边框优先 / 下划线选中
   皮肤只改"令牌 + 少量结构", 不改任何功能、交互与文案。
   顺序约定: 浅色皮肤令牌在此(先), 深色基线在后; 深色+皮肤组合放在深色之后,
   靠 [data-skin][data-theme](0,2,0) 的更高优先级压过单独基线。 */

/* —— sunset: 暖橙 —— */
[data-skin="sunset"] {
  color-scheme: light;

  --accent: #c2410c; --accent-hover: #a8390a; --accent-press: #8f300a;
  --accent-weak: rgba(194, 65, 12, 0.10);
  --accent-weak-2: rgba(194, 65, 12, 0.18);
  --accent-ring: rgba(194, 65, 12, 0.34);
  --on-accent: #ffffff;

  --bg: #fdf8f2; --surface: #ffffff; --surface-2: #f8efe4; --surface-3: #f0e3d4;
  --text: #241610; --text-2: #5c463a; --text-muted: #7d6555;
  --border: #eddccb; --border-strong: #ddc6b0;
  --hairline: rgba(70, 40, 18, 0.08);

  --r-xs: 8px; --r-sm: 10px; --r: 12px; --r-md: 15px;
  --r-lg: 20px; --r-xl: 26px;

  --shadow-xs: 0 1px 2px rgba(84, 48, 18, 0.06);
  --shadow-sm: 0 1px 2px rgba(84, 48, 18, 0.05), 0 2px 6px -2px rgba(84, 48, 18, 0.06);
  --shadow-md: 0 6px 16px -4px rgba(84, 48, 18, 0.14), 0 2px 6px -2px rgba(84, 48, 18, 0.07);
  --shadow-lg: 0 20px 44px -14px rgba(84, 48, 18, 0.26), 0 8px 20px -12px rgba(84, 48, 18, 0.16);
  --shadow-xl: 0 34px 68px -20px rgba(84, 48, 18, 0.34), 0 12px 28px -14px rgba(84, 48, 18, 0.20);
}

/* —— graphite: 石墨黑白 —— */
[data-skin="graphite"] {
  color-scheme: light;

  --accent: #18181b; --accent-hover: #000000; --accent-press: #000000;
  --accent-weak: rgba(24, 24, 27, 0.07);
  --accent-weak-2: rgba(24, 24, 27, 0.12);
  --accent-ring: rgba(24, 24, 27, 0.28);
  --on-accent: #ffffff;

  --bg: #fafafa; --surface: #ffffff; --surface-2: #f4f4f5; --surface-3: #ebebed;
  --text: #09090b; --text-2: #52525b; --text-muted: #66666f;
  --border: #e4e4e7; --border-strong: #d4d4d8;
  --hairline: rgba(9, 9, 11, 0.06);

  --r-xs: 4px; --r-sm: 6px; --r: 8px; --r-md: 9px;
  --r-lg: 12px; --r-xl: 14px;

  --shadow-xs: 0 1px 1px rgba(9, 9, 11, 0.03);
  --shadow-sm: 0 1px 2px rgba(9, 9, 11, 0.04);
  --shadow-md: 0 2px 6px -1px rgba(9, 9, 11, 0.06);
  --shadow-lg: 0 10px 24px -12px rgba(9, 9, 11, 0.16);
  --shadow-xl: 0 18px 40px -18px rgba(9, 9, 11, 0.22);
}

/* 夜间主题令牌 */
[data-theme="dark"] {
  color-scheme: dark;

  --accent: #8b8ff8; --accent-hover: #a0a3fa; --accent-press: #787cf0;
  --accent-weak: rgba(139, 143, 248, 0.15);
  --accent-weak-2: rgba(139, 143, 248, 0.24);
  --accent-ring: rgba(139, 143, 248, 0.42);
  --on-accent: #0e0e14;

  --bg: #0b0b0f; --surface: #141418; --surface-2: #1c1c22; --surface-3: #26262e;
  --text: #f0f0f4; --text-2: #c2c2cc; --text-muted: #8b8b96;
  --border: #26262d; --border-strong: #3a3a44;
  --hairline: rgba(255, 255, 255, 0.07);

  --danger: #ff6369; --danger-weak: rgba(255, 99, 105, 0.16);
  --ok: #3dd68c;     --ok-weak: rgba(61, 214, 140, 0.16);
  --warn: #f0a84a;   --warn-weak: rgba(240, 168, 74, 0.18);

  --shadow-xs: 0 1px 2px rgba(0, 0, 0, 0.40);
  --shadow-sm: 0 1px 2px rgba(0, 0, 0, 0.40), 0 1px 3px rgba(0, 0, 0, 0.30);
  --shadow-md: 0 4px 14px -2px rgba(0, 0, 0, 0.50), 0 2px 6px -2px rgba(0, 0, 0, 0.40);
  --shadow-lg: 0 18px 44px -12px rgba(0, 0, 0, 0.70), 0 8px 18px -10px rgba(0, 0, 0, 0.50);
  --shadow-xl: 0 32px 70px -20px rgba(0, 0, 0, 0.80), 0 12px 28px -14px rgba(0, 0, 0, 0.60);
}

/* 深色 + 皮肤组合: 优先级(0,2,0)高于单独深色或皮肤, 保证夜间也有对应色调 */
[data-skin="sunset"][data-theme="dark"] {
  color-scheme: dark;

  --accent: #ff9a3c; --accent-hover: #ffab5e; --accent-press: #f08828;
  --accent-weak: rgba(255, 154, 60, 0.16);
  --accent-weak-2: rgba(255, 154, 60, 0.26);
  --accent-ring: rgba(255, 154, 60, 0.44);
  --on-accent: #1c120a;

  --bg: #16110d; --surface: #1f1813; --surface-2: #2a211a; --surface-3: #362b22;
  --text: #f7f0e8; --text-2: #d3c5b8; --text-muted: #a3948a;
  --border: #34291f; --border-strong: #4a3b2d;
  --hairline: rgba(255, 255, 255, 0.08);

  --shadow-xs: 0 1px 2px rgba(0, 0, 0, 0.45);
  --shadow-sm: 0 1px 2px rgba(0, 0, 0, 0.45), 0 2px 6px -2px rgba(0, 0, 0, 0.35);
  --shadow-md: 0 6px 16px -4px rgba(0, 0, 0, 0.55), 0 2px 6px -2px rgba(0, 0, 0, 0.40);
  --shadow-lg: 0 20px 44px -14px rgba(0, 0, 0, 0.72), 0 8px 20px -12px rgba(0, 0, 0, 0.55);
  --shadow-xl: 0 34px 68px -20px rgba(0, 0, 0, 0.82), 0 12px 28px -14px rgba(0, 0, 0, 0.62);
}

[data-skin="graphite"][data-theme="dark"] {
  color-scheme: dark;

  --accent: #f4f4f5; --accent-hover: #ffffff; --accent-press: #e4e4e7;
  --accent-weak: rgba(244, 244, 245, 0.09);
  --accent-weak-2: rgba(244, 244, 245, 0.16);
  --accent-ring: rgba(244, 244, 245, 0.34);
  --on-accent: #0a0a0a;

  --bg: #0a0a0a; --surface: #131313; --surface-2: #1b1b1b; --surface-3: #232323;
  --text: #fafafa; --text-2: #c9c9ce; --text-muted: #8f8f96;
  --border: #262626; --border-strong: #3a3a3a;
  --hairline: rgba(255, 255, 255, 0.08);

  --shadow-xs: 0 1px 1px rgba(0, 0, 0, 0.50);
  --shadow-sm: 0 1px 2px rgba(0, 0, 0, 0.50);
  --shadow-md: 0 2px 8px -2px rgba(0, 0, 0, 0.60);
  --shadow-lg: 0 12px 28px -14px rgba(0, 0, 0, 0.75);
  --shadow-xl: 0 20px 44px -20px rgba(0, 0, 0, 0.85);
}

/* ---------- 2. 重置 / 基础排版 ---------- */
*, *::before, *::after {
  box-sizing: border-box;
  margin: 0; padding: 0;
  -webkit-tap-highlight-color: transparent;
}
html, body {
  height: 100%;
  background: var(--bg);
  color: var(--text);
  font-family: -apple-system, BlinkMacSystemFont, "SF Pro Text", "Segoe UI",
    "PingFang SC", "Hiragino Sans GB", "Microsoft YaHei", system-ui, sans-serif;
  font-size: var(--fs-body);
  line-height: 1.55;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  text-rendering: optimizeLegibility;
}
body { display: flex; justify-content: center; overflow: hidden; }

::selection { background: var(--accent-weak-2); color: var(--text); }

button { font: inherit; color: inherit; cursor: pointer; background: none; border: none; }
button:disabled { cursor: not-allowed; }
input, select, textarea { font: inherit; color: var(--text); }
a { color: var(--accent); }

/* 统一焦点环：键盘聚焦可见，鼠标点击不显 */
:focus-visible { outline: 2px solid var(--accent-ring); outline-offset: 2px; border-radius: var(--r-sm); }

/* 细滚动条(桌面) */
.scroll::-webkit-scrollbar,
.search-dropdown::-webkit-scrollbar,
.study-log::-webkit-scrollbar,
.sheet .list::-webkit-scrollbar { width: 6px; height: 6px; }
.scroll::-webkit-scrollbar-thumb,
.search-dropdown::-webkit-scrollbar-thumb,
.study-log::-webkit-scrollbar-thumb,
.sheet .list::-webkit-scrollbar-thumb {
  background: var(--border-strong); border-radius: var(--r-full);
}
.scroll::-webkit-scrollbar-track,
.search-dropdown::-webkit-scrollbar-track,
.study-log::-webkit-scrollbar-track { background: transparent; }

/* 昼夜切换平滑过渡(仅颜色类属性) */
body, .screen, .card, .list, .list li, .top-bar, .tab-bar, .pending-box,
.addr-card, .modal, .sheet, .scan-summary, .study-log, .study-bar,
.addr-picker-row, .map-box, .seg, .seg-btn, .field, .btn-ghost, .sheet-cancel,
.study-empty, .addr-empty, .login-hero {
  transition: background-color var(--t), border-color var(--t), color var(--t-fast);
}

/* ---------- 3. 内联 SVG 图标 ---------- */
.icon { display: inline-block; vertical-align: middle; flex-shrink: 0; }
svg.icon { stroke: currentColor; fill: none; }
[data-icon] { display: inline-flex; align-items: center; justify-content: center; }
.field-icon svg { width: 19px; height: 19px; }
.list li .li-icon svg { width: 18px; height: 18px; }
.tab-btn .ti svg { width: 23px; height: 23px; }
.acc-eye svg { width: 19px; height: 19px; }

/* ---------- 4. 应用外壳 / 分页 ---------- */
.screen {
  display: none; flex-direction: column;
  width: 100%; max-width: 460px;
  height: 100vh; height: 100dvh;
  height: var(--app-height, 100dvh);
  position: relative;
  background: var(--bg);
  overflow: hidden;
}
.screen.active { display: flex; }

.pages { flex: 1; min-height: 0; position: relative; overflow: hidden; }
.pane { position: absolute; inset: 0; display: none; flex-direction: column; }
.pane.active { display: flex; animation: paneIn var(--t) var(--ease-out); }
@keyframes paneIn { from { opacity: 0; transform: translateY(6px); } }

/* 桌面：居中成手机列 + 柔光背景 + 立体边框 */
@media (min-width: 480px) {
  body {
    align-items: center;
    padding: 24px;
    background:
      radial-gradient(1200px 560px at 50% -8%,
        color-mix(in srgb, var(--accent) 9%, var(--bg)) 0%, var(--bg) 58%),
      var(--surface-2);
  }
  .screen {
    height: calc(var(--app-height, 100dvh) - 48px);
    max-height: 940px;
    border: 1px solid var(--border);
    border-radius: var(--r-xl);
    box-shadow: var(--shadow-xl);
  }
}

/* ---------- 5. 登录 / 品牌头 ---------- */
#view-login { justify-content: flex-start; }
#view-login, #view-accounts {
  overflow-y: auto;
  overscroll-behavior-y: contain;
  -webkit-overflow-scrolling: touch;
  scroll-padding-block: var(--s5);
}
#view-login > *, #view-accounts > * { flex-shrink: 0; }

.login-hero {
  position: relative;
  text-align: center;
  background:
    radial-gradient(120% 90% at 50% 0%,
      color-mix(in srgb, var(--accent) 8%, transparent) 0%, transparent 62%);
  padding: calc(env(safe-area-inset-top) + 64px) var(--s6) var(--s8);
}
.login-hero .logo {
  width: 64px; height: 64px;
  margin: 0 auto var(--s4);
  border-radius: var(--r-xl);
  overflow: hidden;
  background: var(--accent);
  box-shadow: var(--shadow-md), 0 0 0 1px var(--hairline);
  animation: heroIn 520ms var(--ease-out) both;
}
.login-hero .logo img { width: 100%; height: 100%; object-fit: cover; display: block; }
.login-hero h1 {
  font-size: var(--fs-display);
  font-weight: 700;
  letter-spacing: -0.4px;
  line-height: 1.25;
}
.login-hero p {
  color: var(--text-muted);
  margin-top: var(--s2);
  font-size: var(--fs-sm);
}
@keyframes heroIn {
  from { opacity: 0; transform: translateY(-8px) scale(0.92); }
}
.login-form { padding: var(--s2) var(--s5) calc(var(--s6) + env(safe-area-inset-bottom)); }
.login-form .list { margin-bottom: var(--s4); }
.login-form .btn-primary { margin-top: var(--s2); }

/* ---------- 6. 卡片 / 表单字段 ---------- */
.card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--r-lg);
  overflow: hidden;
  box-shadow: var(--shadow-sm);
  margin-bottom: var(--s4);
}
.field {
  display: flex; align-items: center; gap: var(--s3);
  padding: 14px var(--s4);
  border-bottom: 1px solid var(--hairline);
  transition: background var(--t-fast);
}
.field:last-child { border-bottom: none; }
.field:focus-within { background: var(--accent-weak); }
.field-icon { font-size: 16px; color: var(--text-muted); transition: color var(--t-fast); }
.field:focus-within .field-icon { color: var(--accent); }
.field label {
  color: var(--text-muted);
  min-width: 56px;
  font-size: var(--fs-sm);
  white-space: nowrap;
}
.field input,
.field select {
  flex: 1; min-width: 0;
  border: none; background: none;
  color: var(--text);
  font-size: 16px;                 /* 16px: 防 iOS 聚焦自动放大 */
  outline: none;
}
.field input::placeholder { color: var(--text-muted); }
.field select { text-align: right; }
.field input[type="number"] { text-align: right; }
.field input[type="checkbox"] { flex: none; }

/* ---------- 7. 按钮 ---------- */
.btn-primary {
  display: inline-flex; align-items: center; justify-content: center;
  width: 100%; min-height: 46px; padding: 12px 18px;
  border: none; border-radius: var(--r-md);
  background: linear-gradient(180deg,
    color-mix(in srgb, var(--accent) 90%, #fff) 0%, var(--accent) 100%);
  color: var(--on-accent);
  font-size: var(--fs-body); font-weight: 650; letter-spacing: 0.2px;
  box-shadow: 0 1px 2px rgba(16, 18, 27, 0.10), inset 0 1px 0 rgba(255, 255, 255, 0.18);
  -webkit-user-select: none; user-select: none;
  transition: transform var(--t-fast), box-shadow var(--t-fast),
    filter var(--t-fast), opacity var(--t-fast);
}
.btn-primary:hover:not(:disabled) { filter: brightness(1.05); box-shadow: var(--shadow-md); }
.btn-primary:active:not(:disabled) {
  transform: scale(0.985);
  filter: brightness(0.96);
  box-shadow: var(--shadow-xs);
}
.btn-primary:disabled { opacity: 0.5; filter: none; box-shadow: none; }

.btn-ghost {
  display: inline-flex; align-items: center; justify-content: center;
  width: 100%; min-height: 44px; padding: 11px 16px;
  margin-top: var(--s3);
  border: 1px solid var(--border);
  border-radius: var(--r-md);
  background: var(--surface);
  color: var(--text-2);
  font-size: var(--fs-body); font-weight: 500;
  box-shadow: var(--shadow-xs);
  transition: background var(--t-fast), border-color var(--t-fast),
    color var(--t-fast), transform var(--t-fast);
}
.btn-ghost:hover:not(:disabled) {
  background: var(--surface-2);
  border-color: var(--border-strong);
  color: var(--text);
}
.btn-ghost:active:not(:disabled) { transform: scale(0.99); background: var(--surface-2); }
.btn-ghost:disabled { opacity: 0.5; }

.mini-btn {
  flex-shrink: 0;
  display: inline-flex; align-items: center; justify-content: center;
  border: 1px solid var(--accent);
  border-radius: var(--r-sm);
  background: var(--accent);
  color: var(--on-accent);
  padding: 8px 14px;
  font-size: var(--fs-sm); font-weight: 600;
  box-shadow: var(--shadow-xs);
  transition: background var(--t-fast), transform var(--t-fast), filter var(--t-fast);
}
.mini-btn:hover { filter: brightness(1.06); }
.mini-btn:active { transform: scale(0.97); filter: brightness(0.95); }

/* ---------- 8. 顶栏 ---------- */
.top-bar {
  flex-shrink: 0;
  position: sticky; top: 0; z-index: 5;
  display: flex; align-items: center; gap: var(--s2);
  min-height: 56px;
  padding: calc(env(safe-area-inset-top) + 10px) var(--s4) 10px;
  background: color-mix(in srgb, var(--bg) 82%, transparent);
  backdrop-filter: saturate(180%) blur(18px);
  -webkit-backdrop-filter: saturate(180%) blur(18px);
  border-bottom: 1px solid var(--hairline);
}
.top-bar h1 {
  flex: 1; min-width: 0;
  font-size: var(--fs-h1); font-weight: 700; letter-spacing: -0.3px;
  overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}
.icon-btn {
  flex: none;
  display: inline-flex; align-items: center; gap: 2px;
  min-height: 34px; padding: 0 10px; margin-left: -8px;
  border-radius: var(--r-sm);
  color: var(--accent);
  font-size: var(--fs-sm); font-weight: 600;
  transition: background var(--t-fast), transform var(--t-fast), opacity var(--t-fast);
}
.icon-btn:hover { background: var(--accent-weak); }
.icon-btn:active { transform: scale(0.96); background: var(--accent-weak-2); }
.icon-btn.save { margin-left: auto; margin-right: -8px; }

.scroll {
  flex: 1; min-height: 0; overflow-y: auto;
  overscroll-behavior-y: contain;
  -webkit-overflow-scrolling: touch;
  padding: var(--s4) var(--s4) calc(var(--tabbar-h) + env(safe-area-inset-bottom) + var(--s6));
}
.section-label {
  display: flex; align-items: center; gap: var(--s2);
  color: var(--text-muted);
  font-size: var(--fs-xs);
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.7px;
  margin: var(--s2) var(--s1) var(--s2);
}

/* Explicit, read-only unsigned attendance results above the course list. */
.unsigned-results { margin-bottom: var(--s5); }
.unsigned-status {
  padding: var(--s3) var(--s4); border: 1px solid var(--border);
  border-radius: var(--r-md); background: var(--surface);
  color: var(--text); font-size: var(--fs-sm); overflow-wrap: anywhere;
}
.unsigned-status.is-partial, .unsigned-warning { color: var(--warn); }
.unsigned-status.is-error { color: var(--danger); }
.unsigned-meta { margin: var(--s2) 2px; color: var(--text-muted); font-size: var(--fs-xs); }
.unsigned-warning {
  margin: var(--s2) 2px var(--s3); font-size: var(--fs-sm); overflow-wrap: anywhere;
}
.unsigned-list li { padding: 0; }
.unsigned-course {
  width: 100%; min-width: 0; min-height: 44px; padding: var(--s4);
  display: flex; flex-direction: column; align-items: flex-start; gap: var(--s2);
  text-align: left; overflow-wrap: anywhere;
}
.unsigned-course b { font-size: var(--fs-body); }
.unsigned-activity { font-size: var(--fs-sm); color: var(--text-2); }
.unsigned-link { color: var(--accent); font-size: var(--fs-sm); }

/* ---------- 9. 列表 / 徽标 ---------- */
.list {
  list-style: none;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--r-lg);
  overflow: hidden;
  box-shadow: var(--shadow-sm);
}
.list li {
  display: flex; align-items: center; gap: var(--s3);
  padding: 14px var(--s4);
  border-bottom: 1px solid var(--hairline);
  transition: background var(--t-fast);
}
.list li:last-child { border-bottom: none; }
.list li:active { background: var(--surface-2); }
.list li .li-icon {
  width: 34px; height: 34px; flex-shrink: 0;
  border-radius: var(--r-md);
  background: var(--accent-weak);
  color: var(--accent);
  display: flex; align-items: center; justify-content: center;
  font-size: 15px; font-weight: 700;
  transition: transform var(--t-fast), background var(--t-fast), color var(--t-fast);
}
.list li:active .li-icon { transform: scale(0.92); }
.list li .li-text { flex: 1; min-width: 0; font-size: var(--fs-body); overflow-wrap: anywhere; }
.list li .chev {
  flex: none; color: var(--text-muted); font-size: 18px; line-height: 1;
  opacity: 0.75;
}
.chev svg { vertical-align: middle; }

.badge, .badge-ok, .badge-warn, .badge-check, .badge-muted {
  display: inline-flex; align-items: center; gap: 5px;
  flex-shrink: 0;
  padding: 3px 9px;
  border-radius: var(--r-full);
  font-size: var(--fs-2xs); font-weight: 600;
  letter-spacing: 0.2px; line-height: 1.45;
  white-space: nowrap;
}
.badge { color: var(--danger); background: var(--danger-weak); }
.badge-ok { color: var(--ok); background: var(--ok-weak); }
.badge-warn { color: var(--warn); background: var(--warn-weak); }
.badge-check { color: var(--text-muted); background: var(--surface-2); }
.badge-muted { color: var(--text-muted); background: var(--surface-2); }

/* 检测中小圆点转圈 */
.dot-spin {
  width: 9px; height: 9px; border-radius: 50%;
  border: 1.5px solid var(--border-strong);
  border-top-color: var(--text-muted);
  animation: spin 0.7s linear infinite;
}

/* ---------- 10. 课程详情 / 待签到卡片 ---------- */
.pending-box {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--r-lg);
  padding: var(--s4);
  margin-bottom: var(--s3);
  box-shadow: var(--shadow-sm);
  transition: box-shadow var(--t), border-color var(--t), transform var(--t);
}
.pending-box .head {
  display: flex; align-items: center; gap: var(--s2);
  margin-bottom: var(--s2);
}
.pending-box h3 {
  flex: 1; min-width: 0;
  font-size: var(--fs-body); font-weight: 650;
  overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}
.pending-box .meta { color: var(--text-muted); font-size: var(--fs-sm); margin: 2px 0; }
.pending-box .btn-primary { margin-top: var(--s3); }

.empty {
  text-align: center; color: var(--text-muted);
  margin-top: var(--s8); font-size: var(--fs-sm);
}
.spinner {
  width: 24px; height: 24px;
  margin: var(--s8) auto var(--s3);
  display: block;
  border: 2.5px solid var(--border);
  border-top-color: var(--accent);
  border-radius: 50%;
  animation: spin 0.7s linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }

/* ---------- 11. 底部 Tab Bar ---------- */
.tab-bar {
  flex-shrink: 0;
  display: flex; align-items: stretch;
  gap: var(--s1);
  padding: 6px var(--s2) calc(6px + env(safe-area-inset-bottom));
  background: color-mix(in srgb, var(--bg) 88%, transparent);
  backdrop-filter: saturate(180%) blur(18px);
  -webkit-backdrop-filter: saturate(180%) blur(18px);
  border-top: 1px solid var(--hairline);
}
.tab-btn {
  flex: 1;
  display: flex; flex-direction: column; align-items: center; justify-content: center;
  gap: 3px;
  height: calc(var(--tabbar-h) - 12px);
  border-radius: var(--r-md);
  color: var(--text-muted);
  font-size: var(--fs-2xs); font-weight: 600; letter-spacing: 0.2px;
  transition: color var(--t-fast), background var(--t-fast);
}
.tab-btn .ti {
  display: flex; align-items: center; justify-content: center;
  width: 48px; height: 28px;
  border-radius: var(--r-full);
  transition: background var(--t), transform var(--t);
}
.tab-btn:hover { color: var(--text-2); }
.tab-btn.active { color: var(--accent); }
.tab-btn.active .ti { background: var(--accent-weak); transform: translateY(-1px); }

/* ---------- 12. 分段控件 ---------- */
.seg {
  display: inline-flex; flex-shrink: 0;
  margin-left: auto; padding: 3px; gap: 2px;
  background: var(--surface-2);
  border: 1px solid var(--border);
  border-radius: var(--r-full);
}
.seg-btn {
  border: none; background: none;
  color: var(--text-2);
  font-size: 12.5px; font-weight: 600; line-height: 1;
  padding: 7px 12px;
  border-radius: var(--r-full);
  transition: background var(--t-fast), color var(--t-fast), box-shadow var(--t-fast);
}
.seg-btn:hover { color: var(--text); }
.seg-btn.active {
  background: var(--surface);
  color: var(--accent);
  box-shadow: var(--shadow-sm);
}

/* ---------- 13. 弹窗 / 选择器 / Toast ---------- */
.modal-overlay {
  display: none;
  position: fixed; inset: 0; z-index: 100;
  align-items: center; justify-content: center;
  padding: var(--s5);
  background: rgba(10, 10, 14, 0.48);
  backdrop-filter: blur(4px);
  -webkit-backdrop-filter: blur(4px);
  animation: fade var(--t);
}
.modal-overlay.active { display: flex; }
@keyframes fade { from { opacity: 0; } }

.modal {
  width: 100%; max-width: 340px;
  max-height: calc(var(--app-height, 100dvh) - 40px - env(safe-area-inset-top) - env(safe-area-inset-bottom));
  display: flex; flex-direction: column;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--r-xl);
  overflow: hidden;
  box-shadow: var(--shadow-xl);
  animation: pop var(--t) var(--ease-out);
}
@keyframes pop { from { transform: scale(0.95); opacity: 0; } }
.modal h2 {
  flex-shrink: 0;
  font-size: 17px; font-weight: 650;
  margin: var(--s5) var(--s5) var(--s2);
  text-align: center;
}
.modal p {
  min-height: 0; overflow-y: auto; overflow-wrap: anywhere;
  font-size: var(--fs-sm); color: var(--text-2);
  margin: 0 var(--s5) var(--s5);
  text-align: center; white-space: pre-line; line-height: 1.6;
}
.modal-map {
  min-height: 80px; flex-shrink: 1;
  height: 160px;
  margin: 0 var(--s4) var(--s4);
  border-radius: var(--r-md);
  overflow: hidden;
  background: var(--surface-2);
  position: relative;
}
.modal-actions { display: flex; flex-shrink: 0; border-top: 1px solid var(--hairline); }
.modal-btn {
  flex: 1; padding: 14px;
  color: var(--text-2); font-size: var(--fs-body); font-weight: 500;
  transition: background var(--t-fast);
}
.modal-btn:hover { background: var(--surface-2); }
.modal-btn:active { background: var(--surface-2); }
.modal-btn.primary {
  font-weight: 650; color: var(--accent);
  border-left: 1px solid var(--hairline);
}

.toast {
  position: fixed; left: 50%;
  bottom: calc(env(safe-area-inset-bottom) + 84px);
  transform: translateX(-50%) translateY(14px);
  max-width: 82%;
  padding: 11px 18px;
  background: rgba(24, 24, 27, 0.94);
  color: #fafafa;
  border: 1px solid rgba(255, 255, 255, 0.10);
  border-radius: var(--r-full);
  font-size: var(--fs-sm);
  text-align: center;
  box-shadow: var(--shadow-lg);
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
  opacity: 0;
  transition: opacity var(--t), transform var(--t);
  pointer-events: none;
  z-index: 200;
}
.toast.show { opacity: 1; transform: translateX(-50%) translateY(0); }

/* 底部选择器 Sheet */
.sheet {
  width: 100%; max-width: 460px;
  max-height: calc(var(--app-height, 100dvh) * 0.84);
  display: flex; flex-direction: column;
  margin: auto 0 0;
  padding: var(--s3) var(--s4) calc(var(--s4) + env(safe-area-inset-bottom));
  background: var(--surface);
  border-top: 1px solid var(--border);
  border-radius: var(--r-xl) var(--r-xl) 0 0;
  box-shadow: var(--shadow-xl);
  animation: sheetup var(--t) var(--ease-out);
}
@keyframes sheetup { from { transform: translateY(28px); opacity: 0; } }
.sheet::before {
  content: ""; display: block;
  width: 38px; height: 4px; margin: 0 auto var(--s3);
  border-radius: var(--r-full);
  background: var(--border-strong);
}
#picker.modal-overlay { align-items: flex-end; padding: 0; }
.sheet h2 {
  font-size: var(--fs-body); font-weight: 650;
  text-align: center; margin-bottom: var(--s3);
}
.sheet .list { min-height: 0; overflow-y: auto; box-shadow: none; }
.sheet-cancel {
  flex-shrink: 0;
  border: 1px solid var(--border);
  border-radius: var(--r-md);
  padding: 12px; margin-top: var(--s3);
  background: var(--surface);
  color: var(--text-2);
  font-size: var(--fs-body); font-weight: 500;
  transition: background var(--t-fast), transform var(--t-fast);
}
.sheet-cancel:hover { background: var(--surface-2); }
.sheet-cancel:active { transform: scale(0.99); background: var(--surface-2); }
.sheet-add {
  flex-shrink: 0;
  margin-top: var(--s3);
  min-height: 46px;
  padding: 12px;
  border: none;
  border-radius: var(--r-md);
  background: var(--accent);
  color: var(--on-accent);
  font-size: var(--fs-body); font-weight: 650;
  box-shadow: var(--shadow-xs);
  transition: filter var(--t-fast), transform var(--t-fast);
}
.sheet-add:hover { filter: brightness(1.06); }
.sheet-add:active { transform: scale(0.99); filter: brightness(0.95); }
.picker-item.current .li-text { color: var(--accent); font-weight: 600; }
.picker-item .chev { color: var(--accent); }

/* ---------- 14. 位置管理 ---------- */
.addr-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--r-lg);
  padding: var(--s4);
  margin-bottom: var(--s3);
  box-shadow: var(--shadow-sm);
  transition: box-shadow var(--t), border-color var(--t);
}
.addr-card .ac-top { display: flex; align-items: center; gap: var(--s2); }
.addr-card .ac-title { flex: 1; font-size: var(--fs-body); font-weight: 650; }
.addr-card .ac-line { color: var(--text-muted); font-size: var(--fs-sm); margin-top: var(--s1); }
.addr-card .ac-actions { display: flex; gap: var(--s2); margin-top: var(--s3); }
.addr-card .ac-actions button {
  flex: 1;
  padding: 9px;
  border: 1px solid var(--border);
  border-radius: var(--r-sm);
  background: var(--surface);
  color: var(--text-2);
  font-size: var(--fs-sm); font-weight: 500;
  transition: background var(--t-fast), border-color var(--t-fast), transform var(--t-fast);
}
.addr-card .ac-actions button:hover { background: var(--surface-2); border-color: var(--border-strong); }
.addr-card .ac-actions button:active { transform: scale(0.98); background: var(--surface-2); }
.addr-card .ac-actions .del { color: var(--danger); }

.addr-empty {
  text-align: center; color: var(--text-muted);
  font-size: var(--fs-sm);
  padding: var(--s8) 0;
  line-height: 1.7;
  white-space: pre-line;
}
.search-poi .li-text b { display: block; font-size: 14px; font-weight: 650; }
.search-poi .li-text small { color: var(--text-muted); font-size: 12.5px; }

/* 课程详情里的当前地址行 */
.addr-picker-row {
  display: flex; align-items: center; gap: var(--s2);
  padding: 12px var(--s4);
  margin-bottom: var(--s3);
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--r-lg);
  box-shadow: var(--shadow-sm);
  cursor: pointer;
  transition: background var(--t-fast), border-color var(--t-fast), transform var(--t-fast);
}
.addr-picker-row:hover { border-color: var(--border-strong); }
.addr-picker-row:active { transform: scale(0.995); background: var(--surface-2); }
.addr-picker-row .apr-label { color: var(--text-muted); font-size: 12.5px; }
.addr-picker-row .apr-val {
  flex: 1; font-size: 14px; font-weight: 500;
  margin-top: 2px;
  overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}
.addr-picker-row .chev { color: var(--accent); font-size: 13px; }

/* ---------- 15. 地点搜索 / 地图 ---------- */
.search-wrap { position: relative; margin-bottom: var(--s4); }
.search-wrap > .card { margin-bottom: 0; }
.search-dropdown {
  position: absolute; top: calc(100% + 6px); left: 0; right: 0; z-index: 30;
  max-height: 46vh; overflow-y: auto;
  -webkit-overflow-scrolling: touch;
  box-shadow: var(--shadow-lg);
}

.map-wrap { position: relative; margin-bottom: var(--s4); }
.map-box {
  width: 100%; height: 240px;
  border: 1px solid var(--border);
  border-radius: var(--r-lg);
  overflow: hidden;
  background: var(--surface);
  box-shadow: var(--shadow-sm);
}
.map-static { width: 100%; height: 100%; object-fit: cover; display: block; }
.map-hint {
  display: flex; align-items: center; justify-content: center;
  height: 100%; padding: var(--s4);
  text-align: center;
  color: var(--text-muted); font-size: var(--fs-sm);
}
.map-locate { position: absolute; right: 12px; bottom: 12px; box-shadow: var(--shadow-md); }
.map-pin {
  position: absolute; left: 50%; top: 50%; z-index: 20;
  transform: translate(-50%, -100%);
  line-height: 0;
  color: var(--danger);
  pointer-events: none;
  filter: drop-shadow(0 2px 3px rgba(0, 0, 0, 0.35));
}
.map-pin svg {
  width: 30px; height: 30px; display: block;
  fill: var(--danger); stroke: #fff; stroke-width: 1.6;
}
.map-pin-hint {
  position: absolute; left: 50%; top: 10px; z-index: 20;
  transform: translateX(-50%);
  white-space: nowrap; pointer-events: none;
  padding: 4px 12px;
  background: color-mix(in srgb, var(--surface) 90%, transparent);
  color: var(--text-2);
  border: 1px solid var(--border);
  border-radius: var(--r-full);
  font-size: var(--fs-xs);
  box-shadow: var(--shadow-sm);
}

/* ---------- 16. 跨设备扫码签到 (qr.html) ---------- */
.qr-page {
  padding: var(--s6) var(--s5) calc(var(--s6) + env(safe-area-inset-bottom));
  background:
    radial-gradient(110% 70% at 50% 0%,
      color-mix(in srgb, var(--accent) 7%, transparent) 0%, transparent 55%),
    var(--bg);
}
.qr-stage { display: none; }
.qr-stage.active { display: block; animation: paneIn var(--t) var(--ease-out); }
/* QR 页内复用品牌头时，去掉顶部留白与背景光晕，贴合页面内边距 */
.qr-page .login-hero { padding: 0 var(--s2) var(--s5); background: none; }
.qr-page .login-hero .logo { width: 56px; height: 56px; border-radius: var(--r-lg); }
.qr-identity { margin: var(--s2) 0 var(--s6); }
.qr-id-row {
  display: flex; justify-content: space-between; align-items: center;
  padding: 14px var(--s4);
  border-bottom: 1px solid var(--hairline);
}
.qr-id-row:last-child { border-bottom: none; }
.qr-id-label { color: var(--text-muted); font-size: var(--fs-sm); }
.qr-id-val { font-size: 17px; font-weight: 650; letter-spacing: 0.5px; }

.scanner-wrap {
  position: relative;
  width: 100%; aspect-ratio: 1 / 1; max-width: 420px;
  margin: var(--s2) auto 0;
  background: #000;
  border-radius: var(--r-xl);
  overflow: hidden;
  box-shadow: var(--shadow-lg);
}
.scanner-video { width: 100%; height: 100%; object-fit: cover; display: block; }
.scanner-frame {
  position: absolute; inset: 18%;
  border: 2px solid rgba(255, 255, 255, 0.85);
  border-radius: var(--r-lg);
  box-shadow: 0 0 0 100vmax rgba(0, 0, 0, 0.42);
  overflow: hidden;
}
.scanner-line {
  position: absolute; left: 0; right: 0; height: 2px;
  background: var(--accent);
  box-shadow: 0 0 10px var(--accent);
  animation: scanline 2s ease-in-out infinite;
}
@keyframes scanline { 0% { top: 4%; } 50% { top: 96%; } 100% { top: 4%; } }
.scanner-tip {
  text-align: center; color: var(--text-muted);
  margin: var(--s4) 0; font-size: var(--fs-sm);
}
.qr-result-icon {
  font-size: 60px; text-align: center;
  margin: var(--s8) 0 var(--s2);
  color: var(--ok);
}
.qr-result-icon.err { color: var(--danger); }
.qr-result-icon svg { width: 60px; height: 60px; }
#qr-result { text-align: center; }
#qr-result h1 { margin: var(--s2) 0; font-size: 20px; font-weight: 700; }

/* 生成链接页(主程序内) */
.qrshare-actions { display: flex; align-items: center; gap: var(--s3); padding: var(--s1) 2px; }
.qrshare-ttl { color: var(--text-muted); font-size: 12.5px; }
#qrshare-url { font-size: var(--fs-sm); }

/* ---------- 17. 账号 / 只读信息 ---------- */
.acc-v {
  flex: 1; min-width: 0;
  color: var(--text); font-size: var(--fs-body);
  overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}
.acc-eye {
  flex: none;
  display: inline-flex; align-items: center; justify-content: center;
  width: 30px; height: 30px;
  margin-right: -6px;
  border-radius: var(--r-sm);
  color: var(--text-muted);
  font-size: 17px; line-height: 1;
  transition: color var(--t-fast), background var(--t-fast);
}
.acc-eye:hover { color: var(--text-2); background: var(--surface-2); }
.account-item .li-text b { display: block; font-size: var(--fs-body); font-weight: 650; }
.account-item .li-text small { color: var(--text-muted); font-size: 12.5px; }
.account-item .acc-del {
  flex: none;
  display: inline-flex; align-items: center; justify-content: center;
  padding: 0 var(--s2);
  color: var(--text-muted); font-size: 14px;
  transition: color var(--t-fast);
}
.account-item .acc-del:hover { color: var(--danger); }
.account-item .acc-del svg { width: 16px; height: 16px; }

/* ---------- 18. 学习通刷课 ---------- */
.study-select {
  flex: 1; min-width: 0;
  border: none; background: transparent;
  color: var(--text); font-size: 16px;
  text-align: right; outline: none;
}
.study-check {
  display: flex; align-items: center; gap: var(--s2);
  padding: 12px var(--s4);
  border-top: 1px solid var(--hairline);
  font-size: var(--fs-sm); color: var(--text-2);
  cursor: pointer;
}
.study-check input {
  width: 18px; height: 18px;
  accent-color: var(--accent);
  cursor: pointer;
}
.study-bar {
  height: 8px;
  border-radius: var(--r-full);
  background: var(--surface-2);
  overflow: hidden;
  margin: var(--s2) 0 var(--s3);
}
.study-bar-fill {
  height: 100%; width: 0;
  border-radius: var(--r-full);
  background: linear-gradient(90deg, var(--accent), color-mix(in srgb, var(--accent) 62%, #7dd3fc));
  transition: width 0.4s var(--ease);
}
.study-log {
  max-height: 220px; overflow: auto;
  white-space: pre-wrap; word-break: break-all;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--r-md);
  padding: var(--s3);
  font-size: var(--fs-xs); line-height: 1.65;
  color: var(--text-2);
  font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
}

/* 刷课主页: 检测概况 */
.scan-summary {
  display: flex; align-items: center; flex-wrap: wrap; gap: var(--s2);
  padding: 11px var(--s4);
  margin-bottom: var(--s4);
  border: 1px solid var(--border);
  border-radius: var(--r-md);
  background: var(--surface);
  box-shadow: var(--shadow-sm);
  font-size: var(--fs-sm); color: var(--text-2);
}
.scan-summary b { color: var(--text); font-weight: 700; }
.scan-summary.has-pending {
  border-color: color-mix(in srgb, var(--warn) 40%, var(--border));
  background: color-mix(in srgb, var(--warn-weak) 60%, var(--surface));
}
.scan-summary.has-pending b { color: var(--warn); }
.scan-summary.all-done {
  border-color: color-mix(in srgb, var(--ok) 36%, var(--border));
  background: color-mix(in srgb, var(--ok-weak) 55%, var(--surface));
  color: var(--ok); font-weight: 600;
}
.scan-summary.has-error {
  border-color: color-mix(in srgb, var(--danger) 38%, var(--border));
  background: color-mix(in srgb, var(--danger-weak) 55%, var(--surface));
  color: var(--danger);
}
.scan-summary.has-error b { color: var(--danger); }
.ss-spin {
  width: 15px; height: 15px; flex-shrink: 0;
  border-radius: 50%;
  border: 2px solid var(--border);
  border-top-color: var(--accent);
  animation: spin 0.7s linear infinite;
}
.scan-summary .ss-updating { display: inline-flex; align-items: center; gap: 5px; color: var(--text-muted); }
.scan-summary .ss-updating .ss-spin { width: 12px; height: 12px; border-width: 2px; }
.scan-summary .ss-meta { color: var(--text-muted); }

/* 分组标题带计数 */
.study-group-label { display: flex; align-items: center; gap: var(--s2); }
.study-group-label .grp-count {
  color: var(--text-muted);
  background: var(--surface-2);
  border-radius: var(--r-full);
  padding: 0 7px;
  font-size: var(--fs-2xs); font-weight: 700;
  letter-spacing: 0; text-transform: none;
}
.study-course-item.is-done { opacity: 0.66; }
.study-course-item.is-done .li-icon { background: var(--surface-2); color: var(--text-muted); }
.study-course-item .row-title { display: block; font-size: var(--fs-body); }
.study-course-item .row-title, .study-course-item .course-name {
  display: -webkit-box;
  -webkit-box-orient: vertical;
  -webkit-line-clamp: 3;
  overflow: hidden;
}
.study-course-item .row-err {
  display: block; margin-top: 3px;
  color: var(--danger);
  font-size: var(--fs-xs); line-height: 1.45;
  white-space: normal; word-break: break-all;
}
.study-course-item .row-remain {
  display: block; margin-top: 3px;
  color: var(--warn);
  font-size: 12.5px; font-weight: 600;
}

/* 暂无待刷课程 空状态 */
.study-empty {
  text-align: center;
  padding: var(--s8) var(--s5);
  margin-bottom: var(--s4);
  border: 1px dashed var(--border-strong);
  border-radius: var(--r-lg);
  background: var(--surface);
}
.study-empty .se-emoji {
  width: 46px; height: 46px;
  margin: 0 auto var(--s3);
  border-radius: var(--r-full);
  display: flex; align-items: center; justify-content: center;
  background: var(--ok-weak); color: var(--ok);
  font-size: 22px; font-weight: 700;
}
.study-empty .se-emoji svg { width: 24px; height: 24px; }
.study-empty .se-title { font-size: var(--fs-h2); font-weight: 700; color: var(--text); }
.study-empty .se-sub { font-size: var(--fs-sm); color: var(--text-muted); margin-top: var(--s2); }

/* --- DeepSeek 状态框 + 前往配置 --- */
#study-deepseek.ds-available { border-color: color-mix(in srgb, var(--ok) 32%, var(--border)); }
#study-deepseek.ds-unavailable { border-color: color-mix(in srgb, var(--warn) 32%, var(--border)); }
.link-config {
  display: inline-block;
  margin-top: var(--s2);
  color: var(--accent);
  font-size: var(--fs-sm); font-weight: 600;
  text-decoration: none; cursor: pointer;
  transition: opacity var(--t-fast);
}
.link-config:hover { opacity: 0.8; text-decoration: underline; }
.link-config:active { opacity: 0.6; }

/* 跳转后高亮 DeepSeek 密钥卡片 */
@keyframes flashFocus {
  0%   { box-shadow: 0 0 0 0 var(--accent-ring); border-color: var(--accent); }
  100% { box-shadow: 0 0 0 6px transparent; border-color: var(--border); }
}
.flash-focus { animation: flashFocus 1.5s ease-out; border-color: var(--accent); }

/* ---------- 19. 状态 / 辅助 ---------- */
.status-err { color: var(--danger); }
.hint {
  color: var(--text-muted);
  font-size: 12.5px;
  text-align: center;
  margin-top: var(--s4);
  line-height: 1.65;
}
.hint b { color: var(--text-2); font-weight: 600; }
.meta svg { width: 15px; height: 15px; vertical-align: -2px; }

/* ---------- 20a. 皮肤结构差异 ----------
   仅做"形态"层面的少量差异, 不改任何布局顺序与功能入口。 */
/* sunset: 悬浮胶囊底栏 / 胶囊主按钮 / 圆形列表图标 / 更暖的品牌头光晕 */
[data-skin="sunset"] .tab-bar {
  margin: 0 var(--s3) calc(var(--s2) + env(safe-area-inset-bottom));
  padding: 6px;
  border: 1px solid var(--border);
  border-radius: var(--r-xl);
  background: var(--surface);
  box-shadow: var(--shadow-md);
  backdrop-filter: none;
  -webkit-backdrop-filter: none;
}
[data-skin="sunset"] .btn-primary,
[data-skin="sunset"] .sheet-add,
[data-skin="sunset"] .mini-btn { border-radius: var(--r-full); }
[data-skin="sunset"] .list li .li-icon { border-radius: var(--r-full); }
[data-skin="sunset"] .login-hero {
  background:
    radial-gradient(120% 90% at 50% 0%,
      color-mix(in srgb, var(--accent) 12%, transparent) 0%, transparent 62%);
}

/* graphite: 下划线式选中 / 纯色主按钮 / 去阴影(边框优先) */
[data-skin="graphite"] .tab-btn.active {
  color: var(--text);
  background: var(--surface);
  box-shadow: inset 0 0 0 1px var(--border-strong);
}
[data-skin="graphite"] .tab-btn.active .ti { background: transparent; transform: none; }
[data-skin="graphite"] .btn-primary { background: var(--accent); box-shadow: none; }
[data-skin="graphite"] .card,
[data-skin="graphite"] .list,
[data-skin="graphite"] .pending-box,
[data-skin="graphite"] .addr-card,
[data-skin="graphite"] .scan-summary,
[data-skin="graphite"] .study-log { box-shadow: none; }
[data-skin="graphite"] .login-hero {
  background:
    radial-gradient(120% 90% at 50% 0%,
      color-mix(in srgb, var(--accent) 6%, transparent) 0%, transparent 62%);
}

/* ---------- 20. 指针设备增强 / 响应式 / 无障碍 ---------- */
@media (hover: hover) {
  .list li:not(.account-item):hover { background: var(--surface-2); }
  .pending-box:hover { box-shadow: var(--shadow-md); }
  .addr-card:hover { box-shadow: var(--shadow-md); }
  .kami-item:hover { box-shadow: var(--shadow-md); border-color: var(--border); }
  .seg-btn { cursor: pointer; }
}

/* 小屏(<=380px)：收紧间距，避免挤压/溢出 */
@media (max-width: 380px) {
  .login-hero { padding-top: calc(env(safe-area-inset-top) + 46px); }
  .login-hero h1 { font-size: 22px; }
  .login-form { padding-left: var(--s4); padding-right: var(--s4); }
  .top-bar { padding-left: var(--s3); padding-right: var(--s3); }
  .scroll { padding-left: var(--s3); padding-right: var(--s3); }
  .field { padding-left: var(--s3); padding-right: var(--s3); }
  .seg-btn { padding: 6px 9px; font-size: 11.5px; }
  .icon-btn { padding: 0 8px; }
}

@media (prefers-reduced-motion: reduce) {
  * { animation-duration: 0.001ms !important; transition-duration: 0.001ms !important; }
}

/* =============================================================
   卡密系统: 用户激活页 + 管理员管理页
   ============================================================= */
.kami-status { display: flex; flex-direction: column; gap: 5px; }
.kami-status-head { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.kami-status-head b { font-size: var(--fs-body); word-break: break-all; }
.kami-meta { font-size: var(--fs-sm); color: var(--text-muted); word-break: break-all; }
.kami-meta code, .kami-row code, .kami-item code {
  font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  font-size: var(--fs-sm);
  color: var(--text-2);
}
.kami-status .badge, .kami-status .badge-ok, .kami-status .badge-warn,
.kami-status .badge-check, .kami-status .badge-muted { flex: none; }

.kami-result { margin-top: var(--s3); }
.kami-result-head {
  display: flex; align-items: center; justify-content: space-between;
  gap: var(--s2); margin-bottom: var(--s2);
}
.kami-code {
  margin: 0; padding: var(--s3);
  background: var(--surface-2); border-radius: var(--r-sm);
  font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  font-size: var(--fs-xs); line-height: 1.6; color: var(--text-2);
  white-space: pre-wrap; word-break: break-all;
  max-height: 240px; overflow: auto;
}

/* 卡密管理: 紧凑操作区与可折叠面板 */
.admin-quick-actions {
  display: flex; gap: var(--s2); margin-bottom: var(--s3);
}
.admin-quick-actions .btn-primary,
.admin-quick-actions .btn-ghost {
  width: auto; min-height: 38px; margin: 0; padding: 8px 14px;
  font-size: var(--fs-sm); box-shadow: var(--shadow-xs);
}
.quick-count {
  min-width: 19px; padding: 1px 5px; border-radius: 10px;
  background: var(--surface-2); color: var(--text-muted); font-size: var(--fs-2xs);
}
.collapsible-section { margin-bottom: var(--s3); }
.compact-card { margin-bottom: var(--s2); }
.compact-card .btn-primary { margin-top: var(--s2); }
.admin-card-browser { margin-top: var(--s2); }
.section-head.compact {
  display: flex; align-items: center; justify-content: space-between;
  gap: var(--s2); margin-bottom: var(--s2);
}
.section-head.compact .section-label { margin: 0; }
.section-total { color: var(--text-muted); font-weight: 400; font-size: var(--fs-xs); }
.card-filter {
  flex-wrap: nowrap; overflow-x: auto; margin-bottom: var(--s2);
  scrollbar-width: none;
}
.card-filter::-webkit-scrollbar { display: none; }
.card-filter .seg-btn { white-space: nowrap; min-width: max-content; }
.card-filter .seg-btn b { margin-left: 2px; font-size: var(--fs-2xs); }
.admin-search { margin-bottom: var(--s2); }
.admin-selection-bar { margin: 4px 0 6px; padding: 0 2px; }
.bulk-actions {
  align-items: center; flex-wrap: wrap; gap: var(--s2);
  margin-bottom: var(--s2); padding: var(--s2);
  background: var(--surface-2); border-radius: var(--r-md);
}
.admin-list-footer { display: flex; justify-content: center; margin-top: var(--s3); }
.admin-list-footer .btn-ghost {
  width: auto; min-height: 34px; margin: 0; padding: 6px 12px;
  color: var(--danger); font-size: var(--fs-sm); box-shadow: none;
}
.kami-card-head { flex-wrap: nowrap; }
.kami-card-head .kami-select { flex: none; }
.kami-account { flex: 1; min-width: 0; overflow-wrap: anywhere; }
.kami-card-info {
  display: flex; flex-direction: column; gap: 5px;
  margin: var(--s2) 0 0 26px;
  font-size: var(--fs-sm);
  overflow-wrap: anywhere;
}
/* 标签 / 值 两列对齐, 读起来更整齐精致 */
.kami-card-info .ki-line { display: flex; align-items: baseline; gap: var(--s2); }
.kami-card-info .ki-k {
  flex: none; width: 52px;
  color: var(--text-muted); font-size: var(--fs-xs);
}
.kami-card-info .ki-v { flex: 1; min-width: 0; color: var(--text-2); }
.kami-card-info .ki-online { color: var(--ok); font-weight: 600; }
.kami-card-info .ki-muted { color: var(--text-muted); }
.kami-actions {
  justify-content: flex-start; border-top: 1px solid var(--hairline);
  padding-top: var(--s2);
}
.kami-actions .mini-btn { padding: 6px 11px; }

.kami-item {
  position: relative; overflow: hidden;
  background: var(--surface); border: 1px solid var(--hairline);
  border-radius: var(--r-md);
  padding: var(--s3) var(--s3) var(--s3) calc(var(--s3) + 3px);
  margin-bottom: var(--s2); box-shadow: var(--shadow-xs);
  transition: box-shadow var(--t), border-color var(--t), transform var(--t-fast);
}
/* 左侧细状态条: 未使用灰 / 已绑定绿 / 过期橙 / 封禁红, 一眼区分状态 */
.kami-item::before {
  content: ""; position: absolute; left: 0; top: 0; bottom: 0; width: 3px;
  background: var(--border-strong);
}
.kami-item[data-status="bound"]::before { background: var(--ok); }
.kami-item[data-status="expired"]::before { background: var(--warn); }
.kami-item[data-status="banned"]::before { background: var(--danger); }
.kami-item[data-status="unused"]::before { background: var(--border-strong); }
.kami-row {
  display: flex; align-items: center; justify-content: space-between;
  gap: var(--s2); margin-bottom: var(--s1); flex-wrap: wrap;
}
.kami-row code { font-size: var(--fs-body); color: var(--text); font-weight: 600; }
.kami-item .kami-meta { margin-top: 2px; }
.kami-actions { display: flex; justify-content: flex-end; flex-wrap: wrap; gap: var(--s2); margin-top: var(--s2); }
.kami-actions .mini-btn { display: inline-flex; align-items: center; gap: 4px; }
.kami-actions .mini-btn.danger { color: var(--danger); }
.kami-actions .mini-btn:disabled { opacity: 0.55; }

/* 卡密管理: 批量操作 */
.kami-toolbar {
  display: flex; align-items: center; gap: 8px;
  flex-wrap: wrap; margin: 8px 0 10px;
}
.kami-select {
  display: inline-flex; align-items: center; gap: 6px;
  font-size: 13px; color: var(--text-2, #666);
}
.kami-toolbar .sel-count {
  margin-left: auto; font-size: 12px; color: var(--text-3, #999);
}
.kami-toolbar .mini-btn { margin: 0; }
.kami-toolbar .mini-btn:disabled { opacity: 0.45; pointer-events: none; }
.kami-item.selected {
  outline: 2px solid var(--accent, #2f7cf6);
  outline-offset: 2px;
}

/* 卡密列表分页 */
.pagination {
  display: flex; align-items: center; justify-content: center;
  gap: 12px; margin: 10px 0 4px;
}
.pagination-info { font-size: var(--fs-sm); color: var(--text-muted); }

/* 卡密详情弹窗 */
.card-detail-modal { max-width: 380px; }
.card-detail-body {
  min-height: 0; max-height: 60vh; overflow-y: auto;
  text-align: left; padding: 0 var(--s4) var(--s2);
}
.detail-row {
  display: flex; align-items: flex-start; justify-content: space-between;
  gap: 12px; padding: 8px 0; font-size: var(--fs-sm);
  border-bottom: 1px solid var(--hairline);
}
.detail-row:last-child { border-bottom: none; }
.detail-label { color: var(--text-muted); flex: 0 0 auto; }
.detail-value { flex: 1; min-width: 0; text-align: right; word-break: break-all; font-weight: 500; }
.detail-value code { font-size: var(--fs-sm); }

/* 账号级 API Key 自动保存状态 */
#acc-deepseek { letter-spacing: 0.02em; }

@media (max-width: 360px) {
  .admin-quick-actions { flex-wrap: wrap; }
  .card-filter .seg-btn { padding-left: 8px; padding-right: 8px; }
}

/* Phone / tablet shell, including a phone held sideways. */
@media (max-width: 767px), (pointer: coarse) {
  body { padding: 0; align-items: flex-start; background: var(--bg); }
  .screen {
    max-width: none; max-height: none;
    height: var(--app-height, 100dvh);
    border: 0; border-radius: 0; box-shadow: none;
  }
  .top-bar {
    padding-left: max(var(--s4), env(safe-area-inset-left));
    padding-right: max(var(--s4), env(safe-area-inset-right));
  }
  .scroll {
    padding-left: max(var(--s4), env(safe-area-inset-left));
    padding-right: max(var(--s4), env(safe-area-inset-right));
  }
  .modal-overlay {
    height: var(--app-height, 100dvh); bottom: auto;
    padding-top: max(var(--s4), env(safe-area-inset-top));
    padding-bottom: max(var(--s4), env(safe-area-inset-bottom));
  }
  #picker.modal-overlay { padding: 0; }
  .qr-page { overflow-y: auto; }
  .qr-stage { flex-shrink: 0; }
  .icon-btn, .mini-btn, .seg-btn, .acc-eye, .account-item .acc-del,
  .admin-quick-actions .btn-primary, .admin-quick-actions .btn-ghost,
  .admin-list-footer .btn-ghost { min-height: 44px; }
  .acc-eye, .account-item .acc-del { min-width: 44px; }
  .kami-select { min-height: 44px; }
  .keyboard-open .tab-bar { display: none; }
  .keyboard-open .scroll { padding-bottom: var(--s6); }
  .appearance-field { flex-wrap: wrap; }
  .appearance-field .seg { flex: 1 0 100%; min-width: 0; margin-left: 0; display: flex; }
  .appearance-field .seg-btn { flex: 1; }
}

@media (max-width: 430px) {
  .study-settings .field { flex-wrap: wrap; }
  .study-settings select { flex-basis: 100%; min-height: 44px; text-align: left; }
  .pagination { flex-wrap: wrap; gap: var(--s2); }
  .pagination-info { flex: 1 0 100%; order: -1; text-align: center; }
}

@media (max-height: 600px) {
  .login-hero { padding-top: calc(env(safe-area-inset-top) + 20px); padding-bottom: var(--s4); }
  .login-hero .logo { width: 48px; height: 48px; margin-bottom: var(--s2); }
  .login-hero h1 { font-size: 22px; }
  .modal-map { height: 100px; }
}
