:root {
  --bg: #f4f5fb;
  --surface: #ffffff;
  --text: #191b2e;
  --muted: #777b92;
  --line: #e5e6f0;
  --brand: #4e46e8;
  --brand-soft: #ecebff;
  --danger: #c43d4b;
  --danger-soft: #fff0f1;
  --ok: #1e8e5a;
  --shadow: 0 8px 30px rgba(31, 35, 80, 0.08);
}
* { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }
html, body { margin: 0; min-height: 100%; background: var(--bg); color: var(--text); }
body {
  font-family: -apple-system, BlinkMacSystemFont, "PingFang SC", "Microsoft YaHei", sans-serif;
  padding: max(18px, env(safe-area-inset-top)) 16px calc(84px + env(safe-area-inset-bottom));
}
button { font: inherit; cursor: pointer; }
.top { display: flex; align-items: flex-start; justify-content: space-between; gap: 12px; margin: 4px 2px 16px; }
.eyebrow { margin: 0 0 4px; color: var(--brand); font-size: 12px; font-weight: 800; letter-spacing: .06em; }
h1 { margin: 0; font-size: 28px; letter-spacing: -.03em; }
h2 { margin: 0; font-size: 17px; }
.key-button { border: 1px solid var(--line); border-radius: 999px; background: var(--surface); color: var(--muted); padding: 8px 12px; font-size: 12px; }
.summary { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; }
.summary-card { border: 1px solid var(--line); border-radius: 16px; background: var(--surface); padding: 13px 12px; text-align: left; box-shadow: var(--shadow); }
.summary-card span { display: block; color: var(--muted); font-size: 12px; }
.summary-card strong { display: block; margin-top: 4px; font-size: 25px; line-height: 1; }
.summary-card.danger strong { color: var(--danger); }
.sync-line { display: flex; justify-content: space-between; align-items: center; margin: 14px 2px 8px; color: var(--muted); font-size: 12px; }
.sync-line button { border: 0; background: transparent; color: var(--brand); font-size: 12px; font-weight: 700; }
.list-head { display: flex; align-items: center; justify-content: space-between; margin: 12px 2px 10px; }
.add-button { border: 0; border-radius: 10px; background: var(--brand); color: #fff; padding: 8px 12px; font-size: 13px; font-weight: 700; }
.task-list { display: grid; gap: 8px; margin: 0; padding: 0; list-style: none; }
.task { display: grid; grid-template-columns: 30px 1fr auto; gap: 9px; align-items: start; border: 1px solid var(--line); border-radius: 15px; background: var(--surface); padding: 13px 12px; box-shadow: 0 3px 14px rgba(31,35,80,.04); }
.task.overdue { border-color: #f2c5ca; background: var(--danger-soft); }
.task.done { opacity: .62; }
.task.done .task-title { text-decoration: line-through; }
.check { width: 24px; height: 24px; border: 2px solid #c8c9d9; border-radius: 50%; background: transparent; margin-top: 1px; display: grid; place-items: center; color: #fff; font-size: 14px; }
.task.done .check { border-color: var(--ok); background: var(--ok); }
.task-title { display: block; font-size: 14px; font-weight: 700; line-height: 1.4; }
.task-meta { display: flex; flex-wrap: wrap; gap: 6px 10px; margin-top: 6px; color: var(--muted); font-size: 12px; }
.task-meta .due { color: var(--brand); font-weight: 700; }
.task.overdue .task-meta .due { color: var(--danger); }
.task-note { margin: 6px 0 0; color: var(--muted); font-size: 12px; line-height: 1.45; }
.task-actions { display: grid; gap: 4px; justify-items: end; }
.task-actions button { border: 0; background: transparent; color: var(--muted); padding: 2px; font-size: 12px; }
.task-actions button.delete { color: #b24b55; }
.empty { text-align: center; color: var(--muted); font-size: 13px; margin: 36px 0; }
.tabs { position: fixed; left: 50%; bottom: max(10px, env(safe-area-inset-bottom)); transform: translateX(-50%); display: flex; gap: 4px; width: min(360px, calc(100vw - 24px)); padding: 5px; border: 1px solid var(--line); border-radius: 16px; background: rgba(255,255,255,.94); backdrop-filter: blur(12px); box-shadow: var(--shadow); }
.tabs button { flex: 1; border: 0; border-radius: 11px; background: transparent; color: var(--muted); padding: 9px; font-size: 13px; }
.tabs button.active { background: var(--brand-soft); color: var(--brand); font-weight: 800; }
dialog { width: min(380px, calc(100vw - 32px)); border: 0; border-radius: 18px; padding: 0; box-shadow: 0 20px 60px rgba(20,24,60,.25); }
dialog::backdrop { background: rgba(19, 22, 50, .36); }
dialog form { display: grid; gap: 12px; padding: 20px; }
dialog label { display: grid; gap: 5px; color: var(--muted); font-size: 12px; }
dialog input { width: 100%; padding: 10px; border: 1px solid var(--line); border-radius: 9px; font: inherit; color: var(--text); background: #fff; }
dialog code { display: block; padding: 10px; border-radius: 8px; background: var(--bg); font-size: 12px; word-break: break-all; }
.dialog-actions { display: flex; justify-content: flex-end; gap: 8px; margin-top: 4px; }
.dialog-actions button { border: 1px solid var(--line); border-radius: 9px; background: #fff; padding: 9px 14px; }
.dialog-actions .primary { border-color: var(--brand); background: var(--brand); color: #fff; font-weight: 700; }
.dialog-actions .quiet { color: var(--muted); }
@media (min-width: 600px) {
  body { max-width: 560px; margin: 0 auto; padding-top: 28px; }
  .task-title { font-size: 15px; }
}
