/* ===== 生活记 · Baby Blue 配色体系 ===== */
:root {
  --bg-top: #C8DCF5;
  --bg-mid: #E3F0FC;
  --bg-bot: #F2F8FD;
  --card: #FFFFFF;
  --line: #D0E2F2;
  --line2: #BFD5EA;
  --text: #1E3A4C;
  --text2: #5A7A92;
  --text3: #9AB0C4;
  --blue: #3B8AD9;
  --blue-deep: #2A6FB5;
  --blue-soft: #E2EEFA;
  --blue-ice: #F0F7FE;
  --teal: #2DBBA6;
  --teal-soft: #DFF7F3;
  --coral: #F26D8E;
  --coral-soft: #FCE4EB;
  --amber: #F5A637;
  --amber-soft: #FEF3E2;
  --lavender: #7B7FD4;
  --lavender-soft: #EAEAF8;
  --radius: 16px;
  --shadow: 0 2px 8px rgba(59,138,217,0.07), 0 1px 3px rgba(59,138,217,0.04);
  --shadow-lg: 0 8px 32px rgba(59,138,217,0.16);
  --safe-top: env(safe-area-inset-top, 0px);
  --safe-bottom: env(safe-area-inset-bottom, 0px);
}

* { 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", "Helvetica Neue", "Microsoft YaHei", sans-serif;
  background: linear-gradient(180deg, var(--bg-top) 0%, var(--bg-mid) 35%, var(--bg-bot) 100%);
  background-attachment: fixed;
  color: var(--text);
  font-size: 15px;
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
  overflow-x: hidden;
}
button { font-family: inherit; cursor: pointer; border: none; background: none; color: inherit; }
input, select, textarea { font-family: inherit; font-size: 15px; color: var(--text); }
input::placeholder, textarea::placeholder { color: var(--text3); }

/* ===== 顶栏 ===== */
#topbar {
  position: fixed; top: 0; left: 0; right: 0; z-index: 50;
  height: calc(52px + var(--safe-top));
  padding: var(--safe-top) 8px 0;
  display: flex; align-items: center; justify-content: space-between;
  background: rgba(200,220,245,0.72);
  backdrop-filter: blur(16px) saturate(1.2);
  -webkit-backdrop-filter: blur(16px) saturate(1.2);
  border-bottom: 1px solid rgba(255,255,255,0.5);
}
#topbarTitle {
  font-size: 18px; font-weight: 700; letter-spacing: 1px;
  color: var(--blue-deep);
}
.icon-btn {
  width: 40px; height: 40px; border-radius: 12px;
  display: flex; align-items: center; justify-content: center;
  color: var(--blue); transition: background .15s;
}
.icon-btn:active { background: rgba(255,255,255,0.6); }

/* ===== 主内容 ===== */
#main {
  padding: calc(60px + var(--safe-top)) 16px calc(32px + var(--safe-bottom));
  max-width: 780px; margin: 0 auto;
}
.page-head {
  display: flex; align-items: center; justify-content: flex-end;
  margin-bottom: 12px;
}
.page-title { font-size: 22px; font-weight: 800; display: none; }
.page-sub { font-size: 13px; color: var(--text2); margin-top: 2px; display: none; }

/* ===== 卡片 ===== */
.card {
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 16px;
  margin-bottom: 14px;
}
.card-title {
  font-size: 15px; font-weight: 700; color: var(--text);
  display: flex; align-items: center; justify-content: space-between;
  margin-bottom: 10px;
}
.card-title .more { font-size: 12px; color: var(--blue); font-weight: 500; }
.card-title .count {
  font-size: 12px; color: var(--text3); font-weight: 500;
  background: var(--blue-soft); padding: 2px 8px; border-radius: 999px; margin-left: 6px;
}

/* ===== 按钮 ===== */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 6px;
  padding: 9px 18px; border-radius: 12px;
  font-size: 14px; font-weight: 600;
  background: linear-gradient(135deg, var(--blue), var(--blue-deep)); color: #fff;
  transition: opacity .15s, transform .1s;
  box-shadow: 0 2px 8px rgba(59,138,217,0.25);
}
.btn:active { transform: scale(0.97); }
.btn.ghost { background: var(--blue-soft); color: var(--blue); box-shadow: none; }
.btn.gray { background: #EDF2F7; color: var(--text2); box-shadow: none; }
.btn.danger { background: var(--coral-soft); color: var(--coral); box-shadow: none; }
.btn.sm { padding: 6px 12px; font-size: 13px; border-radius: 10px; }
.btn.block { width: 100%; }
.btn:disabled { opacity: 0.5; cursor: not-allowed; }

/* ===== 表单 ===== */
.field { margin-bottom: 12px; }
.field label { display: block; font-size: 13px; color: var(--text2); margin-bottom: 6px; font-weight: 600; }
.input, .select, .textarea {
  width: 100%; padding: 10px 12px;
  border: 1px solid var(--line2); border-radius: 12px;
  background: var(--blue-ice); outline: none;
  transition: border .15s, box-shadow .15s;
}
.input:focus, .select:focus, .textarea:focus {
  border-color: var(--blue);
  background: #fff;
  box-shadow: 0 0 0 3px rgba(59,138,217,0.15);
}
.textarea { min-height: 90px; resize: vertical; }
.form-row { display: flex; gap: 10px; }
.form-row > .field { flex: 1; }

/* ===== 弹窗 ===== */
.modal-mask {
  position: fixed; inset: 0; z-index: 100;
  background: rgba(30,58,76,0.35);
  backdrop-filter: blur(2px);
  -webkit-backdrop-filter: blur(2px);
  display: flex; align-items: center; justify-content: center;
  padding: 20px;
  animation: fadeIn .18s ease;
}
.modal {
  background: #fff; border-radius: 20px;
  width: 100%; max-width: 460px; max-height: 88vh;
  overflow-y: auto;
  padding: 20px;
  box-shadow: var(--shadow-lg);
  animation: slideUp .22s ease;
  -webkit-overflow-scrolling: touch;
}
.modal-head {
  display: flex; align-items: center; justify-content: space-between;
  margin-bottom: 16px;
}
.modal-title { font-size: 17px; font-weight: 800; color: var(--text); }
.modal-close {
  width: 32px; height: 32px; border-radius: 10px;
  display: flex; align-items: center; justify-content: center;
  color: var(--text3); background: #EDF2F7;
}
.modal-foot { display: flex; gap: 10px; margin-top: 18px; }
.modal-foot .btn { flex: 1; }
@keyframes fadeIn { from { opacity: 0; } to { opacity: 1; } }
@keyframes slideUp { from { opacity: 0; transform: translateY(16px) scale(0.98); } to { opacity: 1; transform: none; } }
@keyframes popUp { from { opacity: 0; transform: translateY(16px) scale(0.98); } to { opacity: 1; transform: none; } }

/* ===== 提示 ===== */
#toast {
  position: fixed; left: 50%; bottom: calc(80px + var(--safe-bottom));
  transform: translateX(-50%) translateY(20px);
  background: rgba(30,58,76,0.9); color: #fff;
  padding: 10px 20px; border-radius: 999px;
  font-size: 14px; z-index: 200;
  opacity: 0; pointer-events: none;
  transition: opacity .25s, transform .25s;
  max-width: 86vw; text-align: center;
}
#toast.show { opacity: 1; transform: translateX(-50%) translateY(0); }

/* ===== 抽屉导航 ===== */
#drawerMask {
  position: fixed; inset: 0; z-index: 60;
  background: rgba(30,58,76,0.3);
  opacity: 0; pointer-events: none;
  transition: opacity .25s;
}
#drawerMask.show { opacity: 1; pointer-events: auto; }
#drawer {
  position: fixed; top: 0; left: 0; bottom: 0; z-index: 70;
  width: min(78vw, 320px);
  background: linear-gradient(180deg, #F0F7FE 0%, #FFFFFF 30%);
  transform: translateX(-102%);
  transition: transform .28s cubic-bezier(0.22, 1, 0.36, 1);
  display: flex; flex-direction: column;
  box-shadow: 4px 0 24px rgba(59,138,217,0.12);
  padding-top: var(--safe-top);
}
#drawer.open { transform: none; }
.drawer-head {
  display: flex; align-items: center; justify-content: space-between;
  padding: 16px 16px 12px;
}
.drawer-logo {
  font-size: 20px; font-weight: 800;
  color: var(--blue-deep);
}
.drawer-search {
  margin: 0 16px 12px;
  display: flex; align-items: center; gap: 8px;
  background: var(--blue-soft); border-radius: 12px;
  padding: 0 12px; height: 40px; color: var(--text3);
}
.drawer-search input {
  flex: 1; border: none; background: none; outline: none; font-size: 14px;
}
#drawerNav { flex: 1; overflow-y: auto; padding: 0 12px 20px; -webkit-overflow-scrolling: touch; }
.nav-group { margin-bottom: 6px; }
.nav-group-title {
  font-size: 11px; color: var(--text3); font-weight: 700;
  padding: 12px 10px 4px; letter-spacing: 1px;
}
.nav-item {
  display: flex; align-items: center; gap: 12px;
  padding: 11px 10px; border-radius: 12px;
  font-size: 15px; color: var(--text);
  transition: background .15s;
}
.nav-item:active { background: var(--blue-soft); }
.nav-item.active { background: var(--blue-soft); color: var(--blue-deep); font-weight: 700; }
.nav-item .ni-icon {
  width: 32px; height: 32px; border-radius: 10px;
  display: flex; align-items: center; justify-content: center;
  background: var(--blue-ice); color: var(--text2); flex-shrink: 0;
}
.nav-item.active .ni-icon { background: var(--blue); color: #fff; }

/* ===== 通用列表 ===== */
.list-item {
  display: flex; align-items: center; gap: 12px;
  padding: 12px 0;
  border-bottom: 1px solid var(--line);
}
.list-item:last-child { border-bottom: none; }
.list-main { flex: 1; min-width: 0; }
.list-title { font-size: 15px; font-weight: 600; word-break: break-all; }
.list-sub { font-size: 12px; color: var(--text3); margin-top: 2px; }
.list-actions { display: flex; gap: 4px; flex-shrink: 0; }
.mini-btn {
  width: 32px; height: 32px; border-radius: 10px;
  display: flex; align-items: center; justify-content: center;
  color: var(--text3);
}
.mini-btn:active { background: var(--blue-soft); }
.mini-btn.danger:active { background: var(--coral-soft); color: var(--coral); }
.mini-btn.edit:active { background: var(--blue-soft); color: var(--blue); }
.mini-btn.on { background: var(--blue-soft); color: var(--blue); font-weight: 600; }

/* ===== 标签 ===== */
.tag {
  display: inline-flex; align-items: center;
  font-size: 12px; font-weight: 600;
  padding: 2px 10px; border-radius: 999px;
  background: #EDF2F7; color: var(--text2);
}
.tag.blue { background: var(--blue-soft); color: var(--blue); }
.tag.green { background: var(--teal-soft); color: var(--teal); }
.tag.red { background: var(--coral-soft); color: var(--coral); }
.tag.amber { background: var(--amber-soft); color: var(--amber); }
.tag.purple { background: var(--lavender-soft); color: var(--lavender); }
.tag.gray { background: #EDF2F7; color: var(--text2); }

/* ===== 首页 ===== */
.home-greeting { font-size: 20px; font-weight: 800; margin-bottom: 2px; color: var(--text); }
.home-date { font-size: 13px; color: var(--text2); margin-bottom: 16px; }
.stat-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 10px; margin-bottom: 14px; }
.stat-card {
  background: rgba(255,255,255,0.7); border: 1px solid var(--line);
  border-radius: 14px; padding: 14px 12px; text-align: center;
  backdrop-filter: blur(4px);
}
.stat-card .num { font-size: 20px; font-weight: 800; }
.stat-card .label { font-size: 12px; color: var(--text2); margin-top: 2px; }
.stat-card.green .num { color: var(--teal); }
.stat-card.red .num { color: var(--coral); }
.stat-card.blue .num { color: var(--blue); }

.todo-row {
  display: flex; align-items: center; gap: 10px; padding: 9px 0;
  border-bottom: 1px solid var(--line);
}
.todo-row:last-child { border-bottom: none; }
.todo-check {
  width: 22px; height: 22px; border-radius: 50%; flex-shrink: 0;
  border: 2px solid var(--line2);
  display: flex; align-items: center; justify-content: center;
  color: transparent; transition: all .15s;
}
.todo-check.done { background: var(--teal); border-color: var(--teal); color: #fff; }
.todo-row .t-title { flex: 1; font-size: 14px; }
.todo-row .t-title.done-t { text-decoration: line-through; color: var(--text3); }
.t-due { font-size: 12px; color: var(--text3); flex-shrink: 0; }
.t-due.over { color: var(--coral); font-weight: 600; }

/* ===== 首页各模块徽标 ===== */
.chip-row { display: flex; flex-wrap: wrap; gap: 8px; }
.chip {
  display: inline-flex; align-items: center; gap: 6px;
  padding: 8px 14px; border-radius: 999px;
  background: var(--blue-ice); border: 1px solid var(--line);
  font-size: 13px; font-weight: 600;
}
.chip:active { background: var(--blue-soft); border-color: var(--blue); color: var(--blue); }

/* ===== 记账本 ===== */
.ledger-sum {
  display: flex; justify-content: space-around;
  padding: 8px 0 4px; text-align: center;
}
.ledger-sum .ls-label { font-size: 12px; color: var(--text2); }
.ledger-sum .ls-num { font-size: 20px; font-weight: 800; margin-top: 2px; }
.ls-num.inc { color: var(--teal); }
.ls-num.exp { color: var(--coral); }
.seg {
  display: flex; background: var(--blue-soft); border-radius: 12px; padding: 3px;
}
.seg button {
  flex: 1; padding: 7px 0; border-radius: 10px;
  font-size: 13px; font-weight: 600; color: var(--text2);
}
.seg button.on { background: #fff; color: var(--blue-deep); box-shadow: var(--shadow); }

/* ===== 吃什么 ===== */
.food-dice {
  text-align: center; padding: 24px 0 12px;
}
.food-big {
  font-size: 40px; font-weight: 800; min-height: 56px;
  background: linear-gradient(135deg, var(--blue), var(--lavender));
  -webkit-background-clip: text; background-clip: text; -webkit-text-fill-color: transparent;
  word-break: break-all;
}
.food-sub { font-size: 13px; color: var(--text3); margin-top: 8px; }

/* ===== 新闻 ===== */
.news-item {
  display: block; padding: 13px 0;
  border-bottom: 1px solid var(--line);
  text-decoration: none; color: inherit;
}
.news-item:last-child { border-bottom: none; }
.news-title { font-size: 14px; font-weight: 600; line-height: 1.45; }
.news-meta { font-size: 12px; color: var(--text3); margin-top: 5px; display: flex; gap: 8px; align-items: center; }
.news-summary { font-size: 12px; color: var(--text2); margin-top: 4px; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }

/* ===== 备忘录 ===== */
.note-grid { display: grid; grid-template-columns: repeat(2, 1fr); gap: 12px; }
.note-card {
  background: var(--card); border: 1px solid var(--line);
  border-radius: 14px; padding: 14px;
  position: relative;
}
.note-card.pinned { border-color: #F5D980; background: var(--amber-soft); }
.note-title { font-size: 14px; font-weight: 700; word-break: break-all; padding-right: 44px; }
.note-content {
  font-size: 13px; color: var(--text2); margin-top: 6px;
  display: -webkit-box; -webkit-line-clamp: 4; -webkit-box-orient: vertical; overflow: hidden;
  white-space: pre-wrap; word-break: break-all;
}
.note-date { font-size: 11px; color: var(--text3); margin-top: 8px; }
.note-actions { position: absolute; top: 10px; right: 10px; display: flex; gap: 2px; }

/* ===== 旅游 ===== */
.trip-card { display: flex; gap: 12px; }
.trip-cover {
  width: 84px; height: 84px; border-radius: 12px; flex-shrink: 0;
  background: linear-gradient(135deg, var(--blue-soft), var(--lavender-soft));
  display: flex; align-items: center; justify-content: center;
  font-size: 28px; overflow: hidden;
}
.trip-cover img { width: 100%; height: 100%; object-fit: cover; }
.trip-info { flex: 1; min-width: 0; }
.trip-name { font-size: 16px; font-weight: 700; }
.trip-dest { font-size: 13px; color: var(--text2); margin-top: 2px; }
.trip-dates { font-size: 12px; color: var(--text3); margin-top: 4px; }

/* ===== 纪念日 ===== */
.anniv-item {
  padding: 14px 16px;
}
.anniv-top {
  display: flex; align-items: center; justify-content: space-between;
  gap: 8px;
}
.anniv-name {
  font-size: 16px; font-weight: 700; color: var(--text);
  word-break: break-all;
}
.anniv-tags {
  display: flex; gap: 4px; flex-shrink: 0;
}
.anniv-tags .tag {
  font-size: 11px; padding: 2px 8px; border-radius: 8px;
  background: var(--blue-ice); color: var(--blue-deep);
}
.anniv-date-text {
  font-size: 13px; color: var(--text3); margin-top: 2px;
}
.anniv-bottom {
  display: flex; align-items: center; justify-content: space-between;
  margin-top: 10px;
}
.anniv-day {
  font-size: 20px; font-weight: 800; color: var(--blue);
}
.anniv-day.past { color: var(--text3); }
.anniv-day.green { color: var(--teal); }
.anniv-actions { display: flex; gap: 6px; flex-shrink: 0; }

/* ===== 搜索高亮 ===== */
mark { background: #F5D980; border-radius: 2px; padding: 0 1px; }

/* ===== 空提示 ===== */
.empty {
  text-align: center; color: var(--text3);
  padding: 32px 0; font-size: 14px;
}
.empty .e-icon { font-size: 36px; margin-bottom: 8px; }

/* ===== 响应式 ===== */
@media (max-width: 420px) {
  .note-grid { grid-template-columns: 1fr; }
  .stat-grid { grid-template-columns: repeat(3, 1fr); gap: 8px; }
  #main { padding-left: 12px; padding-right: 12px; }
}
@media (min-width: 640px) {
  #main { padding-top: calc(68px + var(--safe-top)); }
  #drawer { width: 300px; }
}
