:root {
  color-scheme: light;
  --page: #f3f4fa;
  --surface: #ffffff;
  --text: #25304a;
  --muted: #596278;
  --accent-text: #65517e;
  --border: #858da3;
  --divider: #dfe2ee;
  --hover: #efedf7;
  --selected: #ede7f8;
  --selected-border: #695095;
  --primary: #55408a;
  --on-primary: #ffffff;
  --focus: #8254ce;
  --warning: #93320a;
  font-family: system-ui, sans-serif;
  color: var(--text);
  background: var(--page);
  line-height: 1.5;
}
:root[data-theme="dark"] {
  color-scheme: dark;
  --page: #131722;
  --surface: #202637;
  --text: #eef0fa;
  --muted: #b8c1d8;
  --accent-text: #cdb6ef;
  --border: #8290ac;
  --divider: #54617b;
  --hover: #343d55;
  --selected: #44345f;
  --selected-border: #bf9eea;
  --primary: #c4a2f0;
  --on-primary: #20152f;
  --focus: #d1b0ff;
  --warning: #ffb58f;
}
* { box-sizing: border-box; }
body { margin: 0; padding: 3rem 1rem; }
main { max-width: 70rem; margin: auto; padding: 2rem; background: var(--surface); border: 1px solid var(--divider); border-radius: 1rem; box-shadow: 0 12px 40px #25304a0a; }
header { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 1rem; margin-bottom: 1.5rem; }
#theme-toggle { white-space: nowrap; }
h1 { margin: 0; font-size: 2.3rem; letter-spacing: -.04em; }
.eyebrow { color: var(--accent-text); margin: 0; font-size: .85rem; }
label { font-weight: 600; }
input, button { font: inherit; }
input:not([type="checkbox"]) { width: 100%; min-width: 0; border: 1px solid var(--border); border-radius: .4rem; padding: .65rem; background: var(--surface); color: var(--text); }
button { border: 1px solid var(--border); border-radius: .4rem; padding: .55rem .8rem; background: var(--surface); color: inherit; cursor: pointer; min-height: 44px; }
button:hover { background: var(--hover); }
.entry { display: flex; gap: .5rem; margin-top: .4rem; }
.entry > button { background: var(--primary); color: var(--on-primary); border-color: var(--primary); white-space: nowrap; }
:focus-visible { outline: 3px solid var(--focus); outline-offset: 3px; }
.toolbar { display: flex; flex-wrap: wrap; gap: .75rem; align-items: center; justify-content: space-between; margin-top: 2rem; }
#filters { display: flex; gap: .35rem; }
[aria-pressed="true"] { background: var(--selected); border-color: var(--selected-border); font-weight: 700; }
#count, #empty, #status { color: var(--muted); font-size: .9rem; }
#tasks { list-style: none; padding: 0; margin: .75rem 0; }
.task { display: flex; align-items: center; gap: .75rem; padding: 1rem 0; border-top: 1px solid var(--divider); }
.task label { flex: 1; min-width: 0; overflow-wrap: anywhere; white-space: pre-wrap; font-weight: 400; }
.task input[type="checkbox"] { width: 1.3rem; height: 1.3rem; flex-shrink: 0; accent-color: var(--primary); cursor: pointer; }
.task.done label { text-decoration: line-through; color: var(--muted); }
.actions { display: flex; flex-wrap: wrap; gap: .4rem; min-width: 0; }
.edit-form { display: flex; flex: 1; flex-wrap: wrap; align-items: center; gap: .5rem; min-width: 0; }
.edit-form label { flex-basis: 100%; }
.edit-form input { flex: 1 1 12rem; }
#storage-warning { color: var(--warning); }
@media (max-width: 520px) {
  body { padding: 1rem .6rem; }
  main { padding: 1.25rem; }
  .task { flex-wrap: wrap; }
  .task label { flex-basis: calc(100% - 3rem); }
  .actions { margin-left: 2rem; }
}

.workspace { display: grid; grid-template-columns: minmax(13rem, 17rem) minmax(0, 1fr); gap: 2rem; }
.task-panel, nav { min-width: 0; }
h2 { font-size: 1.1rem; margin: 0 0 1rem; overflow-wrap: anywhere; }
#project-list { list-style: none; margin: 0 0 1rem; padding: 0; }
#project-list li { display: flex; flex-wrap: wrap; gap: .3rem; margin-bottom: .6rem; }
#project-list li > button:first-child { width: 100%; text-align: left; overflow-wrap: anywhere; }
[aria-current="page"] { background: var(--selected); border-color: var(--selected-border); font-weight: 700; }
#project-form button { margin-top: .5rem; }
.project-label { color: var(--muted); font-size: .8rem; overflow-wrap: anywhere; max-width: 8rem; }
@media (max-width: 760px) {
  .workspace { grid-template-columns: minmax(0, 1fr); }
  nav { border-bottom: 1px solid var(--divider); padding-bottom: 1rem; }
}

.task { flex-wrap: wrap; }
.due-date { display: flex; flex-wrap: wrap; align-items: center; gap: .4rem; flex-basis: 100%; margin-left: 2rem; }
.task .due-date label { display: flex; flex: 0 1 auto; flex-wrap: wrap; align-items: center; gap: .4rem; font-size: .85rem; text-decoration: none; color: var(--muted); }
.task .due-date input { width: auto; max-width: 100%; }
.overdue { color: var(--warning); font-weight: 700; }
