/* Casa - the approved look (docs/design/README.md, 2026-09-17). The token set and every
   component rule are lifted from docs/design/2026-09-17_gen-mockups_v1.py; only the frame is
   adapted from a 390 x 844 artboard to a real viewport with safe areas. No web fonts. */

:root{
  --cream:#FBF5EC; --paper:#FFFFFF; --ink:#2A1F1D; --muted:#6B5B57; --line:#EADFD3;
  --berry:#8A2A3F; --berry-deep:#6E1F32; --straw:#D3382E; --leaf:#3F7A32; --pink:#F7D9DF;
  --lucas:#2563eb; --marina:#db2777; --nos:#8A2A3F;
  --font:-apple-system,"SF Pro Text",system-ui,"Segoe UI",sans-serif;
  --serif:"Iowan Old Style","Palatino Linotype",Palatino,Georgia,serif;
}
*{box-sizing:border-box}

/* Frame: the artboard becomes the viewport. The page never scrolls; .content does. #app is exactly
   the viewport's height (a min-height let it grow with a long list, so the page scrolled and the
   sticky nav covered the add bar - found 2026-09-19). */
html,body{margin:0;padding:0;height:100%}
body{background:var(--cream);color:var(--ink);font-family:var(--font);font-size:17px;line-height:1.35;
  -webkit-text-size-adjust:100%}
#app{height:100dvh;background:var(--cream);color:var(--ink);font-family:var(--font);
  font-size:17px;line-height:1.35;display:flex;flex-direction:column;position:relative}
.sr-only{position:absolute;width:1px;height:1px;padding:0;margin:-1px;overflow:hidden;clip:rect(0 0 0 0);white-space:nowrap;border:0}

.top{padding:calc(env(safe-area-inset-top) + 12px) 20px 12px;display:flex;align-items:flex-end;justify-content:space-between;gap:12px}
.top h1{margin:0;font-size:30px;font-weight:700;letter-spacing:-.01em}
.top .back{display:flex;align-items:center;gap:6px;color:var(--berry);text-decoration:none;font-weight:600;font-size:17px;min-height:44px;
  background:transparent;border:0;padding:0;font-family:inherit;cursor:pointer}
/* min-height:0 lets .content shrink to the space left and scroll; its children keep their own
   height, or a .card (overflow:hidden) would be squeezed and clip its rows. */
.content{flex:1;min-height:0;overflow-y:auto;overscroll-behavior:contain;padding:0 16px;display:flex;flex-direction:column;gap:12px}
.content>*{flex-shrink:0}
.chips{display:flex;gap:8px;padding:4px 0 6px}
.chip{border:1px solid var(--line);background:var(--paper);color:var(--ink);border-radius:999px;padding:0 14px;height:36px;
  font:inherit;font-size:15px;font-weight:600;display:flex;align-items:center;gap:6px;cursor:pointer}
.chip[aria-pressed="true"]{background:var(--berry);border-color:var(--berry);color:#fff}
.dot{width:10px;height:10px;border-radius:50%;display:inline-block;flex:none}
.group{display:flex;flex-direction:column;gap:6px}
.group h2{margin:6px 4px 2px;font-size:13px;font-weight:700;letter-spacing:.06em;text-transform:uppercase;color:var(--muted)}
.card{background:var(--paper);border:1px solid var(--line);border-radius:14px;overflow:hidden}
.row{display:flex;align-items:center;gap:12px;padding:10px 12px;min-height:56px;border-top:1px solid var(--line);text-align:left;width:100%;
  background:transparent;border-left:0;border-right:0;border-bottom:0;font:inherit;color:inherit;cursor:pointer}
.row:first-child{border-top:0}
.check{width:26px;height:26px;border-radius:50%;border:2px solid var(--berry);display:flex;align-items:center;justify-content:center;flex:none;background:var(--paper);padding:0;cursor:pointer}
.check.on{background:var(--leaf);border-color:var(--leaf);color:#fff}
.check.sq{border-radius:8px}
.txt{flex:1;display:flex;flex-direction:column;gap:2px;min-width:0}
/* Long text wraps instead of being cut with "..." (Lucas, 2026-09-19). */
.title{font-weight:500;overflow-wrap:anywhere}
.title.done{text-decoration:line-through;color:var(--muted)}
.meta{font-size:13px;color:var(--muted);display:flex;align-items:center;gap:6px}
.meta.late{color:var(--straw);font-weight:600}
.meta.error{color:var(--straw);font-weight:600;margin:0}
.qty{font-size:14px;color:var(--muted);font-variant-numeric:tabular-nums;flex:none}
.chev{color:var(--muted);flex:none}
.addbar{display:flex;gap:8px;padding:10px 16px;background:var(--cream);border-top:1px solid var(--line);
  position:sticky;bottom:0;z-index:2}
.addbar input{flex:1;height:48px;border:1px solid var(--line);border-radius:12px;padding:0 14px;font:inherit;font-size:17px;background:var(--paper);color:var(--ink)}
.addbar input::placeholder{color:var(--muted)}
.addbar button{width:48px;height:48px;border-radius:12px;border:0;background:var(--berry);color:#fff;display:flex;align-items:center;justify-content:center;cursor:pointer;flex:none}
.addbar.off{opacity:.5}
.nav{display:flex;padding:6px 8px calc(8px + env(safe-area-inset-bottom));background:var(--paper);border-top:1px solid var(--line);
  position:sticky;bottom:0;z-index:2}
.nav a,.nav span,.nav button{flex:1;display:flex;flex-direction:column;align-items:center;gap:3px;text-decoration:none;color:var(--muted);font-size:11px;font-weight:600;min-height:52px;justify-content:center}
.nav button{background:transparent;border:0;font-family:inherit;cursor:pointer;padding:0}
.nav a[aria-current="page"],.nav button[aria-current="page"]{color:var(--berry)}
.btn{height:50px;border-radius:12px;border:0;background:var(--berry);color:#fff;font:inherit;font-size:17px;font-weight:600;display:flex;align-items:center;justify-content:center;text-decoration:none;cursor:pointer;padding:0 18px}
.btn.ghost{background:transparent;border:1.5px solid var(--berry);color:var(--berry)}
.btn.danger{background:transparent;color:var(--straw);border:0}
.btn.sm{height:40px;font-size:15px;border-radius:10px}
.btn[disabled]{opacity:.5}
.field{display:flex;flex-direction:column;gap:6px}
.field label{font-size:13px;font-weight:700;color:var(--muted);letter-spacing:.04em;text-transform:uppercase}
.field input,.field textarea{height:48px;border:1px solid var(--line);border-radius:12px;padding:0 14px;font:inherit;font-size:17px;background:var(--paper);color:var(--ink);width:100%}
.field textarea{height:76px;padding:12px 14px;resize:none}
.seg{display:flex;background:var(--paper);border:1px solid var(--line);border-radius:12px;padding:3px;gap:3px}
.seg button{flex:1;height:40px;border:0;border-radius:9px;background:transparent;font:inherit;font-size:15px;font-weight:600;color:var(--ink);display:flex;align-items:center;justify-content:center;gap:6px;cursor:pointer}
.seg button[aria-pressed="true"]{background:var(--ink);color:#fff}
.banner{background:var(--ink);color:#fff;font-size:14px;font-weight:600;padding:calc(env(safe-area-inset-top) + 10px) 16px 10px;display:flex;align-items:center;gap:8px}
.banner + .top{padding-top:12px}
/* The sheet and its backdrop are fixed to the viewport and stacked above the sticky add bar and nav
   (found live 2026-09-17: anchored to #app they were painted under the bars, hiding Salvar). */
.backdrop{position:fixed;inset:0;z-index:20;background:rgba(42,31,29,.45)}
.sheet{position:fixed;left:0;right:0;bottom:0;z-index:21;max-height:calc(100dvh - 24px);overflow-y:auto;background:var(--cream);border-radius:22px 22px 0 0;padding:10px 20px calc(env(safe-area-inset-bottom) + 20px);display:flex;flex-direction:column;gap:14px}
.handle{width:40px;height:5px;border-radius:3px;background:var(--line);margin:0 auto 4px}
.sheet h2{margin:0;font-size:20px;font-weight:700}
/* The item sheet's classes (the task sheet keeps its inline styles): the nested row button's reset,
   the error line hidden until a write fails - .meta's display:flex would beat the hidden attribute -
   and the action row with its spacer. */
.row.inner{padding:0;min-height:0;border:0}
.meta.error[hidden]{display:none}
.sheet-actions{display:flex;gap:10px;margin-top:4px}
.sheet-actions .spacer{flex:1}
.center{flex:1;display:flex;flex-direction:column;align-items:center;justify-content:center;gap:14px;padding:0 32px;text-align:center}
.center p{margin:0;color:var(--muted)}
.wordmark{font-family:var(--serif);font-size:44px;font-weight:600;letter-spacing:-.01em;margin:0}
.icon{width:112px;height:112px;border-radius:26px;object-fit:cover;box-shadow:0 8px 24px rgba(138,42,63,.18)}
.section{display:flex;flex-direction:column;gap:6px}
.kv{display:flex;align-items:center;gap:12px;padding:12px;min-height:56px;border-top:1px solid var(--line)}
.kv:first-child{border-top:0}
.kv .k{color:var(--muted);font-size:15px;flex:1}
.kv .v{font-weight:500}
.avatar{width:40px;height:40px;border-radius:50%;color:#fff;display:flex;align-items:center;justify-content:center;font-weight:700;font-size:18px;flex:none}
.swatches{display:flex;gap:10px}
.swatch{width:32px;height:32px;border-radius:50%;border:3px solid transparent;padding:0;cursor:pointer}
.swatch[aria-pressed="true"]{border-color:var(--ink)}
.stamp{font-size:13px;color:var(--muted);font-variant-numeric:tabular-nums}
.empty{flex:1;display:flex;flex-direction:column;align-items:center;justify-content:center;gap:10px;text-align:center;padding:0 40px;color:var(--muted)}
.empty strong{color:var(--ink);font-size:20px}
.empty p{margin:0}
/* The assistant sheet: the same fixed sheet, a fixed height instead of a max, and only the log
   scrolls - the composer stays on the bottom padding, which already carries the safe-area inset. */
.sheet.assistant{height:min(78dvh,640px);max-height:none;overflow:hidden;gap:10px}
.assistant .ahead{display:flex;align-items:center;justify-content:space-between;gap:12px}
.aclose{background:transparent;border:0;font:inherit;font-size:15px;font-weight:600;color:var(--berry);padding:0 4px;min-height:44px;cursor:pointer}
.alog{flex:1;min-width:0;min-height:0;overflow-y:auto;overscroll-behavior:contain;display:flex;flex-direction:column;gap:10px;padding:2px 0}
.abubble{max-width:84%;padding:9px 12px;border-radius:14px;background:var(--paper);border:1px solid var(--line)}
.abubble.me{align-self:flex-end;background:var(--berry);border-color:var(--berry);color:#fff}
.abubble.bot{align-self:flex-start}
.acard{align-self:stretch;display:flex;flex-direction:column;gap:8px}
.aline{margin:0}
.ameta{margin:0;font-size:13px;color:var(--muted);display:flex;align-items:center;gap:6px}
.ameta.warn{color:var(--straw);font-weight:600}
.ahint{margin:auto 0;text-align:center;color:var(--muted)}
.aoff{margin:0;font-size:13px;font-weight:600;color:var(--straw)}
.alabels{margin:0;padding-left:20px;color:var(--muted)}
.arow{display:flex;gap:10px;justify-content:flex-end}
.assistant .chips{flex-wrap:wrap;padding:0}
.assistant .row{cursor:default;min-height:44px}
.chip[disabled]{opacity:.5}
/* Several actions in one reply: a block per action or read, a read's header in the screens' group
   style, the outcome lines muted or in the warning colour; long words wrap instead of widening the log. */
.ablock{display:flex;flex-direction:column;gap:6px;min-width:0;overflow-wrap:anywhere}
.aline.muted{color:var(--muted)}
.aline.warn{color:var(--straw);font-weight:600}
.asub{margin:4px 0 0;font-size:13px;font-weight:700;letter-spacing:.06em;text-transform:uppercase;color:var(--muted)}
.aabout{margin:0;font-size:13px;font-weight:600;color:var(--muted);overflow-wrap:anywhere}
.acomposer{display:flex;gap:8px;padding-top:8px;border-top:1px solid var(--line)}
.acomposer input{flex:1;min-width:0;height:48px;border:1px solid var(--line);border-radius:12px;padding:0 14px;font:inherit;font-size:17px;background:var(--paper);color:var(--ink)}
.acomposer input::placeholder{color:var(--muted)}
.acomposer button{flex:none;height:48px;padding:0 16px;border:0;border-radius:12px;background:var(--berry);color:#fff;font:inherit;font-size:16px;font-weight:600;cursor:pointer}
.acomposer input[disabled],.acomposer button[disabled]{opacity:.5}
