:root{
  --ink:#2b2a26; --muted:#6f6a5e; --card:rgba(255,252,246,.94); --line:rgba(80,60,30,.12);
  --teal:#2f9a9b; --teal-d:#237b7c; --ok:#2f7f6f; --over:#bf5a30; --amber:#e4a43c;
  --radius:18px; --shadow:0 10px 30px rgba(70,50,20,.10);
}
*{box-sizing:border-box}
html,body{margin:0}
body{font:16px/1.4 system-ui,-apple-system,"Segoe UI",Roboto,sans-serif;color:var(--ink);
  background:linear-gradient(180deg,#cfe9ee 0%,#e9efe6 38%,#f6efdc 100%);background-attachment:fixed;min-height:100vh;
  padding-bottom:84px;-webkit-text-size-adjust:100%}
button{font:inherit;color:inherit;cursor:pointer;border:0;background:none;padding:0}
.top{display:flex;align-items:center;gap:12px;padding:calc(10px + env(safe-area-inset-top)) 16px 6px;max-width:1280px;margin:0 auto}
.brand{font-weight:700;letter-spacing:.02em;color:var(--teal-d)}
.proj{flex:1;min-width:0;display:flex;flex-direction:column;line-height:1.15}
#projName{font-weight:600;white-space:nowrap;overflow:hidden;text-overflow:ellipsis}
.conn{display:flex;align-items:center;gap:6px;color:var(--muted);font-size:12px}
.dot{width:8px;height:8px;border-radius:50%;background:#bbb;display:inline-block}
.dot.ok{background:#3aa17e}.dot.fail{background:var(--over)}.dot.loading{background:var(--amber)}.dot.off{background:#8a97a3}.dot.none{background:#9fb3a8}
.chip{padding:6px 12px;border-radius:999px;background:rgba(255,255,255,.7);border:1px solid var(--line);font-size:13px}
.stage{max-width:1280px;margin:0 auto;padding:0 12px;display:block}
.scene{position:relative;width:100%;aspect-ratio:1000/860;max-height:72vh;margin:0 auto}
.scene svg{width:100%;height:100%;display:block;overflow:hidden;-webkit-tap-highlight-color:transparent}
.layer,.layer image{pointer-events:none}
.layer{transition:opacity .6s ease}
.layer.enter{animation:layerIn .75s cubic-bezier(.2,.8,.2,1) both}
.layer.leave{opacity:0;pointer-events:none}
.layer.sel{filter:drop-shadow(0 0 3px rgba(255,255,255,.95)) drop-shadow(0 0 9px rgba(255,255,255,.7))}
@keyframes layerIn{from{opacity:0;transform:translateY(-18px)}to{opacity:1;transform:none}}
.hit{fill:transparent;stroke:none;cursor:pointer;pointer-events:all;outline:none}
.hit:hover{fill:rgba(255,255,255,.14)}
.hit:focus-visible{stroke:#fff;stroke-width:3;stroke-dasharray:8 6}
.side{display:flex;flex-direction:column;gap:12px;margin-top:6px}
.card{background:var(--card);border:1px solid var(--line);border-radius:var(--radius);box-shadow:var(--shadow);padding:14px 16px}
.budget{padding:0}
.card-hit{display:block;width:100%;text-align:left;padding:14px 16px}
.figs{display:grid;grid-template-columns:repeat(3,1fr);gap:8px}
.fig{display:flex;flex-direction:column;gap:2px;min-width:0}
.lbl{font-size:11px;letter-spacing:.04em;text-transform:uppercase;color:var(--muted)}
.val{font-size:20px;font-weight:650;font-variant-numeric:tabular-nums}
.fig.ok .val{color:var(--ok)} .fig.over .val{color:var(--over)}
.meter{position:relative;height:8px;border-radius:99px;background:rgba(80,60,30,.10);margin:12px 0 8px;overflow:visible}
.meter .m-in,.meter .m-over{position:absolute;top:0;bottom:0;border-radius:99px;transition:width .6s ease,left .6s ease}
.meter .m-in{left:0;background:var(--teal)} .meter .m-over{background:var(--amber)}
.meter .m-mark{position:absolute;top:-3px;bottom:-3px;width:2px;background:var(--ink);opacity:.55;transition:left .6s ease}
.note{margin:6px 0 0;font-size:13px;color:var(--muted)} .note.over{color:#8a4524}
.kicker{font-size:12px;letter-spacing:.06em;text-transform:uppercase;color:var(--teal-d);font-weight:600;margin-bottom:6px}
.kicker.sp{margin-top:18px}
.consider h3{margin:0 0 2px;font-size:18px}
.c-body{display:flex;gap:14px;align-items:center}
.thumb{width:104px;height:96px;flex:none;border-radius:14px;background:linear-gradient(#dff0f1,#f3ecd6);overflow:hidden}
.thumb svg,.s-thumb svg{width:100%;height:100%;display:block}
.c-text{min-width:0}
.blurb{margin:2px 0 4px;color:var(--muted);font-size:14px}
.price{margin:0;font-weight:600;font-size:14px}.price small{font-weight:400;color:var(--muted)}
.c-actions,.actions{display:flex;gap:10px;margin-top:12px;flex-wrap:wrap}
.actions.col{flex-direction:column}
.primary{background:var(--teal);color:#fff;padding:10px 16px;border-radius:12px;font-weight:600}
.primary:hover{background:var(--teal-d)}
.ghost{padding:10px 14px;border-radius:12px;border:1px solid var(--line);background:rgba(255,255,255,.65)}
.ghost.danger{color:var(--over)} .small{padding:7px 12px;font-size:14px}
button:focus-visible,input:focus-visible,textarea:focus-visible{outline:2px solid var(--teal);outline-offset:2px}
.fab{position:fixed;right:14px;bottom:calc(14px + env(safe-area-inset-bottom));z-index:20;background:var(--ink);color:#fff;padding:11px 16px;border-radius:999px;box-shadow:var(--shadow);font-size:14px}
#toast{position:fixed;left:50%;bottom:calc(70px + env(safe-area-inset-bottom));transform:translate(-50%,20px);opacity:0;pointer-events:none;background:var(--ink);color:#fff;padding:10px 16px;border-radius:12px;font-size:14px;z-index:60;transition:all .3s}
#toast.show{opacity:1;transform:translate(-50%,0)}
.sheet{position:fixed;inset:0;z-index:40;display:flex;align-items:flex-end;background:rgba(40,35,20,.28);animation:fadeIn .2s}
.panel{position:relative;width:100%;max-height:84vh;overflow:auto;background:#fffdf8;border-radius:22px 22px 0 0;padding:20px 18px calc(22px + env(safe-area-inset-bottom));box-shadow:0 -10px 40px rgba(40,30,10,.18);animation:slideUp .28s cubic-bezier(.2,.8,.2,1)}
.panel h2{margin:0 0 6px;font-size:22px}
.x{position:absolute;right:12px;top:8px;font-size:28px;line-height:1;color:var(--muted);width:40px;height:40px}
@keyframes fadeIn{from{opacity:0}to{opacity:1}} @keyframes slideUp{from{transform:translateY(40px);opacity:0}to{transform:none;opacity:1}}
.pill{display:inline-block;padding:3px 10px;border-radius:99px;font-size:12px;font-weight:600}
.pill.planned{background:#efe7d3;color:#7a6a3a}.pill.building{background:#fbe6bd;color:#8a5a10}.pill.completed{background:#d8efe4;color:#256a52}
.stage-name{color:var(--muted);font-size:14px;margin-left:6px}
.field{display:block;margin:14px 0 0}.row{display:flex;gap:8px;margin-top:4px}
input[type=number],textarea{width:100%;font:inherit;padding:10px 12px;border-radius:12px;border:1px solid var(--line);background:#fff}
.seg{display:flex;gap:6px;flex-wrap:wrap;margin:8px 0}
.seg button{flex:1;min-width:84px;padding:9px 6px;border-radius:12px;border:1px solid var(--line);background:#fff;font-size:13px}
.seg button.on{background:var(--teal);color:#fff;border-color:var(--teal)}
.proto-box{margin-top:16px;padding:12px;border-radius:14px;background:rgba(228,164,60,.10);border:1px dashed rgba(180,120,30,.4)}
.proto-title{font-size:12px;font-weight:600;letter-spacing:.04em;text-transform:uppercase;color:#8a5a10}
.tiny{font-size:12px;color:var(--muted);margin:8px 0 0}
.impact{display:grid;gap:6px;margin:12px 0;padding:10px 12px;border-radius:14px;background:#f6f1e4}
.impact>div{display:flex;flex-wrap:wrap;justify-content:space-between;gap:2px 10px;font-variant-numeric:tabular-nums}.impact .over{color:var(--over)}.impact .ok{color:var(--ok)}
.s-thumb{height:170px;border-radius:16px;background:linear-gradient(#dff0f1,#f3ecd6);overflow:hidden;margin:4px 0 10px}
.presets{display:flex;gap:8px;margin-top:8px}
.list{display:flex;flex-direction:column;border:1px solid var(--line);border-radius:14px;overflow:hidden}
.rowbtn,.kv>div{display:flex;justify-content:space-between;gap:10px;padding:11px 14px;background:#fff;border-bottom:1px solid var(--line);text-align:left}
.rowbtn:last-child,.kv>div:last-child{border-bottom:0}.rowbtn span:last-child{font-variant-numeric:tabular-nums;font-weight:600}
.kv span:first-child{color:var(--muted)}
textarea{resize:vertical}
/* Lot 1: the hidden attribute must always win over component display rules (it did not for #projectPanel on phones) */
[hidden]{display:none!important}
@media (min-width:900px){
  body{padding-bottom:0}
  .top{padding:16px 24px 8px}
  .stage{display:grid;grid-template-columns:minmax(0,1fr) 380px;gap:22px;align-items:start;padding:0 24px}
  .scene{max-height:calc(100vh - 110px)}
  .side{margin-top:24px}
  .sheet{background:transparent;pointer-events:none;align-items:stretch;justify-content:flex-end;padding:78px 24px 24px}
  .panel{pointer-events:auto;width:400px;max-height:100%;border-radius:22px;box-shadow:0 20px 60px rgba(40,30,10,.25);align-self:flex-start}
}
@media (prefers-reduced-motion:reduce){*{animation-duration:.01ms!important;transition-duration:.01ms!important}}

/* ---- scene tags (name + price): interface layer above the artwork */
.tags{position:absolute;inset:0;pointer-events:none;overflow:hidden}
.tag{position:absolute;left:0;top:0;pointer-events:auto;display:inline-flex;align-items:center;gap:5px;white-space:nowrap;min-height:32px;padding:6px 11px;border-radius:999px;font-size:12.5px;line-height:1;font-weight:600;letter-spacing:.01em;cursor:pointer;-webkit-tap-highlight-color:transparent;animation:tagIn .5s ease both;box-shadow:0 2px 8px rgba(40,30,10,.22)}
.tag.present{background:rgba(255,255,255,.95);color:var(--ink);border:1.5px solid var(--teal)}
.tag.idea{background:rgba(255,255,255,.62);color:#2c4b4d;border:1.5px dashed rgba(40,100,104,.8);box-shadow:0 1px 5px rgba(40,30,10,.14);-webkit-backdrop-filter:blur(2px);backdrop-filter:blur(2px)}
.tag.idea::before{content:"+";font-weight:800;color:var(--teal-d);margin-right:1px}
.tag.sel{background:var(--teal);color:#fff;border-color:var(--teal-d)}
.tag.present:not(.moved)::after{content:"";position:absolute;left:50%;bottom:-5px;width:8px;height:8px;margin-left:-4px;background:inherit;border-right:1.5px solid var(--teal);border-bottom:1.5px solid var(--teal);transform:rotate(45deg)}
.tag:focus-visible{outline:3px solid #fff;outline-offset:1px;box-shadow:0 0 0 5px var(--teal-d)}
@keyframes tagIn{from{opacity:0}to{opacity:1}}
@media (prefers-reduced-motion:reduce){.tag{animation:none}}

/* ---- "Add to your project" card */
.addcard[hidden]{display:none}
.addlist{list-style:none;margin:0;padding:0;display:flex;flex-direction:column;gap:6px}
.addrow{display:flex;align-items:center;gap:12px;width:100%;text-align:left;padding:6px 8px;border-radius:14px;background:rgba(255,255,255,.55);border:1px solid var(--line);min-height:52px}
.addrow:hover{background:rgba(255,255,255,.9)}
.a-thumb{width:56px;height:46px;flex:none;border-radius:10px;overflow:hidden;background:linear-gradient(#dff0f1,#f3ecd6)}
.a-thumb svg{width:100%;height:100%;display:block}
.a-text{display:flex;flex-direction:column;min-width:0;flex:1}
.a-text b{font-size:15px;font-weight:600;white-space:nowrap;overflow:hidden;text-overflow:ellipsis}
.a-text small{color:var(--muted);font-size:13px}
.a-add{flex:none;font-weight:700;font-size:13px;color:#fff;background:var(--teal);border-radius:999px;padding:7px 12px}

/* =================== V0.3 — world, navigation, site, review, secretariat =================== */
body{padding-bottom:calc(150px + env(safe-area-inset-bottom))}
#nav{position:fixed;left:0;right:0;bottom:0;z-index:30;display:flex;gap:4px;padding:8px 10px calc(8px + env(safe-area-inset-bottom));background:rgba(255,253,248,.97);border-top:1px solid var(--line);box-shadow:0 -6px 24px rgba(60,45,20,.10)}
#nav button{flex:1;min-height:48px;border-radius:14px;font-weight:600;font-size:14px;color:var(--muted);letter-spacing:.01em}
#nav button.on{background:var(--teal);color:#fff}
#nav button.fresh{animation:navPop .9s ease both}
@keyframes navPop{from{transform:scale(.6);opacity:0}60%{transform:scale(1.08);opacity:1}to{transform:none}}
.fab{bottom:calc(76px + env(safe-area-inset-bottom))}
#toast{bottom:auto;top:calc(64px + env(safe-area-inset-top))}
#views{position:relative;overflow-x:clip}
#world{transition:transform .45s cubic-bezier(.4,0,.2,1),opacity .45s ease}
#world.away{transform:translateY(-70px);opacity:0;pointer-events:none}
.secview{max-width:1280px;margin:0 auto;padding:6px 16px 24px;transform:translateY(60px);opacity:0;transition:transform .45s cubic-bezier(.2,.8,.2,1),opacity .45s ease}
.secview.in{transform:none;opacity:1}
.secview[hidden],#world[hidden]{display:none}
/* Lot 1: the old fixed-position .tabcard block that stood here was fully overridden by the phone shell below and has been removed. */
.layer.dim{opacity:.22;filter:saturate(.3);transition:opacity .5s,filter .5s}
.marker.dim{opacity:.25}
.marker{pointer-events:none}.marker .hit{pointer-events:all}
.tag.hide{display:none}
.tag.ph-works{border-color:var(--amber);background:#fff7e6}
.tag.ph-completed{border-color:var(--ok)}
.tag.checked::before{content:"\2713";display:inline-grid;place-items:center;width:16px;height:16px;border-radius:50%;background:var(--ok);color:#fff;font-size:11px;font-weight:800;margin-right:2px}
.tag.sel.checked::before{background:#fff;color:var(--teal-d)}
.tabcard h2{margin:0 0 4px;font-size:22px}
.tabcard .blurb{margin:2px 0 8px}
.vis{display:inline-grid;place-items:center;width:22px;height:22px;border-radius:50%;background:var(--ok);color:#fff;font-size:13px;vertical-align:middle}
.offline{margin:6px 0;padding:8px 12px;border-radius:12px;background:#fbe6bd;color:#6b4710;font-size:13px}
.shotrow{display:flex;gap:10px;align-items:center;flex-wrap:wrap}
.shot{display:inline-flex;align-items:center;justify-content:center;min-height:52px;padding:0 26px;border-radius:14px;cursor:pointer;font-weight:700;font-size:17px;background:var(--teal);color:#fff}
.shotprev img,.refprev img{display:block;max-width:100%;max-height:150px;border-radius:12px;margin:8px 0}
.entries{list-style:none;margin:10px 0 0;padding:0;display:flex;flex-direction:column;gap:8px}
.entry{display:flex;gap:10px;padding:8px;border-radius:12px;background:#fff;border:1px solid var(--line)}
.e-img{width:64px;height:64px;object-fit:cover;border-radius:10px;flex:none}
.e-body{display:flex;flex-direction:column;gap:2px;min-width:0;font-size:14px}.e-body small{color:var(--muted)}
.eact{display:flex;gap:6px;flex-wrap:wrap;margin-top:6px}
.tiny-btn{padding:7px 10px;font-size:12.5px;border-radius:10px;min-height:34px}
.tiny-btn[aria-pressed="true"]{background:#d8efe4;border-color:rgba(47,127,111,.4)}
input[type=text],input[type=date],select{width:100%;font:inherit;padding:10px 12px;border-radius:12px;border:1px solid var(--line);background:#fff;min-height:44px}
input[type=file]{font-size:14px;max-width:100%}
.chips{display:flex;flex-wrap:wrap;gap:8px;align-items:center;margin:6px 0}
.chip2{padding:8px 14px;border-radius:999px;background:#fff;border:1.5px solid var(--teal);font-weight:600;font-size:14px;min-height:40px}
.chk{display:inline-flex;align-items:center;gap:6px;padding:8px 12px;border-radius:999px;background:#fff;border:1px solid var(--line);font-size:14px;min-height:40px}
.chk input{width:18px;height:18px}
.rv{color:var(--ok);font-weight:600}.nr{color:var(--muted);font-weight:400}
.sheet.peek,.sheet.peek.tall{background:transparent;pointer-events:none}
.sheet.peek .panel{pointer-events:auto;max-height:50vh;box-shadow:0 -8px 30px rgba(40,30,10,.25)}
.sheet.peek.tall .panel{max-height:58vh}
.sheet .panel{max-height:84vh}
@supports (height:100dvh){.sheet.peek .panel{max-height:50dvh}.sheet.peek.tall .panel{max-height:58dvh}.sheet .panel{max-height:84dvh}}
.hello{position:fixed;left:14px;right:14px;top:calc(70px + env(safe-area-inset-top));z-index:70;max-width:420px;margin:0 auto;padding:14px 16px;border-radius:16px;background:var(--ink);color:#fff;display:flex;gap:14px;align-items:center;justify-content:space-between;box-shadow:var(--shadow);animation:slideUp .3s}
.hello p{margin:0;font-size:15px}
details.memory{margin:12px 0;border:1px solid var(--line);border-radius:14px;background:rgba(255,255,255,.7);padding:4px 12px}
details.memory summary{cursor:pointer;min-height:44px;display:flex;flex-direction:column;justify-content:center;font-weight:600}
details.memory summary small{font-weight:400;color:var(--muted);font-size:12px}
.mem-block{padding:6px 0;border-top:1px solid var(--line)}
.mem{margin:4px 0;padding-left:18px;font-size:14px}
.rsec{padding:10px 0;border-top:1px solid var(--line)}
.rsec h3{margin:0 0 6px;font-size:15px;display:flex;gap:8px;align-items:center}
.rsec .n{display:inline-grid;place-items:center;width:22px;height:22px;border-radius:50%;background:var(--teal);color:#fff;font-size:12px}
.rlines{list-style:none;margin:4px 0;padding:0;display:flex;flex-direction:column;gap:6px}
.rlines li{display:flex;justify-content:space-between;gap:8px;align-items:flex-start;padding:8px 10px;border-radius:10px;background:#fff;border:1px solid var(--line);font-size:14px}
.x2{width:32px;height:32px;font-size:20px;color:var(--muted);flex:none}
.addline{display:flex;gap:8px;align-items:center;flex-wrap:wrap;margin-top:6px}
.addline input[type=text]{flex:1;min-width:140px}
.addline input[type=date]{width:auto;flex:none}
.addline select{width:auto;flex:none}
.rchg{padding:10px 0;border-top:1px solid var(--line)}
.sumgrid{display:grid;grid-template-columns:repeat(3,1fr);gap:8px;margin:10px 0}
.sumgrid>div{display:flex;flex-direction:column;padding:8px 10px;border-radius:12px;background:#f6f1e4}
.sumgrid b{font-size:20px}.sumgrid span{font-size:11.5px;color:var(--muted);line-height:1.2}
.warn{margin:10px 0;display:flex;flex-direction:column;gap:8px}
.warnrow{display:flex;justify-content:space-between;gap:10px;align-items:center;padding:10px 12px;border-radius:12px;background:#fbe6bd;color:#5c3d0b;font-size:14px}
pre.frozen{white-space:pre-wrap;word-break:break-word;font:13px/1.45 ui-monospace,Menlo,Consolas,monospace;background:#fff;border:1px solid var(--line);border-radius:12px;padding:12px;margin:8px 0}
.cats{display:grid;grid-template-columns:1fr 1fr;gap:10px;margin-top:10px}
.cat{display:flex;flex-direction:column;gap:6px;text-align:left;padding:16px;border-radius:16px;background:var(--card);border:1px solid var(--line);box-shadow:var(--shadow);min-height:84px}
.cat b{font-size:15px}.cat span{font-size:22px;font-weight:650;color:var(--teal-d)}
.sec-top{display:flex;gap:8px;justify-content:space-between;margin:6px 0 10px}
.sub{display:block;font-size:12px;color:var(--muted);font-weight:400}
.rowbtn.plain{cursor:default}
.lbl.sp{display:block;margin-top:14px}
.figline{margin:4px 0}
.figs.two{grid-template-columns:1fr 1fr}
.linkb{color:var(--teal-d);font-weight:600;text-decoration:underline}
.addother{display:flex;align-items:center;gap:12px;width:100%;text-align:left;padding:6px 8px;border-radius:14px;background:transparent;border:1.5px dashed rgba(40,100,104,.55);min-height:52px}
.addother:hover{background:rgba(255,255,255,.7)}
.a-plus{width:56px;height:46px;flex:none;display:grid;place-items:center;font-size:26px;color:var(--teal-d)}
.pill.ph-works{background:#fbe6bd;color:#8a5a10}.pill.ph-agreed{background:#dde8f6;color:#2c4d78}.pill.ph-study{background:#efe7d3;color:#7a6a3a}.pill.ph-completed{background:#d8efe4;color:#256a52}
.pill[hidden]{display:none}
.phase-actions .primary,.phase-actions .ghost{min-height:46px}
@media (min-width:900px){
  body{padding-bottom:0}
  #nav{position:static;box-shadow:none;border:0;background:transparent;padding:0;margin-left:auto;flex:none}
  #nav button{flex:none;min-height:40px;padding:0 16px}
  .fab{bottom:calc(14px + env(safe-area-inset-bottom))}#toast{bottom:auto;top:70px}
  .sheet .panel,.sheet.peek .panel,.sheet.peek.tall .panel{max-height:100%}
  .secview{padding:12px 24px 40px}.cats{grid-template-columns:repeat(3,1fr)}
}

/* =================== V0.3.1 — mobile = application shell ===================
   Phones get a full-screen app: fixed header, the world filling the main area, one docked panel, a fixed bottom navigation.
   Nothing scrolls except the panel and the Secretariat; the page itself never scrolls. Desktop (>=900px) is unchanged. */
:root{--navh:62px}
@media (max-width:899px){
  html,body{height:100%;overflow:hidden;overscroll-behavior:none;touch-action:manipulation;-webkit-tap-highlight-color:transparent}
  body{padding:0;min-height:0;background-attachment:scroll}
  #app{height:100vh;height:100dvh;display:flex;flex-direction:column;padding-bottom:calc(var(--navh) + env(safe-area-inset-bottom))}
  .top{flex:none;width:100%;min-width:0;padding:calc(6px + env(safe-area-inset-top)) calc(12px + env(safe-area-inset-right)) 4px calc(12px + env(safe-area-inset-left));gap:8px}
  .brand{display:none}
  .proj{flex:1;min-width:0}
  .conn small{white-space:nowrap;overflow:hidden;text-overflow:ellipsis}
  .conn{min-width:0}
  .fab{position:static;box-shadow:none;background:rgba(255,255,255,.7);color:var(--ink);border:1px solid var(--line);padding:6px 12px;font-size:13px;z-index:auto}
  #views{flex:1 1 auto;min-height:0;position:relative;overflow:hidden}
  #world{height:100%}
  .stage{height:100%;display:flex;flex-direction:column;padding:0 calc(8px + env(safe-area-inset-right)) 0 calc(8px + env(safe-area-inset-left))}
  .scene{flex:1 1 auto;min-height:150px;height:auto;max-height:none;aspect-ratio:auto}
  .side{flex:none;margin:0;padding:0 0 8px}
  #projectPanel{display:flex;flex-direction:column;gap:10px;max-height:34vh;max-height:34dvh;overflow-y:auto;-webkit-overflow-scrolling:touch;overscroll-behavior:contain;border-radius:var(--radius)}
  .tabcard{position:static;left:auto;right:auto;bottom:auto;z-index:auto;max-height:56vh;max-height:56dvh;overflow-y:auto;-webkit-overflow-scrolling:touch;overscroll-behavior:contain;margin:0}
  .secview{height:100%;overflow-y:auto;-webkit-overflow-scrolling:touch;overscroll-behavior:contain;padding:6px calc(14px + env(safe-area-inset-right)) 24px calc(14px + env(safe-area-inset-left))}
  #nav{position:fixed;left:0;right:0;bottom:0;height:calc(var(--navh) + env(safe-area-inset-bottom));padding:6px calc(8px + env(safe-area-inset-right)) calc(6px + env(safe-area-inset-bottom)) calc(8px + env(safe-area-inset-left));z-index:30}
  #nav button{min-height:48px}
  #toast{top:calc(52px + env(safe-area-inset-top))}
  .hello{top:calc(56px + env(safe-area-inset-top))}
  .sheet .panel{padding-left:calc(18px + env(safe-area-inset-left));padding-right:calc(18px + env(safe-area-inset-right))}
}
/* landscape phone: the world and the panel sit side by side */
@media (max-width:899px) and (max-height:520px){
  html.land{--navh:52px}
  html.land .stage{flex-direction:row;gap:8px}
  html.land .scene{flex:1 1 0;min-width:0}
  html.land .side{flex:0 0 min(44vw,340px);overflow-y:auto;min-height:0;padding-bottom:4px}
  html.land #projectPanel,html.land .tabcard{max-height:none}
  html.land #nav button{min-height:40px;font-size:13px}
  html.land .sheet.peek .panel,html.land .sheet.peek.tall .panel,html.land .sheet .panel{max-height:88vh;max-height:88dvh}
  html.land .sheet.peek .panel{width:min(52vw,420px);margin-left:auto}
}
/* installed (home-screen) mode */
@media (display-mode:standalone){
  body{-webkit-user-select:none;user-select:none}
  input,textarea,.frozen{-webkit-user-select:text;user-select:text}
}

/* =================== V1.0 lot 1 — Android stability ===================
   (a) [hidden] always wins (global rule above): the Project panel (budget, add, ideas) no longer shows under Site/Review.
   (b) Keyboard mode (html.kb, set by js/viewport.js) is NOT the landscape layout: nav hidden, world collapsed, the panel takes the room.
   (c) Primary actions of the Site composer stay reachable: sticky footer inside the scrolling panel. */
.composer .actions{position:sticky;bottom:0;z-index:2;background:var(--card);padding:8px 0 4px;margin-top:6px;box-shadow:0 -8px 8px -6px var(--card)}
@media (max-width:899px){
  html.kb #nav{display:none}
  html.kb #app{padding-bottom:0}
  html.kb .scene{flex:0 0 0;min-height:0;height:0;overflow:hidden;visibility:hidden}
  html.kb .stage{flex-direction:column;gap:0}
  html.kb .side{flex:1 1 auto;min-height:0;display:flex;flex-direction:column;padding-bottom:0}
  html.kb .tabcard,html.kb #projectPanel{max-height:none;flex:1 1 auto;min-height:0}
  html.kb .sheet .panel,html.kb .sheet.peek .panel,html.kb .sheet.peek.tall .panel{max-height:100vh;max-height:var(--vvh,100dvh);border-radius:0;padding-bottom:12px}
  html.kb #toast{top:calc(52px + env(safe-area-inset-top));bottom:auto}
}

/* =================== V1.0 lot 1.2 — typing mode (real-phone feedback) ===================
   While the keyboard is open (html.kb) the screen is a pure writing surface: header, world and navigation are hidden,
   the photo is a small thumbnail, the comment takes ALL the remaining height and scrolls by itself, and Save is a fixed
   footer that can never leave the screen. Outside typing nothing changes: the world stays immersive.
   Layout (works from portrait 400 px down to a landscape 100 px strip):   [ comment (scrolls)            ]
                                                                           [ thumb ][ Save              ]  */
@media (max-width:899px){
  html.kb .top{display:none}
  html.kb #views,html.kb #world,html.kb .stage{height:100%}
  html.kb .stage{padding:0}
  html.kb .side{flex:1 1 auto;min-height:0;display:flex;flex-direction:column;padding:0}
  html.kb #sitePanel{flex:1 1 auto;min-height:0;display:flex;flex-direction:column;max-height:none;overflow:hidden;margin:0;border-radius:0;box-shadow:none;border-left:0;border-right:0;border-top:0;
    padding:calc(4px + env(safe-area-inset-top)) calc(10px + env(safe-area-inset-right)) calc(4px + env(safe-area-inset-bottom)) calc(10px + env(safe-area-inset-left))}
  /* everything but the composer is out of the way while typing */
  html.kb #sitePanel > :not(.composer){display:none}
  html.kb #sitePanel .composer{flex:1 1 auto;min-height:0;display:grid;grid-template-columns:auto minmax(0,1fr);grid-template-rows:minmax(32px,1fr) auto;
    grid-template-areas:"note note" "prev save";gap:6px}
  html.kb #sitePanel .composer .shotrow{display:none}
  html.kb #sitePanel .composer .field{grid-area:note;margin:0;min-height:0;display:flex}
  html.kb #sitePanel .composer .field .lbl{display:none}
  html.kb #sitePanel .composer textarea{flex:1 1 auto;width:100%;height:100%;min-height:0;resize:none;overflow-y:auto;-webkit-overflow-scrolling:touch;overscroll-behavior:contain}
  html.kb #sitePanel .composer .shotprev{grid-area:prev;margin:0;align-self:center}
  html.kb #sitePanel .composer .shotprev[hidden]{display:none}
  html.kb #sitePanel .composer .shotprev img{display:block;margin:0;width:48px;height:48px;max-width:48px;max-height:48px;object-fit:cover;border-radius:10px}
  html.kb #sitePanel .composer .actions{grid-area:save;position:static;margin:0;padding:0;background:none;box-shadow:none;display:flex}
  html.kb #sitePanel .composer .actions .primary{flex:1 1 auto;width:100%;min-height:40px}
  /* grid area "prev" collapses when there is no photo: Save then spans the full width */
  html.kb #sitePanel .composer:not(:has(.shotprev:not([hidden]))){grid-template-columns:minmax(0,1fr);grid-template-areas:"note" "save"}
}

/* =================== V1.0 lot 1.3 — size the app on the VISIBLE area while typing ===================
   --vvh / --vvt come from visualViewport (js/viewport.js). With browsers that resize the layout viewport they equal 100dvh / 0;
   with browsers that only shrink or pan the visual viewport (keyboard "covers" the page) this keeps header-less typing mode,
   comment and Save inside what is really visible. */
@media (max-width:899px){
  html.kb,html.kb body{overflow:hidden}
  html.kb #app{position:fixed;left:0;right:0;top:var(--vvt,0px);bottom:auto;height:var(--vvh,100dvh);padding-bottom:0}
  html.kb .sheet{top:var(--vvt,0px);bottom:auto;height:var(--vvh,100dvh)}
}

/* =================== V1.0 lot 1.4 — extreme heights (html.kbx: typing mode with < 170 px visible; real phone: 51 px) ===================
   Comment and Save side by side on ONE row; thumbnail hidden temporarily (the photo stays attached, only its preview is hidden);
   tight spacing. The comment keeps its own internal scroll; Save stays a usable 40 px target. The system keyboard is never resized. */
@media (max-width:899px),(max-height:520px){
  html.kbx #sitePanel{padding:2px calc(6px + env(safe-area-inset-right)) 2px calc(6px + env(safe-area-inset-left))}
  html.kbx #sitePanel .composer,
  html.kbx #sitePanel .composer:not(:has(.shotprev:not([hidden]))){grid-template-columns:minmax(0,1fr) auto;grid-template-rows:minmax(0,1fr);grid-template-areas:"note save";gap:6px;align-items:stretch}
  html.kbx #sitePanel .composer .shotprev,html.kbx #sitePanel .composer .shotprev[hidden]{display:none}
  html.kbx #sitePanel .composer .field{margin:0;min-height:0}
  html.kbx #sitePanel .composer textarea{min-height:0;height:100%;padding:4px 8px;line-height:1.25;border-radius:8px}
  html.kbx #sitePanel .composer .actions{align-self:center;width:auto}
  html.kbx #sitePanel .composer .actions .primary{width:auto;min-width:76px;min-height:40px;padding:0 16px}
}

/* =================== V1.0 lot 2a — safety net (save errors, drafts, backup) =================== */
.savebanner{position:fixed;left:0;right:0;top:0;z-index:70;background:#8a1f1f;color:#fff;padding:calc(6px + env(safe-area-inset-top)) 12px 6px;font-size:13px;text-align:center}
.savebanner[hidden]{display:none}
html.kb .savebanner{display:none}
.linkbtn{background:none;border:0;padding:2px 4px;color:inherit;text-decoration:underline;font:inherit;cursor:pointer;min-height:32px}
.nudge .linkbtn{color:var(--accent,#1f6f5c)}
.draftpill{margin:2px 0}
html.kb #sitePanel .composer .draftpill{display:none}
.filebtn{display:flex;align-items:center;justify-content:center;cursor:pointer}
.bkconfirm{border:1px solid var(--line,#ccc);border-radius:12px;padding:10px;margin:8px 0}

/* lot 2b */
.migrate-note{position:fixed;inset:auto 12px 12px 12px;z-index:60;background:#1b2a3a;color:#fff;padding:12px 14px;border-radius:12px;font:14px system-ui;text-align:center}

/* lot 2c — observations: kind row, to-do badges. The kind row is hidden in typing mode (it is not a grid area of the Android typing layout). */
.kindrow{margin:10px 0 0}
.kseg{margin:0 0 6px}
.afields{display:flex;gap:8px;flex-wrap:wrap}
.afields .ain{flex:1 1 140px;min-width:0;padding:9px 10px;border:1px solid var(--line);border-radius:12px;font:inherit;background:#fff}
.badge{display:inline-block;font-size:11px;letter-spacing:.03em;text-transform:uppercase;padding:1px 7px;border-radius:999px;margin-right:4px;border:1px solid var(--line)}
.badge.todo{background:#fff4d6;border-color:#e8c766;color:#6a4b00}
.badge.done{background:#e3f4ea;border-color:#9fd0b2;color:#1f5a35}
html.kb #sitePanel .composer .kindrow{display:none}

/* =================== V1.0 lot 3 — three spaces, one docked panel ===================
   Appended only (the Android typing rules above are untouched). The Project panel and the Site panels (visit, meeting) share ONE dock envelope,
   scroll inside it, and keep their action row visible (sticky). In typing mode the more specific html.kb rules above still win. */
@media (max-width:899px){
  :root{--dock:50vh}
  @supports (height:1dvh){:root{--dock:50dvh}}
  #projectPanel,.tabcard{max-height:var(--dock)}
}
#reviewPanel > .actions{position:sticky;bottom:0;z-index:2;background:var(--card);padding:8px 0 4px;box-shadow:0 -8px 8px -6px var(--card)}   /* meeting panel only: the Site composer already has its own sticky Save */

/* =================== V1.0 lot 4 — typing mode for the composer inside the meeting sheet ===================
   Appended only. Same layout as the Site composer (lots 1.2-1.4): while the keyboard is open (html.kb) and the focus is IN the composer of a sheet,
   that composer becomes the writing surface over the visible area: the comment takes the height and scrolls by itself, thumbnail + Save sit on one row,
   and at < 170 px visible (html.kbx, real phone: 51 px) comment and Save sit side by side on one row. Other fields of the sheet (decisions, commitments) are untouched. */
@media (max-width:899px){
  html.kb .sheet .composer:focus-within{position:fixed;left:0;right:0;top:var(--vvt,0px);height:var(--vvh,100dvh);z-index:60;box-sizing:border-box;margin:0;background:#fffdf8;
    padding:calc(4px + env(safe-area-inset-top)) calc(10px + env(safe-area-inset-right)) calc(4px + env(safe-area-inset-bottom)) calc(10px + env(safe-area-inset-left));
    display:grid;grid-template-columns:auto minmax(0,1fr);grid-template-rows:minmax(32px,1fr) auto;grid-template-areas:"note note" "prev save";gap:6px}
  html.kb .sheet .composer:focus-within .shotrow,html.kb .sheet .composer:focus-within .kindrow,html.kb .sheet .composer:focus-within .draftpill{display:none}
  html.kb .sheet .composer:focus-within .field{grid-area:note;margin:0;min-height:0;display:flex}
  html.kb .sheet .composer:focus-within .field .lbl{display:none}
  html.kb .sheet .composer:focus-within textarea{flex:1 1 auto;width:100%;height:100%;min-height:0;resize:none;overflow-y:auto;-webkit-overflow-scrolling:touch;overscroll-behavior:contain}
  html.kb .sheet .composer:focus-within .shotprev{grid-area:prev;margin:0;align-self:center}
  html.kb .sheet .composer:focus-within .shotprev[hidden]{display:none}
  html.kb .sheet .composer:focus-within .shotprev img{display:block;margin:0;width:48px;height:48px;max-width:48px;max-height:48px;object-fit:cover;border-radius:10px}
  html.kb .sheet .composer:focus-within .actions{grid-area:save;position:static;margin:0;padding:0;background:none;box-shadow:none;display:flex}
  html.kb .sheet .composer:focus-within .actions .primary{flex:1 1 auto;width:100%;min-height:40px}
  html.kb .sheet .composer:focus-within:not(:has(.shotprev:not([hidden]))){grid-template-columns:minmax(0,1fr);grid-template-areas:"note" "save"}
}
@media (max-width:899px),(max-height:520px){
  html.kbx .sheet .composer:focus-within,html.kbx .sheet .composer:focus-within:not(:has(.shotprev:not([hidden]))){padding:2px calc(6px + env(safe-area-inset-right)) 2px calc(6px + env(safe-area-inset-left));
    grid-template-columns:minmax(0,1fr) auto;grid-template-rows:minmax(0,1fr);grid-template-areas:"note save";gap:6px;align-items:stretch}
  html.kbx .sheet .composer:focus-within .shotprev,html.kbx .sheet .composer:focus-within .shotprev[hidden]{display:none}
  html.kbx .sheet .composer:focus-within textarea{min-height:0;height:100%;padding:4px 8px;line-height:1.25;border-radius:8px}
  html.kbx .sheet .composer:focus-within .actions{align-self:center;width:auto}
  html.kbx .sheet .composer:focus-within .actions .primary{width:auto;min-width:76px;min-height:40px;padding:0 16px}
}

/* =================== V1.0 lot 4.1 — commitments are to-dos; typing mode for the decision / commitment / next / change forms ===================
   Appended only. Same principle as the lot 4 composer: while the keyboard is open (html.kb) and the focus is IN one of these forms, that form becomes the writing
   surface over the visible area with its action button (Add / Save) always reachable; at < 170 px visible (html.kbx, real phone: 51 px) it is ONE row.
   Fields that do not have the focus stay focusable (the keyboard's "Next" key still works); they are only collapsed. */
.clines .eact{margin-left:6px}
.sheet .chform > .actions{position:sticky;bottom:0;z-index:2;background:var(--card,#fffdf8);padding:8px 0 4px;box-shadow:0 -8px 8px -6px var(--card,#fffdf8)}   /* Save / Ask stay reachable in landscape without the keyboard too */
.clines .badge{margin-right:6px}
@media (max-width:899px){
  html.kb .sheet .addline:focus-within{position:fixed;left:0;right:0;top:var(--vvt,0px);height:var(--vvh,100dvh);z-index:60;box-sizing:border-box;margin:0;background:#fffdf8;overflow-y:auto;overscroll-behavior:contain;
    padding:calc(6px + env(safe-area-inset-top)) calc(10px + env(safe-area-inset-right)) calc(6px + env(safe-area-inset-bottom)) calc(10px + env(safe-area-inset-left));display:flex;flex-wrap:wrap;align-content:flex-start;gap:6px}
  html.kb .sheet .addline:focus-within input[type=text]{flex:1 1 100%;min-width:0}
  html.kb .sheet .addline:focus-within select,html.kb .sheet .addline:focus-within input[type=date]{flex:1 1 40%;min-height:40px}
  html.kb .sheet .addline:focus-within .ghost.small{flex:1 1 30%;min-height:40px;position:sticky;bottom:0}
  html.kb .sheet .chform:focus-within{position:fixed;left:0;right:0;top:var(--vvt,0px);height:var(--vvh,100dvh);z-index:60;box-sizing:border-box;margin:0;background:#fffdf8;overflow-y:auto;overscroll-behavior:contain;-webkit-overflow-scrolling:touch;
    padding:calc(6px + env(safe-area-inset-top)) calc(10px + env(safe-area-inset-right)) 0 calc(10px + env(safe-area-inset-left))}
  html.kb .sheet .chform:focus-within .field{margin:6px 0 0}
  html.kb .sheet .chform:focus-within .actions{position:sticky;bottom:0;z-index:2;display:flex;gap:6px;margin:6px 0 0;padding:6px 0 calc(6px + env(safe-area-inset-bottom));background:#fffdf8;box-shadow:0 -8px 8px -6px #fffdf8}
  html.kb .sheet .chform:focus-within .actions button{flex:1 1 auto;min-height:40px}
}
@media (max-width:899px),(max-height:520px){
  html.kbx .sheet .addline:focus-within{flex-wrap:nowrap;align-items:center;align-content:center;overflow-x:auto;overflow-y:hidden;padding:2px calc(6px + env(safe-area-inset-right)) 2px calc(6px + env(safe-area-inset-left))}
  html.kbx .sheet .addline:focus-within input[type=text]{flex:1 1 0;min-width:120px;min-height:0;height:38px;padding:2px 8px}
  html.kbx .sheet .addline:focus-within select,html.kbx .sheet .addline:focus-within input[type=date]{flex:0 0 auto;min-height:0;height:38px}
  html.kbx .sheet .addline:focus-within .ghost.small{flex:0 0 auto;position:static;min-width:76px;height:40px;min-height:40px;padding:0 14px}
  html.kbx .sheet .chform:focus-within{display:flex;flex-wrap:nowrap;align-items:center;gap:6px;overflow:hidden;padding:2px calc(6px + env(safe-area-inset-right)) 2px calc(6px + env(safe-area-inset-left))}
  html.kbx .sheet .chform:focus-within .lbl,html.kbx .sheet .chform:focus-within .tiny,html.kbx .sheet .chform:focus-within .shotrow,html.kbx .sheet .chform:focus-within .shotprev{display:none}
  html.kbx .sheet .chform:focus-within .field{margin:0;flex:0 0 1px;width:1px;height:1px;overflow:hidden;opacity:0;position:absolute}
  /* the field in focus is shown; when NO field has the focus (the button was just tapped, or a save was refused) the first field is shown, so the row never goes blank and the buttons never move under the finger */
  html.kbx .sheet .chform:focus-within .field:focus-within,html.kbx .sheet .chform:focus-within:not(:has(.field :is(input,select,textarea):focus)) > .field:first-child{position:static;flex:1 1 0;width:auto;height:auto;overflow:visible;opacity:1;min-width:0;display:flex;gap:6px;align-items:center}
  html.kbx .sheet .chform:focus-within .field:focus-within input,html.kbx .sheet .chform:focus-within:not(:has(.field :is(input,select,textarea):focus)) > .field:first-child input{height:38px;min-height:0;padding:2px 8px;flex:1 1 0;min-width:0}
  html.kbx .sheet .chform:focus-within .actions{position:static;margin:0 0 0 auto;padding:0;box-shadow:none;background:none;flex:0 0 auto;display:flex;gap:6px}
  html.kbx .sheet .chform:focus-within .actions button{min-height:40px;height:40px;padding:0 12px;font-size:13px;width:auto}
}

/* ---- Lot 5a: "Cycle tropical" ambience (local time of day) + progressive start + project name. Append-only. */
.projname{font:inherit;font-weight:600;color:inherit;background:none;border:0;padding:2px 0;text-align:left;cursor:pointer;min-height:24px;max-width:100%}
.projname:focus-visible{outline:2px solid var(--teal);outline-offset:2px;border-radius:6px}
/* lot 5b: scene light is defined at the END of this file (data-ambience). The 5a full-scene multiply overlay was removed: it also darkened the tags. */
.scene{border-radius:var(--radius);overflow:hidden}
.startcard .steps{list-style:none;margin:6px 0 0;padding:0;display:grid;gap:8px}
.steprow{display:flex;align-items:center;gap:12px;width:100%;min-height:52px;text-align:left;background:rgba(255,255,255,.6);border:1px solid var(--line);border-radius:14px;padding:8px 12px;font:inherit;color:inherit;cursor:pointer}
.steprow .tick{flex:0 0 28px;height:28px;border-radius:50%;display:grid;place-items:center;background:var(--teal);color:#fff;font-weight:700;font-size:14px}
.steprow.done .tick{background:var(--ok)}
.steprow small{display:block;color:var(--muted)}
.figs.two{grid-template-columns:1fr 1fr}

/* =================== Lot 5b — "Cycle tropical" light: morning · day · evening · night (data-ambience on #scene) ===================
   The tint is an SVG colour-matrix filter on the artwork group only (see scene.js TINT); lights are screen-blended sources tied to element stages.
   Tags, the light control and the hit zones are never tinted or covered. */
.scene{isolation:isolate;background:var(--sky,#bfe8f7);transition:background .9s;--sky:linear-gradient(#8fd3f5,#d6f1fb 70%,#f2fbff)}
.scene::before{content:"";position:absolute;inset:0;z-index:-1;pointer-events:none;background:var(--deco,none);opacity:var(--decoO,0);transition:opacity .9s}
.scene[data-ambience="morning"]{--sky:linear-gradient(#ffd9c4 0%,#ffc5d2 48%,#e2d0f4 100%);--deco:radial-gradient(circle at 22% 62%,rgba(255,236,190,.95),rgba(255,236,190,0) 34%);--decoO:1}
.scene[data-ambience="day"]{--sky:linear-gradient(#8fd3f5 0%,#cdeefb 62%,#f2fbff 100%);--deco:radial-gradient(circle at 82% 12%,rgba(255,255,255,.95),rgba(255,255,255,0) 22%);--decoO:1}
.scene[data-ambience="evening"]{--sky:linear-gradient(#ff9aa8 0%,#e873b5 46%,#8c5fd2 100%);--deco:radial-gradient(circle at 80% 58%,rgba(255,214,150,.9),rgba(255,214,150,0) 30%);--decoO:1}
.scene[data-ambience="night"]{--sky:linear-gradient(#171c63 0%,#2b2f8a 58%,#4a43a3 100%);
  --deco:radial-gradient(circle at 84% 14%,rgba(232,238,255,.95) 0 3.2%,rgba(190,205,255,.35) 4%,rgba(190,205,255,0) 16%),radial-gradient(1.4px 1.4px at 12% 18%,#fff,transparent),radial-gradient(1.4px 1.4px at 31% 9%,#fff,transparent),radial-gradient(1.6px 1.6px at 52% 22%,#fff,transparent),radial-gradient(1.2px 1.2px at 66% 7%,#fff,transparent),radial-gradient(1.4px 1.4px at 8% 41%,#fff,transparent),radial-gradient(1.2px 1.2px at 93% 38%,#fff,transparent),radial-gradient(1.4px 1.4px at 44% 5%,#fff,transparent);--decoO:1}
.scene .lights{mix-blend-mode:screen;pointer-events:none}
.scene .light{opacity:0;transition:opacity .9s;pointer-events:none}
.ambctl{position:absolute;top:8px;left:8px;z-index:5}
.ambbtn{width:44px;height:44px;border-radius:50%;display:grid;place-items:center;border:1.5px solid rgba(255,255,255,.9);background:rgba(36,28,62,.62);color:#fff;cursor:pointer;-webkit-backdrop-filter:blur(3px);backdrop-filter:blur(3px);box-shadow:0 2px 8px rgba(30,20,50,.3);padding:0}
.ambbtn:focus-visible,.ambopt:focus-visible{outline:3px solid #fff;outline-offset:1px;box-shadow:0 0 0 5px var(--teal-d)}
.ambpanel{position:absolute;top:50px;left:0;width:min(260px,calc(100vw - 32px));display:grid;gap:4px;padding:8px;border-radius:14px;background:rgba(255,255,255,.97);border:1px solid var(--line);box-shadow:0 8px 26px rgba(30,20,50,.28)}
.ambpanel[hidden]{display:none}
.ambopt{display:flex;align-items:center;gap:10px;min-height:44px;padding:6px 10px;border-radius:10px;border:1.5px solid transparent;background:transparent;color:var(--ink);font:inherit;text-align:left;cursor:pointer}
.ambopt small{display:block;color:var(--muted);font-size:11.5px}
.ambopt[aria-pressed="true"]{background:#e6f6f6;border-color:var(--teal)}
.ambpanel .tiny{margin:2px 4px 0}
html.kbx .ambctl{display:none}
@media (prefers-reduced-motion:reduce){.scene,.scene::before,.scene .light{transition:none}}

/* lot 5b.3: shadow layers (role shadow) fade with the ambience, like the tint */
.layer[data-role="shadow"] image{transition:opacity .7s ease}
@media (prefers-reduced-motion:reduce){.layer[data-role="shadow"] image{transition:none}}

/* lot 5b.4: narrow scenes group the idea suggestions behind one chip and show them on demand, away from the house and the pool */

.ideas-chip[hidden],.ideas-tray[hidden]{display:none}
.ideas-tray{position:absolute;left:8px;right:8px;bottom:40px;display:flex;flex-wrap:wrap;gap:3px;pointer-events:none}
.ideas-tray .tag{padding:2px 9px;font-size:12px;min-height:28px}
.ideas-tray .tag{position:static;transform:none!important;pointer-events:auto}
.ideas-tray .tag.hide{display:none}

/* lot 5b.4: grouped-ideas chip (same look as an idea tag, but NOT a .tag: scene-element queries keep counting only real tags) */
.ideas-chip.ideas-chip{position:absolute;left:0;top:0;pointer-events:auto;display:inline-flex;align-items:center;gap:5px;white-space:nowrap;min-height:32px;padding:6px 11px;border-radius:999px;font-size:12.5px;line-height:1;font-weight:600;letter-spacing:.01em;cursor:pointer;-webkit-tap-highlight-color:transparent;animation:tagIn .5s ease both;box-shadow:0 2px 8px rgba(40,30,10,.22)}
.ideas-chip{background:rgba(255,255,255,.62);color:#2c4b4d;border:1.5px dashed rgba(40,100,104,.8);box-shadow:0 1px 5px rgba(40,30,10,.14);-webkit-backdrop-filter:blur(2px);backdrop-filter:blur(2px)}
.ideas-chip::before{content:"+";font-weight:800;color:var(--teal-d);margin-right:1px}
.ideas-chip:focus-visible{outline:3px solid #fff;outline-offset:1px;box-shadow:0 0 0 5px var(--teal-d)}
.ideas-chip.ideas-chip{left:10px;top:auto;bottom:10px;transform:none!important;animation:none}

/* ---- Lot 6: finance screens (append-only). Forms reuse .chform / .field / .actions so the keyboard and 880x51 typing-mode rules apply unchanged. */
.money-line{margin-top:6px}.money-line b{font-variant-numeric:tabular-nums}
.over-note{color:var(--over)}
.sheet .chform select,.sheet .chform input[type=date]{width:100%;min-height:44px;margin-top:4px}
.sheet .chform .chips .chk{margin:2px 0}
.sheet .chform #f-prev img{max-width:100%;max-height:140px;border-radius:10px}

/* lot 7 — documents. Availability is shown by text first (colour only reinforces it). */
.field[hidden]{display:none !important}
.dbadge{display:inline-block;padding:3px 9px;border-radius:999px;font-size:12px;font-weight:600;border:1px solid var(--line);background:#fff;white-space:normal;text-align:center;line-height:1.25}
.dbadge.off{color:var(--ok);border-color:var(--ok)} .dbadge.net{color:#7a5a12;border-color:var(--amber);background:#fff8e6} .dbadge.miss{color:#8a4524;border-color:var(--over);background:#fdf0ea}
.docrow{gap:8px;align-items:center} .docrow > .dbadge{flex:0 0 auto;max-width:42%}
.chip2.on{background:var(--teal);color:#fff}
.btnlike{display:inline-flex;align-items:center;justify-content:center;padding:10px 14px;border-radius:12px;text-decoration:none;min-height:40px}
a.primary.btnlike{background:var(--teal);color:#fff;font-weight:600}
.doc-img img{max-width:100%;max-height:46vh;object-fit:contain;border-radius:10px}

/* B3.6: devices and access codes (minimal, no redesign) */
.bigcode{font:600 1.35rem/1.3 ui-monospace,Menlo,Consolas,monospace;letter-spacing:.08em;user-select:all;margin:.4rem 0}
.devrow{padding:.45rem 0;border-bottom:1px solid rgba(0,0,0,.08)}
.codebox{padding:.6rem .7rem;border:1px dashed currentColor;border-radius:8px;margin:.5rem 0}

/* =================== B3.9 — views by room, pointer and activity (append-only; the Android typing rules above are untouched) ===================
   Same engine, same data, three spaces. Phone shell (< 900 px) keeps the scene and the capture first; desk (>= 900 px) gets a generous scene with its
   panel beside it, and lists with their detail side by side when there is room (>= 1200 px). Banners sit IN the page and never cover the navigation. */

/* ---- banners: in the flow, under the header, height capped (they scroll), foldable to one line */
.bannerzone{position:relative;z-index:25;width:100%;max-width:1600px;margin:0 auto}
.bannerzone:empty{display:none}
.bannerzone .savebanner{position:static;margin:4px 12px;border-radius:12px;padding:8px 12px;text-align:left;max-height:38vh;overflow-y:auto;overscroll-behavior:contain;-webkit-overflow-scrolling:touch}
@supports (height:1dvh){.bannerzone .savebanner{max-height:38dvh}}
.bannerzone .savebanner[hidden]{display:none}
.bannerzone .savebanner.folded{padding:4px 12px;max-height:none}
.savebanner .bfold{float:right;margin-left:8px}
.savebanner .bline{font-weight:600}
@media (max-width:899px){
  .bannerzone{flex:none}
  .bannerzone .savebanner{margin:2px calc(8px + env(safe-area-inset-right)) 4px calc(8px + env(safe-area-inset-left));font-size:12.5px}
  html.kb .bannerzone{display:none}
}

/* ---- status pill: a real control (keyboard, mouse, finger) */
.conn{cursor:pointer;border-radius:8px}
.conn:focus-visible{outline:2px solid var(--teal);outline-offset:2px}

/* ---- the main area of a space: the scene, or the Site journal, with the Site bar above on a desk */
.sitebar{display:none}
.journal{min-width:0}
.jhead{display:flex;justify-content:space-between;align-items:flex-end;gap:8px;flex-wrap:wrap;margin:4px 0 10px}
.jtitle{margin:0;font-size:22px}
.jnav{display:flex;gap:6px;flex-wrap:wrap}
.jcard{padding:10px 12px;border-radius:14px;background:var(--card);border:1px solid var(--line);margin-bottom:8px;font-size:14px}
.jcard .actions{margin-top:8px}
.jlist{margin-bottom:6px}
.jgroup{padding:10px 0;border-top:1px solid var(--line)}
.jgroup h3{margin:0 0 6px;font-size:15px;display:flex;align-items:center;gap:8px;flex-wrap:wrap}
.jdetail h2{margin:0 0 4px}
.jrow[aria-current="true"],.seclist [aria-current="true"],.secidx[aria-current="page"]{background:#e6f6f6;box-shadow:inset 3px 0 0 var(--teal)}
.e-miss{display:grid;place-items:center;text-align:center;font-size:10.5px;line-height:1.15;color:var(--muted);background:#f1ece0;border:1px dashed rgba(80,60,30,.3);padding:4px}
@media (max-width:899px){
  .mainarea{display:contents}
  html.journal-on .side{display:none}
  .journal{flex:1 1 auto;min-height:0;overflow-y:auto;-webkit-overflow-scrolling:touch;overscroll-behavior:contain;padding:2px 2px 16px}
}
@media (min-width:900px){
  .top,.stage,.secview{max-width:1600px}
  .stage{grid-template-columns:minmax(0,1fr) clamp(360px,28vw,440px)}
  .mainarea{min-width:0;margin-top:8px}
  .side{position:sticky;top:10px;margin:2px -10px 0;max-height:calc(100vh - 86px);overflow-y:auto;overscroll-behavior:contain;padding:6px 10px 24px}
  @supports (height:1dvh){.side{max-height:calc(100dvh - 86px)}}
  .scene{max-height:calc(100vh - 128px)}
  @supports (height:1dvh){.scene{max-height:calc(100dvh - 128px)}}
  html.in-site .scene{max-height:calc(100vh - 172px)}
  @supports (height:1dvh){html.in-site .scene{max-height:calc(100dvh - 172px)}}
  .sitebar:not([hidden]){display:flex;align-items:center;gap:8px;flex-wrap:wrap;margin:0 0 8px}
  .sbseg{margin:0;flex:none}
  .sbseg button{flex:none;min-width:96px}
  .sbchip{font-weight:600;color:var(--teal-d)}
  .jbtn{display:none}
  .journal:not([hidden]){display:block;min-height:calc(100vh - 172px)}
  .fab{position:static;box-shadow:none;background:rgba(255,255,255,.7);color:var(--ink);border:1px solid var(--line);padding:6px 12px;font-size:13px;z-index:auto}
  .jentries .e-img{width:120px;height:90px}
}
@media (min-width:1200px){
  .jbody.two{display:grid;grid-template-columns:minmax(260px,340px) minmax(0,1fr);gap:16px;align-items:start}
  .jlistcol{position:sticky;top:10px;max-height:calc(100vh - 160px);overflow-y:auto;overscroll-behavior:contain;padding-right:2px}
  .jdetail{background:var(--card);border:1px solid var(--line);border-radius:var(--radius);box-shadow:var(--shadow);padding:16px 18px;min-height:320px;min-width:0}
  .jentries .e-img{width:160px;height:120px}
}

/* ---- Secretariat: categories beside the page on a desk; list beside detail when wide */
@media (min-width:900px){
  .secgrid{display:grid;grid-template-columns:220px minmax(0,1fr);gap:20px;align-items:start}
  .secindex{position:sticky;top:10px;display:flex;flex-direction:column;gap:4px}
  .secidx{display:flex;justify-content:space-between;align-items:center;gap:8px;padding:9px 12px;border-radius:12px;text-align:left;min-height:42px}
  .secidx b{color:var(--teal-d);font-variant-numeric:tabular-nums}
  .secindex .ghost{margin-top:10px;align-self:flex-start}
  .secmain{min-width:0}
}
@media (min-width:1200px){
  .secsplit{display:grid;grid-template-columns:minmax(300px,420px) minmax(0,1fr);gap:20px;align-items:start}
  .seclist{position:sticky;top:10px;max-height:calc(100vh - 120px);overflow-y:auto;overscroll-behavior:contain;padding-right:4px}
  .secdetail{background:var(--card);border:1px solid var(--line);border-radius:var(--radius);box-shadow:var(--shadow);padding:16px 20px;min-width:0}
}

/* ---- documents: a reading space only for a file that is really here */
.doc-pdf{display:none;margin:10px 0}
.doc-pdf.open{display:block}
.doc-frame{display:block;width:100%;height:70vh;border:1px solid var(--line);border-radius:12px;background:#fff}
@supports (height:1dvh){.doc-frame{height:70dvh}}
@media (min-width:900px){
  .doc-pdf{display:block}
  .doc-readhere{display:none}
  .doc-frame{height:calc(100vh - 280px);min-height:420px}
  .doc-img img{max-height:calc(100vh - 300px)}
}

/* ---- pointer and keyboard: finger-sized targets on touch screens whatever the width; hover only where there is a mouse */
@media (pointer:coarse){
  .ghost.small,.tiny-btn,.chip,.secidx,.rowbtn,.chk{min-height:44px}
  .linkbtn{min-height:40px}
}
@media (hover:hover) and (pointer:fine){
  .rowbtn:not(.plain):hover,.secidx:hover,.cat:hover{background:#f4fafa}
}
.rowbtn:focus-visible,.secidx:focus-visible,.cat:focus-visible,.jrow:focus-visible{outline:2px solid var(--teal);outline-offset:-2px}
h2[tabindex="-1"]:focus{outline:none}
a.ghost.btnlike{color:inherit}
/* B3.9: field shortcuts on the kicker line of the Site panel: finger-sized targets that take no extra height */
.panelhead{display:flex;flex-wrap:wrap;align-items:center;justify-content:space-between;gap:0 8px;margin-bottom:6px}
.panelhead .kicker{margin:0}
.qlinks{display:flex;gap:2px;margin:-13px -8px -13px auto}
.qlinks .linkbtn{min-height:44px;padding:0 8px;font-size:13px;font-weight:600;color:var(--teal-d);text-decoration:none}
.qlinks .linkbtn:hover{text-decoration:underline}
@media (min-width:900px){.qlinks .jbtn{display:none}}
/* B3.9: when a banner takes room on a phone, the docked panel SHRINKS and keeps scrolling (its last command stays reachable) instead of being cut */
@media (max-width:899px){
  .side{flex:0 1 auto;min-height:0;display:flex;flex-direction:column}
  .side > #projectPanel,.side > .tabcard{flex:0 1 auto;min-height:0}
  .bannerzone .savebanner{max-height:30vh}
  @supports (height:1dvh){.bannerzone .savebanner{max-height:30dvh}}
}
/* B3.10: new-version notice (same banner zone; calm colour: it is information, not an error) */
.bannerzone .savebanner.updbanner{background:#1f5f60}
