/* ============================================================
   今日 · 我的日程   —— 简洁纯色系
   配色只有几个固定颜色，没有渐变、没有花哨阴影
   ============================================================ */
:root{
  --blue:#2563EB;        /* 主色：按钮、选中 */
  --blue-dark:#1D4ED8;
  --blue-soft:#EFF4FF;   /* 主色的浅底 */
  --bg:#F4F5F7;          /* 页面背景（浅灰） */
  --card:#FFFFFF;        /* 卡片（白） */
  --line:#E6E8EC;        /* 分隔线 */
  --text:#111827;        /* 主要文字 */
  --muted:#6B7280;       /* 次要文字 */
  --done:#9CA3AF;
  --green:#10B981;
  --red:#EF4444;
  --r:14px;              /* 统一圆角 */

  --c0:#64748B; --c1:#2563EB; --c2:#10B981; --c3:#F59E0B; --c4:#EF4444; --c5:#8B5CF6;
}

*{box-sizing:border-box;-webkit-tap-highlight-color:transparent;}
/* 重要：下面这些元素自己带 display，会盖过浏览器默认的 [hidden]{display:none}，
   导致"关掉了"却还盖在屏幕上。这条规则保证 hidden 一定生效。 */
[hidden]{display:none !important;}
html,body{margin:0;padding:0;}
html{-webkit-text-size-adjust:100%;}
body{
  background:var(--bg);
  color:var(--text);
  font-family:-apple-system,BlinkMacSystemFont,"Segoe UI","PingFang SC","Hiragino Sans GB","Microsoft YaHei",sans-serif;
  font-size:16px;
  line-height:1.5;
  padding-bottom:calc(96px + env(safe-area-inset-bottom));
  overscroll-behavior-y:none;
}
button,input{font-family:inherit;font-size:inherit;color:inherit;}
button{border:0;background:none;padding:0;cursor:pointer;}
svg{width:22px;height:22px;display:block;}
/* 列表项允许长按删除：关掉 iOS 的长按选择和"复制/搜索"菜单，免得挡住确认框 */
.item,.day,.check,.empty{-webkit-touch-callout:none;-webkit-user-select:none;user-select:none;}

/* ---------------- 顶栏 ---------------- */
.topbar{
  position:sticky;top:0;z-index:20;
  background:var(--card);
  border-bottom:1px solid var(--line);
  padding-top:env(safe-area-inset-top);
}
.topbar-inner{
  max-width:600px;margin:0 auto;
  padding:14px 18px 12px;
  display:flex;align-items:center;justify-content:space-between;gap:12px;
}
.brand{display:flex;align-items:center;gap:9px;}
.brand-dot{width:11px;height:11px;border-radius:4px;background:var(--blue);display:block;}
.brand-name{font-size:19px;font-weight:700;letter-spacing:.5px;}
.topbar-date{font-size:13px;color:var(--muted);}

/* ---------------- 布局 ---------------- */
.wrap{max-width:600px;margin:0 auto;padding:14px 14px 0;}
.view{display:block;}
.card{
  background:var(--card);
  border-radius:var(--r);
  border:1px solid var(--line);
  margin-bottom:14px;
  overflow:hidden;
}
.card-head{
  display:flex;align-items:center;justify-content:space-between;gap:10px;
  padding:14px 16px 12px;
}
.card-title{font-size:16px;font-weight:650;}
.card-sub{font-size:12.5px;color:var(--muted);margin-top:2px;}

/* ---------------- 分段按钮 ---------------- */
.seg{display:flex;background:var(--bg);border-radius:10px;padding:3px;gap:2px;}
.seg-btn{
  font-size:13px;color:var(--muted);
  padding:5px 11px;border-radius:8px;white-space:nowrap;
}
.seg-btn.is-on{background:var(--card);color:var(--blue);font-weight:650;}

.text-btn{font-size:13.5px;color:var(--blue);padding:6px 2px;font-weight:550;}
.text-btn.is-danger{color:var(--red);}

/* ---------------- 列表 ---------------- */
.list{min-height:8px;}
.item{
  display:flex;align-items:flex-start;gap:12px;
  padding:13px 16px;
  border-top:1px solid var(--line);
  position:relative;
}
.item:first-child{border-top:1px solid var(--line);}
.item-main{flex:1;min-width:0;}
.item-title{font-size:15.5px;word-break:break-word;}
.item-note{font-size:12.5px;color:var(--muted);margin-top:2px;word-break:break-word;}
.item-meta{font-size:12.5px;color:var(--muted);margin-top:3px;display:flex;align-items:center;gap:6px;flex-wrap:wrap;}
.item-time{font-variant-numeric:tabular-nums;}
.overdue{color:var(--red);font-weight:600;}

/* 勾选框 */
.check{
  flex:0 0 auto;width:24px;height:24px;border-radius:50%;
  border:2px solid #CBD2DA;margin-top:1px;
  display:flex;align-items:center;justify-content:center;
  color:#fff;transition:background .12s,border-color .12s;
}
.check svg{width:14px;height:14px;opacity:0;}
.check:active{transform:scale(.92);}

/* 已完成样子 */
.item.done .item-title{color:var(--done);text-decoration:line-through;}
.item.done .check{background:var(--green);border-color:var(--green);}
.item.done .check svg{opacity:1;}

/* 左边色条 */
.item::before{
  content:"";position:absolute;left:0;top:12px;bottom:12px;width:3px;
  border-radius:0 3px 3px 0;background:var(--dot,transparent);
}

/* 空状态 */
.empty{
  padding:34px 18px;text-align:center;color:var(--muted);font-size:14px;
}
.empty b{display:block;color:var(--text);font-size:15px;margin-bottom:4px;}
.empty-btn{
  display:inline-block;margin-top:14px;padding:9px 18px;border-radius:22px;
  background:var(--blue);color:#fff;font-size:14px;font-weight:600;
}
.empty-btn:active{background:var(--blue-dark);}

/* 分组小标题（过期 / 今天 / 某月某日） */
.group-head{
  padding:12px 16px 6px;font-size:12.5px;font-weight:650;
  color:var(--muted);background:var(--bg);
  border-top:1px solid var(--line);
}
.list > .group-head:first-child{border-top:0;}

/* ---------------- 日历 ---------------- */
.cal-head{display:flex;align-items:center;justify-content:space-between;padding:12px 8px 6px;}
.cal-title{font-size:16px;font-weight:650;}
.icon-btn{
  width:38px;height:38px;border-radius:10px;color:var(--muted);
  display:flex;align-items:center;justify-content:center;
}
.icon-btn:active{background:var(--bg);}
.cal-week,.cal-grid{display:grid;grid-template-columns:repeat(7,1fr);}
.cal-week{padding:0 10px 4px;}
.cal-week span{text-align:center;font-size:12px;color:var(--muted);}
.cal-grid{padding:4px 10px 14px;gap:2px 0;}
.day{
  position:relative;height:44px;border-radius:10px;
  display:flex;flex-direction:column;align-items:center;justify-content:center;gap:3px;
  font-size:14.5px;
}
.day.pad{visibility:hidden;}
.day.today{color:var(--blue);font-weight:700;}
.day.today::after{
  content:"";position:absolute;inset:3px;border:1.5px solid var(--blue);border-radius:10px;
}
.day.sel{background:var(--blue);color:#fff;font-weight:650;}
.day.sel::after{display:none;}
.dots{display:flex;gap:3px;height:4px;}
.dots i{width:4px;height:4px;border-radius:50%;background:var(--blue);display:block;}
.day.sel .dots i{background:#fff;}

/* ---------------- 统计 ---------------- */
.stats{display:grid;grid-template-columns:repeat(3,1fr);padding:16px 8px 8px;text-align:center;}
.stats .n{font-size:23px;font-weight:700;font-variant-numeric:tabular-nums;}
.stats .l{font-size:12.5px;color:var(--muted);margin-top:2px;}
.progress{height:7px;background:var(--line);border-radius:4px;margin:6px 16px 18px;overflow:hidden;}
.progress-fill{height:100%;width:0;background:var(--blue);border-radius:4px;transition:width .25s;}

.row-btns{display:flex;gap:10px;padding:0 16px 16px;}
.ghost-btn{
  flex:1;padding:11px;border-radius:10px;border:1px solid var(--line);
  font-size:14px;color:var(--text);background:var(--card);font-weight:550;
}
.ghost-btn:active{background:var(--bg);}

/* ---------------- 底部导航 ---------------- */
.tabbar{
  position:fixed;left:0;right:0;bottom:0;z-index:20;
  background:var(--card);
  border-top:1px solid var(--line);
  padding-bottom:env(safe-area-inset-bottom);
  display:flex;justify-content:center;
}
.tab{
  flex:1;max-width:200px;
  display:flex;flex-direction:column;align-items:center;gap:2px;
  padding:9px 0 8px;color:var(--muted);font-size:11px;
}
.tab.is-on{color:var(--blue);}
.tab.is-on span{font-weight:650;}

/* ---------------- 添加按钮 ---------------- */
.fab{
  position:fixed;z-index:21;
  right:calc(50% - 300px);bottom:calc(74px + env(safe-area-inset-bottom));
  width:56px;height:56px;border-radius:50%;
  background:var(--blue);color:#fff;
  display:flex;align-items:center;justify-content:center;
  box-shadow:0 6px 18px rgba(37,99,235,.32);
}
.fab:active{background:var(--blue-dark);transform:scale(.95);}
@media (max-width:640px){
  .fab{right:18px;}
}

/* ---------------- 添加面板 ---------------- */
.sheet-wrap{position:fixed;inset:0;z-index:40;display:flex;align-items:flex-end;justify-content:center;}
.sheet-backdrop{position:absolute;inset:0;background:rgba(17,24,39,.42);animation:fade .18s ease;}
.sheet{
  position:relative;width:100%;max-width:600px;
  background:var(--card);
  border-radius:18px 18px 0 0;
  padding:8px 18px calc(18px + env(safe-area-inset-bottom));
  max-height:92vh;overflow-y:auto;
  animation:up .22s ease;
}
@keyframes up{from{transform:translateY(24px);opacity:.6}to{transform:none;opacity:1}}
@keyframes fade{from{opacity:0}to{opacity:1}}
.sheet-grip{width:38px;height:4px;border-radius:2px;background:var(--line);margin:6px auto 10px;}
.sheet-title{font-size:17px;font-weight:700;margin:0 0 12px;}
.field{display:block;margin-bottom:13px;}
.field-label{display:block;font-size:12.5px;color:var(--muted);margin-bottom:6px;}
.field input{
  width:100%;min-width:0;max-width:100%;padding:12px 13px;border-radius:11px;
  border:1px solid var(--line);background:var(--bg);outline:none;
  /* 注意：这里故意不写 appearance:none —— 那会让 iPhone 上点日期栏不弹出选择器 */
}
.field input:focus{border-color:var(--blue);background:var(--card);}
.field-row{display:flex;gap:10px;}
.field-row .field{flex:1;min-width:0;}
.quick{display:flex;flex-wrap:wrap;gap:8px;margin:-3px 0 14px;}
.chip{
  font-size:13px;padding:6px 12px;border-radius:20px;
  background:var(--bg);border:1px solid var(--line);color:var(--muted);
}
.chip:active{background:var(--blue-soft);color:var(--blue);}
.colors{display:flex;gap:10px;padding:2px 0;}
.swatch{
  width:30px;height:30px;border-radius:50%;flex:0 0 auto;
  border:2px solid transparent;box-shadow:inset 0 0 0 2px var(--card);
}
.swatch.is-on{outline:2px solid var(--text);outline-offset:2px;}
.sheet-actions{display:flex;gap:10px;margin-top:18px;}
.sheet-cancel,.sheet-save{flex:1;padding:13px;border-radius:12px;font-size:15.5px;font-weight:650;}
.sheet-cancel{background:var(--bg);color:var(--text);}
.sheet-save{background:var(--blue);color:#fff;}
.sheet-save:active{background:var(--blue-dark);}

/* ---------------- 提示条 ---------------- */
.toast{
  position:fixed;left:50%;bottom:96px;transform:translateX(-50%);
  background:#111827;color:#fff;font-size:13.5px;
  padding:10px 16px;border-radius:20px;z-index:60;
  max-width:80%;text-align:center;
}
.install-tip{
  position:fixed;left:14px;right:14px;bottom:calc(84px + env(safe-area-inset-bottom));
  max-width:572px;margin:0 auto;
  background:var(--blue-soft);border:1px solid #D3E0FC;color:#1E3A8A;
  font-size:13px;padding:11px 14px;border-radius:12px;z-index:19;
  display:flex;gap:10px;align-items:flex-start;
}
.install-tip button{color:#1E3A8A;font-size:16px;line-height:1;opacity:.6;}
