:root{
  --bg:#f4f5f7; --card:#fff; --text:#1c1e21; --muted:#8a8f99; --border:#e5e7eb;
  --primary:#3b82f6; --primary-weak:#e8f0fe; --danger:#ef4444; --ok:#22c55e;
  --radius:14px;
}
body.dark{
  --bg:#15171b; --card:#1f2227; --text:#e8eaed; --muted:#9aa0a6; --border:#33373d;
  --primary:#60a5fa; --primary-weak:#26324a; --danger:#f87171; --ok:#4ade80;
}
*{box-sizing:border-box; margin:0; padding:0; -webkit-tap-highlight-color:transparent;}
body{background:var(--bg); color:var(--text); font-family:-apple-system,"Segoe UI",Roboto,"PingFang SC","Microsoft YaHei",sans-serif;
  padding-bottom:calc(64px + env(safe-area-inset-bottom));}
.topbar{position:sticky; top:0; z-index:10; background:var(--card); border-bottom:1px solid var(--border);
  padding:14px 16px; font-size:18px; font-weight:700;}
.topbar h1{font-size:18px;}
main{max-width:720px; margin:0 auto; padding:12px 14px;}
/* ---------- PC：左侧栏 + 内容区（≥900px） ---------- */
.sidebar{display:none;}
@media(min-width:900px){
  body{padding-bottom:0;}
  .sidebar{display:flex; flex-direction:column; position:fixed; top:0; left:0; bottom:0; width:208px;
    background:var(--card); border-right:1px solid var(--border); padding:18px 12px; z-index:30;
    gap:2px; overflow-y:auto;}
  .side-brand{font-size:17px; font-weight:700; padding:4px 10px 16px;}
  .side-title{font-size:12px; color:var(--muted); padding:16px 10px 6px;}
  .side-group{display:flex; flex-direction:column; gap:2px;}
  .side-group a{display:flex; align-items:center; gap:10px; padding:10px 12px; border-radius:10px;
    color:var(--text); text-decoration:none; font-size:14px;}
  .side-group a .nav-ico{font-size:18px;}
  .side-group a:hover{background:var(--bg);}
  .side-group a.active{background:var(--primary-weak); color:var(--primary); font-weight:600;}
  .side-spacer{flex:1;}
  .bottomnav{display:none !important;}
  .topbar{margin-left:208px;}
  main{margin-left:208px; max-width:920px; padding:20px 28px 40px;}
  .fab{position:fixed; right:36px; bottom:36px;}
}
.bottomnav{position:fixed; bottom:0; left:0; right:0; display:flex; background:var(--card);
  border-top:1px solid var(--border); padding-bottom:env(safe-area-inset-bottom); z-index:10;}
.bottomnav a{flex:1; text-align:center; padding:8px 0 7px; color:var(--muted); text-decoration:none; font-size:11px;
  display:flex; flex-direction:column; align-items:center; gap:2px;}
.bottomnav a .nav-ico{font-size:20px; line-height:1;}
.bottomnav a.active{color:var(--primary); font-weight:600;}
@media(min-width:600px){ .bottomnav a{font-size:12px;} .bottomnav a .nav-ico{font-size:22px;} }
.entry-grid{display:grid; grid-template-columns:1fr 1fr; gap:10px; margin-bottom:10px;}
.entry-card{background:var(--card); border:1px solid var(--border); border-radius:var(--radius);
  padding:14px; text-decoration:none; color:var(--text);}
.entry-icon{font-size:24px;}
.entry-label{font-weight:600; margin-top:6px; font-size:15px;}
.entry-desc{color:var(--muted); font-size:12px; margin-top:2px;}

.card{background:var(--card); border-radius:var(--radius); padding:14px; margin-bottom:10px;
  border:1px solid var(--border);}
.row{display:flex; align-items:center; gap:10px;}
.grow{flex:1; min-width:0;}
.muted{color:var(--muted); font-size:12px;}
.mt{margin-top:10px;}
button{border:none; background:none; color:var(--text); cursor:pointer; font-size:14px; padding:6px 10px; border-radius:8px;}
button.primary{background:var(--primary); color:#fff; width:100%; padding:12px; font-size:16px; font-weight:600;}
button.ghost{border:1px solid var(--border);}
button.danger{color:var(--danger);}
button.small{font-size:12px; padding:4px 8px;}
input,select,textarea{width:100%; background:var(--bg); color:var(--text); border:1px solid var(--border);
  border-radius:10px; padding:10px 12px; font-size:15px; margin:6px 0; outline:none;}
input:focus,textarea:focus{border-color:var(--primary);}
.tabs{display:flex; gap:6px; margin-bottom:8px; overflow-x:auto;}
.tabs button{border:1px solid var(--border); background:var(--card); white-space:nowrap;}
.tabs button.active{background:var(--primary); color:#fff; border-color:var(--primary);}
.list-item{display:flex; align-items:flex-start; gap:10px; padding:12px 4px; border-bottom:1px solid var(--border);}
.list-item:last-child{border-bottom:none;}
.checkbox{width:22px; height:22px; min-width:22px; border-radius:50%; border:2px solid var(--muted);
  margin-top:2px; cursor:pointer; display:flex; align-items:center; justify-content:center; font-size:13px; color:#fff;}
.checkbox.done{background:var(--ok); border-color:var(--ok);}
.title{font-size:15px; word-break:break-all;}
.done .title{text-decoration:line-through; color:var(--muted);}
.star{color:#f59e0b; cursor:pointer; font-size:16px;}
.star.off{color:var(--muted); opacity:.5;}
.chip{display:inline-block; font-size:11px; padding:2px 8px; border-radius:999px; background:var(--primary-weak); color:var(--primary); margin-right:4px;}
.fab{position:fixed; right:18px; bottom:calc(76px + env(safe-area-inset-bottom)); width:54px; height:54px;
  border-radius:50%; background:var(--primary); color:#fff; font-size:28px; display:flex; align-items:center;
  justify-content:center; box-shadow:0 4px 14px rgba(0,0,0,.25); z-index:9;}
#toast{position:fixed; left:50%; bottom:90px; transform:translateX(-50%); background:rgba(0,0,0,.8); color:#fff;
  padding:8px 16px; border-radius:8px; font-size:13px; opacity:0; transition:opacity .25s; pointer-events:none; z-index:99;}
#toast.show{opacity:1;}
#modal-root .mask{position:fixed; inset:0; background:rgba(0,0,0,.45); z-index:20; display:flex; align-items:flex-end; justify-content:center;}
@media(min-width:600px){ #modal-root .mask{align-items:center;} }
.sheet{background:var(--card); width:100%; max-width:520px; border-radius:18px 18px 0 0; padding:18px 16px;
  max-height:88vh; overflow-y:auto;}
@media(min-width:600px){ .sheet{border-radius:18px;} }
.sheet h3{margin-bottom:10px; font-size:16px;}
.cal{display:grid; grid-template-columns:repeat(7,1fr); gap:4px; text-align:center;}
.cal .dow{color:var(--muted); font-size:12px; padding:4px 0;}
.cal .day{aspect-ratio:1; display:flex; flex-direction:column; align-items:center; justify-content:center;
  border-radius:10px; cursor:pointer; font-size:14px; position:relative;}
.cal .day.today{border:1px solid var(--primary);}
.cal .day.sel{background:var(--primary); color:#fff;}
.cal .day .dot{width:5px; height:5px; border-radius:50%; background:var(--primary); position:absolute; bottom:4px;}
.cal .day.sel .dot{background:#fff;}
.cal .day.other{color:var(--muted); opacity:.4;}
.habit-icon{width:40px; height:40px; min-width:40px; border-radius:12px; display:flex; align-items:center; justify-content:center; font-size:20px;}
.stat{display:flex; gap:10px; margin-bottom:10px;}
.stat .card{flex:1; text-align:center; margin:0;}
.stat b{font-size:20px;}
.err{color:var(--danger); font-size:13px; min-height:18px;}
.empty{text-align:center; color:var(--muted); padding:40px 0;}
.login-body{display:flex; align-items:center; justify-content:center; min-height:100vh; padding:16px;}
.login-card{background:var(--card); border:1px solid var(--border); border-radius:20px; padding:28px 22px; width:100%; max-width:360px;}
.login-card h1{text-align:center; font-size:26px;}
.login-card .sub{text-align:center; color:var(--muted); margin:6px 0 16px; font-size:13px;}
.link{color:var(--primary); text-decoration:none; font-size:13px;}
