* { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }
html, body { margin: 0; padding: 0; font-family: -apple-system, "PingFang SC", "Microsoft YaHei", sans-serif; background: #fdf6ec; color: #4a3f35; }
.view { min-height: 100vh; display: flex; flex-direction: column; }
.muted { color: #b0a294; font-size: 12px; }

/* 登录 */
#view-login { justify-content: center; align-items: center; padding: 24px; }
.login-box { width: 100%; max-width: 340px; background: #fff; border-radius: 18px; padding: 28px 22px; box-shadow: 0 8px 30px rgba(120,90,50,.12); }
.logo { font-size: 22px; text-align: center; margin: 0 0 4px; }
.sub { text-align: center; color: #b0a294; font-size: 13px; margin: 0 0 22px; }
.field { margin-bottom: 12px; }
.field input { width: 100%; padding: 12px 14px; border: 1px solid #e8ddcd; border-radius: 10px; font-size: 15px; background: #fdf9f2; outline: none; }
.field input:focus { border-color: #e0a76f; }
.btn { border: none; border-radius: 10px; padding: 12px; font-size: 15px; cursor: pointer; width: 100%; }
.btn.primary { background: #e8a763; color: #fff; }
.btn.primary:active { background: #d8914b; }
.btn.ghost { background: #f5eee2; color: #8a6d4a; }
.btn.danger-ghost { background: #fbece8; color: #c96a5a; }
.switch { text-align: center; margin-top: 14px; font-size: 13px; color: #b0a294; }
.switch a { color: #e0a76f; cursor: pointer; }
.msg { text-align: center; color: #c96a5a; font-size: 13px; min-height: 18px; margin-top: 10px; }

/* 主框架 */
#view-app { max-width: 640px; margin: 0 auto; width: 100%; }
.topbar { position: sticky; top: 0; z-index: 20; display: flex; align-items: center; justify-content: space-between; padding: 12px 14px; background: #fdf6ec; border-bottom: 1px solid #f0e6d6; }
.app-title { font-weight: 600; font-size: 16px; }
.top-actions { display: flex; align-items: center; gap: 8px; }
.top-actions input { padding: 8px 12px; border: 1px solid #e8ddcd; border-radius: 20px; font-size: 13px; background: #fff; width: 120px; outline: none; }
.icon-btn { border: none; background: none; font-size: 18px; cursor: pointer; color: #8a6d4a; padding: 4px 8px; }
.tab { flex: 1; padding: 14px 14px 90px; overflow-y: auto; }

/* 日历 */
.cal-header { display: flex; align-items: center; justify-content: space-between; margin-bottom: 10px; }
.cal-title { font-weight: 600; font-size: 16px; }
.cal-grid { display: grid; grid-template-columns: repeat(7, 1fr); gap: 4px; background: #fff; border-radius: 14px; padding: 10px; }
.cal-grid .wd { text-align: center; font-size: 11px; color: #b0a294; padding: 4px 0; }
.cal-day { text-align: center; padding: 8px 0; border-radius: 10px; font-size: 14px; cursor: pointer; position: relative; }
.cal-day.other { color: #ddd3c3; }
.cal-day.today { background: #fdf0dc; font-weight: 600; }
.cal-day.has { background: #e8a763; color: #fff; font-weight: 600; }
.cal-day.has.today { background: #c97f2e; }
.cal-day.sel { outline: 2px solid #c97f2e; }
.day-head { display: flex; justify-content: space-between; align-items: baseline; margin: 18px 4px 8px; font-weight: 600; }
#day-list .diary-item { background: #fff; border-radius: 12px; padding: 12px 14px; margin-bottom: 10px; box-shadow: 0 2px 8px rgba(120,90,50,.06); cursor: pointer; }
.diary-item .t { font-weight: 600; font-size: 15px; margin-bottom: 4px; }
.diary-item .c { color: #8a7a68; font-size: 13px; overflow: hidden; text-overflow: ellipsis; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; }
.diary-item .meta { color: #b0a294; font-size: 11px; margin-top: 6px; display: flex; gap: 8px; align-items: center; flex-wrap: wrap; }
.diary-item .thumbs { display: flex; gap: 4px; margin-top: 6px; }
.diary-item .thumbs img { width: 48px; height: 48px; object-fit: cover; border-radius: 8px; }
.empty { text-align: center; color: #c4b7a5; padding: 30px 0; font-size: 14px; }

/* 编辑器 */
.editor { display: flex; flex-direction: column; gap: 12px; }
.ed-date { padding: 10px; border: 1px solid #e8ddcd; border-radius: 10px; font-size: 14px; background: #fff; color: #4a3f35; }
#ed-title { padding: 12px 14px; border: 1px solid #e8ddcd; border-radius: 10px; font-size: 16px; font-weight: 600; background: #fff; outline: none; }
#ed-content { min-height: 200px; padding: 12px 14px; border: 1px solid #e8ddcd; border-radius: 10px; font-size: 15px; line-height: 1.7; background: #fff; outline: none; resize: vertical; }
.mood-row { display: flex; justify-content: space-between; padding: 6px 4px; }
.mood { font-size: 26px; cursor: pointer; opacity: .35; filter: grayscale(.4); transition: .2s; }
.mood.active { opacity: 1; filter: none; transform: scale(1.15); }
.tag-row input { padding: 10px 12px; border: 1px solid #e8ddcd; border-radius: 10px; font-size: 13px; background: #fff; width: 100%; outline: none; }
.imgs { display: flex; gap: 8px; flex-wrap: wrap; }
.imgs .thumb { position: relative; }
.imgs .thumb img { width: 76px; height: 76px; object-fit: cover; border-radius: 10px; }
.imgs .thumb .x { position: absolute; top: -6px; right: -6px; background: #c96a5a; color: #fff; width: 20px; height: 20px; border-radius: 50%; text-align: center; line-height: 20px; font-size: 12px; cursor: pointer; }
.edit-actions { display: flex; gap: 10px; }

/* 统计 */
.stats-cards { display: flex; gap: 12px; }
.stats-cards .card { flex: 1; background: #fff; border-radius: 14px; text-align: center; padding: 18px 0; box-shadow: 0 2px 8px rgba(120,90,50,.06); }
.card .num { font-size: 26px; font-weight: 700; color: #e0a76f; }
.card .label { color: #b0a294; font-size: 12px; margin-top: 4px; }
.stat-block { background: #fff; border-radius: 14px; padding: 14px; margin-top: 12px; }
.stat-block h3 { margin: 0 0 10px; font-size: 14px; color: #8a6d4a; }
.mood-bar { display: flex; gap: 6px; }
.mood-bar .seg { flex: 1; text-align: center; }
.mood-bar .bar { height: 60px; background: #f5eee2; border-radius: 6px; overflow: hidden; position: relative; }
.mood-bar .fill { position: absolute; bottom: 0; left: 0; right: 0; background: #e8a763; border-radius: 6px; }
.mood-bar .lbl { font-size: 11px; color: #b0a294; margin-top: 4px; }
.month-list { font-size: 13px; }
.month-list .row { display: flex; justify-content: space-between; padding: 6px 0; border-bottom: 1px dashed #f0e6d6; }

/* 底部导航 */
.bottom-nav { position: fixed; bottom: 0; left: 50%; transform: translateX(-50%); width: 100%; max-width: 640px; display: flex; background: #fff; border-top: 1px solid #f0e6d6; z-index: 30; padding: 8px 0; padding-bottom: calc(8px + env(safe-area-inset-bottom)); }
.nav-item { flex: 1; text-align: center; font-size: 12px; color: #b0a294; padding: 4px 0; cursor: pointer; }
.nav-item.active { color: #e0a76f; font-weight: 600; }

/* 搜索高亮列表 */
.search-result .diary-item { background: #fff; border-radius: 12px; padding: 12px 14px; margin-bottom: 10px; cursor: pointer; }
