:root {
  color-scheme: light;
  --canvas: #f3f5ef;
  --paper: #fff;
  --ink: #202b23;
  --muted: #526357;
  --line: #dce5db;
  --green: #214e37;
  --tint: #eaf2e9;
  font: 100%/1.3 system-ui, -apple-system, sans-serif;
  color: var(--ink);
  background: var(--canvas);
}
* { box-sizing: border-box; }
[hidden] { display: none !important; }
body { margin: 0; }
main { width: min(64rem, calc(100% - 2rem)); margin: 0 auto; padding-bottom: 2rem; }
.title-row {
  display: flex; align-items: center; gap: .5rem;
  margin: clamp(.85rem, 3vw, 1.6rem) 0 .85rem;
}
h1, h2, p { margin: 0; }
h1 { min-width: 0; overflow-wrap: anywhere; font-size: clamp(1.8rem, 5.25vw, 3.1875rem); letter-spacing: -.075em; line-height: 1.02; font-weight: 680; }
button, input { font: inherit; }
button { cursor: pointer; }
button, .upload { min-height: 2.75rem; border: 0; border-radius: .6rem; padding: .5rem .85rem; }
button:disabled { opacity: .5; cursor: default; }
.primary { display: inline-flex; align-items: center; gap: .5rem; font-weight: 650; color: white; background: var(--green); }
.primary:hover:enabled { background: #2c6348; }
.primary span { font-size: 1.25rem; line-height: 1; }
.quiet, .upload { background: transparent; color: var(--green); font-weight: 600; }
.quiet:hover, .upload:hover, .icon:hover { background: var(--tint); }
:focus-visible { outline: 2px solid #34734e; outline-offset: 3px; }
#topics { display: grid; gap: .4rem; }
#new-topic { margin-top: .65rem; }
.topic {
  position: relative; display: grid; grid-template-columns: minmax(0, 15rem) minmax(0, 1fr);
  background: var(--paper); border: 1px solid var(--line); border-radius: .75rem; overflow: clip;
}
.topic-header {
  min-width: 0; padding-bottom: .35rem;
  background: #fafcf9; border-inline-end: 1px solid var(--line);
}
.topic-name { display: flex; align-items: center; width: 100%; color: #fff; background: #000; }
.topic-name.topic-complete { background: #237343; }
h2 { font-size: 1.25rem; font-weight: 680; letter-spacing: -.025em; overflow-wrap: anywhere; }
.topic-name h2 { flex: 1; min-width: 0; padding: .25rem 0; line-height: 1.15; }
.topic-name .icon { color: #fff; }
.topic-name .icon:hover { background: #ffffff33; }
.topic-name .icon:focus-visible { outline: 2px solid #fff; outline-offset: -3px; }
.topic-handle { cursor: grab; touch-action: none; user-select: none; }
.topic-handle:active { cursor: grabbing; }
.grip {
  display: block; width: 10px; height: 15px;
  background: radial-gradient(circle, currentColor 1px, transparent 1.5px) 0 0 / 5px 5px;
}
.topic.dragging { opacity: .55; }
.topic.drop-before::after, .topic.drop-after::after {
  content: ""; position: absolute; inset-inline: 0; height: 3px; background: #237343; pointer-events: none;
}
.topic.drop-before::after { top: 0; }
.topic.drop-after::after { bottom: 0; }
.topic-tasks { min-width: 0; }
.task-list { margin: 0; padding: 0 .65rem; list-style: none; }
.task { display: flex; align-items: flex-start; gap: .5rem; border-bottom: 1px solid var(--line); }
.task label { flex: 1; display: flex; align-items: center; gap: .5rem; min-width: 0; min-height: 2rem; padding-block: .2rem; cursor: pointer; }
.task label span { min-width: 0; overflow-wrap: anywhere; }
.task input { flex: 0 0 auto; margin: 0; width: 1.2rem; height: 1.2rem; accent-color: var(--green); cursor: pointer; }
.task input:checked + span { color: #c1c4c1; }
.icon { flex: none; display: grid; place-items: center; padding: 0; width: 2rem; min-height: 2rem; color: var(--muted); background: transparent; }
.icon svg { width: 1.125rem; height: 1.125rem; }
.thumb {
  display: block; flex: none; width: min(100%, 13.4rem);
  min-height: 0; padding: 0; background: var(--tint); overflow: hidden;
}
.topic-header .thumb { width: min(calc(100% - 1.3rem), 13.4rem); margin: .35rem .65rem 0; }
.task .thumb { width: min(40%, 11rem); margin-block: .25rem; }
.thumb img { display: block; width: 100%; height: auto; }
.task-form { display: flex; align-items: center; gap: .35rem; padding: .25rem .65rem; }
.task-form input, #edit-title {
  width: 100%; min-width: 0; border: 1px solid var(--line); color: var(--ink);
  background: var(--paper); padding: .55rem .7rem; border-radius: .55rem;
}
.task-form input { background: #fafcf9; padding: .28rem .5rem; }
.task-form button { min-height: 2rem; padding: .25rem .5rem; }
input::placeholder { color: var(--muted); }
.empty { padding: .7rem; background: var(--paper); border: 1px dashed #b5c5b7; border-radius: .75rem; color: var(--muted); }
#status, #image-error { margin-bottom: .85rem; color: #962e2b; }
dialog {
  width: min(28rem, calc(100% - 2rem)); max-height: calc(100dvh - 2rem);
  border: 1px solid var(--line); border-radius: 1rem; padding: 1.25rem;
  color: var(--ink); background: var(--paper);
}
dialog::backdrop { background: #182b21a0; }
.field-label { display: block; margin: 1rem 0 .35rem; font-size: .875rem; font-weight: 600; }
.image-field, .dialog-actions { display: flex; flex-wrap: wrap; align-items: center; gap: .45rem; margin-top: 1rem; }
.image-field { min-height: 3rem; }
#image-preview { width: 3.5rem; height: 3.5rem; border-radius: .4rem; object-fit: cover; }
.upload { position: relative; display: inline-grid; place-items: center; cursor: pointer; }
.upload input { position: absolute; inset: 0; width: 100%; opacity: 0; cursor: pointer; }
.upload:focus-within { outline: 2px solid #34734e; outline-offset: 3px; }
.dialog-actions { justify-content: flex-end; }
.danger { margin-right: auto; color: #962e2b; background: #fff0ef; }
.danger:hover { background: #f9dedc; }
#delete-confirmation { margin-top: .85rem; color: #962e2b; }
#viewer { width: fit-content; max-width: calc(100% - 2rem); text-align: right; }
#full-image { display: block; max-width: 100%; max-height: 75dvh; border-radius: .5rem; margin-bottom: .5rem; }
@media (max-width: 35rem) {
  main { width: calc(100% - 1.5rem); }
  .topic { grid-template-columns: minmax(6rem, 38%) minmax(0, 1fr); }
  .task-form, .task-list { padding-inline: .35rem; }
  .topic-header .thumb { width: calc(100% - .7rem); margin-inline: .35rem; }
  .task.has-image { display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: 0 .25rem; }
  .task.has-image .icon { grid-area: 1 / 2; }
  .task .thumb { grid-area: 2 / 1 / 3 / -1; width: min(100%, 11rem); }
}
@media (max-width: 26rem) {
  .topic-name { flex-wrap: wrap; justify-content: space-between; }
  .topic-name h2 { order: -1; flex-basis: 100%; padding-inline: .4rem; }
}
@media (pointer: coarse) {
  .task label, .icon, .task-form button { min-height: 2.75rem; }
  .icon { width: 2.75rem; }
}

.list-navigation { margin-top: .75rem; }
.list-navigation + .title-row { margin-top: .35rem; }
.back-link {
  display: inline-flex; align-items: center; min-height: 2rem;
  padding-inline: .5rem; border-radius: .45rem; color: var(--green); font-weight: 650;
}
.back-link:hover { background: var(--tint); }
.dashboard { max-width: 43rem; }
#dashboard-status { color: var(--muted); margin: 0 0 .65rem; }
.checklists {
  display: grid; gap: .35rem; margin: 0 0 .65rem; padding: 0; list-style: none;
}
.checklists:empty { margin: 0; }
.checklist-row {
  display: flex; flex-wrap: wrap; align-items: center; gap: .2rem;
  padding: .2rem .4rem; border: 1px solid var(--line); border-radius: .65rem; background: var(--paper);
}
.checklist-link {
  flex: 1 1 9rem; min-width: 0; padding: .5rem; border-radius: .45rem;
  font-weight: 650; color: var(--ink); overflow-wrap: anywhere;
}
.checklist-link:hover { background: var(--tint); }
.delete-list, #dashboard-error { color: #962e2b; }
#list-name {
  width: 100%; padding: .55rem .7rem; border: 1px solid var(--line);
  border-radius: .55rem; background: var(--paper); color: var(--ink);
}
#list-delete-message, #dashboard-error { margin-top: .75rem; overflow-wrap: anywhere; }
#list-confirm.danger { margin-right: 0; }
