/* ============================================================
   大学工作台 - 全局样式
   设计语言：Bento 轻量工作台（浅紫画布 + 白色浮动卡片 + 胶囊导航）
   配色：主色紫 #5046E5 / 绿 #10B981 / 琥珀 #F59E0B / 红 #EF4444 / 青 #06B6D4
   ============================================================ */

:root {
  /* 色彩令牌 */
  --canvas: #F7F8FC;          /* 画布背景（浅紫） */
  --sidebar-bg: #EEF1F8;      /* 侧边栏背景 */
  --card: #FFFFFF;            /* 卡片背景 */
  --text-1: #0F1419;          /* 主文字 */
  --text-2: #6B7280;          /* 次文字 */
  --text-3: #9CA3AF;          /* 弱文字 */
  --border: #E7E7EA;          /* 边框 */
  --primary: #5046E5;         /* 主色 */
  --primary-soft: #EEF2FF;    /* 主色浅底 */
  --green: #10B981;
  --green-soft: #D1FAE5;
  --amber: #F59E0B;
  --amber-soft: #FEF3C7;
  --red: #EF4444;
  --red-soft: #FEE2E2;
  --cyan: #06B6D4;
  --cyan-soft: #ECFEFF;

  /* 字体与尺寸 */
  --font: "Inter", "PingFang SC", "Microsoft YaHei", "Noto Sans SC", system-ui, sans-serif;
  --radius-card: 12px;
  --radius-pill: 22px;
  --shadow-card: 0 1px 2px rgba(60, 64, 67, 0.06);
  --shadow-elev: 0 4px 12px rgba(60, 64, 67, 0.10);

  /* 布局 */
  --sidebar-w: 256px;
  --topbar-h: 64px;
}

* { margin: 0; padding: 0; box-sizing: border-box; }

html, body { height: 100%; }

body {
  font-family: var(--font);
  font-size: 14px;
  color: var(--text-1);
  background: var(--canvas);
  -webkit-font-smoothing: antialiased;
}

button { font-family: inherit; cursor: pointer; border: none; background: none; color: inherit; }
input, select { font-family: inherit; font-size: 14px; }
h1, h2, h3 { font-weight: 600; }

/* ============================================================
   应用外壳（侧边栏 + 主区域）
   ============================================================ */

.app-shell { display: flex; height: 100vh; overflow: hidden; }

.sidebar {
  width: var(--sidebar-w);
  min-width: var(--sidebar-w);
  background: var(--sidebar-bg);
  display: flex;
  flex-direction: column;
  padding: 20px 16px 16px;
  gap: 12px;
  z-index: 30;
  transition: transform 0.25s ease;
}

.logo-row { display: flex; align-items: center; gap: 10px; padding: 4px; }
.logo-badge {
  width: 30px; height: 30px; border-radius: 9px;
  background: linear-gradient(135deg, #4F46E5, #7668F8);
  color: #fff; font-weight: 700; font-size: 15px;
  display: flex; align-items: center; justify-content: center;
}
.logo-text { font-size: 16px; font-weight: 600; color: var(--text-1); }

.nav-list { display: flex; flex-direction: column; gap: 4px; }
.nav-item {
  display: flex; align-items: center; gap: 10px;
  width: 100%; height: 44px;
  padding: 0 16px;
  border-radius: var(--radius-pill);
  color: var(--text-1);
  transition: background 0.15s, color 0.15s;
}
.nav-item:hover { background: #E2E6F0; }
.nav-item.active {
  background: var(--primary);
  color: #fff;
  font-weight: 500;
}
.nav-dot { width: 10px; height: 10px; border-radius: 50%; background: var(--dot, var(--primary)); flex-shrink: 0; }
.nav-item.active .nav-dot { background: #fff; }
.nav-label { font-size: 14px; }

.sidebar-footer { margin-top: auto; display: flex; flex-direction: column; gap: 8px; }
.user-row { display: flex; align-items: center; gap: 10px; padding: 8px 4px; }
.user-avatar {
  width: 32px; height: 32px; border-radius: 50%;
  background: #C7D2FE; color: #3730A3;
  display: flex; align-items: center; justify-content: center;
  font-size: 13px; font-weight: 600;
}
.user-avatar.small { width: 32px; height: 32px; }
.user-name { font-size: 13px; color: var(--text-2); }
.data-reset-btn {
  font-size: 12px; color: var(--text-3);
  padding: 6px 10px; border-radius: 8px;
  text-align: left;
}
.data-reset-btn:hover { color: var(--red); background: var(--red-soft); }

.sidebar-mask {
  display: none;
  position: fixed; inset: 0;
  background: rgba(15, 20, 25, 0.35);
  z-index: 25;
}

/* 移动端底部 Tab：桌面端隐藏，仅手机显示 */
.mobile-tabbar { display: none; }

/* ============================================================
   主区域
   ============================================================ */

.main-area {
  flex: 1;
  display: flex;
  flex-direction: column;
  min-width: 0;
  height: 100vh;
}

.topbar {
  height: var(--topbar-h);
  min-height: var(--topbar-h);
  background: var(--card);
  border-bottom: 1px solid var(--border);
  display: flex;
  align-items: center;
  gap: 14px;
  padding: 0 28px;
}
.menu-btn { display: none; }
.topbar-title { font-size: 20px; font-weight: 600; flex: 1; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.topbar-right { display: flex; align-items: center; gap: 14px; }
.date-badge {
  display: flex; align-items: center;
  height: 36px; padding: 0 14px;
  border-radius: 18px;
  background: var(--canvas);
  color: var(--text-2);
  font-size: 13px;
  white-space: nowrap;
}

/* ============================================================
   视图容器与通用面板
   ============================================================ */

.view-container { flex: 1; overflow-y: auto; }
.view { display: none; padding: 28px; max-width: 1280px; }
.view.active { display: block; }

.panel {
  background: var(--card);
  border-radius: var(--radius-card);
  box-shadow: var(--shadow-card);
  padding: 20px;
  display: flex;
  flex-direction: column;
  gap: 12px;
}
.panel-head { display: flex; align-items: center; justify-content: space-between; }
.panel-title { font-size: 16px; font-weight: 600; }

.link-btn { font-size: 13px; color: var(--primary); font-weight: 500; }
.link-btn.danger { color: var(--red); }
.link-btn:hover { text-decoration: underline; }

.chip {
  display: inline-flex; align-items: center;
  height: 24px; padding: 0 10px;
  border-radius: 12px;
  font-size: 12px;
  background: var(--primary-soft);
  color: var(--primary);
}

/* ============================================================
   欢迎区 + 统计卡
   ============================================================ */

.welcome-row { display: flex; align-items: center; justify-content: space-between; margin-bottom: 24px; }
.welcome-title { font-size: 26px; font-weight: 600; }
.welcome-sub { font-size: 13px; color: var(--text-2); margin-top: 4px; }

.stats-row { display: grid; grid-template-columns: repeat(4, 1fr); gap: 16px; margin-bottom: 24px; }
.stat-card {
  background: var(--card);
  border-radius: var(--radius-card);
  box-shadow: var(--shadow-card);
  padding: 18px;
  display: flex; flex-direction: column; gap: 8px;
}
.stat-head { display: flex; align-items: center; gap: 8px; }
.stat-dot { width: 8px; height: 8px; border-radius: 50%; background: var(--dot, var(--primary)); }
.stat-label { font-size: 13px; color: var(--text-2); }
.stat-value { font-size: 26px; font-weight: 700; line-height: 1.1; }
.stat-note { font-size: 12px; color: var(--text-3); }
.stat-note.success { color: var(--green); }

/* ============================================================
   总览主网格
   ============================================================ */

.main-grid { display: grid; grid-template-columns: 1.25fr 1fr; gap: 16px; }

.course-list { display: flex; flex-direction: column; gap: 8px; }
.course-row {
  display: flex; align-items: center; gap: 12px;
  padding: 10px; border-radius: 10px;
  background: var(--canvas);
}
.course-row.plain { background: transparent; }
.time-block {
  width: 88px; min-width: 88px; height: 52px; flex-shrink: 0;
  border-radius: 10px;
  display: flex; flex-direction: column;
  align-items: center; justify-content: center;
  gap: 1px;
  color: #fff;
}
.time-block .period { font-size: 10px; opacity: 0.9; white-space: nowrap; }
.time-block .time { font-size: 12px; font-weight: 700; white-space: nowrap; }
.course-info { flex: 1; min-width: 0; }
.course-info .name { font-size: 15px; font-weight: 500; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.course-info .meta { font-size: 12px; color: var(--text-2); margin-top: 2px; }

/* 总览待办 */
.todo-list { display: flex; flex-direction: column; }
.todo-row {
  display: flex; align-items: center; gap: 12px;
  min-height: 44px; padding: 4px 0;
}
.todo-row + .todo-row { border-top: 1px solid #F3F4F6; }
.checkbox {
  width: 20px; height: 20px; flex-shrink: 0;
  border-radius: 6px;
  display: flex; align-items: center; justify-content: center;
  transition: all 0.15s;
}
.checkbox.empty { border: 1.5px solid var(--border); background: var(--card); }
.checkbox.empty:hover { border-color: var(--primary); }
.checkbox.checked { background: var(--primary); }
.checkbox.checked svg { display: block; }
.checkbox svg { display: none; }
.todo-text { flex: 1; min-width: 0; font-size: 14px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.todo-text.done { color: var(--text-3); text-decoration: line-through; }
.routine-badge {
  display: inline-flex; align-items: center;
  height: 22px; padding: 0 8px;
  border-radius: 6px;
  font-size: 11px; font-weight: 500;
  background: #EDE9FE; color: #6D28D9;
  flex-shrink: 0;
}
.due-badge {
  display: inline-flex; align-items: center;
  height: 24px; padding: 0 10px;
  border-radius: 12px; font-size: 12px;
  background: var(--primary-soft); color: var(--primary);
  white-space: nowrap;
}
.due-badge.warn { background: var(--amber-soft); color: #B45309; }
.due-badge.over { background: var(--red-soft); color: var(--red); }
.todo-empty { color: var(--text-3); font-size: 13px; text-align: center; padding: 18px 0; }

/* 倒计时迷你 */
.countdown-mini { display: flex; flex-direction: column; gap: 10px; }
.cd-mini-row {
  display: flex; align-items: center; gap: 12px;
  padding: 10px; border-radius: 10px;
  background: var(--canvas);
}
.cd-badge {
  width: 56px; height: 56px; flex-shrink: 0;
  border-radius: 12px;
  display: flex; flex-direction: column;
  align-items: center; justify-content: center;
  font-weight: 700;
}
.cd-badge .num { font-size: 20px; line-height: 1; }
.cd-badge .unit { font-size: 11px; font-weight: 400; margin-top: 2px; }
.cd-mini-row .info { flex: 1; min-width: 0; }
.cd-mini-row .name { font-size: 14px; font-weight: 500; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.cd-mini-row .date { font-size: 12px; color: var(--text-2); margin-top: 2px; }
.pin-icon { color: var(--amber); flex-shrink: 0; }

/* 营养总览 */
.nutri-overview { display: flex; align-items: center; gap: 16px; }
.nutri-overview .ring-svg { flex-shrink: 0; }
.nutri-overview .info { flex: 1; min-width: 0; }
.nutri-overview .info .t { font-size: 14px; font-weight: 600; }
.nutri-overview .info .s { font-size: 11px; color: var(--text-2); margin-top: 3px; line-height: 1.5; }

/* ============================================================
   视图工具栏（通用）
   ============================================================ */

.view-toolbar {
  display: flex; align-items: center; gap: 12px;
  margin-bottom: 20px; flex-wrap: wrap;
}
.toolbar-spacer { flex: 1; }
.toolbar-hint { font-size: 13px; color: var(--text-2); }
.date-picker-row { display: flex; align-items: center; gap: 8px; }

.btn {
  height: 38px; padding: 0 18px;
  border-radius: 19px;
  font-size: 14px; font-weight: 500;
  background: var(--canvas);
  color: var(--text-1);
  transition: all 0.15s;
  white-space: nowrap;
}
.btn:hover { background: #E9EBF3; }
.btn.primary { background: var(--primary); color: #fff; }
.btn.primary:hover { background: #4538D8; }
.btn.ghost { background: transparent; color: var(--text-2); }
.btn.ghost:hover { background: var(--canvas); }
.btn.danger { background: var(--red-soft); color: var(--red); }
.btn.danger:hover { background: #FECACA; }

.icon-btn {
  width: 36px; height: 36px;
  border-radius: 50%;
  display: flex; align-items: center; justify-content: center;
  transition: background 0.15s;
}
.icon-btn:hover { background: var(--canvas); }

.select, .input {
  height: 38px;
  border: 1px solid var(--border);
  border-radius: 10px;
  background: var(--card);
  color: var(--text-1);
  padding: 0 12px;
  outline: none;
  transition: border-color 0.15s;
}
.select:focus, .input:focus { border-color: var(--primary); }

.seg-control {
  display: flex; gap: 2px; padding: 3px;
  border-radius: 19px; background: var(--canvas);
}
.seg-btn {
  height: 30px; padding: 0 14px;
  border-radius: 15px;
  font-size: 13px;
  color: var(--text-2);
  transition: all 0.15s;
}
.seg-btn.active { background: var(--primary); color: #fff; font-weight: 500; }

.week-nav { display: flex; align-items: center; gap: 8px; }
.week-label { font-size: 14px; font-weight: 500; min-width: 64px; text-align: center; }

/* ============================================================
   课程表
   ============================================================ */

.course-board { background: var(--card); border-radius: var(--radius-card); box-shadow: var(--shadow-card); overflow: hidden; }

/* 周视图：单一 CSS Grid，表头一行 + 每节次一行，课程块跨行（grid-row span） */
.week-board {
  display: grid;
  grid-template-columns: 84px repeat(7, 1fr);
  grid-auto-rows: 56px;           /* 每个节次的行高 */
  gap: 4px 6px;
  padding: 12px;
}
.board-time-head { grid-column: 1; }
.week-board .col-head {
  display: flex; align-items: center; justify-content: center;
  border-radius: 8px;
  font-size: 13px; font-weight: 600;
  background: var(--canvas); color: var(--text-2);
}
.week-board .col-head.today { background: var(--primary-soft); color: var(--primary); }

.time-col {
  display: flex; flex-direction: column;
  align-items: center; justify-content: center;
  gap: 1px;
  min-width: 0;
  padding: 0 2px;
}
.time-col .period { font-size: 11px; font-weight: 500; color: var(--text-2); white-space: nowrap; }
.time-col .clock { font-size: 10px; color: var(--text-3); white-space: nowrap; line-height: 1.3; }

.cell {
  border-radius: 10px;
  min-height: 0;
  padding: 4px;
  background: var(--canvas);
}
.cell.has-course { background: transparent; padding: 0; }
.course-tile {
  width: 100%; height: 100%;
  border-radius: 10px;
  padding: 8px 10px;
  display: flex; flex-direction: column;
  justify-content: center;
  gap: 3px;
  cursor: pointer;
  transition: transform 0.1s;
  overflow: hidden;
}
.course-tile:hover { transform: scale(1.02); }
.course-tile .t-name { font-size: 13px; font-weight: 600; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.course-tile .t-meta { font-size: 10px; opacity: 0.85; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.course-tile .t-time { font-size: 10px; opacity: 0.7; }

/* 日视图 */
.day-view-list { display: flex; flex-direction: column; gap: 10px; padding: 16px; }
.day-view-row {
  display: flex; gap: 14px; align-items: stretch;
  padding: 14px;
  border-radius: 10px;
  background: var(--canvas);
}
.day-view-row .time-block { width: 96px; height: auto; min-height: 64px; }
.day-view-row .course-info { display: flex; flex-direction: column; justify-content: center; }

/* ============================================================
   待办进度
   ============================================================ */

.todo-progress-card {
  background: var(--card);
  border-radius: var(--radius-card);
  box-shadow: var(--shadow-card);
  padding: 18px 20px;
  margin-bottom: 16px;
}
.progress-info { display: flex; align-items: center; justify-content: space-between; font-size: 13px; color: var(--text-2); margin-bottom: 10px; }
.progress-info strong { color: var(--text-1); }
.progress-bar { height: 8px; border-radius: 4px; background: #F3F4F6; overflow: hidden; }
.progress-fill { height: 100%; border-radius: 4px; background: var(--primary); transition: width 0.4s ease; }

/* ============================================================
   倒计时
   ============================================================ */

.countdown-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(240px, 1fr)); gap: 16px; }
.cd-card {
  background: var(--card);
  border-radius: var(--radius-card);
  box-shadow: var(--shadow-card);
  padding: 20px;
  display: flex; flex-direction: column; gap: 12px;
  position: relative;
  transition: box-shadow 0.2s;
}
.cd-card:hover { box-shadow: var(--shadow-elev); }
.cd-card.pinned { border: 1.5px solid var(--amber); }
.cd-card-top { display: flex; align-items: center; justify-content: space-between; }
.cd-card-name { font-size: 15px; font-weight: 600; word-break: break-all; }
.cd-card .cd-date { font-size: 12px; color: var(--text-2); }
.cd-card-big {
  font-size: 44px; font-weight: 700; line-height: 1;
  color: var(--text-1);
  display: flex; align-items: baseline; gap: 6px;
}
.cd-card-big .unit { font-size: 16px; font-weight: 500; color: var(--text-2); }
.cd-card-big.urgent { color: var(--red); }
.cd-card-actions { display: flex; gap: 8px; }
.cd-card-actions .mini-btn {
  flex: 1; height: 32px;
  border-radius: 16px;
  font-size: 12px;
  background: var(--canvas);
  color: var(--text-2);
  transition: all 0.15s;
}
.cd-card-actions .mini-btn:hover { background: var(--primary-soft); color: var(--primary); }
.cd-card-actions .mini-btn.del:hover { background: var(--red-soft); color: var(--red); }
.cd-sort-row { display: flex; gap: 6px; margin-top: -4px; }
.cd-sort-row .mini-btn { flex: 0 0 auto; padding: 0 10px; }

/* ============================================================
   记账
   ============================================================ */

.finance-summary { display: grid; grid-template-columns: repeat(3, 1fr); gap: 16px; margin-bottom: 20px; }
.summary-card {
  background: var(--card);
  border-radius: var(--radius-card);
  box-shadow: var(--shadow-card);
  padding: 18px 20px;
  display: flex; flex-direction: column; gap: 8px;
}
.summary-label { font-size: 13px; color: var(--text-2); }
.summary-value { font-size: 26px; font-weight: 700; }
.summary-card.income .summary-value { color: var(--green); }
.summary-card.expense .summary-value { color: var(--red); }
.summary-card.balance .summary-value { color: var(--primary); }

.finance-list { display: flex; flex-direction: column; }
.fin-row {
  display: flex; align-items: center; gap: 12px;
  min-height: 52px; padding: 6px 0;
}
.fin-row + .fin-row { border-top: 1px solid #F3F4F6; }
.fin-cat {
  width: 36px; height: 36px; flex-shrink: 0;
  border-radius: 10px;
  display: flex; align-items: center; justify-content: center;
  font-size: 13px;
}
.fin-info { flex: 1; min-width: 0; }
.fin-info .note { font-size: 14px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.fin-info .meta { font-size: 12px; color: var(--text-2); margin-top: 2px; }
.fin-amount { font-size: 15px; font-weight: 600; flex-shrink: 0; }
.fin-amount.income { color: var(--green); }
.fin-amount.expense { color: var(--text-1); }
.fin-del {
  width: 28px; height: 28px; flex-shrink: 0;
  border-radius: 50%;
  display: flex; align-items: center; justify-content: center;
  color: var(--text-3);
  opacity: 0;
  transition: all 0.15s;
}
.fin-row:hover .fin-del { opacity: 1; }
.fin-del:hover { background: var(--red-soft); color: var(--red); }

/* ============================================================
   营养记录
   ============================================================ */

.nutri-layout { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; margin-bottom: 16px; }

.nutri-ring-card {
  background: var(--card);
  border-radius: var(--radius-card);
  box-shadow: var(--shadow-card);
  padding: 20px;
  display: flex; flex-direction: column; gap: 14px;
}
.ring-wrap { display: flex; justify-content: center; padding: 8px 0; }
.nutri-ring { width: 200px; height: 200px; }
.ring-legend { display: flex; justify-content: center; gap: 20px; flex-wrap: wrap; }
.ring-legend .item { display: flex; align-items: center; gap: 6px; font-size: 13px; color: var(--text-2); }
.ring-legend .dot { width: 10px; height: 10px; border-radius: 3px; }

.nutri-goal-card { background: var(--card); border-radius: var(--radius-card); box-shadow: var(--shadow-card); padding: 20px; display: flex; flex-direction: column; gap: 16px; }
.goal-bars { display: flex; flex-direction: column; gap: 14px; }
.goal-row .g-head { display: flex; align-items: center; justify-content: space-between; font-size: 13px; margin-bottom: 6px; }
.goal-row .g-head .g-name { display: flex; align-items: center; gap: 6px; color: var(--text-2); }
.goal-row .g-head .g-val { font-weight: 600; color: var(--text-1); }
.goal-row .g-head .g-val.over { color: var(--red); }
.goal-row .g-head .g-val.good { color: var(--green); }
.g-bar { height: 10px; border-radius: 5px; background: #F3F4F6; overflow: hidden; }
.g-fill { height: 100%; border-radius: 5px; transition: width 0.4s ease; }

.food-quick { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; padding: 10px 0; border-bottom: 1px solid #F3F4F6; }
.quick-label { font-size: 12px; color: var(--text-2); }
.quick-chips { display: flex; gap: 8px; flex-wrap: wrap; }
.quick-chip {
  height: 30px; padding: 0 14px;
  border-radius: 15px;
  background: var(--canvas);
  font-size: 13px;
  color: var(--text-1);
  transition: all 0.15s;
}
.quick-chip:hover { background: var(--primary-soft); color: var(--primary); }

.nutri-list { display: flex; flex-direction: column; }
.nutri-row {
  display: flex; align-items: center; gap: 12px;
  min-height: 48px; padding: 6px 0;
}
.nutri-row + .nutri-row { border-top: 1px solid #F3F4F6; }
.nutri-row .food { flex: 1; font-size: 14px; min-width: 0; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.nutri-row .macros { font-size: 12px; color: var(--text-2); flex-shrink: 0; }
.nutri-row .nutri-del { opacity: 0; }

/* ============================================================
   弹窗
   ============================================================ */

.modal-mask {
  position: fixed; inset: 0;
  background: rgba(15, 20, 25, 0.45);
  display: flex; align-items: center; justify-content: center;
  z-index: 100;
  padding: 20px;
}
/* 关键修复：hidden 属性必须能压过 display:flex，否则遮罩层常驻无法关闭 */
.modal-mask[hidden] { display: none; }
.modal {
  width: 100%; max-width: 460px;
  max-height: 85vh;
  background: var(--card);
  border-radius: 16px;
  box-shadow: var(--shadow-elev);
  display: flex; flex-direction: column;
  overflow: hidden;
}
.modal-head {
  display: flex; align-items: center; justify-content: space-between;
  padding: 18px 22px;
  border-bottom: 1px solid #F3F4F6;
}
.modal-title { font-size: 17px; }
.modal-body { padding: 20px 22px; overflow-y: auto; display: flex; flex-direction: column; gap: 14px; }
.modal-foot { padding: 14px 22px; border-top: 1px solid #F3F4F6; display: flex; justify-content: flex-end; gap: 10px; }

.form-row { display: flex; flex-direction: column; gap: 6px; }
.form-row label { font-size: 13px; color: var(--text-2); font-weight: 500; }
.form-row input, .form-row select {
  height: 40px;
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 0 12px;
  outline: none;
  background: var(--card);
}
.form-row input:focus, .form-row select:focus { border-color: var(--primary); }
.form-row.double { flex-direction: row; gap: 10px; }
.form-row.double > div { flex: 1; display: flex; flex-direction: column; gap: 6px; }

/* 表单内的分类选择 */
.cat-select { display: flex; gap: 8px; flex-wrap: wrap; }
.cat-opt {
  height: 34px; padding: 0 14px;
  border-radius: 17px;
  background: var(--canvas);
  font-size: 13px;
  color: var(--text-1);
  border: 1.5px solid transparent;
  transition: all 0.15s;
}
.cat-opt.active { border-color: var(--primary); background: var(--primary-soft); color: var(--primary); font-weight: 500; }

/* ============================================================
   轻提示
   ============================================================ */

.toast {
  position: fixed;
  left: 50%; bottom: 40px;
  transform: translateX(-50%);
  background: rgba(15, 20, 25, 0.88);
  color: #fff;
  padding: 10px 20px;
  border-radius: 20px;
  font-size: 13px;
  z-index: 200;
  animation: toastIn 0.25s ease;
  max-width: 80vw;
  text-align: center;
}
.toast[hidden] { display: none; }
@keyframes toastIn {
  from { opacity: 0; transform: translate(-50%, 12px); }
  to { opacity: 1; transform: translate(-50%, 0); }
}

/* 空状态 */
.empty-state { color: var(--text-3); font-size: 13px; text-align: center; padding: 26px 0; }

/* ============================================================
   响应式适配
   ============================================================ */

/* 平板 */
@media (max-width: 1100px) {
  .main-grid { grid-template-columns: 1fr; }
  .stats-row { grid-template-columns: repeat(2, 1fr); }
  .nutri-layout { grid-template-columns: 1fr; }
}

/* ============================================================
   手机端（≤768px）：移动专属 UI
   隐藏桌面侧栏，改为底部 Tab 导航 + 移动顶栏
   ============================================================ */
@media (max-width: 768px) {
  body { overflow: hidden; }

  /* ---- 隐藏桌面侧边栏与遮罩 ---- */
  .sidebar, .sidebar-mask, .menu-btn { display: none !important; }

  /* ---- 应用外壳：顶栏 + 内容 + 底部 Tab ---- */
  .app-shell { display: flex; flex-direction: column; }
  .main-area { height: 100vh; }

  .topbar {
    height: 52px;
    min-height: 52px;
    padding: 0 16px;
    gap: 10px;
  }
  .topbar-title { font-size: 17px; font-weight: 600; }
  .topbar-right .user-avatar { display: none; }
  .date-badge { display: inline-flex; height: 30px; padding: 0 12px; font-size: 12px; }

  .view-container { flex: 1; overflow-y: auto; -webkit-overflow-scrolling: touch; }
  .view { padding: 16px 14px 92px; }  /* 底部留出 Tab 空间 */

  /* ---- 底部 Tab 导航 ---- */
  .mobile-tabbar {
    display: flex;
    position: fixed;
    left: 0; right: 0; bottom: 0;
    height: calc(56px + env(safe-area-inset-bottom));
    padding-bottom: env(safe-area-inset-bottom);
    background: rgba(255, 255, 255, 0.96);
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
    border-top: 1px solid var(--border);
    z-index: 90;
  }
  .mtab {
    flex: 1;
    display: flex; flex-direction: column;
    align-items: center; justify-content: center;
    gap: 3px;
    color: var(--text-3);
    font-size: 10px;
    transition: color 0.15s;
  }
  .mtab svg { color: var(--text-3); transition: color 0.15s; }
  .mtab.active { color: var(--primary); }
  .mtab.active svg { color: var(--primary); }
  .mtab:active { opacity: 0.7; }

  /* ---- 总览页移动端 ---- */
  .welcome-row { margin-bottom: 14px; }
  .welcome-title { font-size: 20px; line-height: 1.3; }
  .welcome-sub { font-size: 12px; }

  .stats-row { grid-template-columns: repeat(2, 1fr); gap: 10px; margin-bottom: 14px; }
  .stat-card { padding: 14px; gap: 6px; }
  .stat-value { font-size: 22px; }
  .stat-note { font-size: 11px; }

  .main-grid { gap: 12px; }
  .panel { padding: 16px; border-radius: 14px; }
  .panel-title { font-size: 15px; }

  /* ---- 工具栏 ---- */
  .view-toolbar { gap: 8px; margin-bottom: 14px; }
  .view-toolbar .btn { height: 36px; padding: 0 14px; font-size: 13px; }
  .date-picker-row { width: 100%; }
  .date-picker-row .date-input { flex: 1; min-width: 0; max-width: none; }
  .toolbar-hint { font-size: 12px; }

  /* ---- 课程表：手机端优先日视图，周视图横向滚动 ---- */
  .course-board { overflow-x: auto; }
  .week-board { min-width: 700px; }

  /* ---- 倒计时 ---- */
  .countdown-grid { grid-template-columns: repeat(2, 1fr); gap: 10px; }
  .cd-card { padding: 16px; }
  .cd-card-big { font-size: 30px; }

  /* ---- 记账 ---- */
  .finance-summary { grid-template-columns: 1fr; gap: 10px; }
  .summary-card { flex-direction: row; align-items: center; justify-content: space-between; padding: 14px 16px; }
  .summary-value { font-size: 20px; }

  /* ---- 营养 ---- */
  .nutri-layout { grid-template-columns: 1fr; gap: 12px; }

  /* ---- 待办 ---- */
  .todo-progress-card { padding: 14px 16px; }
  .todo-row { min-height: 48px; }

  /* ---- 表单与弹窗 ---- */
  .modal { max-width: none; width: calc(100vw - 28px); border-radius: 16px; }
  .form-row.double { flex-direction: column; gap: 14px; }

  /* ---- 触控目标 ---- */
  .link-btn { padding: 6px 2px; }
  .checkbox { width: 22px; height: 22px; }
  .fin-del, .nutri-del { opacity: 1; width: 34px; height: 34px; }
}

/* 超小屏（≤380px）：进一步收紧 */
@media (max-width: 380px) {
  .stats-row { grid-template-columns: repeat(2, 1fr); gap: 8px; }
  .countdown-grid { grid-template-columns: 1fr; }
  .view { padding: 14px 12px 88px; }
}
