/* ===== 礼貌太太拍拍你 · H5 ===== */
:root {
  --bg: #F7EFDF;
  --bg2: #FDF8EE;
  --card: #FFFDF7;
  --ink: #4A3B2C;
  --ink-soft: #7A6A58;
  --accent: #C25E3C;      /* 太太的围裙色 */
  --accent-dark: #A84A2C;
  --brown: #8B6B4F;       /* 待办 */
  --red: #C0392B;         /* 已到点 */
  --green: #3E7C4F;       /* 已完成 */
  --gray: #A49A8D;        /* 已过 */
  --line: #EADFCC;
  --shadow: 0 6px 24px rgba(90, 62, 35, .08);
  --radius: 16px;
}

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

[hidden] { display: none !important; }

html, body { height: 100%; }

body {
  font-family: "Noto Sans SC", "PingFang SC", "Hiragino Sans GB", "Microsoft YaHei", system-ui, sans-serif;
  background: var(--bg);
  color: var(--ink);
  line-height: 1.55;
}

.app {
  max-width: 560px;
  margin: 0 auto;
  min-height: 100dvh;
  display: flex;
  flex-direction: column;
  background: linear-gradient(180deg, #F7EFDF 0%, #F4E9D6 100%);
  position: relative;
}

/* ===== 顶栏 ===== */
.topbar {
  display: flex; align-items: center; justify-content: space-between;
  padding: 18px 18px 12px;
}
.brand { display: flex; align-items: center; gap: 12px; }
.brand-avatar {
  width: 42px; height: 42px; border-radius: 50%;
  background: var(--accent); color: #FFF8EC;
  display: grid; place-items: center;
  box-shadow: var(--shadow); overflow: hidden; flex-shrink: 0;
}
.brand-avatar img { width: 100%; height: 100%; object-fit: cover; display: block; }
.brand h1 {
  font-family: "Noto Serif SC", serif;
  font-size: 17px; font-weight: 900; letter-spacing: .5px;
}
.brand p { font-size: 12px; color: var(--ink-soft); }

.icon-btn {
  border: none; background: none; color: var(--ink-soft);
  width: 38px; height: 38px; border-radius: 12px; cursor: pointer;
  display: grid; place-items: center;
}
.icon-btn:active { background: rgba(90, 62, 35, .1); }

/* ===== 内容区 ===== */
.content { flex: 1; padding: 4px 14px 90px; }
.view { animation: fadeIn .18s ease; }
@keyframes fadeIn { from { opacity: 0; transform: translateY(4px); } to { opacity: 1; } }

/* ===== 周视图 ===== */
.week-strip {
  background: var(--card); border: 1px solid var(--line); border-radius: var(--radius);
  padding: 10px; margin-bottom: 16px; box-shadow: var(--shadow);
}
.week-nav { display: flex; align-items: center; gap: 8px; margin-bottom: 8px; }
.week-range { flex: 1; text-align: center; font-size: 12.5px; font-weight: 700; color: var(--ink-soft); }
.week-grid { display: grid; grid-template-columns: repeat(7, 1fr); gap: 6px; }
.week-day {
  display: flex; flex-direction: column; align-items: center; gap: 2px;
  padding: 8px 2px; border-radius: 12px; cursor: pointer; color: var(--ink-soft);
  transition: background .12s;
}
.week-day .wd { font-size: 11px; }
.week-day .wn { font-size: 15px; font-weight: 700; }
.week-day .wc {
  font-size: 9px; font-weight: 700; min-width: 14px; height: 14px;
  border-radius: 7px; background: var(--accent); color: #FFF8EC;
  display: grid; place-items: center; padding: 0 3px; line-height: 1;
}
.week-day.sel .wc { background: #FFF8EC; color: var(--accent); }
.week-day .wc:empty { display: none; }
.week-day.today .wd { color: var(--accent); font-weight: 700; }
.week-day.sel { background: var(--accent); color: #FFF8EC; }
.week-day.sel.today .wd { color: #FFE9D2; }
.week-day:active { transform: scale(.96); }

.day-head { display: flex; align-items: baseline; justify-content: space-between; margin: 4px 2px 12px; }
.day-head h2 { font-family: "Noto Serif SC", serif; font-size: 20px; font-weight: 900; }
.day-stats { font-size: 12.5px; color: var(--ink-soft); }

/* ===== 任务列表 ===== */
.task-list { display: flex; flex-direction: column; gap: 10px; }
.task-row {
  display: flex; align-items: center; gap: 12px;
  background: var(--card); border: 1px solid var(--line); border-radius: var(--radius);
  padding: 13px 14px; box-shadow: var(--shadow);
  transition: transform .1s;
}
.task-row:active { transform: scale(.985); }
.task-time {
  font-family: "Noto Serif SC", serif;
  font-size: 18px; font-weight: 700; color: var(--ink);
  min-width: 52px;
}
.task-main { flex: 1; min-width: 0; }
.task-title { font-size: 15px; font-weight: 500; word-break: break-all; }
.task-meta { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 5px; align-items: center; }
.chip {
  font-size: 10.5px; padding: 2px 8px; border-radius: 999px;
  background: #F1E7D6; color: var(--ink-soft); white-space: nowrap;
}
.chip.remind { background: #FBE9D8; color: var(--accent-dark); }
.chip.repeat { background: #E9E2F5; color: #6B5B95; }

.status { font-size: 11px; font-weight: 700; padding: 3px 9px; border-radius: 999px; white-space: nowrap; }
.status.pending { background: #F1E4D3; color: var(--brown); }
.status.arrived { background: #FADDD8; color: var(--red); }
.status.done { background: #DEEEDF; color: var(--green); }
.status.passed { background: #EFECE6; color: var(--gray); }

.task-done { border-color: #D8E5D6; background: #F6FBF3; }
.task-done .task-title { color: var(--green); text-decoration: line-through; text-decoration-thickness: 1.5px; }
.task-done .task-time { color: var(--green); }

.task-actions { display: flex; gap: 6px; }
.btn-icon {
  border: 1.5px solid var(--line); background: var(--bg2); color: var(--ink-soft);
  width: 34px; height: 34px; border-radius: 12px; cursor: pointer;
  display: grid; place-items: center; font-size: 16px; line-height: 1;
}
.btn-icon:active { transform: scale(.92); }
.btn-icon.check { color: var(--green); }
.btn-icon.done { background: var(--green); border-color: var(--green); color: #fff; }
.btn-icon.del:active { color: var(--red); border-color: var(--red); }

.empty { text-align: center; padding: 56px 20px; color: var(--ink-soft); }
.empty p { font-family: "Noto Serif SC", serif; font-size: 17px; font-weight: 700; }
.empty .empty-sub { font-family: "Noto Sans SC", sans-serif; font-size: 13px; font-weight: 400; margin-top: 8px; color: var(--gray); }

/* ===== 月历 ===== */
.cal-toolbar { display: flex; align-items: center; gap: 10px; margin-bottom: 12px; }
.cal-toolbar h2 { font-family: "Noto Serif SC", serif; font-size: 19px; font-weight: 900; flex: 1; }
.cal-nav {
  border: 1px solid var(--line); background: var(--card); color: var(--ink);
  width: 36px; height: 36px; border-radius: 12px; font-size: 20px; cursor: pointer;
  display: grid; place-items: center;
}
.cal-nav:active { background: var(--line); }
.cal-today {
  border: 1.5px solid var(--accent); background: transparent; color: var(--accent);
  font-size: 12.5px; font-weight: 700; padding: 7px 13px; border-radius: 999px; cursor: pointer;
}
.cal-today:active { background: #FBE9D8; }

.cal-stats {
  display: flex; gap: 8px; flex-wrap: wrap; margin-bottom: 12px;
  font-size: 12px; color: var(--ink-soft);
}
.cal-stats b { color: var(--ink); font-weight: 700; }

.cal-weekday {
  display: grid; grid-template-columns: repeat(7, 1fr); text-align: center;
  font-size: 11.5px; color: var(--ink-soft); margin-bottom: 6px;
}
.cal-grid {
  display: grid; grid-template-columns: repeat(7, 1fr); gap: 5px;
  background: var(--card); border: 1px solid var(--line); border-radius: var(--radius);
  padding: 10px; box-shadow: var(--shadow);
}
.cal-cell {
  min-height: 62px; min-width: 0; border-radius: 10px; padding: 4px 3px;
  cursor: pointer; display: flex; flex-direction: column; gap: 2px;
  background: var(--bg2); border: 1px solid transparent; position: relative; overflow: hidden;
}
.cal-cell.other { background: transparent; }
.cal-cell:hover { border-color: var(--line); }
.cal-cell.sel { border-color: var(--accent); background: #FDF1E2; }
.cal-cell.today-cell { outline: 2px solid var(--accent); outline-offset: -2px; }
.cal-num { font-size: 12px; font-weight: 700; color: var(--ink); }
.cal-cell.other .cal-num { color: var(--gray); opacity: .55; }
.cal-cell.today-cell .cal-num { color: var(--accent); }
.cal-item {
  font-size: 9.5px; padding: 1px 4px; border-radius: 5px; overflow: hidden;
  text-overflow: ellipsis; white-space: nowrap; line-height: 1.6;
}
.cal-item.pending { background: #F1E4D3; color: var(--brown); }
.cal-item.arrived { background: #FADDD8; color: var(--red); }
.cal-item.done { background: #DEEEDF; color: var(--green); text-decoration: line-through; }
.cal-item.passed { background: #EFECE6; color: var(--gray); }
.cal-more { font-size: 9.5px; color: var(--accent-dark); font-weight: 700; padding-left: 4px; }

.cal-detail {
  margin-top: 14px; background: var(--card); border: 1px solid var(--line);
  border-radius: var(--radius); padding: 14px; box-shadow: var(--shadow);
}
.cal-detail-head { display: flex; align-items: center; justify-content: space-between; margin-bottom: 12px; }
.cal-detail-head h3 { font-family: "Noto Serif SC", serif; font-size: 16px; font-weight: 900; }

/* ===== 设置 ===== */
.setting-card {
  background: var(--card); border: 1px solid var(--line); border-radius: var(--radius);
  padding: 16px; margin-bottom: 14px; box-shadow: var(--shadow);
}
.setting-card h3 {
  font-family: "Noto Serif SC", serif; font-size: 14.5px; font-weight: 900;
  margin-bottom: 12px; color: var(--accent-dark);
}
.field { display: flex; flex-direction: column; gap: 5px; margin-bottom: 12px; }
.field > span { font-size: 12.5px; color: var(--ink-soft); }
.field.row { flex-direction: row; align-items: center; justify-content: space-between; }
.field input[type=text], .field input[type=time], .field select {
  border: 1.5px solid var(--line); background: var(--bg2); border-radius: 10px;
  padding: 10px 12px; font-size: 14px; color: var(--ink); font-family: inherit;
}
.field input:focus, .field select:focus { outline: 2px solid #E8C9A9; border-color: var(--accent); }

.switch { position: relative; width: 46px; height: 26px; flex-shrink: 0; }
.switch input { opacity: 0; width: 0; height: 0; }
.switch i {
  position: absolute; inset: 0; background: #D8CDBA; border-radius: 999px; cursor: pointer; transition: .2s;
}
.switch i::after {
  content: ""; position: absolute; width: 20px; height: 20px; border-radius: 50%;
  background: #fff; top: 3px; left: 3px; transition: .2s; box-shadow: 0 1px 3px rgba(0,0,0,.2);
}
.switch input:checked + i { background: var(--green); }
.switch input:checked + i::after { transform: translateX(20px); }

.act-status {
  font-size: 13px; padding: 10px 12px; border-radius: 10px; margin-bottom: 10px;
  background: #F1E4D3; color: var(--brown); font-weight: 500;
}
.act-status.ok { background: #DEEEDF; color: var(--green); }
.act-row { display: flex; gap: 8px; }
.act-row input {
  flex: 1; border: 1.5px solid var(--line); background: var(--bg2); border-radius: 10px;
  padding: 10px 12px; font-size: 14px; color: var(--ink); font-family: inherit; letter-spacing: .5px;
}
.act-row input:focus { outline: 2px solid #E8C9A9; border-color: var(--accent); }
.hint { font-size: 12px; color: var(--gray); margin-top: 10px; }
.link { color: var(--accent-dark); font-weight: 500; }

.btn { border: none; cursor: pointer; font-family: inherit; font-weight: 700; }
.btn.primary {
  background: var(--accent); color: #FFF8EC; padding: 10px 18px; border-radius: 12px; font-size: 14px;
}
.btn.primary:active { background: var(--accent-dark); }
.btn.block { width: 100%; padding: 13px; border-radius: 14px; font-size: 15px; }

/* ===== 底部导航 ===== */
.tabbar {
  position: fixed; bottom: 0; left: 0; right: 0;
  max-width: 560px; margin: 0 auto;
  display: flex; background: rgba(255, 253, 247, .96);
  border-top: 1px solid var(--line); padding: 8px 10px calc(10px + env(safe-area-inset-bottom));
  backdrop-filter: blur(8px); z-index: 20;
}
.tab {
  flex: 1; border: none; background: none; cursor: pointer;
  display: flex; flex-direction: column; align-items: center; gap: 3px;
  color: var(--gray); font-size: 11px; font-weight: 500; padding: 4px 0; border-radius: 10px;
}
.tab.active { color: var(--accent); font-weight: 700; }

/* ===== 遮罩 / Toast ===== */
.overlay {
  position: fixed; inset: 0; background: rgba(58, 40, 22, .55);
  display: grid; place-items: center; z-index: 50; padding: 24px;
  backdrop-filter: blur(4px);
}
.overlay-card {
  background: var(--card); border-radius: 20px; padding: 28px 24px; max-width: 380px; width: 100%;
  text-align: center; box-shadow: 0 20px 60px rgba(0,0,0,.25);
}
.overlay-icon { font-size: 44px; margin-bottom: 8px; }
.overlay-card h2 { font-family: "Noto Serif SC", serif; font-size: 19px; font-weight: 900; margin-bottom: 8px; }
.overlay-card p { font-size: 13px; color: var(--ink-soft); margin-bottom: 16px; }
.overlay-card input {
  width: 100%; border: 1.5px solid var(--line); background: var(--bg2); border-radius: 12px;
  padding: 12px; font-size: 15px; text-align: center; letter-spacing: 1px; margin-bottom: 12px;
  font-family: inherit; color: var(--ink);
}
.overlay-card input:focus { outline: 2px solid #E8C9A9; border-color: var(--accent); }
.overlay-error { color: var(--red); font-size: 12.5px; min-height: 18px; margin: 8px 0 0; }

.toast {
  position: fixed; bottom: 86px; left: 50%; transform: translateX(-50%);
  background: rgba(58, 40, 22, .92); color: #FFF8EC; font-size: 13px;
  padding: 10px 18px; border-radius: 999px; z-index: 60; max-width: 86%;
  box-shadow: 0 8px 24px rgba(0,0,0,.25);
}

@media (min-width: 700px) {
  .app { min-height: 100vh; }
}
