/* THV_PHOTO_REORDER_V1 */
.photo-slot[data-thv-photo]{cursor:grab;position:relative}
.photo-slot[data-thv-photo] button.photo-drag-handle{position:absolute;top:auto;left:5px;right:auto;bottom:5px;background:#fff;color:#17435e;border:0;border-radius:50%;padding:7px;box-sizing:border-box;width:32px;height:32px;min-width:32px;min-height:32px;cursor:grab;touch-action:none;z-index:2}
.photo-slot[data-thv-photo] .photo-main-label{position:absolute;left:4px;bottom:40px;background:#17435e;color:#fff;border-radius:3px;padding:3px 6px;font-size:11px;pointer-events:none}
.photo-slot.photo-sorting{opacity:.6;cursor:grabbing;outline:2px dashed #1b729a}
.photo-slot.photo-sort-target{outline:3px solid #008570;outline-offset:2px}
.photo-slot[data-thv-photo] .photo-drag-handle:focus-visible{outline:3px solid #008570;outline-offset:2px}
/* THV_PHOTO_ROTATE_UI_V1 — small circular controls and a real rotation dialog. */
.photo-layout{display:block}
.photo-layout>div:first-child{width:100%}
.photo-grid{width:100%;max-width:none;grid-template-columns:repeat(auto-fill,minmax(140px,1fr));gap:12px}
.photo-grid .photo-slot,.photo-grid .photo-add{height:auto;aspect-ratio:1;border-radius:7px;overflow:hidden}
.photo-grid .photo-slot{order:0}
.photo-grid .photo-add{order:1;border:2px dashed #e0e4e7}
.photo-grid .photo-empty{display:none}
.photo-layout .photo-advice{max-width:none;margin-top:12px}
.photo-layout .photo-advice p{display:inline;margin-left:6px}
.photo-slot[data-thv-photo] button.photo-rotate-button,.photo-slot[data-thv-photo] button.photo-delete-button{position:absolute;left:auto;right:8px;bottom:auto;top:8px;width:32px;height:32px;min-width:32px;min-height:32px;display:grid;place-items:center;border:0;border-radius:50%;background:#fff;padding:8px;color:#263a46;box-shadow:0 1px 3px #0002;z-index:2}
.photo-slot[data-thv-photo] button.photo-delete-button{top:46px}
.photo-slot[data-thv-photo] button img{width:16px;height:16px;object-fit:contain;border-radius:0;pointer-events:none}
.photo-slot[data-thv-photo] button:focus-visible{outline:3px solid #007daa;outline-offset:2px}
.photo-slot[data-thv-photo]>img[role=button]:focus-visible{outline:3px solid #007daa;outline-offset:-3px}
.thv-photo-dialog{box-sizing:border-box;width:min(580px,calc(100vw - 24px));max-height:calc(100dvh - 24px);padding:0;border:0;border-radius:9px;background:#fff;color:#30404d;overflow:auto;box-shadow:0 12px 50px #0003}
.thv-photo-dialog::backdrop{background:#0009}
.thv-photo-dialog header{display:flex;align-items:center;justify-content:center;position:relative;padding:20px 45px}
.thv-photo-dialog h2{font-family:inherit;font-size:18px;line-height:1.4;margin:0;font-weight:700}
.thv-photo-dialog button.photo-dialog-close{position:absolute;right:12px;top:12px;width:32px;height:32px;padding:8px;border:0;border-radius:50%;background:white;display:grid;place-items:center}
.thv-photo-dialog button.photo-dialog-close img{width:18px;height:18px}
.photo-rotate-preview{margin:6px 40px 20px;height:clamp(80px,calc(100dvh - 186px),498px);display:flex;align-items:center;justify-content:center;overflow:hidden;border-radius:9px;background:#f3f3f1}
.photo-rotate-preview img{max-width:none!important;max-height:none!important;object-fit:contain;flex-shrink:0;transition:transform .15s ease}
.photo-rotate-status{min-height:18px;margin:8px 40px;font-size:13px}
.photo-rotate-status[role=alert]{color:#ac2330}
.photo-rotate-status:empty{display:none}
.thv-photo-dialog footer{display:flex;gap:8px;justify-content:flex-end;border-top:1px solid #e4e4e4;padding:12px 16px;margin:0;background:#fff}
.thv-photo-dialog footer button{position:static;display:flex;align-items:center;justify-content:center;gap:6px;width:auto;height:auto;min-width:124px;min-height:44px;border-radius:7px;padding:10px 18px;font-weight:700;font-size:15px;border:1px solid #146eaa;background:#fff;color:#146eaa}
.thv-photo-dialog footer button img{width:18px;height:18px;filter:invert(32%) sepia(49%) saturate(1385%) hue-rotate(168deg)}
.thv-photo-dialog footer .photo-dialog-done{background:#146eaa;color:#fff}
.thv-photo-dialog button:disabled{opacity:.65;cursor:wait}
@media(max-width:600px){.photo-rotate-preview{margin:6px 16px 0}.photo-rotate-status{margin:8px 16px}.thv-photo-dialog footer button{min-width:100px}}
/* THV_PHOTO_CROP_UI_V1 */
.photo-rotate-preview img[hidden]{display:none!important}
.photo-preview-advanced{height:clamp(120px,32dvh,270px);margin-bottom:10px}
.photo-preview-advanced canvas{max-width:100%;max-height:100%;object-fit:contain;display:block}
.photo-edit-tools{margin:0 40px 14px;font-size:13px}
.thv-photo-dialog .photo-edit-tools button{position:static;width:auto;height:auto;min-height:36px;border:1px solid #ccd8df;border-radius:5px;padding:7px 10px;background:#fff;color:#146eaa;font-size:13px}
.photo-edit-settings{display:grid;grid-template-columns:1fr 1fr;gap:8px 20px;margin-top:8px}
.photo-edit-settings label{display:grid;gap:4px;font-size:13px}
.photo-edit-settings input[type=range]{width:100%;margin:0;accent-color:#146eaa;min-height:26px}
.photo-edit-settings .photo-straighten,.photo-edit-settings p{grid-column:1/-1}
.photo-edit-settings p{margin:0;font-size:12px}
.thv-photo-dialog footer{position:sticky;bottom:0;z-index:5}
@media(max-width:600px){.photo-edit-tools{margin:10px 16px}.photo-edit-settings{gap:8px 12px}}
