:root {
  --blue: #2563eb; --blue-d: #1d4ed8; --blue-l: #dbeafe; --bg: #f5f7fb; --card: #fff; --ink: #0f172a; --mut: #64748b;
  --line: #e2e8f0; --ok: #059669; --ok-l: #d1fae5; --warn: #b45309; --warn-l: #fef3c7; --bad: #dc2626; --r: 16px;
  --safe-b: env(safe-area-inset-bottom, 0px); --safe-t: env(safe-area-inset-top, 0px);
  color-scheme: light;
}
* { box-sizing: border-box; }
html, body { margin: 0; background: var(--bg); color: var(--ink); font: 16px/1.45 -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif; -webkit-text-size-adjust: 100%; }
body { padding-top: var(--safe-t); }
a { color: var(--blue); }
button, input, select, textarea { font: inherit; color: inherit; }
#app { max-width: 640px; margin: 0 auto; padding: 12px 14px calc(96px + var(--safe-b)); }
.boot { display: grid; place-items: center; min-height: 70vh; color: var(--mut); }
.boot img { border-radius: 18px; }
h1 { font-size: 1.5rem; margin: 6px 0 2px; letter-spacing: -0.01em; }
h2 { font-size: 1.1rem; margin: 22px 0 8px; }
h3 { font-size: 1rem; margin: 0; }
.sub { color: var(--mut); font-size: .92rem; margin: 0 0 10px; }
.topbar { display: flex; align-items: center; justify-content: space-between; gap: 10px; }
.topbar .logo { width: 36px; height: 36px; border-radius: 10px; }
.card { background: var(--card); border-radius: var(--r); padding: 14px 16px; box-shadow: 0 1px 2px rgba(15,23,42,.06), 0 0 0 1px rgba(15,23,42,.04); margin: 10px 0; }
.pin { position: relative; }
.pin .lbl { font-size: .72rem; text-transform: uppercase; letter-spacing: .08em; color: var(--mut); font-weight: 700; display: flex; justify-content: space-between; align-items: center; }
.pin.verse { background: linear-gradient(135deg, #1e40af, #2563eb); color: #fff; }
.pin.verse .lbl { color: #bfdbfe; }
.pin.verse blockquote { margin: 8px 0 6px; font-family: Georgia, "Times New Roman", serif; font-size: 1.08rem; line-height: 1.5; }
.pin.verse .ref { font-weight: 700; color: #dbeafe; }
.pin.quote blockquote { margin: 8px 0 4px; white-space: pre-line; font-family: Georgia, "Times New Roman", serif; font-style: italic; font-size: 1rem; }
.pin.quote .author { color: var(--mut); font-size: .9rem; }
.pin .edit { background: none; border: 0; color: inherit; opacity: .8; font-size: .85rem; padding: 4px 6px; cursor: pointer; text-decoration: underline; }
.btn { display: inline-flex; align-items: center; justify-content: center; gap: 6px; border: 0; border-radius: 12px; padding: 10px 16px; background: var(--blue); color: #fff; font-weight: 600; cursor: pointer; min-height: 44px; text-decoration: none; }
.btn:active { background: var(--blue-d); }
.btn.sec { background: var(--blue-l); color: var(--blue-d); }
.btn.ghost { background: transparent; color: var(--blue); }
.btn.danger { background: #fee2e2; color: var(--bad); }
.btn.small { min-height: 34px; padding: 6px 12px; font-size: .9rem; }
.btn.block { width: 100%; }
.btn[disabled] { opacity: .5; }
.row { display: flex; gap: 8px; align-items: center; }
.row.wrap { flex-wrap: wrap; }
.grow { flex: 1; min-width: 0; }
.field { display: block; margin: 12px 0; }
.field > span { display: block; font-size: .85rem; color: var(--mut); margin-bottom: 4px; font-weight: 600; }
input[type=text], input[type=password], input[type=time], input[type=date], input:not([type]), select, textarea {
  width: 100%; border: 1px solid var(--line); border-radius: 12px; padding: 11px 12px; background: #fff; min-height: 44px; }
textarea { min-height: 90px; resize: vertical; }
input:focus, select:focus, textarea:focus { outline: 2px solid var(--blue); outline-offset: 0; border-color: transparent; }
.err { color: var(--bad); font-size: .9rem; min-height: 1.2em; }
.banner { border-radius: var(--r); padding: 12px 14px; margin: 10px 0; background: var(--warn-l); color: #78350f; font-size: .95rem; }
.banner.info { background: var(--blue-l); color: #1e3a8a; }
.banner > b:first-child { display: block; margin-bottom: 4px; }
.banner ol { margin: 6px 0 4px 18px; padding: 0; }
.seg { display: flex; background: #e8edf5; border-radius: 12px; padding: 3px; margin: 14px 0 6px; overflow-x: auto; }
.seg button { flex: 1; border: 0; background: transparent; padding: 8px 10px; border-radius: 10px; font-weight: 600; color: var(--mut); white-space: nowrap; cursor: pointer; }
.seg button.on { background: #fff; color: var(--ink); box-shadow: 0 1px 2px rgba(0,0,0,.08); }
.member-head { display: flex; align-items: center; gap: 10px; margin: 18px 0 6px; }
.dot { width: 12px; height: 12px; border-radius: 50%; flex: none; }
.prog { height: 8px; background: #e2e8f0; border-radius: 99px; overflow: hidden; flex: 1; }
.prog > i { display: block; height: 100%; background: var(--ok); border-radius: 99px; transition: width .3s; }
.task { border-left: 5px solid var(--tc, var(--blue)); }
.task.done { background: #f0fdf4; }
.task .th { display: flex; align-items: baseline; gap: 8px; }
.task .time { font-weight: 700; color: var(--tc, var(--blue)); font-variant-numeric: tabular-nums; min-width: 64px; }
.task .ttl { font-weight: 650; flex: 1; color: inherit; text-decoration: none; }
.task .cnt { font-size: .85rem; color: var(--mut); }
.task.done .cnt { color: var(--ok); font-weight: 700; }
.task .notes { color: var(--mut); font-size: .9rem; margin: 4px 0 0; white-space: pre-line; }
.checks { list-style: none; margin: 8px 0 0; padding: 0; }
.checks li { border-top: 1px solid var(--line); }
.checks li:first-child { border-top: 0; }
.ck { display: flex; align-items: center; gap: 12px; padding: 9px 2px; cursor: pointer; min-height: 44px; user-select: none; }
.ck input { position: absolute; opacity: 0; pointer-events: none; }
.ck .box { width: 26px; height: 26px; border-radius: 8px; border: 2px solid #94a3b8; flex: none; display: grid; place-items: center; transition: all .15s; background: #fff; }
.ck input:checked + .box { background: var(--ok); border-color: var(--ok); }
.ck input:checked + .box::after { content: ""; width: 7px; height: 13px; border: solid #fff; border-width: 0 3px 3px 0; transform: rotate(45deg) translate(-1px, -1px); }
.ck input:focus-visible + .box { outline: 2px solid var(--blue); outline-offset: 2px; }
.ck input:checked ~ .txt { color: var(--mut); text-decoration: line-through; }
.ck.ro { cursor: default; }
.ck .by { font-size: .75rem; color: var(--mut); margin-left: auto; }
.hist { display: flex; gap: 3px; margin-top: 8px; align-items: center; }
.hist i { width: 10px; height: 10px; border-radius: 3px; background: #e2e8f0; }
.hist i.y { background: var(--ok); } .hist i.n { background: #fecaca; } .hist i.x { background: transparent; border: 1px dashed #cbd5e1; }
.hist span { font-size: .72rem; color: var(--mut); margin-left: 6px; }
details.later > summary { color: var(--mut); cursor: pointer; margin: 14px 0 4px; font-weight: 600; }
.empty { text-align: center; color: var(--mut); padding: 22px 10px; }
.lists { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.lcard { background: var(--card); border-radius: var(--r); padding: 14px; text-decoration: none; color: var(--ink); border-top: 5px solid var(--lc, var(--blue)); box-shadow: 0 1px 2px rgba(15,23,42,.06), 0 0 0 1px rgba(15,23,42,.04); min-height: 92px; display: flex; flex-direction: column; }
.lcard .ic { font-size: 1.5rem; }
.lcard .nm { font-weight: 700; margin-top: 4px; }
.lcard .ct { color: var(--mut); font-size: .85rem; margin-top: auto; }
.lcard.add { border: 2px dashed #cbd5e1; box-shadow: none; background: transparent; align-items: center; justify-content: center; color: var(--blue); font-weight: 700; }
.items { list-style: none; margin: 0; padding: 0; }
.items li { background: var(--card); border-radius: 12px; margin: 6px 0; padding: 2px 12px; box-shadow: 0 0 0 1px rgba(15,23,42,.05); }
.items .meta { font-size: .8rem; color: var(--mut); margin: -6px 0 6px 38px; white-space: pre-line; }
.items .meta .due.late { color: var(--bad); font-weight: 700; }
.items .more { background: none; border: 0; color: var(--mut); font-size: 1.2rem; padding: 6px 8px; cursor: pointer; margin-left: auto; }
.addrow { display: flex; gap: 8px; margin: 10px 0; }
.chips { display: flex; gap: 6px; flex-wrap: wrap; }
.chip { border: 1px solid var(--line); background: #fff; border-radius: 99px; padding: 6px 12px; cursor: pointer; font-weight: 600; min-width: 44px; min-height: 36px; }
.chip.on { background: var(--blue); color: #fff; border-color: var(--blue); }
.swatches { display: flex; gap: 8px; flex-wrap: wrap; }
.sw { width: 34px; height: 34px; border-radius: 50%; border: 3px solid #fff; box-shadow: 0 0 0 1px var(--line); cursor: pointer; }
.sw.on { box-shadow: 0 0 0 3px var(--ink); }
.itemed { display: flex; gap: 6px; margin: 6px 0; }
.itemed input { flex: 1; }
.itemed button { border: 0; background: #eef2f7; border-radius: 10px; min-width: 40px; cursor: pointer; }
.toggle { display: flex; align-items: center; justify-content: space-between; gap: 10px; padding: 10px 0; }
.toggle input { width: 46px; height: 28px; accent-color: var(--blue); }
.tabs { position: fixed; left: 0; right: 0; bottom: 0; display: flex; background: rgba(255,255,255,.96); backdrop-filter: blur(10px); border-top: 1px solid var(--line); padding-bottom: var(--safe-b); z-index: 10; }
.tabs a { flex: 1; display: flex; flex-direction: column; align-items: center; padding: 8px 0 7px; text-decoration: none; color: var(--mut); font-size: .75rem; font-weight: 600; }
.tabs a .ti { font-size: 1.25rem; filter: grayscale(1); opacity: .7; }
.tabs a.on { color: var(--blue); } .tabs a.on .ti { filter: none; opacity: 1; }
.toast { position: fixed; left: 50%; transform: translateX(-50%); bottom: calc(80px + var(--safe-b)); background: #0f172a; color: #fff; padding: 10px 16px; border-radius: 12px; z-index: 30; max-width: 90vw; font-size: .95rem; }
dialog { border: 0; border-radius: 20px; padding: 0; width: min(560px, 94vw); max-height: 88vh; box-shadow: 0 20px 50px rgba(0,0,0,.25); }
dialog::backdrop { background: rgba(15,23,42,.45); }
dialog .mbody { padding: 18px; overflow: auto; max-height: calc(88vh - 70px); }
dialog .mfoot { display: flex; gap: 8px; justify-content: flex-end; padding: 12px 18px; border-top: 1px solid var(--line); background: #fafbfd; }
dialog h2 { margin-top: 0; }
.suggest { display: flex; flex-wrap: wrap; gap: 6px; margin: 8px 0; }
.preview { background: #f1f5f9; border-radius: 12px; padding: 10px 12px; font-family: Georgia, serif; min-height: 48px; }
.auth { max-width: 420px; margin: 6vh auto 0; }
.auth .logo { display: block; margin: 0 auto 10px; width: 84px; height: 84px; border-radius: 20px; }
.auth h1 { text-align: center; }
.auth .sub { text-align: center; }
.kv { display: flex; justify-content: space-between; padding: 8px 0; border-top: 1px solid var(--line); gap: 10px; }
.kv:first-child { border-top: 0; }
.mut { color: var(--mut); }
.small { font-size: .85rem; }
.offline-pill { background: #fde68a; color: #78350f; font-size: .75rem; border-radius: 99px; padding: 2px 8px; font-weight: 700; }
.heat { display: grid; grid-template-columns: repeat(30, 1fr); gap: 2px; margin: 6px 0 2px; }
.heat i { aspect-ratio: 1; border-radius: 2px; background: #e2e8f0; }
.linkbox { word-break: break-all; background: #f1f5f9; padding: 10px; border-radius: 10px; font-size: .85rem; user-select: all; }
@media (min-width: 700px) { .lists { grid-template-columns: 1fr 1fr 1fr; } }
.cmp { display: grid; grid-template-columns: repeat(auto-fit, minmax(120px, 1fr)); gap: 10px; margin-bottom: 10px; }
.cmpcol { background: #f8fafc; border-radius: 12px; padding: 10px 12px; }
.cmpcol .big { font-size: 1.9rem; font-weight: 800; letter-spacing: -0.02em; line-height: 1.1; margin-top: 4px; }
.chart { width: 100%; height: auto; display: block; }
.heatmap { width: 100%; height: auto; display: block; max-height: 130px; }
.legend { display: flex; gap: 3px; align-items: center; justify-content: flex-end; margin-top: 6px; }
.legend i { width: 10px; height: 10px; border-radius: 2px; display: inline-block; }
.trow .streak { font-weight: 700; color: #c2410c; }
.trow .prog { margin: 6px 0; }
.strip { width: 100%; height: 16px; display: block; margin-top: 4px; }
.tabs a { font-size: .7rem; }
