:root{
  --bg:#161310; --panel:#1e1a15; --line:rgba(220,200,170,.14); --ink:#efe7d8; --muted:#a08e72;
  --rust:#c46a3f; --rust-ink:#fff; --overdue:#e0774f; --done:#7bb87b;
}
*{box-sizing:border-box}
html,body{height:100%}
body{
  margin:0; background:var(--bg); color:var(--ink);
  font-family:-apple-system,BlinkMacSystemFont,"Segoe UI",Roboto,Helvetica,Arial,sans-serif;
  -webkit-font-smoothing:antialiased;
}
.topbar{display:flex;align-items:center;gap:10px;padding:12px 16px;border-bottom:1px solid var(--line);position:sticky;top:0;background:var(--bg);z-index:5}
.topbar .logo{width:26px;height:26px;border-radius:7px}
.topbar b{font-weight:600;font-size:15px}
.topbar .home{color:var(--muted);text-decoration:none;font-size:13px}
.topbar .home:hover{color:var(--ink)}
.ghost{background:transparent;border:1px solid var(--line);color:var(--ink);border-radius:999px;padding:6px 13px;font:inherit;font-size:13px;cursor:pointer}
.ghost:hover{border-color:var(--rust)}
.topbar .ghost{margin-left:auto}
.topbar .ghost + .ghost{margin-left:0}

.app{max-width:680px;margin:0 auto;padding:14px 16px 60px}
.status{color:var(--muted);font-size:13px;text-align:center;padding:6px 0 10px}
.status.err{color:var(--overdue)}

.group{margin-top:20px}
.group h3{font-size:12.5px;text-transform:uppercase;letter-spacing:.08em;color:var(--muted);margin:0 0 8px;font-weight:600;display:flex;gap:8px;align-items:center}
.group.overdue h3{color:var(--overdue)}
.group .count{color:var(--muted);font-weight:500}

.task{display:flex;gap:12px;align-items:flex-start;padding:11px 2px;border-bottom:1px solid var(--line);cursor:pointer;-webkit-tap-highlight-color:transparent}
.task:last-child{border-bottom:0}
.box{flex:0 0 22px;width:22px;height:22px;border:2px solid var(--muted);border-radius:6px;margin-top:1px;display:grid;place-items:center;transition:background .12s,border-color .12s}
.task.done .box{background:var(--done);border-color:var(--done)}
.box svg{width:14px;height:14px;opacity:0;transition:opacity .12s}
.task.done .box svg{opacity:1}
.task .body{flex:1;min-width:0}
.task .text{font-size:16px;line-height:1.4}
.task.done .text{color:var(--muted);text-decoration:line-through}
.task .meta{display:flex;gap:8px;flex-wrap:wrap;margin-top:3px}
.badge{font-size:11.5px;color:var(--muted);background:rgba(160,142,114,.14);padding:2px 8px;border-radius:999px}
.badge.due{color:var(--rust)}
.badge.due.over{color:var(--overdue);background:rgba(224,119,79,.14)}
.badge.note{opacity:.75}

.empty{color:var(--muted);text-align:center;padding:48px 16px;font-size:15px;line-height:1.6}
.show-done{display:block;margin:18px auto 0;background:transparent;border:1px solid var(--line);color:var(--muted);border-radius:999px;padding:8px 16px;font:inherit;font-size:13px;cursor:pointer}
.show-done:hover{border-color:var(--rust);color:var(--ink)}
.foot{color:var(--muted);font-size:12.5px;text-align:center;line-height:1.6;margin-top:34px}
.foot a{color:var(--muted)}.foot code{font-family:ui-monospace,Menlo,monospace;font-size:.9em}

/* sync sheet */
.sheet-bg{position:fixed;inset:0;background:rgba(0,0,0,.5);display:grid;place-items:end center;z-index:20}
@media(min-width:560px){.sheet-bg{place-items:center}}
.sheet{background:var(--panel);border:1px solid var(--line);border-radius:18px 18px 0 0;width:100%;max-width:460px;padding:22px;box-shadow:0 -20px 50px rgba(0,0,0,.5)}
@media(min-width:560px){.sheet{border-radius:18px}}
.sheet h2{margin:0 0 8px;font-size:19px}
.sheet-note{color:var(--muted);font-size:13.5px;line-height:1.55;margin:0 0 16px}
.sheet input#code{width:100%;padding:12px 14px;border-radius:11px;border:1px solid var(--line);background:#181510;color:var(--ink);font:inherit;font-size:16px}
.sheet input#code:focus{outline:2px solid var(--rust);outline-offset:1px}
.code-row{display:flex;align-items:center;justify-content:space-between;margin:10px 2px 0}
.link{background:none;border:0;color:var(--rust);font:inherit;font-size:13.5px;cursor:pointer;padding:0}
.link:hover{text-decoration:underline}
.show{display:flex;align-items:center;gap:7px;color:var(--muted);font-size:13px;cursor:pointer}
.autosync{display:flex;align-items:flex-start;gap:8px;color:var(--muted);font-size:13px;line-height:1.4;margin:14px 2px 0;cursor:pointer}
.autosync input{margin-top:2px}
.sheet-actions{display:flex;gap:10px;justify-content:flex-end;margin-top:18px}
.sheet-status{font-size:13.5px;color:var(--muted);min-height:1.3em;margin:12px 2px 0;text-align:center}
.sheet-status.ok{color:var(--done)}.sheet-status.err{color:var(--overdue)}
.save{background:var(--rust);color:var(--rust-ink);border:0;border-radius:10px;padding:9px 18px;font:inherit;font-weight:600;font-size:15px;cursor:pointer}
.save:active{transform:translateY(1px)}
[hidden]{display:none!important}
