/* Atlas showroom: big screen + mobile capture */
.screen-body{margin:0;height:100vh;min-height:100vh;background:#080b12;color:#f4f7ff;font-family:var(--font);display:grid;grid-template-rows:auto minmax(0,1fr) auto;overflow:hidden}
.screen-head{display:flex;align-items:center;justify-content:space-between;gap:24px;padding:26px 40px;border-bottom:1px solid rgba(255,255,255,.08)}
.screen-brand{display:flex;align-items:center;gap:14px;font-size:18px;letter-spacing:.02em}
.screen-brand img{height:34px;width:auto;filter:brightness(0) invert(1)}
.screen-brand i{width:1px;height:22px;background:rgba(255,255,255,.2)}
.screen-brand strong{font-weight:500;color:rgba(255,255,255,.78)}
.screen-status{display:flex;align-items:center;gap:14px;font-size:14px;color:rgba(255,255,255,.65)}
.dot{width:8px;height:8px;border-radius:50%;background:#d07a3a;display:inline-block}
.dot.ok{background:#4fd1a1}
.pill.dark{background:rgba(255,255,255,.08);color:rgba(255,255,255,.75)}
.screen-btn{border:1px solid rgba(255,255,255,.18);background:transparent;color:rgba(255,255,255,.8);border-radius:10px;padding:8px 14px;font-size:13px;cursor:pointer}
.screen-btn:hover{border-color:rgba(255,255,255,.45)}
.screen-stage{position:relative;min-width:0;width:100%;min-height:0;height:100%;display:grid;grid-template-columns:minmax(0,1fr);grid-template-rows:minmax(0,1fr);place-items:center;padding:24px 40px;overflow:hidden}
.standby{width:min(1280px,92vw);max-height:100%;display:grid;grid-template-columns:1.4fr .8fr;gap:60px;align-items:center;overflow:auto}
.screen-eyebrow{font-size:12px;letter-spacing:.28em;color:rgba(255,255,255,.42);margin:0 0 18px}
.standby h1{font-size:clamp(42px,5.4vw,84px);line-height:1.08;letter-spacing:-.03em;font-weight:500;margin:0 0 26px}
.screen-muted{color:rgba(255,255,255,.55);font-size:16px;line-height:1.8;margin:0}
.small{font-size:13px}
.pair-box{background:#fff;color:#101827;border-radius:22px;padding:26px;text-align:center;box-shadow:0 30px 80px rgba(0,0,0,.35)}
.pair-box p{margin:12px 0 0;font-size:15px}
.pair-box p.small{font-size:12px;color:#5c6880;line-height:1.6}
.qr{width:min(280px,26vw);margin:0 auto}
.qr svg{width:100%;height:auto;display:block}
.pair-code{font-size:12px!important;color:#8a94a8!important;word-break:break-all}
.display{position:relative;width:100%;height:100%;min-width:0;max-width:100%;max-height:100%;min-width:0;min-height:0;display:grid;place-items:center;overflow:hidden}
.display img{position:absolute;inset:0;display:block;width:100%;height:100%;max-width:none;max-height:none;object-fit:contain;object-position:center;border-radius:6px;box-shadow:0 30px 90px rgba(0,0,0,.5);opacity:1;transition:opacity .45s ease}
.display img.fade{animation:fadein .45s ease}
@keyframes fadein{from{opacity:.25}to{opacity:1}}
.display-hint{position:absolute;left:50%;bottom:6px;z-index:2;transform:translateX(-50%);font-size:13px;color:rgba(255,255,255,.5);white-space:nowrap}
.screen-foot{display:flex;justify-content:space-between;gap:20px;padding:14px 40px;border-top:1px solid rgba(255,255,255,.06);color:rgba(255,255,255,.35);font-size:12px}

/* Mobile capture */
.mobile-body{background:var(--paper);color:var(--ink);min-height:100vh}
.mobile-login{max-width:460px;margin:0 auto;padding:48px 24px}
.mobile-logo{height:34px;width:auto;display:block;margin-bottom:36px}
.mobile-login h1{font-size:28px;margin:0 0 8px}
.mobile-login form{display:grid;gap:14px;margin-top:26px}
.mobile-login label{display:grid;gap:6px;font-size:14px;color:var(--muted)}
.mobile-login input{border:1px solid var(--line);border-radius:12px;padding:12px;font-size:16px;background:#fff}
.mobile-head{display:flex;align-items:center;justify-content:space-between;gap:12px;padding:16px 18px;background:#fff;border-bottom:1px solid var(--line);position:sticky;top:0;z-index:5}
.mobile-brand{display:flex;align-items:center;gap:8px;color:var(--ink);font-weight:600}
.mobile-brand img{height:26px;width:auto}
.mobile-brand span{color:var(--muted);font-weight:500}
.capture{max-width:620px;margin:0 auto;padding:20px 18px 48px;display:grid;gap:18px}
.card{background:#fff;border:1px solid var(--line);border-radius:18px;padding:20px}
.capture-title h1{font-size:26px;margin:2px 0 6px}
.eyebrow{font-size:11px;letter-spacing:.2em;color:var(--muted);margin:0}
.capture-actions{display:grid;grid-template-columns:1fr 1fr;gap:12px}
.capture-actions .btn{padding:16px}
.capture-step{font-size:15px;margin:6px 0 0;color:var(--muted);font-weight:500}
.chips{display:flex;gap:10px;flex-wrap:wrap}
.chip{border:1px solid var(--line);background:#fff;border-radius:999px;padding:9px 16px;font-size:14px;color:var(--ink);cursor:pointer}
.chip.on{border-color:var(--blue);background:var(--ice);color:var(--blue);font-weight:600}
.preview-wrap{position:relative;border-radius:16px;overflow:hidden;background:#0d1320}
.preview-wrap img{width:100%;display:block;max-height:52vh;object-fit:contain;background:#0d1320}
.preview-wrap .btn{position:absolute;right:10px;top:10px;background:rgba(255,255,255,.92)}
.capture-status{min-height:24px;margin:4px 0 0;font-size:14px;color:var(--muted)}
.capture-status.bad{color:var(--error)}
.result-card{background:#fff;border:1px solid var(--line);border-radius:16px;overflow:hidden}
.result-card img{width:100%;display:block}
.result-actions{display:flex;gap:10px;padding:12px}
.control-panel{display:grid;gap:12px}
.control-row{display:flex;align-items:flex-start;justify-content:space-between;gap:12px}
.control-row p{margin:4px 0 0}
.control-actions{display:flex;gap:10px;flex-wrap:wrap}
.code-form{display:flex;gap:10px;align-items:flex-end;margin-top:16px}
.code-form label{flex:1;display:grid;gap:6px;font-size:14px;color:var(--muted)}
.code-form input{border:1px solid var(--line);border-radius:12px;padding:12px;font-size:16px}
@media (max-width:760px){
  .screen-head{padding:16px 18px;flex-wrap:wrap}
  .screen-brand img{height:26px}
  .screen-status #conn-text{display:none}
  .screen-brand span{font-size:16px}
  .screen-status{gap:8px}
  .screen-stage{padding:18px}
  .standby{grid-template-columns:1fr;gap:26px;text-align:left}
  .standby h1{font-size:40px}
  .qr{width:min(240px,58vw)}
  .display img{max-height:100%}
  .screen-foot{display:none}
}

.pair-corner{position:fixed;right:28px;bottom:64px;z-index:20;background:#fff;color:#101827;border-radius:16px;padding:12px;text-align:center;box-shadow:0 20px 50px rgba(0,0,0,.4)}
.pair-corner .qr{width:160px}
.pair-corner span{display:block;margin-top:6px;font-size:12px;color:#5c6880}
/* Recognition summary and manual correction */
.recognition{display:flex;align-items:center;justify-content:space-between;gap:12px;background:var(--ice);border:1px solid #d6e2ff;border-radius:14px;padding:12px 14px}
.recognition-summary{margin:0;font-size:15px;line-height:1.5;color:var(--ink)}
.editor{display:grid;gap:10px;background:#fff;border:1px solid var(--line);border-radius:14px;padding:14px}
.editor label{display:grid;gap:6px;font-size:14px;color:var(--muted)}
.editor select{border:1px solid var(--line);border-radius:10px;padding:11px;font-size:15px;background:#fff;color:var(--ink)}
.editor p{margin:0}
.screen-body .pill{display:inline-block;padding:5px 12px;border-radius:999px;background:rgba(255,255,255,.08);color:rgba(255,255,255,.75);font-size:13px;font-weight:500;white-space:nowrap}
/* Product archive */
.products-panel{display:grid;gap:12px}
.products-head{display:flex;align-items:flex-start;justify-content:space-between;gap:12px}
.products-head h2{font-size:18px;margin:0 0 4px}
.products-head p{margin:0}
.product-grid{display:grid;grid-template-columns:repeat(auto-fill,minmax(120px,1fr));gap:10px}
.product-card{display:grid;gap:5px;text-align:left;background:#fff;border:1px solid var(--line);border-radius:12px;padding:6px;cursor:pointer}
.product-card img{width:100%;aspect-ratio:1;object-fit:cover;border-radius:8px;background:var(--paper)}
.product-card-title{font-size:13px;line-height:1.35;color:var(--ink);display:-webkit-box;-webkit-line-clamp:2;-webkit-box-orient:vertical;overflow:hidden}
.product-card-meta{font-size:11px;color:var(--muted)}
.product-modal{position:fixed;inset:0;z-index:50;background:rgba(10,15,24,.55);display:grid;place-items:center;padding:18px}
.product-sheet{position:relative;width:min(680px,100%);max-height:92vh;overflow:auto;background:#fff;border-radius:18px;padding:22px}
.product-close{position:absolute;right:12px;top:10px;border:0;background:none;font-size:26px;line-height:1;color:var(--muted);cursor:pointer}
.product-sheet h2{font-size:20px;margin:0 40px 4px 0}
.product-images{display:grid;grid-template-columns:1fr 1fr;gap:10px;margin:14px 0}
.product-images figure{margin:0;display:grid;gap:6px}
.product-images img{width:100%;aspect-ratio:1;object-fit:contain;background:var(--paper);border-radius:10px}
.product-images figcaption{font-size:12px;color:var(--muted)}
.product-actions{display:flex;justify-content:flex-end}
@media (max-width:520px){.product-images{grid-template-columns:1fr}}
.product-note{border:1px solid var(--line);border-radius:12px;padding:12px;font-size:15px;background:#fff;color:var(--ink)}
.cast-note{margin:0;padding:0 12px 12px;font-size:13px;line-height:1.6;color:var(--muted)}
.cast-note a{color:var(--blue)}
.screen-org{display:inline-flex;align-items:center;gap:8px;max-width:420px;min-width:0}
.screen-org img{height:30px;width:auto;max-width:170px;object-fit:contain}
.screen-org b{font-weight:600;color:#fff;white-space:nowrap;overflow:hidden;text-overflow:ellipsis}
.screen-sub{font-size:16px;color:rgba(255,255,255,.72);margin:0 0 14px}
.archive-fields{display:grid;grid-template-columns:1fr 1.4fr;gap:8px}
.product-sku,.product-note{border:1px solid var(--line);border-radius:12px;padding:12px;font-size:14px;background:#fff;color:var(--ink);min-width:0}
@media (max-width:480px){.archive-fields{grid-template-columns:1fr}}
@media (max-width:900px){
  .screen-org{max-width:230px}
  .screen-org b{max-width:120px}
  .screen-brand strong{display:none}
  .screen-status{gap:8px;font-size:12px}
  .screen-btn{padding:6px 10px;font-size:12px}
}
.ratio-block{display:grid;gap:8px}
.ratio-head{display:flex;align-items:baseline;justify-content:space-between;gap:10px}
.ratio-chips{display:grid;grid-template-columns:1fr 1fr;gap:8px}
.ratio-chip{border:1px solid var(--line);background:#fff;border-radius:12px;padding:12px;font-size:14px;color:var(--muted);cursor:pointer}
.ratio-chip.on{border-color:var(--blue);background:var(--ice);color:var(--blue);font-weight:600}
.screen-choice{display:grid;gap:6px;font-size:13px;color:var(--muted)}
.screen-choice select{border:1px solid var(--line);border-radius:10px;padding:10px;font-size:14px;background:#fff;color:var(--ink)}
.mobile-brand{min-width:0}
.mobile-brand span{white-space:nowrap;overflow:hidden;text-overflow:ellipsis;max-width:150px}
.mobile-head #screen-chip{max-width:150px;overflow:hidden;text-overflow:ellipsis;white-space:nowrap;font-size:11px;padding:5px 9px;flex-shrink:1}
@media (max-width:420px){.mobile-brand span{max-width:118px}.mobile-head #screen-chip{max-width:138px}}
.screen-hint{font-size:12px;color:rgba(255,255,255,.45);white-space:nowrap}
/* V3.5 layout: toolbar + image + status + footer */
.screen-body{grid-template-rows:auto minmax(0,1fr) auto auto;height:100vh;min-height:100vh}
.screen-head{padding:16px 32px;gap:16px}
.screen-brand{min-width:0;gap:10px}
.screen-brand strong{display:block;font-weight:500;color:rgba(255,255,255,.85);white-space:nowrap;overflow:hidden;text-overflow:ellipsis;min-width:0;max-width:46vw}
.screen-stage{padding:18px 32px 10px;min-height:0;overflow:hidden}
.display-status{padding:2px 32px 4px;text-align:center;font-size:12px;line-height:1.45;color:rgba(255,255,255,.55);min-height:0}
.display-status[hidden]{display:none}
.screen-foot{display:flex;flex-wrap:nowrap;justify-content:space-between;align-items:center;gap:16px;padding:8px 32px 10px;border-top:1px solid rgba(255,255,255,.06);color:rgba(255,255,255,.34);font-size:11px;line-height:1.45}
.screen-foot .foot-note{min-width:0;overflow:hidden;text-overflow:ellipsis;white-space:nowrap}
.screen-foot .foot-icp{white-space:nowrap}
@media (max-width:900px){
  .screen-head{flex-wrap:wrap}
  .screen-brand strong{display:block;font-size:16px;max-width:60vw}
  .screen-status{gap:8px;font-size:12px}
}
@media (max-width:700px){
  .screen-head{padding:12px 14px;gap:8px 12px}
  .screen-brand img{height:24px}
  #screen-atlas,#screen-sep{display:none}
  .screen-brand strong{font-size:16px;max-width:64vw}
  .screen-status{gap:7px}
  .screen-status #conn-text{display:none}
  .screen-btn{padding:6px 9px;font-size:11px}
  .screen-stage{padding:10px 12px 6px}
  .display-status{padding:1px 12px 3px;font-size:11px}
  .screen-foot{display:flex;flex-wrap:wrap;gap:3px 10px;padding:6px 12px 8px;font-size:10px}
  .screen-foot .foot-note{flex-basis:100%;white-space:normal;overflow:visible}
}
/* Product archive modal: mobile actions must wrap instead of overflowing left. */
@media (max-width:520px){
  .product-modal{
    padding:max(12px,env(safe-area-inset-top)) max(12px,env(safe-area-inset-right))
            max(12px,env(safe-area-inset-bottom)) max(12px,env(safe-area-inset-left));
  }
  .product-sheet{
    width:100%;
    max-height:calc(100vh - 24px - env(safe-area-inset-top) - env(safe-area-inset-bottom));
    padding:20px 18px calc(20px + env(safe-area-inset-bottom));
    border-radius:16px;
  }
  .product-actions{
    display:grid;
    grid-template-columns:1fr;
    gap:10px;
    justify-content:stretch;
  }
  .product-actions .btn{
    width:100%;
    min-height:44px;
    white-space:normal;
    text-align:center;
  }
}
@supports (height:100dvh){
  @media (max-width:520px){
    .product-sheet{max-height:calc(100dvh - 24px - env(safe-area-inset-top) - env(safe-area-inset-bottom))}
  }
}

.mobile-head-tools{display:flex;align-items:center;gap:8px;min-width:0}
.mobile-help{font-size:12px;color:var(--blue);white-space:nowrap;text-decoration:none}
.mobile-help:hover{text-decoration:underline}
@media (max-width:420px){.mobile-help{font-size:11px}}
/* Result image loading/error states; keep the result card stable while loading. */
.result-message{padding:18px;margin:0;font-size:14px;line-height:1.6;color:var(--muted)}
.result-message-error{background:#fff7f5;border-bottom:1px solid #f2d3cc;color:#8b2b1f}
.result-message-error p{margin:0 0 10px}
.result-message-error .btn{min-height:40px}
.result-card img[hidden]{display:none}
.view-result{justify-self:start;margin-top:6px}
