/* ============================================================
   暖心记忆 · 全局样式
   设计：移动端优先、浅色为主、圆角卡片、柔和阴影。
   电脑浏览器上会自动居中显示为「手机宽度」。
   ============================================================ */

/* ---------- 主题变量 ---------- */
:root {
  --bg: #fdf3f6;            /* 页面背景（淡粉） */
  --card: #ffffff;          /* 卡片背景 */
  --primary: #ff6b9d;       /* 主色（粉红） */
  --primary-deep: #e8507f;  /* 主色（深一档） */
  --primary-soft: #ffe3ec;  /* 主色浅底 */
  --text: #3c2a31;          /* 正文颜色 */
  --muted: #9c8791;         /* 次要文字 */
  --line: #f3e2e8;          /* 分隔线 */
  --danger: #e5484d;        /* 危险操作 */
  --ok: #16a34a;            /* 成功 */
  --radius: 16px;           /* 圆角 */
  --shadow: 0 4px 16px rgba(255, 107, 157, .14);
  --tab-h: 60px;            /* 底部导航高度 */
}

/* ---------- 基础重置 ---------- */
* { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }
html, body { height: 100%; }
body {
  margin: 0;
  background: #f8eef1;
  color: var(--text);
  font-family: -apple-system, BlinkMacSystemFont, "PingFang SC", "Microsoft YaHei",
               "Segoe UI", Roboto, sans-serif;
  font-size: 15px;
  line-height: 1.6;
}
button { font-family: inherit; }
input, select, textarea { font-family: inherit; font-size: 15px; color: var(--text); }
a { color: var(--primary-deep); }

/* 应用外壳：手机上占满全屏，电脑上居中显示成手机宽度 */
.app {
  max-width: 520px;
  margin: 0 auto;
  min-height: 100%;
  display: flex;
  flex-direction: column;
  background: linear-gradient(180deg, #fff6f9, var(--bg));
  box-shadow: 0 0 40px rgba(255, 150, 180, .18);
  position: relative;
}

/* ---------- 视图区 ---------- */
.view {
  flex: 1;
  padding: 16px 16px calc(var(--tab-h) + 28px);
  overflow-y: auto;
}

/* ---------- 底部导航栏 ---------- */
.tabbar {
  position: fixed;
  bottom: 0;
  left: 0;
  right: 0;
  width: 100%;
  max-width: 520px;
  margin: 0 auto;
  height: calc(var(--tab-h) + env(safe-area-inset-bottom));
  padding-bottom: env(safe-area-inset-bottom);
  display: flex;
  background: rgba(255, 255, 255, .96);
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
  border-top: 1px solid var(--line);
  z-index: 50;
}
.tab {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 2px;
  background: none;
  border: 0;
  color: var(--muted);
  font-size: 11px;
  cursor: pointer;
}
.tab svg { width: 22px; height: 22px; }
.tab.active { color: var(--primary); font-weight: 600; }

/* ---------- 通用图标 ---------- */
.ic { width: 18px; height: 18px; vertical-align: -3px; }

/* ---------- 页面头部 ---------- */
.page-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 14px;
}
.ph-title { font-size: 22px; font-weight: 700; margin: 0; }
.ph-date { margin: 2px 0 0; font-size: 13px; color: var(--muted); }
.ph-lunar { margin: 2px 0 0; font-size: 12px; color: var(--primary-deep); }
.ph-actions { display: flex; gap: 8px; }
.page-head-row {
  display: flex; align-items: center; justify-content: space-between;
  margin-bottom: 14px;
}

/* ---------- 图标按钮 ---------- */
.icon-btn {
  width: 38px; height: 38px;
  border-radius: 50%;
  border: 1px solid var(--line);
  background: var(--card);
  color: var(--text);
  display: inline-flex; align-items: center; justify-content: center;
  cursor: pointer;
  box-shadow: 0 2px 8px rgba(0,0,0,.04);
}
.icon-btn:active { transform: scale(.94); }
.icon-btn svg { width: 19px; height: 19px; }
.icon-btn.primary { background: var(--primary); border-color: var(--primary); color: #fff; }

/* ---------- 卡片 ---------- */
.card {
  background: var(--card);
  border-radius: var(--radius);
  padding: 14px;
  box-shadow: var(--shadow);
  margin-bottom: 12px;
}
.card.plain { box-shadow: none; border: 1px solid var(--line); }

.section-title {
  font-size: 14px; font-weight: 700; color: var(--text);
  margin: 18px 0 10px;
  display: flex; align-items: center; gap: 6px;
}
.section-title::before {
  content: ""; width: 4px; height: 15px; border-radius: 3px;
  background: var(--primary); display: inline-block;
}
.sec-head { display: flex; align-items: center; justify-content: space-between; margin: 16px 0 8px; }
.sec-head .section-title { margin: 0; }

/* ---------- 标签 / 徽章 ---------- */
.chip {
  display: inline-flex; align-items: center; gap: 4px;
  padding: 2px 10px; border-radius: 999px;
  background: var(--primary-soft); color: var(--primary-deep);
  font-size: 12px; font-weight: 600;
}
.chip.gray { background: #f1eef0; color: var(--muted); }
.chip.amber { background: #fff3e0; color: #b4630a; }

/* ---------- 空状态 / 轻松的一句话 ---------- */
.empty {
  text-align: center;
  color: var(--muted);
  padding: 26px 10px;
  font-size: 14px;
}
.empty .big { font-size: 34px; color: #ffc9d8; display: block; margin-bottom: 8px; }

/* ---------- 首页：今日卡片 ---------- */
.today-card {
  background: linear-gradient(135deg, #ff6b9d, #ff9bb5);
  color: #fff;
  border-radius: var(--radius);
  padding: 16px;
  box-shadow: 0 8px 20px rgba(255, 107, 157, .35);
}
.today-card .tc-title { font-size: 13px; opacity: .9; font-weight: 600; }
.today-card .tc-list { margin-top: 8px; }
.today-card .tc-item {
  display: flex; align-items: center; gap: 8px;
  padding: 6px 0; font-size: 14px; font-weight: 600;
}
.today-card .tc-item svg { width: 17px; height: 17px; flex: none; }
.today-card .tc-empty { font-size: 14px; margin-top: 6px; opacity: .95; }

/* ---------- 即将到来列表 ---------- */
.up-list { display: flex; flex-direction: column; gap: 8px; }
.up-item {
  display: flex; align-items: center; gap: 10px;
  background: var(--card); border-radius: 14px;
  padding: 10px 12px; box-shadow: var(--shadow);
  cursor: pointer;
}
.up-item:active { transform: scale(.985); }
.up-icon {
  width: 38px; height: 38px; border-radius: 12px; flex: none;
  display: flex; align-items: center; justify-content: center; color: #fff;
}
.up-icon svg { width: 20px; height: 20px; }
.up-body { flex: 1; min-width: 0; }
.up-title { font-size: 14px; font-weight: 600; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.up-sub { font-size: 12px; color: var(--muted); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.up-days {
  flex: none; font-size: 12px; font-weight: 700; color: var(--primary-deep);
  background: var(--primary-soft); padding: 4px 8px; border-radius: 999px;
  white-space: nowrap;
}
.up-days.days-today { background: var(--primary); color: #fff; }
.up-days.days-soon { background: #fff0d6; color: #c0701a; }

/* ---------- 人物列表 ---------- */
.people-grid { display: flex; flex-direction: column; gap: 10px; }
.person-card {
  display: flex; align-items: center; gap: 12px;
  background: var(--card); border-radius: 14px; padding: 12px;
  box-shadow: var(--shadow); cursor: pointer;
}
.person-card:active { transform: scale(.985); }
.person-card .p-info { flex: 1; min-width: 0; }
.person-card .p-name { font-size: 16px; font-weight: 700; }
.person-card .p-sub { font-size: 12px; color: var(--muted); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.p-flag { flex: none; }

/* ---------- 头像 ---------- */
.avatar {
  width: 46px; height: 46px; border-radius: 50%; flex: none;
  object-fit: cover;
  display: flex; align-items: center; justify-content: center;
  font-size: 20px; font-weight: 700; color: #fff;
}
.avatar-sm { width: 36px; height: 36px; font-size: 15px; }
.avatar-lg { width: 76px; height: 76px; font-size: 32px; }

/* ---------- 人物详情 ---------- */
.detail-head {
  background: var(--card); border-radius: var(--radius);
  padding: 18px 16px; box-shadow: var(--shadow);
  display: flex; align-items: center; gap: 14px;
}
.d-name { font-size: 20px; font-weight: 800; margin: 0; }
.d-nick { font-size: 13px; color: var(--muted); margin: 2px 0 6px; }
.d-chips { display: flex; flex-wrap: wrap; gap: 6px; }
.d-actions { margin-left: auto; display: flex; gap: 8px; }

/* 键值列表（基本信息） */
.kv-row {
  display: flex; align-items: flex-start; gap: 10px;
  padding: 9px 0; border-bottom: 1px dashed var(--line); font-size: 14px;
}
.kv-row:last-child { border-bottom: 0; }
.kv-k { flex: none; width: 74px; color: var(--muted); }
.kv-v { flex: 1; word-break: break-all; }

/* 喜好标签 */
.like-chip {
  display: inline-flex; align-items: center; gap: 6px;
  background: var(--primary-soft); color: var(--primary-deep);
  border-radius: 999px; padding: 4px 12px; margin: 0 6px 6px 0;
  font-size: 13px;
}
.like-chip .lk { font-weight: 700; }

/* 特别的事（回忆） */
.memory-item {
  background: var(--card); border-radius: 14px; padding: 12px;
  box-shadow: var(--shadow); margin-bottom: 10px;
}
.memory-item .mem-top { display: flex; align-items: center; gap: 8px; margin-bottom: 4px; }
.memory-item .mem-date { font-size: 12px; color: var(--muted); }
.memory-item .mem-cat { font-size: 11px; color: #fff; background: var(--primary); border-radius: 999px; padding: 1px 8px; }
.memory-item .mem-cat.cat-talk { background: #5aa9e6; }
.memory-item .mem-title { font-size: 14px; font-weight: 600; }
.memory-item .mem-text { font-size: 13px; color: var(--text); margin-top: 2px; white-space: pre-wrap; }
.memory-item .mem-actions { display: flex; gap: 10px; justify-content: flex-end; margin-top: 6px; }
.mini-btn {
  background: none; border: 0; color: var(--muted); font-size: 12px;
  display: inline-flex; align-items: center; gap: 3px; cursor: pointer; padding: 2px;
}
.mini-btn.danger { color: var(--danger); }
.mini-btn svg { width: 14px; height: 14px; }

/* 事件列表 */
.ev-tabs { display: flex; gap: 8px; margin: 16px 0 10px; }
.tabbtn {
  flex: 1; padding: 8px; border-radius: 12px; border: 1px solid var(--line);
  background: var(--card); color: var(--muted); font-size: 13px; cursor: pointer; font-weight: 600;
}
.tabbtn.active { background: var(--primary-soft); color: var(--primary-deep); border-color: var(--primary-soft); }
.ev-item {
  background: var(--card); border-radius: 14px; padding: 12px;
  box-shadow: var(--shadow); margin-bottom: 10px;
}
.ev-top { display: flex; align-items: center; gap: 8px; margin-bottom: 4px; }
.ev-badge {
  font-size: 11px; color: #fff; border-radius: 999px; padding: 1px 9px; font-weight: 600;
}
.ev-title { font-size: 15px; font-weight: 700; }
.ev-sub { font-size: 12px; color: var(--muted); margin-top: 2px; }
.ev-note { font-size: 13px; color: var(--text); background: #fdf6f8; border-radius: 8px; padding: 6px 8px; margin-top: 6px; }
.ev-remind { margin-top: 6px; display: flex; flex-wrap: wrap; gap: 5px; }
.ev-actions { display: flex; gap: 10px; justify-content: flex-end; margin-top: 8px; }

/* ---------- 按钮 ---------- */
.btn {
  border: 0; border-radius: 12px; padding: 10px 16px;
  font-size: 14px; font-weight: 600; cursor: pointer;
  display: inline-flex; align-items: center; justify-content: center; gap: 6px;
}
.btn:active { transform: scale(.97); }
.btn-primary { background: var(--primary); color: #fff; }
.btn-ghost { background: var(--primary-soft); color: var(--primary-deep); }
.btn-danger { background: #fde8e8; color: var(--danger); }
.btn-block { width: 100%; padding: 13px; font-size: 15px; }
.btn svg { width: 17px; height: 17px; }

/* 悬浮新增按钮 */
.fab {
  position: fixed; right: calc((100% - 520px) / 2 + 18px);
  bottom: calc(var(--tab-h) + env(safe-area-inset-bottom) + 16px);
  width: 54px; height: 54px; border-radius: 50%;
  background: var(--primary); color: #fff; border: 0;
  box-shadow: 0 6px 18px rgba(255, 107, 157, .5);
  display: flex; align-items: center; justify-content: center; cursor: pointer;
  z-index: 40;
}
.fab svg { width: 26px; height: 26px; }
.fab:active { transform: scale(.92); }

/* ---------- 表单 ---------- */
.field { margin-bottom: 14px; }
.f-label { font-size: 13px; font-weight: 600; color: var(--muted); display: block; margin-bottom: 6px; }
.f-input, .f-select, .f-textarea {
  width: 100%; padding: 11px 12px;
  border: 1px solid var(--line); border-radius: 12px;
  background: #fff; outline: none;
}
.f-input:focus, .f-select:focus, .f-textarea:focus { border-color: var(--primary); box-shadow: 0 0 0 3px rgba(255,107,157,.12); }
.f-textarea { min-height: 80px; resize: vertical; }
.f-hint { font-size: 12px; color: var(--muted); margin-top: 6px; }
.f-row { display: flex; gap: 10px; }
.f-row .field { flex: 1; }

/* 复选框行 */
.f-check {
  display: flex; align-items: center; gap: 8px;
  padding: 8px 0; cursor: pointer; font-size: 14px;
}
.f-check input { width: 18px; height: 18px; accent-color: var(--primary); }

/* 开关（节日提醒） */
.switch-row {
  display: flex; align-items: center; gap: 10px;
  padding: 11px 4px; border-bottom: 1px dashed var(--line);
}
.switch-row:last-child { border-bottom: 0; }
.sw-info { flex: 1; }
.sw-name { font-size: 14px; font-weight: 600; }
.sw-desc { font-size: 12px; color: var(--muted); }
.switch {
  position: relative; width: 46px; height: 26px; flex: none; cursor: pointer;
}
.switch input { opacity: 0; width: 0; height: 0; }
.sw-track {
  position: absolute; inset: 0; border-radius: 999px; background: #e6dfe2;
  transition: .2s;
}
.sw-track::after {
  content: ""; position: absolute; left: 3px; top: 3px;
  width: 20px; height: 20px; border-radius: 50%; background: #fff;
  transition: .2s; box-shadow: 0 1px 3px rgba(0,0,0,.2);
}
.switch input:checked + .sw-track { background: var(--primary); }
.switch input:checked + .sw-track::after { left: 23px; }

/* 动态喜好编辑行 */
.like-row { display: flex; gap: 8px; margin-bottom: 8px; }
.like-row .f-select { flex: none; width: 96px; }
.like-row input { flex: 1; }

/* ---------- 底部弹层（sheet） ---------- */
.sheet-backdrop {
  position: fixed; inset: 0; background: rgba(60, 30, 40, .45);
  z-index: 100; display: flex; align-items: flex-end; justify-content: center;
  animation: fadeIn .2s;
}
.sheet {
  background: #fff; border-radius: 20px 20px 0 0;
  width: 100%; max-width: 520px;
  max-height: 88vh; overflow-y: auto;
  padding: 8px 18px calc(20px + env(safe-area-inset-bottom));
  animation: slideUp .25s;
}
.sheet-head {
  display: flex; align-items: center; justify-content: space-between;
  padding: 12px 0 8px; position: sticky; top: 0; background: #fff;
}
.sheet-title { font-size: 17px; font-weight: 700; }
.sheet-body { padding: 4px 0 12px; }
.sheet-foot { display: flex; gap: 10px; padding-top: 4px; }
.sheet-foot .btn { flex: 1; }
@keyframes fadeIn { from { opacity: 0; } to { opacity: 1; } }
@keyframes slideUp { from { transform: translateY(30px); opacity: 0; } to { transform: none; opacity: 1; } }

/* ---------- 轻提示 Toast ---------- */
#toast-root { position: fixed; top: 18px; left: 0; right: 0; display: flex; flex-direction: column; align-items: center; gap: 8px; z-index: 300; pointer-events: none; }
.toast-msg {
  background: rgba(60, 30, 40, .92); color: #fff;
  padding: 10px 18px; border-radius: 999px; font-size: 14px;
  box-shadow: 0 6px 20px rgba(0,0,0,.2);
  animation: toastIn .25s;
}
@keyframes toastIn { from { transform: translateY(-10px); opacity: 0; } to { transform: none; opacity: 1; } }

/* ---------- 页面内提醒横幅 ---------- */
.banner-root {
  position: fixed; top: 0; left: 0; right: 0; z-index: 200;
  display: flex; flex-direction: column; gap: 8px; align-items: center;
  padding: 10px 12px 0; pointer-events: none;
}
.banner {
  pointer-events: auto;
  background: #fff; border: 1px solid var(--primary-soft);
  border-radius: 14px; box-shadow: 0 8px 24px rgba(255,107,157,.25);
  padding: 10px 12px; width: 100%; max-width: 480px;
  display: flex; gap: 10px; align-items: center;
  animation: bannerIn .3s;
}
@keyframes bannerIn { from { transform: translateY(-20px); opacity: 0; } to { transform: none; opacity: 1; } }
.banner .b-ic { width: 34px; height: 34px; border-radius: 10px; background: var(--primary-soft); color: var(--primary-deep); display: flex; align-items: center; justify-content: center; flex: none; }
.banner .b-ic svg { width: 19px; height: 19px; }
.banner .b-body { flex: 1; min-width: 0; }
.banner .b-title { font-size: 13px; font-weight: 700; }
.banner .b-sub { font-size: 12px; color: var(--muted); }
.banner .b-close { color: var(--muted); background: none; border: 0; cursor: pointer; display: flex; }
.banner .b-close svg { width: 16px; height: 16px; }

/* ---------- 提醒中心 ---------- */
.rc-sec { font-size: 13px; font-weight: 700; color: var(--muted); margin: 14px 0 8px; }
.rc-item {
  display: flex; align-items: center; gap: 10px;
  padding: 9px 4px; border-bottom: 1px dashed var(--line);
}
.rc-item:last-child { border-bottom: 0; }
.rc-icon { width: 32px; height: 32px; border-radius: 9px; color: #fff; display: flex; align-items: center; justify-content: center; flex: none; }
.rc-icon svg { width: 17px; height: 17px; }
.rc-body { flex: 1; min-width: 0; }
.rc-title { font-size: 14px; font-weight: 600; }
.rc-sub { font-size: 12px; color: var(--muted); }
.rc-days { flex: none; font-size: 12px; font-weight: 700; color: var(--primary-deep); }

/* ---------- 设置页 ---------- */
.set-card .row-link { display: flex; align-items: center; gap: 10px; padding: 12px 2px; border-bottom: 1px dashed var(--line); cursor: pointer; }
.set-card .row-link:last-child { border-bottom: 0; }
.row-link svg { width: 19px; height: 19px; color: var(--primary-deep); }
.row-link .rl-body { flex: 1; }
.row-link .rl-title { font-size: 14px; font-weight: 600; }
.row-link .rl-desc { font-size: 12px; color: var(--muted); }
.install-card {
  background: linear-gradient(135deg, #ffe3ec, #fff3e0);
  border-radius: var(--radius); padding: 14px; margin-bottom: 12px;
}
.install-card .in-title { font-weight: 700; font-size: 15px; margin-bottom: 4px; }
.install-card .in-desc { font-size: 13px; color: var(--muted); }

/* 通知权限状态 */
.permit-card {
  border-radius: var(--radius); padding: 14px; margin-bottom: 12px;
  border: 1px solid var(--line); background: var(--card);
}
.permit-card .per-title { font-weight: 700; font-size: 15px; }
.permit-card .per-desc { font-size: 13px; color: var(--muted); margin: 4px 0 10px; }

/* 关于 */
.about { text-align: center; color: var(--muted); font-size: 12px; padding: 14px 0 30px; }

/* ---------- 桌面端微调（居中显示手机宽度） ---------- */
@media (min-width: 560px) {
  .view { padding-top: 24px; }
  .tabbar { border-radius: 16px 16px 0 0; }
}

/* ---------- 任务清单 ---------- */
.task-count {
  margin-left: 8px;
  font-size: 12px;
  color: var(--primary-deep);
  background: var(--primary-soft);
  border-radius: 999px;
  padding: 1px 8px;
  font-weight: 600;
}
.task-list { display: flex; flex-direction: column; gap: 8px; }

/* 首页简易任务行（整行可点打勾） */
.task-item {
  display: flex;
  align-items: center;
  gap: 10px;
  background: var(--card);
  border-radius: 14px;
  padding: 11px 12px;
  box-shadow: var(--shadow);
  cursor: pointer;
  font-size: 14px;
}
.task-item input[type="checkbox"] {
  width: 20px; height: 20px;
  accent-color: var(--primary);
  flex: none;
  cursor: pointer;
}
.task-item .task-title { flex: 1; }
.task-item .chip { flex: none; }

/* 任务页完整条目 */
.task-item.full { align-items: flex-start; }
.task-item.full .task-check-wrap { padding-top: 2px; }
.task-item.full .task-body { flex: 1; min-width: 0; }
.task-item.full .task-title { font-weight: 600; }
.task-item.full .task-title.done { text-decoration: line-through; color: var(--muted); }
.task-item.full .task-sub { font-size: 12px; color: var(--muted); margin-top: 2px; word-break: break-all; }
.task-item.full .task-actions { display: flex; gap: 8px; flex: none; }
