/* DeskBoard: a dark marker board with colored lists */
:root {
  --board: #111214;
  --panel: #18191c;
  --panel-2: #1f2024;
  --line: #2a2c31;
  --muted: #8a8d94;
  --text: #eeeeee;
  --danger: #ff6b6b;
  --c-white: #eeeeee;
  --c-orange: #f0a546;
  --c-green: #7fdc6e;
  --c-blue: #6cb4ff;
  --c-pink: #e18ce1;
  --c-yellow: #f2d65c;
  --c-red: #ff6b6b;
  --c-purple: #b39cff;
  --c-teal: #4fd1c5;
  --marker: "Permanent Marker", "Comic Sans MS", cursive;
  --hand: "Kalam", "Segoe Print", "Comic Sans MS", cursive;
  --ui: system-ui, -apple-system, "Segoe UI", sans-serif;
  color-scheme: dark;
}
* { box-sizing: border-box; }
html, body { background: var(--board); color: var(--text); margin: 0; }
body {
  font-family: var(--hand);
  padding: max(20px, env(safe-area-inset-top)) max(16px, env(safe-area-inset-right)) 48px max(16px, env(safe-area-inset-left));
  -webkit-tap-highlight-color: transparent;
}
button, input, textarea { font: inherit; color: inherit; }
.muted { color: var(--muted); }
.wrap { max-width: 1280px; margin: 0 auto; display: grid; gap: 22px; }

/* ---- header ---- */
header { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 10px 16px; }
.brand { display: flex; align-items: baseline; gap: 14px; flex-wrap: wrap; }
h1 { font-family: var(--marker); font-weight: 400; font-size: 2rem; margin: 0; letter-spacing: .02em; }
.status { font-family: var(--ui); font-size: .8rem; color: var(--muted); }
.status.err { color: var(--danger); }
.toolbar { display: flex; gap: 8px; flex-wrap: wrap; }
a.btn { text-decoration: none; display: inline-block; }
.btn {
  font-family: var(--ui); font-size: .85rem; background: var(--panel-2); border: 1px solid var(--line);
  border-radius: 8px; padding: 7px 12px; cursor: pointer; white-space: nowrap;
}
.btn:hover { border-color: #3d4047; background: #26282d; }
.btn.primary { background: var(--c-green); color: #0d0e10; border-color: transparent; font-weight: 600; }
.btn.primary:hover { filter: brightness(1.08); }
.btn.danger { color: var(--danger); }
.btn.ghost { background: transparent; border-color: transparent; }
.btn:focus-visible, .icon-btn:focus-visible { outline: 2px solid var(--text); outline-offset: 2px; }

.demo-banner {
  font-family: var(--ui); font-size: .85rem; background: #2a2414; border: 1px solid #4a3f1d; color: #f2d65c;
  border-radius: 8px; padding: 9px 14px; display: flex; gap: 12px; align-items: center; justify-content: space-between; flex-wrap: wrap;
}
.demo-banner a { color: inherit; font-weight: 600; }

/* ---- board ---- */
.grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(290px, 1fr)); gap: 20px; align-items: start; }
section.list {
  background: var(--panel); border: 1px solid var(--line); border-radius: 10px;
  padding: 14px 14px 10px; color: var(--c); min-width: 0; position: relative;
}
.list-head { display: flex; align-items: center; gap: 6px; margin: 0 0 8px; }
.list-head h2 {
  font-family: var(--marker); font-weight: 400; font-size: 1.4rem; margin: 0; flex: 1; min-width: 0;
  cursor: text; overflow-wrap: anywhere; line-height: 1.2;
}
.list-head input.title-edit {
  flex: 1; min-width: 0; font-family: var(--marker); font-size: 1.4rem; color: var(--c);
  background: var(--panel-2); border: 1px solid var(--line); border-radius: 6px; padding: 2px 6px;
}
.count { font-size: .95rem; opacity: .7; font-variant-numeric: tabular-nums; white-space: nowrap; }
.icon-btn {
  background: none; border: 0; color: var(--muted); cursor: pointer; border-radius: 6px;
  width: 28px; height: 28px; display: inline-grid; place-content: center; font-family: var(--ui); font-size: 1rem; flex: none;
}
.icon-btn:hover { color: var(--text); background: rgba(255,255,255,.06); }
.handle { cursor: grab; color: var(--muted); opacity: .45; touch-action: none; user-select: none; }
.handle:hover { opacity: 1; }
.list-head .handle { font-size: 1rem; }

/* ---- tasks ---- */
ul.tasks { list-style: none; margin: 0; padding: 0; display: grid; gap: 1px; min-height: 6px; }
ul.tasks.sub { padding-left: 34px; }
.row {
  display: grid; grid-template-columns: 16px 24px 1fr auto; gap: 8px; align-items: start;
  padding: 5px 4px; border-radius: 6px;
}
.row:hover { background: rgba(255,255,255,.035); }
.row .handle { font-size: .8rem; padding-top: 6px; text-align: center; opacity: 0; }
.row:hover .handle, .row:focus-within .handle { opacity: .5; }
@media (hover: none) { .row .handle { opacity: .35; } }
input[type=checkbox] {
  appearance: none; width: 22px; height: 22px; margin: 3px 0 0; border: 2.5px solid var(--c);
  border-radius: 3px; display: grid; place-content: center; cursor: pointer; background: transparent;
}
input[type=checkbox]::after {
  content: ""; width: 12px; height: 7px; border: solid var(--board); border-width: 0 0 3px 3px;
  transform: rotate(-45deg) translate(1px,-1px); opacity: 0;
}
input[type=checkbox]:checked { background: var(--c); }
input[type=checkbox]:checked::after { opacity: 1; }
input[type=checkbox]:focus-visible { outline: 2px solid var(--text); outline-offset: 2px; }
.txt {
  position: relative; text-transform: uppercase; letter-spacing: .03em; overflow-wrap: anywhere;
  font-size: 1.08rem; line-height: 1.35; cursor: pointer; padding-top: 1px; background: none; border: 0;
  text-align: left; padding-inline: 0;
}
.txt .label { position: relative; }
.txt .label::after {
  content: ""; position: absolute; left: -2px; right: -2px; top: 52%; height: 2.5px;
  background: currentColor; transform: scaleX(0); transform-origin: left; transition: transform .25s ease;
}
.done > .row .txt { opacity: .5; }
.done > .row .txt .label::after { transform: scaleX(1); }
.meta { display: flex; gap: 4px; align-items: center; padding-top: 3px; font-family: var(--ui); font-size: .72rem; }
.chip { border: 1px solid var(--line); border-radius: 999px; padding: 1px 7px; color: var(--muted); white-space: nowrap; }
.chip.today { color: var(--c-yellow); border-color: #5a4f1f; }
.chip.overdue { color: var(--danger); border-color: #5a2a2a; }
.chip.note { padding: 1px 5px; }
.sortable-ghost { opacity: .35; }
.sortable-chosen .row { background: rgba(255,255,255,.06); }

/* ---- task editor ---- */
.editor {
  margin: 4px 0 8px 48px; padding: 10px; background: var(--panel-2); border: 1px solid var(--line);
  border-radius: 8px; display: grid; gap: 8px; font-family: var(--ui); font-size: .85rem; color: var(--text);
}
.editor label { display: grid; gap: 3px; color: var(--muted); font-size: .75rem; }
.editor input[type=text], .editor input[type=date], .editor textarea, .add input, .field input {
  width: 100%; background: var(--board); border: 1px solid var(--line); border-radius: 6px; padding: 7px 9px; color: var(--text);
}
.editor input[type=text] { font-family: var(--hand); font-size: 1rem; }
.editor textarea { min-height: 70px; resize: vertical; font-family: var(--ui); }
.editor .row2 { display: flex; gap: 8px; flex-wrap: wrap; align-items: end; }
.editor .row2 > label { flex: 1 1 140px; }
.editor .actions { display: flex; gap: 6px; flex-wrap: wrap; justify-content: space-between; }
.editor .actions > div { display: flex; gap: 6px; flex-wrap: wrap; }
input[type=date]::-webkit-calendar-picker-indicator { filter: invert(.8); }

.add { margin-top: 6px; }
.add input {
  background: transparent; border: 1px dashed var(--line); font-family: var(--hand); font-size: 1rem; color: var(--text);
}
.add input::placeholder { color: var(--muted); }
.add input:focus { border-style: solid; border-color: var(--c); outline: none; }
.add.sub { margin: 2px 0 6px 34px; }

/* ---- menus & modals ---- */
.menu {
  position: absolute; right: 10px; top: 46px; z-index: 20; background: var(--panel-2); border: 1px solid var(--line);
  border-radius: 10px; padding: 8px; display: grid; gap: 2px; min-width: 200px; font-family: var(--ui); font-size: .85rem;
  color: var(--text); box-shadow: 0 10px 30px rgba(0,0,0,.5);
}
.menu button { text-align: left; background: none; border: 0; padding: 7px 9px; border-radius: 6px; cursor: pointer; }
.menu button:hover { background: rgba(255,255,255,.07); }
.menu .danger { color: var(--danger); }
.swatches { display: flex; flex-wrap: wrap; gap: 6px; padding: 4px 6px 8px; border-bottom: 1px solid var(--line); margin-bottom: 4px; }
.swatch { width: 22px; height: 22px; border-radius: 50%; border: 2px solid transparent; cursor: pointer; padding: 0; }
.swatch.on { border-color: var(--text); box-shadow: 0 0 0 2px var(--panel-2) inset; }

.backdrop {
  position: fixed; inset: 0; background: rgba(0,0,0,.6); z-index: 50; display: grid; place-items: center; padding: 16px;
}
.modal {
  background: var(--panel); border: 1px solid var(--line); border-radius: 12px; width: min(560px, 100%);
  max-height: 85vh; overflow: auto; padding: 18px; font-family: var(--ui); font-size: .9rem;
}
.modal h3 { font-family: var(--marker); font-weight: 400; font-size: 1.4rem; margin: 0 0 12px; }
.modal h4 { margin: 16px 0 6px; font-size: .8rem; text-transform: uppercase; letter-spacing: .06em; color: var(--muted); }
.arch-item { display: flex; gap: 8px; align-items: center; justify-content: space-between; padding: 6px 0; border-bottom: 1px solid var(--line); }
.arch-item span { overflow-wrap: anywhere; }
.arch-item .btns { display: flex; gap: 6px; flex: none; }
.modal .foot { display: flex; justify-content: flex-end; gap: 8px; margin-top: 16px; }

/* ---- auth ---- */
.auth { max-width: 380px; margin: 8vh auto 0; background: var(--panel); border: 1px solid var(--line); border-radius: 12px; padding: 24px; }
.auth h1 { margin-bottom: 4px; }
.auth form { display: grid; gap: 12px; margin-top: 16px; font-family: var(--ui); font-size: .9rem; }
.field { display: grid; gap: 4px; color: var(--muted); font-size: .8rem; }
.field input { font-size: 1rem; }
.auth .err { color: var(--danger); font-size: .85rem; min-height: 1.2em; margin: 0; }
.auth .links { display: flex; justify-content: space-between; gap: 8px; flex-wrap: wrap; font-size: .85rem; }
.auth a, .linkish { color: var(--c-blue); background: none; border: 0; padding: 0; cursor: pointer; font-family: var(--ui); font-size: .85rem; text-decoration: underline; }

.empty { font-family: var(--ui); color: var(--muted); text-align: center; padding: 40px 0; }

@media (prefers-reduced-motion: reduce) { .txt .label::after { transition: none; } }
@media (max-width: 520px) {
  h1 { font-size: 1.6rem; }
  .grid { grid-template-columns: 1fr; }
  .editor { margin-left: 0; }
}
.btn.primary.danger-bg { background: var(--danger); color: #160606; }

/* Drag right to nest / left to un-nest: preview the indent and outline the new parent */
li.nest-in > .row { margin-left: 34px; }
li.nest-out > .row { margin-left: -34px; }
li.nest-parent > .row { outline: 1.5px dashed var(--c); outline-offset: -1px; background: rgba(255,255,255,.04); }

/* Tasks are stored in caps; show caps while typing too (placeholders stay normal) */
.add input:not(:placeholder-shown), .editor input[data-edit-text] { text-transform: uppercase; }

/* ---- import from photo ---- */
.modal:has(.import) { width: min(760px, 100%); }
.scan-thumb { display: block; max-width: 100%; max-height: 240px; margin: 8px auto; border-radius: 8px; border: 1px solid var(--line); }
.scan-wait { display: flex; gap: 12px; align-items: center; margin-top: 8px; }
.spinner {
  width: 22px; height: 22px; border-radius: 50%; flex: none;
  border: 3px solid var(--line); border-top-color: var(--c-green); animation: spin .9s linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }
@media (prefers-reduced-motion: reduce) { .spinner { animation-duration: 3s; } }
.imp-photo { margin: 6px 0 4px; }
.imp-photo summary { cursor: pointer; color: var(--muted); font-size: .85rem; }
.imp-list { border-left: 3px solid var(--c); padding: 4px 0 4px 12px; margin: 16px 0; color: var(--c); }
.imp-head { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; }
.imp-title {
  flex: 1 1 180px; min-width: 0; font-family: var(--marker); font-size: 1.25rem; color: var(--c);
  background: var(--board); border: 1px solid var(--line); border-radius: 6px; padding: 3px 8px;
}
.imp-title.static { background: none; border-color: transparent; padding-left: 0; }
.imp-head select {
  background: var(--panel-2); color: var(--text); border: 1px solid var(--line); border-radius: 6px;
  padding: 6px 8px; font-family: var(--ui); font-size: .85rem; max-width: 100%;
}
.imp-list .swatches { border: 0; padding: 8px 0 2px; margin: 0; }
.imp-items { list-style: none; margin: 8px 0 0; padding: 0; display: grid; gap: 4px; }
.imp-items li { display: flex; gap: 8px; align-items: center; }
.imp-items li.off .imp-text { opacity: .4; text-decoration: line-through; }
.imp-text {
  flex: 1; min-width: 0; font-family: var(--hand); font-size: 1rem; text-transform: uppercase; color: var(--c);
  background: var(--board); border: 1px solid var(--line); border-radius: 6px; padding: 5px 8px;
}
.imp-done { display: flex; gap: 4px; align-items: center; font-size: .75rem; color: var(--muted); cursor: pointer; }
.imp-done input[type=checkbox] { width: 16px; height: 16px; border-width: 2px; margin: 0; }
.imp-done input[type=checkbox]::after { width: 8px; height: 5px; border-width: 0 0 2px 2px; }
.btn:disabled { opacity: .5; cursor: default; }
@media (max-width: 520px) { .imp-done { display: none; } }
