:root {
  --bg: #f6f4ee; --card: #fff; --ink: #1f2933; --muted: #6b7280; --line: #e5e1d8;
  --green: #16805c; --amber: #f59e0b; --red: #dc2626;
  --safe-b: env(safe-area-inset-bottom, 0px);
  /* the shared status line's colours (kit-web/statusline, homelists#125) */
  --line-accent: var(--green); --line-bad: #b45309; --line-ink: var(--ink); --line-panel: var(--card); --line-edge: var(--line);
  --line-page: var(--bg); --safe-bottom: var(--safe-b);
}
[hidden] { display: none !important; }   /* .icon's display:inline-flex otherwise wins over hidden */
* { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }
html, body { margin: 0; height: 100%; }
/* Pinned to the window, not sized by 100dvh (homelists#43: in the installed app on Denis's Android 10, 100dvh reached
   under the navigation bar and hid the box and the status line). FoxChat's #app does the same and shows on that phone. */
body { font: 16px/1.4 system-ui, -apple-system, "Segoe UI", Roboto, sans-serif; color: var(--ink); background: var(--bg);
       display: flex; flex-direction: column; position: fixed; top: 0; bottom: 0; left: 0; right: 0; }
/* All text selectable (skills/shippable-app), buttons included where they hold words. */
body { -webkit-user-select: text; user-select: text; }
button { font: inherit; color: inherit; background: none; border: 0; padding: 0; cursor: pointer; }
.icon { width: 44px; height: 44px; border-radius: 22px; font-size: 22px; display: inline-flex; align-items: center; justify-content: center; }
.icon:active { background: rgba(0,0,0,.06); }
.link { color: var(--green); text-decoration: underline; font-size: inherit; }

#top { display: flex; align-items: center; gap: 4px; padding: 6px 8px; background: var(--green); color: #fff; min-height: 56px; }
#top h1 { flex: 1; margin: 0 6px; font-size: 20px; font-weight: 600; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
#me { font-size: 22px; }

main { flex: 1; overflow-y: auto; padding: 10px 10px 16px; overscroll-behavior: contain; }

/* Home: Keep-like cards, two columns. */
/* A grid, not columns, so the order reads left to right, row by row, the way a drag moves it (homelists#47). */
.grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px; align-items: start; }
.card { position: relative; -webkit-user-select: none; user-select: none; touch-action: pan-y; background: var(--card); border: 1px solid var(--line); border-radius: 14px; padding: 10px 12px; margin: 0 0 10px; display: block; width: 100%; text-align: start; }
.card h2 { margin: 0 0 6px; font-size: 16px; font-weight: 600; }
.card ul { list-style: none; margin: 0; padding: 0; font-size: 14px; color: #374151; }
.card li { padding: 1px 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.card .more { color: var(--muted); font-size: 13px; margin-top: 4px; }
.card.new { border-style: dashed; color: var(--muted); text-align: center; }
.section { margin: 18px 4px 8px; color: var(--muted); font-size: 14px; display: flex; align-items: center; gap: 6px; }
.empty { color: var(--muted); text-align: center; margin: 40px 20px; }

/* A list. */
.items { list-style: none; margin: 0; padding: 0; background: var(--card); border: 1px solid var(--line); border-radius: 14px; }
.item { display: flex; align-items: center; gap: 6px; padding: 4px 6px 4px 2px; border-top: 1px solid var(--line); min-height: 52px; }
.item:first-child { border-top: 0; }
.tick { width: 44px; height: 44px; flex: none; display: inline-flex; align-items: center; justify-content: center; }
.tick span { width: 24px; height: 24px; border: 2px solid #9ca3af; border-radius: 6px; display: inline-flex; align-items: center; justify-content: center; font-size: 16px; color: #fff; }
.item.bought .tick span { background: var(--green); border-color: var(--green); }
.item .body { flex: 1; min-width: 0; padding: 4px 0; }
.item .text { word-wrap: break-word; }
.item.bought .text { text-decoration: line-through; color: var(--muted); }
.item .meta { font-size: 12px; color: var(--muted); }
.item .who { font-size: 16px; flex: none; opacity: .8; white-space: nowrap; }
.item.pending .who::after { content: "⏳"; font-size: 11px; }
.badge { display: inline-block; font-size: 11px; padding: 0 6px; border-radius: 8px; margin-inline-end: 4px; color: #fff; }
.badge.now { background: var(--red); } .badge.soon { background: var(--amber); } .badge.later { background: #9ca3af; }
.qty { font-weight: 600; margin-inline-end: 4px; }

#bottom { background: var(--card); border-top: 1px solid var(--line); padding: 6px 8px calc(4px + var(--safe-b)); }
#composer { display: flex; align-items: flex-end; gap: 6px; }
#box { flex: 1; resize: none; font: inherit; padding: 10px 14px; border: 1px solid var(--line); border-radius: 22px; max-height: 8.5em; background: #fbfaf7; }
#box:focus { outline: 2px solid var(--green); outline-offset: -1px; }
.send { color: var(--green); }
#status { font-size: 12px; color: var(--muted); text-align: center; padding-top: 3px; }
/* homelists#203: the chat switched off in Settings; #status and Report stay, so the bottom shrinks to that line. */
body.nochat #chat, body.nochat #chatbar, body.nochat #staged, body.nochat #composer { display: none !important; }
#sync.offline { color: var(--red); } #sync.pending { color: var(--amber); }

#sheet { position: fixed; inset: 0; background: rgba(0,0,0,.35); display: flex; align-items: flex-end; z-index: 10; }
#sheet[hidden] { display: none; }
.panel { background: var(--card); width: 100%; border-radius: 18px 18px 0 0; padding: 16px 16px calc(16px + var(--safe-b)); max-height: 85dvh; overflow-y: auto; }
.panel h3 { margin: 0 0 10px; }
.panel label { display: block; font-size: 13px; color: var(--muted); margin: 10px 0 4px; }
.panel .hint { font-size: 12px; color: var(--muted); margin: 4px 0 0; }
.panel input, .panel textarea, .panel select { width: 100%; font: inherit; padding: 10px; border: 1px solid var(--line); border-radius: 10px; background: #fbfaf7; }
.row { display: flex; gap: 8px; flex-wrap: wrap; margin-top: 14px; }
.btn { padding: 10px 16px; border-radius: 22px; border: 1px solid var(--line); background: #fff; }
.btn.primary { background: var(--green); color: #fff; border-color: var(--green); }
.btn.danger { color: var(--red); }
.choices { display: flex; gap: 6px; flex-wrap: wrap; }
.choices .btn.on { background: var(--green); color: #fff; border-color: var(--green); }
pre.raw { white-space: pre-wrap; word-break: break-all; font-size: 11px; background: #f3f4f6; padding: 8px; border-radius: 8px; max-height: 40dvh; overflow: auto; }

#toast { position: fixed; left: 50%; transform: translateX(-50%); bottom: calc(110px + var(--safe-b)); background: #111827; color: #fff; padding: 10px 14px; border-radius: 22px; z-index: 20; display: flex; gap: 12px; align-items: center; max-width: 92vw; }
#toast[hidden] { display: none; }
#toast button { color: #86efac; font-weight: 600; }

.row.small { margin-top: 2px; gap: 14px; font-size: 13px; }
.dots { color: var(--muted); animation: pulse 1.2s infinite; }
@keyframes pulse { 50% { opacity: .35; } }
#mic.recording { color: #fff; background: var(--red); }
#me { font-size: 22px; }

table.receipt { width: 100%; border-collapse: collapse; font-size: 13px; margin-top: 10px; }
table.receipt td { padding: 5px 4px; border-top: 1px solid var(--line); vertical-align: top; }
table.receipt td.num { text-align: end; white-space: nowrap; font-variant-numeric: tabular-nums; }
table.receipt tr.missing td { color: var(--muted); }
.ok { color: var(--green); margin: 8px 0; } .warn { color: #b45309; margin: 8px 0; }
ul.plain { list-style: none; margin: 4px 0 8px; padding: 0; }
ul.plain li { padding: 8px 0; border-top: 1px solid var(--line); }

.chips { display: flex; gap: 6px; overflow-x: auto; padding: 0 2px 8px; }
.chip { flex: none; padding: 6px 12px; border-radius: 16px; border: 1px solid var(--line); background: #fff; font-size: 14px; }
.chip.on { background: var(--green); color: #fff; border-color: var(--green); }
.arrival { font-size: 13px; color: #374151; background: #eef6f2; border-radius: 10px; padding: 6px 10px; margin: 0 0 8px; }
/* Shop mode: one shop's items while buying, bigger to hit with a thumb. */
.items.shopmode .item { min-height: 64px; font-size: 18px; }
.items.shopmode .tick span { width: 30px; height: 30px; }

.thumb { width: 44px; height: 44px; object-fit: cover; border-radius: 8px; flex: none; }
.items.shopmode .thumb { width: 72px; height: 72px; }
img.big { width: 100%; max-height: 60dvh; object-fit: contain; border-radius: 12px; background: #f3f4f6; }

.card.out { grid-column: 1 / -1; border-color: #fdba74; background: #fff7ed; margin-bottom: 12px; }
.card.out li { white-space: normal; padding: 3px 0; }
/* Two columns of one-line entries (homelists#138): the mark, then the name cut with … when long. */
.card.out ul.marked { display: grid; grid-template-columns: 1fr 1fr; column-gap: 10px; }
.card.out ul.marked li { display: flex; align-items: center; gap: 5px; min-width: 0; white-space: nowrap; cursor: pointer; }
.card.out ul.marked li .name { overflow: hidden; text-overflow: ellipsis; min-width: 0; }
/* An item alone in its row (one item, or the last of an odd count) has the card's width (homelists#180). */
.card.out ul.marked li:last-child:nth-child(odd) { grid-column: 1 / -1; }
.card.out ul.marked li .tick { width: 34px; height: 30px; margin-inline-start: -8px; }   /* wide for a finger, low so the card keeps its four rows in 230 px (#138, #154) */
.card.out ul.marked li .tick span { width: 20px; height: 20px; }
.card.out .more { font-size: 13px; margin-top: 2px; }


/* ⋮ at the card's right, room kept on the right whatever the title's direction (homelists#62: inline-end padding of
   a Hebrew title is on its left, so the title ran under the ⋮ and the menu looked like part of a letter). */
.card .cardmenu { position: absolute; top: 2px; right: 2px; width: 36px; height: 36px; font-size: 20px; color: var(--muted); border-radius: 18px; background: var(--card); z-index: 1; }
.card h2 { padding-right: 30px; }
.card.dragging { z-index: 30; box-shadow: 0 10px 30px rgba(0,0,0,.25); transform-origin: center; opacity: .95; }
.notebook { margin-bottom: 10px; }
.notebook .nbtitle { font-size: 13px; font-weight: 600; margin: 6px 0 2px; }
.notebook .noterow { display: flex; align-items: center; border-bottom: 1px solid var(--line); }
.panel .notebook input.note, .panel .notebook input.add { border: 0; border-radius: 0; background: transparent; padding: 7px 0; font-size: 14px; outline: none; }
.panel .notebook input.note:focus, .panel .notebook input.add:focus { box-shadow: 0 1px 0 var(--green); }
.panel textarea.convo { font-size: 14px; }
.notebook .forget { flex: none; width: 36px; height: 36px; color: var(--muted); font-size: 18px; }

/* ↶ ↷ always in the top bar (homelists#53). */
#top .hist { color: #fff; font-size: 22px; width: 40px; }
#top .hist:disabled { opacity: .35; }

/* The chat panel (homelists#56): its own section between the lists and the box. */
#chat { display: flex; flex-direction: column; background: #fbfaf7; border-top: 2px solid var(--green); flex: none; min-height: 40px; }
#chathandle { display: flex; align-items: center; gap: 8px; padding: 0 4px 0 12px; height: 40px; touch-action: none; cursor: ns-resize; flex: none; }
#chathandle .grip { width: 36px; height: 4px; border-radius: 2px; background: #c9c3b6; position: absolute; left: 50%; transform: translateX(-50%); }
#chathandle .title { font-size: 13px; color: var(--muted); flex: 1; }
#chathandle .icon { width: 36px; height: 36px; font-size: 16px; color: var(--muted); }
#chat { position: relative; }
#chatlog { flex: 1; overflow-y: auto; padding: 0 10px 8px; }
#chatlog .msg { padding: 8px 10px; border-radius: 12px; margin: 6px 0; max-width: 92%; font-size: 15px; }
#chatlog .msg.user { background: #e7f5ef; margin-inline-start: auto; width: fit-content; }
#chatlog .msg.assistant { background: #fff; border: 1px solid var(--line); }
#chatlog .line { min-height: 1.2em; }
#chatlog .line.bullet { padding-inline-start: 14px; position: relative; }
#chatlog .line.bullet::before { content: "•"; position: absolute; inset-inline-start: 2px; color: var(--muted); }
#chatbar { width: 100%; text-align: center; font-size: 13px; color: var(--green); padding: 4px 0 6px; }
li.item.flash { background: #fef3c7; transition: background .6s; }

#cancelrec { color: var(--red); font-size: 18px; }

/* Rows are dragged like cards (homelists#71): no text selection under a long press, vertical scrolling kept. */
li.item { position: relative; -webkit-user-select: none; user-select: none; touch-action: pan-y; background: var(--card); }
li.item.dragging { position: relative; z-index: 30; box-shadow: 0 8px 24px rgba(0,0,0,.25); }

/* The + on each row boundary (homelists#107), just left of the ≡ column; its tap area reaches past the small circle.
   Not over ≡ (homelists#175: centred there, its tap area covered the handle's top and bottom, and after one lucky drag
   every press on ≡ went to a +). 46 px: the 36 px handle, plus the tap area's 8 px reach, plus 2. */
li.item .ins { position: absolute; right: 46px; width: 22px; height: 22px; z-index: 2; display: flex; align-items: center; justify-content: center;
  border-radius: 11px; border: 1px solid var(--line); background: var(--card); color: #9ca3af; font-size: 16px; line-height: 1; font-weight: 600; }
li.item .ins::after { content: ""; position: absolute; inset: -6px -8px; }
li.item .ins.above { top: -11px; }
li.item .ins.below { bottom: -11px; }
li.item .ins:active { background: #ecfdf5; border-color: var(--green); color: var(--green); }
li.item.dragging .ins { display: none; }

/* Rows drag by their ≡ on the right (homelists#73); the rest of the row keeps scrolling. */
li.item .handle { flex: none; width: 36px; align-self: stretch; display: flex; align-items: center; justify-content: center;
  font-size: 22px; color: #b8b2a6; touch-action: none; cursor: grab; }

/* How much is left (homelists#79): a coloured word. */
.mark { flex: none; display: inline-block; min-width: 38px; padding: 3px 8px; border-radius: 12px; font-size: 13px; font-weight: 700;
  text-align: center; color: #fff; line-height: 1.3; }
.mark-out { background: var(--red); } .mark-low { background: #d97706; } .mark-ok { background: #16805c; }
.card.out .mark { font-size: 11px; min-width: 0; padding: 1px 6px; }
.items.shopmode .mark { font-size: 15px; padding: 4px 10px; }

/* Steps held by ↶ and ↷ (homelists#80). */
#top .hist { position: relative; }
#top .hist .count { position: absolute; top: 2px; right: 0; min-width: 16px; height: 16px; padding: 0 4px; border-radius: 8px;
  background: #fff; color: var(--green); font-size: 10px; font-weight: 700; line-height: 16px; text-align: center; }
.marks { flex: none; display: inline-flex; flex-direction: column; gap: 2px; }
.marks .mark { font-size: 11px; padding: 1px 6px; min-width: 32px; }

/* The inline new row (homelists#86). */
li.item.editing { background: #f0faf5; }
li.item.editing input.inline { flex: 1; min-width: 0; font: inherit; border: 0; border-bottom: 2px solid var(--green); background: transparent; padding: 8px 2px; outline: none; }
li.item.editing .btn.small { padding: 6px 12px; font-size: 14px; }
.recur-icon { font-size: 14px; opacity: .8; }

/* The item sheet, tight (homelists#96; the list's ⋮ sheet shares the .tight rules, homelists#99, Denis 2026-10-29: "Need to clean and tighten this menus"): the text is the
   first line, edited in place; states in the row marks' colours; Buy by on one line. Reviewed by Fable: the default
   Enough is tinted, not solid (the list shows no mark for it); one "chosen" style; chips 36px tall. */
.panel.tight { padding-top: 8px; }
.tight .textline { display: flex; align-items: center; cursor: text; border-bottom: 1px solid var(--line); margin-bottom: 12px; }
.tight .textline::after { content: "✎"; color: var(--muted); font-size: 15px; margin-inline-start: 8px; }
.tight .textline:focus-within { border-bottom-color: var(--green); box-shadow: 0 1px 0 var(--green); }
.tight .textline:focus-within::after { visibility: hidden; }
.panel.tight .textline input { flex: 1; min-width: 0; border: 0; border-radius: 0; background: transparent; padding: 8px 0; font-size: 19px; font-weight: 600; outline: none; }
.tight .btn { min-height: 36px; padding: 7px 12px; font-size: 14px; line-height: 1.3; }
.itemsheet .seg { display: flex; gap: 6px; }
.itemsheet .seg .btn { flex: 1; padding: 7px 4px; font-weight: 600; white-space: nowrap; }
.itemsheet .st-enough { color: var(--green); }
.itemsheet .st-low { color: #b45309; }
.itemsheet .st-out { color: var(--red); }
.itemsheet .st-enough.on { background: #ecfdf5; border-color: var(--green); }
.itemsheet .st-low.on { background: #d97706; border-color: #d97706; color: #fff; }
.itemsheet .st-out.on { background: var(--red); border-color: var(--red); color: #fff; }
.itemsheet .buyline { display: flex; flex-wrap: wrap; align-items: center; gap: 6px; margin-top: 10px; }
.tight .lbl { font-size: 13px; color: var(--muted); white-space: nowrap; }
.itemsheet .buyline .btn { padding: 7px 10px; }
.panel.itemsheet label.datechip { position: relative; display: inline-flex; align-items: center; white-space: nowrap; margin: 0; font-size: 14px; color: var(--ink); }
.itemsheet .datechip .face { display: inline-flex; align-items: center; gap: 4px; line-height: 1; }
.itemsheet .datechip .cal { font-size: 13px; }
.panel.itemsheet .datechip input.buyby { position: absolute; inset: 0; width: 100%; height: 100%; padding: 0; border: 0; opacity: 0; cursor: pointer; }
.itemsheet .buyline .btn.on, .panel.itemsheet label.datechip.set { background: var(--green); color: #fff; border-color: var(--green); }
.itemsheet .metaline { display: flex; align-items: center; gap: 10px; margin-top: 10px; font-size: 13px; color: var(--muted); }
.tight .choices { margin-top: 10px; }
.listsheet .kinds { display: flex; flex-wrap: wrap; align-items: center; gap: 6px; }
.tight .sheet-actions { display: flex; flex-wrap: wrap; align-items: center; gap: 2px 20px; margin: 16px -16px calc(-16px - var(--safe-b));
  padding: 6px 16px calc(10px + var(--safe-b)); background: var(--bg); border-top: 1px solid var(--line); }
/* Actions read as words, not as the setting chips above them (homelists#108). */
.tight .sheet-actions .act { min-height: 40px; padding: 8px 0; font-size: 15px; font-weight: 600; color: var(--ink); }
.tight .sheet-actions .act.danger { color: var(--red); }
.tight .sheet-actions .act.primary { color: var(--green); }
.tight .sheet-actions .act.state { display: flex; align-items: center; color: var(--green); cursor: default; }
/* The household's default list (#231): a green border and a small label on its Home card. */
.card.isdefault { border: 2px solid var(--green); padding: 9px 11px; }
.card .defmark { display: inline-block; margin: -2px 0 6px; padding: 1px 8px; border-radius: 999px; background: var(--green); color: #fff; font-size: 11px; font-weight: 600; }
.panel .qr { display: flex; justify-content: center; margin: 4px 0 8px; }
.panel .qr svg { width: min(72vw, 280px); height: auto; aspect-ratio: 1; }   /* scaled, square: a camera reads it at arm's length */
.receipt .meta.was { text-decoration: line-through; }
.receipt .meta.saved { color: var(--green); }
.tight .sheet-actions .choices { flex-basis: 100%; margin: 0 0 6px; }
/* Recurring is quiet when off and coloured when on (homelists#108, "Recurrent is too prominent"). */
.itemsheet .recur { color: var(--muted); }
.itemsheet .recur .ic { filter: grayscale(1); opacity: .55; }
.itemsheet .recur.on { background: #ecfdf5; border-color: var(--green); color: var(--green); font-weight: 600; }
.itemsheet .recur.on .ic { filter: none; opacity: 1; }
.listsheet .kinds .btn.on { background: var(--green); color: #fff; border-color: var(--green); }

/* Who else has the app open (homelists#84): their mascot with a green dot; a ring when they are in this list. */
#here { display: inline-flex; gap: 2px; }
.who-here { position: relative; font-size: 20px; width: 34px; height: 34px; border-radius: 17px; background: rgba(255,255,255,.18); }
.who-here::after { content: ""; position: absolute; right: 1px; bottom: 2px; width: 9px; height: 9px; border-radius: 5px; background: #4ade80; border: 2px solid var(--green); }
.who-here.same { box-shadow: 0 0 0 2px #fff; }

/* A photo waiting in the box (homelists#139): its thumbnail, a word on its state, and ✕. */
#staged { display: flex; align-items: center; gap: 8px; padding: 4px 8px 0; font-size: 13px; }
#staged .thumbs { flex: none; max-width: 70%; }
#staged .meta { flex: 1; min-width: 0; }

/* Notes in the chat, not over the screen (homelists#167): quieter than an answer; the closed chat's bar gets a small
   dot when something new came since it was last open. */
.msg.note { background: #f6f3ea; border: 1px dashed var(--line); color: var(--ink); }
.msg.note .row { flex-wrap: wrap; gap: 4px 12px; }
#chatbar .dot { display: none; width: 8px; height: 8px; border-radius: 50%; background: var(--green); margin-inline-start: 6px; vertical-align: middle; }
#chatbar.news .dot { display: inline-block; }
#signedout { background: #fff7ed; border-bottom: 1px solid #fdba74; color: #9a3412; padding: 6px 12px; font-size: 13px; text-align: center; }
#signedout[hidden] { display: none; }

/* The "Ticked · N" divider between a list's open and ticked groups; tapping it folds the ticked ones (#227). */
.ticked-divider { display: flex; align-items: center; gap: 4px; width: 100%; margin: 12px 0 8px; padding: 8px 4px; border: 0; background: none; color: var(--muted); font: inherit; font-size: 14px; font-weight: 600; text-align: start; }
.ticked-divider .chev { width: 16px; }

/* Recently removed (#234): a row per item, its text first (dir=auto so Hebrew reads right), Put back at the end. */
.removedsheet .rm { display: flex; align-items: center; gap: 10px; padding: 9px 0; border-bottom: 1px solid var(--line); }
.removedsheet .rm .what { flex: 1; min-width: 0; }
.removedsheet .rm .txt { font-size: 16px; overflow-wrap: anywhere; }
.removedsheet .rm .meta { font-size: 13px; color: var(--muted); margin-top: 2px; }
.removedsheet .rm .btn { flex: none; }
.removedsheet .row { margin-top: 12px; }
