:root {
  color-scheme: light;
  --bg: #f6f8fb;
  --card: #ffffff;
  --text: #1f2328;
  --muted: #6b7280;
  --faint: #9aa3af;
  --border: #e3e8ef;
  --soft: #f3f6fa;
  --primary: #4f46e5;
  --primary-dark: #4338ca;
  --primary-soft: #eef2ff;
  --work: #3b82f6;
  --school: #10b981;
  --band: #a855f7;
  --show: #ec4899;
  --danger: #dc2626;
  --danger-soft: #fef2f2;
  --shadow: 0 1px 2px rgba(16, 24, 40, .04), 0 8px 24px rgba(16, 24, 40, .05);
  /* 把散落的硬编码色收拢为变量，便于深色主题统一覆盖 */
  --surface: #ffffff;
  --outside-bg: #fbfcfe;
  --today-bg: #f8f8ff;
  --outside-text: #cbd5e1;
  --nav-idle: #4b5563;
  --arrow: #9aa3af;
  --tabbar-bg: rgba(255, 255, 255, .96);
  --toast-bg: #1f2328;
  --toast-text: #ffffff;
  --overlay: rgba(15, 23, 42, .45);
  --active-border: #e0e7ff;
  --chip-border: #dbeafe;
  --danger-border: #fecaca;
  --shadow-pop: 0 12px 32px rgba(16, 24, 40, .16);
  --cal-item-bg: #eff6ff;
  --cal-item-text: #1d4ed8;
}

html[data-theme="dark"] {
  color-scheme: dark;
  --bg: #0f141c;
  --card: #171e29;
  --text: #e7edf5;
  --muted: #9aa8ba;
  --faint: #6f7d90;
  --border: #2a3543;
  --soft: #1e2734;
  --primary: #7c74f2;
  --primary-dark: #a5b4fc;
  --primary-soft: #26243f;
  --work: #60a5fa;
  --school: #34d399;
  --band: #c084fc;
  --show: #f472b6;
  --danger: #f87171;
  --danger-soft: #3a1f24;
  --shadow: 0 1px 2px rgba(0, 0, 0, .3), 0 8px 24px rgba(0, 0, 0, .28);
  --surface: #1b2431;
  --outside-bg: #131a24;
  --today-bg: #1d2340;
  --outside-text: #4a5666;
  --nav-idle: #9aa8ba;
  --arrow: #6f7d90;
  --tabbar-bg: rgba(23, 30, 41, .96);
  --toast-bg: #e7edf5;
  --toast-text: #0f141c;
  --overlay: rgba(0, 0, 0, .62);
  --active-border: #3b3a6b;
  --chip-border: #2b3a55;
  --danger-border: #5c2b30;
  --shadow-pop: 0 12px 32px rgba(0, 0, 0, .5);
  --cal-item-bg: #1e2f4d;
  --cal-item-text: #93b8f7;
}

* { box-sizing: border-box; }
html, body { margin: 0; padding: 0; }
html { -webkit-text-size-adjust: 100%; text-size-adjust: 100%; }
body {
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", "PingFang SC", "Microsoft YaHei", sans-serif;
  background: var(--bg);
  color: var(--text);
  font-size: 14px;
  line-height: 1.55;
  -webkit-font-smoothing: antialiased;
  overflow-x: hidden;
  transition: background-color .2s ease, color .2s ease;
}
.hidden { display: none !important; }
button, input, select { font-family: inherit; font-size: inherit; }
button { cursor: pointer; }
code { font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace; }

/* ---------- 登录 ---------- */
.login { min-height: 100vh; min-height: 100dvh; display: flex; align-items: center; justify-content: center; padding: 20px; }
.login-card {
  width: 100%; max-width: 380px; background: var(--card); border: 1px solid var(--border);
  border-radius: 16px; padding: 32px; box-shadow: var(--shadow); text-align: center;
}
.login-card h1 { font-size: 19px; margin: 14px 0 4px; }
.login-sub { color: var(--muted); font-size: 13px; margin: 0 0 22px; }
.login-error { color: var(--danger); font-size: 12.5px; margin: 10px 0 0; }
.brand-mark {
  display: inline-flex; align-items: center; justify-content: center; width: 34px; height: 34px;
  border-radius: 10px; background: var(--primary); color: #fff; font-weight: 800; font-size: 16px;
  flex: 0 0 34px;
}
.brand-mark.big { width: 52px; height: 52px; border-radius: 14px; font-size: 24px; }

/* ---------- 布局 ---------- */
.app { display: flex; min-height: 100vh; min-height: 100dvh; }
.sidebar {
  width: 232px; flex: 0 0 232px; background: var(--card); border-right: 1px solid var(--border);
  display: flex; flex-direction: column; padding: 22px 16px 18px;
  position: sticky; top: 0; height: 100vh; height: 100dvh;
}
.brand { display: flex; align-items: center; gap: 10px; padding: 0 6px 26px; }
.brand-title { font-weight: 700; font-size: 15px; }
.brand-sub { color: var(--faint); font-size: 11px; }
.nav-label {
  font-size: 10.5px; font-weight: 700; letter-spacing: .1em; color: var(--faint);
  padding: 0 10px; margin: 8px 0 8px; text-transform: uppercase;
}
.nav { display: flex; flex-direction: column; gap: 4px; }
.nav-item {
  display: flex; align-items: center; gap: 10px; width: 100%; text-align: left;
  padding: 9px 10px; border: 1px solid transparent; border-radius: 9px;
  background: transparent; color: var(--nav-idle); font-size: 13.5px; transition: .15s;
}
.nav-item:hover { background: var(--soft); color: var(--text); }
.nav-item.active { background: var(--primary-soft); color: var(--primary-dark); font-weight: 600; border-color: var(--active-border); }
.nav-icon { width: 18px; text-align: center; font-size: 14px; opacity: .85; }
.side-tools { display: flex; flex-direction: column; gap: 3px; }
.side-btn {
  text-align: left; padding: 8px 10px; border: 1px solid transparent; border-radius: 8px;
  background: transparent; color: var(--muted); font-size: 12.5px;
}
.side-btn:hover { background: var(--soft); color: var(--text); }
.side-foot { margin-top: auto; padding: 14px 10px 0; border-top: 1px solid var(--border); font-size: 11.5px; color: var(--muted); }
.sync-dot { display: inline-block; width: 7px; height: 7px; border-radius: 50%; background: var(--school); margin-right: 6px; }
.side-meta { color: var(--faint); margin-top: 6px; font-size: 10.5px; }

/* 外观 / 主题三段切换 */
.theme-seg { display: flex; gap: 3px; background: var(--soft); border: 1px solid var(--border); border-radius: 9px; padding: 3px; }
.theme-btn {
  flex: 1; min-width: 0; border: none; background: transparent; border-radius: 7px;
  padding: 6px 2px; font-size: 11px; color: var(--muted);
  display: flex; flex-direction: column; align-items: center; gap: 2px; line-height: 1.2;
}
.theme-btn span { font-size: 14px; line-height: 1; }
.theme-btn.active { background: var(--surface); color: var(--primary-dark); font-weight: 700; box-shadow: 0 1px 3px rgba(16, 24, 40, .1); }

.main { flex: 1; min-width: 0; padding: 0 30px 60px; }
.topbar { display: flex; justify-content: space-between; align-items: flex-end; gap: 16px; padding: 28px 0 20px; flex-wrap: wrap; position: relative; }
.topbar h1 { font-size: 22px; margin: 0; letter-spacing: -.02em; }
.sub { color: var(--muted); font-size: 12.5px; margin: 3px 0 0; }
.top-actions { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
.view-tools { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
button.more-btn { display: none; }

/* 移动端「更多」菜单 */
.mobile-menu {
  position: absolute; right: 0; top: calc(100% - 4px); width: 216px; z-index: 45;
  background: var(--card); border: 1px solid var(--border); border-radius: 12px;
  box-shadow: var(--shadow-pop); padding: 6px;
  max-height: 70dvh; overflow-y: auto;
}
.mobile-menu-item {
  display: block; width: 100%; text-align: left; border: none; background: transparent;
  padding: 11px 12px; border-radius: 8px; font-size: 13px; color: var(--text);
}
.mobile-menu-item:hover { background: var(--soft); }
.mobile-menu-item:active { background: var(--primary-soft); }
.mobile-menu-item.active { background: var(--primary-soft); color: var(--primary-dark); font-weight: 700; }
.mobile-menu-label { font-size: 10.5px; color: var(--faint); font-weight: 700; padding: 10px 12px 4px; border-top: 1px solid var(--border); margin-top: 4px; }

/* ---------- 基础组件 ---------- */
.btn {
  border: 1px solid var(--border); background: var(--card); color: var(--text);
  padding: 8px 14px; border-radius: 9px; font-size: 13px; font-weight: 500; transition: .15s;
}
.btn:hover { background: var(--soft); }
.btn.primary { background: var(--primary); border-color: var(--primary); color: #fff; }
.btn.primary:hover { background: var(--primary-dark); border-color: var(--primary-dark); }
.btn.danger { color: var(--danger); border-color: var(--danger-border); background: var(--surface); }
.btn.danger:hover { background: var(--danger-soft); }
.btn.block { width: 100%; margin-top: 16px; }
.btn.ghost { border-color: transparent; background: transparent; color: var(--muted); }
.btn.ghost:hover { background: var(--soft); color: var(--text); }
.btn.tiny { padding: 5px 9px; font-size: 11.5px; border-radius: 7px; }
.icon-btn {
  border: none; background: transparent; color: var(--faint); font-size: 18px;
  width: 28px; height: 28px; border-radius: 7px; line-height: 1;
  display: inline-flex; align-items: center; justify-content: center;
}
.icon-btn:hover { background: var(--soft); color: var(--text); }
.input, .select, .date-input {
  width: 100%; padding: 9px 11px; border: 1px solid var(--border); border-radius: 9px;
  background: var(--surface); color: var(--text); outline: none; transition: .15s;
}
.input:focus, .select:focus, .date-input:focus { border-color: var(--primary); box-shadow: 0 0 0 3px var(--primary-soft); }
.select { appearance: none; background-image: linear-gradient(45deg, transparent 50%, var(--arrow) 50%), linear-gradient(135deg, var(--arrow) 50%, transparent 50%); background-position: calc(100% - 16px) 50%, calc(100% - 11px) 50%; background-size: 5px 5px, 5px 5px; background-repeat: no-repeat; padding-right: 30px; }

.card, .panel {
  background: var(--card); border: 1px solid var(--border); border-radius: 13px; box-shadow: var(--shadow);
}
.panel { padding: 16px 18px; }
.panel-head { display: flex; align-items: center; gap: 8px; margin-bottom: 14px; flex-wrap: wrap; }
.panel-title { font-weight: 700; font-size: 14px; }
.panel-head .btn { margin-left: auto; padding: 5px 10px; font-size: 12px; }
.panel-head .btn + .btn { margin-left: 0; }
.dot { width: 8px; height: 8px; border-radius: 3px; display: inline-block; flex: 0 0 8px; }
.dot.work { background: var(--work); }
.dot.school { background: var(--school); }
.dot.band { background: var(--band); }
.count { color: var(--faint); font-size: 12px; font-weight: 400; }

.tag { display: inline-block; font-size: 11px; padding: 2px 8px; border-radius: 6px; border: 1px solid transparent; white-space: nowrap; }
.tag-overtime { background: var(--danger-soft); color: var(--danger); border-color: var(--danger-border); font-weight: 600; }
.dur-chip { font-size: 11px; color: var(--muted); font-variant-numeric: tabular-nums; }

/* ---------- 选项彩色 chip（Notion 风格九色板） ---------- */
.chip { display: inline-flex; align-items: center; font-size: 11px; line-height: 1.5; padding: 2px 8px; border-radius: 6px; border: 1px solid transparent; white-space: nowrap; }
.chip-gray   { background: #e9ecef; color: #4b5563; border-color: #dde2e8; }
.chip-brown  { background: #f0e6df; color: #8a5a3b; border-color: #e6d5c8; }
.chip-orange { background: #fbe6d4; color: #b45309; border-color: #f6d5b8; }
.chip-yellow { background: #fbf0c9; color: #92690a; border-color: #f2e2a8; }
.chip-green  { background: #dbf0e2; color: #1f7a4d; border-color: #c6e6d2; }
.chip-blue   { background: #dbeafe; color: #1d4ed8; border-color: #c7ddfb; }
.chip-purple { background: #eee0fb; color: #7e22ce; border-color: #e0cef7; }
.chip-pink   { background: #fbe0ef; color: #be185d; border-color: #f5cee2; }
.chip-red    { background: #fde0e0; color: #c02626; border-color: #f6cccc; }
html[data-theme="dark"] .chip-gray   { background: #2a3341; color: #c2cbd8; border-color: #3a4453; }
html[data-theme="dark"] .chip-brown  { background: #3a2c24; color: #e0b894; border-color: #4a382e; }
html[data-theme="dark"] .chip-orange { background: #3d2c1c; color: #f0b366; border-color: #4d3a25; }
html[data-theme="dark"] .chip-yellow { background: #3b341c; color: #e6cd6b; border-color: #4d4527; }
html[data-theme="dark"] .chip-green  { background: #1e3529; color: #7ee2a8; border-color: #2b4a3a; }
html[data-theme="dark"] .chip-blue   { background: #1e2f4d; color: #93b8f7; border-color: #2b4166; }
html[data-theme="dark"] .chip-purple { background: #302447; color: #c7a5f5; border-color: #41325c; }
html[data-theme="dark"] .chip-pink   { background: #3d2136; color: #f0a0c8; border-color: #512c46; }
html[data-theme="dark"] .chip-red    { background: #3d2224; color: #f39a9a; border-color: #512f32; }

.empty { text-align: center; padding: 26px 12px; color: var(--faint); font-size: 12.5px; }
.empty b { display: block; color: var(--muted); font-size: 13px; margin-bottom: 4px; font-weight: 600; }

/* ---------- 视图工具条 ---------- */
.date-nav { display: flex; align-items: center; gap: 5px; flex-wrap: wrap; }
.date-nav .date-input { width: 152px; padding: 7px 9px; font-size: 12.5px; }
.mini-btn { border: 1px solid var(--border); background: var(--surface); border-radius: 8px; padding: 7px 10px; font-size: 12.5px; color: var(--muted); }
.mini-btn:hover { background: var(--soft); color: var(--text); }
.seg { display: inline-flex; background: var(--soft); border: 1px solid var(--border); border-radius: 9px; padding: 3px; gap: 2px; max-width: 100%; overflow-x: auto; }
.seg button { border: none; background: transparent; padding: 5px 11px; border-radius: 7px; font-size: 12.5px; color: var(--muted); white-space: nowrap; }
.seg button.active { background: var(--surface); color: var(--primary-dark); font-weight: 600; box-shadow: 0 1px 3px rgba(16,24,40,.08); }
.month-label { font-weight: 700; font-size: 14px; min-width: 112px; text-align: center; }

/* ---------- 今日事项 ---------- */
.stat-row { display: grid; grid-template-columns: repeat(3, 1fr); gap: 12px; margin-bottom: 16px; }
.stat { background: var(--card); border: 1px solid var(--border); border-radius: 12px; padding: 14px 16px; box-shadow: var(--shadow); }
.stat b { display: block; font-size: 22px; letter-spacing: -.02em; }
.stat span { color: var(--muted); font-size: 11.5px; }
.two-col { display: grid; grid-template-columns: 1.35fr 1fr; gap: 14px; margin-bottom: 14px; }
.row { display: flex; align-items: flex-start; gap: 12px; padding: 10px 4px; border-bottom: 1px dashed var(--border); cursor: pointer; border-radius: 7px; }
.row:last-child { border-bottom: none; }
.row:hover { background: var(--soft); }
.row-time { font-variant-numeric: tabular-nums; font-weight: 700; font-size: 13px; width: 52px; flex: 0 0 52px; color: var(--work); text-align: right; }
.row-time small { display: block; color: var(--faint); font-weight: 400; font-size: 11px; }
.row-time.band { color: var(--band); }
.row-body { flex: 1; min-width: 0; }
.row-title { font-weight: 600; font-size: 13.5px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.row-meta { display: flex; align-items: center; gap: 6px; flex-wrap: wrap; margin-top: 5px; color: var(--faint); font-size: 11px; }
.row .icon-btn { flex: 0 0 28px; }

.todo-line { display: flex; align-items: center; gap: 10px; padding: 9px 4px; border-bottom: 1px dashed var(--border); }
.todo-line:last-child { border-bottom: none; }
.todo-line .todo-title { flex: 1; min-width: 0; cursor: pointer; font-size: 13.5px; }
.todo-line.done .todo-title { color: var(--faint); text-decoration: line-through; }
.checkbox { width: 17px; height: 17px; accent-color: var(--school); cursor: pointer; flex: 0 0 17px; }
.due-chip {
  flex: 0 0 auto; white-space: nowrap; font-size: 11px; padding: 2px 7px; border-radius: 6px;
  background: var(--soft); color: var(--muted); border: 1px solid var(--border);
  font-variant-numeric: tabular-nums;
}
.due-chip.overdue { background: var(--danger-soft); color: var(--danger); border-color: var(--danger-border); font-weight: 600; }
.progress { height: 7px; border-radius: 99px; background: var(--soft); overflow: hidden; margin: 4px 0 16px; }
.progress-bar { height: 100%; background: var(--school); border-radius: 99px; transition: width .3s; }
.progress-text { color: var(--muted); font-size: 12px; margin-bottom: 6px; }

/* ---------- 月历（格内直接显示标题） ---------- */
.calendar { background: var(--card); border: 1px solid var(--border); border-radius: 13px; box-shadow: var(--shadow); overflow: hidden; }
.cal-head { display: grid; grid-template-columns: repeat(7, 1fr); border-bottom: 1px solid var(--border); background: var(--soft); }
.cal-head div { text-align: center; padding: 9px 0; font-size: 11.5px; color: var(--muted); font-weight: 600; }
.cal-grid { display: grid; grid-template-columns: repeat(7, 1fr); }
.cal-cell {
  min-height: 96px; border-right: 1px solid var(--border); border-bottom: 1px solid var(--border);
  padding: 7px; cursor: pointer; transition: .15s; overflow: hidden;
}
.cal-cell:nth-child(7n) { border-right: none; }
.cal-grid .cal-cell:nth-last-child(-n+7) { border-bottom: none; }
.cal-cell:hover { background: var(--primary-soft); }
.cal-cell.outside { background: var(--outside-bg); }
.cal-cell.outside .cal-daynum { color: var(--outside-text); }
.cal-cell.today { background: var(--today-bg); }
.cal-cell.selected { box-shadow: inset 0 0 0 2px var(--primary); }
.cal-daynum { font-size: 12px; font-weight: 600; color: var(--muted); margin-bottom: 5px; display: flex; justify-content: flex-start; align-items: center; gap: 6px; }
.cal-cell.today .cal-daynum span:first-child { background: var(--primary); color: #fff; border-radius: 6px; padding: 0 6px; }
.today-flag { color: var(--primary); font-size: 10px; }
.cal-item {
  display: flex; align-items: center; gap: 4px; font-size: 10.5px; padding: 3px 5px; border-radius: 5px;
  background: var(--cal-item-bg); color: var(--cal-item-text); border: 1px solid var(--chip-border);
  margin-bottom: 3px; white-space: nowrap; overflow: hidden;
}
.cal-item:hover { filter: brightness(.95); }
.ci-time { flex: 0 0 auto; color: var(--faint); font-variant-numeric: tabular-nums; }
.ci-title { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; min-width: 0; }
.cal-more { font-size: 10.5px; color: var(--faint); padding-left: 4px; }

.cal-day-detail { margin-top: 14px; background: var(--card); border: 1px solid var(--border); border-radius: 13px; box-shadow: var(--shadow); padding: 14px 16px; }
.detail-head { display: flex; align-items: center; justify-content: space-between; gap: 10px; margin-bottom: 8px; flex-wrap: wrap; }
.detail-head b { font-size: 14px; }
.detail-sub { color: var(--faint); font-size: 11.5px; margin-left: 8px; }
.detail-head .btn { padding: 5px 11px; font-size: 12px; }

/* ---------- 乐队时间表 ---------- */
.tl-group { margin-bottom: 18px; }
.tl-group-title { font-size: 12px; color: var(--muted); font-weight: 700; margin: 0 0 8px; padding-left: 2px; }
.tl-row { display: flex; align-items: center; gap: 14px; padding: 11px 14px; border-bottom: 1px dashed var(--border); }
.tl-row:last-child { border-bottom: none; }
.tl-row:hover { background: var(--soft); }
.tl-date { width: 92px; flex: 0 0 92px; font-size: 12.5px; color: var(--muted); font-variant-numeric: tabular-nums; }
.tl-time { width: 58px; flex: 0 0 58px; font-weight: 700; font-size: 14px; font-variant-numeric: tabular-nums; }
.tl-cat { flex: 1; min-width: 0; }
.tl-row .icon-btn { flex: 0 0 28px; }
.tl-near { border-left: 3px solid var(--show); }
.tl-past { opacity: .55; }

/* ---------- 弹窗 / 表单 ---------- */
.modal { position: fixed; inset: 0; background: var(--overlay); display: flex; align-items: center; justify-content: center; padding: 18px; z-index: 50; }
.modal-card { width: 100%; max-width: 440px; max-height: 90vh; overflow-y: auto; background: var(--card); border-radius: 15px; box-shadow: var(--shadow-pop); }
.modal-card.wide { max-width: 560px; }
.modal-head { display: flex; align-items: center; justify-content: space-between; padding: 18px 20px 12px; position: sticky; top: 0; background: var(--card); z-index: 1; }
.modal-head h2 { margin: 0; font-size: 16px; }
.form-fields { padding: 6px 20px 4px; display: flex; flex-direction: column; gap: 13px; }
.field label { display: block; font-size: 12px; color: var(--muted); margin-bottom: 5px; font-weight: 600; }
.label-opt { font-weight: 400; color: var(--faint); }
.field-hint { font-size: 11.5px; color: var(--faint); margin: -4px 0 0; line-height: 1.5; }
.field-row { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.form-error { color: var(--danger); font-size: 12.5px; padding: 0 20px; margin-top: 8px; }
.modal-foot { display: flex; align-items: center; gap: 8px; padding: 18px 20px 20px; }
.spacer { flex: 1; }

/* 选项字段触发器 */
.opt-field { position: relative; }
.opt-trigger {
  width: 100%; display: flex; align-items: center; justify-content: space-between; gap: 8px;
  padding: 8px 10px; min-height: 38px; border: 1px solid var(--border); border-radius: 9px;
  background: var(--surface); color: var(--text); text-align: left; transition: .15s;
}
.opt-trigger:hover { border-color: var(--primary); }
.opt-trigger:focus-visible { outline: none; border-color: var(--primary); box-shadow: 0 0 0 3px var(--primary-soft); }
.opt-current { min-width: 0; overflow: hidden; }
.opt-caret { color: var(--faint); font-size: 12px; flex: 0 0 auto; }
.opt-placeholder { color: var(--faint); font-size: 13px; }

/* 打卡与工作时长 */
.clock-row { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.clock-btn { padding: 6px 11px; font-size: 12px; }
.clock-hint { font-size: 11.5px; color: var(--faint); }
.derived-box { background: var(--soft); border: 1px solid var(--border); border-radius: 10px; padding: 10px 12px; }
.derived-row { display: flex; gap: 22px; flex-wrap: wrap; }
.derived-item { display: flex; flex-direction: column; gap: 2px; }
.derived-item b { font-size: 11px; color: var(--muted); font-weight: 600; }
.derived-val { font-size: 14px; font-weight: 700; font-variant-numeric: tabular-nums; }
.derived-val.ot, .derived-val.bad { color: var(--danger); }
.derived-note { font-size: 11px; color: var(--faint); margin-top: 7px; line-height: 1.5; }
.derived-empty { font-size: 12px; color: var(--faint); }

/* 日历订阅面板 */
.cal-body { padding: 4px 20px 20px; }
.cal-lead { font-size: 12.5px; color: var(--muted); line-height: 1.65; margin: 0 0 14px; }
.cal-lead b { color: var(--text); }
.cal-field { margin-bottom: 12px; }
.cal-field label { display: block; font-size: 12px; color: var(--muted); font-weight: 600; margin-bottom: 5px; }
.cal-tabs { display: flex; gap: 4px; border-bottom: 1px solid var(--border); margin: 2px 0 14px; overflow-x: auto; }
.cal-tab { border: none; background: transparent; padding: 8px 10px; font-size: 12.5px; color: var(--muted); white-space: nowrap; border-bottom: 2px solid transparent; }
.cal-tab.active { color: var(--primary-dark); border-bottom-color: var(--primary); font-weight: 600; }
.copy-row { display: flex; gap: 8px; }
.copy-row .input { flex: 1; min-width: 0; font-size: 12px; }
.copy-row .btn { flex: 0 0 auto; }
.steps { margin: 8px 0 0; padding-left: 20px; font-size: 12.5px; line-height: 1.8; color: var(--text); }
.steps li { margin-bottom: 2px; }
.steps li::marker { color: var(--faint); }
.steps code, .cal-warn code { background: var(--soft); padding: 1px 4px; border-radius: 4px; font-size: 11.5px; }
.pane-note { font-size: 11.5px; color: var(--faint); line-height: 1.6; margin: 10px 0 0; }
.cal-foot { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; margin-top: 14px; padding-top: 14px; border-top: 1px solid var(--border); }
.cal-note { font-size: 11.5px; color: var(--danger); }
.cal-warn { font-size: 11.5px; color: var(--muted); line-height: 1.6; margin: 12px 0 0; }

/* ---------- Notion 风格选项浮层 ---------- */
.opt-pop {
  position: fixed; z-index: 70; display: flex; flex-direction: column;
  background: var(--card); border: 1px solid var(--border); border-radius: 12px;
  box-shadow: var(--shadow-pop); padding: 10px; max-height: 340px;
}
.opt-pop.bottom-sheet { border-radius: 16px 16px 0 0; max-height: 72dvh; padding-bottom: calc(10px + env(safe-area-inset-bottom)); }
.opt-pop-head { display: flex; align-items: center; justify-content: space-between; margin-bottom: 8px; }
.opt-pop-head b { font-size: 13px; }
.opt-search-wrap { margin-bottom: 8px; }
.opt-search { font-size: 13px; padding: 7px 10px; }
.opt-list { flex: 1; overflow-y: auto; min-height: 40px; }
.opt-row { display: flex; align-items: center; gap: 2px; border-radius: 7px; }
.opt-row:hover { background: var(--soft); }
.opt-row.selected { background: var(--primary-soft); }
.opt-choice {
  flex: 1; min-width: 0; display: flex; align-items: center; justify-content: space-between; gap: 6px;
  border: none; background: transparent; padding: 6px 8px; text-align: left; border-radius: 7px;
}
.opt-check { color: var(--primary-dark); font-weight: 700; font-size: 13px; }
.opt-mini { border: none; background: transparent; color: var(--faint); width: 26px; height: 28px; border-radius: 6px; font-size: 13px; }
.opt-mini:hover { background: var(--border); color: var(--text); }
.opt-empty { text-align: center; color: var(--faint); font-size: 12px; padding: 14px 4px; }
.opt-create { margin-top: 6px; }
.opt-create-btn {
  width: 100%; text-align: left; border: 1px dashed var(--border); background: transparent;
  color: var(--primary-dark); padding: 8px 10px; border-radius: 8px; font-size: 12.5px;
}
.opt-create-btn:hover { background: var(--primary-soft); }
.opt-create-btn.muted { color: var(--faint); border-style: dashed; }
.opt-pop-foot { font-size: 10.5px; color: var(--faint); margin-top: 8px; padding-top: 8px; border-top: 1px solid var(--border); line-height: 1.5; }
.opt-edit { padding: 8px; border: 1px solid var(--border); border-radius: 9px; background: var(--soft); margin: 2px 0; }
.opt-edit-input { font-size: 13px; padding: 7px 9px; }
.opt-colors { display: flex; gap: 5px; flex-wrap: wrap; margin: 8px 0; }
.swatch { width: 19px; height: 19px; border-radius: 5px; border: 1px solid rgba(127, 127, 127, .25); padding: 0; }
.swatch.active { outline: 2px solid var(--text); outline-offset: 2px; }
.swatch-gray { background: #8b95a3; } .swatch-brown { background: #a9714a; } .swatch-orange { background: #e0902f; }
.swatch-yellow { background: #d9b53a; } .swatch-green { background: #34a06a; } .swatch-blue { background: #3b82f6; }
.swatch-purple { background: #a855f7; } .swatch-pink { background: #ec4899; } .swatch-red { background: #e05252; }
.opt-edit-actions { display: flex; gap: 6px; flex-wrap: wrap; }
.opt-edit-actions .btn.danger { margin-left: auto; }

.toast { position: fixed; bottom: 28px; left: 50%; transform: translateX(-50%); background: var(--toast-bg); color: var(--toast-text); padding: 10px 18px; border-radius: 9px; font-size: 13px; z-index: 80; box-shadow: var(--shadow-pop); max-width: 88vw; text-align: center; }
.tabbar { display: none; }

/* ---------- 响应式 ---------- */
@media (max-width: 900px) {
  .two-col { grid-template-columns: 1fr; }
  .stat-row { grid-template-columns: repeat(3, 1fr); }
}

@media (max-width: 760px) {
  .sidebar { display: none; }
  .main { padding: 0 14px calc(84px + env(safe-area-inset-bottom)); }
  .topbar { padding: 16px 0 12px; align-items: flex-start; gap: 10px; }
  .topbar h1 { font-size: 19px; }
  .sub { font-size: 12px; }
  .top-actions { width: 100%; justify-content: space-between; gap: 8px; }
  .top-actions .btn.primary { min-height: 38px; }
  .view-tools { order: 1; width: 100%; }
  button.more-btn { display: inline-flex; width: 38px; height: 38px; font-size: 20px; border: 1px solid var(--border); background: var(--surface); }
  .date-nav { width: 100%; }
  .date-nav .date-input { flex: 1; min-width: 120px; }
  .mini-btn { min-height: 36px; padding: 7px 12px; }
  .month-label { min-width: 96px; font-size: 13px; }
  .input, .select, .date-input, .opt-trigger, .opt-search, .opt-edit-input { font-size: 16px; }  /* 防 iOS 聚焦缩放 */
  .copy-row .input { font-size: 12px; }
  .opt-search { font-size: 16px; }

  .stat-row { gap: 8px; }
  .stat { padding: 11px 10px; }
  .stat b { font-size: 18px; }
  .stat span { font-size: 10.5px; }
  .panel { padding: 14px 13px; }
  .panel-head { gap: 6px; }
  .icon-btn { width: 34px; height: 34px; font-size: 20px; }
  .row { gap: 9px; }
  .row-time { width: 46px; flex-basis: 46px; font-size: 12.5px; }
  .row-time small { font-size: 10px; }

  /* 待办行改为两行网格：第一行 复选框/标题/删除，第二行放截止时间徽标。
     徽标用 justify-self:start 收缩到内容宽度，避免 flex-basis:100% + 左 margin 撑破卡片右边缘。 */
  .todo-line { display: grid; grid-template-columns: 17px minmax(0, 1fr) auto; align-items: center; column-gap: 10px; row-gap: 5px; }
  .todo-line .todo-title { min-width: 0; }
  .due-chip { grid-column: 2 / 4; grid-row: 2; justify-self: start; margin: 0; width: fit-content; max-width: 100%; }

  /* 窄屏月历：格内显示标题（精简为单行、隐藏时间前缀），不再用圆点 */
  .cal-head div { padding: 7px 0; font-size: 10px; }
  .cal-cell { min-height: 62px; padding: 4px 3px; }
  .cal-daynum { font-size: 11px; margin-bottom: 3px; gap: 3px; }
  .cal-cell.today .cal-daynum span:first-child { padding: 0 4px; }
  .today-flag { display: none; }
  .cal-item { font-size: 9.5px; padding: 2px 3px; gap: 0; border-radius: 4px; margin-bottom: 2px; }
  .ci-time { display: none; }
  .cal-more { font-size: 9px; padding-left: 2px; }
  .cal-day-detail { padding: 12px 13px; }
  .detail-head b { font-size: 13.5px; }
  .detail-sub { display: block; margin: 2px 0 0; }

  .tl-row { gap: 8px; padding: 10px 8px; }
  .tl-date { width: 62px; flex-basis: 62px; font-size: 11px; }
  .tl-time { width: 44px; flex-basis: 44px; font-size: 13px; }
  .tl-cat { flex: 1; }
  .tl-row .icon-btn { flex-basis: 32px; }

  .clock-btn { min-height: 38px; }
  .derived-row { gap: 14px; }

  /* 弹窗改为底部抽屉 */
  .modal { align-items: flex-end; padding: 0; }
  .modal-card, .modal-card.wide {
    width: 100%; max-width: none; max-height: 92dvh; border-radius: 18px 18px 0 0;
    padding-bottom: env(safe-area-inset-bottom);
  }
  .modal-head { padding: 16px 18px 10px; }
  .form-fields { padding: 6px 18px 4px; }
  .modal-foot { padding: 14px 18px 18px; }
  .field-row { grid-template-columns: 1fr; gap: 13px; }
  .cal-body { padding: 4px 18px 18px; }
  .copy-row .btn { min-height: 38px; }
  .toast { bottom: calc(76px + env(safe-area-inset-bottom)); }

  .tabbar {
    display: grid; grid-template-columns: repeat(4, 1fr); position: fixed; bottom: 0; left: 0; right: 0;
    background: var(--tabbar-bg); backdrop-filter: blur(8px);
    border-top: 1px solid var(--border); z-index: 40;
    padding-bottom: env(safe-area-inset-bottom);
    box-shadow: 0 -2px 12px rgba(16, 24, 40, .05);
  }
  .tab-item {
    border: none; background: transparent; padding: 8px 2px 7px; min-height: 52px;
    display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 2px;
    font-size: 10.5px; color: var(--muted); position: relative;
  }
  .tab-item span { font-size: 17px; line-height: 1.1; }
  .tab-item.active { color: var(--primary-dark); font-weight: 700; }
  .tab-item.active::before { content: ''; position: absolute; top: 0; left: 26%; right: 26%; height: 2px; border-radius: 2px; background: var(--primary); }
}

@media (max-width: 380px) {
  .stat { padding: 9px 8px; }
  .stat b { font-size: 16px; }
  .stat span { font-size: 10px; }
  .topbar h1 { font-size: 18px; }
  .cal-cell { min-height: 56px; }
  .month-label { min-width: 84px; }
  .seg button { padding: 5px 8px; font-size: 12px; }
  .due-chip { margin-left: 0; }
  .theme-btn { font-size: 10px; }
}
