/* ==========================================================================
   个人全能工作台 · 网站前端样式
   薄荷绿 + 水墨山水 + 白色卡片；浅色主题，无外部字体/图片依赖
   ========================================================================== */

:root {
  --bg-top: #f1faf7;
  --bg-mid: #e5f3ee;
  --bg-bottom: #d6ece5;
  --primary: #12998b;
  --primary-dark: #0c7c71;
  --primary-soft: #e2f4ef;
  --primary-tint: #f2faf7;
  --ink: #173f3c;
  --ink-2: #4d6f6b;
  --muted: #8fada8;
  --line: #e7f1ee;
  --card: #ffffff;
  --shadow: 0 6px 22px rgba(20, 90, 80, .07);
  --shadow-hover: 0 10px 28px rgba(20, 90, 80, .12);
  --radius: 14px;
  --orange: #f2705b;
  --red: #ef5b52;
  --purple: #7c6cf0;
  --blue: #3b9ae1;
  --amber: #f0ac3b;
  --green: #3fb59c;
}

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

html { -webkit-text-size-adjust: 100%; }

body {
  font-family: -apple-system, BlinkMacSystemFont, "PingFang SC", "Hiragino Sans GB",
               "Microsoft YaHei", "Segoe UI", Roboto, sans-serif;
  color: var(--ink);
  background: linear-gradient(180deg, var(--bg-top) 0%, var(--bg-mid) 48%, var(--bg-bottom) 100%);
  background-attachment: fixed;
  min-height: 100vh;
  font-size: 13px;
  line-height: 1.55;
  -webkit-font-smoothing: antialiased;
}

img { max-width: 100%; height: auto; }
button, input, select, textarea { font-family: inherit; font-size: inherit; color: inherit; }
button { cursor: pointer; border: none; background: none; }
a { color: inherit; text-decoration: none; }
ul { list-style: none; }

/* 背景山水（内联 SVG，无外部图片） */
.scenery {
  position: fixed;
  left: 0; bottom: 0;
  width: 100%; height: 400px;
  z-index: 0;
  pointer-events: none;
  opacity: .72;
}

.app {
  position: relative;
  z-index: 1;
  display: flex;
  min-height: 100vh;
  max-width: 1680px;
  margin: 0 auto;
}

/* ---------------- 侧边栏 ---------------- */
.sidebar {
  width: 214px;
  flex: 0 0 214px;
  padding: 22px 14px 20px;
  height: 100vh;
  position: sticky;
  top: 0;
  display: flex;
  flex-direction: column;
  background: rgba(255, 255, 255, .30);
  border-right: 1px solid rgba(255, 255, 255, .55);
  backdrop-filter: blur(10px);
}

.brand { display: flex; align-items: center; gap: 10px; padding: 0 6px 20px; }
.brand-avatar {
  width: 38px; height: 38px; flex: none;
  border-radius: 50%;
  background: linear-gradient(140deg, #2ab3a1, #0d8a7d);
  color: #fff; font-weight: 700; font-size: 15px;
  display: flex; align-items: center; justify-content: center;
  box-shadow: 0 3px 10px rgba(18, 153, 139, .3);
  overflow: hidden;
}
.brand-avatar img { width: 100%; height: 100%; object-fit: cover; }
.brand-name { font-size: 13px; font-weight: 700; line-height: 1.3; }
.brand-sub { font-size: 10px; color: var(--muted); letter-spacing: .5px; margin-top: 3px; }

.nav { display: flex; flex-direction: column; gap: 4px; }
.nav-item {
  display: flex; align-items: center; gap: 10px;
  padding: 9px 12px;
  border-radius: 10px;
  color: var(--ink-2);
  font-size: 12.5px;
  font-weight: 500;
  transition: background .18s, color .18s, transform .18s;
  white-space: nowrap;
}
.nav-item:hover { background: rgba(255, 255, 255, .65); color: var(--primary-dark); }
.nav-item.active {
  background: linear-gradient(120deg, var(--primary), #17a894);
  color: #fff;
  box-shadow: 0 5px 14px rgba(18, 153, 139, .28);
  font-weight: 600;
}
.nav-icon { width: 17px; text-align: center; font-size: 14px; flex: none; }

.sidebar-quote {
  margin-top: auto;
  padding: 16px 8px 6px;
  font-size: 11px;
  line-height: 1.9;
  color: #779c96;
  letter-spacing: .3px;
}
.sidebar-quote strong { display: block; font-weight: 600; color: #5c8c85; }
.sidebar-foot { padding: 8px 8px 0; font-size: 10px; color: #a3c0ba; }

/* ---------------- 主区 ---------------- */
.main { flex: 1; min-width: 0; padding: 24px 28px 46px; }

.topbar {
  display: flex; justify-content: space-between; align-items: flex-start;
  gap: 18px; margin-bottom: 20px; flex-wrap: wrap;
}
.page-title {
  font-size: clamp(26px, 3vw, 38px);
  font-weight: 800;
  letter-spacing: 1.5px;
  line-height: 1.25;
}
.page-sub { color: var(--ink-2); font-size: 12.5px; margin-top: 5px; letter-spacing: .3px; }

.top-tools { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; justify-content: flex-end; }
.search-box {
  position: relative;
  display: flex; align-items: center; gap: 7px;
  background: rgba(255, 255, 255, .8);
  border: 1px solid rgba(255, 255, 255, .9);
  border-radius: 999px;
  padding: 7px 14px;
  box-shadow: var(--shadow);
  min-width: 220px;
}
.search-box input { border: none; outline: none; background: transparent; width: 100%; font-size: 12px; }
.search-box input::placeholder { color: var(--muted); }
.search-results {
  position: absolute; top: calc(100% + 8px); right: 0;
  width: 290px; max-height: 300px; overflow: auto;
  background: #fff; border-radius: 12px; box-shadow: var(--shadow-hover);
  padding: 6px; z-index: 30;
}
.search-results button {
  display: block; width: 100%; text-align: left; padding: 8px 10px;
  border-radius: 8px; font-size: 12px; color: var(--ink-2);
}
.search-results button:hover { background: var(--primary-tint); color: var(--primary-dark); }
.search-results .sr-group { font-size: 10px; color: var(--muted); padding: 6px 10px 2px; }

.date-chip {
  background: rgba(255, 255, 255, .72);
  border-radius: 999px; padding: 7px 13px;
  font-size: 11.5px; color: var(--ink-2);
  box-shadow: var(--shadow); white-space: nowrap;
}
.icon-btn {
  width: 32px; height: 32px; border-radius: 50%;
  background: rgba(255, 255, 255, .8); box-shadow: var(--shadow);
  display: flex; align-items: center; justify-content: center;
  font-size: 14px; position: relative;
}
.icon-btn .dot {
  position: absolute; top: 5px; right: 6px; width: 6px; height: 6px;
  background: var(--orange); border-radius: 50%;
}
.user-chip {
  display: flex; align-items: center; gap: 7px;
  background: rgba(255, 255, 255, .82); border-radius: 999px;
  padding: 4px 12px 4px 4px; box-shadow: var(--shadow); font-size: 12px;
}
.user-chip .mini-avatar {
  width: 24px; height: 24px; border-radius: 50%;
  background: linear-gradient(140deg, #2ab3a1, #0d8a7d); color: #fff;
  display: flex; align-items: center; justify-content: center; font-size: 11px; font-weight: 700;
}

/* ---------------- 卡片通用 ---------------- */
.card {
  background: var(--card);
  border-radius: var(--radius);
  padding: 17px 19px;
  box-shadow: var(--shadow);
  border: 1px solid rgba(255, 255, 255, .8);
  min-width: 0;
}
.card-head { display: flex; align-items: center; justify-content: space-between; gap: 10px; margin-bottom: 14px; }
.card-title { font-size: 14.5px; font-weight: 700; letter-spacing: .3px; }
.card-title .count { color: var(--primary); font-weight: 700; }
.card-more { font-size: 11.5px; color: var(--muted); cursor: pointer; white-space: nowrap; }
.card-more:hover { color: var(--primary); }
.card-note { font-size: 11px; color: var(--muted); }

/* ---------------- KPI ---------------- */
.kpi-grid { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 14px; margin-bottom: 16px; }
.kpi-card {
  background: #fff; border-radius: var(--radius); padding: 15px 16px;
  box-shadow: var(--shadow); display: flex; align-items: center; gap: 12px;
  border: 1px solid rgba(255, 255, 255, .8); min-width: 0;
  transition: transform .18s, box-shadow .18s;
}
.kpi-card:hover { transform: translateY(-2px); box-shadow: var(--shadow-hover); }
.kpi-icon {
  width: 38px; height: 38px; flex: none; border-radius: 11px;
  display: flex; align-items: center; justify-content: center; font-size: 18px;
}
.kpi-body { flex: 1; min-width: 0; }
.kpi-label { font-size: 11.5px; color: var(--ink-2); font-weight: 600; }
.kpi-value { font-size: 22px; font-weight: 800; line-height: 1.25; letter-spacing: .5px; margin: 2px 0; }
.kpi-value small { font-size: 12px; font-weight: 600; color: var(--ink-2); margin-left: 2px; }
.kpi-foot { font-size: 10.5px; color: var(--muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.kpi-visual { flex: none; display: flex; align-items: center; justify-content: center; }

/* ---------------- 主网格 ---------------- */
.main-grid { display: grid; grid-template-columns: minmax(0, 1.86fr) minmax(0, 1fr); gap: 16px; align-items: start; }
.col { display: flex; flex-direction: column; gap: 16px; min-width: 0; }
.sub-grid { display: grid; grid-template-columns: minmax(0, 1.35fr) minmax(0, 1fr); gap: 16px; }
.sub-grid-3 { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 16px; }

/* ---------------- Tabs / 按钮 ---------------- */
.tabs { display: flex; gap: 6px; flex-wrap: wrap; margin-bottom: 14px; }
.tab {
  padding: 5px 12px; border-radius: 8px; font-size: 11.5px;
  background: #f2f7f5; color: var(--ink-2); transition: .18s;
}
.tab:hover { background: var(--primary-soft); }
.tab.active { background: var(--primary); color: #fff; font-weight: 600; }

.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 6px;
  padding: 8px 16px; border-radius: 9px; font-size: 12px; font-weight: 600;
  background: var(--primary); color: #fff; transition: .18s; white-space: nowrap;
}
.btn:hover { background: var(--primary-dark); }
.btn:disabled { opacity: .55; cursor: not-allowed; }
.btn-block { width: 100%; }
.btn-ghost { background: var(--primary-soft); color: var(--primary-dark); }
.btn-ghost:hover { background: #cdebe3; }
.btn-sm { padding: 5px 11px; font-size: 11px; border-radius: 7px; }
.btn-danger { background: #fff0ee; color: var(--red); }
.btn-danger:hover { background: #ffe1dd; }

/* ---------------- 复盘卡 ---------------- */
.review-inner { background: #f7fbfa; border-radius: 11px; padding: 15px 16px; border: 1px solid var(--line); }
.review-title { font-size: 15px; font-weight: 700; }
.review-meta { font-size: 11px; color: var(--muted); margin: 3px 0 13px; }
.review-fields { display: grid; grid-template-columns: 1fr 1fr; gap: 10px 16px; margin-bottom: 14px; }
.rf-label { font-size: 11px; color: var(--muted); margin-bottom: 4px; }
.rf-value { font-size: 12px; color: var(--ink-2); }
.rf-value.accent { color: var(--primary-dark); font-weight: 600; }
.review-edit { display: grid; gap: 10px; }
.review-edit label { font-size: 11px; color: var(--muted); display: block; margin-bottom: 4px; }
.field {
  width: 100%; border: 1px solid var(--line); border-radius: 8px;
  padding: 8px 10px; outline: none; background: #fff; font-size: 12px;
  transition: border-color .18s;
}
.field:focus { border-color: var(--primary); }
textarea.field { resize: vertical; min-height: 62px; }

/* ---------------- 提醒 ---------------- */
.remind-list { display: flex; flex-direction: column; }
.remind-item {
  display: flex; align-items: center; gap: 11px;
  padding: 9px 2px; border-bottom: 1px dashed var(--line);
}
.remind-item:last-child { border-bottom: none; }
.remind-time { font-size: 12px; font-weight: 700; color: var(--ink); width: 42px; flex: none; }
.remind-dot { width: 7px; height: 7px; border-radius: 50%; background: var(--orange); flex: none; }
.remind-title { flex: 1; min-width: 0; font-size: 12px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.remind-left { font-size: 10.5px; color: var(--muted); white-space: nowrap; }
.remind-left.soon { color: var(--red); background: #fff0ee; padding: 2px 7px; border-radius: 6px; font-weight: 600; }

/* ---------------- 体重 ---------------- */
.weight-top { display: flex; justify-content: space-between; gap: 14px; align-items: flex-start; }
.metric-label { font-size: 10.5px; color: var(--muted); }
.metric-big { font-size: 27px; font-weight: 800; line-height: 1.2; }
.metric-big small { font-size: 13px; font-weight: 600; color: var(--ink-2); }
.metric-change { font-size: 11px; color: var(--primary); font-weight: 600; margin-top: 2px; }
.goal-box { text-align: right; min-width: 108px; }
.goal-row { font-size: 11px; color: var(--ink-2); }
.goal-row b { font-size: 15px; color: var(--ink); }
.goal-percent { font-size: 10.5px; color: var(--muted); margin-top: 6px; }
.line-chart { width: 100%; height: 132px; display: block; margin-top: 8px; }

/* ---------------- 快捷入口 ---------------- */
.shortcut-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 9px; }
.shortcut {
  display: flex; align-items: center; gap: 9px;
  background: #f6fbf9; border: 1px solid #eef6f3;
  border-radius: 11px; padding: 10px 11px; text-align: left;
  transition: .18s;
}
.shortcut:hover { background: var(--primary-soft); transform: translateY(-1px); }
.sc-icon {
  width: 30px; height: 30px; flex: none; border-radius: 9px;
  display: flex; align-items: center; justify-content: center; font-size: 15px; color: #fff;
}
.sc-label { font-size: 12px; font-weight: 600; }
.sc-sub { font-size: 10px; color: var(--muted); }

/* ---------------- 内容安排 ---------------- */
.content-item { display: flex; align-items: center; gap: 11px; padding: 9px 0; border-bottom: 1px dashed var(--line); }
.content-item:last-child { border-bottom: none; }
.checkbox {
  width: 15px; height: 15px; flex: none; border: 1.6px solid #c6dbd6; border-radius: 4px;
  display: flex; align-items: center; justify-content: center; font-size: 10px; color: #fff;
  transition: .18s;
}
.checkbox.checked { background: var(--primary); border-color: var(--primary); }
.cover-thumb {
  width: 46px; height: 38px; flex: none; border-radius: 7px;
  background: linear-gradient(135deg, #cdeae3, #8fc9bd);
  display: flex; align-items: center; justify-content: center; font-size: 16px;
}
.cover-thumb.sand { background: linear-gradient(135deg, #f6e6cc, #e5c79a); }
.cover-thumb.sky { background: linear-gradient(135deg, #d6e9f7, #9fc8e8); }
.content-main { flex: 1; min-width: 0; }
.content-title { font-size: 12px; font-weight: 600; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.content-title.done { text-decoration: line-through; color: var(--muted); }
.content-tags { display: flex; gap: 5px; margin-top: 4px; flex-wrap: wrap; }
.tag { font-size: 9.5px; padding: 1px 7px; border-radius: 5px; background: var(--primary-soft); color: var(--primary-dark); }
.tag.alt { background: #f1edff; color: #6a5ad4; }
.tag.warn { background: #fff2e2; color: #c98a20; }
.content-time { font-size: 11px; color: var(--muted); flex: none; }

/* ---------------- 学习进度 ---------------- */
.progress-list { display: flex; flex-direction: column; gap: 12px; }
.progress-row { display: flex; align-items: center; gap: 9px; }
.pr-icon { width: 24px; height: 24px; flex: none; border-radius: 7px; background: #f2f8f6; display: flex; align-items: center; justify-content: center; font-size: 12px; }
.pr-name { width: 76px; flex: none; font-size: 11.5px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.progress-track { flex: 1; height: 7px; border-radius: 99px; background: #edf5f2; overflow: hidden; }
.progress-fill { height: 100%; border-radius: 99px; transition: width .4s ease; }
.pr-value { width: 32px; text-align: right; font-size: 11px; font-weight: 700; color: var(--ink-2); flex: none; }

/* ---------------- 便签 ---------------- */
.note-item {
  display: flex; gap: 10px; padding: 10px; border-radius: 10px;
  background: #fffaf0; margin-bottom: 9px; border: 1px solid #fbf0da;
  transition: .18s;
}
.note-item:last-child { margin-bottom: 0; }
.note-item.purple { background: #f8f6ff; border-color: #eee9ff; }
.note-item.mint { background: #f2fbf8; border-color: #e2f4ee; }
.note-icon { width: 26px; height: 26px; flex: none; border-radius: 8px; background: #fff3d6; display: flex; align-items: center; justify-content: center; font-size: 13px; }
.note-item.purple .note-icon { background: #eae4ff; }
.note-item.mint .note-icon { background: #dcf3eb; }
.note-body { flex: 1; min-width: 0; }
.note-title { font-size: 11.5px; font-weight: 700; }
.note-text { font-size: 10.5px; color: var(--ink-2); margin: 3px 0; line-height: 1.5; }
.note-time { font-size: 9.5px; color: var(--muted); }

/* ---------------- 习惯打卡 ---------------- */
.habit-table { width: 100%; border-collapse: collapse; }
.habit-table th { font-size: 10px; color: var(--muted); font-weight: 500; padding: 0 0 8px; text-align: center; }
.habit-table th:first-child { text-align: left; width: 62px; }
.habit-table td { padding: 4px 0; text-align: center; }
.habit-table td:first-child { text-align: left; font-size: 11px; color: var(--ink-2); }
.habit-cell {
  width: 19px; height: 19px; margin: 0 auto; border-radius: 50%;
  border: 1.4px solid #dcece8; display: flex; align-items: center; justify-content: center;
  font-size: 10px; color: #fff; transition: .18s;
}
.habit-cell.on { background: var(--primary); border-color: var(--primary); }
.habit-cell.today { box-shadow: 0 0 0 3px rgba(18, 153, 139, .12); }
.habit-cell:hover { border-color: var(--primary); transform: scale(1.1); }

/* ---------------- 收支 / 心情 ---------------- */
.finance-ring { display: flex; align-items: center; gap: 14px; }
.finance-legend { flex: 1; display: flex; flex-direction: column; gap: 5px; }
.legend-row { display: flex; align-items: center; gap: 6px; font-size: 11px; }
.legend-dot { width: 7px; height: 7px; border-radius: 50%; flex: none; }
.legend-name { color: var(--ink-2); flex: 1; }
.legend-value { font-weight: 700; }
.mood-row { display: flex; justify-content: space-between; margin-bottom: 6px; }
.mood-face { text-align: center; font-size: 16px; line-height: 1.3; }
.mood-face small { display: block; font-size: 9px; color: var(--muted); }
.wave-chart { width: 100%; height: 54px; display: block; }

/* ---------------- 模块视图通用 ---------------- */
.view { display: none; }
.view.active { display: block; }
.section-head { display: flex; justify-content: space-between; align-items: center; gap: 12px; margin-bottom: 14px; flex-wrap: wrap; }
.section-head h2 { font-size: 20px; font-weight: 800; letter-spacing: .5px; }
.section-head p { font-size: 11.5px; color: var(--muted); margin-top: 3px; }
.toolbar { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; }

.list-row {
  display: flex; align-items: center; gap: 11px;
  padding: 11px 13px; border-bottom: 1px solid var(--line);
  transition: background .15s;
}
.list-row:last-child { border-bottom: none; }
.list-row:hover { background: #f8fcfa; }
.list-row.done .row-title { text-decoration: line-through; color: var(--muted); }
.row-main { flex: 1; min-width: 0; }
.row-title { font-size: 12.5px; font-weight: 600; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.row-sub { font-size: 10.5px; color: var(--muted); margin-top: 2px; }
.row-actions { display: flex; gap: 5px; flex: none; }
.mini-btn { padding: 4px 9px; border-radius: 7px; font-size: 10.5px; background: #f2f8f6; color: var(--ink-2); }
.mini-btn:hover { background: var(--primary-soft); color: var(--primary-dark); }
.mini-btn.del:hover { background: #fff0ee; color: var(--red); }
.priority { width: 3px; height: 26px; border-radius: 3px; flex: none; }
.pill { font-size: 10px; padding: 2px 8px; border-radius: 6px; background: var(--primary-soft); color: var(--primary-dark); }
.pill.gray { background: #f1f5f4; color: var(--muted); }
.pill.red { background: #fff0ee; color: var(--red); }
.pill.amber { background: #fff5e5; color: #c98a20; }

.stat-strip { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 12px; margin-bottom: 16px; }
.stat-box { background: #fff; border-radius: 12px; padding: 14px 16px; box-shadow: var(--shadow); }
.stat-label { font-size: 11px; color: var(--muted); }
.stat-value { font-size: 22px; font-weight: 800; margin-top: 3px; }
.stat-value small { font-size: 11px; font-weight: 600; color: var(--ink-2); }

.empty {
  padding: 36px 16px; text-align: center; color: var(--muted);
  font-size: 12px; border: 1px dashed var(--line); border-radius: 10px;
}
.empty-mini { padding: 18px; text-align: center; color: var(--muted); font-size: 11px; }
.grid-2 { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 16px; }

/* ---------------- Modal / Toast ---------------- */
.modal-mask {
  position: fixed; inset: 0; z-index: 100;
  background: rgba(18, 55, 50, .38); backdrop-filter: blur(3px);
  display: flex; align-items: center; justify-content: center; padding: 20px;
}
.modal-mask[hidden] { display: none; }
.modal {
  width: 100%; max-width: 440px; background: #fff; border-radius: 16px;
  box-shadow: 0 24px 60px rgba(10, 60, 54, .24); padding: 22px;
  max-height: 88vh; overflow: auto;
}
.modal-head { display: flex; justify-content: space-between; align-items: center; margin-bottom: 16px; }
.modal-title { font-size: 16px; font-weight: 700; }
.modal-close { font-size: 20px; color: var(--muted); line-height: 1; }
.form-row { margin-bottom: 13px; }
.form-row label { display: block; font-size: 11px; color: var(--ink-2); margin-bottom: 5px; font-weight: 600; }
.form-actions { display: flex; justify-content: flex-end; gap: 9px; margin-top: 18px; }
.form-hint { font-size: 10.5px; color: var(--muted); margin-top: 4px; }

.toast {
  position: fixed; left: 50%; bottom: 30px; transform: translate(-50%, 20px);
  background: rgba(23, 63, 60, .94); color: #fff; padding: 10px 20px;
  border-radius: 10px; font-size: 12px; z-index: 200;
  opacity: 0; pointer-events: none; transition: .25s;
  box-shadow: 0 8px 24px rgba(10, 60, 54, .24);
}
.toast.show { opacity: 1; transform: translate(-50%, 0); }

.mode-badge {
  font-size: 10px; padding: 3px 9px; border-radius: 999px;
  background: #eef7f4; color: var(--primary-dark); border: 1px solid #d9ede7;
}
.mode-badge.offline { background: #fff6e8; color: #b7822a; border-color: #f5e3c2; }

/* ---------------- 登录门 ---------------- */
.auth-gate {
  position: fixed; inset: 0; z-index: 90;
  display: flex; align-items: center; justify-content: center;
  padding: 20px; overflow-y: auto;
  background: linear-gradient(180deg, #f1faf7 0%, #e5f3ee 48%, #d6ece5 100%);
}
.auth-gate[hidden], body:not(.auth-mode) .auth-gate { display: none; }
body.auth-mode .app, body.auth-mode .mobile-nav, body.auth-mode .fab,
body.auth-mode .scenery { display: none !important; }

.auth-decor { position: absolute; inset: 0; pointer-events: none; overflow: hidden; }
.auth-decor svg { position: absolute; bottom: 0; left: 0; width: 100%; height: 46%; opacity: .8; }
.auth-panel {
  position: relative; z-index: 1; width: 100%; max-width: 420px;
  background: rgba(255, 255, 255, .95); backdrop-filter: blur(14px);
  border: 1px solid rgba(255, 255, 255, .9); border-radius: 20px;
  padding: 32px 30px 26px; box-shadow: 0 26px 70px rgba(12, 80, 72, .16);
}
.auth-brand { text-align: center; margin-bottom: 24px; }
.auth-logo {
  width: 54px; height: 54px; margin: 0 auto 12px; border-radius: 17px;
  background: linear-gradient(140deg, #2ab3a1, #0d8a7d); color: #fff;
  display: flex; align-items: center; justify-content: center;
  font-size: 25px; font-weight: 800; box-shadow: 0 8px 20px rgba(18, 153, 139, .3);
}
.auth-brand h1 { font-size: 23px; font-weight: 800; letter-spacing: 1px; }
.auth-brand p { font-size: 11.5px; color: var(--muted); margin-top: 6px; line-height: 1.6; }
.auth-tabs { display: flex; gap: 6px; background: #f1f7f5; border-radius: 11px; padding: 4px; margin-bottom: 20px; }
.auth-tab {
  flex: 1; padding: 10px 8px; border-radius: 8px; font-size: 13px;
  font-weight: 600; color: var(--ink-2); min-height: 42px;
}
.auth-tab.active { background: #fff; color: var(--primary-dark); box-shadow: 0 2px 8px rgba(20, 90, 80, .1); }
.auth-row { margin-bottom: 14px; }
.auth-row label { display: block; font-size: 11.5px; font-weight: 600; color: var(--ink-2); margin-bottom: 6px; }
.auth-row .field { min-height: 44px; padding: 11px 12px; font-size: 14px; }
.auth-error {
  background: #fff0ee; color: var(--red); border-radius: 8px;
  padding: 9px 12px; font-size: 12px; margin-bottom: 12px;
}
.auth-error[hidden] { display: none; }
.auth-submit { width: 100%; min-height: 46px; font-size: 14px; border-radius: 10px; }
.auth-foot { text-align: center; margin-top: 16px; }
.auth-demo { font-size: 11.5px; color: var(--primary-dark); text-decoration: underline; min-height: 32px; }
.auth-note { font-size: 10.5px; color: var(--muted); text-align: center; margin-top: 16px; line-height: 1.6; }

/* ---------------- 新增通用组件 ---------------- */
.mobile-brand { display: none; align-items: center; gap: 9px; font-size: 14px; font-weight: 700; }
.mobile-nav { display: none; }
.fab {
  display: none; align-items: center; justify-content: center;
  position: fixed; right: 16px; bottom: calc(82px + env(safe-area-inset-bottom));
  width: 54px; height: 54px; border-radius: 50%; z-index: 85;
  background: linear-gradient(140deg, #20b09c, #0d8a7d); color: #fff;
  font-size: 30px; font-weight: 300; line-height: 1;
  box-shadow: 0 10px 26px rgba(12, 110, 98, .38);
  -webkit-tap-highlight-color: transparent;
}
.quick-grid { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 10px; }
.quick-item {
  display: flex; flex-direction: column; align-items: center; justify-content: center;
  gap: 6px; min-height: 82px; border-radius: 12px;
  background: #f3faf7; border: 1px solid #e6f3ee; color: var(--ink-2);
}
.quick-item span { font-size: 22px; }
.quick-item em { font-style: normal; font-size: 11.5px; font-weight: 600; }
.quick-item:active { background: var(--primary-soft); }
.btn-row { display: flex; gap: 8px; flex-wrap: wrap; margin-top: 14px; }
.data-stats { display: grid; grid-template-columns: repeat(auto-fill, minmax(76px, 1fr)); gap: 9px; }
.data-stat {
  background: #f5faf8; border-radius: 10px; padding: 10px 6px; text-align: center;
  border: 1px solid #edf5f2;
}
.data-stat b { display: block; font-size: 18px; color: var(--primary-dark); }
.data-stat span { font-size: 10px; color: var(--muted); }
.table-scroll { overflow-x: auto; -webkit-overflow-scrolling: touch; }
.habit-manage-list { margin-bottom: 14px; max-height: 320px; overflow-y: auto; }
.habit-emoji { font-size: 18px; flex: none; }
.line-chart, .wave-chart { max-width: 100%; }

/* ---------------- 响应式：平板 ---------------- */
@media (max-width: 1240px) {
  .kpi-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .main-grid { grid-template-columns: minmax(0, 1.5fr) minmax(0, 1fr); }
  .sub-grid-3 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}
@media (max-width: 980px) {
  .main-grid { grid-template-columns: 1fr; }
  .sidebar { width: 76px; flex-basis: 76px; padding: 18px 10px; }
  .brand-name, .brand-sub, .nav-item span:not(.nav-icon), .sidebar-quote, .sidebar-foot { display: none; }
  .brand { justify-content: center; padding: 0 0 18px; }
  .nav-item { justify-content: center; padding: 11px 0; }
  .nav-icon { font-size: 16px; }
  .sub-grid { grid-template-columns: 1fr; }
}

/* ---------------- 响应式：手机（侧栏 → 底部导航） ---------------- */
@media (max-width: 900px) {
  html, body { -webkit-tap-highlight-color: transparent; }
  body { font-size: 14px; }
  .app { display: block; }
  .sidebar { display: none; }
  .scenery { height: 220px; opacity: .5; }
  .main { padding: 12px 12px calc(96px + env(safe-area-inset-bottom)); }

  .topbar { gap: 10px; margin-bottom: 14px; align-items: center; }
  .topbar-title { display: none; }
  .mobile-brand { display: flex; flex: 1; min-width: 0; }
  .mobile-brand .mini-avatar {
    width: 32px; height: 32px; border-radius: 50%; flex: none;
    background: linear-gradient(140deg, #2ab3a1, #0d8a7d); color: #fff;
    display: flex; align-items: center; justify-content: center; font-size: 13px; font-weight: 700;
  }
  .top-tools { width: 100%; flex-wrap: nowrap; gap: 8px; justify-content: space-between; }
  .search-box { flex: 1; min-width: 0; width: auto; padding: 8px 12px; }
  .search-box input { font-size: 16px; }
  .search-results { right: 0; left: 0; width: auto; }
  .date-chip { display: none; }
  .icon-btn { width: 40px; height: 40px; flex: none; font-size: 16px; }
  .user-chip { flex: none; padding: 3px; border-radius: 50%; }
  .user-chip #topName { display: none; }
  .user-chip .mini-avatar { width: 32px; height: 32px; font-size: 13px; }

  .section-head { gap: 10px; }
  .section-head h2 { font-size: 19px; }
  .section-head .toolbar { width: 100%; }
  .section-head .toolbar .btn { flex: 1; }

  .kpi-grid, .stat-strip { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px; }
  .main-grid, .sub-grid, .sub-grid-3, .grid-2, .col { grid-template-columns: 1fr; gap: 12px; }
  .col { display: grid; }
  .grid-2 { display: grid; }
  .card { padding: 15px 14px; border-radius: 13px; }
  .kpi-card { padding: 13px 12px; gap: 9px; }
  .kpi-icon { width: 34px; height: 34px; font-size: 16px; }
  .kpi-value { font-size: 19px; }
  .kpi-visual { display: none; }
  .stat-box { padding: 12px; }
  .stat-value { font-size: 19px; }
  .review-fields { grid-template-columns: 1fr 1fr; gap: 10px; }
  .shortcut-grid { gap: 8px; }
  .shortcut { padding: 12px 10px; min-height: 56px; }
  .finance-ring { flex-wrap: wrap; justify-content: center; gap: 10px; }
  .finance-legend { min-width: 170px; }
  .weight-top { flex-wrap: wrap; gap: 10px; }
  .goal-box { text-align: left; min-width: 120px; }
  .mood-face { flex: 1; min-width: 0; }

  /* 列表行：允许换行，操作按钮不会挤出屏幕 */
  .list-row { flex-wrap: wrap; gap: 9px; padding: 12px 2px; }
  .row-main { flex: 1 1 calc(100% - 90px); min-width: 0; }
  .row-title { white-space: normal; overflow: visible; text-overflow: clip; line-height: 1.45; }
  .row-actions { width: 100%; justify-content: flex-end; gap: 8px; }
  .row-sub { line-height: 1.5; }
  .content-item { flex-wrap: wrap; }
  .content-main { flex: 1 1 calc(100% - 110px); }
  .content-title { white-space: normal; }
  .progress-row { flex-wrap: wrap; }
  .progress-track { flex: 1 1 90px; }

  /* 触控目标 ≥44px */
  .btn { min-height: 44px; padding: 10px 18px; font-size: 13px; }
  .btn-sm { min-height: 40px; padding: 9px 14px; font-size: 12px; }
  .mini-btn { min-height: 38px; padding: 8px 13px; font-size: 12px; }
  .tab { min-height: 40px; padding: 9px 14px; font-size: 12.5px; }
  .icon-btn, .modal-close { min-width: 44px; min-height: 44px; }
  .modal-close { display: flex; align-items: center; justify-content: center; }
  .card-more { min-height: 36px; display: inline-flex; align-items: center; }
  .checkbox { width: 24px; height: 24px; border-radius: 6px; font-size: 13px; position: relative; flex: none; }
  .checkbox::after { content: ''; position: absolute; inset: -10px; }
  .habit-cell { width: 28px; height: 28px; font-size: 12px; position: relative; }
  .habit-cell::after { content: ''; position: absolute; inset: -8px; }
  .cover-thumb { width: 42px; height: 36px; }
  .auth-tab, .auth-submit, .auth-demo { min-height: 44px; }

  /* 输入框统一 16px，避免 iOS 聚焦时自动放大页面 */
  input, select, textarea { font-size: 16px; }
  .field { min-height: 46px; padding: 11px 12px; }
  textarea.field { min-height: 90px; }
  .form-row label { font-size: 12.5px; }
  .form-hint, .card-note { font-size: 11.5px; }

  /* 底部导航：8 项均分，不横滑 */
  .mobile-nav {
    display: flex; position: fixed; left: 0; right: 0; bottom: 0; z-index: 80;
    background: rgba(255, 255, 255, .97); backdrop-filter: blur(14px);
    border-top: 1px solid #dcece7; box-shadow: 0 -4px 20px rgba(20, 90, 80, .09);
    padding: 5px 3px calc(5px + env(safe-area-inset-bottom));
  }
  .mobile-nav-item {
    flex: 1 1 0; min-width: 0; min-height: 52px;
    display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 2px;
    border-radius: 10px; color: var(--ink-2);
  }
  .mobile-nav-item span { font-size: 17px; line-height: 1.2; }
  .mobile-nav-item em { font-style: normal; font-size: 9.5px; white-space: nowrap; }
  .mobile-nav-item.active { background: var(--primary-soft); color: var(--primary-dark); }
  .mobile-nav-item.active em { font-weight: 700; }
  .fab { display: flex; }

  /* 弹窗改为底部抽屉 */
  .modal-mask { align-items: flex-end; padding: 0; }
  .modal {
    max-width: 100%; border-radius: 20px 20px 0 0;
    padding: 20px 18px calc(20px + env(safe-area-inset-bottom));
    max-height: 88vh; box-shadow: 0 -12px 40px rgba(10, 60, 54, .2);
  }
  .form-actions { gap: 10px; }
  .form-actions .btn { flex: 1; min-height: 46px; }
  .toast { bottom: calc(92px + env(safe-area-inset-bottom)); max-width: 90vw; text-align: center; }

  /* 打卡表：横向滚动 + 首列吸顶 */
  .table-scroll { margin: 0 -2px; }
  .habit-table { min-width: 430px; }
  .habit-table th:first-child, .habit-table td:first-child {
    position: sticky; left: 0; background: #fff; z-index: 1;
  }
}

/* ---------------- 响应式：窄屏手机 ---------------- */
@media (max-width: 640px) {
  .auth-gate { padding: 14px; align-items: flex-start; }
  .auth-panel { margin: auto 0; padding: 24px 20px 20px; border-radius: 18px; }
  .auth-brand { margin-bottom: 18px; }
  .auth-logo { width: 48px; height: 48px; font-size: 22px; }
  .auth-brand h1 { font-size: 21px; }
  .main { padding: 10px 10px calc(94px + env(safe-area-inset-bottom)); }
  .kpi-grid, .stat-strip, .review-fields { gap: 8px; }
  .kpi-value { font-size: 17px; }
  .kpi-label, .stat-label { font-size: 10.5px; }
  .page-sub { display: none; }
  .section-head h2 { font-size: 18px; }
  .quick-grid { grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 8px; }
  .quick-item { min-height: 76px; }
  .mobile-nav-item em { font-size: 9px; }
  .data-stats { grid-template-columns: repeat(3, minmax(0, 1fr)); }
}

/* 减少动画偏好 */
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { transition-duration: .01ms !important; animation-duration: .01ms !important; }
}
