/* Photo tools workspace (the in-browser editor and image utilities).
   The workspace stays neutral grey on purpose: colour on screen must not tint the photo.
   Everything is scoped to .photo-ws so it cannot clash with the PDF tools' styles. */
.photo-ws{
  --ws:#2A2A2A; --ws-stage:#3A3A3A; --ws-panel:#242424; --ws-raise:#323232; --ws-raise-2:#3C3C3C;
  --ws-text:#ECECEA; --ws-muted:#A3A3A0; --ws-line:#3F3F3F;
  --ph-accent:#3DD68C; --ph-accent-2:#5FE3A3;
  --r-s:8px; --r-m:12px; --r-l:16px;
}
.photo-ws canvas,.photo-ws img{display:block;max-width:100%}
.photo-ws .ico{width:24px;height:24px;fill:none;stroke:currentColor;stroke-width:1.75;stroke-linecap:round;stroke-linejoin:round}
.photo-ws .sr{position:absolute!important;width:1px;height:1px;padding:0;margin:-1px;overflow:hidden;clip:rect(0 0 0 0);white-space:nowrap;border:0}
.photo-ws :focus-visible{outline:3px solid var(--ph-accent);outline-offset:2px}
.photo-ws.is-busy .dropzone{opacity:.6;pointer-events:none}
/* neutralise Lystok form/layout classes that share a name with editor parts */
.photo-ws .panel{position:static;top:auto;box-shadow:none;border-radius:0}
.photo-ws .field>label{display:block;font-weight:400;margin:0}
.photo-ws .check input{margin:0}
.photo-ws .bar{height:auto;background:none;border-radius:0;overflow:visible;max-width:none;margin:0 0 12px}
.photo-ws .bar span{display:inline;height:auto;width:auto;background:none;border-radius:0;transition:none}
.photo-ws .bar .grow{display:block}

/* =========================================================== workspace */
.photo-ws .app{background:var(--ws);color:var(--ws-text);border-radius:var(--r-l);overflow:hidden;font-size:15px;line-height:1.4;display:grid;grid-template-rows:auto minmax(0,1fr);height:min(86vh,900px);min-height:560px}
.photo-ws .app button,.photo-ws .app input,.photo-ws .app select,.photo-ws .app textarea{font:inherit;color:inherit}
.photo-ws .app-bar{display:flex;align-items:center;gap:6px;padding:10px 12px;border-bottom:1px solid var(--ws-line);background:var(--ws-panel);flex-wrap:wrap}
.photo-ws .app-bar .sep{width:1px;height:24px;background:var(--ws-line);margin:0 4px}
.photo-ws .app-bar .grow{flex:1}
.photo-ws .zoom-val{min-width:52px;text-align:center;font-variant-numeric:tabular-nums;color:var(--ws-muted);font-size:14px}
.photo-ws .wbtn{display:inline-flex;align-items:center;justify-content:center;gap:7px;min-height:36px;min-width:36px;padding:0 10px;border-radius:8px;border:0;background:transparent;color:var(--ws-text);cursor:pointer;font-size:14px;white-space:nowrap}
.photo-ws .wbtn:hover{background:var(--ws-raise)}
.photo-ws .wbtn:disabled{opacity:.35;cursor:default;background:transparent}
.photo-ws .wbtn .ico{width:20px;height:20px}
.photo-ws .wbtn.is-on{background:var(--ws-raise-2)}
.photo-ws .wbtn-solid{background:var(--ws-raise)}
.photo-ws .wbtn-solid:hover{background:var(--ws-raise-2)}
.photo-ws .wbtn-primary{background:var(--ph-accent);color:#1d1d1d;font-weight:700;padding:0 16px}
.photo-ws .wbtn-primary:hover{background:var(--ph-accent-2)}
.photo-ws .wbtn-danger:hover{background:#5a2a2c}
.photo-ws .app-main{display:grid;grid-template-columns:minmax(0,1fr) 340px;min-height:0}
.photo-ws .stage{position:relative;background:var(--ws-stage);overflow:hidden;touch-action:none;min-height:0}
.photo-ws .stage-inner{position:absolute;left:0;top:0;transform-origin:0 0}
.photo-ws .stage canvas{position:absolute;left:0;top:0;width:100%;height:100%}
.photo-ws .stage .c-before{z-index:1}
.photo-ws .stage .c-gl{z-index:2}
.photo-ws .stage .c-over{z-index:3}
.photo-ws .stage .c-ui{z-index:4}
.photo-ws .stage.checker .stage-inner{background:repeating-conic-gradient(#5a5a5a 0 25%,#4a4a4a 0 50%) 0 0/16px 16px}
.photo-ws .compare-handle{position:absolute;top:0;bottom:0;width:0;z-index:6;cursor:ew-resize}
.photo-ws .compare-handle::before{content:"";position:absolute;top:0;bottom:0;left:-1px;width:2px;background:var(--ph-accent)}
.photo-ws .compare-handle::after{content:"";position:absolute;top:50%;left:-14px;width:28px;height:28px;margin-top:-14px;border-radius:50%;background:var(--ph-accent);box-shadow:0 2px 10px rgba(0,0,0,.4)}
.photo-ws .stage-msg{position:absolute;left:50%;bottom:16px;transform:translateX(-50%);z-index:8;background:rgba(20,20,20,.88);color:#fff;padding:9px 14px;border-radius:8px;font-size:14px;max-width:90%;text-align:center}
.photo-ws .side{background:var(--ws-panel);border-left:1px solid var(--ws-line);display:grid;grid-template-rows:auto minmax(0,1fr) auto;min-height:0}
.photo-ws .tabs{display:grid;grid-template-columns:repeat(5,1fr);gap:2px;padding:8px;border-bottom:1px solid var(--ws-line)}
.photo-ws .tab{display:flex;flex-direction:column;align-items:center;gap:4px;padding:8px 2px;border:0;border-radius:8px;background:transparent;color:var(--ws-muted);cursor:pointer;font-size:12px;line-height:1.1;text-align:center}
.photo-ws .tab .ico{width:20px;height:20px}
.photo-ws .tab:hover{background:var(--ws-raise);color:var(--ws-text)}
.photo-ws .tab[aria-selected=true]{background:var(--ws-raise-2);color:var(--ws-text)}
.photo-ws .tab[aria-selected=true] .ico{color:var(--ph-accent)}
.photo-ws .panel{overflow:auto;padding:14px 16px 20px;scrollbar-width:thin;scrollbar-color:#555 transparent}
.photo-ws .panel h3{font:700 13px/1 var(--font-body);color:var(--ws-muted);margin:18px 0 10px;letter-spacing:.01em}
.photo-ws .panel h3:first-child{margin-top:4px}
.photo-ws .field{display:grid;gap:6px;margin-bottom:12px}
.photo-ws .field-row{display:flex;align-items:center;justify-content:space-between;gap:8px}
.photo-ws .field label,.photo-ws .field .lbl{font-size:14px;color:var(--ws-text)}
.photo-ws .field output{font-variant-numeric:tabular-nums;color:var(--ws-muted);font-size:13px;min-width:38px;text-align:right}
.photo-ws .grid2{display:grid;grid-template-columns:1fr 1fr;gap:8px}
.photo-ws .grid3{display:grid;grid-template-columns:repeat(3,1fr);gap:6px}
.photo-ws .grid4{display:grid;grid-template-columns:repeat(4,1fr);gap:6px}
.photo-ws :is(.app,.tool-app,.dlg) input[type=range]{-webkit-appearance:none;appearance:none;width:100%;height:22px;background:transparent;cursor:pointer;margin:0}
.photo-ws :is(.app,.tool-app,.dlg) input[type=range]::-webkit-slider-runnable-track{height:4px;border-radius:2px;background:linear-gradient(to right,var(--ws-raise-2),var(--ws-raise-2))}
.photo-ws :is(.app,.tool-app,.dlg) input[type=range]::-moz-range-track{height:4px;border-radius:2px;background:var(--ws-raise-2)}
.photo-ws :is(.app,.tool-app,.dlg) input[type=range]::-webkit-slider-thumb{-webkit-appearance:none;width:16px;height:16px;border-radius:50%;background:#F2F2F0;margin-top:-6px;border:0;box-shadow:0 1px 4px rgba(0,0,0,.5)}
.photo-ws :is(.app,.tool-app,.dlg) input[type=range]::-moz-range-thumb{width:16px;height:16px;border-radius:50%;background:#F2F2F0;border:0}
.photo-ws :is(.app,.tool-app,.dlg) input[type=range].bipolar::-webkit-slider-runnable-track{background:linear-gradient(to right,var(--ws-raise-2) calc(50% - 1px),#8a8a87 calc(50% - 1px) calc(50% + 1px),var(--ws-raise-2) calc(50% + 1px))}
.photo-ws :is(.app,.tool-app,.dlg) input[type=range]:focus-visible{outline:2px solid var(--ph-accent);outline-offset:2px}
.photo-ws :is(.app,.tool-app,.dlg) :is(input[type=number],input[type=text],select,textarea){width:100%;min-height:36px;padding:6px 10px;border-radius:8px;border:1px solid var(--ws-line);background:#1B1B1B;color:var(--ws-text)}
.photo-ws :is(.app,.tool-app,.dlg) textarea{min-height:70px;resize:vertical}
.photo-ws :is(.app,.tool-app,.dlg) input[type=color]{width:100%;height:36px;border:1px solid var(--ws-line);border-radius:8px;background:#1B1B1B;padding:3px;cursor:pointer}
.photo-ws :is(.app,.tool-app,.dlg) input[type=checkbox]{accent-color:var(--ph-accent);width:16px;height:16px}
.photo-ws .check{display:flex;align-items:center;gap:8px;font-size:14px;cursor:pointer;margin-bottom:10px}
.photo-ws .seg{display:flex;flex-wrap:wrap;gap:6px}
.photo-ws .seg button{flex:1 1 auto;min-height:34px;padding:0 10px;border-radius:8px;border:1px solid var(--ws-line);background:transparent;color:var(--ws-text);cursor:pointer;font-size:13px}
.photo-ws .seg button:hover{background:var(--ws-raise)}
.photo-ws .seg button[aria-pressed=true]{background:var(--ws-text);color:#1d1d1d;border-color:var(--ws-text)}
.photo-ws .hint{font-size:13px;color:var(--ws-muted);margin:0 0 12px}
.photo-ws .presets{display:grid;grid-template-columns:repeat(3,1fr);gap:8px}
.photo-ws .preset{border:0;padding:0;background:transparent;cursor:pointer;color:var(--ws-text);display:grid;gap:5px;font-size:12px;text-align:left}
.photo-ws .preset canvas{width:100%;aspect-ratio:1;border-radius:8px;object-fit:cover;background:#333}
.photo-ws .preset[aria-pressed=true] canvas{box-shadow:0 0 0 2px var(--ws-panel),0 0 0 4px var(--ph-accent)}
.photo-ws .curve-box{position:relative;background:#1B1B1B;border-radius:8px;border:1px solid var(--ws-line);aspect-ratio:1;touch-action:none}
.photo-ws .curve-box canvas{width:100%;height:100%;border-radius:8px}
.photo-ws .layers{border-top:1px solid var(--ws-line);padding:10px 12px;max-height:200px;overflow:auto}
.photo-ws .layers h3{font:700 13px/1 var(--font-body);color:var(--ws-muted);margin:2px 0 8px}
.photo-ws .layers ul{list-style:none;margin:0;padding:0;display:grid;gap:4px}
.photo-ws .layers li{display:flex;align-items:center;gap:8px;padding:4px 6px 4px 10px;border-radius:8px;background:var(--ws-raise);font-size:13px}
.photo-ws .layers li.is-sel{box-shadow:inset 0 0 0 1px var(--ph-accent)}
.photo-ws .layers li span{flex:1;overflow:hidden;text-overflow:ellipsis;white-space:nowrap;cursor:pointer}
.photo-ws .layers .empty{font-size:13px;color:var(--ws-muted)}
.photo-ws .swatches{display:flex;flex-wrap:wrap;gap:6px;margin-bottom:10px}
.photo-ws .swatches button{width:26px;height:26px;border-radius:6px;border:0;cursor:pointer;background:var(--c);box-shadow:inset 0 0 0 1px rgba(255,255,255,.15)}
.photo-ws .swatches button[aria-pressed=true]{box-shadow:0 0 0 2px var(--ws-panel),0 0 0 4px var(--ph-accent)}
/* export dialog */
.photo-ws .dlg{border:0;border-radius:16px;padding:0;background:var(--ws-panel);color:var(--ws-text);width:min(440px,calc(100vw - 32px));box-shadow:0 30px 80px rgba(0,0,0,.5)}
.photo-ws .dlg::backdrop{background:rgba(15,15,15,.6)}
.photo-ws .dlg form{padding:22px}
.photo-ws .dlg button,.photo-ws .dlg select,.photo-ws .dlg input{font:inherit}
.photo-ws .dlg h2{font-size:28px;margin-bottom:16px;color:#fff}
.photo-ws .dlg .actions{display:flex;justify-content:flex-end;gap:8px;margin-top:16px}
.photo-ws .dlg .est{font-variant-numeric:tabular-nums;color:var(--ws-muted);font-size:14px}
/* batch / meta / favicon / picker / collage */
.photo-ws .tool-app{background:var(--ws);color:var(--ws-text);border-radius:var(--r-l);padding:18px;font-size:15px;line-height:1.4}
.photo-ws .tool-app button,.photo-ws .tool-app input,.photo-ws .tool-app select{font:inherit}
.photo-ws .tool-app .app{height:auto}
.photo-ws .bar{display:flex;flex-wrap:wrap;align-items:end;gap:14px;padding-bottom:16px;border-bottom:1px solid var(--ws-line);margin-bottom:12px}
.photo-ws .bar .field{margin:0;min-width:150px}
.photo-ws .bar .grow{flex:1}
.photo-ws .tool-app input[type=range]{width:180px}
.photo-ws .files{list-style:none;margin:0;padding:0;display:grid;gap:8px}
.photo-ws .file{display:grid;grid-template-columns:56px minmax(0,1fr) auto auto;gap:14px;align-items:center;padding:8px 10px 8px 8px;background:var(--ws-panel);border-radius:10px}
.photo-ws .file img,.photo-ws .file .thumb{width:56px;height:56px;object-fit:cover;border-radius:6px;background:#333}
.photo-ws .file .name{overflow:hidden;text-overflow:ellipsis;white-space:nowrap;font-weight:600}
.photo-ws .file .meta{font-size:13px;color:var(--ws-muted);font-variant-numeric:tabular-nums}
.photo-ws .file .gain{font-variant-numeric:tabular-nums;font-weight:700;color:#8FD18F}
.photo-ws .file .gain.worse{color:#E8A0A0}
.photo-ws .file .st{font-size:13px;color:var(--ws-muted)}
.photo-ws .file.is-err .st{color:#F0A0A0}
.photo-ws .next{margin-top:16px;padding-top:14px;border-top:1px solid var(--ws-line);display:flex;flex-wrap:wrap;gap:8px;align-items:center}
.photo-ws .next p{color:var(--ws-muted);font-size:14px;margin-right:6px}
.photo-ws .next a{display:inline-flex;align-items:center;gap:8px;padding:6px 12px;border-radius:999px;background:var(--ws-raise);color:var(--ws-text);text-decoration:none;font-size:14px}
.photo-ws .next a:hover{background:var(--ws-raise-2);color:#fff}
.photo-ws .next .dot{width:10px;height:10px}
.photo-ws .tags{width:100%;border-collapse:collapse;font-size:13px;margin-top:8px}
.photo-ws .tags td{padding:5px 8px;border-top:1px solid var(--ws-line);vertical-align:top;overflow-wrap:anywhere}
.photo-ws .tags td:first-child{color:var(--ws-muted);width:38%}
.photo-ws .meta-card{background:var(--ws-panel);border-radius:12px;padding:14px;display:grid;grid-template-columns:120px minmax(0,1fr);gap:16px}
.photo-ws .meta-card img{width:120px;height:120px;object-fit:cover;border-radius:8px}
.photo-ws .meta-card details summary{cursor:pointer;color:var(--ws-muted);font-size:14px;margin-top:8px}
.photo-ws .warn{display:inline-block;background:#4B3A12;color:#F6DB7C;padding:6px 10px;border-radius:8px;font-size:14px;margin:6px 0}
.photo-ws .kv{display:grid;grid-template-columns:auto minmax(0,1fr);gap:4px 14px;font-size:14px}
.photo-ws .kv dt{color:var(--ws-muted)}.kv dd{margin:0}
.photo-ws .picker{display:grid;grid-template-columns:minmax(0,1fr) 300px;gap:16px}
.photo-ws .picker-stage{position:relative;background:var(--ws-stage);border-radius:12px;overflow:hidden;display:grid;place-items:center;min-height:380px;cursor:crosshair;touch-action:none}
.photo-ws .picker-stage canvas{max-height:70vh;width:auto;height:auto}
.photo-ws .loupe{position:absolute;width:120px;height:120px;border-radius:50%;border:3px solid #fff;box-shadow:0 4px 16px rgba(0,0,0,.5);pointer-events:none;overflow:hidden;image-rendering:pixelated}
.photo-ws .colors{list-style:none;margin:0;padding:0;display:grid;gap:6px}
.photo-ws .color-item{display:grid;grid-template-columns:40px minmax(0,1fr) auto;gap:10px;align-items:center;background:var(--ws-panel);border-radius:10px;padding:6px}
.photo-ws .color-item i{width:40px;height:40px;border-radius:7px;background:var(--c);box-shadow:inset 0 0 0 1px rgba(255,255,255,.15)}
.photo-ws .color-item code{font:600 14px/1.3 ui-monospace,Menlo,Consolas,monospace}
.photo-ws .color-item small{display:block;color:var(--ws-muted);font:12px/1.3 ui-monospace,Menlo,Consolas,monospace}
.photo-ws .pal{display:grid;grid-template-columns:repeat(6,1fr);height:56px;border-radius:10px;overflow:hidden;margin:8px 0 14px}
.photo-ws .pal button{border:0;cursor:pointer;background:var(--c)}
.photo-ws .fav{display:grid;grid-template-columns:300px minmax(0,1fr);gap:20px}
.photo-ws .fav-prev{display:flex;align-items:end;gap:14px;flex-wrap:wrap;background:var(--ws-panel);border-radius:12px;padding:16px}
.photo-ws .fav-prev canvas{border-radius:4px;background:repeating-conic-gradient(#5a5a5a 0 25%,#4a4a4a 0 50%) 0 0/10px 10px}
.photo-ws .fav pre{background:#1B1B1B;border-radius:10px;padding:12px;font-size:12.5px;overflow:auto;white-space:pre;color:#DADAD6}
.photo-ws .collage{display:grid;grid-template-columns:minmax(0,1fr) 300px;gap:16px}
.photo-ws .collage-stage{background:var(--ws-stage);border-radius:12px;display:grid;place-items:center;padding:16px;min-height:420px}
.photo-ws .collage-stage canvas{max-height:72vh;width:auto;max-width:100%;touch-action:none;cursor:grab}
.photo-ws .layouts{display:grid;grid-template-columns:repeat(4,1fr);gap:6px}
.photo-ws .layouts button{aspect-ratio:1;border:1px solid var(--ws-line);border-radius:8px;background:transparent;padding:5px;cursor:pointer}
.photo-ws .layouts button[aria-pressed=true]{border-color:var(--ph-accent);box-shadow:inset 0 0 0 1px var(--ph-accent)}
.photo-ws .layouts svg{width:100%;height:100%}
.photo-ws .layouts rect{fill:#5C5C5A}
@media (max-width:920px){
  .photo-ws .app{height:auto;min-height:0;grid-template-rows:auto auto}
  .photo-ws .app-main{grid-template-columns:1fr}
  .photo-ws .stage{height:50vh;min-height:300px}
  .photo-ws .side{border-left:0;border-top:1px solid var(--ws-line);grid-template-rows:auto auto auto}
  .photo-ws .tabs{display:flex;overflow-x:auto;scrollbar-width:none}
  .photo-ws .tab{flex:0 0 74px}
  .photo-ws .panel{max-height:none}
  .photo-ws .picker,.photo-ws .fav,.photo-ws .collage{grid-template-columns:1fr}
}
@media (max-width:620px){
  .photo-ws .file{grid-template-columns:48px minmax(0,1fr) auto}
  .photo-ws .file .acts{grid-column:1/-1;display:flex;justify-content:flex-end}
  .photo-ws .app-bar .lbl-wide{display:none}
}

/* page chrome around the workspace */
.photo-badge{display:inline-flex;align-items:center;gap:8px;margin:10px 0 0;font-size:.9rem;color:var(--ink-2)}
.photo-badge::before{content:"";width:9px;height:9px;border-radius:50%;background:var(--leaf)}
.photo-badge.is-server::before{background:#E0A32E}
.photo-ws{margin-bottom:28px;scroll-margin-top:80px}
.photo-ws .dlg h2{font-family:var(--font-head)}
/* Fira Sans is wider than the editor's original condensed face: let tab labels wrap inside the side panel */
.photo-ws .side,.photo-ws .panel,.photo-ws .tabs{min-width:0}
.photo-ws .tab{min-width:0;font-size:12px;line-height:1.15;text-align:center;overflow-wrap:anywhere;hyphens:auto}
.photo-ws .seg button{min-width:0}
.photo-ws .tabs{grid-template-columns:repeat(5,minmax(0,1fr))}
.photo-ws .presets{grid-template-columns:repeat(3,minmax(0,1fr))}
.photo-ws .grid2{grid-template-columns:repeat(2,minmax(0,1fr))}
.photo-ws .grid3{grid-template-columns:repeat(3,minmax(0,1fr))}
.photo-ws .grid4{grid-template-columns:repeat(4,minmax(0,1fr))}
@media (max-width:920px){.photo-ws .tabs{display:flex}}
.photo-ws .tab{overflow-wrap:normal}
.photo-ws .app-main{grid-template-columns:minmax(0,1fr) 360px}
@media (max-width:920px){.photo-ws .app-main{grid-template-columns:1fr}}
/* ID photo */
.photo-ws .id-box{min-height:420px;padding:16px;cursor:grab}
.photo-ws .id-stage{touch-action:none;box-shadow:0 0 0 1px rgba(255,255,255,.25),0 10px 30px rgba(0,0,0,.4);max-width:100%}
.photo-ws .id-box:active{cursor:grabbing}
