:root {
  --bg: #f5efe0; --card: #fffdf7; --ink: #232d26; --muted: #6a7068; --line: #e4dcc8;
  --accent: #2c6a3a; --accent-ink: #fff; --warn: #b4531f; --soft: #e8efe2;
  --timber: #b9772f; --wall: #a8b4b0; --rose: #e4b1b6; --teal: #4a97ad;
}
@media (prefers-color-scheme: dark) {
  :root { --bg: #161b17; --card: #202620; --ink: #ece8da; --muted: #9ba396; --line: #2f372e; --accent: #7fc08a; --accent-ink: #0f1a11; --warn: #e0905e; --soft: #263226; --timber: #d79a52; --wall: #5d6a66; --rose: #c98f95; --teal: #6fb6c9; }
}
* { box-sizing: border-box; }
body { margin: 0; background: var(--bg); color: var(--ink); font: 16px/1.4 system-ui, sans-serif; padding-bottom: 76px; }
header { display: flex; justify-content: space-between; align-items: center; padding: 14px 16px 6px; }
h1 { margin: 0; font-size: 22px; }
h2 { font-size: 15px; margin: 22px 0 8px; color: var(--muted); text-transform: uppercase; letter-spacing: .04em; }
main { padding: 0 16px 24px; }
button { font: inherit; color: inherit; }
.sync { border: 1px solid var(--line); background: var(--card); border-radius: 999px; padding: 6px 14px; }
.sync.ok { border-color: var(--accent); color: var(--accent); }
.chips { display: flex; gap: 8px; overflow-x: auto; padding: 8px 16px; scrollbar-width: none; }
.chips button { flex: none; border: 1px solid var(--line); background: var(--card); border-radius: 999px; padding: 6px 14px; }
.chips button.on { background: var(--accent); color: var(--accent-ink); border-color: var(--accent); }
.tabs { position: fixed; bottom: 0; left: 0; right: 0; display: flex; background: var(--card); border-top: 1px solid var(--line); padding-bottom: env(safe-area-inset-bottom); }
.tabs button { flex: 1; border: 0; background: none; padding: 16px 0; color: var(--muted); }
.tabs button.on { color: var(--accent); font-weight: 600; box-shadow: inset 0 2px var(--accent); }
.card { background: var(--card); border: 1px solid var(--line); border-radius: 12px; padding: 12px 14px; margin: 8px 0; }
.row { display: flex; gap: 10px; align-items: flex-start; justify-content: space-between; }
.row > .grow { flex: 1; min-width: 0; }
.title { font-weight: 600; }
.sub { color: var(--muted); font-size: 14px; }
.tag { display: inline-block; font-size: 12px; padding: 1px 8px; border-radius: 999px; background: var(--soft); color: var(--accent); margin-right: 4px; }
.tag.warn { background: #f7e4d8; color: var(--warn); }
@media (prefers-color-scheme: dark) { .tag.warn { background: #3a2a20; } }
.btn { border: 1px solid var(--accent); background: var(--accent); color: var(--accent-ink); border-radius: 10px; padding: 8px 14px; }
.btn.ghost { background: none; color: var(--accent); }
.mini { border: 1px solid var(--line); background: none; border-radius: 8px; padding: 2px 8px; }
.add { width: 100%; margin: 10px 0; }
.banner { background: #f7e4d8; color: #6a2f0e; border-radius: 12px; padding: 10px 14px; margin: 8px 0; }
@media (prefers-color-scheme: dark) { .banner { background: #3a2a20; color: #f1c4a6; } }
.total { text-align: right; font-weight: 600; margin: 4px 0 12px; }
dialog { border: 0; border-radius: 16px; width: min(94vw, 480px); padding: 16px; background: var(--card); color: var(--ink); }
dialog::backdrop { background: rgba(0,0,0,.4); }
label { display: block; font-size: 13px; color: var(--muted); margin: 10px 0 2px; }
input, select, textarea { width: 100%; font: inherit; padding: 9px 10px; border: 1px solid var(--line); border-radius: 8px; background: var(--bg); color: var(--ink); }
textarea { min-height: 70px; }
.actions { display: flex; gap: 8px; justify-content: space-between; margin-top: 16px; }
#toast { position: fixed; left: 50%; bottom: 90px; transform: translateX(-50%); background: var(--ink); color: var(--bg); padding: 8px 14px; border-radius: 10px; opacity: 0; transition: opacity .2s; pointer-events: none; }
#toast.show { opacity: 1; }
.calc { display: grid; grid-template-columns: 1fr 1fr; gap: 4px 12px; }
.big { font-size: 22px; font-weight: 700; }

.strip { display: flex; flex-wrap: wrap; margin: 6px -2px; }
.mini.sel { background: var(--accent); color: var(--accent-ink); border-color: var(--accent); }
.neg { color: var(--warn); }
.mini.sel .neg { color: inherit; }

/* layout: header, chips and search stay in view while the list scrolls */
.top { position: sticky; top: 0; z-index: 5; background: var(--bg); padding-top: env(safe-area-inset-top); border-bottom: 1px solid var(--line); }
.tools { padding: 0 16px 8px; }
.tools[hidden] { display: none; }
.tools input { padding: 10px 12px; border-radius: 10px; }
.chips button { min-height: 40px; }
.mini { min-height: 36px; min-width: 44px; display: inline-flex; align-items: center; justify-content: center; text-decoration: none; color: inherit; }
.btns { display: flex; gap: 6px; flex-wrap: wrap; justify-content: flex-end; }
.quick { display: flex; gap: 8px; flex-wrap: wrap; margin: 10px 0; }
.card[role="button"] { cursor: pointer; }
.card[role="button"]:active { background: var(--soft); }
.card:focus-visible, button:focus-visible, a:focus-visible, input:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
.check { display: flex; align-items: center; gap: 8px; color: var(--ink); font-size: 15px; }
.check input { width: auto; }
.sync.dirty { border-color: var(--warn); color: var(--warn); }
#toast { display: flex; align-items: center; gap: 10px; }
#toast.act { pointer-events: auto; }
#toast .undo { background: none; border: 1px solid currentColor; color: inherit; border-radius: 8px; padding: 4px 12px; min-height: 32px; }
.tabs button { min-height: 56px; }
@media (prefers-reduced-motion: reduce) { * { transition: none !important; } }

.thumb { width: 56px; height: 56px; object-fit: cover; border-radius: 8px; flex: none; background: var(--soft); }
.thumb.big { width: 100%; height: auto; max-height: 220px; object-fit: contain; margin: 6px 0; }
.filefield { margin: 8px 0; }
.meta a { color: var(--accent); }

.amts { display: grid; grid-template-columns: auto auto; gap: 0 14px; text-align: right; font-size: 0.95rem; }
.amts .lab { font-size: 0.7rem; color: var(--muted, #777); font-weight: 400; }
.mini.paid { margin-top: 8px; }
.mini.paid.on { background: var(--accent); color: #fff; border-color: var(--accent); }

button.tag { border: 0; font: inherit; cursor: pointer; }
button.daytag { background: var(--soft); color: inherit; }
.clamp { display: -webkit-box; -webkit-line-clamp: 3; -webkit-box-orient: vertical; overflow: hidden; white-space: pre-line; }

/* rooms and a calmer look */
body { font-size: 16px; line-height: 1.45; }
header { padding: 16px 16px 8px; }
h1 { font-size: 26px; letter-spacing: -.01em; }
h2 { font-size: 13px; margin: 26px 0 8px; }
.card { border: 0; box-shadow: 0 1px 2px rgba(0,0,0,.06), 0 2px 8px rgba(0,0,0,.04); border-radius: 14px; padding: 14px 16px; }
.btn.add { background: var(--soft); color: var(--accent); border: 1px dashed var(--accent); font-weight: 600; }
.chips button { border: 0; background: var(--soft); color: var(--ink); }
.chips button.on { background: var(--accent); color: var(--accent-ink); }
.hero { background: var(--accent); color: var(--accent-ink); border-radius: 18px; padding: 18px 20px; margin: 8px 0 14px; }
.hero .sub { color: inherit; opacity: .8; }
.hero .big { font-size: 32px; }
.hero .nm2 { font-size: 20px; font-weight: 700; margin-bottom: 4px; }
.tiles { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.tile { display: flex; flex-direction: column; align-items: flex-start; gap: 2px; text-align: left; background: var(--card); border: 0; border-radius: 16px; padding: 14px; min-height: 112px; box-shadow: 0 1px 2px rgba(0,0,0,.06), 0 2px 8px rgba(0,0,0,.04); cursor: pointer; }
.tile:active { background: var(--soft); }
.tile .ico { font-size: 28px; }
.tile .nm { font-weight: 700; margin-top: 4px; }
.tile .meta { font-size: 13px; color: var(--muted); }
.back { border: 0; background: none; color: var(--accent); font-weight: 600; padding: 10px 0 2px; min-height: 40px; }
.jobhead { font-weight: 600; margin: 14px 0 2px; color: var(--accent); }

/* palette from the house photos: shelf green, cream cabinets, honey timber, grey-sage walls */
.top { background: var(--bg); border-bottom: 3px solid var(--timber); }
.hero { background: linear-gradient(135deg, var(--accent), #1f4d2b); }
.tile:nth-child(3n+1) { border-top: 4px solid var(--accent); }
.tile:nth-child(3n+2) { border-top: 4px solid var(--timber); }
.tile:nth-child(3n) { border-top: 4px solid var(--wall); }
.tabs { background: var(--card); border-top: 3px solid var(--wall); }
.tabs button.on { color: var(--accent); box-shadow: inset 0 3px var(--timber); }
.btn.add { border-color: var(--timber); color: var(--accent); }
.tag { background: var(--soft); color: var(--accent); }
.jobhead { color: var(--timber); }

.bar { height: 8px; background: var(--soft); border-radius: 99px; margin-top: 8px; overflow: hidden; }
.bar i { display: block; height: 100%; background: linear-gradient(90deg, var(--accent), var(--timber)); border-radius: 99px; }
.amt { text-align: right; font-weight: 700; white-space: nowrap; }
.shops { margin-top: 10px; border-top: 1px solid var(--line); padding-top: 6px; }
.shop { display: flex; justify-content: space-between; gap: 10px; padding: 5px 0; font-size: 15px; }

/* today, quick add, bottom bar */
.stats { display: flex; gap: 10px; margin-top: 14px; }
.stats > div { flex: 1; background: rgba(255,255,255,.14); border-radius: 12px; padding: 10px; display: flex; flex-direction: column; }
.stats b { font-size: 22px; } .stats span { font-size: 12px; opacity: .85; } .neg2 { color: #ffd2b8; }
.tiles.small .tile { min-height: 92px; }
.tabs button { display: flex; flex-direction: column; align-items: center; gap: 2px; font-size: 12px; padding: 8px 0 10px; }
.tabs .ti { font-size: 20px; filter: grayscale(.6); } .tabs button.on .ti { filter: none; }
#fab { position: fixed; right: 16px; bottom: calc(86px + env(safe-area-inset-bottom)); width: 56px; height: 56px; border-radius: 50%; border: 0; background: var(--timber); color: #fff; font-size: 32px; line-height: 1; box-shadow: 0 4px 14px rgba(0,0,0,.28); z-index: 6; }
#fab:active { transform: scale(.95); }
.quickgrid { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; margin: 10px 0; }
.qbtn { display: flex; flex-direction: column; align-items: flex-start; gap: 6px; font-size: 24px; padding: 14px; border: 0; border-radius: 14px; background: var(--soft); text-align: left; min-height: 84px; }
.qbtn span { font-size: 15px; font-weight: 600; }
body { padding-bottom: 150px; }

.card.wide { width: 100%; text-align: left; font: inherit; color: inherit; cursor: pointer; margin-top: 12px; }

.gallery { display: grid; grid-template-columns: repeat(auto-fill, minmax(110px, 1fr)); gap: 8px; margin-top: 8px; }
.gallery figure { margin: 0; }
.gallery img { width: 100%; aspect-ratio: 1; object-fit: cover; border-radius: 10px; background: var(--soft); }

.cam { color: var(--accent); font-weight: 600; }
