:root {
  --green: #2E7D32; --green-ink: #1B5E20; --accent: #F9A825;
  --bg: #f6f8f4; --card: #ffffff; --ink: #1c2119; --muted: #5c6658; --line: #dfe5da;
  --bar: #2E7D32; --on-green: #ffffff; --warn-bg: #fff6dc; --warn-ink: #6a4b00; --danger: #b3261e; --chip: #e8f2e6;
  color-scheme: light;
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --green: #66bb6a; --green-ink: #a5d6a7; --bar: #1f5a23; --on-green: #0b1a0c; --bg: #111510; --card: #1b2119; --ink: #e8ede4;
    --muted: #a3ad9e; --line: #2d362a; --warn-bg: #3a3000; --warn-ink: #ffe08a; --danger: #ff8a80; --chip: #243323;
    color-scheme: dark;
  }
}
* { box-sizing: border-box; }
html, body { margin: 0; background: var(--bg); color: var(--ink);
  font: 17px/1.45 -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif; }
body { padding-bottom: calc(68px + env(safe-area-inset-bottom)); }
a { color: var(--green); }
.topbar { position: sticky; top: 0; z-index: 5; display: flex; align-items: center; gap: 8px;
  padding: calc(10px + env(safe-area-inset-top)) 16px 10px; background: var(--bar); color: #fff; }
.topbar h1 { margin: 0; font-size: 20px; font-weight: 650; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.back { min-width: 44px; min-height: 44px; margin-left: -10px; border: 0; background: none; color: #fff; font-size: 34px; line-height: 1; cursor: pointer; }
main { max-width: 720px; margin: 0 auto; padding: 16px; outline: none; }
.tabs { position: fixed; bottom: 0; left: 0; right: 0; z-index: 5; display: flex; background: var(--card);
  border-top: 1px solid var(--line); padding-bottom: env(safe-area-inset-bottom); }
.tabs a { flex: 1; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 2px;
  min-height: 60px; color: var(--muted); text-decoration: none; font-size: 13px; }
.tabs a span { font-size: 21px; }
.tabs a[aria-current="page"] { color: var(--green); font-weight: 650; }
h2 { font-size: 15px; text-transform: uppercase; letter-spacing: .04em; color: var(--muted); margin: 22px 4px 8px; }
h2:first-child { margin-top: 4px; }
.card { background: var(--card); border: 1px solid var(--line); border-radius: 14px; padding: 14px 16px; margin-bottom: 10px; }
.list { background: var(--card); border: 1px solid var(--line); border-radius: 14px; overflow: hidden; margin-bottom: 10px; }
.row { display: flex; align-items: center; gap: 12px; min-height: 56px; padding: 10px 16px; border-top: 1px solid var(--line);
  color: inherit; text-decoration: none; }
.row:first-child { border-top: 0; }
.row .main { flex: 1; min-width: 0; }
.row .title { font-weight: 600; }
.row .sub { color: var(--muted); font-size: 15px; }
a.row::after { content: "\203A"; color: var(--muted); font-size: 24px; }
.badge { display: inline-block; padding: 2px 8px; border-radius: 99px; font-size: 13px; background: var(--chip); color: var(--green-ink); margin: 2px 4px 2px 0; }
.badge.overdue { background: #fde3e1; color: #8c1d18; }
.badge.done { background: var(--chip); }
.muted { color: var(--muted); }
.small { font-size: 14px; }
.notice { background: var(--warn-bg); color: var(--warn-ink); border-radius: 12px; padding: 12px 14px; font-size: 15px; margin: 10px 0; }
.btn { display: inline-flex; align-items: center; justify-content: center; gap: 6px; min-height: 44px; padding: 0 16px;
  border-radius: 12px; border: 1px solid var(--line); background: var(--card); color: var(--ink); font: inherit; font-weight: 600;
  text-decoration: none; cursor: pointer; }
.btn.primary { background: var(--green); border-color: var(--green); color: var(--on-green); }
.btn.danger { color: var(--danger); }
.btn.block { width: 100%; margin-top: 8px; }
.btn:disabled { opacity: .45; cursor: not-allowed; }
.btnrow { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 8px; }
.btnrow .btn { flex: 1 1 auto; }
label { display: block; font-weight: 600; margin: 12px 0 4px; }
input, select, textarea { width: 100%; min-height: 44px; padding: 10px 12px; border-radius: 10px; border: 1px solid var(--line);
  background: var(--bg); color: var(--ink); font: inherit; }
textarea { min-height: 84px; resize: vertical; }
.check { display: flex; gap: 10px; align-items: flex-start; font-weight: 400; margin: 12px 0; }
.check input { width: 22px; min-height: 22px; height: 22px; margin-top: 2px; flex: none; }
.counter { text-align: right; font-size: 13px; color: var(--muted); }
.photos { display: grid; grid-template-columns: repeat(auto-fill, minmax(96px, 1fr)); gap: 8px; margin: 8px 0; }
.photo { position: relative; aspect-ratio: 1; border-radius: 10px; overflow: hidden; background: var(--line); }
.photo img { width: 100%; height: 100%; object-fit: cover; display: block; }
.photo button { position: absolute; top: 4px; right: 4px; width: 32px; height: 32px; border-radius: 50%; border: 0;
  background: rgba(0,0,0,.6); color: #fff; font-size: 18px; cursor: pointer; }
.empty { text-align: center; padding: 28px 16px; color: var(--muted); }
.empty .big { font-size: 44px; }
dialog { width: min(560px, calc(100% - 24px)); max-height: calc(100dvh - 24px); overflow-y: auto; overscroll-behavior: contain; border: 0; border-radius: 16px; padding: 0; background: var(--card); color: var(--ink); }
dialog::backdrop { background: rgba(0,0,0,.45); }
dialog form { padding: 18px 18px 14px; }
dialog h3 { margin: 0 0 6px; }
.seg { display: flex; gap: 8px; }
.seg label { flex: 1; margin: 0; }
.seg input { position: absolute; opacity: 0; }
.seg span { display: flex; align-items: center; justify-content: center; min-height: 48px; border: 1px solid var(--line); border-radius: 12px; font-weight: 600; cursor: pointer; }
.seg input:checked + span { border-color: var(--green); background: var(--chip); color: var(--green-ink); }
.seg input:focus-visible + span { outline: 2px solid var(--green); }
.footer-note { font-size: 13px; color: var(--muted); margin: 14px 4px; }
details summary { cursor: pointer; font-weight: 600; min-height: 44px; display: flex; align-items: center; }
