/* wireframe look: monochrome, hard borders, sketch fonts, placeholder hatching */
:root {
  --ink: #222;
  --ink-soft: #666;
  --paper: #fff;
  --fill: #f2f2f2;
  --hatch: repeating-linear-gradient(135deg, #ddd 0 2px, transparent 2px 8px);
  --bw: 2px;
  --r: 4px;
  --font: "Comic Sans MS", "Chalkboard SE", "Segoe Print", "Bradley Hand", cursive, sans-serif;
  --mono: ui-monospace, "SF Mono", Menlo, Consolas, monospace;
  --safe-b: env(safe-area-inset-bottom, 0px);
}
* { box-sizing: border-box; }
html, body { margin: 0; height: 100%; background: var(--paper); color: var(--ink); font-family: var(--font); font-size: 16px; -webkit-tap-highlight-color: transparent; }
button, input, textarea, select { font: inherit; color: inherit; }
[hidden] { display: none !important; }
.grow { flex: 1; }

.app { max-width: 640px; margin: 0 auto; min-height: 100%; display: flex; flex-direction: column; border-left: var(--bw) solid var(--ink); border-right: var(--bw) solid var(--ink); }
@media (max-width: 660px) { .app { border-left: 0; border-right: 0; } }

.topbar { position: sticky; top: 0; z-index: 5; background: var(--paper); display: flex; align-items: center; gap: 8px; padding: 10px 12px; border-bottom: var(--bw) solid var(--ink); }
.logo { margin: 0; font-size: 20px; letter-spacing: 1px; text-transform: lowercase; cursor: pointer; }
.logo::before { content: "▣ "; }

.view { flex: 1; padding: 12px; padding-bottom: calc(96px + var(--safe-b)); }

.btn { background: var(--paper); border: var(--bw) solid var(--ink); border-radius: var(--r); padding: 8px 14px; cursor: pointer; box-shadow: 3px 3px 0 var(--ink); position: relative; }
.btn:active { box-shadow: 0 0 0 var(--ink); transform: translate(3px, 3px); }
.btn.icon { padding: 4px 10px; font-size: 18px; line-height: 1; box-shadow: none; }
.btn.icon:active { transform: none; }
.btn.primary { background: var(--ink); color: var(--paper); }
.btn.ghost { border-style: dashed; box-shadow: none; }
.btn.big { padding: 16px; font-size: 18px; width: 100%; }
.btn:disabled { opacity: .5; cursor: default; }
.btn.rec { background: var(--hatch); animation: blink 1s steps(2) infinite; }
@keyframes blink { 50% { border-color: var(--ink-soft); } }

.row { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; }
.row > input:not([type=checkbox]), .row > select, .row > textarea { flex: 1; width: auto; min-width: 0; }
.row > input[type=checkbox] { width: 22px; height: 22px; margin: 0; accent-color: var(--ink); }
.mt { margin-top: 12px; }
.muted { color: var(--ink-soft); }
.small { font-size: 13px; }
.mono { font-family: var(--mono); }
.tag { display: inline-block; border: 1px solid var(--ink); border-radius: 999px; padding: 0 8px; font-size: 12px; background: var(--fill); }
.tag.due { background: var(--ink); color: var(--paper); }

/* boxes */
.box { border: var(--bw) solid var(--ink); border-radius: var(--r); padding: 12px; background: var(--paper); }
.box.dashed { border-style: dashed; }
.box.hatch { background: var(--hatch); }
.box h2 { margin: 0 0 8px; font-size: 16px; text-transform: uppercase; letter-spacing: 1px; }
.placeholder-img { border: var(--bw) solid var(--ink); background: var(--hatch); position: relative; height: 80px; }
.placeholder-img::before, .placeholder-img::after { content: ""; position: absolute; inset: 0; background: linear-gradient(to bottom right, transparent calc(50% - 1px), var(--ink) 50%, transparent calc(50% + 1px)); }
.placeholder-img::after { transform: scaleX(-1); }

/* list */
.toolbar { display: flex; gap: 8px; align-items: center; margin-bottom: 10px; }
.toolbar select { border: var(--bw) solid var(--ink); border-radius: var(--r); padding: 6px 8px; background: var(--paper); }
.list { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 8px; }
.item { display: grid; grid-template-columns: 28px 28px 1fr auto; gap: 8px; align-items: center; border: var(--bw) solid var(--ink); border-radius: var(--r); padding: 8px; background: var(--paper); user-select: none; -webkit-user-select: none; }
.item.firing { border-style: double; border-width: 4px; }
.item.dragging { opacity: .4; border-style: dashed; }
.item.over { box-shadow: 0 -4px 0 var(--ink); }
.handle { cursor: grab; text-align: center; font-size: 18px; color: var(--ink-soft); touch-action: none; }
.check { width: 24px; height: 24px; border: var(--bw) solid var(--ink); border-radius: 3px; background: var(--paper); cursor: pointer; font-size: 16px; line-height: 20px; text-align: center; padding: 0; }
.item .main { min-width: 0; cursor: pointer; }
.item .title { font-weight: bold; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.item .meta { font-size: 12px; color: var(--ink-soft); display: flex; gap: 6px; flex-wrap: wrap; }
.item .body-preview { font-size: 13px; color: var(--ink-soft); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.updown { display: flex; flex-direction: column; gap: 2px; }
.updown button { border: 1px solid var(--ink); background: var(--paper); font-size: 10px; padding: 0 5px; cursor: pointer; line-height: 14px; }
.item.done .title { text-decoration: line-through; color: var(--ink-soft); }
.empty { text-align: center; color: var(--ink-soft); padding: 40px 12px; border: var(--bw) dashed var(--ink); border-radius: var(--r); }

/* composer */
.composer { position: fixed; bottom: 0; left: 0; right: 0; z-index: 6; }
.composer .inner { max-width: 640px; margin: 0 auto; background: var(--paper); border-top: var(--bw) solid var(--ink); padding: 10px 12px; padding-bottom: calc(10px + var(--safe-b)); display: flex; gap: 8px; align-items: flex-end; }
.composer textarea { flex: 1; border: var(--bw) solid var(--ink); border-radius: var(--r); padding: 10px; resize: none; min-height: 44px; max-height: 120px; background: var(--paper); }
.composer .preview { position: absolute; bottom: 100%; left: 0; right: 0; }
.composer .preview .inner { border-top: var(--bw) dashed var(--ink); padding: 6px 12px; font-size: 13px; color: var(--ink-soft); background: var(--fill); display: block; }
.composer .preview b { color: var(--ink); }
.fab { position: fixed; right: 16px; bottom: calc(84px + var(--safe-b)); width: 56px; height: 56px; border-radius: 50%; border: var(--bw) solid var(--ink); background: var(--paper); font-size: 30px; line-height: 1; box-shadow: 3px 3px 0 var(--ink); cursor: pointer; z-index: 6; }
.fab:active { box-shadow: none; transform: translate(3px, 3px); }
@media (min-width: 660px) { .fab { right: calc(50% - 320px + 16px); } }

/* forms */
.field { display: flex; flex-direction: column; gap: 4px; margin-bottom: 12px; }
.field label { font-size: 12px; text-transform: uppercase; letter-spacing: 1px; color: var(--ink-soft); }
.field input, .field textarea, .field select { border: var(--bw) solid var(--ink); border-radius: var(--r); padding: 10px; background: var(--paper); width: 100%; }
.field textarea { min-height: 100px; resize: vertical; }
.chips { display: flex; gap: 6px; flex-wrap: wrap; }
.chip { border: 1px solid var(--ink); border-radius: 999px; padding: 4px 10px; background: var(--paper); cursor: pointer; font-size: 14px; }
.chip.on { background: var(--ink); color: var(--paper); }

/* notify screen */
.notify { display: flex; flex-direction: column; gap: 12px; }
.notify .bell { font-size: 64px; text-align: center; animation: ring 1.2s ease-in-out infinite; }
@keyframes ring { 0%,100% { transform: rotate(0); } 20% { transform: rotate(15deg); } 40% { transform: rotate(-15deg); } 60% { transform: rotate(8deg); } 80% { transform: rotate(-8deg); } }
.notify .big-title { font-size: 26px; font-weight: bold; text-align: center; }
.notify .grid { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; }
.notify .grid .full { grid-column: 1 / -1; }

.toast { position: fixed; top: 60px; left: 50%; transform: translateX(-50%); background: var(--ink); color: var(--paper); padding: 8px 14px; border-radius: var(--r); z-index: 20; font-size: 14px; max-width: 90vw; }

.detail .body { white-space: pre-wrap; min-height: 60px; }
kbd { border: 1px solid var(--ink); border-radius: 3px; padding: 0 4px; font-family: var(--mono); font-size: 12px; background: var(--fill); }
.hr { border-top: var(--bw) dashed var(--ink); margin: 12px 0; }
.anno { font-size: 12px; color: var(--ink-soft); font-style: italic; }
.anno::before { content: "↳ "; }
