/* 布局（侧边栏 / 顶栏 / 提示条 / 登录页）+ 前端 A 页面专属样式（工作台 / 任务 / 日历 / 清单）。
   只用 core.css 里的颜色变量，浅色/深色自动适配。 */
:root { --sb-w: 220px; --sb-w-mini: 64px; --top-h: 56px; }

/* ================= 登录 ================= */
.auth { min-height: 100vh; min-height: 100dvh; display: grid; place-items: center; padding: 16px; }
.auth-card { width: 100%; max-width: 380px; background: var(--surface); border: 1px solid var(--line); padding: 28px 24px; border-radius: 20px; box-shadow: 0 8px 30px rgba(0,0,0,.06); }
.auth-brand { display: flex; align-items: center; gap: 10px; font-weight: 700; font-size: 26px; }
.auth-brand img { width: 40px; height: 40px; }
.auth-tagline { color: var(--muted); margin: 6px 0 20px; }
.auth-seg { margin-bottom: 18px; }
.auth-seg button { padding: 6px 20px; font-size: 14px; }
.auth-err { color: var(--danger); font-size: 13px; min-height: 1.4em; margin: -4px 0 8px; }
.auth-submit { width: 100%; height: 44px; font-size: 15px; }
.auth-hint { color: var(--muted); font-size: 13px; text-align: center; margin-top: 12px; }
.auth { grid-template-rows: 1fr auto; }
.auth-agree { display: flex; align-items: flex-start; gap: 8px; font-size: 13px; color: var(--text-2); margin: 2px 0 8px; line-height: 1.55; cursor: pointer; }
.auth-agree input { margin-top: 3px; flex: none; width: 16px; height: 16px; }
.auth-agree a { color: var(--accent-ink); }
.auth-forgot { text-align: center; margin-top: 6px; }
.auth-forgot-text { font-size: 13px; color: var(--text-2); background: var(--surface-2); border-radius: 10px; padding: 10px 12px; margin-top: 8px; line-height: 1.6; word-break: break-word; }
.auth-foot { display: flex; flex-wrap: wrap; justify-content: center; align-items: center; gap: 4px 8px; font-size: 12px; color: var(--muted); padding: 12px 0 max(4px, env(safe-area-inset-bottom)); }
.auth-foot a { color: var(--muted); }
.auth-foot a:hover { color: var(--text); }

/* ================= 框架 ================= */
.app { display: flex; min-height: 100vh; min-height: 100dvh; }
.main { flex: 1; min-width: 0; display: flex; flex-direction: column; }

/* 侧边栏 */
.sidebar {
  width: var(--sb-w); flex: none; position: sticky; top: 0; height: 100vh; height: 100dvh; z-index: 30;
  display: flex; flex-direction: column; background: var(--surface); border-right: 1px solid var(--line);
  transition: width .18s ease, transform .2s ease;
}
.sb-brand { display: flex; align-items: center; gap: 10px; height: var(--top-h); padding: 0 18px; flex: none; color: var(--text); font-weight: 700; font-size: 18px; border-bottom: 1px solid var(--line); white-space: nowrap; overflow: hidden; }
.sb-brand:hover { text-decoration: none; }
.sb-brand img { width: 28px; height: 28px; flex: none; }
.sb-nav { flex: 1; overflow-y: auto; overflow-x: hidden; padding: 10px 10px 16px; display: flex; flex-direction: column; gap: 2px; }
.sb-foot { flex: none; padding: 12px 18px; border-top: 1px solid var(--line); font-size: 12px; color: var(--muted); white-space: nowrap; overflow: hidden; }

.nav-item {
  display: flex; align-items: center; gap: 10px; width: 100%; min-height: 40px; padding: 0 10px; border-radius: 9px;
  border: 0; background: transparent; color: var(--text-2); cursor: pointer; text-align: left; font-size: 14px; white-space: nowrap;
}
.nav-item:hover { background: var(--surface-2); color: var(--text); text-decoration: none; }
.nav-item.active { background: var(--accent-soft); color: var(--accent-ink); font-weight: 600; }
.nav-item.active-parent { color: var(--text); font-weight: 600; }
.nav-icon { width: 24px; flex: none; text-align: center; font-size: 16px; }
.nav-label { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; }
.nav-caret { flex: none; color: var(--muted); transition: transform .15s; font-size: 16px; }
.nav-group.open > .nav-parent .nav-caret { transform: rotate(90deg); }
.nav-count { flex: none; min-width: 20px; height: 18px; padding: 0 6px; border-radius: 99px; background: var(--danger); color: #fff; font-size: 11px; line-height: 18px; text-align: center; font-weight: 600; }
.nav-sub { display: none; flex-direction: column; gap: 1px; padding: 2px 0 6px; }
.nav-group.open > .nav-sub { display: flex; }
.nav-flyout-title { display: none; }
.nav-subitem { display: flex; align-items: center; min-height: 36px; padding: 0 10px 0 44px; border-radius: 9px; color: var(--text-2); font-size: 13.5px; white-space: nowrap; position: relative; }
.nav-subitem:hover { background: var(--surface-2); color: var(--text); text-decoration: none; }
.nav-subitem.active { background: var(--accent-soft); color: var(--accent-ink); font-weight: 600; }
.nav-subitem.active::before { content: ""; position: absolute; left: 30px; top: 50%; width: 5px; height: 5px; margin-top: -2.5px; border-radius: 50%; background: var(--accent); }
.nav-item:focus-visible, .nav-subitem:focus-visible, .icon-btn:focus-visible, .acct-btn:focus-visible { outline: 2px solid var(--accent); outline-offset: -2px; }

/* 折叠成图标栏（仅电脑） */
@media (min-width: 1024px) {
  .sb-collapsed .sidebar { width: var(--sb-w-mini); }
  .sb-collapsed .sb-brand { padding: 0 18px; }
  .sb-collapsed .sb-brand-text, .sb-collapsed .nav-label, .sb-collapsed .nav-caret, .sb-collapsed .sb-foot-text { display: none; }
  .sb-collapsed .sb-nav { overflow: visible; padding: 10px 8px; }
  .sb-collapsed .nav-item { justify-content: center; padding: 0; position: relative; }
  .sb-collapsed .nav-item .nav-count { position: absolute; top: 2px; right: 2px; min-width: 16px; height: 16px; line-height: 16px; padding: 0 4px; font-size: 10px; }
  .sb-collapsed .nav-group { position: relative; }
  .sb-collapsed .nav-group.has-active > .nav-parent { background: var(--accent-soft); color: var(--accent-ink); }
  .sb-collapsed .nav-group > .nav-sub,
  .sb-collapsed .nav-group.open > .nav-sub { display: none; }
  /* 悬停时浮出子菜单 */
  .sb-collapsed .nav-group:hover > .nav-sub,
  .sb-collapsed .nav-group:focus-within > .nav-sub {
    display: flex; position: absolute; left: calc(100% + 4px); top: 0; min-width: 160px; padding: 6px; z-index: 40;
    background: var(--surface); border: 1px solid var(--line); border-radius: 10px; box-shadow: 0 8px 24px rgba(0,0,0,.12);
  }
  .sb-collapsed .nav-group:hover > .nav-sub::before { content: ""; position: absolute; left: -8px; top: 0; bottom: 0; width: 8px; }
  .sb-collapsed .nav-flyout-title { display: block; padding: 4px 10px 6px; font-size: 12px; color: var(--muted); }
  .sb-collapsed .nav-subitem { padding-left: 12px; }
  .sb-collapsed .nav-subitem.active::before { display: none; }
}

/* 手机 / 平板：抽屉 */
.sb-mask { display: none; }
@media (max-width: 1023.98px) {
  .sidebar { position: fixed; left: 0; top: 0; bottom: 0; width: min(260px, 82vw); transform: translateX(-100%); box-shadow: none; }
  .drawer-open .sidebar { transform: none; box-shadow: 8px 0 30px rgba(0,0,0,.18); }
  .sb-mask { display: block; position: fixed; inset: 0; z-index: 25; background: rgba(0,0,0,.35); opacity: 0; pointer-events: none; transition: opacity .2s; }
  .drawer-open .sb-mask { opacity: 1; pointer-events: auto; }
  .sb-brand { padding-top: env(safe-area-inset-top); height: calc(var(--top-h) + env(safe-area-inset-top)); }
}

/* 顶栏 */
.topbar {
  position: sticky; top: 0; z-index: 20; display: flex; align-items: center; gap: 8px; height: var(--top-h); padding: 0 16px;
  background: color-mix(in srgb, var(--surface) 92%, transparent); backdrop-filter: blur(8px); -webkit-backdrop-filter: blur(8px);
  border-bottom: 1px solid var(--line);
}
@media (max-width: 1023.98px) { .topbar { padding-top: env(safe-area-inset-top); height: calc(var(--top-h) + env(safe-area-inset-top)); padding-left: 8px; padding-right: 8px; } }
.top-toggle { font-size: 18px; width: 36px; height: 36px; flex: none; }
.crumb { flex: 1; min-width: 0; display: flex; align-items: center; gap: 6px; font-size: 14px; white-space: nowrap; overflow: hidden; }
.crumb-parent { color: var(--muted); }
.crumb-sep { color: var(--line); color: var(--muted); opacity: .6; }
.crumb-cur { color: var(--text); font-weight: 600; overflow: hidden; text-overflow: ellipsis; }
.top-right { display: flex; align-items: center; gap: 4px; flex: none; }
.plan-badge { height: 24px; padding: 0 10px; margin-right: 4px; }
.plan-badge:hover { text-decoration: none; filter: brightness(.97); }
.bell { position: relative; display: inline-flex; align-items: center; justify-content: center; width: 38px; height: 38px; font-size: 17px; }
.bell:hover { text-decoration: none; }
.bell-count { position: absolute; top: -1px; right: -8px; min-width: 18px; height: 18px; padding: 0 5px; border-radius: 99px; background: var(--danger); color: #fff; font-size: 11px; line-height: 18px; font-weight: 600; text-align: center; border: 2px solid var(--surface); box-sizing: content-box; }
.acct { position: relative; }
.acct-btn { display: flex; align-items: center; gap: 6px; height: 38px; padding: 0 8px; border: 0; border-radius: 9px; background: transparent; cursor: pointer; color: var(--text-2); }
.acct-btn:hover { background: var(--surface-2); }
.avatar { width: 28px; height: 28px; border-radius: 50%; background: var(--accent-soft); display: grid; place-items: center; font-size: 14px; flex: none; }
.acct-name { font-size: 13px; max-width: 140px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.caret { font-size: 11px; color: var(--muted); }
.acct-menu {
  position: absolute; right: 0; top: calc(100% + 6px); min-width: 200px; z-index: 50; padding: 6px;
  background: var(--surface); border: 1px solid var(--line); border-radius: 12px; box-shadow: 0 12px 32px rgba(0,0,0,.14);
  display: flex; flex-direction: column;
}
.acct-menu-head { padding: 8px 10px 10px; border-bottom: 1px solid var(--line); margin-bottom: 4px; }
.acct-menu-account { font-weight: 600; word-break: break-all; }
.acct-menu a, .acct-menu button { display: block; width: 100%; text-align: left; padding: 9px 10px; border-radius: 8px; border: 0; background: transparent; color: var(--text); font-size: 14px; cursor: pointer; }
.acct-menu a:hover, .acct-menu button:hover { background: var(--surface-2); text-decoration: none; }
.acct-logout { color: var(--danger) !important; }
@media (max-width: 640px) {
  .acct-name, .caret { display: none; }
  .acct-btn { padding: 0 4px; }
  .crumb-parent, .crumb-sep { display: none; }
  .plan-badge { padding: 0 8px; font-size: 11.5px; }
}

/* 全局提示条 */
.banners:empty { display: none; }
.banners { padding: 12px 24px 0; display: flex; flex-direction: column; gap: 8px; }
.banner { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; padding: 9px 12px; border-radius: 10px; font-size: 14px; }
.banner-text { flex: 1 1 200px; min-width: 0; }
.banner a { font-weight: 600; white-space: nowrap; }
.banner-info { background: var(--accent-soft); color: var(--text); }
.banner-danger { background: var(--danger-soft); color: var(--danger); }
.banner-danger a { color: var(--danger); text-decoration: underline; }
.banner-warning { background: var(--warning-soft, #FFF4E0); color: var(--text); }
.banner-close { margin-left: auto; font-size: 13px; padding: 4px 6px; }

/* 内容区 */
.content { flex: 1; width: 100%; max-width: 1360px; padding: 20px 24px 48px; outline: none; }
@media (max-width: 640px) {
  .content { padding: 14px 12px calc(32px + env(safe-area-inset-bottom)); }
  .banners { padding: 10px 12px 0; }
  h1 { font-size: 18px; }
  .page-head { margin-bottom: 12px; }
}
.page-fail { padding: 64px 16px; }
.page-fail-title { font-size: 17px; font-weight: 600; color: var(--text); margin-bottom: 4px; }
.page-fail-actions { display: flex; gap: 8px; justify-content: center; margin-top: 16px; }
.center { text-align: center; }
.nowrap { white-space: nowrap; }

/* ================= 任务公共组件 ================= */
.task-list { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 2px; }
.task-item { display: flex; align-items: flex-start; gap: 10px; padding: 8px 6px; border-radius: 9px; }
.task-item:hover { background: var(--surface-2); }
.task-check {
  flex: none; width: 22px; height: 22px; margin-top: 1px; border-radius: 50%; border: 2px solid var(--muted); background: transparent;
  display: grid; place-items: center; padding: 0; cursor: pointer; color: #fff; font-size: 12px; font-weight: 700; line-height: 1;
}
.task-check:hover { border-color: var(--accent); background: var(--accent-soft); }
.task-check.on { background: var(--success); border-color: var(--success); }
.task-check:disabled { opacity: .5; }
.task-body { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 3px; border: 0; background: transparent; padding: 0; text-align: left; cursor: pointer; color: inherit; }
.task-title { word-break: break-word; line-height: 1.45; }
.is-done .task-title { color: var(--muted); text-decoration: line-through; }
.task-meta { display: flex; flex-wrap: wrap; gap: 6px; align-items: center; font-size: 12px; }
.list-tag { display: inline-flex; align-items: center; gap: 5px; font-size: 12px; color: var(--text-2); white-space: nowrap; max-width: 160px; }
.list-tag span:last-child { overflow: hidden; text-overflow: ellipsis; }

/* 新建表单 */
.task-form { display: flex; flex-direction: column; gap: 10px; }
.task-form .field { margin-bottom: 0; }
.tf-title-row { display: flex; gap: 8px; }
.tf-title-row input { flex: 1; min-width: 0; font-size: 15px; min-height: 40px; }
.ai-btn { flex: none; height: 40px; background: var(--accent-soft); color: var(--accent-ink); border-color: transparent; font-weight: 600; }
.ai-btn:disabled { opacity: .7; }
.img-btn { flex: none; height: 40px; width: 44px; padding: 0; justify-content: center; font-size: 18px; }
.tf-img { display: flex; align-items: center; gap: 10px; padding: 8px; border: 1px dashed var(--line); border-radius: 10px; }
.tf-img img { width: 56px; height: 56px; object-fit: cover; border-radius: 8px; flex: none; background: var(--surface-2); }
.tf-img-status { flex: 1; min-width: 0; font-size: 13px; color: var(--text-2); }
.editor-img-row { display: flex; align-items: flex-end; gap: 10px; margin-bottom: 4px; }
.editor-img img { display: block; max-width: 220px; max-height: 220px; border-radius: 10px; border: 1px solid var(--line); object-fit: contain; background: var(--surface-2); }
.editor-img.is-dropped img { opacity: .3; }
@media (max-width: 640px) { .tf-title-row input { font-size: 16px; } }
.tf-tip { font-size: 12px; color: var(--muted); margin-top: -4px; }
.tf-grid { display: grid; grid-template-columns: minmax(0, 1.4fr) minmax(0, 1fr) minmax(0, 1fr); gap: 10px; }
.task-form.compact .tf-grid { grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); }
.task-form.compact .tf-grid > .field:first-child { grid-column: 1 / -1; }
@media (max-width: 640px) {
  .tf-grid { grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); }
  .tf-grid > .field:first-child { grid-column: 1 / -1; }
}
.tf-chips { display: flex; flex-wrap: wrap; gap: 6px; }
.chip { height: 28px; padding: 0 11px; border-radius: 99px; border: 1px solid var(--line); background: var(--surface); color: var(--text-2); font-size: 12.5px; cursor: pointer; white-space: nowrap; }
.chip:hover { border-color: var(--accent); color: var(--accent-ink); }
.chip-ghost { border-style: dashed; color: var(--muted); }
.tf-foot { display: flex; align-items: flex-start; justify-content: space-between; gap: 10px; flex-wrap: wrap; }
.tf-follow { flex: 1 1 220px; font-size: 13px; }
.tf-follow summary { color: var(--text-2); cursor: pointer; padding: 6px 0; }
.tf-follow-row { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; padding-top: 4px; color: var(--text-2); }
.tf-follow-row select { width: auto; min-width: 96px; }
.tf-submit { min-width: 96px; }
@media (max-width: 640px) { .tf-submit { flex: 1 1 100%; height: 40px; } }

/* 编辑弹窗 */
.task-editor .modal-foot .btn-danger { margin-right: auto; }
.task-editor .modal-foot { flex-wrap: wrap; }
.editor-info { display: flex; flex-wrap: wrap; gap: 6px; align-items: center; margin-bottom: 14px; }
.editor-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 0 14px; }
.editor-grid > .field:first-child { grid-column: 1 / -1; }
@media (max-width: 480px) { .editor-grid { gap: 0 10px; } }

/* ================= 工作台 ================= */
.stat-link { display: block; color: inherit; border-radius: var(--radius); }
.stat-link:hover { text-decoration: none; }
.stat-link:hover .stat-card { border-color: var(--accent); }
.stat-link .stat-card { height: 100%; transition: border-color .15s; }
.dash-stats > .loading { grid-column: 1 / -1; }
.dash-error { grid-column: 1 / -1; margin: 0; }
.dash-grid { display: grid; grid-template-columns: minmax(0, 1.35fr) minmax(0, 1fr); gap: 16px; align-items: start; }
@media (max-width: 1100px) { .dash-grid { grid-template-columns: minmax(0, 1fr); } }
.dash-col { min-width: 0; }
.dash-empty { padding: 12px 0; text-align: center; font-size: 13px; }
.tl-late { background: var(--danger-soft); border-radius: 10px; padding: 8px 8px 4px; margin-bottom: 12px; }
.tl-late-head { display: flex; justify-content: space-between; align-items: center; color: var(--danger); font-weight: 600; font-size: 13px; padding: 0 6px 4px; }
.tl-late .task-item:hover { background: color-mix(in srgb, var(--surface) 50%, transparent); }
.timeline { list-style: none; margin: 0; padding: 0; position: relative; }
.timeline::before { content: ""; position: absolute; left: 55px; top: 8px; bottom: 8px; width: 2px; background: var(--line); }
.tl-item { display: grid; grid-template-columns: 44px 24px minmax(0, 1fr); align-items: start; position: relative; padding: 2px 0; }
.tl-time { font-size: 13px; color: var(--text-2); font-variant-numeric: tabular-nums; padding-top: 8px; text-align: right; }
.tl-dot { width: 10px; height: 10px; border-radius: 50%; background: var(--surface); border: 2px solid var(--accent); margin: 12px auto 0; position: relative; z-index: 1; }
.tl-item.is-done .tl-dot { background: var(--success); border-color: var(--success); }
.tl-item.is-late .tl-dot { border-color: var(--danger); background: var(--danger); }
.tl-item.is-late .tl-time { color: var(--danger); }
.tl-card { display: flex; gap: 10px; align-items: flex-start; padding: 6px 8px; border-radius: 9px; }
.tl-card:hover { background: var(--surface-2); }

/* ================= 任务页 ================= */
.view-switch { margin-bottom: 14px; max-width: 100%; overflow-x: auto; }
.add-card .card-body { padding-top: 10px; }
.task-toolbar > select { min-width: 0; flex: 0 1 auto; }
@media (max-width: 640px) {
  .task-toolbar > .grow { flex: 1 1 100%; }
  .task-toolbar > select { flex: 1 1 calc(50% - 5px); min-width: 0; }
  .task-toolbar > select:first-of-type { flex-basis: 100%; }
}
.batch-bar { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; padding: 8px 10px; margin-bottom: 12px; border-radius: 10px; background: var(--accent-soft); }
.batch-count { font-weight: 600; color: var(--accent-ink); margin-right: 4px; font-size: 13px; }
.batch-move { width: auto; min-height: 30px; height: 30px; padding: 0 26px 0 8px; font-size: 13px; }
@media (max-width: 640px) { .batch-move { height: 36px; font-size: 16px; } }
.task-table { min-width: 760px; }
.task-table td:nth-child(2) { width: 44px; }
.cell-title { display: flex; flex-direction: column; gap: 2px; min-width: 200px; }
.cell-title-text { font-weight: 500; word-break: break-word; }
.cell-title.is-done .cell-title-text { color: var(--muted); text-decoration: line-through; }
@media (max-width: 640px) { .task-table { min-width: 620px; } .cell-title { min-width: 150px; } .task-table th, .task-table td { padding-left: 8px; padding-right: 8px; } }
.cell-note { font-size: 12px; color: var(--muted); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; max-width: 360px; }

/* ================= 日历 ================= */
.cal-layout { display: grid; grid-template-columns: minmax(0, 1fr) 340px; gap: 16px; align-items: start; }
@media (max-width: 1439.98px) { .cal-layout { grid-template-columns: minmax(0, 1fr); } .cal-side .task-form:not(.compact-wide) { max-width: 720px; } }
.cal-main, .cal-side { min-width: 0; }
.cal-nav { display: flex; align-items: center; gap: 8px; margin-bottom: 12px; flex-wrap: wrap; }
.cal-nav .btn:first-child, .cal-nav .btn:nth-child(3) { width: 36px; padding: 0; font-size: 18px; }
.cal-month { font-size: 17px; min-width: 110px; text-align: center; font-variant-numeric: tabular-nums; }
.cal-nav .btn:last-child { margin-left: auto; }
.cal-grid { display: grid; grid-template-columns: repeat(7, minmax(0, 1fr)); border-top: 1px solid var(--line); border-left: 1px solid var(--line); border-radius: 10px; overflow: hidden; }
.cal-head { padding: 6px 8px; font-size: 12px; color: var(--text-2); background: var(--surface-2); border-right: 1px solid var(--line); border-bottom: 1px solid var(--line); text-align: center; }
.cal-cell {
  min-height: 108px; display: flex; flex-direction: column; align-items: stretch; gap: 3px; padding: 6px; min-width: 0;
  border: 0; border-right: 1px solid var(--line); border-bottom: 1px solid var(--line); background: var(--surface); text-align: left; cursor: pointer; color: inherit; position: relative;
}
.cal-cell:hover { background: var(--surface-2); }
.cal-cell.is-weekend { background: color-mix(in srgb, var(--surface-2) 60%, var(--surface)); }
.cal-cell.is-out { color: var(--muted); }
.cal-cell.is-out .cal-chips { opacity: .55; }
.cal-cell.is-sel { box-shadow: inset 0 0 0 2px var(--accent); }
.cal-cell:focus-visible { outline: 2px solid var(--accent); outline-offset: -2px; }
.cal-num { display: flex; align-items: center; gap: 6px; font-size: 13px; font-variant-numeric: tabular-nums; }
.cal-cell.is-today .cal-num > :first-child, .cal-cell.is-today .cal-num { font-weight: 700; color: var(--accent-ink); }
.cal-today-tag { font-size: 11px; padding: 0 6px; border-radius: 99px; background: var(--accent); color: #fff; font-weight: 600; line-height: 17px; }
.cal-chips { display: flex; flex-direction: column; gap: 2px; min-width: 0; }
.cal-chip { display: block; font-size: 12px; line-height: 18px; padding: 0 5px; border-radius: 4px; background: var(--accent-soft); color: var(--text); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; border-left: 3px solid var(--accent); }
.cal-chip.is-late { background: var(--danger-soft); color: var(--danger); border-left-color: var(--danger); }
.cal-chip.is-done { background: var(--success-soft); color: var(--text-2); border-left-color: var(--success); text-decoration: line-through; text-decoration-color: color-mix(in srgb, var(--text-2) 50%, transparent); }
.cal-chip.is-high:not(.is-done) { font-weight: 600; }
.cal-more { font-size: 11.5px; color: var(--muted); padding-left: 4px; }
.cal-count { display: none; }
.cal-legend { display: flex; gap: 14px; flex-wrap: wrap; margin-top: 10px; font-size: 12px; color: var(--muted); }
.cal-legend > span { display: inline-flex; align-items: center; gap: 6px; }
.cal-chip-demo { font-size: 11px; line-height: 16px; padding: 0 5px; border-radius: 4px; background: var(--accent-soft); color: var(--text); border-left: 3px solid var(--accent); }
.cal-chip-demo.is-late { background: var(--danger-soft); color: var(--danger); border-left-color: var(--danger); }
.cal-chip-demo.is-done { background: var(--success-soft); color: var(--text-2); border-left-color: var(--success); }
.cal-day .card-body { padding-top: 10px; }
.cal-add { margin-top: 14px; padding-top: 14px; border-top: 1px dashed var(--line); }
.cal-add-title { font-size: 13px; color: var(--text-2); font-weight: 600; margin-bottom: 8px; }
.cal-agenda { display: none; }
.agenda-day + .agenda-day { margin-top: 12px; padding-top: 12px; border-top: 1px solid var(--line); }
.agenda-date { font-size: 13px; color: var(--text-2); display: flex; align-items: center; gap: 6px; margin: 0 0 4px; }
.agenda-day.is-today .agenda-date { color: var(--accent-ink); }

/* 手机：网格只显示日期和数量，下面显示本月日程 */
@media (max-width: 700px) {
  .cal-cell { min-height: 54px; padding: 4px 2px; align-items: center; gap: 2px; }
  .cal-num { font-size: 13px; justify-content: center; }
  .cal-today-tag, .cal-chips, .cal-more, .cal-legend { display: none; }
  .cal-cell.is-today .cal-num { background: var(--accent); color: #fff; border-radius: 99px; min-width: 24px; height: 22px; justify-content: center; }
  .cal-count { display: block; font-size: 10.5px; line-height: 15px; min-width: 18px; padding: 0 4px; border-radius: 99px; text-align: center; background: var(--accent-soft); color: var(--accent-ink); font-weight: 600; }
  .cal-count.is-late { background: var(--danger-soft); color: var(--danger); }
  .cal-count.is-done { background: var(--success-soft); color: var(--success); }
  .cal-head { padding: 4px 0; font-size: 11px; }
  .cal-nav .btn:last-child { margin-left: 0; }
  .cal-nav { justify-content: space-between; }
  .cal-month { min-width: 0; flex: 1; }
  .cal-agenda { display: block; }
}

/* ================= 清单 ================= */
.list-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(240px, 1fr)); gap: 14px; }
@media (max-width: 640px) { .list-grid { grid-template-columns: minmax(0, 1fr); gap: 10px; } }
.list-card {
  position: relative; display: flex; flex-direction: column; background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius);
  box-shadow: var(--shadow); overflow: hidden; transition: border-color .15s; min-width: 0;
}
.list-card::before { content: ""; height: 4px; background: var(--list-color, var(--muted)); }
.list-card:hover { border-color: var(--list-color, var(--accent)); }
.list-card-main { display: flex; flex-direction: column; gap: 8px; padding: 14px 16px 10px; border: 0; background: transparent; text-align: left; cursor: pointer; color: inherit; }
.list-card-name { display: flex; align-items: center; gap: 8px; font-size: 15px; font-weight: 600; min-width: 0; }
.list-card-name .dot { width: 10px; height: 10px; }
.list-card-name span:last-child { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.list-card-counts { display: flex; gap: 14px; font-size: 13px; color: var(--text-2); }
.list-card-counts b { font-size: 18px; color: var(--text); font-variant-numeric: tabular-nums; margin-right: 2px; }
.list-progress { display: block; height: 6px; border-radius: 99px; background: var(--surface-2); overflow: hidden; }
.list-progress-fill { display: block; height: 100%; background: var(--list-color, var(--accent)); border-radius: 99px; }
.list-card-actions { display: flex; justify-content: flex-end; gap: 4px; padding: 0 10px 10px; }
.list-foot { margin-top: 14px; }
.swatches { display: flex; flex-wrap: wrap; gap: 10px; }
.swatch { width: 32px; height: 32px; border-radius: 50%; border: 2px solid var(--surface); box-shadow: 0 0 0 1px var(--line); cursor: pointer; padding: 0; position: relative; }
.swatch.on { box-shadow: 0 0 0 2px var(--text); }
.swatch.on::after { content: "✓"; position: absolute; inset: 0; display: grid; place-items: center; color: #fff; font-weight: 700; font-size: 14px; text-shadow: 0 1px 2px rgba(0,0,0,.35); }

/* ===== 集成修正：手机上任务表格改成卡片列表（第一行：勾选 + 完成圈 + 标题；第二行：时间/优先级/清单） ===== */
@media (max-width: 640px) {
  .task-table-box .table-wrap { border: 0; overflow: visible; }
  .task-table-box .table { min-width: 0 !important; width: 100%; }
  .task-table-box .table thead { display: none; }
  .task-table-box .table, .task-table-box .table tbody { display: block; }
  /* 手机卡片：左边固定勾选框和完成圈，右边标题占一行，状态/优先级/清单自动换行，不再截断 */
  .task-table-box .table tr {
    display: flex; flex-wrap: wrap; align-items: center; gap: 6px 8px; position: relative; min-height: 52px;
    background: var(--surface); border: 1px solid var(--line); border-radius: 12px; padding: 10px 12px 10px 80px; margin-bottom: 8px;
  }
  .task-table-box .table td { border: 0; padding: 0; min-width: 0; }
  .task-table-box .table td:nth-child(1) { position: absolute; left: 12px; top: 13px; }
  .task-table-box .table td:nth-child(2) { position: absolute; left: 40px; top: 9px; }
  .task-table-box .table td:nth-child(3) { flex: 1 1 100%; }
  .task-table-box .table td:nth-child(6) { max-width: 100%; overflow: hidden; white-space: nowrap; text-overflow: ellipsis; }
  .task-table-box .table td:nth-child(7) { display: none; }
  .task-table-box .table .table-empty { flex: 1 1 100%; margin-left: -68px; }
}

/* ================= 装到手机桌面（PWA）：刘海 / 底部横条的安全区 ================= */
/* index.html 用了 viewport-fit=cover：横屏时左右有刘海，内容往里让；提示条让开底部横条 */
@media (max-width: 1023.98px) {
  .main { padding-left: env(safe-area-inset-left); padding-right: env(safe-area-inset-right); }
  .sidebar { padding-left: env(safe-area-inset-left); padding-bottom: env(safe-area-inset-bottom); }
}
.toast { bottom: calc(32px + env(safe-area-inset-bottom)); }
/* 登录页：顶部状态栏 / 刘海、左右横屏刘海都让开 */
.auth { padding: max(16px, env(safe-area-inset-top)) max(16px, env(safe-area-inset-right)) 16px max(16px, env(safe-area-inset-left)); }
/* 从桌面打开（standalone）时没有浏览器地址栏，下拉不要整页回弹露出底色 */
@media (display-mode: standalone) { html, body { overscroll-behavior-y: none; } }
