:root {
  --bg: #eef2ef;
  /* 卡片底色比原来更实：不再依赖毛玻璃来透出背景，省掉每帧的模糊计算 */
  --surface: rgba(255, 255, 255, 0.9);
  --surface-solid: #ffffff;
  --text: #171717;
  --text-muted: #6b7280;
  --border: rgba(23, 23, 23, 0.09);
  --glass-border: rgba(255, 255, 255, 0.65);
  /* 只留给顶部固定栏；去掉 saturate，那是额外一层昂贵的色彩运算 */
  --glass-blur: blur(10px);
  --brand: #0ab861;
  --brand-soft: #e5fff2;
  /* 操作色：白字压在它上面时对比度约 4.9:1，够 WCAG AA；--brand 仍作装饰色用 */
  --brand-strong: #078248;
  --focus-ring: 0 0 0 3px rgba(10, 184, 97, 0.35);
  --radius: 16px;
  --shadow-sm: 0 1px 2px rgba(16, 36, 26, 0.05);
  --shadow-md: 0 8px 24px rgba(16, 36, 26, 0.08);
  --ease: cubic-bezier(0.22, 0.9, 0.3, 1);
}

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

/* 去掉手机端点击时出现的蓝色方框 */
* {
  -webkit-tap-highlight-color: transparent;
}

button, a, input, select, textarea {
  -webkit-appearance: none;
  appearance: none;
  outline: none;
  touch-action: manipulation;
}

button:focus-visible,
a:focus-visible,
input:focus-visible,
textarea:focus-visible,
select:focus-visible {
  outline: 2px solid var(--brand-strong);
  outline-offset: 2px;
}

body {
  font-family: "PingFang SC", "Microsoft YaHei", system-ui, sans-serif;
  color: var(--text);
  min-height: 100vh;
  min-height: 100dvh;   /* 手机地址栏收起/展开时高度更准 */
  display: flex;
  flex-direction: column;
  background-color: var(--bg);
  /* 背景：三层柔和光晕 + 底色，比纯灰更有呼吸感。
     不用 background-attachment: fixed —— 那会让手机滚动时每帧重绘整屏渐变 */
  background-image:
    radial-gradient(1100px 620px at 8% -12%, rgba(16, 185, 129, 0.16), transparent 62%),
    radial-gradient(900px 520px at 96% 2%, rgba(56, 132, 255, 0.10), transparent 58%),
    radial-gradient(800px 620px at 46% 108%, rgba(16, 185, 129, 0.10), transparent 62%);
  -webkit-font-smoothing: antialiased;
}

.site-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 18px 32px;
  border-bottom: 1px solid var(--glass-border);
  background: rgba(255, 255, 255, 0.62);
  backdrop-filter: var(--glass-blur);
  -webkit-backdrop-filter: var(--glass-blur);
  box-shadow: 0 1px 0 rgba(255, 255, 255, 0.6);
  position: sticky;
  top: 0;
  z-index: 20;
}

.site-header h1 { font-size: 20px; font-weight: 600; }

/* 装到桌面打开时是全面屏，给刘海/状态栏留出安全区，避免标题被盖住 */
@supports (padding: env(safe-area-inset-top)) {
  .site-header { padding-top: calc(18px + env(safe-area-inset-top)); }
}

.back-link {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 28px;
  height: 28px;
  border-radius: 8px;
  color: var(--text-muted);
  text-decoration: none;
  transition: background 0.16s var(--ease), color 0.16s var(--ease), transform 0.16s var(--ease);
}

.back-link:hover { background: rgba(10, 184, 97, 0.10); color: var(--brand); }
.back-link:active { transform: scale(0.92); }

/* 顶栏右侧的小导航胶囊（如：番茄钟） */
.header-link {
  display: inline-block;
  margin-left: 12px;
  padding: 4px 12px;
  border: 1px solid var(--border);
  border-radius: 999px;
  font-size: 13px;
  font-weight: 500;
  color: var(--text-muted);
  text-decoration: none;
  vertical-align: middle;
  transition: color 0.16s var(--ease), border-color 0.16s var(--ease), background 0.16s var(--ease);
}
.header-link:hover {
  color: var(--brand);
  border-color: rgba(10, 184, 97, 0.45);
  background: var(--brand-soft);
}
html.dark .header-link { background: rgba(255, 255, 255, 0.06); }

.status {
  font-size: 13px;
  padding: 4px 12px;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.7);
  color: var(--text-muted);
  border: 1px solid var(--border);
}
.status-ok { background: var(--brand-soft); color: var(--brand); border-color: transparent; }

.container {
  flex: 1;
  width: 100%;
  max-width: 960px;
  margin: 0 auto;  padding: 48px 24px;
}

/* hidden 属性统一生效：组件自己设了 display 会盖掉浏览器默认的 [hidden] 样式，
   导致 el.hidden = true 后元素其实还看得见（角色入口过滤就踩过这个坑） */
[hidden] { display: none !important; }

/* 角色入口：拿到角色之前先藏起来，避免成员短暂看到管理员功能 */
html:not([data-role]) [data-hide-for="member"],
html:not([data-role]) [data-need="admin"],
html:not([data-role]) [data-need="class"] { display: none; }

.intro { font-size: 18px; margin-bottom: 24px; }

/* ===== 首页三层分区 ===== */
.zone { margin-bottom: 32px; }

.zone-title {
  font-size: 14px;
  font-weight: 600;
  color: var(--text-muted);
  letter-spacing: 0.02em;
  margin-bottom: 12px;
}

/* --- 今日聚焦 --- */
.focus-row {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
  gap: 12px;
  margin-bottom: 12px;
}

.focus-card {
  display: flex;
  align-items: baseline;
  gap: 10px;
  padding: 16px 18px;
  border-radius: 14px;
  text-decoration: none;
  color: inherit;
  background: var(--surface);
  border: 1px solid var(--glass-border);
  box-shadow: var(--shadow-sm);
  transition: border-color 0.18s var(--ease), background 0.18s var(--ease);
}

.focus-card:hover { border-color: var(--accent); }

.focus-today { --accent: #d98b3f; }
.focus-overdue { --accent: #cf6a63; }

.focus-num {
  font-size: 26px;
  font-weight: 600;
  line-height: 1;
  color: var(--accent, var(--brand-strong));
}

.focus-label { font-size: 13px; color: var(--text-muted); }

.focus-list {
  list-style: none;
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.focus-item {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 14px;
  border-radius: 12px;
  background: var(--surface);
  border: 1px solid var(--border);
  font-size: 14px;
  text-decoration: none;
  color: inherit;
}

.focus-item .fi-dot {
  width: 7px;
  height: 7px;
  border-radius: 999px;
  background: var(--accent, var(--brand));
  flex: none;
}

.focus-item .fi-title { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.focus-item .fi-date { font-size: 12px; color: var(--text-muted); flex: none; }
.focus-item.overdue .fi-date { color: #cf6a63; }

.focus-empty { font-size: 13px; color: var(--text-muted); }

/* --- 每日打卡 --- */
.checkin-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 10px;
}

.checkin-head .zone-title {
  margin-bottom: 0;
  display: flex;
  align-items: center;
  gap: 8px;
}

.checkin-streak {
  font-style: normal;
  font-size: 12px;
  font-weight: 600;
  letter-spacing: 0;
  color: #0a8f4c;
  background: rgba(10, 184, 97, 0.12);
  border-radius: 999px;
  padding: 2px 9px;
}

.checkin-more {
  flex: none;
  font-size: 12px;
  color: var(--text-muted);
  text-decoration: none;
  padding: 4px 8px;
  border-radius: 8px;
  transition: color 0.16s var(--ease), background 0.16s var(--ease);
}

.checkin-more:hover { color: var(--brand-strong); background: var(--brand-soft); }

.checkin-empty { font-size: 13px; color: var(--text-muted); }

.checkin-progress {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-bottom: 12px;
}

.cp-text { font-size: 13px; color: var(--text-muted); flex: none; }
.cp-text b {
  font-size: 14px;
  font-weight: 600;
  color: var(--text);
  font-variant-numeric: tabular-nums;
}

.cp-bar {
  flex: 1;
  height: 6px;
  border-radius: 999px;
  background: rgba(23, 23, 23, 0.08);
  overflow: hidden;
}

.cp-fill {
  display: block;
  width: 0;
  height: 100%;
  border-radius: inherit;
  background: linear-gradient(90deg, #31d68a, #0ab861);
  transition: width 0.5s var(--ease);
}

.habit-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(150px, 1fr));
  gap: 10px;
}

.habit-card {
  position: relative;
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 4px;
  padding: 14px 14px 12px;
  border-radius: 14px;
  border: 1px solid var(--border);
  background: var(--hc-bg, rgba(10, 184, 97, 0.10));
  color: var(--text);
  font-family: inherit;
  text-align: left;
  cursor: pointer;
  transition: transform 0.16s var(--ease), box-shadow 0.16s var(--ease),
              border-color 0.16s var(--ease);
}

.habit-card:hover {
  transform: translateY(-2px);
  border-color: rgba(10, 184, 97, 0.35);
  box-shadow: var(--shadow-sm);
}

.habit-card:active { transform: scale(0.97); }
.habit-card.is-done { border-color: rgba(10, 184, 97, 0.45); }

.habit-card.is-rest { opacity: 0.55; cursor: default; }
.habit-card.is-rest:hover {
  transform: none;
  border-color: var(--border);
  box-shadow: none;
}

.hc-name {
  font-size: 14px;
  font-weight: 600;
  line-height: 1.3;
  padding-right: 22px;
  word-break: break-all;
}

.hc-streak { font-size: 12px; color: var(--hc-fg, #0a8f4c); }

.hc-mark {
  position: absolute;
  top: 11px;
  right: 11px;
  display: grid;
  place-items: center;
  width: 17px;
  height: 17px;
  border-radius: 999px;
  border: 1.5px solid rgba(23, 23, 23, 0.16);
  font-size: 11px;
  line-height: 1;
  color: #fff;
}

.habit-card.is-done .hc-mark {
  border-color: transparent;
  background: var(--hc-fg, #0a8f4c);
}

.week-rhythm {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-top: 14px;
  padding: 10px 12px;
  border-radius: 12px;
  background: var(--surface);
  border: 1px solid var(--border);
}

.wr-label { flex: none; font-size: 12px; color: var(--text-muted); }

.wr-days {
  flex: 1;
  display: grid;
  grid-template-columns: repeat(7, 1fr);
  gap: 6px;
}

.wr-day {
  display: grid;
  place-items: center;
  height: 26px;
  border-radius: 7px;
  font-size: 12px;
  color: var(--text-muted);
  background: rgba(23, 23, 23, 0.06);
}

.wr-day.is-partial { background: rgba(10, 184, 97, 0.26); color: #0a8f4c; }
.wr-day.is-full { background: var(--brand); color: #fff; }
.wr-day.is-today { outline: 2px solid rgba(10, 184, 97, 0.35); outline-offset: 1px; }
.wr-day.is-future { opacity: 0.5; }

html.dark .checkin-streak { color: #5ee0a3; background: rgba(10, 184, 97, 0.18); }
html.dark .cp-bar { background: rgba(255, 255, 255, 0.12); }
html.dark .habit-card { border-color: rgba(255, 255, 255, 0.10); }
html.dark .habit-card.is-rest:hover { border-color: rgba(255, 255, 255, 0.10); }
html.dark .hc-mark { border-color: rgba(255, 255, 255, 0.25); }
html.dark .week-rhythm { background: rgba(255, 255, 255, 0.05); border-color: rgba(255, 255, 255, 0.08); }
html.dark .wr-day { background: rgba(255, 255, 255, 0.08); }
html.dark .wr-day.is-partial { background: rgba(10, 184, 97, 0.32); color: #7ce8b4; }
html.dark .wr-day.is-full { color: #062d1c; }

@media (max-width: 640px) {
  .habit-grid { grid-template-columns: repeat(2, 1fr); }
}

/* --- 快捷操作 --- */
.quick-row {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(140px, 1fr));
  gap: 12px;
}

.quick-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 14px 18px;
  border-radius: 14px;
  font-size: 14px;
  font-weight: 500;
  text-decoration: none;
  color: var(--text);
  background: var(--surface);
  border: 1px solid var(--glass-border);
  box-shadow: var(--shadow-sm);
  transition: border-color 0.18s var(--ease), color 0.18s var(--ease), background 0.18s var(--ease);
}

.quick-btn:hover { border-color: var(--brand); color: var(--brand-strong); background: var(--brand-soft); }
.quick-btn svg { width: 18px; height: 18px; color: var(--brand-strong); }

.card-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  gap: 20px;
}

.card {
  position: relative;
  display: block;
  background: var(--surface);
  border: 1px solid var(--glass-border);
  border-radius: var(--radius);
  padding: 28px 24px;
  text-decoration: none;
  color: inherit;
  box-shadow: var(--shadow-sm);
  transition: transform 0.2s var(--ease), box-shadow 0.2s var(--ease),
              border-color 0.2s var(--ease), background 0.2s var(--ease);
  animation: card-in 0.45s var(--ease) both;
}

/* 卡片依次淡入，避免一起蹦出来 */
.card:nth-child(2) { animation-delay: 0.06s; }
.card:nth-child(3) { animation-delay: 0.12s; }
.card:nth-child(4) { animation-delay: 0.18s; }

/* 模块辅助色：低饱和度，只用于图标和 hover 边线，主色仍是绿 */
.card[data-accent="todo"] { --accent: #d98b3f; }
.card[data-accent="drive"] { --accent: #4a86c7; }
.card[data-accent="campus"] { --accent: #7b74c9; }
.card[data-accent="pomodoro"] { --accent: #cf6a63; }

@keyframes card-in {
  from { opacity: 0; transform: translateY(10px); }
  to { opacity: 1; transform: none; }
}

.card:hover {
  border-color: var(--accent, var(--brand));
  transform: translateY(-2px);
  box-shadow: var(--shadow-md);
  background: var(--surface-solid);
}

.card svg {
  width: 36px;
  height: 36px;
  color: var(--accent, var(--brand));
  margin-bottom: 16px;
}

.card h2 { font-size: 17px; font-weight: 600; margin-bottom: 6px; }
.card p { font-size: 14px; color: var(--text-muted); }

.tag {
  position: absolute;
  top: 16px;
  right: 16px;
  font-size: 12px;
  padding: 2px 10px;
  border-radius: 999px;
  background: var(--brand-soft);
  color: var(--brand-strong);
}

.site-footer {
  padding: 20px;
  text-align: center;
  font-size: 13px;
  color: var(--text-muted);
  border-top: 1px solid var(--border);
  background: rgba(255, 255, 255, 0.72);
}

/* ===== 手机端适配 ===== */
@media (max-width: 640px) {
  .site-header { padding: 14px 16px; }
  .site-header h1 { font-size: 17px; }
  .container { padding: 24px 16px; }
  .intro { font-size: 16px; }
  .card { padding: 22px 18px; }
  /* 手机端关掉 hover 抬升，避免点完还悬在半空 */
  .card:hover { transform: none; box-shadow: var(--shadow-sm); }
}

/* ===== 登录页 ===== */
.login-page {
  min-height: 100vh;
  min-height: 100dvh;   /* 手机浏览器地址栏收起/展开时高度更准 */
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 24px;
  position: relative;
}

/* 右上角主题切换 */
.login-theme {
  position: absolute;
  top: 18px;
  right: 18px;
  width: 40px;
  height: 40px;
  display: grid;
  place-items: center;
  font-size: 18px;
  border-radius: 999px;
  border: 1px solid var(--border);
  background: var(--surface);
  cursor: pointer;
  transition: background 0.18s var(--ease), border-color 0.18s var(--ease);
}
.login-theme:hover { border-color: var(--brand); background: var(--brand-soft); }

.login-card {
  width: 360px;
  max-width: 100%;
  padding: 32px 28px 28px;
  background: var(--surface);
  border: 1px solid var(--glass-border);
  border-radius: 20px;
  box-shadow: 0 20px 50px rgba(16, 36, 26, 0.12);
  animation: card-in 0.45s var(--ease) both;
}

.login-card h1 { font-size: 22px; font-weight: 600; margin-bottom: 6px; }
.login-card .login-sub { font-size: 13px; color: var(--text-muted); margin-bottom: 24px; }

.login-field { display: flex; flex-direction: column; gap: 6px; margin-bottom: 14px; }
.login-field label { font-size: 13px; color: var(--text-muted); }

.login-field input {
  font-family: inherit;
  font-size: 15px;
  color: var(--text);
  padding: 12px 14px;
  border-radius: 12px;
  border: 1px solid var(--border);
  background: rgba(255, 255, 255, 0.8);
  transition: border-color 0.18s var(--ease), box-shadow 0.18s var(--ease);
}

/* 焦点只保留一种视觉：边框变色 + 单层柔光环（不再叠加全局 outline） */
.login-field input:focus {
  border-color: var(--brand-strong);
}

.login-field input:focus-visible {
  outline: none;
  border-color: var(--brand-strong);
  box-shadow: var(--focus-ring);
}

/* 密码框：右侧留给「显示 / 隐藏」图标按钮 */
.login-pwd-wrap { position: relative; }
.login-pwd-wrap input { width: 100%; padding-right: 46px; }

.login-pwd-toggle {
  position: absolute;
  top: 50%;
  right: 8px;
  transform: translateY(-50%);
  display: grid;
  place-items: center;
  width: 32px;
  height: 32px;
  padding: 0;
  border: none;
  border-radius: 8px;
  background: transparent;
  color: var(--brand-strong);
  cursor: pointer;
  transition: background 0.15s var(--ease), color 0.15s var(--ease);
}

.login-pwd-toggle svg { width: 18px; height: 18px; display: block; }
.login-pwd-toggle:hover { background: rgba(10, 184, 97, 0.12); }

.login-caps {
  font-size: 12px;
  color: #a8641b;
  background: rgba(232, 145, 58, 0.12);
  border-radius: 8px;
  padding: 5px 9px;
  margin-top: 2px;
}

.login-btn {
  width: 100%;
  margin-top: 8px;
  font-family: inherit;
  font-size: 15px;
  font-weight: 600;
  color: #fff;
  background: var(--brand-strong);
  border: none;
  border-radius: 12px;
  padding: 12px 0;
  cursor: pointer;
  transition: background 0.18s var(--ease);
}

.login-btn:hover { background: #066b3b; }
.login-btn:disabled { opacity: 0.6; cursor: default; }

.login-error {
  font-size: 13px;
  color: #b3322b;
  background: rgba(224, 82, 82, 0.12);
  border-radius: 10px;
  padding: 8px 12px;
  margin-bottom: 12px;
  animation: fade-in 0.24s var(--ease);
}

html.dark .login-error { color: #ffb3ad; }
html.dark .login-caps { color: #f0c088; }
html.dark .login-pwd-toggle { color: #57d999; }
html.dark .login-field input { background: rgba(255, 255, 255, 0.06); }

@keyframes fade-in { from { opacity: 0; transform: translateY(-4px); } to { opacity: 1; transform: none; } }

/* ===== 登录后的问候语：中央显示 → 缩到左上角 ===== */
.greeting {
  position: fixed;
  inset: 0;
  z-index: 70;
  display: flex;
  align-items: center;
  justify-content: center;
  background-color: var(--bg);
  background-image:
    radial-gradient(1100px 620px at 8% -12%, rgba(16, 185, 129, 0.16), transparent 62%),
    radial-gradient(900px 520px at 96% 2%, rgba(56, 132, 255, 0.10), transparent 58%),
    radial-gradient(800px 620px at 46% 108%, rgba(16, 185, 129, 0.10), transparent 62%);
  transition: opacity 0.35s var(--ease);
}

.greeting-text {
  /* 刚出现时字号更大，像从水下浮上来 */
  font-size: clamp(44px, 7.5vw, 76px);
  font-weight: 600;
  letter-spacing: 1px;
  color: var(--text);
  transform-origin: center;
  opacity: 0;
  transform: translateY(30px) scale(0.94);
  filter: blur(12px);
  transition:
    opacity 0.8s var(--ease),
    transform 1.05s cubic-bezier(0.16, 1, 0.3, 1),
    filter 0.9s var(--ease);
}

.greeting.emerge .greeting-text {
  opacity: 1;
  transform: none;
  filter: blur(0);
}

/* 停一会儿后缓缓缩向左上角，落点正好在标题栏 */
.greeting.settle .greeting-text {
  opacity: 0;
  transform: translate(-38vw, -42vh) scale(0.28);
  filter: blur(5px);
  transition:
    transform 1.15s cubic-bezier(0.4, 0, 0.2, 1),
    opacity 0.75s var(--ease) 0.35s,
    filter 1s var(--ease);
}

.greeting.done { opacity: 0; pointer-events: none; }

/* display:flex 会盖掉 hidden 属性的隐藏效果，这里补回来，否则动画结束后整页点不动 */
.greeting[hidden] { display: none; }

.site-header, .container, .site-footer { transition: opacity 0.4s var(--ease); }

/* 左上角的常驻问候 */
.hello-name { font-size: 13px; color: var(--text-muted); font-weight: 400; margin-left: 10px; }

/* ===== 左下角设置按钮 ===== */
.settings-fab {
  position: fixed;
  left: 28px;
  bottom: 28px;
  width: 46px;
  height: 46px;
  border-radius: 50%;
  border: 1px solid var(--glass-border);
  background: rgba(255, 255, 255, 0.92);
  color: var(--text-muted);
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  box-shadow: var(--shadow-md);
  z-index: 25;
  transition: transform 0.2s var(--ease), color 0.2s var(--ease), box-shadow 0.2s var(--ease);
}

.settings-fab:hover { color: var(--brand); border-color: var(--brand); transform: translateY(-2px); }
.settings-fab:active { transform: scale(0.94); }
.settings-fab svg { width: 22px; height: 22px; }

/* ===== 设置弹窗 ===== */
.hub-overlay {
  position: fixed;
  inset: 0;
  z-index: 40;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 24px;
  /* 全屏模糊是所有毛玻璃里最贵的一种，换成更实的半透明遮罩即可 */
  background: rgba(24, 32, 28, 0.42);
  animation: overlay-in 0.22s var(--ease);
}
.hub-overlay[hidden] { display: none; }

.hub-modal {
  width: 380px;
  max-width: 100%;
  padding: 24px;
  border-radius: 20px;
  background: rgba(255, 255, 255, 0.97);
  border: 1px solid rgba(255, 255, 255, 0.9);
  box-shadow: 0 24px 60px rgba(16, 36, 26, 0.22);
  animation: modal-in 0.26s var(--ease);
}

@keyframes overlay-in { from { opacity: 0; } to { opacity: 1; } }
@keyframes modal-in { from { opacity: 0; transform: translateY(12px) scale(0.97); } to { opacity: 1; transform: none; } }

.hub-modal h2 { font-size: 17px; font-weight: 600; margin-bottom: 18px; }

.setting-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  padding: 14px 0;
  border-bottom: 1px solid var(--border);
}

.setting-row .setting-label { font-size: 14px; }
.setting-row .setting-desc { font-size: 12px; color: var(--text-muted); margin-top: 2px; }

/* 开关滑块 */
.toggle { position: relative; display: inline-flex; flex-shrink: 0; cursor: pointer; }
.toggle input { position: absolute; opacity: 0; width: 0; height: 0; }
.toggle-track {
  width: 46px;
  height: 26px;
  border-radius: 999px;
  background: rgba(23, 23, 23, 0.12);
  transition: background 0.2s var(--ease);
  display: block;
}
.toggle-track::after {
  content: "";
  display: block;
  width: 20px;
  height: 20px;
  margin: 3px;
  border-radius: 50%;
  background: #fff;
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.18);
  transition: transform 0.2s var(--ease);
}
.toggle input:checked + .toggle-track { background: var(--brand); }
.toggle input:checked + .toggle-track::after { transform: translateX(20px); }

.pwd-form { display: flex; flex-direction: column; gap: 10px; margin-top: 16px; }
.pwd-form input {
  font-family: inherit;
  font-size: 14px;
  color: var(--text);
  padding: 10px 12px;
  border-radius: 10px;
  border: 1px solid var(--border);
  background: rgba(255, 255, 255, 0.85);
}
.pwd-form input:focus { border-color: rgba(10, 184, 97, 0.5); }

.pwd-tip { font-size: 12px; min-height: 16px; margin-top: 2px; }
.pwd-tip.ok { color: #0a8f4c; }
.pwd-tip.err { color: #c23a3a; }

.hub-actions { display: flex; justify-content: flex-end; gap: 10px; margin-top: 18px; }
.hub-btn {
  font-family: inherit;
  font-size: 14px;
  padding: 10px 20px;
  border-radius: 12px;
  border: 1px solid var(--border);
  background: rgba(255, 255, 255, 0.9);
  color: var(--text);
  cursor: pointer;
  transition: transform 0.18s var(--ease), background 0.18s var(--ease);
}
.hub-btn:hover { background: rgba(255, 255, 255, 1); }
.hub-btn:active { transform: scale(0.97); }
.hub-btn.primary { background: var(--brand); border-color: transparent; color: #fff; font-weight: 500; }
.hub-btn.primary:hover { background: #09a656; }
.hub-btn.ghost { background: transparent; color: var(--text-muted); }

/* ===== 黑夜模式 ===== */
html.dark {
  --bg: #0e1411;
  --surface: rgba(26, 34, 30, 0.92);
  --surface-solid: #1a211d;
  --text: #e7efea;
  --text-muted: #94a39b;
  --border: rgba(255, 255, 255, 0.13);
  --glass-border: rgba(255, 255, 255, 0.12);
  --brand-soft: rgba(10, 184, 97, 0.18);
  --shadow-sm: 0 1px 2px rgba(0, 0, 0, 0.4);
  --shadow-md: 0 10px 28px rgba(0, 0, 0, 0.45);
}

html.dark body {
  background-image:
    radial-gradient(1100px 620px at 8% -12%, rgba(16, 185, 129, 0.20), transparent 62%),
    radial-gradient(900px 520px at 96% 2%, rgba(56, 132, 255, 0.12), transparent 58%),
    radial-gradient(800px 620px at 46% 108%, rgba(16, 185, 129, 0.12), transparent 62%);
}

html.dark .site-header { background: rgba(18, 24, 21, 0.86); }
html.dark .site-footer { background: rgba(18, 24, 21, 0.82); }
html.dark .status { background: rgba(255, 255, 255, 0.08); }
html.dark .status-ok { background: var(--brand-soft); }
html.dark .card:hover { background: rgba(38, 48, 43, 0.92); }
html.dark .settings-fab { background: rgba(30, 39, 34, 0.96); }
html.dark .hub-modal { background: rgba(26, 34, 30, 0.98); border-color: rgba(255, 255, 255, 0.12); }
html.dark .login-field input,
html.dark .pwd-form input { background: rgba(255, 255, 255, 0.07); color: var(--text); }
html.dark .hub-btn { background: rgba(255, 255, 255, 0.08); }
html.dark .hub-btn.primary { background: var(--brand); }
html.dark .hub-btn.danger { background: rgba(224, 82, 82, 0.16); color: #ff9a9a; }

/* 退出登录 */
.logout-row {
  margin-top: 16px;
  padding-top: 16px;
  border-top: 1px solid var(--border);
  display: flex;
}
.hub-btn.danger {
  background: rgba(224, 82, 82, 0.08);
  border-color: transparent;
  color: #c23a3a;
}
.hub-btn.danger:hover { background: rgba(224, 82, 82, 0.16); }
html.dark .greeting { background-color: var(--bg); }

@media (max-width: 640px) {
  .settings-fab { left: 16px; bottom: calc(16px + env(safe-area-inset-bottom)); width: 44px; height: 44px; }
  .hub-overlay { align-items: flex-end; padding: 0; }
  .hub-modal {
    width: 100%;
    border-radius: 22px 22px 0 0;
    padding: 22px 18px calc(22px + env(safe-area-inset-bottom));
    animation: hub-sheet-in 0.3s var(--ease);
  }
  @keyframes hub-sheet-in { from { transform: translateY(100%); opacity: 0.6; } to { transform: none; opacity: 1; } }
}

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

/* ===== 全局交互统一：更顺滑的按压、涟漪与切换 ===== */
html { scroll-behavior: smooth; }

/* 按压缩放：用 :where 保持零权重，不覆盖各页面已有的精细动效 */
:where(button:not(:disabled)):active { opacity: 0.9; }

body { transition: opacity 0.16s ease; }
body.page-leave { opacity: 0; pointer-events: none; }

/* 悬停：只改颜色/边框，不做下沉或倾斜，操作反馈更稳定 */
button:not(:disabled):not(.fab):not(.ddl-fab):not(.settings-fab):hover,
.file-btn:hover,
.back-link:hover {
  transition: background-color 0.18s var(--ease), border-color 0.18s var(--ease),
              color 0.18s var(--ease), box-shadow 0.18s var(--ease);
}

/* 按下时只轻微变暗，不再缩放/位移 */
button:not(:disabled):not(.fab):not(.ddl-fab):not(.settings-fab):active,
.file-btn:active,
.back-link:active {
  opacity: 0.9;
}

/* 列表错峰出现：让一批条目依次浮入，而不是同时闪现 */
.todo-list > .todo-item:nth-child(2),
.ddl-list > .ddl-item:nth-child(2),
.drive-list > .drive-item:nth-child(2) { animation-delay: 0.04s; }
.todo-list > .todo-item:nth-child(3),
.ddl-list > .ddl-item:nth-child(3),
.drive-list > .drive-item:nth-child(3) { animation-delay: 0.08s; }
.todo-list > .todo-item:nth-child(4),
.ddl-list > .ddl-item:nth-child(4),
.drive-list > .drive-item:nth-child(4) { animation-delay: 0.12s; }
.todo-list > .todo-item:nth-child(5),
.ddl-list > .ddl-item:nth-child(5),
.drive-list > .drive-item:nth-child(5) { animation-delay: 0.16s; }
.todo-list > .todo-item:nth-child(6),
.ddl-list > .ddl-item:nth-child(6),
.drive-list > .drive-item:nth-child(6) { animation-delay: 0.20s; }
.todo-list > .todo-item:nth-child(n+7),
.ddl-list > .ddl-item:nth-child(n+7),
.drive-list > .drive-item:nth-child(n+7) { animation-delay: 0.24s; }

/* 弹窗关闭动画（设置弹窗 / DDL 弹窗） */
.hub-overlay.closing,
.ddl-overlay.closing {
  animation: ui-overlay-out 0.18s ease forwards;
  pointer-events: none;
}
.hub-overlay.closing .hub-modal,
.ddl-overlay.closing .ddl-modal {
  animation: ui-modal-out 0.18s ease forwards;
}
@keyframes ui-overlay-out {
  to { opacity: 0; }
}
@keyframes ui-modal-out {
  to { opacity: 0; transform: translateY(8px) scale(0.97); }
}

/* ===== PWA：新版本就绪提示条 ===== */
#pwa-update {
  position: fixed;
  left: 50%;
  bottom: calc(92px + env(safe-area-inset-bottom));
  transform: translateX(-50%);
  z-index: 60;
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 10px 12px 10px 16px;
  border-radius: 14px;
  background: rgba(23, 23, 23, 0.92);
  color: #fff;
  font-size: 13px;
  box-shadow: 0 12px 32px rgba(0, 0, 0, 0.24);
  animation: pwa-up-in 0.26s var(--ease) both;
}

#pwa-update button {
  font-family: inherit;
  font-size: 13px;
  font-weight: 500;
  padding: 6px 14px;
  border: 0;
  border-radius: 9px;
  background: var(--brand);
  color: #fff;
  cursor: pointer;
  transition: background 0.15s var(--ease), transform 0.15s var(--ease);
}

#pwa-update button:hover { background: #09a556; }
#pwa-update button:active { transform: scale(0.95); }

@keyframes pwa-up-in {
  from { opacity: 0; transform: translate(-50%, 10px); }
  to   { opacity: 1; transform: translate(-50%, 0); }
}

@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
}

/* ===== 手机端：顶栏毛玻璃换成实色 =====
   sticky 顶栏的模糊在滚动时每一帧都要对整条屏幕宽度重新采样，
   手机 GPU 扛不住就是掉帧的主要来源。这里换成 96% 不透明底色，
   肉眼几乎看不出差别，滚动立刻顺。 */
@media (max-width: 640px) {
  .site-header {
    background: rgba(255, 255, 255, 0.96);
    backdrop-filter: none;
    -webkit-backdrop-filter: none;
  }
  html.dark .site-header { background: rgba(18, 24, 21, 0.96); }
}

/* ===== 顶部请求进度条：所有 fetch 自动触发 ===== */
.hub-progress {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  height: 2px;
  z-index: 90;
  pointer-events: none;
  opacity: 0;
  transition: opacity 0.2s var(--ease);
}
.hub-progress.on { opacity: 1; }
.hub-progress i {
  display: block;
  height: 100%;
  width: 100%;
  background: var(--brand);
  transform: scaleX(0);
  transform-origin: left center;
  transition: transform 0.25s var(--ease);
}

/* ===== 按钮内联转圈 ===== */
.btn-spinner {
  display: inline-block;
  width: 14px;
  height: 14px;
  margin-right: 8px;
  vertical-align: -2px;
  border: 2px solid rgba(255, 255, 255, 0.45);
  border-top-color: #fff;
  border-radius: 50%;
  animation: hub-spin 0.8s linear infinite;
}
@keyframes hub-spin { to { transform: rotate(360deg); } }

/* ===== 骨架屏：首次加载时占位，尺寸和真内容一致，不跳动 ===== */
li.skel-row { list-style: none; }
.skel-row {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 16px;
  margin-bottom: 10px;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: var(--surface);
}
.skel-dot {
  width: 22px;
  height: 22px;
  border-radius: 50%;
  background: rgba(127, 127, 127, 0.18);
  flex: none;
}
.skel-lines { flex: 1; display: flex; flex-direction: column; gap: 8px; }
.skel-line {
  height: 10px;
  border-radius: 6px;
  background: rgba(127, 127, 127, 0.18);
}
.skel-line.short { width: 38%; }
@media (prefers-reduced-motion: no-preference) {
  .skel-dot, .skel-line { animation: hub-pulse 1.1s ease-in-out infinite; }
  .skel-line.short { animation-delay: 0.15s; }
}
@keyframes hub-pulse {
  0%, 100% { opacity: 0.45; }
  50% { opacity: 0.9; }
}

/* ===== 首页 header：名字后面的天气小胶囊 ===== */
.weather-wrap {
  position: relative;
  display: inline-flex;
  vertical-align: middle;
  margin-left: 8px;
}
.weather-chip {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  height: 26px;
  padding: 0 9px;
  border: 1px solid var(--border);
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.72);
  color: var(--text);
  font-family: inherit;
  font-size: 13px;
  font-weight: 500;
  line-height: 1;
  cursor: pointer;
  transition: background 0.16s var(--ease), border-color 0.16s var(--ease);
}
.weather-chip:hover { border-color: var(--brand); }
.weather-chip[aria-expanded="true"] { border-color: var(--brand); background: var(--brand-soft); }
.weather-chip-icon { display: inline-flex; color: var(--brand); }
.weather-chip-icon svg { width: 16px; height: 16px; display: block; }
.weather-chip-temp { font-variant-numeric: tabular-nums; }
.weather-chip.is-loading .weather-chip-temp { animation: hub-pulse 1.1s ease-in-out infinite; }

.weather-pop {
  position: absolute;
  top: calc(100% + 10px);
  left: 50%;
  transform: translateX(-50%);
  width: 248px;
  max-width: calc(100vw - 32px);
  padding: 14px;
  border: 1px solid var(--border);
  border-radius: 14px;
  background: var(--surface-solid);
  box-shadow: var(--shadow-md);
  z-index: 40;
  font-weight: 400;
  text-align: left;
}
.weather-pop-head {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 8px;
  margin-bottom: 10px;
}
.weather-city { font-size: 14px; font-weight: 600; }
.weather-muted { font-size: 12px; color: var(--text-muted); }
.weather-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px 12px;
  margin-bottom: 10px;
}
.weather-k { display: block; font-size: 12px; color: var(--text-muted); }
.weather-v { font-size: 13px; font-weight: 500; font-variant-numeric: tabular-nums; }
.weather-pop-foot {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  padding-top: 10px;
  border-top: 1px solid var(--border);
}
.weather-link {
  border: 0;
  background: transparent;
  color: var(--brand);
  font-family: inherit;
  font-size: 12px;
  font-weight: 500;
  padding: 2px 4px;
  border-radius: 6px;
  cursor: pointer;
}
.weather-link:hover { background: var(--brand-soft); }
.weather-link.strong { color: #fff; background: var(--brand); padding: 6px 12px; }
.weather-city-form {
  display: flex;
  gap: 8px;
  margin-top: 10px;
}
.weather-city-form input {
  flex: 1;
  min-width: 0;
  font-family: inherit;
  font-size: 13px;
  padding: 7px 10px;
  border: 1px solid var(--border);
  border-radius: 9px;
  background: rgba(255, 255, 255, 0.9);
  color: var(--text);
}
.weather-err {
  margin-top: 8px;
  font-size: 12px;
  color: #c23a3a;
}

html.dark .weather-chip { background: rgba(255, 255, 255, 0.08); }
html.dark .weather-city-form input { background: rgba(255, 255, 255, 0.07); }

@media (max-width: 640px) {
  .weather-chip { height: 24px; padding: 0 8px; font-size: 12px; }
  .weather-wrap { margin-left: 6px; }
}

/* ===== 深色模式补丁：按钮别再反白变亮 ===== */
html.dark .hub-btn:hover { background: rgba(255, 255, 255, 0.14); }
html.dark .hub-btn.primary:hover { background: #0cc26b; }
html.dark .hub-btn.danger:hover { background: rgba(224, 82, 82, 0.26); }
html.dark .hub-btn.ghost { background: transparent; }
html.dark .hub-btn.ghost:hover { background: rgba(255, 255, 255, 0.08); }
html.dark .login-btn:hover { background: #0cc26b; box-shadow: 0 8px 20px rgba(10, 184, 97, 0.42); }
html.dark .status { color: var(--text-muted); }
html.dark .status-ok { color: #4ee89a; }
