/* ============================================================
   智课云 v3.2 · 全平台优化样式
   修复：移动端表格视图 · IP获取多源降级 · 视图切换逻辑
   ============================================================ */
:root {
  --sky: #0ea5e9;
  --sky2: #0284c7;
  --sky3: #38bdf8;
  --sky4: #7dd3fc;
  --sky-bg: #f0f7ff;
  --sky-border: #bae6fd;
  --sky-light: #e0f2fe;
  --card: #ffffff;
  --text: #0f172a;
  --text2: #334155;
  --muted: #64748b;
  --green: #10b981;
  --green2: #059669;
  --red: #ef4444;
  --gold: #f59e0b;
  --orange: #f97316;
  --purple: #8b5cf6;
  --blue: #3b82f6;
  --sidebar-w: 260px;
  --header-h: 58px;
  --radius: 14px;
  --shadow: 0 2px 12px rgba(14,165,233,.1);
  --shadow-md: 0 4px 20px rgba(14,165,233,.14);
  --shadow-lg: 0 8px 32px rgba(14,165,233,.18);
  --tab-h: 60px;
  --accent: var(--sky);
}

* { margin: 0; padding: 0; box-sizing: border-box; -webkit-tap-highlight-color: transparent; }
html { font-size: 16px; scroll-behavior: smooth; }
body {
  font-family: 'Noto Sans SC', -apple-system, BlinkMacSystemFont, sans-serif;
  background: var(--sky-bg);
  color: var(--text);
  min-height: 100vh;
  overflow-x: hidden;
}

::-webkit-scrollbar { width: 4px; height: 4px; }
::-webkit-scrollbar-thumb { background: var(--sky-border); border-radius: 2px; }

/* ============================================================
   顶部栏
   ============================================================ */
.topbar {
  position: fixed; top: 0; left: 0; right: 0; z-index: 200;
  height: var(--header-h);
  background: linear-gradient(135deg, var(--sky2) 0%, var(--sky) 60%, #22d3ee 100%);
  display: flex; align-items: center; gap: .5rem; padding: 0 .7rem;
  box-shadow: 0 2px 16px rgba(2,132,199,.25);
}
.topbar-menu-btn {
  width: 38px; height: 38px; border: none; background: rgba(255,255,255,.15);
  border-radius: 10px; color: #fff; font-size: 1.05rem; cursor: pointer;
  display: flex; align-items: center; justify-content: center; flex-shrink: 0;
  transition: background .2s;
}
.topbar-menu-btn:hover { background: rgba(255,255,255,.25); }
.topbar-title { flex: 1; min-width: 0; display: flex; flex-direction: column; overflow: hidden; }
.topbar-school { font-size: .78rem; color: rgba(255,255,255,.82); font-weight: 400; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.topbar-class { font-size: .98rem; font-weight: 700; color: #fff; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; font-family: 'Noto Serif SC', serif; }
.topbar-actions { display: flex; gap: .35rem; flex-shrink: 0; align-items: center; }
.topbar-btn {
  min-width: 34px; height: 34px; border: none; background: rgba(255,255,255,.15);
  border-radius: 9px; color: #fff; font-size: .95rem; cursor: pointer;
  display: flex; align-items: center; justify-content: center; transition: background .2s;
  padding: 0 .45rem;
}
.topbar-btn:hover { background: rgba(255,255,255,.28); }
/* 视图切换按钮：文字型，自适应宽度 */
#viewToggleBtn { font-size: .63rem; font-weight: 600; letter-spacing: -.01em; white-space: nowrap; gap:.2rem; }
/* 邮件按钮红点 */
.mail-badge { position:absolute;top:4px;right:4px;width:8px;height:8px;background:#ef4444;border-radius:50%;border:1.5px solid var(--sky2); }
/* schedule-only 按钮：只在课程表tab显示 */
.schedule-only-btn { display: flex; }
body:not(.tab-schedule) .schedule-only-btn { display: none !important; }

/* ============================================================
   侧边栏
   ============================================================ */
.sidebar-overlay {
  position: fixed; inset: 0; z-index: 300; background: rgba(15,23,42,.45);
  opacity: 0; pointer-events: none; transition: opacity .28s; backdrop-filter: blur(2px);
}
.sidebar-overlay.open { opacity: 1; pointer-events: auto; }

.sidebar {
  position: fixed; top: 0; left: 0; bottom: 0; width: var(--sidebar-w); z-index: 350;
  background: linear-gradient(180deg, var(--sky2) 0%, #0369a1 100%);
  display: flex; flex-direction: column; overflow: hidden;
  transform: translateX(-100%); transition: transform .3s cubic-bezier(.4,0,.2,1);
  box-shadow: 4px 0 30px rgba(2,132,199,.3);
}
.sidebar.open { transform: translateX(0); }

.sidebar-head { padding: 1.2rem 1rem 0; }
.sidebar-brand { display: flex; align-items: center; gap: .65rem; padding: .5rem 0 1rem; }
.brand-logo { width: 38px; height: 38px; background: rgba(255,255,255,.18); border-radius: 11px; display: flex; align-items: center; justify-content: center; font-size: 1.1rem; color: #fff; flex-shrink: 0; }
.brand-name { font-size: .95rem; font-weight: 700; color: #fff; font-family: 'Noto Serif SC', serif; }
.brand-version { font-size: .68rem; color: rgba(255,255,255,.5); margin-top: .1rem; }

.sidebar-user { display: flex; align-items: center; gap: .7rem; background: rgba(255,255,255,.1); border-radius: 12px; padding: .7rem .85rem; margin-bottom: .7rem; cursor: pointer; transition: background .2s; }
.sidebar-user:hover { background: rgba(255,255,255,.18); }
.user-avatar { width: 36px; height: 36px; border-radius: 50%; background: rgba(255,255,255,.25); color: #fff; font-size: .95rem; font-weight: 700; display: flex; align-items: center; justify-content: center; flex-shrink: 0; }
.user-info { flex: 1; min-width: 0; }
.user-name { font-size: .87rem; font-weight: 600; color: #fff; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.user-class { font-size: .7rem; color: rgba(255,255,255,.52); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }

.sidebar-nav { flex: 1; overflow-y: auto; padding: .7rem 0; }
.nav-group-title { font-size: .66rem; font-weight: 600; letter-spacing: .08em; text-transform: uppercase; color: rgba(255,255,255,.4); padding: .8rem 1rem .3rem; }
.nav-item {
  display: flex; align-items: center; gap: .65rem; padding: .62rem 1.1rem;
  color: rgba(255,255,255,.75); font-size: .87rem; text-decoration: none;
  border-radius: 10px; margin: .08rem .55rem; cursor: pointer; transition: all .18s;
}
.nav-item:hover { background: rgba(255,255,255,.12); color: #fff; }
.nav-item.active { background: rgba(255,255,255,.18); color: #fff; font-weight: 600; }
.nav-item i { width: 16px; text-align: center; flex-shrink: 0; }

.sidebar-foot { padding: .8rem; border-top: 1px solid rgba(255,255,255,.1); }
.sidebar-logout { width: 100%; padding: .6rem; background: rgba(239,68,68,.15); border: 1px solid rgba(239,68,68,.25); border-radius: 10px; color: rgba(255,255,255,.75); font-size: .83rem; cursor: pointer; display: flex; align-items: center; justify-content: center; gap: .5rem; transition: all .18s; }
.sidebar-logout:hover { background: rgba(239,68,68,.28); color: #fff; }

/* ============================================================
   主区域
   ============================================================ */
.main {
  padding-top: var(--header-h);
  padding-bottom: var(--tab-h);
  min-height: 100vh;
}

/* ============================================================
   课表页头
   ============================================================ */
.header-card {
  background: linear-gradient(135deg, var(--sky2) 0%, var(--sky) 60%, #22d3ee 100%);
  padding: 1.15rem 1rem 1rem; position: relative; overflow: hidden;
  box-shadow: 0 4px 20px rgba(2,132,199,.22);
}
.header-card::before {
  content: ''; position: absolute; top: -30px; right: -30px;
  width: 140px; height: 140px; background: rgba(255,255,255,.07);
  border-radius: 50%; pointer-events: none;
}
.hc-school { font-size: .78rem; color: rgba(255,255,255,.8); font-weight: 400; margin-bottom: .15rem; }
.hc-class { font-size: 1.18rem; font-weight: 700; color: #fff; font-family: 'Noto Serif SC', serif; }
.hc-meta { font-size: .72rem; color: rgba(255,255,255,.62); margin-top: .2rem; }
.hc-actions { display: none; gap: .5rem; margin-top: .55rem; align-items: center; }
.hc-action-btn { padding: .4rem .9rem; background: rgba(255,255,255,.18); border: 1px solid rgba(255,255,255,.3); border-radius: 20px; color: #fff; font-size: .78rem; cursor: pointer; display: flex; align-items: center; gap: .4rem; transition: background .2s; white-space: nowrap; }
.hc-action-btn:hover { background: rgba(255,255,255,.28); }
.hc-action-btn.public-on { background: rgba(16,185,129,.28); border-color: rgba(16,185,129,.5); }

.hc-status { margin-top: .5rem; font-size: .78rem; display: flex; align-items: center; gap: .4rem; flex-wrap: wrap; color: rgba(255,255,255,.9); }
.status-dot { width: 7px; height: 7px; border-radius: 50%; flex-shrink: 0; background: #94a3b8; }

/* 🔴 正在上课 — 红色闪烁 */
.status-dot.in-class {
  background: #ef4444;
  box-shadow: 0 0 8px #ef4444;
  animation: pulse-red 1.5s infinite;
}

/* 🟡 课间 / 下节课即将开始 — 黄色闪烁 */
.status-dot.break-dot {
  background: #facc15;
  box-shadow: 0 0 8px #facc15;
  animation: pulse-yellow 1.5s infinite;
}

/* 🟢 今日课程结束 / 空闲 — 绿色闪烁 */
.status-dot.free-dot {
  background: #22c55e;
  box-shadow: 0 0 8px #22c55e;
  animation: pulse-green 1.5s infinite;
}

/* 🔵 睡眠时段 / 明日信息 — 蓝色 */
.status-dot.sleep-dot {
  background: #38bdf8;
  box-shadow: 0 0 8px #38bdf8;
  animation: pulse-blue 2s infinite;
}

/* 🟣 放假 — 紫色 */
.status-dot.holiday-dot {
  background: #a855f7;
  box-shadow: 0 0 8px #a855f7;
  animation: pulse-purple 2s infinite;
}

/* ⚪ 离线/加载中 */
.status-dot.offline { background: #94a3b8; }

/* 所有状态文字统一白色（位于蓝色渐变header上） */
.hcs-class,
.hcs-break,
.hcs-free,
.hcs-sleep,
.hcs-holiday { color: #ffffff; }
.hcs-countdown { background: rgba(255,255,255,.18); border-radius: 6px; padding: .1rem .45rem; font-size: .7rem; color: #fff; font-variant-numeric: tabular-nums; letter-spacing: .02em; }
#statusCountdownVal { font-family: ui-monospace, 'SF Mono', monospace; font-size: .72rem; }

@keyframes pulse-red    { 0%,100%{box-shadow:0 0 5px #ef4444}50%{box-shadow:0 0 14px #ef4444,0 0 22px #ef444466} }
@keyframes pulse-yellow { 0%,100%{box-shadow:0 0 5px #facc15}50%{box-shadow:0 0 14px #facc15,0 0 22px #facc1566} }
@keyframes pulse-green  { 0%,100%{box-shadow:0 0 5px #22c55e}50%{box-shadow:0 0 14px #22c55e,0 0 22px #22c55e66} }
@keyframes pulse-blue   { 0%,100%{box-shadow:0 0 5px #38bdf8}50%{box-shadow:0 0 12px #38bdf8,0 0 18px #38bdf866} }
@keyframes pulse-purple { 0%,100%{box-shadow:0 0 5px #a855f7}50%{box-shadow:0 0 12px #a855f7,0 0 18px #a855f766} }

/* ============================================================
   周次导航
   ============================================================ */
.week-nav {
  display: flex; align-items: center; gap: .35rem; padding: .55rem .7rem;
  background: var(--card); border-bottom: 1px solid var(--sky-border);
  overflow-x: auto; -webkit-overflow-scrolling: touch; white-space: nowrap;
}
.week-nav-btn {
  width: 34px; height: 34px; flex-shrink: 0; border: 1.5px solid var(--sky-border);
  background: var(--sky-bg); border-radius: 9px; color: var(--sky2); font-size: .85rem;
  cursor: pointer; display: flex; align-items: center; justify-content: center;
  transition: all .18s;
}
.week-nav-btn:hover { background: var(--sky-light); border-color: var(--sky3); }
.week-select-wrap { flex-shrink: 0; }
.week-select {
  height: 34px; border: 1.5px solid var(--sky-border); border-radius: 9px;
  background: var(--sky-bg); color: var(--sky2); font-size: .82rem; padding: 0 .6rem;
  cursor: pointer; outline: none; font-weight: 600;
}
.week-label { font-size: .78rem; color: var(--muted); display: none; flex-shrink: 0; }
.today-chip {
  flex-shrink: 0; padding: .25rem .65rem; background: linear-gradient(135deg, var(--sky2), var(--sky));
  color: #fff; border: none; border-radius: 20px; font-size: .75rem; font-weight: 600;
  cursor: pointer; transition: opacity .18s; white-space: nowrap;
}
.today-chip:hover { opacity: .85; }
.mode-chip {
  flex-shrink: 0; padding: .25rem .65rem; background: linear-gradient(135deg, #f97316, #fbbf24);
  color: #fff; border: none; border-radius: 20px; font-size: .75rem; font-weight: 600;
  cursor: pointer; transition: opacity .18s; white-space: nowrap;
}
.mode-chip.winter { background: linear-gradient(135deg, #0ea5e9, #6366f1); }
.mode-chip.custom { background: linear-gradient(135deg, #8b5cf6, #ec4899); }
.mode-chip:hover { opacity: .85; }

/* 视图切换按钮 — 在周次导航栏内，紧邻模式按钮 */
.view-toggle-chip {
  flex-shrink: 0; padding: .25rem .65rem;
  background: linear-gradient(135deg, #475569, #64748b);
  color: #fff; border: none; border-radius: 20px; font-size: .75rem; font-weight: 600;
  cursor: pointer; transition: all .18s; white-space: nowrap;
}
.view-toggle-chip:hover { opacity: .85; }
.view-toggle-chip.table-mode { background: linear-gradient(135deg, #0369a1, var(--sky2)); }

/* ============================================================
   统计行
   ============================================================ */
.stats-row { display: flex; gap: .5rem; padding: .6rem .85rem; overflow-x: auto; -webkit-overflow-scrolling: touch; }
.stat-chip { background: var(--card); border: 1.5px solid var(--sky-border); border-radius: 10px; padding: .45rem .75rem; display: flex; align-items: center; gap: .35rem; white-space: nowrap; box-shadow: var(--shadow); }
.stat-chip-val { font-size: 1.1rem; font-weight: 700; color: var(--sky2); }
.stat-chip-lbl { font-size: .7rem; color: var(--muted); }

/* ============================================================
   过滤栏
   ============================================================ */
.filter-bar { padding: .4rem .85rem; display: flex; gap: .4rem; overflow-x: auto; -webkit-overflow-scrolling: touch; }
.filter-tag { padding: .25rem .65rem; background: var(--card); border: 1.5px solid var(--sky-border); border-radius: 20px; font-size: .75rem; color: var(--text2); cursor: pointer; white-space: nowrap; transition: all .18s; }
.filter-tag.active { background: var(--sky2); border-color: var(--sky2); color: #fff; }

/* ============================================================
   ★ 课程表视图 — 核心修复 ★
   
   移动端默认显示列表视图。
   当用户切换到表格视图时（body 上无 list-mode class），
   .schedule-table-wrap 必须能显示。
   
   修复逻辑：
   - 移动端：默认 list-mode → 列表显示，表格隐藏
   - 移动端：切换后 !list-mode → 表格显示，列表隐藏
   - 桌面端：默认 !list-mode → 表格显示
   ============================================================ */

/* 移动端默认：列表显示，表格隐藏 */
.schedule-table-wrap {
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
  /* 底部留白 = tab栏(60px) + FAB主按钮(52px) + 间践 \uff0c防止最后一节课被FAB遮挡 */
  padding: .6rem .6rem calc(var(--tab-h) + 4.5rem) .6rem;
  display: none;
}
.list-view {
  display: block;
  padding: .5rem .65rem calc(var(--tab-h) + 4.5rem);
}

/* 移动端 list-mode（默认态）：列表 ✓ 表格 ✗ */
body.list-mode .schedule-table-wrap { display: none; }
body.list-mode .list-view { display: block; }

/* ★ 关键修复：移动端表格视图（非 list-mode 时）*/
body:not(.list-mode) .schedule-table-wrap { display: block; }
body:not(.list-mode) .list-view { display: none; }

.schedule-table {
  width: 100%;
  border-collapse: separate;
  border-spacing: 3px;
  min-width: 520px;   /* 移动端允许更小 */
}
.schedule-table th {
  background: linear-gradient(135deg, var(--sky2), var(--sky));
  color: #fff; font-size: .68rem; font-weight: 600; padding: .45rem .2rem;
  border-radius: 7px; text-align: center; white-space: nowrap; vertical-align: middle;
  min-width: 46px;
}
.schedule-table th.today-col { background: linear-gradient(135deg, #ea580c, var(--orange)); box-shadow: 0 2px 10px rgba(249,115,22,.35); }
.schedule-table td {
  background: var(--card); border-radius: 8px; vertical-align: top;
  padding: .3rem; min-height: 52px; cursor: pointer; transition: background .15s;
}
.schedule-table td:hover { background: var(--sky-light); }
.schedule-table td.drop-target { background: rgba(14,165,233,.07); outline: 2px dashed rgba(14,165,233,.35); outline-offset: -2px; }
.schedule-table td.drag-over { background: rgba(14,165,233,.18); outline-color: var(--sky); }
.schedule-table td.droppable-hint { outline: 2px dashed rgba(14,165,233,.2); outline-offset: -2px; }
.time-label-cell { background: var(--sky-bg) !important; cursor: default !important; width: 64px; }
.time-label { display: flex; flex-direction: column; align-items: center; justify-content: center; padding: .18rem .06rem; gap:.04rem; }
.time-label strong { font-size: .67rem; color: var(--text2); font-weight: 600; }
.time-detail { display: flex; flex-direction: column; align-items: center; gap: .04rem; width: 100%; }
.slot-mini { font-size: .52rem; color: var(--muted); display: flex; align-items: center; gap: .12rem; white-space: nowrap; line-height:1.3; }
.slot-mini em { font-style: normal; color: var(--sky2); font-weight: 500; }
.slot-note { font-size: .48rem; color: var(--orange); margin-top: .04rem; }
.slot-note { font-size: .54rem; color: var(--orange); margin-top: .05rem; }
tr.time-type-break td { background: rgba(14,165,233,.03) !important; }

/* 移动端表格：时间列更窄，课程格字体更小 */
@media (max-width: 767px) {
  .schedule-table { min-width: 480px; }
  .time-label-cell { width: 48px; }
  .schedule-table th { font-size: .62rem; padding: .35rem .15rem; min-width: 40px; }
  .schedule-table td { padding: .2rem; min-height: 44px; }
  .course-name { font-size: .67rem !important; }
  .course-teacher { font-size: .6rem !important; }
  .course-room { font-size: .58rem !important; }
}

/* ============================================================
   课程格
   ============================================================ */
.course {
  border-radius: 7px; border-left: 3px solid; padding: .3rem .32rem;
  cursor: pointer; position: relative; transition: transform .15s, box-shadow .15s;
  font-size: .72rem; user-select: none; min-height: 40px;
}
.course:hover { transform: translateY(-1px); box-shadow: 0 3px 12px rgba(0,0,0,.12); }
.course:hover .course-actions { opacity: 1; }
.course-conflict { border-left-color: #ef4444 !important; background: #fef2f2 !important; }
.course-actions {
  position: absolute; top: 2px; right: 2px;
  display: flex; gap: 2px; opacity: 0; transition: opacity .18s;
  background: rgba(255,255,255,.9); border-radius: 6px; padding: 2px;
}
/* 移动端触摸显示操作按钮 */
.course.actions-visible .course-actions { opacity: 1; }
.course-action-btn {
  width: 20px; height: 20px; border: none; background: none;
  border-radius: 4px; cursor: pointer; font-size: .68rem;
  display: flex; align-items: center; justify-content: center;
  color: var(--muted); transition: all .15s;
}
.course-action-btn:hover { background: var(--sky-light); color: var(--sky2); }
.course.dragging { opacity: .5; transform: scale(.95); }
.course-name { font-size: .73rem; font-weight: 600; color: var(--text); line-height: 1.25; margin-bottom: .15rem; }
.course-teacher { font-size: .63rem; color: var(--text2); }
.course-room { font-size: .62rem; color: var(--muted); margin-top: .1rem; }
.course-notes { font-size: .58rem; color: var(--orange); margin-top: .12rem; line-height: 1.25; word-break: break-word; }

/* ============================================================
   列表视图
   ============================================================ */
.day-section { margin-bottom: .8rem; }
.day-header {
  display: flex; align-items: center; padding: .55rem .85rem;
  background: var(--card); border-radius: 11px 11px 0 0;
  border-bottom: 2px solid var(--sky-border);
  box-shadow: var(--shadow);
}
.day-header.today { border-bottom-color: var(--sky2); background: linear-gradient(135deg, #eff6ff, #e0f2fe); }
.day-header.holiday { background: linear-gradient(135deg, #ecfdf5, #d1fae5); border-bottom-color: var(--green); }
.day-name { font-size: .88rem; font-weight: 700; color: var(--text); }
.day-date { font-size: .75rem; color: var(--muted); }
.day-tag { padding: .2rem .55rem; border-radius: 10px; font-size: .68rem; font-weight: 600; background: var(--sky-bg); color: var(--sky2); }
.day-tag.today-tag { background: var(--sky2); color: #fff; }
.day-tag.holiday-tag { background: var(--green); color: #fff; }

.course-card {
  display: flex; align-items: center; padding: .6rem .85rem;
  background: var(--card); border-bottom: 1px solid var(--sky-border);
  gap: .7rem; transition: background .15s; cursor: pointer;
}
.course-card:last-child { border-radius: 0 0 11px 11px; border-bottom: none; box-shadow: var(--shadow); }
.course-card:hover { background: var(--sky-bg); }
.course-card-color { width: 4px; height: 42px; border-radius: 3px; flex-shrink: 0; }
.course-card-body { flex: 1; min-width: 0; }
.cc-name { font-size: .88rem; font-weight: 600; color: var(--text); }
.cc-info { display: flex; flex-wrap: wrap; gap: .3rem .65rem; margin-top: .2rem; font-size: .73rem; color: var(--muted); }
.cc-info span { display: flex; align-items: center; gap: .25rem; }
.cc-info i { font-size: .65rem; }
/* 桌面端: opacity 控制显隐，鼠标移入发现，移出消失 */
.course-card-actions {
  display: flex; align-items: center; gap: .4rem; flex-shrink: 0;
  opacity: 0; transition: opacity .15s;
  pointer-events: none;
}
.course-card:hover .course-card-actions {
  opacity: 1;
  pointer-events: auto;
}
/* 移动端触摸: 点击卡片弹出操作按钮 */
@media (max-width: 767px) {
  .course-card-actions {
    opacity: 0;
    display: none;
    pointer-events: none;
  }
  .course-card.actions-visible .course-card-actions {
    display: flex;
    opacity: 1;
    pointer-events: auto;
  }
}
.cc-time { font-size: .73rem; color: var(--sky2); font-weight: 600; white-space: nowrap; }
.cc-action {
  width: 28px; height: 28px; border: none; background: var(--sky-bg);
  border-radius: 7px; cursor: pointer; font-size: .72rem; color: var(--muted);
  display: flex; align-items: center; justify-content: center; transition: all .15s;
}
.cc-action.edit:hover { background: var(--sky-light); color: var(--sky2); }
.cc-action.del:hover { background: #fef2f2; color: var(--red); }
.cc-action.copy:hover { background: #f0fdf4; color: var(--green); }

.no-course-tip {
  padding: 1.1rem .85rem; background: var(--card); color: var(--muted);
  font-size: .8rem; text-align: center; border-radius: 0 0 11px 11px;
  box-shadow: var(--shadow);
}

/* ============================================================
   示例横幅
   ============================================================ */
.example-banner {
  display: flex; align-items: flex-start; gap: .7rem;
  padding: .8rem 1rem; background: linear-gradient(135deg, #eff6ff, #e0f2fe);
  border: 1.5px solid var(--sky-border); border-radius: 12px;
  margin: .5rem .65rem; animation: slideDown .3s ease;
  overflow: hidden; box-sizing: border-box;
}
@keyframes slideDown { from { opacity: 0; transform: translateY(-8px); } to { opacity: 1; transform: translateY(0); } }
.banner-icon { font-size: 1.4em; flex-shrink: 0; line-height: 1.5; }
.banner-body { flex: 1; min-width: 0; overflow: hidden; }
.banner-title { font-size: .87rem; font-weight: 700; color: var(--sky2); margin-bottom: .25rem; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.banner-text { font-size: .78rem; color: var(--text2); line-height: 1.55; word-break: break-word; white-space: normal; overflow-wrap: break-word; }
.banner-actions { display: flex; gap: .5rem; margin-top: .55rem; flex-wrap: wrap; }
.banner-btn { padding: .35rem .85rem; border-radius: 20px; font-size: .78rem; font-weight: 600; cursor: pointer; border: none; transition: all .18s; }
.banner-btn-primary { background: var(--sky2); color: #fff; }
.banner-btn-primary:hover { background: var(--sky); }
.banner-btn-ghost { background: rgba(2,132,199,.1); color: var(--sky2); }
.banner-btn-ghost:hover { background: rgba(2,132,199,.18); }

/* ============================================================
   Tab 栏
   ============================================================ */
.tab-bar {
  position: fixed; bottom: 0; left: 0; right: 0; height: var(--tab-h);
  background: rgba(255,255,255,.95); backdrop-filter: blur(12px);
  border-top: 1px solid var(--sky-border);
  display: flex; align-items: stretch; z-index: 200;
  box-shadow: 0 -4px 20px rgba(14,165,233,.1);
}
.tab-item {
  flex: 1; border: none; background: none; display: flex; flex-direction: column;
  align-items: center; justify-content: center; gap: .2rem; cursor: pointer;
  color: var(--muted); font-size: .62rem; font-weight: 500; transition: color .18s;
  padding: .4rem 0;
}
.tab-item i { font-size: 1.1rem; transition: transform .18s; }
.tab-item.active { color: var(--sky2); }
.tab-item.active i { transform: translateY(-2px); }
.tab-bar-fab-space { width: 58px; flex-shrink: 0; }

/* ============================================================
   FAB
   ============================================================ */
.fab-group {
  position: fixed; bottom: calc(var(--tab-h) + .8rem); right: 1rem; z-index: 190;
  display: flex; flex-direction: column; align-items: flex-end; gap: .5rem;
}
.fab {
  width: 52px; height: 52px; border: none; border-radius: 50%; cursor: pointer;
  display: flex; align-items: center; justify-content: center; font-size: 1.2rem;
  box-shadow: 0 4px 18px rgba(0,0,0,.2); transition: all .25s; color: #fff;
}
.fab-main { background: linear-gradient(135deg, var(--sky2), var(--sky)); }
.fab-main:hover { transform: scale(1.06); }
.fab-mini {
  width: 44px; height: 44px; font-size: 1rem;
  background: linear-gradient(135deg, #6366f1, #818cf8);
  opacity: 0; pointer-events: none; transform: translateY(8px);
  transition: all .2s;
}
.fab-mini.settings-fab { background: linear-gradient(135deg, #0f172a, #334155); }
.fab-mini.export-fab { background: linear-gradient(135deg, #10b981, #34d399); }
.fab-group.expanded .fab-mini { opacity: 1; pointer-events: auto; transform: translateY(0); }
.fab-group.expanded .fab-main { transform: rotate(45deg); }

/* ============================================================
   Modal / Sheet
   ============================================================ */
.modal-overlay {
  position: fixed; inset: 0; z-index: 500; background: rgba(15,23,42,.45);
  display: flex; align-items: flex-end; justify-content: center;
  opacity: 0; pointer-events: none; transition: opacity .25s; backdrop-filter: blur(3px);
}
.modal-overlay.open { opacity: 1; pointer-events: auto; }
.modal-overlay.open .modal-sheet { transform: translateY(0); }

.modal-sheet {
  width: 100%; max-width: 600px; background: var(--card);
  border-radius: 20px 20px 0 0; transform: translateY(100%);
  transition: transform .3s cubic-bezier(.4,0,.2,1);
  max-height: 92vh; overflow-y: auto; overflow-x: hidden;
  display: flex; flex-direction: column;
}
.modal-sheet.center { align-items: stretch; }
.sheet-handle { width: 38px; height: 4px; background: var(--sky-border); border-radius: 3px; margin: .7rem auto .3rem; flex-shrink: 0; }
.sheet-head { display: flex; align-items: center; justify-content: space-between; padding: .4rem 1.1rem .6rem; border-bottom: 1px solid var(--sky-border); flex-shrink: 0; }
.sheet-title { font-size: 1rem; font-weight: 700; color: var(--text); display: flex; align-items: center; gap: .5rem; }
.sheet-close { width: 30px; height: 30px; border: none; background: var(--sky-bg); border-radius: 8px; cursor: pointer; color: var(--muted); font-size: .9rem; display: flex; align-items: center; justify-content: center; transition: all .18s; }
.sheet-close:hover { background: var(--sky-light); color: var(--sky2); }
.sheet-body { padding: .9rem 1.1rem; flex: 1; overflow-y: auto; }
.sheet-foot { display: flex; gap: .6rem; padding: .8rem 1.1rem; border-top: 1px solid var(--sky-border); background: var(--card); flex-shrink: 0; }

/* ============================================================
   表单
   ============================================================ */
.form-group { margin-bottom: .85rem; }
.form-row { display: grid; grid-template-columns: 1fr 1fr; gap: .65rem; }
.form-label { font-size: .78rem; font-weight: 600; color: var(--text2); margin-bottom: .3rem; }
.form-control {
  width: 100%; padding: .55rem .75rem; border: 1.5px solid var(--sky-border);
  border-radius: 10px; background: var(--sky-bg); color: var(--text); font-size: .87rem;
  outline: none; transition: border-color .18s, box-shadow .18s; font-family: inherit;
}
.form-control:focus { border-color: var(--sky); box-shadow: 0 0 0 3px rgba(14,165,233,.12); background: #fff; }
.form-control[type="color"] { height: 40px; padding: .25rem; cursor: pointer; }
.form-hint { font-size: .72rem; color: var(--muted); margin-top: .3rem; }

/* ============================================================
   输入联想下拉
   ============================================================ */
.ac-dropdown {
  background: #fff;
  border: 1.5px solid var(--sky-border);
  border-radius: 11px;
  box-shadow: 0 8px 28px rgba(14,165,233,.18);
  overflow: hidden;
  max-height: 220px;
  overflow-y: auto;
  animation: acFadeIn .15s ease;
}
@keyframes acFadeIn { from{opacity:0;transform:translateY(-4px)} to{opacity:1;transform:translateY(0)} }
.ac-option {
  padding: .6rem .85rem;
  font-size: .87rem;
  color: var(--text);
  cursor: pointer;
  border-bottom: 1px solid var(--sky-bg);
  transition: background .12s;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.ac-option:last-child { border-bottom: none; }
.ac-option:hover,
.ac-option.active { background: var(--sky-light); color: var(--sky2); }
.ac-option mark {
  background: #fef08a;
  color: #713f12;
  border-radius: 3px;
  padding: 0 1px;
  font-style: normal;
}


/* 校验错误框 */
.validation-err-box {
  background: #fef2f2; border: 1.5px solid rgba(239,68,68,.3); border-radius: 10px;
  padding: .6rem .85rem; margin-bottom: .7rem;
  animation: shakeErr .4s cubic-bezier(.36,.07,.19,.97);
  display: flex; align-items: flex-start; gap: .5rem;
}
@keyframes shakeErr {
  0%,100% { transform: translateX(0); }
  20%,60% { transform: translateX(-5px); }
  40%,80% { transform: translateX(5px); }
}
.veb-icon { font-size: 1.1em; flex-shrink: 0; }
.veb-list { list-style: none; margin: 0; padding: 0; }
.veb-list li { font-size: .8rem; color: #dc2626; line-height: 1.6; }

/* ============================================================
   按钮
   ============================================================ */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: .4rem;
  padding: .55rem 1.1rem; border-radius: 11px; font-size: .87rem; font-weight: 600;
  cursor: pointer; border: none; transition: all .18s; white-space: nowrap;
  font-family: inherit;
}
.btn-primary { background: linear-gradient(135deg, var(--sky2), var(--sky)); color: #fff; }
.btn-primary:hover { opacity: .88; transform: translateY(-1px); }
.btn-ghost { background: var(--sky-bg); border: 1.5px solid var(--sky-border); color: var(--text2); }
.btn-ghost:hover { background: var(--sky-light); color: var(--sky2); }
.btn-danger { background: linear-gradient(135deg, #dc2626, #ef4444); color: #fff; }
.btn-danger:hover { opacity: .88; }
.btn-full { width: 100%; }
.btn:disabled { opacity: .5; cursor: not-allowed; pointer-events: none; }

/* ============================================================
   设置页
   ============================================================ */
.settings-tabs {
  display: flex; gap: .3rem; overflow-x: auto; padding: .6rem 1.2rem;
  border-bottom: 1px solid var(--sky-border); -webkit-overflow-scrolling: touch;
}
.stab {
  flex-shrink: 0; padding: .45rem .85rem; border: 1.5px solid var(--sky-border);
  border-radius: 20px; background: var(--card); color: var(--muted); font-size: .78rem;
  font-weight: 600; cursor: pointer; transition: all .18s; white-space: nowrap;
}
.stab.active { background: var(--sky2); border-color: var(--sky2); color: #fff; }
.stab:hover:not(.active) { background: var(--sky-light); color: var(--sky2); }

.settings-panel { display: none; padding: .9rem .9rem 2rem; }
.settings-panel.active { display: block; }

.class-info-card {
  background: var(--card); border: 1.5px solid var(--sky-border); border-radius: 14px;
  padding: .9rem; position: relative; overflow: hidden; margin-bottom: .8rem;
  box-shadow: var(--shadow);
}
.class-info-card h4 { font-size: .87rem; font-weight: 700; color: var(--text); margin-bottom: .7rem; display: flex; align-items: center; gap: .4rem; }
.class-info-card h4 i { color: var(--sky2); }

/* 公开课表 */
.pub-sched-card {
  display: flex; align-items: center; gap: .7rem; padding: .7rem .85rem;
  background: var(--card); border: 1.5px solid var(--sky-border); border-radius: 12px;
  margin-bottom: .5rem; cursor: pointer; transition: all .18s;
}
.pub-sched-card:hover { border-color: var(--sky3); background: var(--sky-bg); }
.pub-sched-card.selected { border-color: var(--sky2); background: var(--sky-light); }
.pub-sched-icon { font-size: 1.4em; flex-shrink: 0; }
.pub-sched-body { flex: 1; min-width: 0; }
.pub-sched-name { font-size: .87rem; font-weight: 700; color: var(--text); }
.pub-sched-info { font-size: .73rem; color: var(--muted); margin-top: .2rem; line-height: 1.4; }
.pub-sched-check { color: var(--sky-border); font-size: 1rem; flex-shrink: 0; transition: color .18s; }
.pub-sched-card.selected .pub-sched-check { color: var(--sky2); }

/* 时间段 */
.ts-scheme-bar { display: flex; align-items: center; gap: .4rem; flex-wrap: wrap; margin-bottom: .5rem; padding: .5rem; background: var(--sky-bg); border-radius: 10px; }
.ts-scheme-label { font-size: .75rem; color: var(--muted); font-weight: 600; }
.ts-scheme-tabs { display: flex; gap: .25rem; flex-wrap: wrap; }
.ts-scheme-tab { padding: .3rem .65rem; border: 1.5px solid var(--sky-border); border-radius: 20px; background: var(--card); font-size: .75rem; font-weight: 600; cursor: pointer; transition: all .15s; white-space: nowrap; }
.ts-scheme-tab.active { background: var(--sky2); border-color: var(--sky2); color: #fff; }
.ts-add-scheme-btn { padding: .3rem .65rem; border: 1.5px dashed var(--sky-border); border-radius: 20px; background: none; font-size: .75rem; color: var(--sky2); cursor: pointer; display: flex; align-items: center; gap: .3rem; }
.ts-del-scheme-btn { padding: .3rem .5rem; border: none; background: none; font-size: .8rem; color: var(--red); cursor: pointer; }
.ts-scheme-info { font-size: .73rem; color: var(--muted); padding: .2rem .5rem .4rem; }
.timeslot-row { background: var(--card); border: 1.5px solid var(--sky-border); border-radius: 12px; padding: .7rem; margin-bottom: .5rem; }
.timeslot-row-head { display: flex; align-items: center; gap: .5rem; margin-bottom: .5rem; }
.ts-row-num { width: 20px; height: 20px; background: var(--sky2); color: #fff; border-radius: 5px; font-size: .7rem; font-weight: 700; display: flex; align-items: center; justify-content: center; flex-shrink: 0; }
.ts-type-badge { font-size: .65rem; padding: .1rem .4rem; border-radius: 8px; margin-left: .3rem; font-weight: 600; }
.ts-type-class { background: #e0f2fe; color: var(--sky2); }
.ts-type-break { background: #fef9c3; color: #854d0e; }
.ts-type-self-study { background: #f0fdf4; color: var(--green2); }
.ts-mini-grid { display: grid; grid-template-columns: 1fr 1fr; gap: .45rem; }

/* 实体 */
.entity-item { display: flex; align-items: center; justify-content: space-between; padding: .5rem .7rem; background: var(--sky-bg); border: 1.5px solid var(--sky-border); border-radius: 10px; margin-bottom: .4rem; }
.entity-item-del { width: 28px; height: 28px; border: none; background: none; color: var(--red); cursor: pointer; border-radius: 7px; display: flex; align-items: center; justify-content: center; font-size: .8rem; transition: background .15s; }
.entity-item-del:hover { background: #fef2f2; }

/* 校历 */
.calendar-empty { text-align: center; padding: 2rem; color: var(--muted); font-size: .83rem; }
.ce-icon { font-size: 2em; margin-bottom: .5rem; }

/* 同步偏好 */
.sync-pref-card { background: var(--sky-bg); border: 1.5px solid var(--sky-border); border-radius: 12px; padding: .75rem; }
.sync-pref-title { font-size: .82rem; font-weight: 700; color: var(--text); margin-bottom: .55rem; display: flex; align-items: center; gap: .4rem; }
.sync-pref-opts { display: flex; gap: .8rem; flex-wrap: wrap; margin-bottom: .4rem; }
.sync-radio { display: flex; align-items: center; gap: .35rem; font-size: .8rem; color: var(--text2); cursor: pointer; }
.sync-pref-note { font-size: .73rem; color: var(--muted); }

/* ============================================================
   看板
   ============================================================ */
.dash-grid { display: grid; grid-template-columns: 1fr 1fr; gap: .7rem; }
.dash-card { background: var(--card); border: 1.5px solid var(--sky-border); border-radius: 14px; padding: .85rem; box-shadow: var(--shadow); transition: transform .18s; }
.dash-card:hover { transform: translateY(-2px); }
.dash-card.full-w { grid-column: 1 / -1; }
.dc-label { font-size: .72rem; color: var(--muted); margin-bottom: .35rem; font-weight: 600; }
.dc-time { font-size: 2.2rem; font-weight: 800; color: var(--text); font-variant-numeric: tabular-nums; line-height: 1; }
.dc-val { font-size: 1.8rem; font-weight: 800; color: var(--sky2); line-height: 1; }
.dc-val.small { font-size: 1.1rem; }
.dc-sub { font-size: .72rem; color: var(--muted); margin-top: .3rem; }
.locale-btn { padding: .2rem .6rem; border: 1.5px solid var(--sky-border); background: var(--sky-bg); border-radius: 8px; font-size: .72rem; color: var(--sky2); cursor: pointer; transition: all .15s; }
.locale-btn:hover { background: var(--sky-light); }

/* ============================================================
   Toast
   ============================================================ */
.toast {
  position: fixed; bottom: calc(var(--tab-h) + .8rem); left: 50%; transform: translateX(-50%) translateY(20px);
  background: var(--text); color: #fff; padding: .6rem 1.2rem; border-radius: 20px;
  font-size: .83rem; font-weight: 500; z-index: 9999; opacity: 0;
  transition: all .28s; pointer-events: none; max-width: min(88vw, 360px); text-align: center;
  box-shadow: 0 4px 20px rgba(0,0,0,.25); white-space: normal; word-break: break-word;
  line-height: 1.5;
}
.toast.show { opacity: 1; transform: translateX(-50%) translateY(0); }
.toast.success { background: linear-gradient(135deg, #059669, #10b981); }
.toast.error { background: linear-gradient(135deg, #dc2626, #ef4444); }
.toast.warn, .toast.warning { background: linear-gradient(135deg, #d97706, #f59e0b); }
.toast.info { background: linear-gradient(135deg, var(--sky2), var(--sky)); }

/* ============================================================
   推荐课表弹窗
   ============================================================ */
.recommend-modal {
  position: fixed; inset: 0; z-index: 600; background: rgba(15,23,42,.55);
  display: flex; align-items: center; justify-content: center; padding: 1rem;
  opacity: 0; pointer-events: none; transition: opacity .25s; backdrop-filter: blur(3px);
}
.recommend-modal.active { opacity: 1; pointer-events: auto; }
.recommend-box {
  background: var(--card); border-radius: 20px; width: 100%; max-width: 440px;
  max-height: 88vh; overflow: hidden; display: flex; flex-direction: column;
  box-shadow: 0 20px 60px rgba(0,0,0,.25);
  animation: slideUp .3s cubic-bezier(.4,0,.2,1);
}
.recommend-header { padding: 1.3rem 1.2rem .8rem; border-bottom: 1px solid var(--sky-border); text-align: center; }
.recommend-icon { font-size: 2.2rem; margin-bottom: .4rem; }
.recommend-title { font-size: 1.05rem; font-weight: 700; color: var(--text); font-family: 'Noto Serif SC', serif; }
.recommend-subtitle { font-size: .78rem; color: var(--muted); margin-top: .3rem; }
.recommend-body { flex: 1; overflow-y: auto; padding: 1rem 1.1rem; }
.recommend-footer { padding: .8rem 1.1rem; border-top: 1px solid var(--sky-border); display: flex; gap: .65rem; }
.recommend-card-list { display: flex; flex-direction: column; gap: .5rem; }
.recommend-card { display: flex; align-items: center; gap: .7rem; padding: .7rem .85rem; border: 1.5px solid var(--sky-border); border-radius: 12px; cursor: pointer; transition: all .18s; }
.recommend-card:hover { border-color: var(--sky3); background: var(--sky-bg); }
.recommend-card.selected { border-color: var(--sky2); background: var(--sky-light); }
.recommend-card.builtin-card { border-color: #c4b5fd; }
.recommend-card.builtin-card.selected { background: #f5f3ff; border-color: var(--purple); }
.recommend-card-avatar { font-size: 1.4em; flex-shrink: 0; width: 36px; text-align: center; }
.recommend-card-info { flex: 1; min-width: 0; }
.recommend-card-name { font-size: .87rem; font-weight: 700; color: var(--text); }
.recommend-card-meta { font-size: .72rem; color: var(--muted); margin-top: .2rem; }
.recommend-card-check { color: var(--sky-border); font-size: 1rem; flex-shrink: 0; transition: color .18s; }
.recommend-card.selected .recommend-card-check { color: var(--sky2); }

/* ============================================================
   用户资料弹窗
   ============================================================ */
.profile-modal {
  position: fixed; inset: 0; z-index: 600; background: rgba(15,23,42,.55);
  display: flex; align-items: center; justify-content: center; padding: 1rem;
  opacity: 0; pointer-events: none; transition: opacity .25s; backdrop-filter: blur(3px);
}
.profile-modal.active { opacity: 1; pointer-events: auto; }
.profile-box {
  background: var(--card); border-radius: 20px; width: 100%; max-width: 360px;
  box-shadow: 0 20px 60px rgba(0,0,0,.25); overflow: hidden;
  animation: slideUp .3s cubic-bezier(.4,0,.2,1);
}
.profile-top { background: linear-gradient(135deg, var(--sky2), var(--sky)); padding: 1.4rem 1.2rem 1rem; display: flex; align-items: center; gap: .85rem; position: relative; }
.profile-avatar-lg { width: 52px; height: 52px; border-radius: 50%; background: rgba(255,255,255,.25); color: #fff; font-size: 1.4rem; font-weight: 700; display: flex; align-items: center; justify-content: center; flex-shrink: 0; }
.profile-info { flex: 1; min-width: 0; }
.profile-name { font-size: 1.05rem; font-weight: 700; color: #fff; font-family: 'Noto Serif SC', serif; }
.profile-role { font-size: .75rem; color: rgba(255,255,255,.75); margin-top: .2rem; }
.profile-close { position: absolute; top: .9rem; right: .9rem; width: 28px; height: 28px; border: none; background: rgba(255,255,255,.18); border-radius: 8px; color: #fff; cursor: pointer; display: flex; align-items: center; justify-content: center; }
.profile-body { padding: 1rem 1.1rem 1.2rem; }
.profile-row { display: flex; align-items: flex-start; justify-content: space-between; padding: .45rem 0; border-bottom: 1px solid var(--sky-border); gap: .5rem; }
.profile-row:last-of-type { border-bottom: none; }
.profile-row-label { font-size: .78rem; color: var(--muted); flex-shrink: 0; min-width: 60px; }
.profile-row-value { font-size: .83rem; color: var(--text); font-weight: 500; text-align: right; }

/* ============================================================
   冲突 / 移动弹窗
   ============================================================ */
.conflict-modal {
  position: fixed; inset: 0; z-index: 700; background: rgba(15,23,42,.55);
  display: flex; align-items: center; justify-content: center; padding: 1rem;
  opacity: 0; pointer-events: none; transition: opacity .25s; backdrop-filter: blur(3px);
}
.conflict-modal.active { opacity: 1; pointer-events: auto; }
.conflict-box {
  background: var(--card); border-radius: 20px; width: 100%; max-width: 380px;
  padding: 1.3rem 1.2rem; box-shadow: 0 20px 60px rgba(0,0,0,.25);
  animation: slideUp .3s cubic-bezier(.4,0,.2,1);
}
.conflict-box h3 { font-size: 1rem; font-weight: 700; color: var(--text); margin-bottom: .5rem; font-family: 'Noto Serif SC', serif; }
.conflict-box p { font-size: .83rem; color: var(--text2); margin-bottom: 1rem; line-height: 1.5; }
.conflict-btns { display: flex; flex-direction: column; gap: .5rem; }

/* ============================================================
   同步气泡
   ============================================================ */
.sync-prompt-bubble {
  position: fixed; bottom: calc(var(--tab-h) + 1rem); right: 1rem;
  background: var(--card); border: 1.5px solid var(--sky-border); border-radius: 16px;
  padding: .85rem 1rem; box-shadow: var(--shadow-lg); z-index: 400;
  display: flex; flex-direction: column; gap: .5rem; max-width: 260px;
  animation: slideInRight .3s cubic-bezier(.4,0,.2,1);
}
@keyframes slideInRight { from { opacity: 0; transform: translateX(30px); } to { opacity: 1; transform: translateX(0); } }
@keyframes fadeOutDown { to { opacity: 0; transform: translateY(20px); } }
.spb-icon { font-size: 1.4em; text-align: center; }
.spb-text { font-size: .82rem; font-weight: 600; color: var(--text); text-align: center; }
.spb-actions { display: flex; gap: .35rem; flex-wrap: wrap; justify-content: center; }
.spb-btn { padding: .3rem .65rem; border: none; border-radius: 10px; font-size: .75rem; font-weight: 600; cursor: pointer; transition: all .15s; }
.spb-yes { background: var(--sky2); color: #fff; }
.spb-no  { background: var(--sky-bg); color: var(--text2); }
.spb-auto { background: #f0fdf4; color: var(--green2); }
.spb-off  { background: #fef2f2; color: var(--red); }

/* ============================================================
   管理员推送横幅
   ============================================================ */
.admin-push-banner {
  position: fixed; top: calc(var(--header-h) + .7rem); left: 50%;
  transform: translateX(-50%);
  background: var(--card); border: 1.5px solid #fbbf24; border-radius: 14px;
  padding: .7rem 1rem; display: flex; align-items: center; gap: .65rem;
  box-shadow: var(--shadow-lg); z-index: 400; max-width: min(90vw, 380px);
  animation: slideDown .3s ease;
}
.apb-icon { font-size: 1.3em; flex-shrink: 0; }
.apb-body { flex: 1; min-width: 0; }
.apb-title { font-size: .85rem; font-weight: 700; color: var(--text); }
.apb-sub { font-size: .72rem; color: var(--muted); margin-top: .1rem; }
.apb-refresh { padding: .35rem .7rem; background: var(--sky2); color: #fff; border: none; border-radius: 8px; font-size: .78rem; font-weight: 600; cursor: pointer; white-space: nowrap; }
.apb-close { padding: .35rem; background: none; border: none; color: var(--muted); cursor: pointer; font-size: .9rem; }

/* ============================================================
   打印
   ============================================================ */
@media print {
  .topbar,.sidebar,.sidebar-overlay,.fab-group,.tab-bar,.week-nav,.search-bar,
  .filter-bar,.stats-row,.list-view,.example-banner,.course-card-actions,
  .sync-prompt-bubble,.admin-push-banner { display: none !important; }
  body:not(.list-mode) .schedule-table-wrap,
  body.list-mode .schedule-table-wrap { display: block !important; }
  .schedule-table th, .schedule-table td { border: 1px solid #ddd !important; }
  .course-actions { display: none !important; }
  .main { padding-top: 0; padding-bottom: 0; }
}

/* ============================================================
   桌面端 (≥ 768px)
   ============================================================ */
@media (min-width: 768px) {
  :root { --sidebar-w: 240px; }
  body.desktop-mode .sidebar { transform: translateX(0) !important; position: fixed; }
  body.desktop-mode .sidebar-overlay { display: none !important; }
  body.desktop-mode .main { margin-left: var(--sidebar-w); }
  body.desktop-mode .topbar-menu-btn { display: none; }

  /* 桌面端：覆盖移动端规则，强制表格视图 */
  .schedule-table-wrap { display: block !important; }
  .list-view { display: none !important; }
  body.list-mode .schedule-table-wrap { display: none !important; }
  body.list-mode .list-view { display: block !important; }

  .schedule-table { min-width: 600px; }
  .time-label-cell { width: 72px; }
  .schedule-table th { font-size: .72rem; }
  .schedule-table td { min-height: 56px; }
  .course-name { font-size: .73rem !important; }

  .tab-bar { display: none; }
  .fab-group { bottom: 1.5rem; }
  /* 桌面端没有tab栏，FAB下移，相应缩小底部留白 */
  .schedule-table-wrap { padding-bottom: 5rem; }
  .list-view { padding-bottom: 5rem; }
  .toast { bottom: 1.5rem; }
  .modal-overlay { align-items: center; }
  .modal-sheet { border-radius: 20px; max-width: 560px; margin: auto; transform: translateY(0) scale(.95); }
  .modal-overlay.open .modal-sheet { transform: translateY(0) scale(1); }
  .dash-grid { grid-template-columns: repeat(3, 1fr); }
  .week-label { display: block; }
  .hc-actions { display: flex; }
  /* 桌面端: 列表卡片操作按钮鼠标悬停显示 */
  .course-card-actions { display: flex; opacity: 0; pointer-events: none; }
  .course-card:hover .course-card-actions { opacity: 1; pointer-events: auto; }
  /* 桌面端: 表格课程格操作按钮鼠标悬停显示 */
  .course-actions { opacity: 0; }
  .course:hover .course-actions { opacity: 1; }
}

/* ============================================================
   超小屏 (≤ 360px)
   ============================================================ */
@media (max-width: 360px) {
  .hc-class { font-size: .98rem; }
  .topbar-school { display: none; }
  .week-nav-btn { width: 36px; height: 36px; }
  .schedule-table { min-width: 420px; }
  /* 超小屏 toast 字号稍小，确保不超出 */
  .toast { font-size: .78rem; padding: .5rem .9rem; max-width: 92vw; }
}

/* ============================================================
   动画
   ============================================================ */
@keyframes slideUp {
  from { opacity: 0; transform: translateY(20px); }
  to { opacity: 1; transform: translateY(0); }
}
.page-content { animation: fadeIn .25s ease; }
@keyframes fadeIn { from { opacity: 0; } to { opacity: 1; } }

/* ============================================================
   页面过渡
   ============================================================ */
.page-content { display: none; }
.page-content.active { display: block; }

/* ============================================================
   天气卡片
   ============================================================ */
#dashWeatherCard { position: relative; }

/* ============================================================
   IP加载状态
   ============================================================ */
.ip-loading { display: inline-flex; align-items: center; gap: .4rem; }
.ip-loading::after { content: ''; width: 12px; height: 12px; border: 2px solid var(--sky-border); border-top-color: var(--sky2); border-radius: 50%; animation: spin .6s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }



/* =========================
   移动端欢迎提示优化
========================= */
.welcome-tip,
.notice-text,
.dashboard-welcome,
.welcome-banner {
    max-width: 100%;
    overflow-wrap: break-word;
    word-break: break-word;
    white-space: normal;
    line-height: 1.6;
}

@media (max-width: 768px) {
    .welcome-tip,
    .notice-text,
    .dashboard-welcome,
    .welcome-banner {
        font-size: 0.92rem !important;
        padding: 0.9rem 1rem !important;
        border-radius: 16px;
        box-sizing: border-box;
        overflow: hidden;
    }

    .dashboard-card,
    .glass-card,
    .hero-card {
        overflow: hidden;
    }
}

/* ===== 强制移动端卡片防溢出修复 ===== */
@media (max-width:768px){

  *{
    box-sizing:border-box;
  }

  .glass-card,
  .dashboard-card,
  .hero-card,
  .notice-card,
  .welcome-card,
  .card{
    width:100% !important;
    max-width:100% !important;
    overflow:hidden !important;
    border-radius:22px !important;
  }

  .welcome-tip,
  .notice-text,
  .dashboard-welcome,
  .welcome-banner,
  .hero-desc,
  .card-desc,
  .card-text{
    width:100% !important;
    max-width:100% !important;

    white-space:normal !important;
    overflow-wrap:anywhere !important;
    word-break:break-word !important;

    display:block !important;
    line-height:1.7 !important;

    padding-right:0 !important;
  }

  .welcome-tip *,
  .notice-text *,
  .dashboard-welcome *,
  .welcome-banner *{
    max-width:100% !important;
    word-break:break-word !important;
  }
}

/* ============================================================
   邮件/通知面板
   ============================================================ */
.mail-item {
  display: flex; gap: .7rem; padding: .75rem .6rem;
  border-bottom: 1px solid var(--sky-border); cursor: pointer;
  transition: background .15s; border-radius: 10px; margin-bottom: .25rem;
}
.mail-item:hover { background: var(--sky-bg); }
.mail-item.unread { background: linear-gradient(135deg, rgba(14,165,233,.06), rgba(14,165,233,.02)); }
.mail-icon { width: 34px; height: 34px; border-radius: 50%; display: flex; align-items: center; justify-content: center; font-size: 1.05rem; flex-shrink: 0; }
.mail-icon.info { background: rgba(14,165,233,.12); }
.mail-icon.warning { background: rgba(249,115,22,.12); }
.mail-icon.success { background: rgba(16,185,129,.12); }
.mail-icon.holiday { background: rgba(16,185,129,.12); }
.mail-body { flex: 1; min-width: 0; }
.mail-title { font-size: .83rem; font-weight: 600; color: var(--text); margin-bottom: .15rem; }
.mail-item.unread .mail-title::before { content: ''; display: inline-block; width: 6px; height: 6px; border-radius: 50%; background: var(--sky2); margin-right: .35rem; vertical-align: middle; }
.mail-preview { font-size: .73rem; color: var(--text2); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.mail-time { font-size: .67rem; color: var(--muted); margin-top: .2rem; }
.mail-actions { display: flex; gap: .4rem; margin-top: .5rem; }
.mail-action-btn { padding: .2rem .6rem; border-radius: 20px; border: 1.5px solid var(--sky-border); background: none; font-size: .7rem; cursor: pointer; color: var(--text2); font-family: inherit; transition: all .15s; }
.mail-action-btn.read-btn:hover { background: var(--sky-light); color: var(--sky2); border-color: var(--sky3); }
.mail-action-btn.ignore-btn:hover { background: rgba(239,68,68,.08); color: #dc2626; border-color: rgba(239,68,68,.3); }
.mail-action-btn.ignored { color: var(--muted); text-decoration: line-through; }


/* ── 时间段课间设置 ── */
.filter-divider { color: var(--sky-border); margin: 0 .35rem; user-select: none; }
.filter-tag.time-filter { border-style: dashed; }