:root{
  font-family:Inter,system-ui,-apple-system,BlinkMacSystemFont,"Segoe UI",sans-serif;
  color:#1f241f;background:#f5f3ee;
  --red:#971f26;--red-dark:#7f171e;--green:#2f603d;--ink:#1f241f;--muted:#6d726d;
  --line:#ddd8cf;--card:#fff;--soft:#f0ede7;--green-soft:#edf3ee;
}
*{box-sizing:border-box}
html{background:#f5f3ee}
body{margin:0;min-height:100vh;background:linear-gradient(180deg,#f7f5f1 0,#f1eee8 100%)}
button,input,select,textarea{font:inherit}
button{-webkit-tap-highlight-color:transparent}
.shell{max-width:720px;margin:0 auto;min-height:100vh;padding:env(safe-area-inset-top) 16px calc(92px + env(safe-area-inset-bottom))}
.topbar{position:sticky;top:0;z-index:5;margin:0 -16px 18px;padding:12px 16px;background:rgba(247,245,241,.94);backdrop-filter:blur(12px);border-bottom:1px solid var(--line);display:flex;align-items:center;gap:11px}
.brandmark{width:40px;height:40px;border-radius:50%;display:grid;place-items:center;background:var(--red);color:#fff;font-weight:900;font-size:14px;box-shadow:0 4px 10px rgba(151,31,38,.18)}
.brandcopy{min-width:0}.topbar h1{font-size:17px;line-height:1.1;margin:0}.topbar p{font-size:11px;margin:3px 0 0;color:var(--muted)}
.card{background:var(--card);border:1px solid var(--line);border-radius:18px;padding:17px;box-shadow:0 8px 22px rgba(45,42,35,.055);margin-bottom:14px}
.actionHero{background:linear-gradient(135deg,var(--red),var(--red-dark));color:#fff;border-radius:20px;padding:20px;margin-bottom:20px;box-shadow:0 12px 28px rgba(122,24,31,.16)}
.actionHero .eyebrow{display:inline-block;text-transform:uppercase;letter-spacing:.08em;font-size:10px;font-weight:800;opacity:.74;margin-bottom:6px}
.actionHero h2{font-size:24px;line-height:1.1;margin:0 0 7px}.actionHero p{margin:0;color:#f8e9ea;font-size:14px;line-height:1.45}
.cameraButton{width:100%;margin-top:17px;border:0;border-radius:14px;padding:14px 16px;background:#fff;color:var(--red-dark);font-weight:900;display:flex;align-items:center;justify-content:center;gap:9px;cursor:pointer;box-shadow:0 4px 12px rgba(0,0,0,.08)}
.cameraIcon{font-size:19px}
.sectionBlock{margin-bottom:20px}.sectionHeader{display:flex;align-items:center;justify-content:space-between;gap:12px;margin:0 2px 10px}.sectionHeader h3{font-size:16px;margin:0}.textButton{border:0;background:transparent;color:var(--red);font-size:12px;font-weight:800;padding:5px;cursor:pointer}
.cropGrid{display:grid;grid-template-columns:repeat(5,minmax(0,1fr));gap:8px}.cropQuick{min-height:72px;border:1px solid var(--line);background:#fff;border-radius:15px;padding:10px 6px;display:flex;flex-direction:column;align-items:center;justify-content:center;gap:5px;font-size:11px;font-weight:800;cursor:pointer;box-shadow:0 5px 14px rgba(45,42,35,.035)}.cropQuick:active{transform:scale(.98)}.cropIcon{font-size:22px}.recentSection{margin-bottom:0}.compactCard{padding:4px 15px}.compactEmpty{padding:25px 10px!important}
.field{margin-bottom:14px}.field:last-child{margin-bottom:0}.field label{display:block;font-weight:800;font-size:12px;margin-bottom:6px}.req{color:var(--red)}
.field input,.field select,.field textarea{width:100%;padding:12px 13px;border:1px solid #ccc6bc;border-radius:12px;background:#fff;color:var(--ink);outline:none}.field input:focus,.field select:focus,.field textarea:focus{border-color:#9d8b7e;box-shadow:0 0 0 3px rgba(151,31,38,.07)}
.twoCols{display:grid;grid-template-columns:1fr 1fr;gap:12px}.primary,.secondary,.danger{border:0;border-radius:13px;padding:13px 16px;font-weight:900;cursor:pointer;width:100%}.primary{background:var(--red);color:#fff;box-shadow:0 7px 16px rgba(151,31,38,.14)}.primary:disabled{opacity:.45;box-shadow:none;cursor:not-allowed}.secondary{background:var(--green-soft);color:var(--green)}.danger{background:#f7e6e7;color:#7d2024}
.bottomnav{position:fixed;left:50%;transform:translateX(-50%);bottom:0;width:min(720px,100%);display:grid;grid-template-columns:repeat(3,1fr);background:rgba(255,255,255,.97);backdrop-filter:blur(10px);border-top:1px solid var(--line);padding:6px 8px calc(7px + env(safe-area-inset-bottom));z-index:8}.bottomnav button{border:0;background:transparent;padding:7px 4px 5px;font-size:11px;color:var(--muted);display:flex;flex-direction:column;align-items:center;gap:1px}.bottomnav button.active{color:var(--red);font-weight:900}.navicon{font-size:20px;line-height:1}
.pageHeading{display:flex;align-items:center;gap:10px;margin:2px 0 14px}.pageHeading h2{font-size:21px;margin:0 0 3px}.pageHeading p{font-size:12px;color:var(--muted);margin:0}.backButton{width:36px;height:36px;border-radius:50%;border:1px solid var(--line);background:#fff;font-size:27px;line-height:1;color:var(--ink);padding:0 0 3px;cursor:pointer}.formCard{padding-bottom:4px}
.photoCard{padding:15px}.photoHeader{display:flex;align-items:center;justify-content:space-between;gap:10px;margin-bottom:12px}.photoHeader strong{font-size:14px}.photoHeader p{font-size:11px;color:var(--muted);margin:2px 0 0}.addPhoto{border:1px solid #c8d5ca;background:var(--green-soft);color:var(--green);padding:8px 10px;border-radius:10px;font-size:12px;font-weight:900;cursor:pointer}.addPhoto.disabled{opacity:.45;pointer-events:none}
.emptyPhoto{min-height:180px;border:2px dashed #c9c2b8;border-radius:15px;background:#fbfaf8;display:flex;flex-direction:column;align-items:center;justify-content:center;text-align:center;padding:20px;cursor:pointer}.emptyPhoto strong{font-size:14px}.emptyPhoto small{color:var(--muted);font-size:11px;margin-top:5px;max-width:280px;line-height:1.4}.bigCamera{font-size:35px;margin-bottom:7px}.photoGrid{display:grid;grid-template-columns:repeat(2,1fr);gap:9px}.photoTile{position:relative;aspect-ratio:4/3;border-radius:13px;overflow:hidden;background:var(--soft);border:1px solid var(--line)}.photoTile img{width:100%;height:100%;object-fit:cover;display:block}.photoTile>span{position:absolute;left:7px;bottom:7px;width:23px;height:23px;border-radius:50%;display:grid;place-items:center;background:rgba(0,0,0,.62);color:#fff;font-size:11px;font-weight:900}.removePhoto{position:absolute;right:6px;top:6px;width:28px;height:28px;border:0;border-radius:50%;background:rgba(0,0,0,.67);color:#fff;font-size:20px;line-height:1;cursor:pointer}.photoTips{display:flex;gap:6px;flex-wrap:wrap;margin-top:10px}.photoTips span{font-size:10px;color:var(--muted);background:#f4f1eb;border-radius:999px;padding:5px 8px}.analyzePrimary{margin:2px 0 15px;padding:15px;font-size:15px}
.resultSection{scroll-margin-top:75px;margin-top:8px}.resultHeader{margin:15px 2px 10px}.resultHeader h3{font-size:20px;margin:7px 0 2px}.resultHeader p{font-size:12px;color:var(--muted);margin:0}.result{padding:4px 16px;border-left:4px solid var(--green)}.prob{display:grid;grid-template-columns:28px 1fr auto;align-items:flex-start;gap:10px;padding:14px 0;border-bottom:1px solid var(--line)}.prob:last-child{border-bottom:0}.probRank{width:26px;height:26px;border-radius:50%;display:grid;place-items:center;background:var(--green-soft);color:var(--green);font-size:11px;font-weight:900}.probText strong{display:block;font-size:14px;margin-bottom:4px}.probPct{font-size:14px;color:var(--green)}.pill{display:inline-block;padding:5px 9px;border-radius:999px;background:var(--green-soft);color:var(--green);font-size:10px;font-weight:900}.checksCard h4{margin:0 0 8px}.checksCard ul{margin:0 0 14px;padding-left:20px}.checksCard li{font-size:13px;margin:7px 0;line-height:1.4}.disclaimer{font-size:10px;color:var(--muted);text-align:center;line-height:1.4;padding:0 8px 12px}
.case{display:flex;gap:11px;align-items:center;padding:11px 0;border-bottom:1px solid var(--line)}.case:last-child{border-bottom:0}.thumb{width:52px;height:52px;border-radius:11px;object-fit:cover;background:var(--soft);display:grid;place-items:center}.thumb.placeholder{font-size:20px}.caseMeta{flex:1;min-width:0}.caseMeta strong{display:block;font-size:13px;white-space:nowrap;overflow:hidden;text-overflow:ellipsis}.caseMeta small{display:block;color:var(--muted);font-size:10px;margin-top:3px}.validatedText{color:var(--green);font-weight:800}.pendingText{color:#9a6b2d;font-weight:800}.chevron{font-size:24px;color:#aaa39a}.historyCard{padding:2px 15px}.historyItem{border-bottom:1px solid var(--line)}.historyItem:last-child{border-bottom:0}.historyItem .case{border:0}.historyActions{padding:0 0 11px 63px}.historyActions .secondary{width:auto;padding:8px 11px}
.login{min-height:100vh;display:grid;place-items:center;padding:20px}.login .card{width:min(420px,100%)}.loginCard h2{text-align:center;margin-bottom:4px}.logoLarge{width:70px;height:70px;border-radius:50%;display:grid;place-items:center;background:var(--red);color:white;font-weight:900;font-size:23px;margin:0 auto 15px}.centered{text-align:center}.hint{font-size:11px;color:var(--muted);line-height:1.45}.status{padding:11px 12px;border-radius:11px;font-size:12px;margin-bottom:12px}.status.info{background:#eef3f5}.status.error{background:#fbe8e8;color:#7d2024}.status.ok{background:#e7f1e9;color:#285536}.analyzing{text-align:center;font-weight:800}.toolbar{display:flex;gap:8px}.toolbar button{width:auto;flex:1}.small{font-size:11px}.empty{text-align:center;color:var(--muted);padding:30px 10px;display:flex;flex-direction:column;gap:4px}.empty strong{color:#555a55;font-size:13px}.empty span{font-size:11px}.installNote{font-size:11px;color:var(--muted);margin-top:10px;text-align:center}.srOnly{position:absolute;width:1px;height:1px;padding:0;margin:-1px;overflow:hidden;clip:rect(0,0,0,0);white-space:nowrap;border:0}
@media(max-width:560px){.cropGrid{grid-template-columns:repeat(3,1fr)}.twoCols{grid-template-columns:1fr}.shell{padding-left:12px;padding-right:12px}.topbar{margin-left:-12px;margin-right:-12px}.actionHero{padding:18px}.actionHero h2{font-size:22px}}
@media(min-width:561px){.photoGrid{grid-template-columns:repeat(4,1fr)}}

/* v3 */
.brandLogo{width:72px;height:48px;object-fit:contain;object-position:left center;flex:0 0 auto}.logoLogin{display:block;width:190px;max-width:70%;height:auto;object-fit:contain;margin:0 auto 14px}.caseButton{width:100%;border:0;background:transparent;text-align:left;cursor:pointer;color:inherit}.caseButton:hover{background:#faf8f4}.hypothesisRole{display:block;font-size:9px;line-height:1.2;text-transform:uppercase;letter-spacing:.05em;color:var(--green);font-weight:900;margin-bottom:2px}.hidden{display:none!important}.caseDetailCard{padding:14px}.caseHeroImage{width:100%;max-height:330px;object-fit:cover;border-radius:14px;display:block}.detailPhotoStrip{display:flex;gap:7px;overflow:auto;margin-top:8px;padding-bottom:2px}.detailPhotoStrip img{width:74px;height:62px;object-fit:cover;border-radius:9px;border:1px solid var(--line)}.detailFacts{display:grid;grid-template-columns:repeat(3,1fr);gap:8px;margin-top:12px}.detailFacts>div{background:var(--soft);border-radius:10px;padding:9px}.detailFacts span,.detailNotes span{display:block;font-size:9px;color:var(--muted);text-transform:uppercase;letter-spacing:.04em;font-weight:800}.detailFacts strong{display:block;font-size:12px;margin-top:3px}.detailNotes{margin-top:12px}.detailNotes p{font-size:12px;line-height:1.45;margin:4px 0 0}.validationCard,.validationSummary{margin-top:14px}.validationCard h3,.validationSummary h3{margin:0 0 6px}.validationSummary p{font-size:12px;color:var(--muted);line-height:1.45}.validatedBadge{display:inline-block;background:var(--green-soft);color:var(--green);border-radius:999px;padding:5px 8px;font-size:10px;font-weight:900;margin-bottom:8px}.detailResult{margin-top:14px}.validationCard .primary{margin-top:2px}.validationSummary .secondary{margin-top:8px}
@media(max-width:560px){.brandLogo{width:58px;height:42px}.detailFacts{grid-template-columns:1fr 1fr}.caseHeroImage{max-height:260px}}


/* v4 — PIN partilhado + backend real */
.logoutMini{
  margin-left:auto;border:1px solid rgba(255,255,255,.45);background:rgba(255,255,255,.12);
  color:#fff;border-radius:10px;padding:7px 10px;font-size:12px;font-weight:700;cursor:pointer;
}
.headerActions{display:flex;gap:8px;align-items:center}
.pendingCard{margin-top:16px;text-align:left}
.pendingBadge{
  display:inline-flex;background:#fff3d8;color:#785200;border-radius:999px;padding:6px 10px;
  font-weight:800;font-size:12px;margin-bottom:8px;
}
.detailPhotos{display:grid;grid-template-columns:repeat(3,1fr);gap:8px;margin-bottom:14px}
.detailPhotos img{width:100%;aspect-ratio:1/1;object-fit:cover;border-radius:12px;border:1px solid #e1ddd7}
.caseInfo{display:grid;grid-template-columns:1fr 1fr;gap:14px;margin-bottom:14px}
.caseInfo div{display:flex;flex-direction:column;gap:4px}
.caseInfo span{font-size:12px;color:#777}
.caseInfo .full{grid-column:1/-1}
@media(max-width:600px){
  .logoutMini{padding:6px 8px}
  .detailPhotos{grid-template-columns:repeat(2,1fr)}
  .caseInfo{grid-template-columns:1fr}
}

.photoActions{display:flex;gap:10px;flex-wrap:wrap;margin:12px 0}
.photoActions .addPhoto{display:inline-flex;align-items:center;justify-content:center;min-height:44px}
.photoActions .secondaryPhoto{background:#fff;color:#8d1f24;border:1px solid #8d1f24}
.staticEmptyPhoto{cursor:default}
@media(max-width:520px){
  .photoActions{display:grid;grid-template-columns:1fr 1fr}
  .photoActions .addPhoto{width:100%;padding:10px 8px;text-align:center}
}
