/* ============ 日月计划 · 主题变量 ============ */
:root {
  --bg: #f7f3ec;
  --bg-soft: #f1ebdf;
  --card: #ffffff;
  --card-2: #faf7f0;
  --ink: #2d2a26;
  --ink-2: #6f6a61;
  --ink-3: #a39c8f;
  --line: #e9e2d4;
  --sun: #e8853d;
  --sun-deep: #d96f26;
  --sun-soft: #fdeedd;
  --moon: #6c63ff;
  --moon-soft: #ebeaff;
  --green: #3d9e70;
  --green-soft: #e2f3ea;
  --red: #d9534f;
  --red-soft: #fbe7e6;
  --blue: #3d8bc9;
  --shadow: 0 2px 10px rgba(90, 72, 45, .07), 0 10px 30px rgba(90, 72, 45, .06);
  --radius: 18px;
}

html[data-theme="dark"] {
  --bg: #14161f;
  --bg-soft: #191c28;
  --card: #1f2331;
  --card-2: #262b3b;
  --ink: #eae7e1;
  --ink-2: #a9a49a;
  --ink-3: #6e6a62;
  --line: #2e3346;
  --sun: #f0a05c;
  --sun-deep: #f0a05c;
  --sun-soft: #3a2d1e;
  --moon: #8b85ff;
  --moon-soft: #292c4d;
  --green: #57bd8d;
  --green-soft: #1d3329;
  --red: #e06c68;
  --red-soft: #3a2222;
  --blue: #62a5da;
  --shadow: 0 2px 10px rgba(0, 0, 0, .3), 0 10px 30px rgba(0, 0, 0, .25);
}

/* ============ 基础 ============ */
* { margin: 0; padding: 0; box-sizing: border-box; -webkit-tap-highlight-color: transparent; }

html, body { height: 100%; }

body {
  font-family: -apple-system, BlinkMacSystemFont, "PingFang SC", "Hiragino Sans GB", "Microsoft YaHei", "Segoe UI", sans-serif;
  background: var(--bg);
  color: var(--ink);
  font-size: 15px;
  line-height: 1.55;
  transition: background .3s ease, color .3s ease;
}

button {
  font-family: inherit;
  font-size: inherit;
  color: inherit;
  background: none;
  border: none;
  cursor: pointer;
}

input, select { font-family: inherit; }

svg { display: block; }

#app {
  max-width: 520px;
  margin: 0 auto;
  min-height: 100dvh;
  display: flex;
  flex-direction: column;
  position: relative;
}

/* ============ 头部 ============ */
.app-header { padding: 18px 20px 6px; }

.header-top {
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.brand { display: flex; align-items: center; gap: 9px; }

.brand-logo { width: 34px; height: 34px; }
.brand-logo .logo-sun { color: var(--sun); }
.brand-logo .logo-moon { color: var(--moon); }

.brand h1 {
  font-size: 20px;
  font-weight: 700;
  letter-spacing: 2px;
}

.header-actions { display: flex; align-items: center; gap: 4px; position: relative; }

.icon-btn {
  width: 38px;
  height: 38px;
  border-radius: 12px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  color: var(--ink-2);
  transition: background .15s ease, color .15s ease;
}
.icon-btn:hover { background: var(--bg-soft); color: var(--ink); }
.icon-btn svg { width: 20px; height: 20px; }

.header-date { margin-top: 14px; }
.greeting { font-size: 22px; font-weight: 700; letter-spacing: 1px; }
.date-text { color: var(--ink-2); font-size: 13.5px; margin-top: 2px; font-variant-numeric: tabular-nums; }

/* 数据菜单 */
.menu-drop {
  position: absolute;
  top: 46px;
  right: 0;
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: 14px;
  box-shadow: var(--shadow);
  padding: 6px;
  min-width: 150px;
  display: none;
  z-index: 60;
}
.menu-drop.show { display: block; }
.menu-drop button {
  display: flex;
  align-items: center;
  gap: 9px;
  width: 100%;
  padding: 10px 12px;
  border-radius: 9px;
  font-size: 14px;
  color: var(--ink);
  text-align: left;
}
.menu-drop button:hover { background: var(--bg-soft); }
.menu-drop button.danger { color: var(--red); }
.menu-drop button svg { width: 17px; height: 17px; flex: none; }

/* ============ 主区域 ============ */
.app-main {
  flex: 1;
  padding: 10px 20px 110px;
}

.view { display: none; animation: fadeUp .25s ease; }
.view.active { display: block; }

@keyframes fadeUp {
  from { opacity: 0; transform: translateY(8px); }
  to { opacity: 1; transform: translateY(0); }
}

/* ============ 日期 / 月份导航 ============ */
.date-nav, .month-nav {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin: 6px 0 12px;
}

.cur-date, .cur-month {
  font-size: 17px;
  font-weight: 700;
  letter-spacing: .5px;
  text-align: center;
}
.cur-date span {
  display: block;
  font-size: 12px;
  font-weight: 400;
  color: var(--ink-2);
  margin-top: 1px;
}

.back-today {
  display: block;
  margin: -4px auto 12px;
  font-size: 12.5px;
  color: var(--sun-deep);
  background: var(--sun-soft);
  padding: 4px 14px;
  border-radius: 999px;
}

/* ============ 进度卡片 ============ */
.progress-card {
  background: var(--card);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 16px 18px;
  display: flex;
  align-items: center;
  gap: 16px;
  margin-bottom: 14px;
}

.ring-wrap { position: relative; width: 64px; height: 64px; flex: none; }
.ring { width: 64px; height: 64px; transform: rotate(-90deg); }
.ring circle { fill: none; stroke-width: 7; stroke-linecap: round; }
.ring-bg { stroke: var(--bg-soft); }
.ring-fg {
  stroke: var(--sun);
  stroke-dasharray: 188.5;
  stroke-dashoffset: 188.5;
  transition: stroke-dashoffset .5s ease, stroke .3s ease;
}
.ring-fg.all-done { stroke: var(--green); }
.ring-num {
  position: absolute;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 13.5px;
  font-weight: 700;
  font-variant-numeric: tabular-nums;
}

.progress-title { font-weight: 700; font-size: 15.5px; }
.progress-sub { color: var(--ink-2); font-size: 13px; margin-top: 2px; }

/* ============ 任务列表 ============ */
.task-list { display: flex; flex-direction: column; gap: 10px; }

.task {
  background: var(--card);
  border-radius: 15px;
  box-shadow: var(--shadow);
  padding: 13px 14px;
  display: flex;
  align-items: flex-start;
  gap: 11px;
  transition: opacity .2s ease;
}

.task .check {
  width: 24px;
  height: 24px;
  border-radius: 50%;
  border: 2px solid var(--ink-3);
  flex: none;
  margin-top: 1px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  color: #fff;
  transition: all .18s ease;
}
.task .check svg { width: 14px; height: 14px; opacity: 0; transform: scale(.5); transition: all .18s ease; }
.task .check:hover { border-color: var(--sun); }
.task.done .check { background: var(--green); border-color: var(--green); }
.task.done .check svg { opacity: 1; transform: scale(1); }

.task-body { flex: 1; min-width: 0; }
.task-title { font-weight: 600; font-size: 15px; word-break: break-word; transition: color .2s ease; }
.task.done .task-title { text-decoration: line-through; color: var(--ink-3); font-weight: 500; }
.task.done { opacity: .75; }

.task-meta {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 6px;
  margin-top: 5px;
}
.meta-time {
  font-size: 12px;
  color: var(--ink-2);
  font-variant-numeric: tabular-nums;
  background: var(--bg-soft);
  border-radius: 6px;
  padding: 1.5px 8px;
}
.badge { font-size: 11.5px; border-radius: 6px; padding: 1.5px 8px; font-weight: 600; }
.badge.p-high { color: var(--red); background: var(--red-soft); }
.badge.p-medium { color: var(--sun-deep); background: var(--sun-soft); }
.badge.p-low { color: var(--blue); background: rgba(61, 139, 201, .12); }
html[data-theme="dark"] .badge.p-low { background: rgba(98, 165, 218, .16); }

.meta-postponed {
  font-size: 10.5px;
  color: var(--red);
  background: var(--red-soft);
  border-radius: 7px;
  padding: 2.5px 7px;
  font-weight: 600;
  white-space: nowrap;
}

.meta-goal {
  font-size: 12px;
  color: var(--moon);
  background: var(--moon-soft);
  border-radius: 6px;
  padding: 1.5px 8px;
  max-width: 160px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.task .del {
  flex: none;
  width: 30px;
  height: 30px;
  border-radius: 9px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  color: var(--ink-3);
  opacity: 0;
  transition: all .15s ease;
}
.task:hover .del { opacity: 1; }
.task .del:hover { color: var(--red); background: var(--red-soft); }
.task .del svg { width: 16px; height: 16px; }
@media (hover: none) { .task .del { opacity: .6; } }

/* ============ 月历 ============ */
.cal-card {
  background: var(--card);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 14px 12px 16px;
}

.cal-weekdays {
  display: grid;
  grid-template-columns: repeat(7, 1fr);
  text-align: center;
  font-size: 12px;
  color: var(--ink-3);
  padding-bottom: 8px;
}
.cal-weekdays .weekend { color: var(--sun); }

.cal-grid {
  display: grid;
  grid-template-columns: repeat(7, 1fr);
  row-gap: 4px;
}

.cal-cell {
  min-height: 66px;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: flex-start;
  padding: 4px 2px 3px;
  border-radius: 12px;
  position: relative;
  transition: background .15s ease;
  overflow: hidden;
}
.cal-cell:not(.pad):hover { background: var(--bg-soft); }
.cal-cell.pad { pointer-events: none; min-height: 0; }
.cal-cell.is-sel { background: var(--sun-soft); }
.cal-cell.is-today { background: var(--sun-soft); box-shadow: inset 0 0 0 1.5px var(--sun); }
.cal-cell.done-all { background: var(--green-soft); }
.cal-cell.done-all.is-sel { background: var(--green-soft); box-shadow: inset 0 0 0 1.5px var(--green); }

.cal-day-num {
  font-size: 13.5px;
  font-variant-numeric: tabular-nums;
  width: 24px;
  height: 24px;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 50%;
  flex: none;
}
.cal-cell.weekend .cal-day-num { color: var(--sun-deep); }
.cal-cell.is-today .cal-day-num { background: var(--sun); color: #fff; font-weight: 700; }
.cal-cell.has-tasks .cal-day-num { font-weight: 600; }

.cal-today-tag {
  font-size: 8.5px;
  line-height: 1.2;
  color: var(--sun-deep);
  font-weight: 700;
  margin-top: 1px;
}

.cal-tasks {
  display: flex;
  flex-direction: column;
  gap: 2px;
  width: 100%;
  margin-top: 3px;
}
.cal-task {
  display: flex;
  align-items: center;
  gap: 3px;
  font-size: 9px;
  line-height: 1.35;
  color: var(--ink-2);
  min-width: 0;
}
.cal-task i {
  width: 4px;
  height: 4px;
  border-radius: 50%;
  flex: none;
}
.cal-task.p-high i { background: var(--red); }
.cal-task.p-medium i { background: var(--sun); }
.cal-task.p-low i { background: var(--blue); }
.cal-task b { font-weight: 600; flex: none; }
.cal-task u {
  text-decoration: none;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  min-width: 0;
}
.cal-task.done { opacity: .55; }
.cal-task.done u { text-decoration: line-through; }
.cal-more {
  font-size: 8.5px;
  color: var(--ink-3);
  line-height: 1.2;
}

/* 月历下方：当日日程面板 */
.day-agenda {
  margin-top: 14px;
  background: var(--card);
  border-radius: var(--radius);
  padding: 14px 16px;
  box-shadow: var(--shadow);
}
.da-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
}
.da-title {
  font-size: 14.5px;
  font-weight: 700;
  color: var(--ink);
}
.da-title em {
  font-style: normal;
  font-size: 11px;
  color: var(--sun-deep);
  background: var(--sun-soft);
  border-radius: 8px;
  padding: 2px 7px;
  margin-left: 7px;
  font-weight: 700;
}
.da-goto {
  font-size: 12px;
  font-weight: 600;
  color: var(--sun-deep);
  background: var(--sun-soft);
  border-radius: 999px;
  padding: 6px 12px;
  flex: none;
  transition: filter .15s ease;
}
.da-goto:hover { filter: brightness(.97); }
.da-goto:active { transform: scale(.97); }

.da-list { margin-top: 10px; display: flex; flex-direction: column; }
.da-item {
  display: flex;
  align-items: center;
  gap: 9px;
  padding: 8px 0;
  border-top: 1px dashed var(--line);
}
.da-item:first-child { border-top: none; }
.da-dot {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  flex: none;
}
.da-item.p-high .da-dot { background: var(--red); }
.da-item.p-medium .da-dot { background: var(--sun); }
.da-item.p-low .da-dot { background: var(--blue); }
.da-time {
  font-size: 12px;
  color: var(--ink-3);
  font-variant-numeric: tabular-nums;
  flex: none;
  min-width: 40px;
}
.da-name {
  font-size: 13.5px;
  color: var(--ink);
  flex: 1;
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.da-item.done .da-name { color: var(--ink-3); text-decoration: line-through; }
.da-check {
  font-size: 11px;
  color: var(--green);
  flex: none;
}
.da-tag {
  font-size: 10px;
  line-height: 1;
  color: var(--red);
  background: var(--red-soft);
  border-radius: 6px;
  padding: 3px 5px;
  font-weight: 700;
  flex: none;
}
.da-empty {
  margin-top: 10px;
  font-size: 12.5px;
  color: var(--ink-3);
  text-align: center;
  padding: 10px 0 4px;
}

.cal-hint {
  text-align: center;
  color: var(--ink-3);
  font-size: 12.5px;
  margin-top: 12px;
}

.month-stats {
  margin-top: 12px;
  background: var(--card);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 14px 18px;
  display: flex;
  justify-content: space-around;
  text-align: center;
}
.month-stats .ms-num { font-size: 19px; font-weight: 700; font-variant-numeric: tabular-nums; }
.month-stats .ms-num.c-sun { color: var(--sun-deep); }
.month-stats .ms-num.c-green { color: var(--green); }
.month-stats .ms-num.c-moon { color: var(--moon); }
.month-stats .ms-label { font-size: 12px; color: var(--ink-2); margin-top: 2px; }

/* ============ 月度目标 ============ */
.goal-list { display: flex; flex-direction: column; gap: 12px; }

.goal-card {
  background: var(--card);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 16px 18px;
}

.goal-head { display: flex; align-items: flex-start; justify-content: space-between; gap: 10px; }
.goal-title { font-weight: 700; font-size: 15.5px; word-break: break-word; }
.goal-head .del {
  flex: none;
  width: 30px;
  height: 30px;
  border-radius: 9px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  color: var(--ink-3);
}
.goal-head .del:hover { color: var(--red); background: var(--red-soft); }
.goal-head .del svg { width: 16px; height: 16px; }

.goal-bar {
  height: 8px;
  background: var(--bg-soft);
  border-radius: 99px;
  margin-top: 12px;
  overflow: hidden;
}
.goal-bar > div {
  height: 100%;
  border-radius: 99px;
  background: linear-gradient(90deg, var(--sun), var(--moon));
  transition: width .5s ease;
}
.goal-bar.full > div { background: var(--green); }

.goal-foot {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-top: 8px;
  font-size: 12.5px;
  color: var(--ink-2);
}
.goal-foot .pct { font-weight: 700; color: var(--ink); font-variant-numeric: tabular-nums; }
.goal-foot .pct.done { color: var(--green); }

/* 年度规划 */
.goal-year-tag {
  display: inline-block;
  margin-top: 6px;
  font-size: 10.5px;
  color: var(--moon);
  background: var(--moon-soft);
  border-radius: 7px;
  padding: 2.5px 8px;
  font-weight: 600;
  max-width: 100%;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.ym-list {
  margin-top: 12px;
  border-top: 1px dashed var(--line);
  padding-top: 4px;
}
.ym-row {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 8px 2px;
  border-radius: 10px;
  cursor: pointer;
  transition: background .15s ease;
}
.ym-row:hover { background: var(--bg-soft); }
.ym-row:active { transform: scale(.99); }
.ym-month {
  flex: none;
  font-size: 11px;
  font-weight: 700;
  color: var(--sun-deep);
  background: var(--sun-soft);
  border-radius: 8px;
  padding: 3px 8px;
}
.ym-title {
  flex: 1;
  min-width: 0;
  font-size: 13px;
  color: var(--ink);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.ym-pct {
  flex: none;
  font-size: 11.5px;
  color: var(--ink-3);
  font-variant-numeric: tabular-nums;
}
.ym-pct.done { color: var(--green); font-weight: 700; }

/* ============ 习惯打卡 ============ */
.habit-summary {
  background: linear-gradient(120deg, var(--sun), var(--moon));
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  color: #fff;
  padding: 16px 20px;
  margin-bottom: 14px;
  display: flex;
  align-items: center;
  justify-content: space-between;
}
.habit-summary .hs-title { font-size: 13.5px; opacity: .92; }
.habit-summary .hs-num { font-size: 22px; font-weight: 700; font-variant-numeric: tabular-nums; }
.habit-summary .hs-sub { font-size: 12.5px; opacity: .85; margin-top: 2px; }

.habit-list { display: flex; flex-direction: column; gap: 12px; }

.habit-card {
  background: var(--card);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 15px 18px;
}

.habit-head { display: flex; align-items: center; gap: 9px; }
.habit-dot { width: 11px; height: 11px; border-radius: 50%; flex: none; }
.habit-name { font-weight: 700; font-size: 15px; flex: 1; min-width: 0; word-break: break-word; }
.streak-badge {
  font-size: 11.5px;
  font-weight: 700;
  color: var(--sun-deep);
  background: var(--sun-soft);
  border-radius: 999px;
  padding: 2.5px 10px;
  white-space: nowrap;
  font-variant-numeric: tabular-nums;
}
.habit-head .del {
  flex: none;
  width: 28px;
  height: 28px;
  border-radius: 8px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  color: var(--ink-3);
}
.habit-head .del:hover { color: var(--red); background: var(--red-soft); }
.habit-head .del svg { width: 15px; height: 15px; }

.habit-week {
  display: flex;
  gap: 6px;
  margin-top: 13px;
}
.hw-day {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 4px;
}
.hw-circle {
  width: 26px;
  height: 26px;
  border-radius: 50%;
  border: 1.6px solid var(--line);
  display: flex;
  align-items: center;
  justify-content: center;
  color: #fff;
}
.hw-circle svg { width: 13px; height: 13px; }
.hw-label { font-size: 10.5px; color: var(--ink-3); }

.habit-foot {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-top: 13px;
  gap: 10px;
}
.habit-rate { font-size: 12.5px; color: var(--ink-2); font-variant-numeric: tabular-nums; }
.habit-check-btn {
  border-radius: 999px;
  padding: 8px 20px;
  font-size: 13.5px;
  font-weight: 700;
  color: #fff;
  transition: transform .12s ease, opacity .2s ease;
}
.habit-check-btn:active { transform: scale(.95); }
.habit-check-btn.checked {
  background: var(--green-soft) !important;
  color: var(--green);
}

/* ============ 空状态 ============ */
.empty {
  text-align: center;
  padding: 44px 20px;
  color: var(--ink-3);
}
.empty-icon { width: 52px; height: 52px; margin: 0 auto 12px; opacity: .55; }
.empty p { font-size: 14.5px; }
.empty-sub { font-size: 12.5px; margin-top: 4px; opacity: .8; }

/* ============ 悬浮添加按钮 ============ */
.fab {
  position: fixed;
  right: max(20px, calc(50vw - 240px));
  bottom: calc(78px + env(safe-area-inset-bottom, 0px));
  background: var(--sun);
  color: #fff;
  border-radius: 999px;
  height: 52px;
  padding: 0 22px;
  display: none;
  align-items: center;
  gap: 6px;
  font-size: 14.5px;
  font-weight: 700;
  box-shadow: 0 6px 18px rgba(232, 133, 61, .42);
  z-index: 40;
  transition: transform .15s ease;
}
.fab.show { display: inline-flex; }
.fab:active { transform: scale(.94); }
.fab svg { width: 19px; height: 19px; }

/* ============ 底部导航 ============ */
.tabbar {
  position: fixed;
  left: 0;
  right: 0;
  bottom: 0;
  max-width: 520px;
  margin: 0 auto;
  background: var(--card);
  border-top: 1px solid var(--line);
  display: grid;
  grid-template-columns: repeat(5, 1fr);
  padding: 6px 8px calc(8px + env(safe-area-inset-bottom, 0px));
  z-index: 50;
}

.tab {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 3px;
  padding: 6px 0 4px;
  border-radius: 12px;
  color: var(--ink-3);
  font-size: 11px;
  transition: color .15s ease;
}
.tab svg { width: 22px; height: 22px; }
.tab.active { color: var(--sun-deep); font-weight: 600; }

/* ============ 弹层 ============ */
.modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(20, 16, 10, .45);
  display: flex;
  align-items: flex-end;
  justify-content: center;
  z-index: 100;
  opacity: 0;
  pointer-events: none;
  transition: opacity .22s ease;
}
.modal-overlay.show { opacity: 1; pointer-events: auto; }

.modal-sheet {
  background: var(--card);
  width: 100%;
  max-width: 520px;
  border-radius: 22px 22px 0 0;
  padding: 20px 22px calc(22px + env(safe-area-inset-bottom, 0px));
  transform: translateY(30px);
  transition: transform .22s ease;
  max-height: 86dvh;
  overflow-y: auto;
}
.modal-overlay.show .modal-sheet { transform: translateY(0); }

.modal-sheet h2 {
  font-size: 17px;
  margin-bottom: 16px;
  letter-spacing: .5px;
}

.modal-sheet label {
  display: block;
  font-size: 13px;
  color: var(--ink-2);
  margin-bottom: 13px;
}

.modal-sheet input[type="text"],
.modal-sheet input[type="date"],
.modal-sheet input[type="time"],
.modal-sheet select {
  display: block;
  width: 100%;
  margin-top: 6px;
  padding: 11px 13px;
  border: 1.5px solid var(--line);
  border-radius: 12px;
  background: var(--card-2);
  color: var(--ink);
  font-size: 15px;
  outline: none;
  transition: border-color .15s ease;
}
.modal-sheet input:focus, .modal-sheet select:focus { border-color: var(--sun); }

.form-row { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }

.seg { display: flex; gap: 8px; margin: 6px 0 14px; }
.seg button {
  flex: 1;
  padding: 9px 0;
  border-radius: 11px;
  border: 1.5px solid var(--line);
  color: var(--ink-2);
  font-size: 13.5px;
  font-weight: 600;
  transition: all .15s ease;
}
.seg button.on.p-high { border-color: var(--red); color: var(--red); background: var(--red-soft); }
.seg button.on.p-medium { border-color: var(--sun); color: var(--sun-deep); background: var(--sun-soft); }
.seg button.on.p-low { border-color: var(--blue); color: var(--blue); background: rgba(61, 139, 201, .1); }

.color-row { display: flex; gap: 10px; margin: 6px 0 14px; }
.color-pick {
  width: 32px;
  height: 32px;
  border-radius: 50%;
  border: 3px solid transparent;
  transition: transform .12s ease;
}
.color-pick.on { border-color: var(--ink); transform: scale(1.08); }

.modal-actions { display: flex; gap: 10px; margin-top: 4px; }
.modal-actions button {
  flex: 1;
  padding: 12px 0;
  border-radius: 13px;
  font-size: 15px;
  font-weight: 700;
}
.modal-actions .btn-ghost { background: var(--bg-soft); color: var(--ink-2); }
.modal-actions .btn-primary { background: var(--sun); color: #fff; }
.modal-actions .btn-primary:active { transform: scale(.98); }

/* ============ Toast ============ */
.toast {
  position: fixed;
  left: 50%;
  bottom: calc(150px + env(safe-area-inset-bottom, 0px));
  transform: translateX(-50%) translateY(10px);
  background: var(--ink);
  color: var(--bg);
  font-size: 13.5px;
  padding: 9px 18px;
  border-radius: 999px;
  opacity: 0;
  pointer-events: none;
  transition: all .25s ease;
  z-index: 200;
  max-width: 80vw;
  text-align: center;
}
.toast.show { opacity: .94; transform: translateX(-50%) translateY(0); }

/* ============ 桌面端微调 ============ */
@media (min-width: 560px) {
  body { background: var(--bg-soft); }
  #app { background: var(--bg); box-shadow: 0 0 40px rgba(0, 0, 0, .06); }
  .tabbar { border-radius: 18px 18px 0 0; }
}

/* ============ 云同步账户按钮 ============ */
.acct-btn {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  height: 38px;
  padding: 0 12px;
  margin-right: 4px;
  border-radius: 12px;
  background: var(--sun-soft);
  color: var(--sun-deep);
  font-size: 13px;
  font-weight: 700;
  transition: opacity .15s ease;
}
.acct-btn:active { opacity: .75; }
.acct-login-text { letter-spacing: 1px; }
.acct-name { max-width: 88px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

.acct-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  flex: none;
}
.acct-dot.st-synced { background: var(--green); }
.acct-dot.st-offline { background: var(--red); }
.acct-dot.st-syncing {
  background: var(--sun);
  animation: pulse 1s ease-in-out infinite;
}
@keyframes pulse {
  0%, 100% { opacity: 1; transform: scale(1); }
  50% { opacity: .45; transform: scale(.75); }
}

/* ============ 登录 / 账号弹层 ============ */
.auth-overlay {
  position: fixed;
  inset: 0;
  background: rgba(20, 16, 10, .5);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 120;
  opacity: 0;
  pointer-events: none;
  transition: opacity .22s ease;
  padding: 20px;
}
.auth-overlay.show { opacity: 1; pointer-events: auto; }

.auth-sheet {
  background: var(--card);
  width: 100%;
  max-width: 380px;
  border-radius: 22px;
  padding: 24px 22px 22px;
  position: relative;
  transform: translateY(14px);
  transition: transform .22s ease;
  max-height: 86dvh;
  overflow-y: auto;
}
.auth-overlay.show .auth-sheet { transform: translateY(0); }

.auth-close {
  position: absolute;
  top: 14px;
  right: 14px;
  width: 32px;
  height: 32px;
  border-radius: 10px;
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--ink-3);
}
.auth-close:hover { background: var(--bg-soft); color: var(--ink); }
.auth-close svg { width: 16px; height: 16px; }

.auth-head { margin-bottom: 16px; }
.auth-title { font-size: 18px; font-weight: 700; letter-spacing: .5px; }
.auth-sub { font-size: 12.5px; color: var(--ink-2); margin-top: 3px; line-height: 1.5; }
.auth-notice {
  font-size: 12px;
  color: var(--sun-deep);
  background: var(--sun-soft);
  border-radius: 10px;
  padding: 8px 11px;
  margin-top: 10px;
  line-height: 1.5;
}

.auth-tabs {
  display: flex;
  gap: 4px;
  background: var(--bg-soft);
  border-radius: 12px;
  padding: 4px;
  margin-bottom: 16px;
}
.auth-tabs button {
  flex: 1;
  padding: 8px 0;
  border-radius: 9px;
  font-size: 13px;
  font-weight: 600;
  color: var(--ink-2);
  transition: all .15s ease;
}
.auth-tabs button.on {
  background: var(--card);
  color: var(--ink);
  box-shadow: 0 1px 4px rgba(0, 0, 0, .08);
}

.auth-error {
  background: var(--red-soft);
  color: var(--red);
  border-radius: 10px;
  padding: 9px 12px;
  font-size: 13px;
  margin-bottom: 12px;
  line-height: 1.45;
}

.auth-sheet label {
  display: block;
  font-size: 13px;
  color: var(--ink-2);
  margin-bottom: 13px;
}

.auth-sheet input[type="email"],
.auth-sheet input[type="password"],
.auth-sheet input[type="text"] {
  display: block;
  width: 100%;
  margin-top: 6px;
  padding: 11px 13px;
  border: 1.5px solid var(--line);
  border-radius: 12px;
  background: var(--card-2);
  color: var(--ink);
  font-size: 15px;
  outline: none;
  transition: border-color .15s ease;
}
.auth-sheet input:focus { border-color: var(--sun); }

.auth-input-row {
  display: flex;
  gap: 8px;
  margin-top: 6px;
}
.auth-input-row input { margin-top: 0 !important; flex: 1; min-width: 0; }

.auth-code-btn {
  flex: none;
  padding: 0 13px;
  border-radius: 12px;
  background: var(--sun-soft);
  color: var(--sun-deep);
  font-size: 12.5px;
  font-weight: 700;
  white-space: nowrap;
}
.auth-code-btn:disabled { opacity: .55; }

.auth-submit {
  display: block;
  width: 100%;
  padding: 12px 0;
  margin-top: 6px;
  border-radius: 13px;
  background: var(--sun);
  color: #fff;
  font-size: 15px;
  font-weight: 700;
}
.auth-submit:disabled { opacity: .7; }
.auth-submit:active { transform: scale(.98); }

.auth-ghost {
  display: block;
  width: 100%;
  padding: 12px 0;
  margin-top: 10px;
  border-radius: 13px;
  background: var(--bg-soft);
  color: var(--ink-2);
  font-size: 15px;
  font-weight: 700;
}

.auth-link {
  display: block;
  margin: 2px 0 12px;
  font-size: 13px;
  color: var(--blue);
  text-align: right;
}

.acct-status {
  font-size: 13.5px;
  color: var(--ink-2);
  background: var(--bg-soft);
  border-radius: 11px;
  padding: 10px 14px;
  margin-bottom: 14px;
}
