:root {
  --ink: #1F2A37; --slate: #3D5A80; --terra: #E07A5F; --sage: #81B29A; --mustard: #F2CC8F; --paper: #FAF7F0;
  --line: #E6E0D3; --muted: #6E737C; --card: #FFFFFF; --app-w: 560px;
}
* { box-sizing: border-box; }
html, body { margin: 0; }
body { font-family: system-ui, -apple-system, "Segoe UI", Roboto, sans-serif; background: #EDE8DC; color: var(--ink); }
.app { max-width: var(--app-w); min-height: 100vh; margin: 0 auto; background: var(--paper); position: relative; }
@media (min-width: 600px) { .app { box-shadow: 0 0 0 1px var(--line), 0 10px 40px #0000000f; } }

.appbar { padding: 18px 18px 8px; display: flex; align-items: center; gap: 10px; min-height: 64px; }
.appbar h1 { font-size: 22px; margin: 0; flex: 1; overflow-wrap: anywhere; }
.appbar h1.sm { font-size: 19px; }
h1:focus { outline: none; }
h1:focus-visible { outline: 3px solid var(--slate); outline-offset: 2px; border-radius: 4px; }
.icon-btn { min-width: 44px; min-height: 44px; border: 0; background: transparent; font-size: 20px; cursor: pointer; border-radius: 12px; color: var(--ink); }
.icon-btn:hover { background: #0000000a; }
a:focus-visible, button:focus-visible, input:focus-visible, textarea:focus-visible { outline: 3px solid var(--slate); outline-offset: 2px; }

.tabs { display: flex; margin: 0 18px 8px; background: #EFE9DC; border-radius: 12px; padding: 4px; }
.tabs button { flex: 1; min-height: 44px; border: 0; background: transparent; border-radius: 9px; font: inherit; font-weight: 600; color: var(--muted); cursor: pointer; }
.tabs button.on { background: #fff; color: var(--ink); box-shadow: 0 1px 3px #0001; }

.scroll { padding: 4px 18px 110px; }
ul.cards, ul.items, ul.itemrows { list-style: none; margin: 0; padding: 0; }
.card { background: var(--card); border-radius: 16px; padding: 14px 16px; margin-bottom: 10px; box-shadow: 0 1px 0 var(--line), 0 2px 8px #0000000a; display: flex; gap: 12px; align-items: flex-start; border-left: 5px solid var(--mustard); color: inherit; text-decoration: none; min-height: 44px; }
.card:hover { box-shadow: 0 1px 0 var(--line), 0 4px 14px #00000014; }
.card .body { flex: 1; min-width: 0; display: block; }
.card .t { display: block; font-weight: 650; font-size: 16px; overflow-wrap: anywhere; }
.card .meta { font-size: 13px; color: var(--muted); margin-top: 4px; display: flex; gap: 10px; flex-wrap: wrap; align-items: center; }
.card .excerpt { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; max-width: 100%; }
.card.done { background: #F1F6F2; border-left-color: var(--sage); opacity: .85; }
.card.done .t { text-decoration: line-through; color: var(--muted); }
.pill { display: inline-flex; align-items: center; gap: 4px; padding: 2px 8px; border-radius: 999px; background: #FCEDE8; color: #A34A31; font-size: 12px; font-weight: 600; }
.pill.ok { background: #E3F0E8; color: #3E7A5B; }
.chk { width: 26px; height: 26px; border-radius: 50%; border: 2px solid var(--line); flex: none; display: grid; place-items: center; color: #fff; font-size: 15px; }
.done .chk, .chk.on { background: var(--sage); border-color: var(--sage); }
.empty { text-align: center; color: var(--muted); padding: 60px 20px; }
.empty .big { font-size: 44px; }

.fab { position: fixed; bottom: 24px; right: max(20px, calc((100vw - var(--app-w)) / 2 + 20px)); width: 60px; height: 60px; border-radius: 50%; border: 0; background: var(--terra); color: #fff; font-size: 30px; box-shadow: 0 8px 20px #E07A5F66; cursor: pointer; z-index: 3; }
.fab:hover { filter: brightness(.95); }

.f { display: block; font-size: 13px; font-weight: 600; color: var(--slate); margin: 14px 0 6px; }
input[type=text], textarea, input[type=datetime-local] { width: 100%; font: inherit; font-size: 16px; padding: 12px; border: 1.5px solid var(--line); border-radius: 12px; background: #fff; color: var(--ink); min-height: 48px; }
textarea { min-height: 70px; resize: vertical; }
.err { color: #B3261E; font-size: 13px; margin-top: 6px; }
input.bad { border-color: #B3261E; }
.itemrow { display: flex; gap: 6px; margin-bottom: 6px; }
.itemrow input { flex: 1; }
.link { border: 0; background: none; color: var(--slate); font: inherit; font-weight: 600; min-height: 44px; cursor: pointer; padding: 0 4px; }
.btnbar { display: flex; gap: 10px; margin-top: 20px; }
.btn { flex: 1; min-height: 48px; border-radius: 14px; border: 0; font: inherit; font-weight: 700; cursor: pointer; }
.btn.pri { background: var(--ink); color: #fff; }
.btn.sec { background: #EFE9DC; color: var(--ink); }
.btn.dan { background: transparent; color: #B3261E; border: 1.5px solid #E8B4AE; }

.note-text { margin: 0 0 8px; color: #555; white-space: pre-wrap; overflow-wrap: anywhere; }
.status-done { margin: 0 0 8px; color: #3E7A5B; font-weight: 700; }
.count { font-size: 13px; color: var(--muted); margin: 0 0 4px; }
.item { display: flex; gap: 12px; align-items: center; width: 100%; min-height: 52px; padding: 6px 4px; border: 0; border-bottom: 1px solid var(--line); background: none; font: inherit; color: inherit; text-align: left; cursor: pointer; }
.item .txt { overflow-wrap: anywhere; }
.item.on .txt { text-decoration: line-through; color: var(--muted); }
.remline { display: flex; align-items: center; gap: 8px; background: #fff; border-radius: 12px; padding: 8px 12px; margin: 14px 0; font-size: 14px; }
.grow { flex: 1; }
.celebrate { text-align: center; background: #E3F0E8; color: #3E7A5B; border-radius: 12px; padding: 10px; font-weight: 700; margin-top: 12px; }

.for { margin: 0; color: #555; }
.selected { font-size: 13px; color: var(--slate); margin-top: 6px; }
.chips { display: flex; gap: 8px; flex-wrap: wrap; }
.chip { min-height: 44px; padding: 0 14px; border-radius: 999px; border: 1.5px solid var(--line); background: #fff; font: inherit; font-size: 14px; cursor: pointer; color: var(--ink); }
.chip.on { background: var(--slate); color: #fff; border-color: var(--slate); }
.chip:disabled { opacity: .45; cursor: not-allowed; }
.hint { font-size: 13px; background: #FFF6E2; border-radius: 10px; padding: 10px; color: #7A5A12; margin-top: 12px; }

.layer { position: fixed; left: 0; right: 0; margin: 0 auto; max-width: var(--app-w); z-index: 5; pointer-events: none; }
.layer > * { pointer-events: auto; }
.layer.top { top: 12px; padding: 0 12px; }
.layer.bottom { bottom: 28px; padding: 0 96px 0 16px; }
.banner { background: var(--ink); color: #fff; border-radius: 16px; padding: 12px 14px; box-shadow: 0 10px 30px #0004; }
.banner b { display: block; overflow-wrap: anywhere; }
.banner .sub { font-size: 13px; opacity: .85; }
.banner .row { display: flex; gap: 8px; margin-top: 8px; }
.banner button { flex: 1; min-height: 44px; border-radius: 10px; border: 0; font: inherit; font-weight: 600; cursor: pointer; }
.banner .b-open { background: var(--mustard); color: var(--ink); }
.banner .b-snooze { background: #ffffff22; color: #fff; }
.toast { background: var(--ink); color: #fff; border-radius: 12px; padding: 8px 14px; display: flex; justify-content: space-between; align-items: center; font-size: 14px; gap: 10px; }
.toast button { background: none; border: 0; color: var(--mustard); font: inherit; font-weight: 700; cursor: pointer; min-height: 44px; min-width: 44px; }

.dialog-bg { position: fixed; inset: 0; background: #0006; display: grid; place-items: center; z-index: 10; padding: 16px; }
.dialog { background: #fff; border-radius: 18px; padding: 20px; width: 100%; max-width: 320px; }
.dialog h2 { margin: 0 0 6px; font-size: 19px; }
.dialog p { color: #555; font-size: 14px; }

@media (prefers-reduced-motion: no-preference) {
  .card, .item, .chip, .btn { transition: background-color .15s, box-shadow .15s, opacity .15s; }
}
