/* EasyLife：本地资源、系统字体，无第三方依赖。
 * 布局原则：一列为主、信息密度适中；任务一行一条，只显示有信息量的标记。 */
:root {
  color-scheme: light;
  --bg: #f5f3ee;
  --card: #fffefb;
  --surface: #edf2ec;
  --text: #343d36;
  --muted: #626b60;
  --line: #e4e6dd;
  --input-line: #829489;
  --primary: #426557;
  --primary-hover: #355344;
  --on-primary: #fffefb;
  --primary-soft: #edf2ec;
  --danger: #a6303e;
  --danger-bg: #fff0f0;
  --ok: #216244;
  --ok-bg: #e5f3e9;
  --warn: #78500e;
  --warn-bg: #fff2d9;
  --focus: #2768b0;
  --hover: rgb(66 101 87 / 5%);
  /* 优先级：高=红、中=琥珀、低=蓝、最低=灰；文字色与对应浅底均 ≥ 4.5:1。 */
  --p3: #b4232f; --p3-bg: #fdeced;
  --p2: #8a5300; --p2-bg: #fcf0d9;
  --p1: #23599a; --p1-bg: #e6eefa;
  --p0: #5b6e64; --p0-bg: #edf1ee;
  --scrim: rgb(10 25 17 / 45%);
  --radius: 14px;
  --radius-sm: 8px;
  --shadow: 0 1px 2px rgb(29 57 43 / 6%), 0 2px 12px rgb(29 57 43 / 4%);
  --shadow-lift: 0 12px 40px rgb(29 57 43 / 16%);
  --space-1: 4px;
  --space-2: 8px;
  --space-3: 12px;
  --space-4: 16px;
  --space-5: 24px;
  --space-6: 32px;
  --font: system-ui, "PingFang SC", -apple-system, BlinkMacSystemFont, "Microsoft YaHei", sans-serif;
  --control: 40px;
  --page: 880px;
}

@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    color-scheme: dark;
    --bg: #121b17; --card: #1b2821; --surface: #26372d;
    --text: #e8f0e9; --muted: #b1c3b7; --line: #2e4035; --input-line: #789783;
    --primary: #93d5ad; --primary-hover: #b0e6c4; --on-primary: #10281b; --primary-soft: #284a37;
    --danger: #ffb4bb; --danger-bg: #442830; --ok: #9eddb5; --ok-bg: #243e2f;
    --warn: #f5d18d; --warn-bg: #403520; --focus: #a5ceff;
    --hover: rgb(147 213 173 / 7%); --scrim: rgb(0 0 0 / 60%);
    --p3: #ffb0b7; --p3-bg: #4a2329; --p2: #f5c97a; --p2-bg: #423419;
    --p1: #a9c8ff; --p1-bg: #1f3550; --p0: #b1c3b7; --p0-bg: #2a372f;
    --shadow: 0 1px 2px rgb(0 0 0 / 25%); --shadow-lift: 0 12px 40px rgb(0 0 0 / 45%);
  }
}

:root[data-theme="dark"] {
  color-scheme: dark;
  --bg: #121b17; --card: #1b2821; --surface: #26372d;
  --text: #e8f0e9; --muted: #b1c3b7; --line: #2e4035; --input-line: #789783;
  --primary: #93d5ad; --primary-hover: #b0e6c4; --on-primary: #10281b; --primary-soft: #284a37;
  --danger: #ffb4bb; --danger-bg: #442830; --ok: #9eddb5; --ok-bg: #243e2f;
  --warn: #f5d18d; --warn-bg: #403520; --focus: #a5ceff;
  --hover: rgb(147 213 173 / 7%); --scrim: rgb(0 0 0 / 60%);
  --p3: #ffb0b7; --p3-bg: #4a2329; --p2: #f5c97a; --p2-bg: #423419;
  --p1: #a9c8ff; --p1-bg: #1f3550; --p0: #b1c3b7; --p0-bg: #2a372f;
  --shadow: 0 1px 2px rgb(0 0 0 / 25%); --shadow-lift: 0 12px 40px rgb(0 0 0 / 45%);
}

:root[data-theme="light"] { color-scheme: light; }

/* ------------------------------------------------------------ 基础 */

*, *::before, *::after { box-sizing: border-box; }
[hidden] { display: none !important; }

html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  background: var(--bg);
  color: var(--text);
  font: 15px/1.5 var(--font);
  -webkit-font-smoothing: antialiased;
}

h1, h2, h3 { margin: 0; line-height: 1.25; letter-spacing: -.01em; }
h1 { font-size: 1.5rem; font-weight: 700; }
h2 { font-size: 1.05rem; font-weight: 650; }
h3 { font-size: 1rem; font-weight: 650; }
p { margin: 0; }
a { color: var(--primary); }

/* 视图切换时会把焦点移到标题上，鼠标用户不需要看到焦点框。 */
[tabindex="-1"]:focus { outline: none; }
:focus-visible { outline: 2px solid var(--focus); outline-offset: 2px; }

.sr-only {
  position: absolute !important;
  width: 1px; height: 1px;
  margin: -1px; padding: 0;
  overflow: hidden;
  clip: rect(0 0 0 0);
  white-space: nowrap;
  border: 0;
}

.skip-link {
  position: absolute; left: 8px; top: -60px; z-index: 100;
  padding: 8px 14px; border-radius: var(--radius-sm);
  background: var(--primary); color: var(--on-primary);
  text-decoration: none;
}
.skip-link:focus { top: 8px; }

.muted { color: var(--muted); }
.small { font-size: .8125rem; }
.eyebrow { display: block; color: var(--muted); font-size: .75rem; font-weight: 600; letter-spacing: .04em; }

/* ------------------------------------------------------------ 顶栏 */

.site-header {
  position: sticky; top: 0; z-index: 20;
  display: flex; align-items: center; gap: var(--space-4);
  height: 56px;
  padding: 0 max(var(--space-4), calc((100% - var(--page)) / 2));
  background: color-mix(in srgb, var(--bg) 88%, transparent);
  backdrop-filter: saturate(1.4) blur(10px);
  -webkit-backdrop-filter: saturate(1.4) blur(10px);
  border-bottom: 1px solid var(--line);
}

.brand-link {
  display: inline-flex; align-items: center; gap: 8px;
  color: var(--text); text-decoration: none;
  font-weight: 700; font-size: 1.05rem;
}
.brand-link img { border-radius: 7px; }

/* 顶栏各项宽度固定，空间不够时也不会把中文拆成两行。 */
.brand-link, .workspace-nav, .topbar-actions > * { flex-shrink: 0; }
.workspace-nav { display: flex; gap: 2px; }
.nav-link {
  display: inline-flex; align-items: center; gap: 6px;
  white-space: nowrap;
  min-height: 34px; padding: 0 12px;
  border: 0; border-radius: var(--radius-sm);
  background: transparent; color: var(--muted);
  font: inherit; font-size: .875rem; font-weight: 600;
  text-decoration: none; cursor: pointer;
}
.nav-link:hover { color: var(--text); background: var(--hover); }
.nav-link[aria-current="page"], .nav-link.is-active { color: var(--primary); background: var(--primary-soft); }

.topbar-actions { display: flex; align-items: center; gap: var(--space-2); margin-left: auto; }

.theme-select {
  width: auto; min-height: 34px;
  padding: 0 26px 0 10px;
  font-size: .8125rem;
  border-color: var(--line);
  background-color: transparent;
}

.account-nav { position: relative; }
.account-toggle { min-height: 34px; padding: 0 10px; font-size: .875rem; }
.caret { font-size: .7rem; margin-left: 4px; }
.account-panel {
  position: absolute; right: 0; top: calc(100% + 6px); z-index: 30;
  display: grid; gap: 4px;
  width: 240px; padding: var(--space-3);
  background: var(--card); border: 1px solid var(--line);
  border-radius: var(--radius); box-shadow: var(--shadow-lift);
}
.account-name {
  display: block; padding: 0 4px 8px; margin-bottom: 4px;
  border-bottom: 1px solid var(--line);
  font-weight: 600; overflow-wrap: anywhere;
}
.account-panel .eyebrow { padding: 0 4px; }
.account-panel .btn { justify-content: flex-start; }

.verification-banner {
  display: flex; align-items: center; justify-content: center; flex-wrap: wrap; gap: 4px 12px;
  padding: 6px var(--space-4);
  background: var(--warn-bg); color: var(--warn);
  font-size: .8125rem;
  border-bottom: 1px solid color-mix(in srgb, var(--warn) 18%, transparent);
}
.verification-banner .btn {
  min-height: 28px; padding: 0 10px;
  background: transparent; border-color: currentColor; color: inherit;
  font-size: .8125rem;
}

/* ------------------------------------------------------------ 页面骨架 */

.wrap {
  flex: 1;
  width: 100%;
  max-width: calc(var(--page) + 2 * var(--space-4));
  margin: 0 auto;
  padding: var(--space-5) var(--space-4) var(--space-6);
}
.wrap:focus { outline: none; }

.site-footer {
  padding: var(--space-4);
  text-align: center;
  color: var(--muted); font-size: .75rem;
}

.card {
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  box-shadow: none;
  padding: var(--space-5);
}

.page-heading {
  display: flex; align-items: flex-end; justify-content: space-between; gap: var(--space-3);
  margin-bottom: var(--space-4);
}
.date-stamp { display: block; color: var(--muted); font-size: .8125rem; margin-bottom: 2px; }

.page-feedback { position: fixed; left: 50%; bottom: 20px; z-index: 60; transform: translateX(-50%); width: min(420px, calc(100% - 32px)); pointer-events: none; }
.page-feedback .toast { pointer-events: auto; }

/* ------------------------------------------------------------ 表单控件 */

label {
  display: block;
  margin: var(--space-3) 0 6px;
  font-size: .8125rem; font-weight: 600;
  color: var(--text);
}

input, textarea, select {
  width: 100%;
  min-height: var(--control);
  padding: 8px 12px;
  font: inherit; font-size: .9375rem;
  color: var(--text);
  /* 填充式输入框：浅底无描边，悬停出现细边，聚焦时白底 + 主色光圈。 */
  background: var(--surface);
  border: 1px solid transparent;
  border-radius: 10px;
  transition: border-color .15s, box-shadow .15s, background-color .15s;
}
input:hover, textarea:hover, select:hover { border-color: var(--line); }
textarea { resize: none; min-height: 76px; line-height: 1.6; overflow: hidden; }
input::placeholder, textarea::placeholder { color: var(--muted); opacity: .85; }
input:focus, textarea:focus, select:focus {
  outline: none;
  background: var(--card);
  border-color: var(--primary);
  box-shadow: 0 0 0 3px color-mix(in srgb, var(--primary) 22%, transparent);
}
input[readonly] { background: var(--surface); border-color: transparent; }
input[aria-invalid="true"] { border-color: var(--danger); }
select {
  appearance: none; -webkit-appearance: none;
  padding-right: 30px;
  background-image: linear-gradient(45deg, transparent 50%, var(--muted) 50%), linear-gradient(135deg, var(--muted) 50%, transparent 50%);
  background-position: calc(100% - 15px) 52%, calc(100% - 10px) 52%;
  background-size: 5px 5px;
  background-repeat: no-repeat;
}

.grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 0 var(--space-3); }
.grid-3 { grid-template-columns: minmax(0, .7fr) minmax(0, 1fr) minmax(0, 1fr); }
.el-field, .el-stack { min-width: 0; }

.row, .el-row { display: flex; flex-wrap: wrap; align-items: center; gap: var(--space-2); }
.row.end { justify-content: flex-end; }
.grow { flex: 1 1 220px; min-width: 0; }
.el-divider { margin-top: var(--space-4); padding-top: var(--space-4); border-top: 1px solid var(--line); }

.password-field { position: relative; }
.password-field input { padding-right: 64px; }
.password-toggle {
  position: absolute; right: 4px; top: 50%; transform: translateY(-50%);
  min-height: 32px; padding: 0 10px;
  border: 0; border-radius: 6px;
  background: transparent; color: var(--primary);
  font: inherit; font-size: .8125rem; font-weight: 600; cursor: pointer;
}
.password-toggle:hover { background: var(--hover); }

.check-row { display: flex; align-items: center; gap: 10px; margin-top: var(--space-3); }
.check-row .check-label { margin: 0; font-weight: 500; }
.mail-check { width: 18px; height: 18px; min-height: 0; accent-color: var(--primary); }

/* ------------------------------------------------------------ 分段选择 / 日期时间选择 */

.picker-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.span-all { grid-column: 1 / -1; }

.seg {
  display: flex; gap: 2px;
  padding: 3px;
  background: var(--surface);
  border-radius: 10px;
}
.seg-btn {
  flex: 1 1 0; min-width: 0;
  min-height: 34px; padding: 0 8px;
  border: 0; border-radius: 7px;
  background: transparent; color: var(--muted);
  font: inherit; font-size: .875rem; font-weight: 600;
  cursor: pointer; white-space: nowrap;
  transition: background-color .12s, color .12s;
}
.seg-btn:hover { color: var(--text); }
.seg-btn.is-active { background: var(--card); color: var(--text); box-shadow: var(--shadow); }
.seg[data-for$="priority"] .seg-btn[data-value="3"] { --pc: var(--p3); --pb: var(--p3-bg); }
.seg[data-for$="priority"] .seg-btn[data-value="2"] { --pc: var(--p2); --pb: var(--p2-bg); }
.seg[data-for$="priority"] .seg-btn[data-value="1"] { --pc: var(--p1); --pb: var(--p1-bg); }
.seg[data-for$="priority"] .seg-btn[data-value="0"] { --pc: var(--p0); --pb: var(--p0-bg); }
.seg[data-for$="priority"] .seg-btn::before {
  content: ""; display: inline-block; width: 8px; height: 8px; margin-right: 6px;
  border-radius: 50%; background: var(--pc); vertical-align: 1px;
}
.seg[data-for$="priority"] .seg-btn.is-active { background: var(--pb); color: var(--pc); box-shadow: inset 0 0 0 1px color-mix(in srgb, var(--pc) 35%, transparent); }
.seg[data-for="d-status"] .seg-btn.is-active[data-value="doing"] { background: var(--primary-soft); color: var(--primary); }
.seg[data-for="d-status"] .seg-btn.is-active[data-value="done"] { background: var(--primary); color: var(--on-primary); }

.dt { position: relative; display: flex; align-items: center; }
.dt-trigger {
  display: flex; align-items: center; gap: 8px;
  width: 100%; min-height: var(--control);
  padding: 0 34px 0 12px;
  border: 1px solid transparent; border-radius: 10px;
  background: var(--surface); color: var(--text);
  font: inherit; font-size: .9rem; font-weight: 500;
  text-align: left; cursor: pointer;
  transition: border-color .12s;
}
.dt-trigger:hover { border-color: var(--line); }
.dt-trigger[aria-expanded="true"] { border-color: var(--primary); background: var(--card); }
.dt-trigger.is-empty { color: var(--muted); font-weight: 400; }
.dt-text { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
/* 纯 CSS 小日历图标 */
.dt-icon {
  flex: 0 0 auto; position: relative;
  width: 14px; height: 13px;
  border: 1.5px solid currentColor; border-top-width: 3px; border-radius: 3px;
  opacity: .7;
}
.dt-clear {
  position: absolute; right: 4px; top: 50%; transform: translateY(-50%);
  width: 28px; height: 28px;
  border: 0; border-radius: 6px;
  background: transparent; color: var(--muted);
  font: inherit; font-size: 1.1rem; line-height: 1; cursor: pointer;
}
.dt-clear:hover { background: var(--hover); color: var(--text); }

.dt-panel {
  position: absolute; left: 0; top: calc(100% + 6px); z-index: 50;
  width: 320px; max-width: calc(100vw - 32px);
  padding: var(--space-3);
  background: var(--card);
  border: 1px solid var(--line); border-radius: var(--radius);
  box-shadow: var(--shadow-lift);
  animation: toast-in .12s ease-out;
}
/* 右列（截止时间）的面板向左展开，不超出卡片。 */
.picker-grid .el-field:not(.span-all) + .el-field:not(.span-all) .dt-panel { left: auto; right: 0; }

.dt-quick, .dt-presets { display: flex; flex-wrap: wrap; gap: 6px; }
.dt-presets { flex-wrap: nowrap; justify-content: space-between; }
.dt-presets .dt-chip { padding: 0 8px; font-variant-numeric: tabular-nums; }
.dt-quick { padding-bottom: var(--space-3); border-bottom: 1px solid var(--line); }
.dt-chip {
  min-height: 28px; padding: 0 10px;
  border: 1px solid var(--line); border-radius: 999px;
  background: var(--card); color: var(--text);
  font: inherit; font-size: .8125rem; cursor: pointer;
}
.dt-chip:hover { border-color: var(--primary); color: var(--primary); }
.dt-chip.accent { background: var(--primary-soft); border-color: transparent; color: var(--primary); }
.dt-chip.is-selected { background: var(--primary); border-color: var(--primary); color: var(--on-primary); }

.dt-head { display: flex; align-items: center; justify-content: space-between; margin: var(--space-3) 0 6px; }
.dt-month { font-weight: 650; font-size: .9375rem; }
.dt-nav {
  width: 32px; height: 32px;
  border: 0; border-radius: 8px;
  background: transparent; color: var(--text);
  font: inherit; font-size: 1.25rem; line-height: 1; cursor: pointer;
}
.dt-nav:hover { background: var(--hover); }

.dt-grid { display: grid; grid-template-columns: repeat(7, 1fr); gap: 2px; }
.dt-weekday { text-align: center; font-size: .75rem; color: var(--muted); padding: 2px 0 4px; }
.dt-day {
  height: 36px;
  border: 0; border-radius: 8px;
  background: transparent; color: var(--text);
  font: inherit; font-size: .875rem; cursor: pointer;
  font-variant-numeric: tabular-nums;
}
.dt-day:hover { background: var(--hover); }
.dt-day.is-outside, .dt-day.is-past { color: var(--muted); opacity: .6; }
.dt-day.is-today { color: var(--primary); font-weight: 700; box-shadow: inset 0 0 0 1px var(--primary); opacity: 1; }
.dt-day.is-selected { background: var(--primary); color: var(--on-primary); font-weight: 700; opacity: 1; }

.dt-time { margin-top: var(--space-3); padding-top: var(--space-3); border-top: 1px solid var(--line); }
.dt-wheels {
  position: relative;
  display: flex; align-items: center; justify-content: center; gap: 4px;
  margin-top: var(--space-2);
  padding: 0 var(--space-4);
  background: var(--surface); border-radius: 12px;
}
.dt-wheel {
  position: relative; z-index: 1;
  width: 72px; height: 180px;
  padding: 72px 0;
  overflow-y: auto;
  scroll-snap-type: y mandatory;
  scroll-padding-top: 72px;
  scrollbar-width: none;
  overscroll-behavior: contain;
  -webkit-mask-image: linear-gradient(transparent, #000 30%, #000 70%, transparent);
  mask-image: linear-gradient(transparent, #000 30%, #000 70%, transparent);
  border-radius: 10px;
}
.dt-wheel::-webkit-scrollbar { display: none; }
.dt-wheel:focus-visible { outline-offset: -2px; }
.dt-wheel-item {
  height: 36px; line-height: 36px;
  scroll-snap-align: start;
  text-align: center;
  color: var(--muted);
  font-size: 1.05rem; font-variant-numeric: tabular-nums;
  cursor: pointer; user-select: none;
  transition: color .1s, font-size .1s;
}
.dt-wheel-item.is-selected { color: var(--text); font-size: 1.3rem; font-weight: 700; }
.dt-band {
  position: absolute; left: 10px; right: 10px; top: 50%; height: 36px; transform: translateY(-50%);
  border-radius: 9px; background: var(--card); box-shadow: var(--shadow);
  pointer-events: none;
}
.dt-colon { position: relative; z-index: 1; font-size: 1.3rem; font-weight: 700; color: var(--text); }

.dt-foot { display: flex; justify-content: flex-end; gap: var(--space-2); margin-top: var(--space-3); }
.dt-foot .btn { min-height: 36px; }

.theme-toggle { min-height: 34px; padding: 0 10px; font-size: .8125rem; font-weight: 500; color: var(--muted); }
.theme-toggle:hover { color: var(--text); }

/* ------------------------------------------------------------ 按钮 */

.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 6px;
  min-height: var(--control);
  padding: 0 16px;
  font: inherit; font-size: .875rem; font-weight: 600;
  color: var(--text);
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
  text-decoration: none;
  cursor: pointer;
  white-space: nowrap;
  transition: background-color .15s, border-color .15s, color .15s;
}
.btn:hover { background: var(--surface); }
.btn:disabled { opacity: .55; cursor: not-allowed; }
.btn.primary { background: var(--primary); border-color: var(--primary); color: var(--on-primary); }
.btn.primary:hover:not(:disabled) { background: var(--primary-hover); border-color: var(--primary-hover); }
.btn.ghost { background: transparent; border-color: transparent; }
.btn.ghost:hover:not(:disabled) { background: var(--hover); }
.btn.danger { color: var(--danger); }
.btn.danger:hover:not(:disabled) { background: var(--danger-bg); border-color: color-mix(in srgb, var(--danger) 30%, transparent); }
.btn.link { color: var(--primary); }
.btn.block { display: flex; width: 100%; margin-top: var(--space-2); }
.btn.is-loading { cursor: progress; }
.text-button { background: transparent; border-color: transparent; color: var(--primary); font-weight: 500; }
.text-button:hover { background: transparent; text-decoration: underline; }

.badge {
  display: inline-flex; align-items: center;
  padding: 1px 7px;
  border-radius: 999px;
  background: var(--surface); color: var(--muted);
  font-size: .6875rem; font-weight: 700; letter-spacing: .02em;
  vertical-align: middle;
}

/* ------------------------------------------------------------ 提示 */

.form-message { margin-top: var(--space-2); font-size: .8125rem; color: var(--muted); }
.form-message.error { color: var(--danger); }
.form-message.ok { color: var(--ok); }
.form-message.warn { color: var(--warn); }

.feedback-slot:empty { display: none; }
.feedback-slot { margin-top: var(--space-2); }

.toast {
  padding: 10px 14px;
  border-radius: 10px;
  background: var(--text); color: var(--bg);
  font-size: .875rem; font-weight: 500;
  box-shadow: var(--shadow-lift);
  animation: toast-in .18s ease-out;
}
.feedback-slot .toast { box-shadow: none; animation: none; background: var(--ok-bg); color: var(--ok); }
.feedback-slot .toast.error { background: var(--danger-bg); color: var(--danger); }
.feedback-slot .toast.warn { background: var(--warn-bg); color: var(--warn); }
.page-feedback .toast.error { background: var(--danger); color: var(--card); }
@keyframes toast-in { from { opacity: 0; transform: translateY(6px); } to { opacity: 1; transform: none; } }

/* ------------------------------------------------------------ 登录 / 注册 / 邮件 */

.auth-view { display: flex; justify-content: center; padding-top: 6vh; }
.auth-card { width: 100%; max-width: 400px; padding: var(--space-6) var(--space-5); }
.auth-card h1 { font-size: 1.375rem; margin-bottom: 6px; }
.auth-card > .muted, .auth-card .brand .muted { font-size: .875rem; }
.brand { margin-bottom: var(--space-4); }
.brand .eyebrow { margin-bottom: 6px; }
.auth-card form .btn.primary { margin-top: var(--space-4); }
.auth-footnote { margin-top: var(--space-4); text-align: center; }
.mail-symbol {
  display: grid; place-items: center;
  width: 48px; height: 48px; margin-bottom: var(--space-4);
  border-radius: 14px;
  background: var(--primary-soft); color: var(--primary);
  font-size: 1.5rem; font-weight: 700;
}

.tabs {
  display: grid; grid-template-columns: 1fr 1fr; gap: 4px;
  padding: 4px; margin-bottom: var(--space-2);
  background: var(--surface); border-radius: 10px;
}
.tab {
  min-height: 36px;
  border: 0; border-radius: 7px;
  background: transparent; color: var(--muted);
  font: inherit; font-size: .875rem; font-weight: 600; cursor: pointer;
}
.tab.is-active { background: var(--card); color: var(--text); box-shadow: var(--shadow); }

/* ------------------------------------------------------------ 任务：快速添加 */

.workspace-grid { display: grid; gap: var(--space-3); }

.composer { padding: var(--space-3); }
.quick-row { display: flex; gap: var(--space-2); }
.quick-row input {
  flex: 1; min-width: 0;
  min-height: 44px;
  border-color: transparent;
  background: var(--surface);
  font-size: 1rem;
}
.quick-row input:focus { background: var(--card); }
.quick-row .btn { min-height: 44px; padding: 0 20px; }

.disclosure {
  margin-top: 6px; padding: 4px 6px;
  border: 0; border-radius: 6px;
  background: transparent; color: var(--muted);
  font: inherit; font-size: .8125rem; cursor: pointer;
}
.disclosure:hover { color: var(--primary); background: var(--hover); }
.create-options { padding: 0 2px 4px; }
.create-options label:first-child { margin-top: var(--space-2); }

/* ------------------------------------------------------------ 任务：列表 */

.tasks-card { padding: 0; overflow: hidden; }

.list-head { padding: var(--space-3) var(--space-3) 0; }
.filters {
  display: flex; gap: 4px;
  overflow-x: auto;
  scrollbar-width: none;
  padding-bottom: var(--space-2);
  border-bottom: 1px solid var(--line);
}
.filters::-webkit-scrollbar { display: none; }
.chip {
  flex: 0 0 auto;
  min-height: 32px; padding: 0 12px;
  border: 0; border-radius: 999px;
  background: transparent; color: var(--muted);
  font: inherit; font-size: .8125rem; font-weight: 600;
  cursor: pointer;
}
.chip:hover { color: var(--text); background: var(--hover); }
.chip.is-active { background: var(--primary); color: var(--on-primary); }

/* 任务列表（项目）：一行横向滚动的列表标签 + 新建 / 编辑。 */
.list-bar { display: flex; align-items: center; justify-content: flex-end; gap: 6px; padding-bottom: var(--space-2); }
.list-tabs { display: flex; gap: 4px; flex: 1 1 auto; min-width: 0; overflow-x: auto; scrollbar-width: none; }
.list-tabs::-webkit-scrollbar { display: none; }
.list-chip { display: inline-flex; align-items: center; gap: 6px; }
.list-dot {
  display: inline-block; flex: 0 0 auto;
  width: 9px; height: 9px; border-radius: 50%;
  background: var(--list-color, var(--primary));
}
.list-chip.is-active .list-dot { box-shadow: 0 0 0 2px var(--on-primary); }
.list-count-badge { font-size: .6875rem; font-weight: 700; opacity: .75; }
.list-tool {
  flex: 0 0 auto;
  min-height: 32px; padding: 0 10px;
  border: 1px dashed var(--line); border-radius: 999px;
  background: transparent; color: var(--muted);
  font: inherit; font-size: .8125rem; font-weight: 600;
  cursor: pointer;
}
.list-tool:hover { color: var(--text); background: var(--hover); }
.list-form {
  display: grid; gap: var(--space-2);
  margin-bottom: var(--space-2); padding: var(--space-3);
  border: 1px solid var(--line); border-radius: 12px;
  background: var(--hover);
}
.list-colors { display: flex; flex-wrap: wrap; gap: 8px; }
.list-swatch {
  width: 28px; height: 28px; padding: 0;
  border: 0; border-radius: 50%;
  background: var(--list-color);
  cursor: pointer;
}
.list-swatch[aria-checked="true"] { box-shadow: 0 0 0 2px var(--card), 0 0 0 4px var(--list-color); }
.list-form-actions { display: flex; flex-wrap: wrap; gap: var(--space-2); }
.list-form-actions .danger { margin-left: auto; }
.list-seg { flex-wrap: wrap; }
.list-seg-btn { flex: 0 1 auto; display: inline-flex; align-items: center; justify-content: center; gap: 6px; padding: 0 12px; }
.list-seg-btn span:last-child { overflow: hidden; text-overflow: ellipsis; }
.list-seg-btn.is-active { background: var(--card); color: var(--text); box-shadow: var(--shadow); }
.list-tag { display: inline-flex; align-items: center; gap: 4px; }
.list-tag .list-dot { width: 7px; height: 7px; }

#filter-hint { padding: var(--space-2) var(--space-4) 0; font-size: .75rem; }

.todo-list { list-style: none; margin: 0; padding: var(--space-1) 0; }

.todo {
  position: relative;
  display: flex; align-items: flex-start; gap: var(--space-3);
  padding: 10px var(--space-4);
  border-bottom: 1px solid var(--line);
  transition: background-color .12s;
}
.todo:last-child { border-bottom: 0; }
.todo:hover { background: var(--hover); }
.todo.is-urgent::before {
  content: ""; position: absolute; left: 0; top: 12px; bottom: 12px;
  width: 3px; border-radius: 0 3px 3px 0; background: var(--p3);
}

/* 圆形完成按钮：视觉 20px，点击区域靠外边距扩大。 */
.check {
  appearance: none; -webkit-appearance: none;
  flex: 0 0 auto;
  position: relative;
  width: 20px; height: 20px; min-height: 0;
  margin: 2px 0 0; padding: 0;
  border: 1.5px solid var(--input-line);
  border-radius: 50%;
  background: var(--card);
  cursor: pointer;
  transition: background-color .15s, border-color .15s;
}
.check::before {
  content: ""; position: absolute; inset: -12px;
}
.check::after {
  content: ""; position: absolute; left: 6px; top: 2.5px;
  width: 4px; height: 9px;
  border: solid var(--on-primary); border-width: 0 2px 2px 0;
  transform: rotate(45deg) scale(0);
  transition: transform .12s;
}
.check:hover { border-color: var(--primary); }
.check:checked { background: var(--primary); border-color: var(--primary); }
.check:checked::after { transform: rotate(45deg) scale(1); }
.check:focus { box-shadow: none; }
.check:disabled { opacity: .5; }
.prio-3 { --pc: var(--p3); --pb: var(--p3-bg); }
.prio-2 { --pc: var(--p2); --pb: var(--p2-bg); }
.prio-1 { --pc: var(--p1); --pb: var(--p1-bg); }
.prio-0 { --pc: var(--p0); --pb: var(--p0-bg); }
/* 圆圈颜色即优先级：一眼区分红 / 琥珀 / 蓝 / 灰。 */
.todo .check:not(:checked) { border-color: var(--pc, var(--input-line)); background: color-mix(in srgb, var(--pb, var(--card)) 60%, var(--card)); }
.todo .check:not(:checked):hover { background: var(--pb, var(--card)); }

.todo-main { flex: 1; min-width: 0; }
.todo-title {
  display: block; width: 100%;
  padding: 0; margin: 0;
  border: 0; background: transparent;
  color: var(--text);
  font: inherit; font-size: .9375rem; font-weight: 500;
  line-height: 1.45;
  text-align: left; cursor: pointer;
}
.todo-title:hover .todo-title-text { color: var(--primary); }
.todo-title-text { overflow-wrap: anywhere; }
.todo-snippet {
  margin-top: 1px;
  color: var(--muted); font-size: .8125rem;
  overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}
.todo-meta {
  display: flex; flex-wrap: wrap; align-items: center; gap: 2px 10px;
  margin-top: 3px;
  color: var(--muted); font-size: .75rem;
}
.meta-item { white-space: nowrap; }
.due-overdue { color: var(--danger); font-weight: 600; }
.due-today { color: var(--warn); font-weight: 600; }
.checklist-done { color: var(--ok); }
.tag {
  padding: 0 6px; border-radius: 4px;
  font-size: .6875rem; font-weight: 700; line-height: 18px;
  background: var(--surface); color: var(--muted);
}
.tag.status-doing { background: var(--primary-soft); color: var(--primary); }
.tag.priority-3 { background: var(--p3-bg); color: var(--p3); }
.tag.priority-2 { background: var(--p2-bg); color: var(--p2); }
.tag.priority-1 { background: var(--p1-bg); color: var(--p1); }
.tag.priority-0 { background: var(--p0-bg); color: var(--p0); }

.todo.is-done .todo-title, .todo.is-archived .todo-title { color: var(--muted); }
.todo.is-done .todo-title-text { text-decoration: line-through; text-decoration-color: color-mix(in srgb, var(--muted) 60%, transparent); }

.todo-actions { flex: 0 0 auto; align-self: center; }
.icon-button {
  min-height: 30px; padding: 0 10px;
  border: 0; border-radius: 6px;
  background: transparent; color: var(--muted);
  font: inherit; font-size: .75rem; cursor: pointer;
}
.icon-button.danger:hover, .icon-button.danger:focus-visible { color: var(--danger); background: var(--danger-bg); }
@media (hover: hover) {
  .todo .icon-button { opacity: 0; }
  .todo:hover .icon-button, .todo:focus-within .icon-button { opacity: 1; }
}

.todo-group {
  padding: var(--space-4) var(--space-4) 6px;
  color: var(--muted); font-size: .75rem; font-weight: 700; letter-spacing: .04em;
  border-bottom: 1px solid var(--line);
}

.list-count { padding: 0 var(--space-4) var(--space-3); font-size: .75rem; }
.list-count:empty { display: none; }

.loading-state, .error-state, .empty-state { padding: var(--space-6) var(--space-4); text-align: center; color: var(--muted); }
.error-state p { color: var(--danger); margin-bottom: var(--space-3); }
.empty-state { display: grid; justify-items: center; gap: 6px; }
.empty-state .btn { margin-top: 4px; }
.empty-art {
  display: grid; place-items: center;
  width: 44px; height: 44px; margin-bottom: 4px;
  border-radius: 50%;
  background: var(--primary-soft); color: var(--primary);
  font-size: 1.25rem; font-weight: 700;
}
.empty-state h3 { color: var(--text); }
.empty-state p { font-size: .875rem; }

/* ------------------------------------------------------------ 详情 */

.topbar { display: flex; align-items: center; justify-content: space-between; gap: var(--space-2); margin-bottom: var(--space-3); }
.topbar .btn { min-height: 36px; }
.topbar .btn.ghost:first-child { padding-left: 8px; }

.detail-grid { display: grid; gap: var(--space-3); }
.detail-card form > label:first-of-type { margin-top: 0; }
.title-input {
  min-height: 48px;
  padding: 6px 10px; margin-left: -10px; width: calc(100% + 20px);
  border-color: transparent;
  font-size: 1.25rem; font-weight: 650;
}
.title-input { background: transparent; }
.title-input:hover { background: var(--surface); border-color: transparent; }
#d-meta { margin-top: var(--space-3); font-size: .75rem; }
.detail-save { margin-top: var(--space-4); min-width: 120px; }
.calendar-actions .btn { min-height: 32px; padding: 0 10px; font-size: .8125rem; font-weight: 500; border-color: transparent; background: transparent; color: var(--primary); }
.calendar-actions .btn:hover { background: var(--primary-soft); }

.notes-card h2 { margin-bottom: var(--space-3); }
.timeline { list-style: none; margin: 0 0 var(--space-3); padding: 0; }
.note {
  position: relative;
  padding: 0 0 var(--space-3) 20px;
  border-left: 2px solid var(--line);
  margin-left: 5px;
}
.note:last-child { padding-bottom: 4px; }
.note::before {
  content: ""; position: absolute; left: -6px; top: 4px;
  width: 10px; height: 10px; border-radius: 50%;
  background: var(--primary); border: 2px solid var(--card);
}
.note-time { display: block; color: var(--muted); font-size: .75rem; }
.note-body { font-size: .9rem; margin-top: 2px; }
.notes-card .empty { font-size: .875rem; margin-bottom: var(--space-3); }
#note-form .btn { margin-top: var(--space-2); }

/* ------------------------------------------------------------ Markdown */

.md-label { display: flex; align-items: flex-end; justify-content: space-between; gap: var(--space-2); }
.md-tabs { display: flex; gap: 2px; margin-bottom: 4px; padding: 2px; background: var(--surface); border-radius: 8px; }
.md-tab {
  min-height: 26px; padding: 0 10px;
  border: 0; border-radius: 6px;
  background: transparent; color: var(--muted);
  font: inherit; font-size: .75rem; font-weight: 600; cursor: pointer;
}
.md-tab[aria-pressed="true"] { background: var(--card); color: var(--text); box-shadow: var(--shadow); }

.md { overflow-wrap: anywhere; line-height: 1.65; }
.md > :first-child { margin-top: 0; }
.md > :last-child { margin-bottom: 0; }
.md p, .md ul, .md ol, .md pre, .md blockquote { margin: 0 0 .6em; }
.md .md-heading { margin: .9em 0 .35em; font-size: 1rem; font-weight: 700; }
.md h3.md-heading { font-size: 1.1rem; }
.md ul, .md ol { padding-left: 1.4em; }
.md ul { list-style: disc; }
.md ol { list-style: decimal; }
.md li::marker { color: var(--muted); }
.md li { margin: .15em 0; }
.md li.md-task { list-style: none; position: relative; margin-left: .35em; }
.md-box {
  position: absolute; left: -1.35em; top: .3em;
  width: 14px; height: 14px;
  border: 1.5px solid var(--input-line); border-radius: 4px;
}
.md-task.is-checked > span:last-child { color: var(--muted); text-decoration: line-through; }
.md-task.is-checked .md-box { background: var(--primary); border-color: var(--primary); }
.md-task.is-checked .md-box::after {
  content: ""; position: absolute; left: 3.5px; top: .5px;
  width: 3px; height: 7px;
  border: solid var(--on-primary); border-width: 0 1.5px 1.5px 0;
  transform: rotate(45deg);
}
.md code {
  padding: 1px 5px; border-radius: 5px;
  background: var(--surface);
  font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace; font-size: .85em;
}
.md pre { padding: 10px 12px; border-radius: 10px; background: var(--surface); overflow-x: auto; }
.md pre code { padding: 0; background: none; font-size: .8125rem; line-height: 1.55; }
.md blockquote { padding: 2px 0 2px 12px; border-left: 3px solid var(--line); color: var(--muted); }
.md hr { border: 0; border-top: 1px solid var(--line); margin: .9em 0; }
.md a { color: var(--primary); text-underline-offset: 2px; }
.md del { color: var(--muted); }

.md-toolbar {
  display: flex; gap: 1px;
  overflow-x: auto; scrollbar-width: none;
  margin-bottom: 4px;
}
.md-tool {
  flex: 0 0 auto;
  min-width: 28px; height: 28px; padding: 0 6px;
  border: 0; border-radius: 6px;
  background: transparent; color: var(--muted);
  font: inherit; font-size: .8125rem; font-weight: 600; cursor: pointer;
}
.md-tool:hover { background: var(--surface); color: var(--text); }
.md-tool.is-bold { font-weight: 800; }
.md-tool.is-italic { font-style: italic; font-family: Georgia, serif; }
.md-tool.is-strike { text-decoration: line-through; }
button.md-box {
  padding: 0; background: var(--card); cursor: pointer;
  width: 16px; height: 16px; top: .25em; left: -1.45em;
}
button.md-box:hover { border-color: var(--primary); }
.md-task.is-checked button.md-box { background: var(--primary); }
.md-task.is-checked button.md-box::after { left: 4.5px; top: 1.5px; }

.md-preview {
  min-height: 76px;
  padding: 8px 12px;
  border-radius: 10px;
  border: 1px solid transparent;
  cursor: text;
  transition: background-color .15s;
}
.md-preview:hover { background: var(--surface); }
.md-empty { color: var(--muted); }

/* ------------------------------------------------------------ 设置 */

.settings-grid { display: grid; grid-template-columns: 180px minmax(0, 1fr); gap: var(--space-4); align-items: start; }
.settings-sections { display: grid; gap: 2px; position: sticky; top: 72px; }
.settings-sections .nav-link { justify-content: flex-start; min-height: 38px; }
/* 普通用户只有「日历订阅」一项，不必显示单独的分类导航。 */
.settings-grid:not(:has(#nav-mail-settings:not([hidden]))) { grid-template-columns: minmax(0, 1fr); }
.settings-sections:not(:has(#nav-mail-settings:not([hidden]))) { display: none; }
.settings-cards { display: grid; gap: var(--space-4); min-width: 0; }
.settings-card h2 { display: flex; align-items: center; gap: 8px; margin-bottom: 6px; }
.settings-card > .muted.small { line-height: 1.6; }
.feed-row { margin-top: 0; }
.feed-row input { font-family: ui-monospace, SFMono-Regular, Menlo, monospace; font-size: .8125rem; }
.settings-warning { margin-top: var(--space-2); }
.settings-view .page-heading { align-items: center; }

.mail-meta {
  display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: var(--space-2);
  margin: var(--space-4) 0;
}
.mail-meta div { padding: 10px 12px; border-radius: var(--radius-sm); background: var(--surface); }
.mail-meta dt { color: var(--muted); font-size: .75rem; }
.mail-meta dd { margin: 2px 0 0; font-size: .875rem; font-weight: 600; overflow-wrap: anywhere; }
.mail-form .muted.small { margin-top: 6px; }
.mail-status { padding: 8px 12px; border-radius: var(--radius-sm); background: var(--surface); }
.mail-status.warn { background: var(--warn-bg); }
.mail-status.error { background: var(--danger-bg); }
.mail-status.ok { background: var(--ok-bg); }
.mail-presets { margin-top: var(--space-2); }
.mail-presets .btn { min-height: 34px; font-size: .8125rem; font-weight: 500; }

/* ------------------------------------------------------------ 确认框 */

.modal {
  position: fixed; inset: 0; z-index: 80;
  display: grid; place-items: center;
  padding: var(--space-4);
  background: var(--scrim);
}
.modal-box {
  width: min(400px, 100%);
  padding: var(--space-5);
  background: var(--card);
  border-radius: var(--radius);
  box-shadow: var(--shadow-lift);
  animation: toast-in .15s ease-out;
}
.confirm-text { margin-bottom: var(--space-5); line-height: 1.6; overflow-wrap: anywhere; }
body.has-modal { overflow: hidden; }

/* ------------------------------------------------------------ 提醒、重复、标记、标签 */

/* 选项多时排成等宽网格，换行后每格一样宽。 */
.seg-wrap { display: grid; grid-template-columns: repeat(auto-fill, minmax(76px, 1fr)); }
.seg-wrap .seg-btn { padding: 0 8px; }
.field-label {
  display: block;
  margin: var(--space-3) 0 6px;
  font-size: .8125rem; font-weight: 600;
}
.toggle-row { display: flex; flex-wrap: wrap; gap: var(--space-2); }
.toggle-chip { position: relative; margin: 0; cursor: pointer; }
.create-options label.toggle-chip { margin: 0; }   /* 不受「首个标签上边距」影响 */
.toggle-chip input { position: absolute; opacity: 0; width: 1px; height: 1px; min-height: 0; pointer-events: none; }
.toggle-chip span {
  display: inline-flex; align-items: center; gap: 6px;
  min-height: 36px; padding: 0 14px;
  border: 1px solid var(--line); border-radius: 999px;
  background: var(--card); color: var(--muted);
  font-size: .875rem; font-weight: 600;
  transition: background-color .12s, color .12s, border-color .12s;
}
.toggle-chip span::before { font-size: .95rem; line-height: 1; }
.flag-toggle span::before { content: "⚑"; }
.urgent-toggle span::before { content: "!"; font-weight: 800; }
.toggle-chip:hover span { color: var(--text); border-color: var(--input-line); }
.toggle-chip input:checked + span { background: var(--warn-bg); border-color: color-mix(in srgb, var(--warn) 40%, transparent); color: var(--warn); }
.urgent-toggle input:checked + span { background: var(--danger-bg); border-color: color-mix(in srgb, var(--danger) 40%, transparent); color: var(--danger); }
.toggle-chip input:focus-visible + span { outline: 2px solid var(--focus); outline-offset: 2px; }

.tags-field {
  display: flex; flex-wrap: wrap; align-items: center; gap: 6px;
  min-height: var(--control); padding: 4px 6px;
  background: var(--surface); border: 1px solid transparent; border-radius: 10px;
}
.tags-field:focus-within { background: var(--card); border-color: var(--primary); box-shadow: 0 0 0 3px color-mix(in srgb, var(--primary) 22%, transparent); }
.tags-field input {
  flex: 1 1 120px; width: auto; min-width: 0; min-height: 30px;
  padding: 0 6px; border: 0; background: transparent; box-shadow: none;
}
.tags-field input:focus { border: 0; box-shadow: none; background: transparent; }
.tag-list { display: contents; }
.tag-chip {
  display: inline-flex; align-items: center; gap: 2px;
  padding: 0 8px; border-radius: 999px;
  background: var(--primary-soft); color: var(--primary);
  font-size: .75rem; font-weight: 600; line-height: 22px; white-space: nowrap;
}
.tag-remove {
  min-height: 0; width: 18px; height: 18px; padding: 0; margin-right: -4px;
  border: 0; border-radius: 50%; background: transparent; color: inherit;
  font: inherit; font-size: .9rem; line-height: 1; cursor: pointer;
}
.tag-remove:hover { background: color-mix(in srgb, var(--primary) 15%, transparent); }
.tag-link { border: 0; cursor: pointer; font-family: inherit; }
.tag-link:hover { background: color-mix(in srgb, var(--primary) 18%, var(--primary-soft)); }
.tag-filter {
  display: flex; align-items: center; gap: var(--space-2);
  padding: var(--space-2) var(--space-4) 0;
}
.tag-filter .btn { min-height: 30px; padding: 0 10px; font-size: .8125rem; }

.flag-mark { margin-right: 6px; color: var(--warn); font-weight: 700; }
.tag.urgent-tag { background: var(--danger-bg); color: var(--danger); }
.todo.is-subtask { padding-left: calc(var(--space-4) + 30px); }
.todo.is-subtask .todo-title { font-size: .875rem; }

.parent-link {
  display: inline-block; margin-bottom: var(--space-2);
  color: var(--primary); font-size: .8125rem; font-weight: 600; text-decoration: none;
}
.parent-link:hover { text-decoration: underline; }
.nag-box {
  display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: var(--space-2);
  margin-top: var(--space-3); padding: var(--space-2) var(--space-3);
  border-radius: var(--radius-sm);
  background: var(--danger-bg); color: var(--danger);
  font-size: .8125rem; font-weight: 600;
}
.nag-box .btn { min-height: 32px; padding: 0 12px; }

/* ------------------------------------------------------------ 子任务与图片 */

.detail-section { margin-top: var(--space-5); padding-top: var(--space-4); border-top: 1px solid var(--line); }
.section-title { margin: 0 0 var(--space-2); font-size: .9375rem; font-weight: 700; }
.subtask-list { list-style: none; margin: 0; padding: 0; }
.subtask {
  display: flex; align-items: center; gap: var(--space-3);
  padding: 8px 0; border-bottom: 1px solid var(--line);
}
.subtask .check { margin: 0; }
.subtask-title {
  flex: 1; min-width: 0; padding: 0;
  border: 0; background: transparent; color: var(--text);
  font: inherit; font-size: .9375rem; text-align: left; cursor: pointer;
  overflow-wrap: anywhere;
}
.subtask-title:hover { color: var(--primary); }
.subtask.is-done .subtask-title { color: var(--muted); text-decoration: line-through; }
.subtask .meta-item { color: var(--muted); font-size: .75rem; }
.subtask-form { display: flex; gap: var(--space-2); margin-top: var(--space-3); }
.subtask-form input { flex: 1; min-width: 0; }

.image-grid {
  list-style: none; margin: 0 0 var(--space-3); padding: 0;
  display: grid; grid-template-columns: repeat(auto-fill, minmax(96px, 1fr)); gap: var(--space-2);
}
.image-grid:empty { display: none; }
.image-item { position: relative; }
.thumb {
  display: block; width: 100%; aspect-ratio: 1; padding: 0;
  border: 1px solid var(--line); border-radius: var(--radius-sm); overflow: hidden;
  background: var(--surface); cursor: zoom-in;
}
.thumb img { display: block; width: 100%; height: 100%; object-fit: cover; }
.thumb-delete {
  position: absolute; top: 4px; right: 4px;
  width: 26px; height: 26px; min-height: 0; padding: 0;
  border: 0; border-radius: 50%;
  background: rgb(0 0 0 / 55%); color: #fff;
  font-size: 1rem; line-height: 1; cursor: pointer;
}
.thumb-delete:hover { background: rgb(0 0 0 / 75%); }

.lightbox { background: rgb(0 0 0 / 82%); }
.lightbox-box { display: grid; gap: var(--space-3); width: min(960px, 100%); }
.lightbox-frame img {
  display: block; max-width: 100%; max-height: calc(100vh - 140px); margin: 0 auto;
  border-radius: var(--radius-sm); object-fit: contain; background: #111;
}
.lightbox-box .row { color: #fff; align-items: center; }
.lightbox-box #lightbox-index { flex: 1 1 auto; color: rgb(255 255 255 / 80%); }
.lightbox-box .btn.ghost { color: #fff; }
.lightbox-box .btn.ghost:hover { background: rgb(255 255 255 / 12%); }

/* ------------------------------------------------------------ 宽屏：详情两栏 */

@media (min-width: 960px) {
  .detail-grid { grid-template-columns: minmax(0, 1.5fr) minmax(0, 1fr); align-items: start; }
  .notes-card { position: sticky; top: 72px; }
}

/* ------------------------------------------------------------ 平板 */

@media (max-width: 720px) {
  .settings-grid { grid-template-columns: 1fr; }
  .settings-sections { position: static; display: flex; overflow-x: auto; }
}

/* ------------------------------------------------------------ 手机 */

@media (max-width: 560px) {
  body { font-size: 15px; }
  .site-header { gap: var(--space-2); height: 52px; }
  .site-header:has(#workspace-nav:not([hidden])) .brand-link span { display: none; }
  .workspace-nav .nav-link { padding: 0 10px; }
  .theme-select { max-width: 92px; }
  /* 手机上主题按钮只留图标，完整名称仍在 aria-label 里。 */
  .theme-toggle { padding: 0 12px; }
  .theme-toggle .theme-name { display: none; }

  .wrap { padding: var(--space-4) var(--space-3) var(--space-6); }
  h1 { font-size: 1.3rem; }
  .page-heading { margin-bottom: var(--space-3); }
  .new-button { display: none; }

  .card { padding: var(--space-4); border-radius: 12px; }
  .composer { padding: var(--space-2); }
  .tasks-card { padding: 0; }
  .list-head { padding: var(--space-2) var(--space-2) 0; }
  .todo { padding: 10px var(--space-3); }
  #filter-hint { padding: var(--space-2) var(--space-3) 0; }
  .list-bar { flex-wrap: wrap; }
  .list-tabs { flex-basis: 100%; }
  .list-count { padding: 0 var(--space-3) var(--space-3); }

  /* iOS 小于 16px 的输入框会自动放大页面。 */
  input, textarea, select { font-size: 16px; }
  .theme-select { font-size: 13px; }
  .grid, .grid-3 { grid-template-columns: 1fr; }
  .detail-card .grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .title-input { font-size: 1.125rem; }

  .mail-meta { grid-template-columns: 1fr; }
  .auth-view { padding-top: 0; }
  .auth-card { padding: var(--space-5) var(--space-4); }
  .verification-banner { justify-content: space-between; }
  .feed-row .btn { flex: 1; }
}

@media (max-width: 560px) {
  .dt-panel {
    position: fixed; inset: auto 0 0 0 !important;
    width: auto; max-width: none; max-height: 88vh; overflow-y: auto;
    padding: var(--space-4) var(--space-4) calc(var(--space-4) + env(safe-area-inset-bottom));
    border-radius: 18px 18px 0 0; border-bottom: 0;
    box-shadow: 0 0 0 100vmax var(--scrim);
    animation: sheet-in .18s ease-out;
  }
  .dt-day { height: 40px; }
  body.has-sheet { overflow: hidden; }
}
@keyframes sheet-in { from { transform: translateY(24px); opacity: 0; } to { transform: none; opacity: 1; } }

@media (max-width: 400px) {
  .picker-grid { grid-template-columns: 1fr; }
}

@media (max-width: 360px) {
  .detail-card .grid { grid-template-columns: 1fr; }
}

/* ------------------------------------------------------------ 无障碍 */

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation: none !important; transition: none !important; }
}

@media (forced-colors: active) {
  .check { border-color: CanvasText; }
  .check:checked { background: Highlight; }
  .chip.is-active, .nav-link[aria-current="page"], .tab.is-active { outline: 2px solid Highlight; }
  .btn, .chip, .tab { border: 1px solid ButtonText; }
}

/* 提醒事项同步 */
.dav-steps { margin: var(--space-3) 0 0; padding-left: 1.3em; line-height: 1.7; }
.dav-steps li + li { margin-top: 2px; }
#dav-password-box input { font-weight: 600; letter-spacing: .04em; }
#dav-state { margin: var(--space-2) 0 var(--space-3); }
