/* ============ 主题变量 ============ */
:root {
  --accent: #6366f1;
  --accent-2: #22d3ee;
  --success: #22c55e;
  --warn: #f59e0b;
  --danger: #ef4444;
  --radius: 16px;
  --radius-sm: 10px;
  --shadow: 0 10px 30px rgba(0, 0, 0, .18);
  --t: .18s ease;
  --font: "PingFang SC", "Microsoft YaHei", "Segoe UI", system-ui, -apple-system, "Helvetica Neue", sans-serif;
}

html[data-theme="dark"] {
  --bg: #0e1117;
  --bg-2: #131823;
  --surface: #171d29;
  --surface-2: #1d2534;
  --border: #26304180;
  --text: #e8edf7;
  --muted: #8b98ad;
  --cell-empty: #1b2231;
}

html[data-theme="light"] {
  --bg: #f4f6fb;
  --bg-2: #eef1f8;
  --surface: #ffffff;
  --surface-2: #f6f8fc;
  --border: #e2e7f0;
  --text: #17202f;
  --muted: #6b7688;
  --cell-empty: #e9edf5;
  --shadow: 0 8px 24px rgba(20, 30, 60, .08);
}

* { box-sizing: border-box; }

body {
  margin: 0;
  font-family: var(--font);
  background:
    radial-gradient(900px 500px at 12% -8%, color-mix(in srgb, var(--accent) 22%, transparent), transparent 60%),
    radial-gradient(800px 460px at 92% 4%, color-mix(in srgb, var(--accent-2) 16%, transparent), transparent 60%),
    var(--bg);
  color: var(--text);
  min-height: 100vh;
  -webkit-font-smoothing: antialiased;
}

h1, h2, h3 { margin: 0; font-weight: 700; }
p { margin: 0; }
button { font-family: inherit; cursor: pointer; }
::-webkit-scrollbar { width: 10px; height: 10px; }
::-webkit-scrollbar-thumb { background: var(--border); border-radius: 10px; }

/* ============ 顶栏 ============ */
.topbar {
  display: flex; align-items: center; justify-content: space-between;
  gap: 16px; padding: 20px 28px 8px; max-width: 1240px; margin: 0 auto;
}
/* 左上角账号区：头像 + 昵称 */
.acct-chip {
  display: flex; align-items: center; gap: 10px; padding: 5px 12px 5px 6px;
  border: 1px solid var(--border); background: var(--surface-2); border-radius: 999px;
  color: var(--text); font-size: 14px; max-width: 52vw; min-width: 0; transition: var(--t);
}
.acct-chip:hover { border-color: var(--accent); }
.acct-avatar {
  width: 36px; height: 36px; border-radius: 50%; flex: none; display: grid; place-items: center;
  font-size: 20px; background: linear-gradient(135deg, var(--accent), var(--accent-2));
  box-shadow: 0 6px 14px color-mix(in srgb, var(--accent) 40%, transparent);
}
.acct-name {
  font-weight: 700; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; min-width: 0;
}

/* 头像选择 */
.avatar-grid { display: grid; grid-template-columns: repeat(6, 1fr); gap: 8px; margin-top: 12px; }
.avatar-item {
  aspect-ratio: 1; border-radius: 12px; border: 1px solid var(--border); background: var(--surface-2);
  font-size: 22px; display: grid; place-items: center; padding: 0; transition: var(--t);
}
.avatar-item:hover { transform: translateY(-2px); border-color: var(--accent); }
.avatar-item.active { border-color: var(--accent); background: color-mix(in srgb, var(--accent) 18%, transparent); }

/* 个人信息里的 关注/粉丝/好友 三栏 */
.pa-stats {
  display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; margin-top: 12px;
  border: 1px solid var(--border); border-radius: 12px; overflow: hidden; background: var(--surface-2);
}
.pa-stat { padding: 10px 4px; text-align: center; cursor: pointer; transition: var(--t); }
.pa-stat:hover { background: color-mix(in srgb, var(--accent) 14%, transparent); }
.pa-stat-num { font-size: 18px; font-weight: 800; }
.pa-stat-label { font-size: 12px; color: var(--muted); margin-top: 2px; }

.brand { display: flex; align-items: center; gap: 14px; }
.logo {
  width: 46px; height: 46px; display: grid; place-items: center; font-size: 24px;
  background: linear-gradient(135deg, var(--accent), var(--accent-2));
  border-radius: 14px; box-shadow: 0 8px 20px color-mix(in srgb, var(--accent) 45%, transparent);
}
.brand-text h1 { font-size: 20px; letter-spacing: .5px; }
.brand-text p { font-size: 13px; color: var(--muted); margin-top: 2px; }
.top-actions { display: flex; gap: 8px; align-items: center; }

.icon-btn, .round-btn {
  width: 38px; height: 38px; border-radius: 12px; border: 1px solid var(--border);
  background: var(--surface); color: var(--text); font-size: 16px;
  display: grid; place-items: center; transition: var(--t);
}
.icon-btn:hover, .round-btn:hover { background: var(--surface-2); transform: translateY(-1px); }

.ghost-btn, .text-btn, .primary-btn, .danger-btn {
  border-radius: 12px; padding: 9px 16px; font-size: 14px; font-weight: 600;
  border: 1px solid var(--border); background: var(--surface); color: var(--text); transition: var(--t);
}
.ghost-btn:hover, .text-btn:hover { background: var(--surface-2); }
.primary-btn {
  background: linear-gradient(135deg, var(--accent), #8b5cf6); border: none; color: #fff;
  box-shadow: 0 6px 18px color-mix(in srgb, var(--accent) 40%, transparent);
}
.primary-btn:hover { filter: brightness(1.08); transform: translateY(-1px); }
.danger-btn { color: var(--danger); border-color: color-mix(in srgb, var(--danger) 35%, var(--border)); }
.danger-btn:hover { background: color-mix(in srgb, var(--danger) 14%, transparent); }
.text-btn { border: none; background: transparent; color: var(--muted); padding: 6px 8px; }

/* ============ Tabs ============ */
.tabs {
  display: flex; gap: 6px; max-width: 1240px; margin: 12px auto 0; padding: 0 28px;
  border-bottom: 1px solid var(--border);
}
.tab {
  border: none; background: transparent; color: var(--muted); font-size: 15px; font-weight: 600;
  padding: 12px 18px; border-radius: 12px 12px 0 0; position: relative; transition: var(--t);
}
.tab:hover { color: var(--text); }
.tab.active { color: var(--text); }
.tab.active::after {
  content: ""; position: absolute; left: 18px; right: 18px; bottom: -1px; height: 3px; border-radius: 3px;
  background: linear-gradient(90deg, var(--accent), var(--accent-2));
}

.container { max-width: 1240px; margin: 0 auto; padding: 22px 28px 60px; }
.view { display: none; animation: fade .25s ease; }
.view.active { display: block; }
@keyframes fade { from { opacity: 0; transform: translateY(6px); } to { opacity: 1; transform: none; } }

/* ============ 卡片 ============ */
.card {
  background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius);
  padding: 20px; margin-bottom: 18px; box-shadow: var(--shadow);
}
.card-head { display: flex; align-items: center; gap: 10px; margin-bottom: 14px; }
.card-head h3 { font-size: 15px; }
.grow { flex: 1; }
.chip {
  font-size: 12px; color: var(--muted); background: var(--surface-2);
  border: 1px solid var(--border); padding: 4px 10px; border-radius: 999px; margin-left: auto;
}
.hint { font-size: 13px; color: var(--muted); line-height: 1.7; }

/* ============ 今天页布局 ============ */
.today-grid { display: grid; grid-template-columns: minmax(0, 1fr) 320px; gap: 18px; align-items: start; }
.col-side { display: flex; flex-direction: column; gap: 18px; }

.hero { display: flex; justify-content: space-between; gap: 24px; align-items: center; flex-wrap: wrap; }
.hero-left { flex: 1; min-width: 260px; }
.date-nav { display: flex; align-items: center; gap: 12px; }
.date-title { display: flex; flex-direction: column; }
.date-title strong { font-size: 17px; }
.date-title span { font-size: 12px; color: var(--muted); margin-top: 2px; }
.hero-stats { display: flex; gap: 26px; margin-top: 18px; flex-wrap: wrap; }
.hstat { display: flex; flex-direction: column; }
.hstat-num { font-size: 24px; font-weight: 800; letter-spacing: .5px; }
.hstat-label { font-size: 12px; color: var(--muted); margin-top: 2px; }

/* 顶部社交统计（昵称下方 / 标签栏上方） */
.social-bar { max-width: 1240px; margin: 10px auto 0; padding: 0 28px; }
.social-row { display: grid; grid-template-columns: repeat(3, 1fr); gap: 10px; }
.social-cell {
  background: color-mix(in srgb, var(--surface-2) 75%, transparent);
  border: 1px solid var(--border); border-radius: 12px; padding: 10px 4px;
  text-align: center; cursor: pointer; transition: var(--t);
}
.social-cell:hover { border-color: var(--accent); transform: translateY(-1px); }
.social-num { display: block; font-size: 17px; font-weight: 800; line-height: 1.2; }
.social-label { font-size: 11px; color: var(--muted); }
.social-hint { font-size: 12px; color: var(--muted); margin-top: 8px; }
.hero-tip {
  margin-top: 16px; font-size: 13px; color: var(--muted); background: var(--surface-2);
  border: 1px solid var(--border); border-radius: var(--radius-sm); padding: 10px 14px; display: inline-block;
}
.hero-right { display: grid; place-items: center; }
.ring { position: relative; width: 150px; height: 150px; }
.ring svg { width: 100%; height: 100%; transform: rotate(-90deg); }
.ring-bg { fill: none; stroke: var(--cell-empty); stroke-width: 12; }
.ring-fg {
  fill: none; stroke: var(--accent); stroke-width: 12; stroke-linecap: round;
  stroke-dasharray: 327; stroke-dashoffset: 327; transition: stroke-dashoffset .6s cubic-bezier(.4, 0, .2, 1);
}
.ring-text { position: absolute; inset: 0; display: grid; place-content: center; text-align: center; }
.ring-text strong { font-size: 26px; font-weight: 800; display: block; }
.ring-text span { font-size: 12px; color: var(--muted); }

/* ============ 清单 ============ */
.section-head { display: flex; align-items: center; justify-content: space-between; gap: 14px; margin: 22px 0 12px; flex-wrap: wrap; }
.section-head h2 { font-size: 17px; }
.count-pill { font-size: 12px; color: var(--muted); background: var(--surface-2); border: 1px solid var(--border); padding: 2px 8px; border-radius: 999px; margin-left: 8px; }
.head-actions { display: flex; align-items: center; gap: 12px; }
.filters { display: flex; gap: 6px; flex-wrap: wrap; }
.chip-btn {
  border: 1px solid var(--border); background: var(--surface); color: var(--muted);
  border-radius: 999px; padding: 6px 12px; font-size: 12px; transition: var(--t);
}
.chip-btn:hover { color: var(--text); }
.chip-btn.active { background: color-mix(in srgb, var(--accent) 18%, transparent); border-color: var(--accent); color: var(--text); }

.task-list { display: flex; flex-direction: column; gap: 10px; }
.task-item {
  display: flex; align-items: center; gap: 14px; padding: 14px 16px; border-radius: var(--radius);
  background: var(--surface); border: 1px solid var(--border); transition: var(--t); position: relative; overflow: hidden;
}
.task-item::before {
  content: ""; position: absolute; left: 0; top: 0; bottom: 0; width: 3px; background: var(--tcolor, var(--accent)); opacity: .85;
}
.task-item:hover { transform: translateY(-1px); border-color: color-mix(in srgb, var(--accent) 45%, var(--border)); }
.task-item.done { background: color-mix(in srgb, var(--success) 10%, var(--surface)); }
.task-item.done .t-name { text-decoration: line-through; color: var(--muted); }
.task-item.missed .t-name { color: var(--muted); }

.check {
  width: 30px; height: 30px; border-radius: 50%; border: 2px solid var(--border); background: transparent;
  display: grid; place-items: center; color: transparent; font-size: 15px; flex: none; transition: var(--t);
}
.check:hover { border-color: var(--success); transform: scale(1.06); }
.task-item.done .check { background: var(--success); border-color: var(--success); color: #fff; }

.t-emoji { font-size: 22px; flex: none; width: 34px; text-align: center; }
.t-main { flex: 1; min-width: 0; }
.t-name { font-size: 15px; font-weight: 600; }
.t-meta { font-size: 12px; color: var(--muted); margin-top: 3px; display: flex; gap: 10px; flex-wrap: wrap; align-items: center; }
.t-status { font-size: 12px; color: var(--muted); margin-top: 4px; }
.task-item.done .t-status { color: var(--success); }
.t-meta .streak { color: var(--warn); }
.t-actions { display: flex; align-items: center; gap: 6px; flex: none; }
.mini-btn {
  width: 30px; height: 30px; border-radius: 9px; border: 1px solid var(--border); background: var(--surface-2);
  color: var(--muted); display: grid; place-items: center; font-size: 14px; transition: var(--t);
}
.mini-btn:hover { color: var(--text); background: var(--surface); border-color: var(--accent); }
.counter { display: flex; align-items: center; gap: 6px; }
.counter .val { font-size: 15px; font-weight: 700; min-width: 58px; text-align: center; font-variant-numeric: tabular-nums; }

.empty { text-align: center; padding: 46px 20px; color: var(--muted); }
.empty-emoji { font-size: 40px; margin-bottom: 12px; }
.empty p { margin-bottom: 16px; font-size: 14px; }

/* 心情 & 番茄钟 */
.mood-row { display: flex; gap: 8px; justify-content: space-between; }
.mood-btn { flex: 1; border: 1px solid var(--border); background: var(--surface-2); border-radius: 12px; padding: 10px 0; font-size: 20px; transition: var(--t); }
.mood-btn:hover { transform: translateY(-2px); }
.mood-btn.active { background: color-mix(in srgb, var(--accent) 20%, transparent); border-color: var(--accent); }

.focus { text-align: center; }
.focus-time { font-size: 40px; font-weight: 800; font-variant-numeric: tabular-nums; letter-spacing: 1px; margin: 6px 0 14px; }
.focus-actions { display: flex; gap: 8px; justify-content: center; margin-bottom: 12px; }
.focus-modes { display: flex; gap: 6px; justify-content: center; }

.week-bars { display: flex; align-items: flex-end; gap: 8px; height: 120px; }
.wb { flex: 1; display: flex; flex-direction: column; align-items: center; gap: 6px; }
.wb-bar { width: 100%; border-radius: 8px; background: var(--cell-empty); position: relative; height: 84px; overflow: hidden; }
.wb-fill { position: absolute; bottom: 0; left: 0; right: 0; background: linear-gradient(180deg, var(--accent), var(--accent-2)); border-radius: 8px; transition: height .5s ease; }
.wb span { font-size: 11px; color: var(--muted); }
.wb.today span { color: var(--accent); font-weight: 700; }

.badge-row { display: flex; flex-wrap: wrap; gap: 10px; }
.badge {
  display: flex; align-items: center; gap: 8px; padding: 8px 12px; border-radius: 12px; font-size: 13px;
  background: var(--surface-2); border: 1px solid var(--border); color: var(--muted);
}
.badge.unlocked { color: var(--text); border-color: color-mix(in srgb, var(--warn) 60%, var(--border)); background: color-mix(in srgb, var(--warn) 14%, transparent); }
.badge i { font-style: normal; font-size: 18px; }
.badge-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(210px, 1fr)); gap: 12px; }
.badge-card {
  display: flex; gap: 12px; align-items: center; padding: 14px; border-radius: var(--radius);
  border: 1px solid var(--border); background: var(--surface-2); opacity: .5;
}
.badge-card.unlocked { opacity: 1; border-color: color-mix(in srgb, var(--warn) 55%, var(--border)); background: color-mix(in srgb, var(--warn) 12%, transparent); }
.badge-card .bi { font-size: 26px; }
.badge-card b { font-size: 14px; display: block; }
.badge-card small { color: var(--muted); font-size: 12px; }

/* ============ 日历 ============ */
.calendar-head { flex-wrap: wrap; row-gap: 8px; }
.calendar-head h3 { font-size: 16px; margin: 0 6px; white-space: nowrap; }
.legend { font-size: 12px; color: var(--muted); display: flex; align-items: center; gap: 6px; margin-left: auto; white-space: nowrap; }
.legend .dot { width: 10px; height: 10px; border-radius: 3px; display: inline-block; margin-left: 8px; }
.dot.l0 { background: var(--cell-empty); }
.dot.l1 { background: color-mix(in srgb, var(--accent) 45%, var(--cell-empty)); }
.dot.l2 { background: var(--success); }

/* ============ 设置面板（外观自定义） ============ */
.settings-sec { font-size: 12px; color: var(--muted); margin: 16px 0 8px; letter-spacing: 1px; }
.swatch-row { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.swatch {
  width: 32px; height: 32px; border-radius: 10px; border: 2px solid var(--border);
  padding: 0; transition: var(--t); flex: none;
}
.swatch.on { border-color: var(--text); box-shadow: 0 0 0 2px color-mix(in srgb, var(--text) 25%, transparent); }
.swatch.custom { -webkit-appearance: none; appearance: none; background: conic-gradient(#ef4444, #f59e0b, #22c55e, #22d3ee, #6366f1, #ec4899, #ef4444); cursor: pointer; }
input.swatch.custom::-webkit-color-swatch-wrapper { padding: 2px; }
input.swatch.custom::-webkit-color-swatch { border: none; border-radius: 6px; opacity: .9; }
input.swatch.custom { border-radius: 10px; }
.swatch.wide { width: 56px; height: 36px; }
.swatch-btn {
  padding: 9px 16px; border-radius: 10px; border: 1px solid var(--border);
  background: var(--surface-2); color: var(--text); font-size: 14px; transition: var(--t);
}
.swatch-btn.on { border-color: var(--accent); color: var(--accent); background: color-mix(in srgb, var(--accent) 12%, var(--surface-2)); }

/* ============ 个人信息面板 ============ */
.profile-account {
  display: flex; align-items: center; gap: 12px; margin-top: 12px;
  padding: 12px; border-radius: 12px; background: var(--surface-2); border: 1px solid var(--border);
}
.pa-avatar { width: 44px; height: 44px; border-radius: 12px; display: grid; place-items: center; font-size: 22px;
  background: linear-gradient(135deg, var(--accent), var(--accent-2)); flex: none; }
.pa-name { font-size: 15px; font-weight: 700; word-break: break-all; }
.pa-sub { font-size: 12px; color: var(--muted); margin-top: 2px; }
.profile-input {
  width: 84px; padding: 9px 10px; border-radius: 10px; border: 1px solid var(--border);
  background: var(--surface-2); color: var(--text); font-size: 14px;
}

/* ============ 守则型任务 ============ */
.task-item.rule { border-left: 3px solid color-mix(in srgb, var(--tcolor) 70%, transparent); }
/* 任务正文 / 备注：多行内容原样换行显示（清单与详情弹窗共用） */
.rule-body {
  margin-top: 6px; font-size: 13px; color: var(--muted); line-height: 1.65;
  white-space: pre-wrap; word-break: break-word; overflow-wrap: anywhere;
  padding: 6px 10px; border-left: 2px solid color-mix(in srgb, var(--tcolor, var(--accent)) 45%, transparent);
  background: color-mix(in srgb, var(--tcolor, var(--accent)) 6%, transparent); border-radius: 0 8px 8px 0;
}
.rule-tag { color: var(--accent); font-size: 12px; }

/* ============ 任务详情 ============ */
.detail-tags { display: flex; gap: 6px; flex-wrap: wrap; margin-top: 8px; }
.tag.warn { color: var(--warn); border-color: color-mix(in srgb, var(--warn) 45%, transparent); }
.detail-info { display: grid; grid-template-columns: repeat(2, 1fr); gap: 8px 12px; grid-column: 1 / -1; margin-bottom: 6px; }
.detail-info div { display: flex; justify-content: space-between; font-size: 13px; padding: 7px 10px; background: var(--surface-2); border-radius: 8px; }
.detail-info label { color: var(--muted); }
.detail-kpi { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; margin-top: 10px; }
.detail-kpi div { text-align: center; padding: 10px 6px; background: var(--surface-2); border-radius: 10px; }
.detail-kpi b { display: block; font-size: 18px; color: var(--accent); }
.detail-kpi span { font-size: 12px; color: var(--muted); }
/* 无法完成备案 */
.tag.exc { color: var(--warn); border-color: color-mix(in srgb, var(--warn) 45%, transparent); }
.task-item.excused { opacity: .92; border-left: 3px solid color-mix(in srgb, var(--warn) 55%, transparent); }
.exc-body {
  margin-top: 4px; font-size: 12px; line-height: 1.6; white-space: pre-wrap; word-break: break-word;
  color: var(--muted); padding: 5px 9px; border-left: 2px solid color-mix(in srgb, var(--warn) 55%, transparent);
  background: color-mix(in srgb, var(--warn) 8%, transparent); border-radius: 0 8px 8px 0;
}
.exc-row { margin: 6px 0 10px; }
.exc-row .exc-date { font-size: 12px; color: var(--muted); margin-right: 8px; }
.dots i.exc { background: var(--warn); }

.detail-week { display: grid; grid-template-columns: repeat(7, 1fr); gap: 6px; margin-top: 6px; }
.dw-cell { text-align: center; padding: 6px 2px; border-radius: 8px; background: var(--cell-empty); font-size: 11px; color: var(--muted); }
.dw-cell.half { background: color-mix(in srgb, var(--accent) 40%, var(--cell-empty)); color: var(--text); }
.dw-cell.on { background: var(--success); color: #fff; }
.dw-date { display: block; }
.dw-val { display: block; font-weight: 700; }

/* ============ 共享与指派 ============ */
.share-row { display: flex; align-items: center; gap: 10px; padding: 8px 0; border-bottom: 1px dashed var(--border); flex-wrap: wrap; }
.share-row .ghost-btn { padding: 6px 12px; font-size: 13px; }
.sr-emoji { font-size: 20px; flex: none; width: 32px; height: 32px; display: grid; place-items: center; border-radius: 50%; }
.sr-main { flex: 1 1 auto; min-width: 120px; }
.sr-name { font-size: 14px; font-weight: 600; word-break: break-all; }
.sr-sub { font-size: 12px; color: var(--muted); margin-top: 2px; }

.cal-week { display: grid; grid-template-columns: repeat(7, 1fr); gap: 8px; margin-bottom: 8px; }
.cal-week div { text-align: center; font-size: 12px; color: var(--muted); padding: 4px 0; }
.cal-grid { display: grid; grid-template-columns: repeat(7, 1fr); gap: 8px; }
.cal-cell {
  min-height: 84px; border-radius: 12px; border: 1px solid var(--border); background: var(--surface-2);
  padding: 8px; cursor: pointer; transition: var(--t); display: flex; flex-direction: column; gap: 6px;
}
.cal-cell:hover { border-color: var(--accent); transform: translateY(-1px); }
.cal-cell.other { opacity: .35; }
.cal-cell.today { border-color: var(--accent); box-shadow: 0 0 0 1px var(--accent) inset; }
.cal-cell.selected { background: color-mix(in srgb, var(--accent) 16%, var(--surface)); }
.cal-cell .dnum { font-size: 13px; font-weight: 700; }
.cal-cell .dnum.weekend { color: var(--muted); }
.cal-cell .dots { display: flex; flex-wrap: wrap; gap: 3px; margin-top: auto; }
.cal-cell .dots i { width: 7px; height: 7px; border-radius: 50%; background: var(--cell-empty); }
.cal-cell .dots i.ok { background: var(--success); }
.cal-cell .drate { font-size: 11px; color: var(--muted); }

/* ============ 任务管理 ============ */
.manage-list { display: flex; flex-direction: column; gap: 12px; }
.manage-item {
  display: flex; gap: 14px; align-items: center; padding: 16px; border-radius: var(--radius);
  background: var(--surface); border: 1px solid var(--border); transition: var(--t);
}
.manage-item:hover { border-color: color-mix(in srgb, var(--accent) 40%, var(--border)); }
.manage-item.archived { opacity: .55; }
.mi-emoji {
  width: 44px; height: 44px; border-radius: 14px; display: grid; place-items: center; font-size: 22px; flex: none;
  background: color-mix(in srgb, var(--tcolor, var(--accent)) 18%, var(--surface-2));
}
.mi-main { flex: 1; min-width: 0; }
.mi-main .mi-name { font-size: 15px; font-weight: 700; display: flex; align-items: center; gap: 8px; }
.mi-meta { font-size: 12px; color: var(--muted); margin-top: 4px; display: flex; gap: 12px; flex-wrap: wrap; }
.tag { font-size: 11px; padding: 2px 8px; border-radius: 999px; background: var(--surface-2); border: 1px solid var(--border); color: var(--muted); }
.mi-actions { display: flex; gap: 6px; flex: none; }
.switch { display: flex; align-items: center; gap: 6px; font-size: 13px; color: var(--muted); cursor: pointer; }
.row-actions { display: flex; gap: 8px; flex-wrap: wrap; margin-top: 12px; }

/* ============ 报表 ============ */
.kpi-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(190px, 1fr)); gap: 14px; margin-bottom: 18px; }
.kpi {
  background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); padding: 18px;
  box-shadow: var(--shadow); position: relative; overflow: hidden;
}
.kpi::after {
  content: ""; position: absolute; right: -30px; top: -30px; width: 100px; height: 100px; border-radius: 50%;
  background: color-mix(in srgb, var(--accent) 14%, transparent);
}
.kpi .k-label { font-size: 12px; color: var(--muted); }
.kpi .k-value { font-size: 28px; font-weight: 800; margin-top: 6px; font-variant-numeric: tabular-nums; }
.kpi .k-sub { font-size: 12px; color: var(--muted); margin-top: 4px; }

.heat-wrap { overflow-x: auto; padding-bottom: 6px; }
.heat-body { display: flex; gap: 6px; }
.heat-dows { display: grid; grid-template-rows: repeat(7, 15px); gap: 4px; font-size: 10px; color: var(--muted); }
.heat-dows span { line-height: 15px; }
.heat-months { display: flex; gap: 4px; margin-left: 22px; margin-bottom: 6px; font-size: 10px; color: var(--muted); }
.heat-grid { display: grid; grid-auto-flow: column; grid-template-rows: repeat(7, 15px); gap: 4px; }
.cell { width: 15px; height: 15px; border-radius: 4px; background: var(--cell-empty); cursor: pointer; transition: var(--t); }
.cell:hover { outline: 1px solid var(--accent); }
.c0 { background: var(--cell-empty); }
.c1 { background: color-mix(in srgb, var(--success) 28%, var(--cell-empty)); }
.c2 { background: color-mix(in srgb, var(--success) 55%, var(--cell-empty)); }
.c3 { background: color-mix(in srgb, var(--success) 78%, var(--cell-empty)); }
.c4 { background: var(--success); }
.heat-legend { display: flex; align-items: center; gap: 4px; font-size: 11px; color: var(--muted); margin-top: 10px; justify-content: flex-end; }
.heat-legend span:first-child { margin-right: 4px; }
.heat-legend span:last-child { margin-left: 4px; }

.report-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 18px; }
.trend { height: 190px; display: flex; align-items: flex-end; gap: 4px; position: relative; }
.trend .bar {
  flex: 1; background: linear-gradient(180deg, var(--accent), var(--accent-2)); border-radius: 4px 4px 2px 2px;
  min-height: 2px; transition: var(--t); position: relative;
}
.trend .bar:hover { filter: brightness(1.2); }
.trend .bar::after {
  content: attr(data-tip); position: absolute; bottom: calc(100% + 6px); left: 50%; transform: translateX(-50%);
  background: var(--surface-2); border: 1px solid var(--border); color: var(--text); font-size: 11px;
  padding: 4px 8px; border-radius: 8px; white-space: nowrap; opacity: 0; pointer-events: none; transition: var(--t); z-index: 5;
}
.trend .bar:hover::after { opacity: 1; }
.trend .zero { background: var(--cell-empty); }
.trend-axis { display: flex; justify-content: space-between; font-size: 11px; color: var(--muted); margin-top: 8px; }

.table-wrap { overflow-x: auto; }
.rank-table { width: 100%; border-collapse: collapse; font-size: 14px; }
.rank-table th {
  text-align: left; font-size: 12px; color: var(--muted); font-weight: 600; padding: 8px 10px;
  border-bottom: 1px solid var(--border); white-space: nowrap;
}
.rank-table td { padding: 12px 10px; border-bottom: 1px solid var(--border); white-space: nowrap; }
.rank-table tr:last-child td { border-bottom: none; }
.rank-table .prog { display: flex; align-items: center; gap: 8px; min-width: 140px; }
.rank-table .prog .track { flex: 1; height: 8px; border-radius: 6px; background: var(--cell-empty); overflow: hidden; }
.rank-table .prog .fill { height: 100%; border-radius: 6px; background: linear-gradient(90deg, var(--accent), var(--accent-2)); }

/* ============ 模态框 ============ */
.modal-mask {
  position: fixed; inset: 0; background: rgba(6, 10, 18, .6); backdrop-filter: blur(4px);
  display: grid; place-items: center; padding: 20px; z-index: 100; animation: fade .18s ease;
}
.modal {
  width: 100%; max-width: 560px; max-height: 88vh; overflow: auto; background: var(--surface);
  border: 1px solid var(--border); border-radius: 20px; box-shadow: var(--shadow); padding: 24px;
}
.modal-head { display: flex; align-items: center; justify-content: space-between; margin-bottom: 18px; }
.modal-head h3 { font-size: 17px; }
.form-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; }
.field { display: flex; flex-direction: column; gap: 6px; }
.field.full { grid-column: 1 / -1; }
.field label { font-size: 12px; color: var(--muted); font-weight: 600; }
.field input, .field select, .field textarea {
  background: var(--surface-2); border: 1px solid var(--border); color: var(--text);
  border-radius: 12px; padding: 10px 12px; font-size: 14px; font-family: inherit; width: 100%;
}
.field input:focus, .field select:focus, .field textarea:focus { outline: none; border-color: var(--accent); }
.field textarea { resize: vertical; min-height: 60px; }

/* 用户模糊搜索下拉框（指派 / 分享） */
.ac-box {
  position: absolute; left: 0; right: 0; top: calc(100% + 4px); z-index: 60;
  background: var(--surface); border: 1px solid var(--border); border-radius: 12px;
  box-shadow: var(--shadow); max-height: 224px; overflow-y: auto; padding: 4px;
}
.ac-item { display: flex; align-items: baseline; gap: 8px; padding: 9px 10px; border-radius: 8px; cursor: pointer; }
.ac-item:hover, .ac-item.active { background: var(--surface-2); }
.ac-name { font-size: 14px; font-weight: 600; }
.ac-sub { font-size: 12px; color: var(--muted); }
.ac-empty { padding: 10px; color: var(--muted); font-size: 13px; }
.ac-av {
  width: 26px; height: 26px; border-radius: 50%; flex: none; display: grid; place-items: center;
  font-size: 14px; background: var(--surface-2); border: 1px solid var(--border);
}
.ac-rel {
  margin-left: auto; font-size: 11px; padding: 2px 7px; border-radius: 999px;
  background: color-mix(in srgb, var(--accent) 18%, transparent); color: var(--accent); flex: none;
}
.emoji-picker { display: flex; flex-wrap: wrap; gap: 6px; }
.emoji-picker button { width: 34px; height: 34px; border-radius: 10px; border: 1px solid var(--border); background: var(--surface-2); font-size: 18px; }
.emoji-picker button.active { border-color: var(--accent); background: color-mix(in srgb, var(--accent) 20%, transparent); }
.color-picker { display: flex; gap: 8px; flex-wrap: wrap; }
.color-picker button { width: 26px; height: 26px; border-radius: 50%; border: 2px solid transparent; }
.color-picker button.active { border-color: var(--text); transform: scale(1.1); }
.week-picker { display: flex; gap: 6px; }
.week-picker button { flex: 1; padding: 8px 0; border-radius: 10px; border: 1px solid var(--border); background: var(--surface-2); color: var(--muted); font-size: 12px; }
.week-picker button.active { background: color-mix(in srgb, var(--accent) 20%, transparent); border-color: var(--accent); color: var(--text); }
.date-picker { display: flex; flex-wrap: wrap; gap: 5px; max-height: 128px; overflow: auto; }
.date-picker button { width: 34px; height: 30px; border-radius: 8px; border: 1px solid var(--border); background: var(--surface-2); color: var(--muted); font-size: 12px; }
.date-picker button.active { background: color-mix(in srgb, var(--accent) 20%, transparent); border-color: var(--accent); color: var(--text); }
.modal-foot { display: flex; justify-content: flex-end; gap: 10px; margin-top: 20px; }

/* 弹窗右上角 ✕ */
.modal-head { position: relative; }
.modal-x {
  position: absolute; right: 0; top: 50%; transform: translateY(-50%);
  width: 30px; height: 30px; border-radius: 50%; padding: 0; line-height: 1;
  border: 1px solid var(--border); background: var(--surface-2); color: var(--muted); font-size: 14px;
  transition: var(--t);
}
.modal-x:hover { color: var(--text); border-color: var(--accent); }

/* 头像为图片时的统一裁剪 */
.avatar-img { width: 100%; height: 100%; border-radius: 50%; object-fit: cover; display: block; }
.pa-avatar, .acct-avatar, .sr-emoji, .ac-av { overflow: hidden; }

/* ============ 初次使用指引 ============ */
.guide-modal { text-align: center; }
.guide-head { display: flex; justify-content: center; margin-bottom: 6px; }
.guide-icon {
  width: 72px; height: 72px; border-radius: 20px; display: grid; place-items: center;
  font-size: 38px; background: linear-gradient(135deg, var(--accent), var(--accent-2)); box-shadow: var(--shadow);
}
.guide-title { font-size: 19px; margin: 10px 0 8px; }
.guide-desc { color: var(--muted); line-height: 1.75; font-size: 14px; min-height: 84px; }
.guide-dots { display: flex; justify-content: center; gap: 7px; margin: 6px 0 4px; }
.guide-dot { width: 7px; height: 7px; border-radius: 50%; background: var(--border); transition: var(--t); }
.guide-dot.active { width: 20px; border-radius: 4px; background: var(--accent); }
.guide-foot { justify-content: space-between; align-items: center; margin-top: 16px; }
.guide-foot .guide-right { display: flex; gap: 10px; }

/* ============ 打卡动态（首页消息） ============ */
.feed-card .card-head { margin-bottom: 6px; }
.feed-list { display: flex; flex-direction: column; gap: 2px; }
.feed-item {
  display: flex; align-items: center; gap: 12px;
  padding: 12px 4px; border-bottom: 1rpx dashed var(--border);
}
.feed-item:last-child { border-bottom: none; }
.feed-emoji {
  width: 44px; height: 44px; border-radius: 12px; flex: none;
  background: var(--field); display: grid; place-items: center; font-size: 22px;
}
.feed-body { flex: 1; min-width: 0; }
.feed-line { font-size: 14px; line-height: 1.5; }
.feed-line b { font-weight: 700; }
.feed-time { font-size: 12px; color: var(--muted); margin-top: 2px; }
.feed-item { cursor: pointer; transition: background var(--t); }
.feed-item:hover { background: var(--field); border-radius: 10px; }
.feed-item.self { background: color-mix(in srgb, var(--accent) 7%, transparent); border-radius: 10px; }

/* 状态徽标 */
.fbadge {
  display: inline-block; font-size: 11px; line-height: 1; padding: 3px 7px; border-radius: 999px;
  background: var(--field); color: var(--muted); margin-right: 4px; vertical-align: middle;
}
.fbadge.ok { background: color-mix(in srgb, var(--success) 18%, transparent); color: var(--success); }
.fbadge.warn { background: color-mix(in srgb, var(--warn) 18%, transparent); color: var(--warn); }
.fbadge.sum { background: color-mix(in srgb, var(--accent) 18%, transparent); color: var(--accent); }

/* 卡片头右侧操作区 */
.feed-card .hd-right { display: flex; align-items: center; gap: 10px; margin-left: auto; }
.more {
  padding: 4px 12px; border-radius: 999px; font-size: 12px; cursor: pointer;
  border: 1px solid color-mix(in srgb, var(--accent) 45%, transparent);
  background: color-mix(in srgb, var(--accent) 10%, transparent); color: var(--accent);
}
.more:hover { background: color-mix(in srgb, var(--accent) 18%, transparent); }

/* 每日汇总卡片 */
.summary-card {
  background: linear-gradient(135deg, color-mix(in srgb, var(--accent) 12%, var(--surface)), var(--surface));
  border: 1px solid color-mix(in srgb, var(--accent) 30%, var(--border));
  border-radius: 14px; padding: 12px 14px; margin-bottom: 10px;
}
.sum-head { font-size: 15px; font-weight: 800; }
.sum-sub { font-size: 12px; color: var(--muted); margin-top: 4px; }
.sum-items { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 8px; }
.sum-item {
  font-size: 11px; padding: 3px 8px; border-radius: 999px; background: var(--surface-2);
  border: 1px solid var(--border);
}
.sum-item.ok { color: var(--success); border-color: color-mix(in srgb, var(--success) 40%, transparent); }
.sum-item.warn { color: var(--warn); border-color: color-mix(in srgb, var(--warn) 40%, transparent); }
.sum-item.pending { color: var(--muted); }

/* 动态详情 */
.kv { display: flex; flex-direction: column; gap: 8px; }
.kv-row { display: flex; gap: 12px; font-size: 14px; }
.kv-row .k { width: 64px; color: var(--muted); flex: none; }
.kv-row .v { flex: 1; word-break: break-word; }
.sum-detail { display: flex; flex-direction: column; gap: 6px; }
.sum-row {
  display: flex; justify-content: space-between; align-items: center; gap: 10px;
  padding: 9px 12px; border-radius: 10px; background: var(--field); font-size: 14px;
}
.sum-row.ok { background: color-mix(in srgb, var(--success) 12%, var(--field)); color: var(--success); }
.sum-row.warn { background: color-mix(in srgb, var(--warn) 12%, var(--field)); color: var(--warn); }
.sum-row.pending { color: var(--muted); }

.toast {
  position: fixed; left: 50%; bottom: 40px; transform: translate(-50%, 20px);
  background: var(--surface); border: 1px solid var(--border); color: var(--text);
  padding: 12px 20px; border-radius: 14px; box-shadow: var(--shadow); font-size: 14px;
  opacity: 0; pointer-events: none; transition: var(--t); z-index: 200;
}
.toast.show { opacity: 1; transform: translate(-50%, 0); }

/* ============ 响应式 ============ */
@media (max-width: 980px) {
  .today-grid { grid-template-columns: 1fr; }
  .report-grid { grid-template-columns: 1fr; }
}
@media (max-width: 640px) {
  .topbar { padding: 16px 16px 4px; }
  .social-bar { padding: 0 16px; }
  .tabs { padding: 0 16px; }
  .container { padding: 18px 16px 50px; }
  .form-grid { grid-template-columns: 1fr; }
  .hero-stats { gap: 18px; }
  .ring { width: 120px; height: 120px; }
  .cal-cell { min-height: 62px; padding: 6px; }
  .cal-cell .dots i { width: 5px; height: 5px; }
  .manage-item { flex-wrap: wrap; }

  /* 手机端进一步适配（微信 / 移动浏览器） */
  html, body { -webkit-text-size-adjust: 100%; touch-action: manipulation; }
  :root { -webkit-tap-highlight-color: transparent; }
  body { padding-bottom: env(safe-area-inset-bottom); -webkit-user-select: none; user-select: none; }
  input, textarea, .t-name, .mi-name, .hint, .modal p, .badge small, .mi-meta { -webkit-user-select: text; user-select: text; }

  .topbar { padding: 12px 14px 6px; }
  .brand-text h1 { font-size: 17px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
  .logo { width: 40px; height: 40px; font-size: 20px; border-radius: 12px; }
  .top-actions .ghost-btn { padding: 7px 10px; font-size: 13px; }
  .top-actions .icon-btn { width: 34px; height: 34px; }

  .tabs { overflow-x: auto; -webkit-overflow-scrolling: touch; scrollbar-width: none; }
  .tabs::-webkit-scrollbar { display: none; }
  .tab { white-space: nowrap; padding: 12px 14px; }
  .container { padding: 14px 12px 60px; }

  .kpi-grid { grid-template-columns: 1fr 1fr; gap: 10px; }
  .kpi { padding: 14px; }
  .kpi .k-value { font-size: 22px; }
  .report-grid { gap: 12px; }

  .task-item { padding: 12px; gap: 11px; }
  .check { width: 34px; height: 34px; }
  .t-emoji { width: 30px; font-size: 20px; }
  .mini-btn { width: 34px; height: 34px; }
  .primary-btn, .ghost-btn, .danger-btn { min-height: 40px; }

  .mood-btn { padding: 12px 0; font-size: 22px; }
  .cal-cell { min-height: 56px; padding: 5px; }
  .cal-cell .dnum { font-size: 12px; }
  .cal-grid, .cal-week { gap: 5px; }

  /* 日历头窄屏重排：第一行 标题+翻月，第二行 图例居中 */
  .calendar-head h3 { flex: 1 1 auto; text-align: center; overflow: hidden; text-overflow: ellipsis; }
  .calendar-head .legend { order: 10; flex: 1 1 100%; justify-content: center; margin-left: 0; }
  .calendar-head .text-btn { flex: none; }

  .modal { padding: 18px; border-radius: 18px; max-height: 92vh; }
  .modal-foot .primary-btn, .modal-foot .ghost-btn { flex: 1; }

  .heat-grid .cell { width: 13px; height: 13px; }
  .heat-dows span { font-size: 9px; }
  .heat-grid { grid-template-rows: repeat(7, 13px); gap: 3px; }

  /* ---- 防止文字被压成竖排 ---- */
  .brand { flex: 1 1 auto; min-width: 0; }
  .brand-text { min-width: 0; overflow: hidden; }
  .acct-chip { max-width: 56vw; padding: 4px 10px 4px 4px; }
  .acct-avatar { width: 32px; height: 32px; font-size: 18px; }
  .brand-text p { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
  .top-actions { flex: none; }
  .ghost-btn, .text-btn, .primary-btn, .danger-btn, .chip-btn, .tab { white-space: nowrap; flex: none; }
  .head-actions { flex-wrap: wrap; }

  /* 今日任务项：窄屏重排 —— 文本区保底宽度，操作区换行到下一行 */
  .task-item { flex-wrap: wrap; }
  .t-main { flex: 1 1 auto; min-width: 150px; }
  .t-name, .mi-name { overflow-wrap: anywhere; }
  .t-actions { margin-left: auto; }

  /* 任务管理项：操作按钮独立成行 */
  .mi-main { flex: 1 1 auto; min-width: 150px; }
  .mi-name > span:first-child { flex: 1; min-width: 0; }
  .mi-name .tag { flex: none; white-space: nowrap; }
  .mi-actions { flex: 1 1 100%; justify-content: flex-end; margin-top: 4px; padding-top: 10px; border-top: 1px dashed var(--border); }

  /* 报表表格与排行在窄屏可横向滑动 */
  .table-wrap { overflow-x: auto; -webkit-overflow-scrolling: touch; }
}
