/* 健康康康 · 宝宝记录 —— 界面样式（粉色主题，移动优先） */
:root{
  --brand-900:#831843; --brand-700:#be185d;
  --brand-600:#db2777; --brand-500:#ec4899; --brand-100:#fce7f3;
  --bg:#fdf4f7; --card:#ffffff; --ink:#2a1620; --muted:#8f6b7c;
  --line:#f6e3ec; --line-strong:#f1d8e5;
  --feed:#db2777; --feed-bg:#fce7f3;
  --diaper:#d97706; --diaper-bg:#fdf3e3;
  --sleep:#7c6ce0; --sleep-bg:#f0edfd;
  --med:#0891b2; --med-bg:#e0f2fe;
  --vac:#059669; --vac-bg:#d9f2e6;
  --danger:#dc2626;
  --shadow:0 1px 2px rgba(80,20,50,.05), 0 8px 24px -18px rgba(80,20,50,.35);
}
*{box-sizing:border-box; margin:0; padding:0;}
[hidden]{display:none !important;}
body{
  min-height:100vh;
  font-family:-apple-system,BlinkMacSystemFont,"PingFang SC","Microsoft YaHei",system-ui,sans-serif;
  background:var(--bg); color:var(--ink);
  -webkit-tap-highlight-color:transparent;
  -webkit-font-smoothing:antialiased;
  font-size:15px;
}
button{font-family:inherit; cursor:pointer; border:0; background:none; color:inherit;}
input,textarea{font-family:inherit; font-size:16px; color:inherit;}
.boot{padding:120px 0; text-align:center; color:var(--muted); font-size:14px;}

.wrap{max-width:560px; margin:0 auto;
  padding:env(safe-area-inset-top) 16px calc(env(safe-area-inset-bottom) + 28px);}

/* ---------- 顶栏（仅「全部记录」页使用） ---------- */
.topbar{
  background:linear-gradient(165deg,var(--brand-900),var(--brand-600) 82%);
  color:#fff;
  padding:calc(env(safe-area-inset-top) + 18px) 0 16px;
}
.topbar-inner{max-width:560px; margin:0 auto; padding:0 16px;
  display:flex; align-items:center; justify-content:space-between; gap:12px;}
.brand{font-size:18px; font-weight:700; letter-spacing:1px;}
.brand-sub{font-size:11px; opacity:.75; letter-spacing:2px; margin-top:3px; text-transform:uppercase;}
.topbar .ghost{
  font-size:13px; padding:6px 12px; border-radius:999px;
  background:rgba(255,255,255,.15); border:1px solid rgba(255,255,255,.28); color:#fff;
}

/* ---------- 首页 ---------- */
.page-date{font-size:20px; font-weight:700; margin:18px 2px 2px;}
.page-date small{font-size:12.5px; color:var(--muted); font-weight:400; margin-left:8px;}

.actions{display:grid; grid-template-columns:repeat(2,1fr); gap:12px; margin-top:14px;}
/* 卡片数为奇数时，最后一张占满整行（如「更多」页只有「疫苗」时） */
.actions .action-card:last-child:nth-child(odd){grid-column:1/-1;}

/* 首页功能卡：左右无极滑动（首尾克隆循环） */
.pager{
  overflow-x:auto; overflow-y:hidden;
  scroll-snap-type:x mandatory; overscroll-behavior-x:contain;
  -webkit-overflow-scrolling:touch; scrollbar-width:none;
}
.pager::-webkit-scrollbar{display:none;}
.pager-track{display:flex;}
.pager-page{flex:0 0 100%; scroll-snap-align:start; display:flex; flex-direction:column; justify-content:center;}
.pager-dots{display:flex; justify-content:center; align-items:center; gap:7px; margin-top:12px;}
.pager-dots .dot{
  width:8px; height:8px; border-radius:50%; background:#eccfdd;
  transition:width .2s ease, background .2s ease;
}
.pager-dots .dot.on{width:18px; border-radius:4px; background:var(--brand-600);}
.action-card{
  background:var(--card); border-radius:18px; padding:16px 8px 13px;
  text-align:center; box-shadow:var(--shadow); border:1px solid var(--line);
}
.action-card:active{transform:translateY(1px);}
.action-emoji{
  width:52px; height:52px; margin:0 auto 8px; border-radius:16px;
  display:flex; align-items:center; justify-content:center; font-size:26px;
}
.action-card.feed .action-emoji{background:var(--feed-bg);}
.action-card.diaper .action-emoji{background:var(--diaper-bg);}
.action-card.sleep .action-emoji{background:var(--sleep-bg);}
.action-card.med .action-emoji{background:var(--med-bg);}
.action-card.vaccine .action-emoji{background:var(--vac-bg);}
.action-name{font-size:14.5px; font-weight:600;}
.action-last{font-size:11.5px; color:var(--muted); margin-top:5px; line-height:1.45;}

.running{
  margin-top:14px; background:var(--sleep-bg); border:1px solid #ddd6f8;
  border-radius:18px; padding:14px 16px; display:flex; align-items:center;
  justify-content:space-between; gap:12px;
}
.running .r-main{display:flex; align-items:center; gap:10px; font-size:14px;}
.running .pulse{
  width:10px; height:10px; border-radius:50%; background:var(--sleep);
  box-shadow:0 0 0 0 rgba(124,108,224,.5); animation:pulse 2s infinite;
}
@keyframes pulse{
  0%{box-shadow:0 0 0 0 rgba(124,108,224,.45);}
  70%{box-shadow:0 0 0 10px rgba(124,108,224,0);}
  100%{box-shadow:0 0 0 0 rgba(124,108,224,0);}
}
.running .r-time{font-weight:700; font-variant-numeric:tabular-nums;}
.btn-wake{
  background:var(--sleep); color:#fff; font-size:13.5px; font-weight:600;
  padding:9px 16px; border-radius:999px; white-space:nowrap;
}

.card{background:var(--card); border-radius:18px; padding:16px; margin-top:14px;
  box-shadow:var(--shadow); border:1px solid var(--line);}
.card-title{font-size:14px; font-weight:700; display:flex; justify-content:space-between; align-items:center;}
.card-title .more{font-size:12.5px; color:var(--brand-700); font-weight:500;}

.sum-rows{margin-top:10px;}
.sum-row{display:flex; align-items:center; justify-content:space-between;
  padding:10px 0; border-bottom:1px solid var(--line); font-size:14px;}
.sum-row:last-child{border-bottom:0; padding-bottom:2px;}
.sum-row .k{color:var(--muted); display:flex; align-items:center; gap:8px;}
.sum-row .v{font-weight:600; font-variant-numeric:tabular-nums;}

/* ---------- 记录列表 ---------- */
.rec-list{margin-top:6px;}
.rec-row{
  display:flex; align-items:center; gap:12px; padding:12px 0;
  border-bottom:1px solid var(--line); width:100%; text-align:left;
}
.rec-row:last-child{border-bottom:0;}
.rec-emoji{
  width:40px; height:40px; border-radius:13px; flex:none;
  display:flex; align-items:center; justify-content:center; font-size:19px;
}
.rec-emoji.feed{background:var(--feed-bg);}
.rec-emoji.diaper{background:var(--diaper-bg);}
.rec-emoji.sleep{background:var(--sleep-bg);}
.rec-emoji.med{background:var(--med-bg);}
.rec-emoji.vaccine{background:var(--vac-bg);}
.rec-main{flex:1; min-width:0;}
.rec-title{display:block; font-size:14px; font-weight:600;}
.rec-sub{display:block; font-size:12px; color:var(--muted); margin-top:3px; overflow:hidden;
  text-overflow:ellipsis; white-space:nowrap;}
.rec-time{font-size:12.5px; color:var(--muted); text-align:right; flex:none; line-height:1.5;}
.badge-pending{
  display:inline-block; font-size:10.5px; color:#b45309; background:#fef3c7;
  border-radius:999px; padding:1.5px 7px; margin-left:6px; vertical-align:1px;
}
.empty{padding:26px 0; text-align:center; color:var(--muted); font-size:13.5px;}

.day-head{font-size:12.5px; color:var(--muted); padding:14px 2px 4px; font-weight:600;}

/* ---------- 筛选 chips ---------- */
.filters{display:flex; gap:8px; margin-top:14px; overflow-x:auto; padding-bottom:2px;}
.chip{
  flex:none; padding:8px 15px; border-radius:999px; font-size:13.5px;
  background:#fff; border:1px solid var(--line-strong); color:var(--ink);
}
.chip.on{background:var(--brand-600); border-color:var(--brand-600); color:#fff; font-weight:600;}

.offline-bar{
  margin-top:14px; background:#fff7ed; border:1px solid #fed7aa; color:#9a3412;
  border-radius:14px; padding:10px 14px; font-size:13px; line-height:1.5;
}

/* ---------- 顶部滚动公告（游戏公告式跑马灯） ---------- */
.notice-bar{
  display:flex; align-items:center; gap:8px;
  margin-top:14px; padding:9px 12px; border-radius:12px;
  background:linear-gradient(90deg,#fdeef4,#fbe0ec);
  border:1px solid #f5d3e4; color:#a61e5c; font-size:13px; overflow:hidden;
}
.notice-icon{flex:none; font-size:14px;}
.notice-scroll{flex:1; min-width:0; overflow:hidden; white-space:nowrap;}
.notice-track{display:inline-block; white-space:nowrap;
  animation:notice-scroll linear infinite; will-change:transform;}
.notice-unit{display:inline-block;}
@keyframes notice-scroll{from{transform:translateX(0);} to{transform:translateX(-50%);}}
.notice-edit{flex:none; font-size:13px; opacity:.65;}
@media (prefers-reduced-motion: reduce){ .notice-track{animation:none;} }
.hint-note{margin:10px 4px 0; font-size:12.5px; color:#b394a3; line-height:1.6;}

/* ---------- 底部抽屉表单 ---------- */
.backdrop{
  position:fixed; inset:0; background:rgba(60,20,40,.45); z-index:40;
  opacity:0; transition:opacity .22s ease;
}
.backdrop.open{opacity:1;}
.sheet{
  position:fixed; left:0; right:0; bottom:0; z-index:41;
  background:#fdf5f8; border-radius:22px 22px 0 0;
  max-height:92vh; display:flex; flex-direction:column;
  transform:translateY(100%); transition:transform .26s cubic-bezier(.2,.8,.3,1);
  padding-bottom:env(safe-area-inset-bottom);
}
.sheet.open{transform:translateY(0);}
.sheet-head{padding:14px 16px 6px; text-align:center; position:relative; flex:none;}
.sheet-handle{width:40px; height:4px; border-radius:2px; background:#ecd3de; margin:0 auto 10px;}
.sheet-title{font-size:17px; font-weight:700;}
.sheet-chip{
  display:inline-flex; align-items:center; gap:6px; margin-top:8px;
  background:#fdeef4; color:var(--brand-700); font-size:12.5px;
  border-radius:999px; padding:5px 12px;
}
.sheet-chip.warn{background:#fdeaea; color:#b91c1c;}
.sheet-close{
  position:absolute; right:12px; top:12px; width:32px; height:32px;
  border-radius:50%; background:#f7e8ef; color:var(--muted); font-size:16px; line-height:1;
}
.sheet-body{overflow-y:auto; padding:6px 14px 12px; -webkit-overflow-scrolling:touch;}
.sheet-foot{
  flex:none; display:flex; gap:10px; padding:10px 14px 14px;
  background:linear-gradient(to top, #fdf5f8 75%, rgba(253,245,248,0));
}
.btn-cancel{
  flex:1; padding:14px; border-radius:14px; background:#f7e8ef;
  color:#6b4559; font-size:15.5px; font-weight:600;
}
.btn-primary{
  flex:2; padding:14px; border-radius:14px; font-size:15.5px; font-weight:700; color:#fff;
  background:linear-gradient(165deg,var(--brand-700),var(--brand-500));
  box-shadow:0 10px 20px -12px rgba(190,24,93,.75);
}
.btn-primary:disabled{opacity:.55;}
.btn-danger{
  flex:1; padding:14px; border-radius:14px; background:#fdeaea;
  color:var(--danger); font-size:15.5px; font-weight:600;
}

.f-card{background:#fff; border-radius:16px; padding:14px 15px; margin-top:10px;
  border:1px solid var(--line);}
.f-label{font-size:13.5px; color:var(--muted); margin-bottom:10px;}
.f-label .opt{font-size:12px; color:#bb9aab;}
.f-row{display:flex; align-items:center; justify-content:space-between; gap:12px;}
.f-row .f-key{font-size:14.5px;}
.f-row .f-key .opt{display:block; font-size:12px; color:#bb9aab; font-weight:400; margin-top:3px;}
.f-row input[type="datetime-local"]{
  border:0; background:none; text-align:right; color:var(--ink); font-size:14.5px;
  padding:4px 0;
}
.f-value{font-size:14.5px; font-weight:600;}

/* 分段选择（奶瓶/亲喂） */
.seg{display:flex; gap:26px; justify-content:center; padding:2px 0 4px;}
.seg button{font-size:17px; font-weight:600; color:#bb9aab; padding:6px 2px; position:relative;}
.seg button.on{color:var(--brand-700);}
.seg button.on::after{
  content:""; position:absolute; left:18%; right:18%; bottom:0; height:3px;
  border-radius:2px; background:var(--brand-600);
}

/* 选项 chips 组 */
.chips{display:flex; flex-wrap:wrap; gap:10px;}
.chips .chip{padding:11px 0; flex:1; min-width:88px; text-align:center; font-size:14.5px;}
.chips .chip.on{background:var(--brand-600); color:#fff; border-color:var(--brand-600);}

/* 文本输入（药品名称/剂量） */
.f-input{
  width:100%; border:0; background:none; outline:none; padding:4px 0;
  font-size:16px; margin-top:12px;
}
.f-input::placeholder{color:#c9aebc;}

/* 奶量步进器 */
.stepper{display:flex; align-items:center; justify-content:center; gap:18px; padding:6px 0 2px;}
.stepper button{
  width:54px; height:54px; border-radius:50%; font-size:26px; line-height:1;
  background:var(--brand-100); color:var(--brand-700); font-weight:600;
}
.stepper input{
  width:130px; border:0; text-align:center; font-size:34px; font-weight:700;
  background:none; color:var(--ink); font-variant-numeric:tabular-nums;
}
.stepper .unit{font-size:15px; color:var(--muted); margin-left:-6px;}

/* 尿色色卡 */
.swatches{display:grid; grid-template-columns:repeat(6,1fr); gap:8px; padding-top:2px;}
.swatch{text-align:center; position:relative; padding:2px 0 0;}
.swatch .dot{
  display:block; width:44px; height:44px; border-radius:50%; margin:0 auto;
  border:2px solid rgba(42,22,32,.06); position:relative;
}
.swatch .nm{font-size:11px; color:var(--muted); margin-top:6px; display:block;}
.swatch.on .dot{box-shadow:0 0 0 3px var(--brand-100);}
.swatch.on .nm{color:var(--brand-700); font-weight:600;}
.swatch.on .dot::after{
  content:"✓"; position:absolute; left:0; right:0; top:0; bottom:0;
  display:flex; align-items:center; justify-content:center;
  color:#fff; font-size:18px; font-weight:700; text-shadow:0 1px 2px rgba(0,0,0,.18);
}

/* 开关 */
.switch{
  width:52px; height:31px; border-radius:999px; background:#ecd9e2; position:relative;
  transition:background .18s ease; flex:none;
}
.switch::after{
  content:""; position:absolute; top:2.5px; left:3px; width:26px; height:26px;
  border-radius:50%; background:#fff; box-shadow:0 1px 3px rgba(0,0,0,.22);
  transition:left .18s ease;
}
.switch.on{background:var(--brand-500);}
.switch.on::after{left:23px;}

/* 备注 */
textarea{
  width:100%; border:0; background:none; resize:none; min-height:74px;
  font-size:15px; line-height:1.6; outline:none;
}
textarea::placeholder{color:#c9aebc;}
.note-head{display:flex; justify-content:space-between; align-items:center; margin-bottom:6px;}
.note-head .cnt{font-size:12px; color:#bb9aab;}

/* 照片（大便照片） */
.photo-grid{display:flex; gap:10px;}
.photo-add{
  position:relative; width:84px; height:84px; border-radius:14px; overflow:hidden;
  border:1.5px dashed var(--line-strong);
  display:flex; flex-direction:column; align-items:center; justify-content:center; gap:3px;
  color:#c9aebc; background:#fff;
}
.photo-add .pd-icon{font-size:24px; line-height:1;}
.photo-add .pd-cap{font-size:11px; letter-spacing:.5px;}
.photo-add input{
  /* opacity 用 0.01 而非 0：部分安卓 WebView 会跳过全透明元素的点击命中，
     微透明既不可见又能保证手指点在 input 上（浏览器路径直接触发系统选择器） */
  position:absolute; inset:0; width:100%; height:100%;
  opacity:0.01; pointer-events:auto; cursor:pointer;
}
.photo-thumb{position:relative; width:96px; height:96px;}
.photo-thumb img{width:100%; height:100%; object-fit:cover; border-radius:14px; display:block;}
.photo-x{
  position:absolute; right:-8px; top:-8px; width:26px; height:26px; border-radius:50%;
  background:rgba(42,22,32,.75); color:#fff; font-size:13px; line-height:26px;
  padding:0; text-align:center;
}
.lightbox{
  position:fixed; inset:0; z-index:80; background:rgba(10,5,8,.92);
  display:flex; align-items:center; justify-content:center; padding:16px;
  opacity:0; pointer-events:none; transition:opacity .18s ease;
}
.lightbox.show{opacity:1; pointer-events:auto;}
.lightbox img{max-width:100%; max-height:100%; border-radius:12px;}

/* 自建相机（拍照不依赖系统文件选择器） */
.camera-modal{
  position:fixed; inset:0; z-index:90; background:#000;
  display:none; flex-direction:column;
}
.camera-modal.show{display:flex;}
.camera-top{display:flex; justify-content:space-between; align-items:center;
  padding:calc(env(safe-area-inset-top) + 12px) 14px 10px;}
.cam-btn{
  width:40px; height:40px; border-radius:50%; background:rgba(255,255,255,.18);
  color:#fff; font-size:17px; display:flex; align-items:center; justify-content:center;
}
.cam-video{flex:1; width:100%; min-height:0; object-fit:cover; background:#000;}
.cam-still{flex:1; width:100%; min-height:0; object-fit:contain; background:#000;}
.camera-foot{display:flex; align-items:center; justify-content:center; gap:18px;
  padding:18px 16px calc(env(safe-area-inset-bottom) + 22px);}
.camera-foot.cam-actions{gap:10px;}
.camera-foot.cam-actions .btn-cancel{flex:1;}
.camera-foot.cam-actions .btn-primary{flex:2;}
.shutter{
  width:74px; height:74px; border-radius:50%; background:#fff;
  border:4px solid rgba(255,255,255,.45);
}
.shutter:active{transform:scale(.95);}

/* ---------- 登录 ---------- */
.login-wrap{min-height:100vh; display:flex; flex-direction:column;
  align-items:center; justify-content:center; padding:32px 24px calc(env(safe-area-inset-bottom) + 40px);}
.login-logo{
  width:96px; height:96px; border-radius:28px; overflow:hidden; margin-bottom:18px;
  box-shadow:0 14px 32px -18px rgba(131,24,67,.7);
}
.login-logo img{width:100%; height:100%; display:block;}
.login-title{font-size:22px; font-weight:700;}
.login-sub{font-size:13px; color:var(--muted); margin-top:8px;}
.login-box{width:100%; max-width:340px; margin-top:26px;}
.login-box input{
  width:100%; padding:15px 16px; border-radius:14px; border:1px solid var(--line-strong);
  background:#fff; font-size:16px; outline:none;
}
.login-box input:focus{border-color:var(--brand-500); box-shadow:0 0 0 3px var(--brand-100);}
.login-btn{
  width:100%; margin-top:14px; padding:15px; border-radius:14px;
  background:linear-gradient(165deg,var(--brand-700),var(--brand-500));
  color:#fff; font-size:16px; font-weight:700;
  box-shadow:0 10px 20px -12px rgba(190,24,93,.75);
}
.login-err{color:var(--danger); font-size:13px; margin-top:12px; min-height:18px; text-align:center;}
.login-tip{font-size:12px; color:var(--muted); margin-top:22px; text-align:center; line-height:1.7;}

/* ---------- 提示条 ---------- */
.toast{
  position:fixed; left:50%; bottom:calc(env(safe-area-inset-bottom) + 96px);
  transform:translateX(-50%) translateY(8px); z-index:60;
  background:rgba(42,16,28,.92); color:#fff; font-size:13.5px;
  border-radius:999px; padding:10px 20px; max-width:86vw; text-align:center;
  opacity:0; transition:opacity .2s ease, transform .2s ease; pointer-events:none;
}
.toast.show{opacity:1; transform:translateX(-50%) translateY(0);}
.toast.error{background:rgba(153,27,27,.94);}

.foot-note{margin-top:20px; text-align:center; font-size:11.5px; color:#b394a3; letter-spacing:.4px;}
.foot-logout{color:#b394a3; font-size:11.5px; letter-spacing:.4px; text-decoration:underline; padding:0;}
