:root {
  --brand: #0A5CAD;
  --brand-soft: #2563EB;
  --bg: #F3F5F9;
  --card: #FFFFFF;
  --card-subtle: #F8FAFC;
  --fg: #0F172A;
  --fg-2: #475569;
  --fg-3: #8896AB;
  --line: rgba(15, 23, 42, 0.065);
  --line-strong: rgba(15, 23, 42, 0.12);
  --shadow-sm: 0 1px 2px rgba(15, 23, 42, 0.03), 0 6px 16px -8px rgba(15, 23, 42, 0.08);
  --shadow-md: 0 2px 6px rgba(15, 23, 42, 0.04), 0 12px 28px -10px rgba(15, 23, 42, 0.12);
  --ok: #10B981;
  --warn: #F59E0B;
  --err: #EF4444;
  --purple: #7C3AED;
  --radius-lg: 16px;
  --radius-md: 12px;
  --safe-top: env(safe-area-inset-top, 0px);
  --safe-bottom: env(safe-area-inset-bottom, 0px);
}

@media (prefers-color-scheme: dark) {
  :root {
    --brand: #3B82F6;
    --brand-soft: #60A5FA;
    --bg: #0B101B;
    --card: #141D2E;
    --card-subtle: #1B263B;
    --fg: #F1F5F9;
    --fg-2: #94A3B8;
    --fg-3: #64748B;
    --line: rgba(255, 255, 255, 0.075);
    --line-strong: rgba(255, 255, 255, 0.14);
    --shadow-sm: 0 2px 8px rgba(0, 0, 0, 0.28);
    --shadow-md: 0 8px 24px rgba(0, 0, 0, 0.45);
  }
}

* { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }
[hidden] { display: none !important; }
html, body { margin: 0; padding: 0; }
html { -webkit-text-size-adjust: 100%; }
body {
  font-family: -apple-system, BlinkMacSystemFont, "SF Pro Text", "SF Pro Display", "PingFang SC", "Helvetica Neue", sans-serif;
  background: var(--bg);
  color: var(--fg);
  font-size: 15px;
  line-height: 1.45;
  overscroll-behavior-y: none;
  -webkit-font-smoothing: antialiased;
}
button, input, select, textarea { font-family: inherit; color: inherit; }
button { cursor: pointer; background: none; border: none; padding: 0; }
::-webkit-scrollbar { width: 0; height: 0; }

/* ═══════════════ 启动屏与门禁 ═══════════════ */
.boot {
  position: fixed; inset: 0; z-index: 60;
  display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 16px;
  background: var(--bg); color: var(--fg-2); font-size: 13px;
}
.boot-logo, .gate-logo {
  width: 68px; height: 68px; border-radius: 20px;
  display: grid; place-items: center;
  background: linear-gradient(145deg, #2563EB, #0A5CAD);
  color: #fff; font-size: 30px; font-weight: 700;
  box-shadow: 0 14px 32px -10px rgba(10, 92, 173, 0.5);
}
.boot-bar { width: 108px; height: 3.5px; border-radius: 4px; overflow: hidden; background: var(--line-strong); }
.boot-bar i { display: block; height: 100%; width: 42%; border-radius: 4px; background: var(--brand); animation: slide 1s ease-in-out infinite; }
@keyframes slide { 0% { transform: translateX(-110%); } 100% { transform: translateX(300%); } }

.gate { position: fixed; inset: 0; z-index: 70; display: grid; place-items: center; padding: 24px; background: var(--bg); }
.gate-card {
  width: 100%; max-width: 340px; padding: 30px 24px 22px;
  background: var(--card); border: 1px solid var(--line); border-radius: 22px;
  box-shadow: var(--shadow-md); text-align: center;
  display: flex; flex-direction: column; align-items: center; gap: 12px;
}
.gate-card h1 { margin: 4px 0 0; font-size: 22px; }
.gate-sub { margin: 0 0 6px; color: var(--fg-2); font-size: 13px; }
.gate-card input {
  width: 100%; height: 44px; padding: 0 14px; font-size: 15px;
  border-radius: 12px; border: 1px solid var(--line-strong); background: var(--card-subtle);
  outline: none;
}
.gate-err { color: var(--err); font-size: 12.5px; min-height: 18px; margin: 0; }

/* ═══════════════ 通用按钮系统 ═══════════════ */
.btn {
  border: none; border-radius: 11px; min-height: 40px; padding: 8px 16px;
  font-size: 14px; font-weight: 600; line-height: 1.25;
  display: inline-flex; align-items: center; justify-content: center; gap: 6px;
  transition: transform 0.12s ease, opacity 0.15s ease;
  text-decoration: none;
}
.btn:active { transform: scale(0.97); }
.btn.full { width: 100%; }
.btn.primary {
  color: #fff;
  background: linear-gradient(145deg, #2563EB, #0A5CAD);
  box-shadow: 0 6px 16px -6px rgba(10, 92, 173, 0.48);
}
.btn.ghost {
  background: var(--card-subtle);
  border: 1px solid var(--line-strong);
  color: var(--fg);
}
.btn.sm {
  min-height: 28px; padding: 4px 11px; border-radius: 999px;
  font-size: 12px; font-weight: 600; white-space: nowrap;
}

/* ═══════════════ 顶部栏（纯净毛玻璃） ═══════════════ */
.topbar {
  position: sticky; top: 0; z-index: 30;
  padding: calc(var(--safe-top) + 8px) 15px 9px;
  display: flex; align-items: center; justify-content: space-between; gap: 8px;
  background: color-mix(in srgb, var(--bg) 82%, transparent);
  backdrop-filter: saturate(1.8) blur(20px);
  -webkit-backdrop-filter: saturate(1.8) blur(20px);
  border-bottom: 1px solid var(--line);
}
.brand { display: flex; align-items: center; gap: 9px; min-width: 0; cursor: pointer; }
.brand-mark {
  width: 34px; height: 34px; border-radius: 10px; flex-shrink: 0;
  display: grid; place-items: center; color: #fff; font-weight: 700; font-size: 16px;
  background: linear-gradient(145deg, #2563EB, #0A5CAD);
  box-shadow: 0 4px 12px -4px rgba(10, 92, 173, 0.55);
}
.brand-text { display: flex; flex-direction: column; min-width: 0; line-height: 1.2; }
.brand-title-row { display: flex; align-items: center; gap: 5px; }
.brand-text b { font-size: 16px; font-weight: 700; letter-spacing: 0.2px; }
.brand-text i {
  font-style: normal; font-size: 11px; color: var(--fg-3);
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis; max-width: 46vw;
}

.top-actions { display: flex; align-items: center; gap: 6px; flex-shrink: 0; }
.sync-chip {
  display: inline-flex; align-items: center; gap: 5px;
  height: 30px; padding: 0 10px; border-radius: 999px;
  border: 1px solid var(--line); background: var(--card);
  color: var(--fg-2); font-size: 11.5px; font-weight: 600; white-space: nowrap;
}
.sync-chip .dot { width: 6.5px; height: 6.5px; border-radius: 50%; background: var(--ok); flex-shrink: 0; }
.sync-chip.ok .dot { background: var(--ok); }
.sync-chip.warn .dot { background: var(--warn); }
.sync-chip.err .dot { background: var(--err); }
.sync-chip.syncing .dot { background: var(--brand); animation: blink 1s infinite; }
@keyframes blink { 50% { opacity: 0.25; } }

.icon-btn {
  width: 32px; height: 32px; border-radius: 10px;
  display: grid; place-items: center;
  border: 1px solid var(--line); background: var(--card); color: var(--fg-2);
}
.icon-btn:active { transform: scale(0.93); }

.hint-bar {
  max-width: 600px; margin: 8px 14px 0; padding: 8px 30px 8px 12px;
  border-radius: 11px; font-size: 12px; color: var(--fg-2);
  background: color-mix(in srgb, var(--brand) 8%, var(--card));
  border: 1px solid color-mix(in srgb, var(--brand) 18%, transparent);
  position: relative;
}
.hint-bar.offline {
  padding-right: 12px; color: #B45309;
  background: color-mix(in srgb, var(--warn) 12%, var(--card));
  border-color: color-mix(in srgb, var(--warn) 28%, transparent);
}
@media (prefers-color-scheme: dark) { .hint-bar.offline { color: #FCD34D; } }
.hint-close { position: absolute; right: 6px; top: 50%; transform: translateY(-50%); width: 24px; height: 24px; color: var(--fg-3); font-size: 16px; }

/* ═══════════════ 主容器与分段控制器（iOS 原生滑块） ═══════════════ */
main { max-width: 600px; margin: 0 auto; padding: 10px 14px calc(40px + var(--safe-bottom)); }

.seg {
  --idx: 0;
  position: relative;
  display: grid; grid-template-columns: repeat(4, 1fr);
  padding: 3px; margin: 0 0 10px;
  border-radius: 12px;
  background: color-mix(in srgb, var(--fg) 6%, var(--card));
  border: 1px solid var(--line);
}
.seg button {
  position: relative; z-index: 2; height: 32px;
  font-size: 13px; font-weight: 600; color: var(--fg-2);
  border-radius: 9px; display: flex; align-items: center; justify-content: center; gap: 4px;
  white-space: nowrap; transition: color 0.2s ease;
}
.seg button.active { color: var(--fg); font-weight: 700; }
.seg-pill {
  position: absolute; z-index: 1; top: 3px; bottom: 3px; left: 3px;
  width: calc((100% - 6px) / 4);
  border-radius: 9px; background: var(--card);
  box-shadow: 0 1px 4px rgba(15, 23, 42, 0.1), 0 0 0 0.5px rgba(15, 23, 42, 0.04);
  transform: translateX(calc(var(--idx) * 100%));
  transition: transform 0.25s cubic-bezier(0.22, 1, 0.36, 1);
}
@media (prefers-color-scheme: dark) {
  .seg-pill { background: #24324B; box-shadow: 0 1px 4px rgba(0, 0, 0, 0.4); }
}
.tab-badge {
  font-style: normal; font-size: 10px; font-weight: 700;
  min-width: 15px; height: 15px; padding: 0 4px; border-radius: 999px;
  background: var(--err); color: #fff; display: inline-grid; place-items: center; line-height: 1;
}

/* ═══════════════ 紧凑一体化智能实况卡（Live Strip） ═══════════════ */
.live-strip {
  margin-bottom: 10px; padding: 11px 13px;
  border-radius: 14px; background: var(--card);
  border: 1px solid var(--line); box-shadow: var(--shadow-sm);
  cursor: pointer; transition: transform 0.12s ease;
}
.live-strip:active { transform: scale(0.99); }
.live-strip.ongoing {
  background: linear-gradient(135deg, color-mix(in srgb, var(--brand) 10%, var(--card)), var(--card));
  border-color: color-mix(in srgb, var(--brand) 28%, transparent);
}
.live-strip.upcoming {
  background: linear-gradient(135deg, color-mix(in srgb, var(--ok) 9%, var(--card)), var(--card));
  border-color: color-mix(in srgb, var(--ok) 28%, transparent);
}
.ls-row { display: flex; align-items: center; justify-content: space-between; gap: 10px; }
.ls-left { min-width: 0; flex: 1; }
.ls-kicker {
  display: flex; align-items: center; gap: 6px;
  font-size: 11px; font-weight: 700; color: var(--brand); letter-spacing: 0.2px;
}
.live-strip.upcoming .ls-kicker { color: #059669; }
.live-strip.preview .ls-kicker { color: var(--fg-3); font-weight: 600; }
@media (prefers-color-scheme: dark) {
  .live-strip.upcoming .ls-kicker { color: #34D399; }
}
.ls-dot { width: 6.5px; height: 6.5px; border-radius: 50%; background: currentColor; flex-shrink: 0; }
.live-strip.ongoing .ls-dot { animation: pulse-ring 1.6s infinite; }
@keyframes pulse-ring {
  0% { box-shadow: 0 0 0 0 color-mix(in srgb, var(--brand) 45%, transparent); }
  70% { box-shadow: 0 0 0 5px transparent; }
  100% { box-shadow: 0 0 0 0 transparent; }
}
.ls-title {
  margin-top: 2px; font-size: 14.5px; font-weight: 700; color: var(--fg);
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.ls-sub { font-size: 12px; color: var(--fg-2); margin-top: 1px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.ls-right { text-align: right; flex-shrink: 0; font-variant-numeric: tabular-nums; }
.ls-big { font-size: 17px; font-weight: 800; color: var(--brand); line-height: 1.1; }
.live-strip.upcoming .ls-big { color: #059669; }
.live-strip.preview .ls-big { font-size: 13px; font-weight: 700; color: var(--fg-2); }
@media (prefers-color-scheme: dark) { .live-strip.upcoming .ls-big { color: #34D399; } }
.ls-unit { font-size: 10.5px; color: var(--fg-3); display: block; margin-top: 1px; }
.ls-prog { height: 3px; border-radius: 3px; background: var(--line); margin-top: 8px; overflow: hidden; }
.ls-prog i { display: block; height: 100%; background: var(--brand); border-radius: 3px; }
.ls-radar {
  margin-top: 7px; padding-top: 7px; border-top: 1px dashed var(--line-strong);
  font-size: 11px; color: var(--fg-2); display: flex; align-items: center; gap: 6px;
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.ls-radar-tag {
  font-size: 10px; font-weight: 700; padding: 1px 5px; border-radius: 4px; flex-shrink: 0;
  background: color-mix(in srgb, var(--brand) 12%, transparent); color: var(--brand);
}

/* ═══════════════ 紧凑一体化周次控制条 ═══════════════ */
.weekbar {
  display: flex; align-items: center; justify-content: space-between; gap: 8px;
  padding: 5px 6px; margin-bottom: 10px;
  background: var(--card); border: 1px solid var(--line); border-radius: 12px;
  box-shadow: var(--shadow-sm);
}
.wk-arrow {
  width: 30px; height: 30px; border-radius: 8px;
  display: grid; place-items: center; color: var(--fg-2); flex-shrink: 0;
}
.wk-arrow:active { background: var(--card-subtle); }
.wk-center {
  flex: 1; min-width: 0; display: flex; align-items: center; justify-content: center; gap: 8px;
}
.wk-title-btn {
  display: inline-flex; align-items: center; gap: 6px;
  padding: 3px 8px; border-radius: 8px;
}
.wk-title-btn:active { background: var(--card-subtle); }
.wk-num { font-size: 14.5px; font-weight: 700; color: var(--fg); }
.wk-tag {
  font-size: 10.5px; font-weight: 700; padding: 1.5px 6px; border-radius: 6px;
  background: color-mix(in srgb, var(--brand) 12%, transparent); color: var(--brand);
}
.wk-tag.muted { background: var(--card-subtle); color: var(--fg-3); font-weight: 600; }
.wk-range { font-size: 11.5px; color: var(--fg-3); font-variant-numeric: tabular-nums; }
.wk-reset-pill {
  height: 24px; padding: 0 9px; border-radius: 999px;
  font-size: 11px; font-weight: 700; white-space: nowrap;
  background: var(--brand); color: #fff;
}

.views-container { position: relative; min-height: 360px; }
.view { animation: fade 0.18s ease; }
@keyframes fade { from { opacity: 0.4; transform: translateY(2px); } }

/* ═══════════════ 视图 1：日程列表（纯净克制 iOS 风） ═══════════════ */
.topic-notice {
  margin-bottom: 10px; padding: 9px 12px; border-radius: 12px;
  background: color-mix(in srgb, var(--purple) 8%, var(--card));
  border: 1px solid color-mix(in srgb, var(--purple) 22%, transparent);
  font-size: 12px; color: var(--fg-2);
}
.topic-notice b { color: var(--purple); font-weight: 700; margin-right: 4px; }
@media (prefers-color-scheme: dark) { .topic-notice b { color: #C4B5FD; } }

.day-group { margin-bottom: 14px; }
.day-head {
  display: flex; align-items: center; gap: 7px;
  padding: 2px 3px 6px;
}
.day-head .wd { font-size: 15px; font-weight: 700; color: var(--fg); display: inline-flex; align-items: center; gap: 6px; }
.day-group.today .day-head .wd { color: var(--brand); }
.today-pill {
  font-size: 10px; font-weight: 700; color: #fff; background: var(--brand);
  padding: 1px 6px; border-radius: 999px; line-height: 1.4;
}
.day-head .dt { font-size: 12px; color: var(--fg-3); font-variant-numeric: tabular-nums; }
.day-head .cnt { margin-left: auto; font-size: 11.5px; color: var(--fg-3); }

.day-cards { display: flex; flex-direction: column; gap: 7px; }
.day-empty {
  padding: 12px 14px; border-radius: 13px;
  background: var(--card); border: 1px dashed var(--line-strong);
  color: var(--fg-3); font-size: 12.5px; text-align: center;
}

.ev {
  display: flex; align-items: stretch; gap: 11px;
  padding: 11px 13px 11px 14px;
  border-radius: 14px; background: var(--card);
  border: 1px solid var(--line); box-shadow: var(--shadow-sm);
  position: relative; overflow: hidden; cursor: pointer;
  transition: transform 0.12s ease;
}
.ev::before {
  content: ''; position: absolute; left: 0; top: 10px; bottom: 10px; width: 3.5px;
  border-radius: 0 3px 3px 0; background: var(--c, var(--brand));
}
.ev:active { transform: scale(0.985); }
.ev.now {
  border-color: color-mix(in srgb, var(--brand) 38%, transparent);
  background: linear-gradient(90deg, color-mix(in srgb, var(--brand) 6%, var(--card)), var(--card));
}
.ev.past { opacity: 0.62; }

.ev-time {
  flex: 0 0 46px; display: flex; flex-direction: column; align-items: flex-start;
  font-variant-numeric: tabular-nums; line-height: 1.2; padding-top: 1px;
}
.ev-time .t1 { font-size: 14.5px; font-weight: 700; color: var(--fg); }
.ev-time .t2 { font-size: 11.5px; color: var(--fg-3); margin-top: 1px; }
.ev-time .u {
  margin-top: 4px; font-size: 10px; font-weight: 600; color: var(--fg-3);
  background: var(--card-subtle); padding: 1px 5px; border-radius: 4px;
  white-space: nowrap;
}

.ev-body { flex: 1; min-width: 0; display: flex; flex-direction: column; justify-content: center; }
.ev-title-line { display: flex; align-items: flex-start; justify-content: space-between; gap: 6px; }
.ev-name { font-size: 15px; font-weight: 650; color: var(--fg); line-height: 1.3; }
.ev-tags { display: flex; gap: 4px; flex-shrink: 0; padding-top: 1px; }

.tag-pill {
  font-size: 10px; font-weight: 700; padding: 1.5px 6px; border-radius: 5px;
  white-space: nowrap; line-height: 1.35;
}
.tag-pill.retake { background: rgba(245, 158, 11, 0.15); color: #B45309; }
.tag-pill.lab { background: rgba(124, 58, 237, 0.12); color: #6D28D9; }
.tag-pill.first { background: rgba(16, 185, 129, 0.14); color: #047857; }
.tag-pill.last { background: rgba(100, 116, 139, 0.14); color: var(--fg-2); }
.tag-pill.exam { background: rgba(239, 68, 68, 0.14); color: #DC2626; }
@media (prefers-color-scheme: dark) {
  .tag-pill.retake { color: #FBBF24; }
  .tag-pill.lab { color: #C4B5FD; }
  .tag-pill.first { color: #34D399; }
  .tag-pill.exam { color: #F87171; }
}

.ev-meta {
  margin-top: 5px; display: flex; align-items: center; flex-wrap: wrap; gap: 6px;
  font-size: 12px; color: var(--fg-2);
}
.room-chip {
  font-size: 11.5px; font-weight: 650; color: var(--brand);
  background: color-mix(in srgb, var(--brand) 9%, transparent);
  padding: 1px 6.5px; border-radius: 5px; white-space: nowrap;
}
.meta-sep { color: var(--fg-3); opacity: 0.5; }
.ev-note {
  margin-top: 6px; padding: 4px 8px; border-radius: 6px;
  background: color-mix(in srgb, var(--warn) 10%, var(--card-subtle));
  color: #92400E; font-size: 11.5px; line-height: 1.35;
}
@media (prefers-color-scheme: dark) { .ev-note { color: #FDE68A; } }

/* ═══════════════ 视图 2：网格课表（零重叠 · 零溢出 · 智能周末收窄） ═══════════════ */
.grid-card {
  border-radius: 16px; border: 1px solid var(--line);
  background: var(--card); box-shadow: var(--shadow-sm);
  overflow: hidden;
}
.grid {
  display: grid;
  grid-template-columns: 28px repeat(7, minmax(0, 1fr));
  grid-template-rows: 36px repeat(11, 46px);
  width: 100%;
}
/* 当周六周日无课时，自动把横向空间让给周一至周五，课程名多显示 25% 宽度！ */
.grid.compact-wknd {
  grid-template-columns: 28px repeat(5, minmax(0, 1.18fr)) repeat(2, minmax(0, 0.55fr));
}

.g-corner, .g-head {
  display: flex; flex-direction: column; align-items: center; justify-content: center;
  background: var(--card-subtle);
  border-bottom: 1px solid var(--line); border-right: 1px solid var(--line);
  overflow: hidden; min-width: 0; line-height: 1.15;
}
.g-head:last-child { border-right: none; }
.g-corner { font-size: 9.5px; font-weight: 700; color: var(--fg-3); }
.g-head .wd { font-size: 11px; font-weight: 700; color: var(--fg-2); white-space: nowrap; }
.g-head .dt { font-size: 9.5px; color: var(--fg-3); font-variant-numeric: tabular-nums; white-space: nowrap; margin-top: 1px; }
.g-head.today { background: color-mix(in srgb, var(--brand) 12%, var(--card-subtle)); }
.g-head.today .wd, .g-head.today .dt { color: var(--brand); font-weight: 800; }

.g-unit {
  display: flex; flex-direction: column; align-items: center; justify-content: center;
  background: var(--card-subtle);
  border-bottom: 1px solid var(--line); border-right: 1px solid var(--line);
  overflow: hidden; min-width: 0; padding: 0 1px; line-height: 1.1;
}
.g-unit b { font-size: 11px; font-weight: 700; color: var(--fg-2); }
.g-unit i {
  font-style: normal; font-size: 8px; color: var(--fg-3);
  letter-spacing: -0.3px; font-variant-numeric: tabular-nums;
  white-space: nowrap; margin-top: 1px;
}

.g-cell {
  border-bottom: 1px solid var(--line); border-right: 1px solid var(--line);
  min-width: 0;
}
.g-cell.col-7 { border-right: none; }
.g-cell.today-col { background: color-mix(in srgb, var(--brand) 3%, transparent); }

.g-ev {
  z-index: 2;
  margin: 1.5px; padding: 4px 4.5px;
  border-radius: 7px;
  border-left: 2.5px solid var(--bd, var(--brand));
  background: color-mix(in srgb, var(--bd, var(--brand)) 12%, var(--card));
  color: color-mix(in srgb, var(--bd, var(--brand)) 82%, #0F172A);
  display: flex; flex-direction: column; justify-content: space-between;
  overflow: hidden; min-width: 0; cursor: pointer;
  transition: transform 0.1s ease;
}
@media (prefers-color-scheme: dark) {
  .g-ev {
    background: color-mix(in srgb, var(--bd, var(--brand)) 22%, var(--card));
    color: color-mix(in srgb, var(--bd, var(--brand)) 42%, #FFFFFF);
  }
}
.g-ev:active { transform: scale(0.96); }
.g-ev .n {
  font-size: 10px; font-weight: 700; line-height: 1.2;
  word-break: break-all;
  display: -webkit-box; -webkit-line-clamp: 3; -webkit-box-orient: vertical;
  overflow: hidden;
}
.g-ev.span-3 .n { -webkit-line-clamp: 4; }
.g-ev .r {
  font-size: 8.5px; font-weight: 600; opacity: 0.86;
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
  margin-top: 2px; line-height: 1.1;
}

/* 通用分区小标题 */
.sec-head {
  display: flex; align-items: center; justify-content: space-between; gap: 8px;
  margin: 16px 2px 8px;
}
.sec-head h3 { margin: 0; font-size: 14px; font-weight: 700; color: var(--fg); }
.sec-sub { font-size: 11.5px; color: var(--fg-3); }

/* 学期课程全览列表 */
.course-list {
  border-radius: 14px; border: 1px solid var(--line);
  background: var(--card); box-shadow: var(--shadow-sm); overflow: hidden;
}
.course-row {
  display: flex; align-items: center; gap: 10px;
  padding: 10px 13px; border-bottom: 1px solid var(--line);
}
.course-row:last-child { border-bottom: none; }
.c-dot { width: 8px; height: 8px; border-radius: 50%; flex-shrink: 0; }
.c-main { flex: 1; min-width: 0; }
.c-title-row { display: flex; align-items: center; gap: 6px; }
.c-name { font-size: 13.5px; font-weight: 650; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.c-meta { font-size: 11.5px; color: var(--fg-3); margin-top: 1px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.c-side { text-align: right; flex-shrink: 0; }
.c-wk { font-size: 11.5px; font-weight: 600; color: var(--fg-2); font-variant-numeric: tabular-nums; }
.c-bar { width: 52px; height: 3.5px; border-radius: 3px; background: var(--line); margin: 4px 0 0 auto; overflow: hidden; }
.c-bar i { display: block; height: 100%; border-radius: 3px; }

/* ═══════════════ 视图 3：考试 · 待办（清爽三段式，绝不挤字穿模） ═══════════════ */
.exam-list { display: flex; flex-direction: column; gap: 8px; }
.exam-item {
  display: flex; align-items: center; gap: 11px;
  padding: 12px 13px; border-radius: 14px;
  background: var(--card); border: 1px solid var(--line); box-shadow: var(--shadow-sm);
}
.exam-item.past { opacity: 0.58; }

.exam-badge-box {
  flex: 0 0 52px; height: 50px; border-radius: 11px;
  display: flex; flex-direction: column; align-items: center; justify-content: center;
  background: rgba(239, 68, 68, 0.09); color: #DC2626;
  font-variant-numeric: tabular-nums; line-height: 1.15;
}
.exam-badge-box.pending {
  background: var(--card-subtle); border: 1px solid var(--line); color: var(--fg-3);
}
.exam-badge-box b { font-size: 15px; font-weight: 800; }
.exam-badge-box.pending b { font-size: 12.5px; font-weight: 700; color: var(--fg-2); }
.exam-badge-box i { font-style: normal; font-size: 9.5px; margin-top: 2px; opacity: 0.85; }

.exam-info { flex: 1; min-width: 0; }
.exam-name {
  font-size: 14.5px; font-weight: 700; color: var(--fg); line-height: 1.3;
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.exam-detail {
  margin-top: 3px; font-size: 12px; color: var(--fg-2);
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.exam-act-btn {
  flex-shrink: 0; height: 28px; padding: 0 10px; border-radius: 999px;
  font-size: 11.5px; font-weight: 650; white-space: nowrap;
  color: var(--brand); background: color-mix(in srgb, var(--brand) 10%, transparent);
}
.exam-act-btn:active { transform: scale(0.95); }

/* 待办清单 */
.ddl-card {
  display: flex; align-items: center; gap: 10px;
  padding: 11px 13px; border-radius: 13px;
  background: var(--card); border: 1px solid var(--line); box-shadow: var(--shadow-sm);
  margin-bottom: 7px;
}
.ddl-card.done { opacity: 0.55; }
.ddl-card.done .ddl-title { text-decoration: line-through; }
.ddl-check {
  width: 20px; height: 20px; border-radius: 6px; flex-shrink: 0;
  border: 1.8px solid var(--line-strong); background: var(--card-subtle);
  display: grid; place-items: center; color: #fff; font-size: 12px;
}
.ddl-card.done .ddl-check { background: var(--ok); border-color: var(--ok); }
.ddl-body { flex: 1; min-width: 0; }
.ddl-title { font-size: 14px; font-weight: 650; }
.ddl-meta { font-size: 11.5px; color: var(--fg-3); margin-top: 2px; display: flex; flex-wrap: wrap; gap: 6px; }
.ddl-del { color: var(--fg-3); font-size: 15px; padding: 4px; flex-shrink: 0; }

.empty-box {
  padding: 26px 16px; border-radius: 14px;
  background: var(--card); border: 1px dashed var(--line-strong);
  text-align: center; color: var(--fg-3); font-size: 12.5px;
}

/* ═══════════════ 视图 4：学业参谋（精致数据看板） ═══════════════ */
.acad-hero {
  padding: 16px; border-radius: 16px;
  background: linear-gradient(140deg, #0A5CAD, #1E3A8A);
  color: #fff; box-shadow: 0 10px 24px -10px rgba(10, 92, 173, 0.5);
  margin-bottom: 12px;
}
.ah-top { display: flex; align-items: flex-start; justify-content: space-between; gap: 10px; margin-bottom: 14px; }
.ah-stu b { font-size: 16px; display: block; }
.ah-stu span { font-size: 11.5px; opacity: 0.82; }
.ah-gpa { text-align: right; font-variant-numeric: tabular-nums; }
.ah-gpa b { font-size: 26px; font-weight: 800; line-height: 1; }
.ah-gpa i { display: block; font-style: normal; font-size: 10.5px; opacity: 0.8; margin-top: 2px; }
.ah-grid {
  display: grid; grid-template-columns: repeat(4, 1fr); gap: 6px;
  padding: 9px 8px; border-radius: 11px; background: rgba(255, 255, 255, 0.12);
}
.ah-kpi { text-align: center; font-variant-numeric: tabular-nums; }
.ah-kpi b { display: block; font-size: 14.5px; font-weight: 700; }
.ah-kpi i { font-style: normal; font-size: 10px; opacity: 0.82; }

.card-panel {
  background: var(--card); border: 1px solid var(--line); border-radius: 14px;
  padding: 13px 14px; box-shadow: var(--shadow-sm); margin-bottom: 12px;
}
.cp-head { display: flex; align-items: center; justify-content: space-between; margin-bottom: 10px; }
.cp-head h4 { margin: 0; font-size: 13.5px; font-weight: 700; }
.cp-head span { font-size: 11px; color: var(--fg-3); }

/* 历年学期柱状图 */
.sem-chart {
  display: grid; grid-template-columns: repeat(4, 1fr); gap: 10px;
  height: 108px; align-items: end; padding: 6px 4px 0;
}
.sc-col { display: flex; flex-direction: column; align-items: center; height: 100%; justify-content: flex-end; gap: 4px; }
.sc-val { font-size: 11.5px; font-weight: 700; color: var(--brand); font-variant-numeric: tabular-nums; }
.sc-track {
  width: 100%; max-width: 38px; flex: 1; border-radius: 7px;
  background: var(--card-subtle); display: flex; align-items: flex-end; padding: 2px;
}
.sc-fill { width: 100%; border-radius: 5px; background: linear-gradient(180deg, #3B82F6, #0A5CAD); }
.sc-lbl { font-size: 10.5px; color: var(--fg-3); white-space: nowrap; }

/* GPA 推演模拟器 */
.sim-summary {
  display: flex; align-items: center; justify-content: space-between;
  padding: 10px 12px; border-radius: 11px; margin-bottom: 10px;
  background: color-mix(in srgb, var(--ok) 9%, var(--card-subtle));
  border: 1px solid color-mix(in srgb, var(--ok) 24%, transparent);
}
.sim-summary .lbl { font-size: 11px; color: var(--fg-2); }
.sim-summary .val { font-size: 17px; font-weight: 800; color: #059669; font-variant-numeric: tabular-nums; }
@media (prefers-color-scheme: dark) { .sim-summary .val { color: #34D399; } }
.sim-presets { display: grid; grid-template-columns: repeat(3, 1fr); gap: 6px; margin-bottom: 10px; }
.sim-presets button {
  height: 28px; border-radius: 8px; font-size: 11.5px; font-weight: 600;
  background: var(--card-subtle); border: 1px solid var(--line-strong); color: var(--fg-2);
}
.sim-presets button:active { background: color-mix(in srgb, var(--brand) 10%, var(--card)); color: var(--brand); }
.sim-row {
  display: flex; align-items: center; gap: 8px;
  padding: 6px 0; border-bottom: 1px dashed var(--line); font-size: 12.5px;
}
.sim-row:last-child { border-bottom: none; }
.sim-name { flex: 1; min-width: 0; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; font-weight: 600; }
.sim-cred { font-size: 11px; color: var(--fg-3); flex-shrink: 0; width: 42px; text-align: right; white-space: nowrap; }
.sim-slider { width: 84px; accent-color: var(--brand); flex-shrink: 0; }
.sim-score { width: 62px; text-align: right; font-size: 11.5px; font-weight: 700; color: var(--brand); font-variant-numeric: tabular-nums; flex-shrink: 0; }

/* 培养方案进度条 */
.plan-row { padding: 6px 0; border-bottom: 1px solid var(--line); }
.plan-row:last-child { border-bottom: none; }
.pr-top { display: flex; justify-content: space-between; font-size: 12px; margin-bottom: 4px; }
.pr-name { font-weight: 600; color: var(--fg); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; padding-right: 8px; }
.pr-val { font-variant-numeric: tabular-nums; color: var(--fg-2); flex-shrink: 0; font-size: 11.5px; }
.pr-bar { height: 4.5px; border-radius: 3px; background: var(--line); overflow: hidden; }
.pr-bar i { display: block; height: 100%; border-radius: 3px; background: var(--brand); }
.pr-bar.done i { background: var(--ok); }

/* 成绩单筛选与列表 */
.grade-toolbar { display: flex; flex-direction: column; gap: 8px; margin-bottom: 10px; }
.grade-search {
  width: 100%; height: 34px; padding: 0 11px; border-radius: 9px;
  border: 1px solid var(--line-strong); background: var(--card-subtle);
  font-size: 13px; outline: none;
}
.grade-chips { display: flex; gap: 6px; }
.g-chip {
  height: 26px; padding: 0 10px; border-radius: 999px; font-size: 11.5px; font-weight: 600;
  background: var(--card-subtle); border: 1px solid var(--line); color: var(--fg-2);
}
.g-chip.active { background: var(--brand); color: #fff; border-color: transparent; }

.grade-row {
  display: flex; align-items: center; justify-content: space-between; gap: 10px;
  padding: 9px 2px; border-bottom: 1px solid var(--line);
}
.grade-row:last-child { border-bottom: none; }
.g-name { font-size: 13.5px; font-weight: 650; }
.g-sub { font-size: 11px; color: var(--fg-3); margin-top: 1px; }
.g-score { text-align: right; flex-shrink: 0; font-variant-numeric: tabular-nums; line-height: 1.2; }
.g-score b { font-size: 15px; font-weight: 800; color: var(--brand); display: block; }
.g-score.high b { color: var(--ok); }
.g-score.fail b { color: var(--err); }
.g-score i { font-style: normal; font-size: 10.5px; color: var(--fg-3); }

/* ═══════════════ 页脚与底部抽屉（Sheet） ═══════════════ */
.foot { margin-top: 22px; text-align: center; color: var(--fg-3); font-size: 11px; line-height: 1.65; }
.foot-sub { opacity: 0.8; }

.backdrop {
  position: fixed; inset: 0; z-index: 40;
  background: rgba(15, 23, 42, 0.42);
  backdrop-filter: blur(3px); -webkit-backdrop-filter: blur(3px);
}
.sheet {
  position: fixed; left: 0; right: 0; bottom: 0; z-index: 50;
  max-height: 86vh; overflow-y: auto;
  background: var(--card); border-radius: 20px 20px 0 0;
  padding: 8px 16px calc(22px + var(--safe-bottom));
  box-shadow: 0 -16px 48px rgba(0, 0, 0, 0.28);
  animation: sheet-in 0.24s cubic-bezier(0.22, 1, 0.36, 1);
}
@keyframes sheet-in { from { transform: translateY(48px); opacity: 0.5; } }
@media (min-width: 600px) {
  .sheet { left: 50%; transform: translateX(-50%); max-width: 520px; border-radius: 20px; bottom: 20px; }
}
.sheet-grip { width: 36px; height: 4px; border-radius: 3px; background: var(--line-strong); margin: 4px auto 12px; }
.sheet h3 { margin: 2px 0 4px; font-size: 17px; font-weight: 700; }
.sheet .sub { font-size: 12px; color: var(--fg-3); margin-bottom: 12px; }

/* 周次快速选择矩阵 */
.week-picker-grid { display: grid; grid-template-columns: repeat(4, 1fr); gap: 8px; margin-top: 8px; }
.wk-cell {
  height: 46px; border-radius: 11px; border: 1px solid var(--line);
  background: var(--card-subtle);
  display: flex; flex-direction: column; align-items: center; justify-content: center;
  line-height: 1.25;
}
.wk-cell b { font-size: 13px; font-weight: 700; }
.wk-cell i { font-style: normal; font-size: 10px; color: var(--fg-3); }
.wk-cell.cur { border-color: var(--brand); }
.wk-cell.sel { background: var(--brand); color: #fff; border-color: transparent; }
.wk-cell.sel i { color: rgba(255, 255, 255, 0.85); }

/* 详情键值对与表单 */
.kv-box {
  border-radius: 12px; border: 1px solid var(--line);
  background: var(--card-subtle); padding: 4px 12px; margin-bottom: 12px;
}
.kv-row {
  display: flex; justify-content: space-between; gap: 12px;
  padding: 8px 0; border-bottom: 1px solid var(--line); font-size: 13px;
}
.kv-row:last-child { border-bottom: none; }
.kv-row .k { color: var(--fg-3); flex-shrink: 0; }
.kv-row .v { font-weight: 600; text-align: right; }

.form-group { margin-bottom: 11px; }
.form-label { display: block; font-size: 12px; font-weight: 600; color: var(--fg-2); margin-bottom: 5px; }
.form-input, .form-select, .form-textarea {
  width: 100%; border-radius: 10px; border: 1px solid var(--line-strong);
  background: var(--card-subtle); color: var(--fg);
  padding: 9px 11px; font-size: 14px; outline: none;
}
.form-textarea { min-height: 68px; resize: vertical; line-height: 1.4; }
.form-row-2 { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.sheet-actions { display: flex; gap: 8px; margin-top: 12px; }
.sheet-actions .btn { flex: 1; }

/* 设置分组 */
.set-group {
  border: 1px solid var(--line); border-radius: 13px;
  background: var(--card-subtle); padding: 11px 13px; margin-bottom: 11px;
}
.set-group h4 { margin: 0 0 8px; font-size: 13px; font-weight: 700; color: var(--fg); }
.set-row {
  display: flex; align-items: center; justify-content: space-between; gap: 10px;
  padding: 8px 0; border-top: 1px solid var(--line);
}
.set-group h4 + .set-row { border-top: none; padding-top: 2px; }
.set-row .label { font-size: 13.5px; font-weight: 600; }
.set-row .desc { font-size: 11.5px; color: var(--fg-3); margin-top: 2px; line-height: 1.35; }

.toast {
  position: fixed; left: 50%; bottom: calc(32px + var(--safe-bottom));
  transform: translateX(-50%); z-index: 80;
  max-width: 86vw; padding: 9px 16px; border-radius: 999px;
  background: rgba(15, 23, 42, 0.92); color: #fff;
  font-size: 12.5px; font-weight: 500; text-align: center;
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.35);
}
@media (prefers-color-scheme: dark) {
  .toast { background: rgba(241, 245, 249, 0.95); color: #0F172A; }
}
