/* ==========================================================================
   喜鹊儿课程 · 设计系统
   --------------------------------------------------------------------------
   基于《小雪糕》设计系统移植(三级背景层次 / BEM 组件 / 深浅双主题),
   并在其上扩展手动主题切换(data-theme 三态:light / dark / 跟随系统)。
   布局断点:<768 移动单列+底部标签栏;>=1024 固定侧边栏工作台。
   ========================================================================== */

/* ---------- 主题变量 ---------- */
:root {
  --ios-blue: #007aff;
  --ios-blue-strong: #0062cc;
  --ios-green: #34c759;
  --ios-green-text: #248a3d;
  --ios-red: #ff3b30;
  --ios-red-text: #d70015;
  --ios-orange: #ff9500;
  --ios-orange-text: #b25000;
  --ios-yellow: #ffcc00;
  --ios-purple: #af52de;
  --ios-pink: #ff2d55;
  --ios-teal: #5ac8fa;
  --ios-indigo: #5856d6;

  --gray-1: #8e8e93;
  --gray-2: #aeaeb2;
  --gray-3: #c7c7cc;
  --gray-4: #d1d1d6;
  --gray-5: #e5e5ea;
  --gray-6: #f2f2f7;

  --bg: #f2f2f7;
  --bg-elevated: #ffffff;
  --bg-sunken: #e9e9ef;
  --bg-nav: rgba(249, 249, 249, 0.82);
  --bg-sidebar: rgba(250, 250, 252, 0.9);

  --text: #1c1c1e;
  --text-secondary: #6b6b70;
  --text-tertiary: #9a9aa0;

  --border: rgba(0, 0, 0, 0.08);
  --separator: rgba(60, 60, 67, 0.14);
  --separator-strong: rgba(60, 60, 67, 0.28);
  --fill: rgba(120, 120, 128, 0.14);
  --fill-strong: rgba(120, 120, 128, 0.22);

  --radius-sm: 8px;
  --radius: 12px;
  --radius-lg: 16px;
  --radius-xl: 22px;
  --radius-full: 999px;

  --gap-xs: 4px;
  --gap-sm: 8px;
  --gap-md: 12px;
  --gap-lg: 16px;
  --gap-xl: 24px;
  --gap-2xl: 32px;

  --font: -apple-system, BlinkMacSystemFont, 'SF Pro Text', 'PingFang SC',
    'Helvetica Neue', 'Microsoft YaHei', 'Segoe UI', sans-serif;
  --font-mono: ui-monospace, 'SF Mono', SFMono-Regular, Menlo, Consolas, monospace;

  --ease: cubic-bezier(0.32, 0.72, 0, 1);
  --duration: 0.28s;

  --nav-height: 52px;
  --tab-height: 54px;
  --sidebar-width: 236px;
  --content-max: 1160px;
  --safe-top: env(safe-area-inset-top, 0px);
  --safe-bottom: env(safe-area-inset-bottom, 0px);

  --shadow-xs: 0 1px 2px rgba(16, 24, 40, 0.04);
  --shadow-sm: 0 1px 3px rgba(16, 24, 40, 0.06), 0 1px 2px rgba(16, 24, 40, 0.04);
  --shadow: 0 4px 16px rgba(16, 24, 40, 0.08);
  --shadow-lg: 0 16px 48px rgba(16, 24, 40, 0.16);
  --shadow-pop: 0 12px 32px rgba(0, 122, 255, 0.24);

  color-scheme: light;
}

/* 深色主题:系统跟随(无 JS 干预时的默认)与手动模式共用一套变量 */
@media (prefers-color-scheme: dark) {
  :root:not([data-theme='light']) {
    color-scheme: dark;
    --gray-6: #1c1c1e;
    --bg: #000000;
    --bg-elevated: #1c1c1e;
    --bg-sunken: #0a0a0c;
    --bg-nav: rgba(22, 22, 24, 0.78);
    --bg-sidebar: rgba(18, 18, 20, 0.92);
    --text: #f5f5f7;
    --text-secondary: #a1a1a8;
    --text-tertiary: #76767e;
    --border: rgba(255, 255, 255, 0.09);
    --separator: rgba(255, 255, 255, 0.1);
    --separator-strong: rgba(255, 255, 255, 0.18);
    --fill: rgba(120, 120, 128, 0.28);
    --fill-strong: rgba(120, 120, 128, 0.4);
    --ios-green-text: #32d74b;
    --ios-red-text: #ff6961;
    --ios-orange-text: #ffb340;
    --shadow-xs: none;
    --shadow-sm: none;
    --shadow: 0 4px 16px rgba(0, 0, 0, 0.5);
    --shadow-lg: 0 16px 48px rgba(0, 0, 0, 0.7);
  }
}

/* 手动深色(优先级高于系统浅色;系统深色时 data-theme=light 由上方规则排除) */
:root[data-theme='dark'] {
  color-scheme: dark;
  --gray-6: #1c1c1e;
  --bg: #000000;
  --bg-elevated: #1c1c1e;
  --bg-sunken: #0a0a0c;
  --bg-nav: rgba(22, 22, 24, 0.78);
  --bg-sidebar: rgba(18, 18, 20, 0.92);
  --text: #f5f5f7;
  --text-secondary: #a1a1a8;
  --text-tertiary: #76767e;
  --border: rgba(255, 255, 255, 0.09);
  --separator: rgba(255, 255, 255, 0.1);
  --separator-strong: rgba(255, 255, 255, 0.18);
  --fill: rgba(120, 120, 128, 0.28);
  --fill-strong: rgba(120, 120, 128, 0.4);
  --ios-green-text: #32d74b;
  --ios-red-text: #ff6961;
  --ios-orange-text: #ffb340;
  --shadow-xs: none;
  --shadow-sm: none;
  --shadow: 0 4px 16px rgba(0, 0, 0, 0.5);
  --shadow-lg: 0 16px 48px rgba(0, 0, 0, 0.7);
}

/* ---------- 基础重置 ---------- */
* { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }
html, body { margin: 0; padding: 0; min-height: 100%; }
body {
  font-family: var(--font);
  font-size: 15px;
  line-height: 1.5;
  color: var(--text);
  background: var(--bg);
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  overscroll-behavior-y: none;
  transition: background 0.3s var(--ease), color 0.3s var(--ease);
}
#app { min-height: 100vh; }
a { color: var(--ios-blue); text-decoration: none; }
button {
  font-family: inherit; font-size: inherit; color: inherit;
  border: none; background: none; cursor: pointer; padding: 0; text-align: left;
}
input, textarea, select { font-family: inherit; font-size: inherit; }
.scroll { -webkit-overflow-scrolling: touch; }

/* ==========================================================================
   应用外壳
   ========================================================================== */
.app-shell { display: flex; min-height: 100vh; background: var(--bg); }
.app-main { flex: 1; min-width: 0; display: flex; flex-direction: column; }

.container { width: 100%; max-width: var(--content-max); margin: 0 auto; padding: 0 var(--gap-lg); }
.container--narrow { max-width: 720px; }

.page {
  flex: 1;
  padding-bottom: calc(var(--tab-height) + var(--safe-bottom) + var(--gap-xl));
  background: var(--bg);
  min-height: 100vh;
}
.page-body { padding-top: calc(var(--nav-height) + var(--safe-top) + var(--gap-lg)); }
.page-body--large { padding-top: calc(var(--nav-height) + var(--safe-top) + var(--gap-sm)); }

/* ---------- 响应式栅格 ---------- */
.grid { display: grid; gap: var(--gap-lg); grid-template-columns: 1fr; }
.grid--auto { grid-template-columns: repeat(auto-fill, minmax(240px, 1fr)); }
.grid--stats { grid-template-columns: repeat(2, 1fr); gap: var(--gap-md); }
@media (min-width: 480px) { .grid--stats { grid-template-columns: repeat(4, 1fr); } }
@media (min-width: 768px) {
  .grid--2 { grid-template-columns: repeat(2, 1fr); }
  .grid--main { grid-template-columns: minmax(0, 1.35fr) minmax(0, 1fr); align-items: start; }
}
.span-full { grid-column: 1 / -1; }

/* ==========================================================================
   侧边栏(桌面端)
   ========================================================================== */
.sidebar { display: none; }

@media (min-width: 1024px) {
  .sidebar {
    display: flex;
    flex-direction: column;
    position: fixed;
    inset: 0 auto 0 0;
    width: var(--sidebar-width);
    background: var(--bg-sidebar);
    backdrop-filter: saturate(180%) blur(24px);
    -webkit-backdrop-filter: saturate(180%) blur(24px);
    border-right: 1px solid var(--border);
    padding: var(--gap-xl) var(--gap-md);
    z-index: 900;
  }
  .app-main { margin-left: var(--sidebar-width); }
  .tabbar, .mobile-nav { display: none !important; }
  .page { padding-bottom: var(--gap-2xl); }
  .page-body, .page-body--large { padding-top: var(--gap-xl); }
  .container { padding: 0 var(--gap-xl); }
}

.sidebar__brand { display: flex; align-items: center; gap: var(--gap-md); padding: 0 var(--gap-md) var(--gap-xl); }
.sidebar__logo {
  width: 38px; height: 38px; border-radius: 11px;
  background: linear-gradient(145deg, #4facfe, #007aff);
  color: #fff; font-size: 19px; font-weight: 700;
  display: flex; align-items: center; justify-content: center;
  flex: none; box-shadow: var(--shadow-pop);
}
.sidebar__title { font-size: 16px; font-weight: 700; letter-spacing: -0.01em; line-height: 1.2; }
.sidebar__subtitle { font-size: 12px; color: var(--text-tertiary); margin-top: 1px; }

.sidebar__nav { display: flex; flex-direction: column; gap: 2px; flex: 1; overflow-y: auto; }
.sidebar__item {
  display: flex; align-items: center; gap: var(--gap-md);
  height: 40px; padding: 0 var(--gap-md);
  border-radius: var(--radius-sm);
  font-size: 14px; font-weight: 500; color: var(--text-secondary);
  transition: background var(--duration) var(--ease), color var(--duration) var(--ease);
}
.sidebar__item:hover { background: var(--fill); color: var(--text); }
.sidebar__item--active { background: var(--fill); color: var(--ios-blue); font-weight: 600; }
.sidebar__icon { width: 20px; height: 20px; flex: none; opacity: 0.9; }
.sidebar__icon svg { width: 100%; height: 100%; display: block; }
.sidebar__label { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.sidebar__user .sidebar__label { display: flex; flex-direction: column; gap: 1px; white-space: normal; }
.sidebar__section {
  font-size: 11px; font-weight: 600; letter-spacing: 0.06em;
  text-transform: uppercase; color: var(--text-tertiary);
  padding: var(--gap-lg) var(--gap-md) var(--gap-sm);
}
.sidebar__footer { border-top: 1px solid var(--border); padding-top: var(--gap-md); margin-top: var(--gap-md); }
.sidebar__user {
  display: flex; align-items: center; gap: var(--gap-md);
  padding: var(--gap-sm) var(--gap-md); border-radius: var(--radius-sm);
  transition: background var(--duration) var(--ease);
}
.sidebar__user:hover { background: var(--fill); }
.sidebar__avatar {
  width: 32px; height: 32px; border-radius: 50%;
  background: linear-gradient(145deg, #4facfe, #007aff);
  color: #fff; font-size: 14px; font-weight: 600;
  display: flex; align-items: center; justify-content: center; flex: none;
}

/* ==========================================================================
   顶部导航(移动端)
   ========================================================================== */
.mobile-nav {
  position: fixed; top: 0; left: 0; right: 0; z-index: 900;
  padding-top: var(--safe-top);
  background: var(--bg-nav);
  backdrop-filter: saturate(180%) blur(20px);
  -webkit-backdrop-filter: saturate(180%) blur(20px);
  border-bottom: 1px solid transparent;
  transition: border-color var(--duration) var(--ease);
}
.mobile-nav--scrolled { border-bottom-color: var(--border); }
.mobile-nav__inner { height: var(--nav-height); padding: 0 var(--gap-sm); display: flex; align-items: center; gap: var(--gap-sm); }
.mobile-nav__side { flex: 1; display: flex; align-items: center; min-width: 0; gap: var(--gap-xs); }
.mobile-nav__side--right { justify-content: flex-end; }
.mobile-nav__title {
  font-size: 16px; font-weight: 600; opacity: 0;
  transition: opacity var(--duration) var(--ease);
  white-space: nowrap; max-width: 46vw; overflow: hidden; text-overflow: ellipsis;
}
.mobile-nav__title--visible { opacity: 1; }
.nav-btn {
  display: inline-flex; align-items: center; gap: 2px;
  color: var(--ios-blue); font-size: 16px;
  padding: 8px; border-radius: var(--radius-sm);
}
.nav-btn:active { opacity: 0.5; }

.page-title { padding: var(--gap-sm) 0 var(--gap-lg); }
.page-title__text { margin: 0; font-size: 30px; line-height: 1.2; font-weight: 700; letter-spacing: -0.022em; }
.page-title__desc { margin: var(--gap-xs) 0 0; font-size: 14px; color: var(--text-secondary); }
@media (min-width: 1024px) { .page-title__text { font-size: 26px; } }

/* ==========================================================================
   底部标签栏(移动端)
   ========================================================================== */
.tabbar {
  position: fixed; left: 0; right: 0; bottom: 0; z-index: 800;
  background: var(--bg-nav);
  backdrop-filter: saturate(180%) blur(20px);
  -webkit-backdrop-filter: saturate(180%) blur(20px);
  border-top: 1px solid var(--border);
  padding-bottom: var(--safe-bottom);
}
.tabbar__inner { max-width: 560px; margin: 0 auto; height: var(--tab-height); display: flex; }
.tabbar__item {
  flex: 1; display: flex; flex-direction: column;
  align-items: center; justify-content: center; gap: 2px;
  color: var(--gray-1); transition: color 0.18s var(--ease);
}
.tabbar__item--active { color: var(--ios-blue); }
.tabbar__icon { width: 25px; height: 25px; display: block; line-height: 0; }
.tabbar__icon svg { width: 100%; height: 100%; }
.tabbar__label { font-size: 10px; font-weight: 500; }

/* ==========================================================================
   分组列表
   ========================================================================== */
.section { margin-bottom: var(--gap-xl); }
.section__header {
  display: flex; align-items: baseline; justify-content: space-between;
  gap: var(--gap-md); padding: 0 var(--gap-xs) var(--gap-sm);
  font-size: 12px; font-weight: 600; letter-spacing: 0.05em;
  text-transform: uppercase; color: var(--text-tertiary);
}
.section__footer { font-size: 12px; color: var(--text-tertiary); padding: var(--gap-sm) var(--gap-xs) 0; line-height: 1.5; }

.card { background: var(--bg-elevated); border: 1px solid var(--border); border-radius: var(--radius-lg); overflow: hidden; }
.card--pad { padding: var(--gap-lg); }
.card__header {
  display: flex; align-items: center; justify-content: space-between;
  gap: var(--gap-md); padding: var(--gap-md) var(--gap-lg);
  border-bottom: 1px solid var(--border); font-size: 14px; font-weight: 600;
}

.list { display: flex; flex-direction: column; }
.row {
  display: flex; align-items: center; gap: var(--gap-md);
  min-height: 52px; padding: var(--gap-md) var(--gap-lg);
  position: relative; background: var(--bg-elevated);
  transition: background var(--duration) var(--ease);
}
.row + .row::before {
  content: ''; position: absolute; top: 0; left: var(--gap-lg); right: 0;
  height: 1px; background: var(--separator);
}
.row--tappable { cursor: pointer; }
.row--tappable:hover { background: var(--bg-sunken); }
.row--tappable:active { background: var(--fill); }
.row--center { justify-content: center; text-align: center; }
.row__main { flex: 1; min-width: 0; }
.row__title {
  display: block; font-size: 15px; font-weight: 500; color: var(--text);
  overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}
.row__desc {
  display: block; font-size: 13px; color: var(--text-secondary);
  margin-top: 2px; line-height: 1.45;
  overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}
.row__desc--wrap { white-space: normal; }
.row__value {
  display: block; flex: none; max-width: 45%; font-size: 14px;
  color: var(--text-secondary); text-align: right;
  overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}
.chevron {
  flex: none; width: 7px; height: 12px;
  border-right: 2px solid var(--text-tertiary);
  border-bottom: 2px solid var(--text-tertiary);
  transform: rotate(-45deg); border-radius: 1px; opacity: 0.6;
}

/* ==========================================================================
   按钮
   ========================================================================== */
.btn {
  display: inline-flex; align-items: center; justify-content: center;
  gap: var(--gap-sm); height: 42px; padding: 0 var(--gap-lg);
  border-radius: var(--radius); font-size: 15px; font-weight: 600;
  letter-spacing: -0.01em;
  transition: opacity var(--duration) var(--ease), transform 0.12s var(--ease),
    background var(--duration) var(--ease);
  user-select: none; white-space: nowrap;
}
.btn:active:not(:disabled) { transform: scale(0.98); opacity: 0.85; }
.btn:disabled { opacity: 0.4; cursor: not-allowed; }
.btn--primary { background: var(--ios-blue); color: #fff; box-shadow: 0 2px 8px rgba(0, 122, 255, 0.28); }
.btn--primary:active:not(:disabled) { background: var(--ios-blue-strong); }
.btn--success { background: var(--ios-green); color: #fff; }
.btn--tinted { background: var(--fill); color: var(--ios-blue); }
.btn--danger { background: var(--fill); color: var(--ios-red-text); }
.btn--plain { background: transparent; color: var(--ios-blue); padding: 0 var(--gap-sm); font-weight: 500; }
.btn--block { width: 100%; }
.btn--sm { height: 32px; padding: 0 var(--gap-md); font-size: 13px; border-radius: var(--radius-sm); }
.btn--lg { height: 48px; font-size: 16px; }
@media (max-width: 767px) { .btn { height: 46px; } }

/* ==========================================================================
   表单
   ========================================================================== */
.field {
  display: flex; align-items: center; gap: var(--gap-md);
  min-height: 52px; padding: var(--gap-md) var(--gap-lg);
  background: var(--bg-elevated); position: relative;
}
.field + .field::before {
  content: ''; position: absolute; top: 0; left: var(--gap-lg); right: 0;
  height: 1px; background: var(--separator);
}
.field__label { flex: none; width: 76px; font-size: 14px; font-weight: 500; color: var(--text-secondary); }
.field__control { flex: 1; min-width: 0; }
.input {
  width: 100%; border: none; outline: none; background: transparent;
  font-size: 15px; color: var(--text); padding: 0;
}
.input::placeholder { color: var(--text-tertiary); }
textarea.input { min-height: 76px; resize: vertical; line-height: 1.5; padding: var(--gap-xs) 0; }
.field--stack { align-items: stretch; flex-direction: column; gap: var(--gap-sm); }
.form-card { background: var(--bg-elevated); border: 1px solid var(--border); border-radius: var(--radius-lg); overflow: hidden; }

/* ==========================================================================
   标签 / 统计
   ========================================================================== */
.tag {
  display: inline-flex; align-items: center; height: 22px; padding: 0 8px;
  border-radius: 6px; font-size: 12px; font-weight: 600; white-space: nowrap;
}
.tag--blue { background: rgba(0, 122, 255, 0.12); color: var(--ios-blue); }
.tag--green { background: rgba(52, 199, 89, 0.14); color: var(--ios-green-text); }
.tag--red { background: rgba(255, 59, 48, 0.12); color: var(--ios-red-text); }
.tag--orange { background: rgba(255, 149, 0, 0.14); color: var(--ios-orange-text); }
.tag--purple { background: rgba(175, 82, 222, 0.12); color: var(--ios-purple); }
.tag--gray { background: var(--fill); color: var(--text-secondary); }
.tag-group { display: flex; flex-wrap: wrap; gap: 6px; margin-top: var(--gap-sm); }

.stat { background: var(--bg-elevated); border: 1px solid var(--border); border-radius: var(--radius); padding: var(--gap-lg) var(--gap-md); text-align: center; }
.stat__value { font-size: 24px; font-weight: 700; letter-spacing: -0.02em; line-height: 1.1; }
.stat__label { font-size: 12px; color: var(--text-secondary); margin-top: var(--gap-xs); }
.stat--accent-green .stat__value { color: var(--ios-green-text); }
.stat--accent-red .stat__value { color: var(--ios-red-text); }
.stat--accent-orange .stat__value { color: var(--ios-orange-text); }

.metric {
  display: flex; align-items: center; gap: var(--gap-md);
  background: var(--bg-elevated); border: 1px solid var(--border);
  border-radius: var(--radius); padding: var(--gap-md) var(--gap-lg);
}
.metric__value { font-size: 22px; font-weight: 700; letter-spacing: -0.02em; line-height: 1.1; min-width: 48px; }
.metric__label { font-size: 13px; color: var(--text-secondary); }

/* ==========================================================================
   分段控件 / 开关
   ========================================================================== */
.segmented {
  display: inline-flex; gap: 2px; padding: 3px;
  background: var(--fill); border-radius: var(--radius);
  overflow-x: auto; scrollbar-width: none; max-width: 100%;
}
.segmented::-webkit-scrollbar { display: none; }
.segmented__item {
  flex: 1; min-width: fit-content; height: 32px; padding: 0 var(--gap-md);
  border-radius: 9px; font-size: 13px; font-weight: 500; color: var(--text-secondary);
  display: flex; align-items: center; justify-content: center; white-space: nowrap;
  transition: all var(--duration) var(--ease);
}
.segmented__item--active {
  background: var(--bg-elevated); color: var(--text);
  font-weight: 600; box-shadow: var(--shadow-xs);
}
:root[data-theme='dark'] .segmented__item--active { background: #48484a; color: #fff; }
@media (prefers-color-scheme: dark) {
  :root:not([data-theme='light']) .segmented__item--active { background: #48484a; color: #fff; }
}
.segmented--block { display: flex; width: 100%; }

.switch { flex: none; position: relative; width: 48px; height: 29px; border-radius: var(--radius-full); background: var(--gray-4); transition: background var(--duration) var(--ease); }
.switch--on { background: var(--ios-green); }
.switch__knob {
  position: absolute; top: 2px; left: 2px; width: 25px; height: 25px;
  border-radius: 50%; background: #fff;
  box-shadow: 0 2px 6px rgba(0, 0, 0, 0.2);
  transition: transform var(--duration) var(--ease);
}
.switch--on .switch__knob { transform: translateX(19px); }

/* ==========================================================================
   反馈:加载 / 空状态 / 提示
   ========================================================================== */
.spinner {
  width: 18px; height: 18px;
  border: 2px solid var(--fill-strong); border-top-color: var(--gray-1);
  border-radius: 50%; animation: spin 0.8s linear infinite; flex: none;
}
.spinner--lg { width: 28px; height: 28px; border-width: 3px; }
@keyframes spin { to { transform: rotate(360deg); } }
.loading { display: flex; align-items: center; justify-content: center; gap: var(--gap-sm); padding: 56px 0; color: var(--text-secondary); font-size: 14px; }

.empty { display: flex; flex-direction: column; align-items: center; gap: var(--gap-sm); padding: 64px var(--gap-lg); text-align: center; }
.empty__icon {
  width: 60px; height: 60px; border-radius: 50%; background: var(--fill);
  display: flex; align-items: center; justify-content: center;
  font-size: 26px; color: var(--text-tertiary); margin-bottom: var(--gap-xs);
}
.empty__title { font-size: 16px; font-weight: 600; }
.empty__desc { font-size: 13px; color: var(--text-secondary); max-width: 320px; line-height: 1.55; }

.alert { display: flex; gap: var(--gap-sm); padding: var(--gap-md) var(--gap-lg); border-radius: var(--radius); font-size: 13px; line-height: 1.5; }
.alert--error { background: rgba(255, 59, 48, 0.1); color: var(--ios-red-text); border: 1px solid rgba(255, 59, 48, 0.18); }
.alert--info { background: rgba(0, 122, 255, 0.08); color: var(--ios-blue); border: 1px solid rgba(0, 122, 255, 0.16); }

/* ==========================================================================
   浮层
   ========================================================================== */
.mask { position: fixed; inset: 0; background: rgba(0, 0, 0, 0.45); z-index: 1000; animation: fade-in 0.2s var(--ease); backdrop-filter: blur(3px); }
@keyframes fade-in { from { opacity: 0; } to { opacity: 1; } }

.sheet {
  position: fixed; left: 0; right: 0; bottom: 0; z-index: 1001;
  background: var(--bg);
  border-radius: var(--radius-xl) var(--radius-xl) 0 0;
  padding-bottom: var(--safe-bottom); max-height: 92vh;
  display: flex; flex-direction: column;
  animation: sheet-in 0.34s var(--ease);
  box-shadow: var(--shadow-lg);
}
@keyframes sheet-in { from { transform: translateY(100%); } to { transform: translateY(0); } }
.sheet__handle { width: 36px; height: 4px; border-radius: 2px; background: var(--gray-3); margin: 8px auto 0; flex: none; }
.sheet__header {
  display: flex; align-items: center; justify-content: space-between;
  gap: var(--gap-md); padding: var(--gap-md) var(--gap-lg);
  flex: none; border-bottom: 1px solid var(--border);
}
.sheet__title { flex: 1; text-align: center; font-size: 16px; font-weight: 600; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.sheet__action { min-width: 48px; font-size: 15px; color: var(--ios-blue); text-align: right; }
.sheet__action:active { opacity: 0.5; }
.sheet__body { overflow-y: auto; padding: var(--gap-lg); flex: 1; }
.sheet__footer { flex: none; padding: var(--gap-md) var(--gap-lg) var(--gap-lg); border-top: 1px solid var(--border); background: var(--bg); }

@media (min-width: 768px) {
  .sheet {
    left: 50%; right: auto; bottom: auto; top: 50%;
    transform: translate(-50%, -50%);
    width: min(560px, calc(100vw - 64px));
    max-height: min(84vh, 760px);
    border-radius: var(--radius-xl);
    animation: dialog-in 0.24s var(--ease);
  }
  .sheet__handle { display: none; }
  .sheet__header { padding: var(--gap-lg) var(--gap-xl) var(--gap-md); border-bottom: none; }
  .sheet__body { padding: 0 var(--gap-xl) var(--gap-lg); }
  .sheet__footer { padding: var(--gap-md) var(--gap-xl) var(--gap-xl); border-top: none; }
}
@keyframes dialog-in {
  from { opacity: 0; transform: translate(-50%, -48%) scale(0.97); }
  to { opacity: 1; transform: translate(-50%, -50%) scale(1); }
}

.dialog {
  position: fixed; top: 50%; left: 50%; transform: translate(-50%, -50%);
  z-index: 1001; width: min(320px, calc(100vw - 64px));
  background: var(--bg-elevated); border-radius: var(--radius-lg);
  overflow: hidden; animation: dialog-in 0.22s var(--ease);
  box-shadow: var(--shadow-lg);
}
.dialog__body { padding: var(--gap-xl) var(--gap-lg) var(--gap-lg); text-align: center; }
.dialog__title { font-size: 16px; font-weight: 600; margin-bottom: var(--gap-xs); }
.dialog__message { font-size: 13px; color: var(--text-secondary); line-height: 1.55; white-space: pre-wrap; max-height: 46vh; overflow-y: auto; text-align: left; }
.dialog__actions { display: flex; border-top: 1px solid var(--border); }
.dialog__action {
  flex: 1; height: 46px; display: flex; align-items: center;
  justify-content: center; font-size: 16px; color: var(--ios-blue);
  position: relative; text-align: center;
}
.dialog__action + .dialog__action::before {
  content: ''; position: absolute; left: 0; top: 0; bottom: 0;
  width: 1px; background: var(--border);
}
.dialog__action--bold { font-weight: 600; }
.dialog__action--destructive { color: var(--ios-red); }
.dialog__action:hover { background: var(--bg-sunken); }

.toast-layer {
  position: fixed; top: calc(var(--safe-top) + 16px); left: 50%;
  transform: translateX(-50%); z-index: 2000;
  display: flex; flex-direction: column; align-items: center;
  gap: var(--gap-sm); pointer-events: none;
  padding: 0 var(--gap-lg); width: max-content;
  max-width: min(440px, 100vw);
}
.toast {
  display: flex; align-items: center; gap: var(--gap-sm);
  padding: 10px 16px; border-radius: var(--radius-full);
  background: rgba(28, 28, 30, 0.94); color: #fff;
  font-size: 14px; line-height: 1.4;
  backdrop-filter: blur(20px); box-shadow: var(--shadow);
  animation: toast-in 0.26s var(--ease); max-width: 100%;
}
@keyframes toast-in { from { opacity: 0; transform: translateY(-10px) scale(0.97); } to { opacity: 1; transform: translateY(0) scale(1); } }
.toast--success { background: rgba(36, 138, 61, 0.95); }
.toast--error { background: rgba(200, 38, 30, 0.95); }
.toast--leaving { opacity: 0; transform: translateY(-6px) scale(0.98); transition: all 0.22s var(--ease); }

/* ==========================================================================
   业务区块
   ========================================================================== */
/* 状态主卡(打卡状态等,替代小雪糕的额度卡) */
.hero-card {
  position: relative; border-radius: var(--radius-xl);
  padding: var(--gap-xl); color: #fff;
  background: linear-gradient(135deg, #4facfe 0%, #007aff 100%);
  box-shadow: var(--shadow-pop); overflow: hidden;
}
.hero-card::after {
  content: ''; position: absolute; right: -40px; top: -40px;
  width: 180px; height: 180px; border-radius: 50%;
  background: rgba(255, 255, 255, 0.12);
}
.hero-card--green { background: linear-gradient(135deg, #43e97d 0%, #34c759 100%); box-shadow: 0 12px 32px rgba(52, 199, 89, 0.24); }
.hero-card--orange { background: linear-gradient(135deg, #ffb340 0%, #ff9500 100%); box-shadow: 0 12px 32px rgba(255, 149, 0, 0.24); }
.hero-card__top { display: flex; align-items: center; justify-content: space-between; gap: var(--gap-md); font-size: 13px; opacity: 0.92; position: relative; z-index: 1; }
.hero-card__value { font-size: 30px; font-weight: 700; letter-spacing: -0.025em; margin: var(--gap-sm) 0 var(--gap-lg); position: relative; z-index: 1; line-height: 1.15; }
.hero-card__sub { font-size: 13px; opacity: 0.92; margin-bottom: var(--gap-md); position: relative; z-index: 1; }
.hero-card__actions { display: flex; gap: var(--gap-sm); position: relative; z-index: 1; }
.hero-card__btn {
  flex: 1; height: 36px; border-radius: var(--radius-full);
  background: rgba(255, 255, 255, 0.22); color: #fff;
  font-size: 14px; font-weight: 500;
  display: flex; align-items: center; justify-content: center;
  backdrop-filter: blur(10px); transition: background var(--duration) var(--ease);
}
.hero-card__btn:hover { background: rgba(255, 255, 255, 0.32); }
.hero-card__btn:active { opacity: 0.7; }
@media (min-width: 768px) {
  .hero-card { padding: var(--gap-xl) var(--gap-2xl); }
  .hero-card__value { font-size: 36px; }
  .hero-card__actions { max-width: 320px; }
}

/* 快捷入口卡 */
.entry {
  display: flex; gap: var(--gap-md); padding: var(--gap-lg);
  background: var(--bg-elevated); border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  transition: border-color var(--duration) var(--ease), transform 0.12s var(--ease), box-shadow var(--duration) var(--ease);
  text-align: left; align-items: flex-start; cursor: pointer; width: 100%;
}
.entry:hover { border-color: rgba(0, 122, 255, 0.4); box-shadow: var(--shadow-sm); }
.entry:active { transform: scale(0.99); }
.entry__icon {
  width: 40px; height: 40px; border-radius: 12px;
  display: flex; align-items: center; justify-content: center;
  flex: none; font-size: 19px; background: var(--fill);
}
.entry__icon--blue { background: rgba(0, 122, 255, 0.12); color: var(--ios-blue); }
.entry__icon--green { background: rgba(52, 199, 89, 0.14); color: var(--ios-green-text); }
.entry__icon--orange { background: rgba(255, 149, 0, 0.14); color: var(--ios-orange-text); }
.entry__icon--purple { background: rgba(175, 82, 222, 0.12); color: var(--ios-purple); }
.entry__main { flex: 1; min-width: 0; }
.entry__title { display: block; font-size: 15px; font-weight: 600; color: var(--text); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.entry__desc { display: block; font-size: 13px; color: var(--text-secondary); margin-top: 2px; line-height: 1.45; }

/* 个人资料卡 */
.profile-card {
  display: flex; align-items: center; gap: var(--gap-lg);
  background: var(--bg-elevated); border: 1px solid var(--border);
  border-radius: var(--radius-lg); padding: var(--gap-lg);
}
.profile-card__avatar {
  flex: none; width: 56px; height: 56px; border-radius: 50%;
  background: linear-gradient(145deg, #4facfe, #007aff);
  color: #fff; font-size: 22px; font-weight: 600;
  display: flex; align-items: center; justify-content: center;
}
.profile-card__name { font-size: 18px; font-weight: 700; letter-spacing: -0.01em; }
.profile-card__meta { font-size: 13px; color: var(--text-secondary); margin-top: 1px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

/* 键值对列表(学籍档案) */
.kv { display: flex; gap: var(--gap-md); padding: 11px var(--gap-lg); position: relative; font-size: 14px; }
.kv + .kv::before { content: ''; position: absolute; left: var(--gap-lg); right: 0; top: 0; height: 1px; background: var(--separator); }
.kv .k { width: 96px; flex: none; color: var(--text-secondary); }
.kv .v { flex: 1; min-width: 0; word-break: break-all; }

/* ==========================================================================
   工具类
   ========================================================================== */
.t-secondary { color: var(--text-secondary); }
.t-tertiary { color: var(--text-tertiary); }
.t-blue { color: var(--ios-blue); }
.t-green { color: var(--ios-green-text); }
.t-red { color: var(--ios-red-text); }
.t-orange { color: var(--ios-orange-text); }
.t-sm { font-size: 12px; }
.t-md { font-size: 14px; }
.t-bold { font-weight: 600; }
.t-mono { font-family: var(--font-mono); }
.t-center { text-align: center; }
.t-right { text-align: right; }
.t-ellipsis { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

.flex { display: flex; }
.flex-col { flex-direction: column; }
.items-center { align-items: center; }
.items-start { align-items: flex-start; }
.justify-between { justify-content: space-between; }
.flex-wrap { flex-wrap: wrap; }
.flex-1 { flex: 1; min-width: 0; }
.gap-xs { gap: var(--gap-xs); }
.gap-sm { gap: var(--gap-sm); }
.gap-md { gap: var(--gap-md); }
.gap-lg { gap: var(--gap-lg); }
.mt-xs { margin-top: var(--gap-xs); }
.mt-sm { margin-top: var(--gap-sm); }
.mt-md { margin-top: var(--gap-md); }
.mt-lg { margin-top: var(--gap-lg); }
.mt-xl { margin-top: var(--gap-xl); }
.mb-sm { margin-bottom: var(--gap-sm); }
.mb-md { margin-bottom: var(--gap-md); }
.mb-lg { margin-bottom: var(--gap-lg); }
.mb-xl { margin-bottom: var(--gap-xl); }
.divider { height: 1px; background: var(--separator); margin: var(--gap-md) 0; }

.only-mobile { display: block; }
.only-desktop { display: none; }
@media (min-width: 1024px) {
  .only-mobile { display: none !important; }
  .only-desktop { display: block !important; }
}

@media (prefers-reduced-motion: reduce) {
  * { animation-duration: 0.01ms !important; transition-duration: 0.01ms !important; }
}

@media (min-width: 1024px) {
  ::-webkit-scrollbar { width: 10px; height: 10px; }
  ::-webkit-scrollbar-thumb {
    background: var(--fill-strong); border-radius: 5px;
    border: 2px solid transparent; background-clip: content-box;
  }
  ::-webkit-scrollbar-thumb:hover { background: var(--gray-2); background-clip: content-box; }
  ::-webkit-scrollbar-track { background: transparent; }
}

/* 登录页(独立于外壳) */
.auth-page {
  min-height: 100vh; display: flex; align-items: center; justify-content: center;
  padding: var(--gap-xl) var(--gap-lg);
  background:
    radial-gradient(1200px 500px at 80% -10%, rgba(0, 122, 255, 0.14), transparent 60%),
    radial-gradient(900px 420px at 10% 110%, rgba(79, 172, 254, 0.12), transparent 55%),
    var(--bg);
}
.auth-card { width: 100%; max-width: 400px; }
.auth-brand { text-align: center; margin-bottom: var(--gap-xl); }
.auth-brand__logo {
  width: 72px; height: 72px; border-radius: 20px; margin: 0 auto var(--gap-md);
  background: linear-gradient(145deg, #4facfe, #007aff);
  color: #fff; font-size: 34px; font-weight: 700;
  display: flex; align-items: center; justify-content: center;
  box-shadow: var(--shadow-pop);
}
.auth-brand__title { font-size: 24px; font-weight: 700; letter-spacing: -0.02em; }
.auth-brand__desc { font-size: 13px; color: var(--text-secondary); margin-top: var(--gap-xs); }

/* 主题切换浮动按钮(移动端在导航栏;登录页右上角) */
.theme-fab {
  position: fixed; top: calc(var(--safe-top) + 10px); right: 14px; z-index: 950;
  width: 36px; height: 36px; border-radius: var(--radius-full);
  background: var(--bg-elevated); border: 1px solid var(--border);
  display: flex; align-items: center; justify-content: center;
  color: var(--text-secondary); box-shadow: var(--shadow-sm);
  cursor: pointer; transition: transform 0.12s var(--ease);
}
.theme-fab:active { transform: scale(0.92); }
@media (min-width: 1024px) { .theme-fab { display: none; } }

/* 演示模式横幅(数据来自本地模拟服务器时显示) */
.demo-banner {
  display: flex; align-items: center; justify-content: center;
  margin: 0 0 var(--gap-md);
  padding: 8px var(--gap-md);
  border-radius: var(--radius);
  background: rgba(255, 149, 0, 0.14);
  color: var(--ios-orange-text);
  border: 1px solid rgba(255, 149, 0, 0.28);
  font-size: 12.5px; line-height: 1.45; text-align: center;
}
