:root{font-family:system-ui,-apple-system,BlinkMacSystemFont,"Segoe UI",sans-serif;color:#eee;background:#0b0b0b}
*{box-sizing:border-box} body{margin:0;background:#0b0b0b} header{height:58px;display:flex;align-items:center;justify-content:space-between;padding:0 16px;border-bottom:1px solid #292929;position:sticky;top:0;background:#0b0b0bf2;z-index:4}
.brand{font-weight:800;letter-spacing:.05em} main{max-width:900px;margin:0 auto;padding:16px}.panel{background:#151515;border:1px solid #292929;border-radius:16px;padding:18px;margin-bottom:16px}.narrow{max-width:430px;margin:50px auto}.hidden{display:none!important}
h1{margin:.2em 0 .5em;font-size:1.7rem}h2{font-size:1.1rem;margin:0 0 12px}.muted{color:#aaa}.eyebrow{font-size:.78rem;color:#888;text-transform:uppercase}
label{display:block;margin:14px 0;color:#bbb;font-size:.9rem}input,select,button{font:inherit}input,select{width:100%;background:#0e0e0e;color:#fff;border:1px solid #3a3a3a;border-radius:10px;padding:13px;margin-top:6px}
button{border:0;border-radius:10px;padding:11px 14px;background:#303030;color:#fff;font-weight:700}.primary{background:#d01616}.ghost{background:#222}.big{padding:14px 18px}.full{width:100%;margin-top:18px}.msg{margin-top:12px;color:#f0b4b4}
.hero{display:flex;gap:18px;align-items:center;justify-content:space-between;flex-wrap:wrap}.searchrow{display:grid;grid-template-columns:1fr auto;gap:8px}.searchrow input{margin:0}.results{display:grid;gap:8px;margin-top:12px}.result{padding:12px;background:#0d0d0d;border:1px solid #2b2b2b;border-radius:10px}.result b{display:block}.small{font-size:.85rem;color:#aaa}
.summary{display:flex;gap:10px;flex-wrap:wrap}.pill{padding:10px 12px;background:#0d0d0d;border:1px solid #2b2b2b;border-radius:10px}
.photoGrid{display:grid;grid-template-columns:repeat(2,1fr);gap:12px}.photoCard{background:#0d0d0d;border:1px solid #2b2b2b;border-radius:14px;padding:10px;display:grid;gap:9px}.slot{aspect-ratio:1;background:#202020;border-radius:10px;display:flex;align-items:center;justify-content:center;font-size:3rem;color:#555;background-position:center;background-size:cover}.cameraBtn{width:100%}
.modal{position:fixed;inset:0;background:#000e;z-index:20;display:flex;align-items:center;justify-content:center;padding:10px}.cameraBox{width:min(620px,100%);background:#111;border-radius:14px;padding:12px}.cameraTop{display:flex;justify-content:space-between;align-items:center;margin-bottom:8px}.finder{position:relative;aspect-ratio:1;background:#000;overflow:hidden;border-radius:12px}.finder video{width:100%;height:100%;object-fit:cover}.squareGuide{position:absolute;inset:6%;border:3px solid #fff9;border-radius:8px;pointer-events:none}.fallback{font-size:.8rem}.fallback input{font-size:.8rem}.analysis pre{white-space:pre-wrap;background:#0d0d0d;padding:12px;border-radius:10px;max-height:280px;overflow:auto}
@media(max-width:560px){main{padding:10px}.panel{border-radius:12px;padding:14px}.photoGrid{gap:8px}.photoCard{padding:8px}.brand{font-size:.86rem}.hero .primary{width:100%}}

.danger{background:#5f1818}
.previewImg{width:100%;aspect-ratio:1;object-fit:cover;background:#000;border-radius:12px}
.previewActions{display:grid;grid-template-columns:1fr 1fr;gap:10px;margin-top:12px}

/* 0.1.2 - ergonomía móvil de la cámara */
.cameraBox{max-height:calc(100dvh - 20px);overflow:auto;padding-bottom:18px}
.cameraBox.previewMode #finder{display:none}
.cameraBox.previewMode #shootBtn{display:none!important}
.cameraBox.previewMode #fallbackLabel{display:none!important}
.cameraBox.previewMode .previewActions{
  position:sticky;
  top:0;
  z-index:35;
  background:#111;
  padding:8px 0 10px;
  margin:0 0 10px;
}
.previewActions button{min-height:52px;font-size:1rem}
#usePhotoBtn{font-size:1.08rem}
@media(max-width:560px){
  .modal{padding:0;align-items:stretch}
  .cameraBox{
    width:100%;
    min-height:100dvh;
    max-height:100dvh;
    border-radius:0;
    padding:10px 10px calc(18px + env(safe-area-inset-bottom));
  }
  .cameraTop{
    position:sticky;
    top:0;
    z-index:40;
    background:#111;
    padding:4px 0 8px;
  }
  .finder{max-height:calc(100dvh - 170px)}
  .previewImg{
    width:100%;
    max-height:calc(100dvh - 165px);
    object-fit:contain;
    background:#000;
  }
  .cameraBox.previewMode .previewActions{
    top:48px;
  }
}

/* 0.1.3 - borradores y encuadre cuadrado coherente */
.draftBanner{border-color:#7a5b16}
.draftActions{display:flex;gap:10px;flex-wrap:wrap}
.captureHeaderActions{display:flex;justify-content:space-between;gap:10px;align-items:center}
.squareGuide{inset:0;border:3px solid #fff9;border-radius:12px}
.cameraBox.previewMode .previewImg{display:block!important}
@media(max-width:560px){
  .captureHeaderActions{align-items:stretch}
  .captureHeaderActions button{font-size:.84rem;padding:10px}
}

/* 0.1.4 - salida OCR limpia */
.ocrUseful{display:grid;gap:7px;margin-bottom:12px}
.ocrLine{background:#0d0d0d;border:1px solid #2b2b2b;border-radius:9px;padding:9px 11px}
.ocrLine .side{display:inline-block;min-width:58px;color:#999;font-size:.78rem;font-weight:700}
.ocrMeta{font-size:.84rem;color:#999;margin:8px 0 14px}
.ocrDetails{margin:12px 0 18px;border-top:1px solid #2a2a2a;padding-top:10px}
.ocrDetails summary{cursor:pointer;color:#aaa;font-size:.9rem}
