:root {
  color-scheme: light;
  --bg: #f4f6fa; --surface: #fff; --ink: #202330; --muted: #717786;
  --line: #e1e4eb; --primary: #5b5ce2; --primary-hover: #4b4ccf;
  --tint: #f0f0ff; --danger: #b43c4a;
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", "Malgun Gothic", sans-serif;
  font-synthesis: none;
}
* { box-sizing: border-box; }
body { margin: 0; background: var(--bg); color: var(--ink); font-size: 14px; line-height: 1.5; }
button, input, textarea { font: inherit; }
button { cursor: pointer; touch-action: manipulation; }
button:disabled { cursor: wait; opacity: .55; }
button, input, textarea { -webkit-tap-highlight-color: transparent; }
:focus-visible { outline: 3px solid #a6a7f3; outline-offset: 3px; }
[hidden] { display: none !important; }
.sr-only { position: absolute; width: 1px; height: 1px; margin: -1px; overflow: hidden; clip: rect(0,0,0,0); white-space: nowrap; }
.skip-link { position: fixed; top: 8px; left: 8px; transform: translateY(-160%); padding: 12px; background: var(--ink); color: white; z-index: 10; }
.skip-link:focus { transform: none; }
.workspace { width: min(920px, 100%); margin: 0 auto; padding: 40px 28px 28px; }
.page-header { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin-bottom: 22px; }
h1 { display: flex; align-items: center; gap: 10px; margin: 0; font-size: 21px; font-weight: 700; letter-spacing: -.6px; }
.brand-mark { display: grid; place-items: center; width: 30px; height: 30px; border-radius: 9px; background: var(--primary); color: white; font-size: 18px; }
.snapshot-controls { display: flex; align-items: center; justify-content: flex-end; gap: 8px; }
.sync-status { display: flex; align-items: center; gap: 6px; color: var(--muted); font-size: 12px; white-space: nowrap; }
.sync-status::before { content: ""; width: 6px; height: 6px; border-radius: 50%; background: #9298a6; }
.sync-status[data-state="saved"]::before { background: #44997b; }
.sync-status[data-state="dirty"] { color: #9b5c00; font-weight: 650; }
.sync-status[data-state="dirty"]::before { background: #d38b18; }
.sync-status[data-state="error"] { color: var(--danger); }
.sync-status[data-state="error"]::before { background: var(--danger); }
.quick-add { display: flex; gap: 8px; padding: 8px; background: var(--surface); border: 1px solid #d5d9e3; border-radius: 12px; box-shadow: 0 4px 16px #20233006; margin-bottom: 20px; }
.quick-add:focus-within { border-color: #aaaaf0; box-shadow: 0 0 0 3px #5b5ce20a; }
.quick-add input { flex: 1; min-width: 0; width: 100%; padding: 10px 12px; border: 0; outline: 0; background: transparent; font-size: 16px; color: var(--ink); }
input::placeholder, textarea::placeholder { color: #9197a4; }
.primary-button, .secondary-button, .danger-button { min-height: 44px; padding: 10px 17px; border: 1px solid transparent; border-radius: 8px; font-weight: 600; white-space: nowrap; }
.primary-button { background: var(--primary); color: #fff; }
.primary-button:hover { background: var(--primary-hover); }
.secondary-button { background: white; border-color: #d5d9e3; color: #505768; }
.secondary-button:hover { background: var(--bg); }
.danger-button { background: var(--danger); color: white; }
.list-panel { border: 1px solid #d5d9e3; border-radius: 12px; background: var(--surface); overflow: hidden; }
.panel-header { display: flex; align-items: center; justify-content: space-between; gap: 16px; padding: 18px 20px 12px; }
.panel-heading { display: flex; align-items: baseline; flex-wrap: wrap; gap: 10px; }
h2 { margin: 0; font-size: 16px; font-weight: 650; }
#progress-copy { font-size: 12px; color: var(--muted); }
.search-box { display: flex; align-items: center; gap: 7px; width: 176px; min-height: 44px; padding: 0 10px; border-radius: 7px; background: #f6f7fa; border: 1px solid transparent; }
.search-box:focus-within { border-color: #aaaaf0; }
.search-box svg { flex: 0 0 16px; width: 16px; height: 16px; stroke: #8b91a0; fill: none; stroke-width: 1.7; }
.search-box input { min-width: 0; width: 100%; height: 40px; border: 0; outline: 0; background: transparent; color: var(--ink); }
.filter-nav { display: flex; gap: 4px; padding: 0 16px 12px; border-bottom: 1px solid var(--line); }
.nav-item { display: inline-flex; align-items: center; gap: 7px; min-height: 44px; padding: 0 12px; border: 0; border-radius: 7px; color: #747b8b; background: transparent; font-size: 13px; }
.nav-item span { font-size: 11px; font-variant-numeric: tabular-nums; }
.nav-item:hover { background: var(--bg); }
.nav-item.is-active { color: var(--primary); background: var(--tint); font-weight: 650; }
.task-list { padding: 12px 16px; display: grid; gap: 7px; min-height: 270px; align-content: start; }
.task-row { display: grid; grid-template-columns: 44px 44px minmax(0,1fr) auto; align-items: start; gap: 2px; width: calc(100% - var(--task-indent, 0px)); margin-inline-start: var(--task-indent, 0px); padding: 5px 6px; border: 1px solid #e3e6ee; border-radius: 8px; background: #fcfcfe; }
.task-row:hover, .task-row:focus-within { border-color: #c1c2ec; }
.expand-button, .tree-spacer, .check-button { display: grid; place-items: center; height: 44px; width: 44px; padding: 0; background: transparent; border: 0; border-radius: 7px; }
.expand-button { color: #747b8b; font-size: 24px; line-height: 1; }
.expand-button:hover { background: var(--tint); color: var(--primary); }
.check-box { display: grid; place-items: center; width: 19px; height: 19px; border: 1.5px solid #b9becb; border-radius: 5px; color: transparent; font-size: 13px; }
.is-completed .check-box { background: var(--primary); border-color: var(--primary); color: white; }
.check-button[data-derived="true"]:disabled { opacity: 1; cursor: default; }
.completion-hint, .context-label { color: var(--muted); font-size: 11px; padding: 0 5px 5px; }
.context-label { display: block; }
.task-body { min-width: 0; }
.task-title { display: block; width: 100%; min-height: 44px; padding: 10px 5px; text-align: left; background: transparent; color: var(--ink); border: 0; border-radius: 5px; overflow-wrap: anywhere; line-height: 1.65; }
.task-title:hover { color: var(--primary); background: #5b5ce206; }
.is-completed .task-title { color: #969ba8; text-decoration: line-through; }
.task-meta { display: flex; align-items: center; flex-wrap: wrap; gap: 6px; padding: 0 5px 7px; }
.note-preview { display: block; min-width: 0; max-width: 100%; color: var(--muted); font-size: 12px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.task-actions { display: flex; flex: 0 0 auto; }
.icon-button { display: inline-grid; place-items: center; flex: 0 0 44px; width: 44px; height: 44px; padding: 0; border: 0; border-radius: 6px; background: transparent; color: #858b9a; font-size: 21px; }
.icon-button:hover { background: var(--tint); color: var(--primary); }
.details-button { font-size: 12px; }
.child-button { font-size: 21px; }
.delete-button:hover { background: #fff0ee; color: var(--danger); }
.inline-editor { display: flex; flex-wrap: wrap; gap: 4px; padding: 3px 0; }
.inline-editor input { flex: 1 1 120px; min-width: 0; width: 100%; min-height: 40px; padding: 8px; border: 1px solid #a6a7f3; border-radius: 5px; background: white; color: var(--ink); font-size: 16px; }
.inline-actions { display: flex; margin-left: auto; }
.inline-actions button { min-height: 40px; padding: 7px 10px; font-size: 12px; }
.inline-error { width: 100%; margin: 4px 0; color: var(--danger); font-size: 12px; }
.empty-state, .loading-state { display: grid; justify-items: center; align-content: center; min-height: 245px; padding: 32px 16px; text-align: center; color: var(--muted); }
.empty-symbol { display: grid; place-items: center; width: 40px; height: 40px; border: 1px solid var(--line); border-radius: 11px; color: #adb1cb; margin-bottom: 14px; font-size: 22px; }
.empty-state h3 { margin: 0; color: #596171; font-size: 14px; font-weight: 550; }
.empty-state p { margin: 6px 0 0; font-size: 12px; }
.panel-footer { display: flex; justify-content: space-between; flex-wrap: wrap; gap: 4px 12px; border-top: 1px solid #edf0f5; padding: 12px 20px; color: #8a90a0; font-size: 11px; }
.page-footer { margin-top: 16px; color: #838a99; font-size: 11px; }
.app-message { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin: 0 0 16px; padding: 10px 14px; color: var(--danger); background: #fff0ee; border-radius: 8px; font-size: 13px; }
.app-message button { min-height: 44px; border: 0; background: transparent; color: var(--danger); text-decoration: underline; white-space: nowrap; }
dialog { width: min(480px, calc(100% - 28px)); max-height: calc(100dvh - 32px); margin: auto; padding: 24px; border: 1px solid var(--line); border-radius: 14px; color: var(--ink); background: white; box-shadow: 0 20px 70px #20233025; }
dialog::backdrop { background: #20233065; }
.dialog-header { display: flex; align-items: center; justify-content: space-between; gap: 10px; margin-bottom: 18px; }
.dialog-header h2 { font-size: 18px; }
.dialog-header .icon-button { margin: -8px -8px -8px 0; }
.dialog-context { margin: 3px 0 0; color: var(--muted); font-size: 12px; font-weight: 400; overflow-wrap: anywhere; }
.field { display: block; margin-bottom: 18px; font-size: 13px; font-weight: 600; }
.optional { color: #949aaa; font-size: 11px; font-weight: 400; }
.field input, .field textarea { display: block; min-width: 0; width: 100%; margin-top: 7px; padding: 11px 12px; min-height: 44px; border: 1px solid #d5d9e3; border-radius: 7px; background: white; color: var(--ink); font-size: 16px; font-weight: 400; }
.field textarea { resize: vertical; min-height: 100px; }
.dialog-actions { display: flex; justify-content: flex-end; gap: 8px; margin-top: 20px; }
.text-button { min-height: 44px; padding: 8px 4px; border: 0; color: var(--danger); background: transparent; }
.delete-link { margin-right: auto; }
.form-message { margin: 8px 0; color: var(--danger); font-size: 13px; }
.dialog-save-note { color: var(--muted); }
#delete-title { overflow-wrap: anywhere; font-weight: 600; }
.muted { color: var(--muted); font-size: 13px; }
@media (max-width: 600px) {
  .workspace { padding: 22px 14px max(22px, env(safe-area-inset-bottom)); }
  .page-header { margin-bottom: 18px; flex-wrap: wrap; }
  .quick-add { margin-bottom: 14px; padding: 6px; }
  .snapshot-controls { width: 100%; justify-content: space-between; }
  .snapshot-controls .sync-status { margin-right: auto; }
  .reload-button, .save-button { min-width: 0; padding-inline: 12px; }
  .quick-add input { padding: 10px 8px; }
  .panel-header { padding: 14px 12px 8px; gap: 8px; flex-wrap: wrap; }
  .panel-heading { gap: 6px; }
  .search-box { width: 130px; }
  .search-box input { font-size: 16px; }
  .filter-nav { padding: 0 8px 8px; gap: 4px; }
  .nav-item { padding: 0 10px; }
  .task-list { padding: 10px 8px; }
  .task-row { grid-template-columns: 44px 44px minmax(0,1fr); padding: 3px 2px; gap: 0; }
  .task-body { grid-column: 3; grid-row: 1; }
  .task-actions { grid-column: 3; grid-row: 2; justify-content: flex-end; }
  .task-title { padding: 10px 4px; }
  .task-meta { padding-left: 4px; }
  .panel-footer { padding: 12px; }
  dialog { padding: 20px; }
  .app-message { align-items: flex-start; }
}
@media (prefers-reduced-motion: no-preference) { button { transition: background-color .12s, color .12s; } }
