/* === PhotoAlfa — Refined Watch Photography === */

:root {
    --cream: #F5F0EB;
    --charcoal: #1A1A1A;
    --gold: #B8860B;
    --gold-light: #D4A843;
    --warm-gray: #8A8278;
    --glass-bg: rgba(245, 240, 235, 0.85);
    --glass-border: rgba(184, 134, 11, 0.15);
}

* { box-sizing: border-box; }

.sr-only {
    position: absolute;
    width: 1px;
    height: 1px;
    padding: 0;
    margin: -1px;
    overflow: hidden;
    clip: rect(0, 0, 0, 0);
    white-space: nowrap;
    border: 0;
}

body {
    background: var(--cream);
    background-image:
        radial-gradient(ellipse at 20% 0%, rgba(184, 134, 11, 0.06) 0%, transparent 50%),
        radial-gradient(ellipse at 80% 100%, rgba(184, 134, 11, 0.04) 0%, transparent 50%);
}

/* Navbar */
.navbar {
    background: var(--glass-bg);
    backdrop-filter: blur(20px);
    -webkit-backdrop-filter: blur(20px);
    border-bottom: 1px solid var(--glass-border);
}

.nav-link {
    font-size: 0.8rem;
    font-weight: 500;
    letter-spacing: 0.12em;
    text-transform: uppercase;
    color: var(--warm-gray);
    transition: color 0.3s ease;
    position: relative;
    padding-bottom: 2px;
}
.nav-link::after {
    content: '';
    position: absolute;
    bottom: -2px;
    left: 0;
    width: 0;
    height: 1.5px;
    background: var(--gold);
    transition: width 0.3s ease;
}
.nav-link:hover, .nav-link.active {
    color: var(--charcoal);
}
.nav-link:hover::after, .nav-link.active::after {
    width: 100%;
}
@media (max-width: 767px) {
    .nav-link {
        font-size: 0.65rem;
        letter-spacing: 0.06em;
    }
}

/* Section Titles */
.section-title {
    font-family: 'Playfair Display', serif;
    font-size: 1.75rem;
    font-weight: 600;
    letter-spacing: -0.01em;
    margin-bottom: 1.5rem;
    color: var(--charcoal);
}
.section-subtitle {
    font-size: 0.8rem;
    text-transform: uppercase;
    letter-spacing: 0.15em;
    color: var(--warm-gray);
    font-weight: 500;
    margin-bottom: 0.75rem;
}

/* Cards & Panels */
.panel {
    background: white;
    border: 1px solid rgba(0,0,0,0.06);
    border-radius: 12px;
    padding: 1.5rem;
    box-shadow: 0 1px 3px rgba(0,0,0,0.04);
    transition: box-shadow 0.3s ease;
}
.panel:hover {
    box-shadow: 0 4px 16px rgba(0,0,0,0.06);
}

/* Thumbnail Grid */
.thumb-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(100px, 1fr));
    gap: 0.75rem;
}
.thumb-item {
    position: relative;
    aspect-ratio: 1;
    border-radius: 8px;
    overflow: hidden;
    cursor: pointer;
    border: 2px solid transparent;
    transition: all 0.3s ease;
}
.thumb-item img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    transition: transform 0.4s ease;
}
.thumb-item:hover img {
    transform: scale(1.05);
}
.thumb-item.selected {
    border-color: var(--gold);
    box-shadow: 0 0 0 3px rgba(184, 134, 11, 0.2);
}
.thumb-item .thumb-label {
    position: absolute;
    bottom: 0;
    left: 0;
    right: 0;
    padding: 4px 6px;
    background: linear-gradient(transparent, rgba(0,0,0,0.7));
    color: white;
    font-size: 0.65rem;
    text-transform: uppercase;
    letter-spacing: 0.08em;
    font-weight: 500;
}

/* Upload Zone */
.upload-zone {
    border: 2px dashed rgba(184, 134, 11, 0.3);
    border-radius: 12px;
    padding: 2.5rem 1.5rem;
    text-align: center;
    cursor: pointer;
    transition: all 0.3s ease;
    background: rgba(184, 134, 11, 0.02);
}
.upload-zone:hover, .upload-zone.drag-over {
    border-color: var(--gold);
    background: rgba(184, 134, 11, 0.06);
}
.upload-zone.has-file {
    border-style: solid;
    border-color: var(--gold);
    padding: 1rem;
}
.upload-zone .upload-icon {
    font-size: 2rem;
    margin-bottom: 0.5rem;
    opacity: 0.4;
}
.upload-zone .upload-text {
    font-size: 0.85rem;
    color: var(--warm-gray);
}
.upload-zone .upload-text strong {
    color: var(--gold);
}
.gallery-pick-btn {
    display: inline-block;
    margin-top: 0.75rem;
    padding: 0;
    border: none;
    background: none;
    color: var(--gold);
    font-size: 0.75rem;
    font-weight: 600;
    letter-spacing: 0.04em;
    cursor: pointer;
}
.gallery-pick-btn:hover { color: var(--gold-light); }
.gallery-picker {
    position: fixed;
    inset: 0;
    z-index: 80;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 1.25rem;
    background: rgba(26, 26, 26, 0.45);
}
.gallery-picker[hidden] { display: none; }
.gallery-picker-panel {
    width: min(920px, 100%);
    max-height: min(82vh, 760px);
    display: flex;
    flex-direction: column;
    background: var(--cream, #F5F0EB);
    border-radius: 16px;
    overflow: hidden;
    box-shadow: 0 24px 60px rgba(0, 0, 0, 0.18);
}
.gallery-picker-head {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 1rem 1.1rem 0.4rem;
}
.gallery-picker-close {
    border: none;
    background: none;
    font-size: 1.5rem;
    line-height: 1;
    color: var(--warm-gray, #8A8278);
    cursor: pointer;
}
.gallery-picker-search {
    margin: 0.35rem 1.1rem 0;
    padding: 0.45rem 0.7rem;
    border: 1px solid rgba(0, 0, 0, 0.08);
    border-radius: 8px;
    background: white;
    font-size: 0.8rem;
}
.gallery-picker-grid {
    overflow: auto;
    padding: 0.75rem 1.1rem 1.1rem;
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(140px, 1fr));
    grid-auto-rows: 168px;
    gap: 0.75rem;
    align-items: start;
}
.gallery-picker-card {
    display: block;
    min-width: 0;
    height: 168px;
    border: 2px solid transparent;
    border-radius: 10px;
    overflow: hidden;
    background: white;
    cursor: pointer;
    text-align: left;
    padding: 0;
}
.gallery-picker-card img {
    width: 100%;
    height: 132px;
    object-fit: cover;
    display: block;
    background: #e7e1d8;
}
.gallery-picker-card span {
    display: block;
    padding: 0.35rem 0.45rem 0.5rem;
    font-size: 0.65rem;
    color: var(--warm-gray, #8A8278);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}
.gallery-picker-card.selected {
    border-color: var(--gold, #B8860B);
}
.gallery-picker-foot {
    padding: 0.75rem 1.1rem 1rem;
    border-top: 1px solid rgba(0, 0, 0, 0.06);
}
.gallery-picker-empty {
    grid-column: 1 / -1;
    text-align: center;
    color: var(--warm-gray, #8A8278);
    font-size: 0.85rem;
    padding: 2rem 0;
}

/* Buttons */
.btn-primary {
    background: var(--charcoal);
    color: white;
    padding: 0.75rem 2rem;
    border-radius: 8px;
    font-size: 0.8rem;
    font-weight: 600;
    letter-spacing: 0.1em;
    text-transform: uppercase;
    border: none;
    cursor: pointer;
    transition: all 0.3s ease;
    position: relative;
    overflow: hidden;
}
.btn-primary:hover:not(:disabled) {
    background: var(--gold);
    transform: translateY(-1px);
    box-shadow: 0 4px 12px rgba(184, 134, 11, 0.3);
}
.btn-primary.is-danger {
    background: #b91c1c;
}
.btn-primary.is-danger:hover:not(:disabled) {
    background: #dc2626;
    box-shadow: 0 4px 12px rgba(220, 38, 38, 0.35);
}
.btn-primary:disabled {
    opacity: 0.4;
    cursor: not-allowed;
}
.btn-secondary {
    background: transparent;
    color: var(--charcoal);
    padding: 0.6rem 1.5rem;
    border-radius: 8px;
    font-size: 0.75rem;
    font-weight: 600;
    letter-spacing: 0.1em;
    text-transform: uppercase;
    border: 1.5px solid rgba(0,0,0,0.15);
    cursor: pointer;
    transition: all 0.3s ease;
}
.btn-secondary:hover {
    border-color: var(--gold);
    color: var(--gold);
}
.btn-danger {
    background: transparent;
    color: #C0392B;
    padding: 0.6rem 1.5rem;
    border-radius: 8px;
    font-size: 0.75rem;
    font-weight: 600;
    letter-spacing: 0.1em;
    text-transform: uppercase;
    border: 1.5px solid rgba(192, 57, 43, 0.3);
    cursor: pointer;
    transition: all 0.3s ease;
}
.btn-danger:hover {
    background: #C0392B;
    color: white;
    border-color: #C0392B;
}

/* Form controls */
.form-select, .form-textarea {
    width: 100%;
    padding: 0.6rem 0.75rem;
    border: 1.5px solid rgba(0,0,0,0.1);
    border-radius: 8px;
    font-family: 'DM Sans', sans-serif;
    font-size: 0.85rem;
    background: white;
    color: var(--charcoal);
    transition: border-color 0.3s ease;
    appearance: none;
}
.form-select {
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' fill='%238A8278' viewBox='0 0 16 16'%3E%3Cpath d='M8 11L3 6h10l-5 5z'/%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: right 0.75rem center;
    padding-right: 2rem;
}
.form-select:focus, .form-textarea:focus {
    outline: none;
    border-color: var(--gold);
    box-shadow: 0 0 0 3px rgba(184, 134, 11, 0.1);
}
.form-textarea {
    resize: vertical;
    min-height: 80px;
}

.gen-settings-stack {
    display: flex;
    flex-direction: column;
    gap: 1.15rem;
}

.model-picker {
    display: flex;
    flex-direction: column;
    gap: 0.4rem;
}
.model-pick {
    display: flex;
    flex-direction: column;
    align-items: flex-start;
    gap: 0.15rem;
    width: 100%;
    text-align: left;
    padding: 0.7rem 0.85rem;
    border: 1.5px solid rgba(0, 0, 0, 0.08);
    border-radius: 10px;
    background: white;
    cursor: pointer;
    transition: border-color 0.2s ease, background 0.2s ease, box-shadow 0.2s ease;
}
.model-pick:hover { border-color: rgba(184, 134, 11, 0.45); }
.model-pick:focus-visible {
    outline: 2px solid var(--gold);
    outline-offset: 2px;
}
.model-pick.selected {
    border-color: var(--gold);
    background: rgba(184, 134, 11, 0.08);
    box-shadow: 0 0 0 2px rgba(184, 134, 11, 0.16);
}
.model-pick-name {
    font-size: 0.82rem;
    font-weight: 600;
    color: var(--charcoal);
}
.model-pick-meta {
    font-size: 0.65rem;
    color: var(--warm-gray);
    display: -webkit-box;
    -webkit-line-clamp: 3;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

.res-picker {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(4.4rem, 1fr));
    gap: 0.4rem;
}
.res-pick {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 0.15rem;
    padding: 0.55rem 0.3rem 0.5rem;
    border: 1.5px solid rgba(0, 0, 0, 0.08);
    border-radius: 10px;
    background: white;
    cursor: pointer;
    transition: border-color 0.2s ease, background 0.2s ease, box-shadow 0.2s ease;
}
.res-pick:hover { border-color: rgba(184, 134, 11, 0.45); }
.res-pick:focus-visible {
    outline: 2px solid var(--gold);
    outline-offset: 2px;
}
.res-pick.selected {
    border-color: var(--gold);
    background: rgba(184, 134, 11, 0.08);
    box-shadow: 0 0 0 2px rgba(184, 134, 11, 0.16);
}
.res-pick-k {
    font-size: 0.9rem;
    font-weight: 600;
    color: var(--charcoal);
    letter-spacing: 0.02em;
}
.res-pick-hint {
    font-size: 0.6rem;
    color: var(--warm-gray);
    letter-spacing: 0.06em;
    text-transform: uppercase;
}

.ratio-picker {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(3.35rem, 1fr));
    gap: 0.4rem;
}
.ratio-pick {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: flex-end;
    gap: 0.35rem;
    min-height: 3.75rem;
    padding: 0.45rem 0.2rem 0.4rem;
    border: 1.5px solid rgba(0, 0, 0, 0.08);
    border-radius: 10px;
    background: white;
    cursor: pointer;
    color: var(--warm-gray);
    transition: border-color 0.2s ease, background 0.2s ease, box-shadow 0.2s ease;
}
.ratio-pick:hover {
    border-color: rgba(184, 134, 11, 0.45);
}
.ratio-pick:focus-visible {
    outline: 2px solid var(--gold);
    outline-offset: 2px;
}
.ratio-pick.selected {
    border-color: var(--gold);
    background: rgba(184, 134, 11, 0.08);
    box-shadow: 0 0 0 2px rgba(184, 134, 11, 0.16);
    color: var(--charcoal);
}
.ratio-frame {
    display: block;
    background: var(--charcoal);
    opacity: 0.45;
    border-radius: 2px;
    flex-shrink: 0;
}
.ratio-pick.selected .ratio-frame {
    background: var(--gold);
    opacity: 1;
}
.ratio-frame-auto {
    width: 22px;
    height: 22px;
    background: transparent;
    opacity: 1;
    border: 1.5px dashed var(--warm-gray);
    border-radius: 4px;
}
.ratio-pick.selected .ratio-frame-auto {
    border-color: var(--gold);
    background: transparent;
}
.ratio-label {
    font-size: 0.62rem;
    font-weight: 500;
    letter-spacing: 0.03em;
    line-height: 1;
}
@media (prefers-reduced-motion: reduce) {
    .ratio-pick, .model-pick, .res-pick { transition: none; }
}

/* Loading spinner */
.spinner {
    display: inline-block;
    width: 18px;
    height: 18px;
    border: 2px solid rgba(255,255,255,0.3);
    border-top-color: white;
    border-radius: 50%;
    animation: spin 0.6s linear infinite;
}
@keyframes spin {
    to { transform: rotate(360deg); }
}

/* Result preview */
.result-area {
    min-height: 300px;
    border-radius: 12px;
    overflow: hidden;
    display: flex;
    align-items: center;
    justify-content: center;
    background: rgba(0,0,0,0.02);
    border: 1px solid rgba(0,0,0,0.06);
}
.result-area img {
    max-width: 100%;
    max-height: 600px;
    object-fit: contain;
}
/* Generating: BorderGlow-style light (mesh border + outer glow) orbiting the result box */
@property --glow-angle {
    syntax: '<angle>';
    initial-value: 0deg;
    inherits: true;
}
.result-glow {
    --glow-1: #F3D58A;
    --glow-2: #D4A843;
    --glow-3: #B8860B;
    --glow-color: 40deg 75% 52%;
    --glow-padding: 32px;
    position: relative;
    border-radius: 12px;
    isolation: isolate;
}
.result-glow::before,
.result-glow > .edge-light {
    content: '';
    position: absolute;
    border-radius: inherit;
    pointer-events: none;
    opacity: 0;
    transition: opacity 0.75s ease-in-out;
}
/* Bright border segment */
.result-glow::before {
    inset: 0;
    z-index: 3;
    padding: 2px;
    background: conic-gradient(from var(--glow-angle),
        var(--glow-1) 0%, var(--glow-2) 7%, transparent 22%,
        transparent 78%, var(--glow-3) 93%, var(--glow-1) 100%);
    -webkit-mask: linear-gradient(#000 0 0) content-box, linear-gradient(#000 0 0);
    -webkit-mask-composite: xor;
    mask-composite: exclude;
}
/* Soft glow inside and outside the border, following the same angle */
.result-glow > .edge-light {
    inset: calc(var(--glow-padding) * -1);
    z-index: 2;
    -webkit-mask-image: conic-gradient(from var(--glow-angle), black 3%, transparent 14%, transparent 86%, black 97%);
    mask-image: conic-gradient(from var(--glow-angle), black 3%, transparent 14%, transparent 86%, black 97%);
}
.result-glow > .edge-light::before {
    content: '';
    position: absolute;
    inset: var(--glow-padding);
    border-radius: 12px;
    box-shadow:
        inset 0 0 0 1px hsl(var(--glow-color) / 100%),
        inset 0 0 3px 0 hsl(var(--glow-color) / 50%),
        inset 0 0 6px 0 hsl(var(--glow-color) / 40%),
        inset 0 0 15px 0 hsl(var(--glow-color) / 30%),
        inset 0 0 25px 2px hsl(var(--glow-color) / 20%),
        inset 0 0 50px 2px hsl(var(--glow-color) / 10%),
        0 0 3px 0 hsl(var(--glow-color) / 50%),
        0 0 6px 0 hsl(var(--glow-color) / 40%),
        0 0 15px 0 hsl(var(--glow-color) / 30%),
        0 0 25px 2px hsl(var(--glow-color) / 20%),
        0 0 50px 2px hsl(var(--glow-color) / 10%);
}
.result-glow.is-generating {
    animation: glow-orbit 3.2s linear infinite;
}
.result-glow.is-generating::before,
.result-glow.is-generating > .edge-light {
    opacity: 1;
    transition: opacity 0.25s ease-out;
}
@keyframes glow-orbit {
    to { --glow-angle: 360deg; }
}
@media (prefers-reduced-motion: reduce) {
    .result-glow.is-generating { animation-duration: 10s; }
}

.result-placeholder {
    text-align: center;
    color: var(--warm-gray);
    opacity: 0.5;
}
.result-placeholder svg {
    width: 48px;
    height: 48px;
    margin-bottom: 0.5rem;
    opacity: 0.3;
}

/* Progress bar */
.progress-bar-container {
    width: 100%;
    height: 4px;
    background: rgba(0,0,0,0.06);
    border-radius: 2px;
    overflow: hidden;
}
.progress-bar-fill {
    height: 100%;
    background: linear-gradient(90deg, var(--gold), var(--gold-light));
    border-radius: 2px;
    transition: width 0.4s ease;
}

/* Gallery grid */
.gallery-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
    gap: 1rem;
}
.gallery-item {
    position: relative;
    aspect-ratio: 1;
    border-radius: 10px;
    overflow: hidden;
    cursor: pointer;
    border: 2px solid transparent;
    transition: all 0.3s ease;
}
.gallery-item img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    transition: transform 0.5s ease;
}
.gallery-item:hover img {
    transform: scale(1.03);
}
.gallery-item.selected {
    border-color: var(--gold);
    box-shadow: 0 0 0 3px rgba(184, 134, 11, 0.2);
}
.gallery-item .gallery-check {
    position: absolute;
    top: 8px;
    right: 8px;
    width: 24px;
    height: 24px;
    border-radius: 50%;
    background: rgba(255,255,255,0.8);
    border: 2px solid rgba(0,0,0,0.15);
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.3s ease;
    z-index: 2;
}
.gallery-item.selected .gallery-check {
    background: var(--gold);
    border-color: var(--gold);
    color: white;
}
.gallery-item .gallery-name {
    position: absolute;
    bottom: 0;
    left: 0;
    right: 0;
    padding: 8px 10px;
    background: linear-gradient(transparent, rgba(0,0,0,0.6));
    color: white;
    font-size: 0.7rem;
    font-weight: 500;
    opacity: 0;
    transition: opacity 0.3s ease;
}
.gallery-item:hover .gallery-name {
    opacity: 1;
}

/* Modal / Lightbox */
.lightbox {
    position: fixed;
    inset: 0;
    z-index: 100;
    background: rgba(0,0,0,0.9);
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 2rem;
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.3s ease;
}
.lightbox.open {
    opacity: 1;
    pointer-events: all;
}
#lightbox.lightbox.open,
#batchLightbox.lightbox.open {
    flex-direction: column;
}
.lightbox img {
    max-width: 90vw;
    max-height: 85vh;
    object-fit: contain;
    border-radius: 4px;
}
.lightbox-image-wrap {
    position: relative;
    display: flex;
    align-items: center;
    justify-content: center;
}
.lightbox-image-wrap > img {
    transition: filter 0.25s ease;
}
.lightbox-image-wrap.is-generating > img {
    filter: blur(10px) brightness(0.55) saturate(0.7);
}
.lightbox-image-wrap.is-generating {
    box-shadow: 0 0 0 2px rgba(212, 168, 67, 0.9), 0 0 48px rgba(184, 134, 11, 0.5);
    animation: lightbox-regen-glow 2s ease-in-out infinite;
    border-radius: 6px;
}
.lightbox-generating {
    position: absolute;
    inset: 0;
    border-radius: 4px;
    overflow: hidden;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 1.2rem;
    background: rgba(10, 10, 10, 0.35);
    pointer-events: none;
    z-index: 3;
}
.lightbox-generating.hidden { display: none; }
.lightbox-generating .batch-gen-label {
    color: rgba(255, 235, 170, 0.98);
    font-size: 1rem;
    font-weight: 600;
    letter-spacing: 0.14em;
    text-transform: uppercase;
    text-shadow: 0 2px 10px rgba(0, 0, 0, 0.6);
}
.lightbox-generating .batch-gen-spinner {
    width: 68px;
    height: 68px;
    border-width: 4px;
    border-color: rgba(212, 168, 67, 0.25);
    border-top-color: rgb(230, 190, 100);
    box-shadow: 0 0 24px rgba(212, 168, 67, 0.4);
}
@keyframes lightbox-regen-glow {
    0%, 100% { box-shadow: 0 0 0 2px rgba(212, 168, 67, 0.7), 0 0 32px rgba(184, 134, 11, 0.35); }
    50%      { box-shadow: 0 0 0 3px rgba(230, 190, 100, 1),   0 0 60px rgba(212, 168, 67, 0.7); }
}
.lightbox-close {
    position: absolute;
    top: 1.5rem;
    right: 1.5rem;
    width: 40px;
    height: 40px;
    border-radius: 50%;
    background: rgba(255,255,255,0.1);
    color: white;
    border: none;
    cursor: pointer;
    font-size: 1.2rem;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: background 0.3s ease;
}
.lightbox-close:hover {
    background: rgba(255,255,255,0.2);
}

/* Lightbox navigation arrows */
.lightbox-nav {
    position: absolute;
    top: 50%;
    transform: translateY(-50%);
    width: 52px;
    height: 52px;
    border-radius: 50%;
    background: rgba(255,255,255,0.08);
    backdrop-filter: blur(8px);
    color: white;
    border: 1px solid rgba(255,255,255,0.15);
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: background 0.2s ease, transform 0.2s ease;
    z-index: 2;
}
.lightbox-nav:hover:not(:disabled) {
    background: rgba(255,255,255,0.2);
    transform: translateY(-50%) scale(1.05);
}
.lightbox-nav:disabled {
    opacity: 0.25;
    cursor: default;
}
.lightbox-nav .lucide,
.lightbox-nav svg {
    width: 28px;
    height: 28px;
    stroke-width: 1.6;
}
.lightbox-nav-prev { left: 1.5rem; }
.lightbox-nav-next { right: 1.5rem; }

/* Lightbox toolbar */
.lightbox-toolbar {
    position: absolute;
    bottom: 2rem;
    left: 50%;
    transform: translateX(-50%);
    display: flex;
    align-items: center;
    gap: 0.75rem;
    padding: 0.6rem 1rem;
    background: rgba(20,20,20,0.7);
    backdrop-filter: blur(12px);
    border: 1px solid rgba(255,255,255,0.12);
    border-radius: 999px;
    z-index: 2;
}
.lightbox-action {
    width: 38px;
    height: 38px;
    border-radius: 50%;
    background: rgba(255,255,255,0.06);
    color: white;
    border: none;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    text-decoration: none;
    transition: background 0.15s ease, color 0.15s ease;
}
.lightbox-action:hover {
    background: rgba(184, 134, 11, 0.35);
    color: #fff3cd;
}
.lightbox-action.hidden { display: none; }
.lightbox-action .lucide,
.lightbox-action svg {
    width: 18px;
    height: 18px;
    stroke-width: 1.7;
}
.lightbox-counter {
    color: rgba(255,255,255,0.7);
    font-size: 0.75rem;
    letter-spacing: 0.06em;
    padding: 0 0.5rem;
    font-variant-numeric: tabular-nums;
}

/* Compare view */
.compare-container {
    display: flex;
    gap: 1rem;
    overflow-x: auto;
    padding: 1rem 0;
}
.compare-container img {
    max-height: 70vh;
    border-radius: 8px;
    flex-shrink: 0;
}

/* Batch queue */
.queue-item {
    display: flex;
    align-items: center;
    gap: 1rem;
    padding: 0.75rem 1rem;
    background: white;
    border: 1px solid rgba(0,0,0,0.06);
    border-radius: 8px;
    margin-bottom: 0.5rem;
    transition: all 0.3s ease;
}
.queue-item .queue-thumb {
    width: 48px;
    height: 48px;
    border-radius: 6px;
    object-fit: cover;
    flex-shrink: 0;
}
.queue-item .queue-info {
    flex: 1;
    font-size: 0.8rem;
}
.queue-item .queue-status {
    font-size: 0.7rem;
    text-transform: uppercase;
    letter-spacing: 0.1em;
    font-weight: 600;
}
.queue-item .queue-status.pending { color: var(--warm-gray); }
.queue-item .queue-status.running { color: var(--gold); }
.queue-item .queue-status.done { color: #27AE60; }
.queue-item .queue-status.error { color: #C0392B; }
.queue-item .queue-remove {
    background: none;
    border: none;
    color: var(--warm-gray);
    cursor: pointer;
    font-size: 1.1rem;
    padding: 4px;
    transition: color 0.2s;
}
.queue-item .queue-remove:hover { color: #C0392B; }

/* Toast notification */
.toast {
    position: fixed;
    bottom: 2rem;
    right: 2rem;
    padding: 0.75rem 1.25rem;
    border-radius: 8px;
    font-size: 0.85rem;
    font-weight: 500;
    z-index: 200;
    transform: translateY(20px);
    opacity: 0;
    transition: all 0.3s ease;
    max-width: 400px;
}
.toast.show {
    transform: translateY(0);
    opacity: 1;
}
.toast.success {
    background: #27AE60;
    color: white;
}
.toast.error {
    background: #C0392B;
    color: white;
}

/* Animations */
@keyframes fadeInUp {
    from { opacity: 0; transform: translateY(12px); }
    to { opacity: 1; transform: translateY(0); }
}
.fade-in-up {
    animation: fadeInUp 0.5s ease forwards;
}
.fade-in-up-delay-1 { animation-delay: 0.1s; opacity: 0; }
.fade-in-up-delay-2 { animation-delay: 0.2s; opacity: 0; }
.fade-in-up-delay-3 { animation-delay: 0.3s; opacity: 0; }

/* Style Presets (F5) */
.style-presets {
    display: flex;
    gap: 0.5rem;
    flex-wrap: wrap;
}
.style-preset-btn {
    padding: 0.4rem 0.9rem;
    border-radius: 20px;
    font-size: 0.75rem;
    font-weight: 500;
    letter-spacing: 0.05em;
    text-transform: uppercase;
    border: 1.5px solid rgba(0,0,0,0.1);
    background: white;
    color: var(--warm-gray);
    cursor: pointer;
    transition: all 0.3s ease;
}
.style-preset-btn:hover {
    border-color: var(--gold);
    color: var(--gold);
}
.style-preset-btn.active {
    background: var(--gold);
    border-color: var(--gold);
    color: white;
}

/* Photography Style Toggle */
.style-toggle {
    display: flex;
    gap: 0;
    border-radius: 8px;
    overflow: hidden;
    border: 1.5px solid rgba(0,0,0,0.1);
    background: white;
}
.style-toggle-btn {
    flex: 1;
    padding: 0.6rem 1rem;
    font-size: 0.8rem;
    font-weight: 600;
    letter-spacing: 0.03em;
    border: none;
    background: white;
    color: var(--warm-gray);
    cursor: pointer;
    transition: all 0.3s ease;
}
.style-toggle-btn:not(:last-child) {
    border-right: 1.5px solid rgba(0,0,0,0.1);
}
.style-toggle-btn:hover {
    color: var(--gold);
    background: rgba(184, 134, 11, 0.05);
}
.style-toggle-btn.active {
    background: var(--gold);
    color: white;
}

/* Outfit Chips */
.outfit-chips {
    display: flex;
    gap: 0.5rem;
    flex-wrap: wrap;
}
.outfit-chip {
    padding: 0.35rem 0.8rem;
    border-radius: 20px;
    font-size: 0.7rem;
    font-weight: 500;
    letter-spacing: 0.04em;
    border: 1.5px solid rgba(0,0,0,0.1);
    background: white;
    color: var(--warm-gray);
    cursor: pointer;
    transition: all 0.3s ease;
}
.outfit-chip:hover {
    border-color: var(--gold);
    color: var(--gold);
}
.outfit-chip.active {
    background: var(--charcoal);
    border-color: var(--charcoal);
    color: white;
}

.outfit-chip .color-dot {
    display: inline-block;
    width: 10px;
    height: 10px;
    border-radius: 50%;
    vertical-align: middle;
    margin-right: 2px;
}

.outfit-chip.active .color-dot {
    border-color: rgba(255,255,255,0.4) !important;
}

/* A/B Comparison (F2) */
.compare-ab {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 1rem;
    width: 100%;
}
.compare-ab-item {
    text-align: center;
}
.compare-ab-label {
    font-size: 0.75rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.1em;
    color: var(--warm-gray);
    margin-bottom: 0.5rem;
}
.compare-ab-item img {
    width: 100%;
    border-radius: 8px;
    max-height: 500px;
    object-fit: contain;
}

/* Dark spinner for secondary buttons */
.spinner-dark {
    border-color: rgba(0,0,0,0.15);
    border-top-color: var(--charcoal);
}

/* Gallery Favorites (F9) */
.gallery-fav {
    position: absolute;
    top: 8px;
    left: 8px;
    width: 28px;
    height: 28px;
    border-radius: 50%;
    background: rgba(255,255,255,0.8);
    border: none;
    cursor: pointer;
    font-size: 1rem;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.3s ease;
    z-index: 2;
    color: var(--warm-gray);
    line-height: 1;
}
.gallery-fav:hover {
    background: rgba(255,255,255,0.95);
    color: #E74C3C;
}
.gallery-fav.active {
    color: #E74C3C;
    background: rgba(255,255,255,0.9);
}

/* Reference images preview (F6) */
.ref-preview-grid {
    display: flex;
    gap: 0.5rem;
    flex-wrap: wrap;
}
.ref-preview-item {
    position: relative;
    width: 88px;
    border-radius: 6px;
    overflow: visible;
}
.ref-preview-item img {
    width: 88px;
    height: 72px;
    object-fit: cover;
    display: block;
    border-radius: 6px;
    border: 1px solid rgba(0,0,0,0.1);
}
.ref-role {
    width: 100%;
    margin-top: 4px;
    font-size: 0.65rem;
    letter-spacing: 0.02em;
    color: var(--charcoal);
    background: white;
    border: 1px solid rgba(0,0,0,0.12);
    border-radius: 4px;
    padding: 2px 4px;
}
.ref-preview-item .ref-remove {
    position: absolute;
    top: 2px;
    right: 2px;
    width: 18px;
    height: 18px;
    border-radius: 50%;
    background: rgba(0,0,0,0.5);
    color: white;
    border: none;
    cursor: pointer;
    font-size: 0.7rem;
    display: flex;
    align-items: center;
    justify-content: center;
    line-height: 1;
}
.upload-zone-sm {
    padding: 1rem;
}
.upload-zone-sm .upload-icon {
    font-size: 1.2rem;
    margin-bottom: 0.25rem;
}

/* Favorite filter button active state */
#favFilterBtn.active {
    background: var(--gold);
    border-color: var(--gold);
    color: white;
}

/* Result content wrapper */
.result-content {
    width: 100%;
    padding: 0.5rem;
}

.fidelity-compare {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 0.75rem;
    margin-top: 0.85rem;
}
.fidelity-compare-label {
    font-size: 0.65rem;
    font-weight: 600;
    letter-spacing: 0.08em;
    text-transform: uppercase;
    color: var(--warm-gray);
    margin-bottom: 0.35rem;
}
.fidelity-compare img {
    width: 100%;
    max-height: 160px;
    object-fit: contain;
    background: rgba(0,0,0,0.03);
    border-radius: 6px;
    border: 1px solid rgba(0,0,0,0.06);
}
.fidelity-note {
    font-size: 0.75rem;
    line-height: 1.4;
    color: #9a3412;
    margin-top: 0.65rem;
}
.edit-watch-lock:not(.hidden) {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    margin-bottom: 0.85rem;
}
.edit-watch-lock img {
    width: 72px;
    height: 72px;
    object-fit: contain;
    border-radius: 8px;
    border: 1px solid rgba(0, 0, 0, 0.08);
    background: rgba(0, 0, 0, 0.03);
}
.edit-watch-lock p {
    font-size: 0.72rem;
    font-weight: 600;
    letter-spacing: 0.06em;
    text-transform: uppercase;
    color: var(--warm-gray);
}
.edit-chip-hint {
    font-size: 0.75rem;
    line-height: 1.4;
    color: var(--warm-gray);
    margin: 0 0 0.6rem;
}
@media (max-width: 640px) {
    .edit-watch-lock img {
        width: 56px;
        height: 56px;
    }
}
@media (max-width: 640px) {
    .fidelity-compare {
        grid-template-columns: 1fr 1fr;
        gap: 0.5rem;
    }
    .fidelity-compare img {
        max-height: 120px;
    }
}

/* Generate model button */
.thumb-generate {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    border: 2px dashed rgba(184, 134, 11, 0.4);
    background: rgba(184, 134, 11, 0.05);
    cursor: pointer;
}
.thumb-generate:hover {
    border-color: var(--gold);
    background: rgba(184, 134, 11, 0.1);
}
.thumb-generate.generating {
    pointer-events: none;
    opacity: 0.7;
}
.thumb-generate-icon {
    font-size: 2rem;
    color: var(--gold);
    line-height: 1;
}
/* Section subtitle row with settings */
.section-subtitle-row {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    margin-bottom: 0.75rem;
    position: relative;
}

.modelli-settings-btn {
    width: 26px;
    height: 26px;
    border-radius: 50%;
    background: transparent;
    border: 1.5px solid rgba(0,0,0,0.1);
    cursor: pointer;
    font-size: 0.9rem;
    display: flex;
    align-items: center;
    justify-content: center;
    color: var(--warm-gray);
    line-height: 1;
    transition: all 0.2s ease;
}
.modelli-settings-btn:hover {
    border-color: var(--gold);
    color: var(--gold);
}

.modelli-settings-popover {
    position: absolute;
    top: 100%;
    left: 0;
    margin-top: 0.35rem;
    background: white;
    border: 1px solid rgba(0,0,0,0.1);
    border-radius: 10px;
    padding: 0.75rem;
    z-index: 10;
    box-shadow: 0 6px 20px rgba(0,0,0,0.1);
    min-width: 180px;
    display: flex;
    flex-direction: column;
    gap: 0.6rem;
}
.modelli-settings-field label {
    font-size: 0.65rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.1em;
    color: var(--warm-gray);
    display: block;
    margin-bottom: 0.2rem;
}
.modelli-settings-field .form-select {
    font-size: 0.75rem;
    padding: 0.35rem 0.5rem;
}

/* Delete icon on thumb items */
.thumb-delete {
    position: absolute;
    top: 4px;
    right: 4px;
    width: 22px;
    height: 22px;
    border-radius: 50%;
    background: rgba(0,0,0,0.5);
    color: white;
    border: none;
    cursor: pointer;
    font-size: 0.9rem;
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 3;
    line-height: 1;
    opacity: 0;
    transition: opacity 0.2s ease, background 0.2s ease;
}
.thumb-item:hover .thumb-delete {
    opacity: 1;
}
.thumb-delete:hover {
    background: #C0392B;
}

/* Don't show delete on generate button */
.thumb-generate .thumb-delete {
    display: none;
}

.spinner-small {
    display: inline-block;
    width: 1.5rem;
    height: 1.5rem;
    border: 2px solid rgba(184, 134, 11, 0.3);
    border-top-color: var(--gold);
    border-radius: 50%;
    animation: spin 0.8s linear infinite;
}

/* Batch mode radios */
.batch-mode-radios {
    display: flex;
    gap: 0.75rem;
    flex-wrap: wrap;
}
.batch-mode-label {
    display: flex;
    align-items: center;
    gap: 0.35rem;
    font-size: 0.8rem;
    color: var(--warm-gray);
    cursor: pointer;
    transition: color 0.2s;
}
.batch-mode-label input[type="radio"] {
    accent-color: var(--gold);
}
.batch-mode-label:has(input:checked) span {
    color: var(--charcoal);
    font-weight: 600;
}

/* Form checkbox */
.form-checkbox {
    accent-color: var(--gold);
    width: 1rem;
    height: 1rem;
    cursor: pointer;
}

/* Batch job cards */
.batch-job-card {
    background: var(--glass-bg);
    border: 1px solid var(--glass-border);
    border-radius: 12px;
    padding: 1.25rem;
    cursor: pointer;
    transition: all 0.2s;
}
.batch-job-card:hover {
    border-color: var(--gold-light);
    box-shadow: 0 4px 12px rgba(184, 134, 11, 0.1);
}
.batch-job-card-header {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    margin-bottom: 0.5rem;
}

/* Batch table layout */
.batch-table-header {
    display: grid;
    grid-template-columns: 44px 160px 1fr 1fr;
    gap: 1px;
    background: var(--glass-border);
    border-radius: 10px 10px 0 0;
    overflow: hidden;
    margin-bottom: 1px;
}
.batch-th {
    background: rgba(184, 134, 11, 0.08);
    padding: 0.6rem 1rem;
    font-size: 0.75rem;
    font-weight: 600;
    color: var(--warm-gray);
    text-transform: uppercase;
    letter-spacing: 0.04em;
}
.batch-th-select {
    padding: 0.6rem 0;
    display: flex;
    align-items: center;
    justify-content: center;
}
.batch-item-row {
    display: grid;
    grid-template-columns: 44px 160px 1fr 1fr;
    gap: 1px;
    background: var(--glass-border);
    margin-bottom: 1px;
    transition: background-color 150ms ease, box-shadow 150ms ease;
    position: relative;
}
.batch-item-row.is-selected {
    box-shadow: inset 3px 0 0 0 rgba(184, 134, 11, 0.9);
}
.batch-item-row.is-selected .batch-cell {
    background: rgba(184, 134, 11, 0.07);
}
.batch-cell-select {
    background: var(--glass-bg);
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 0;
}
/* Lucide icon sizing */
.lucide-sm { width: 14px; height: 14px; }
.lucide-xs { width: 12px; height: 12px; }
.batch-action-link .lucide,
.batch-action-link svg {
    width: 16px;
    height: 16px;
    stroke-width: 1.8;
}
.batch-item-remove .lucide,
.batch-item-remove svg {
    width: 14px;
    height: 14px;
}
.batch-gen-icon-lucide {
    width: 22px;
    height: 22px;
    stroke-width: 1.6;
}
.batch-row-checkbox,
.batch-selectall-checkbox {
    width: 18px;
    height: 18px;
    cursor: pointer;
    accent-color: rgb(184, 134, 11);
    margin: 0;
}

/* Loading state for job detail */
.batch-loading {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 4rem 1rem;
    gap: 0.5rem;
}

/* Generating animation */
.batch-cell-generating {
    position: relative;
    width: 180px;
    height: 180px;
    border-radius: 12px;
    overflow: hidden;
    background: linear-gradient(135deg, rgba(184, 134, 11, 0.08), rgba(184, 134, 11, 0.03));
    border: 1px solid rgba(184, 134, 11, 0.25);
    display: flex;
    align-items: center;
    justify-content: center;
    flex-direction: column;
    gap: 0.6rem;
}
.batch-gen-shimmer {
    position: absolute;
    top: 0;
    left: 0;
    width: 60%;
    height: 100%;
    background: linear-gradient(
        100deg,
        transparent 0%,
        rgba(184, 134, 11, 0.0) 20%,
        rgba(184, 134, 11, 0.22) 50%,
        rgba(184, 134, 11, 0.0) 80%,
        transparent 100%
    );
    pointer-events: none;
    transform: translate3d(-100%, 0, 0);
    animation: batch-shimmer 1.8s cubic-bezier(0.4, 0, 0.2, 1) infinite;
    will-change: transform;
}
.batch-gen-spinner {
    position: relative;
    width: 32px;
    height: 32px;
    border-radius: 50%;
    border: 2.5px solid rgba(184, 134, 11, 0.2);
    border-top-color: rgb(184, 134, 11);
    animation: batch-spin 0.9s linear infinite;
    z-index: 1;
}
.batch-gen-label {
    position: relative;
    z-index: 1;
    font-size: 0.75rem;
    letter-spacing: 0.06em;
    text-transform: uppercase;
    color: rgb(140, 100, 8);
    font-weight: 500;
    animation: batch-pulse 1.6s ease-in-out infinite;
}
@keyframes batch-shimmer {
    0%   { transform: translate3d(-100%, 0, 0); }
    100% { transform: translate3d(250%, 0, 0); }
}
@keyframes batch-spin {
    to { transform: rotate(360deg); }
}
@keyframes batch-pulse {
    0%, 100% { opacity: 0.55; }
    50% { opacity: 1; }
}
.batch-item-row:last-child {
    border-radius: 0 0 10px 10px;
    overflow: hidden;
}
.batch-cell {
    background: var(--glass-bg);
    padding: 0.75rem;
    min-height: 100px;
    display: flex;
    align-items: flex-start;
    justify-content: center;
}
.batch-cell-watch {
    flex-direction: column;
    align-items: center;
    gap: 0.4rem;
    position: relative;
}
.batch-watch-img {
    width: 80px;
    height: 80px;
    object-fit: cover;
    border-radius: 8px;
    border: 1px solid rgba(0,0,0,0.06);
    cursor: pointer;
    transition: transform 0.2s, box-shadow 0.2s;
}
.batch-watch-img:hover {
    transform: scale(1.05);
    box-shadow: 0 4px 12px rgba(0,0,0,0.1);
}
.batch-watch-name {
    font-size: 0.7rem;
    color: var(--warm-gray);
    max-width: 130px;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    text-align: center;
}
.batch-item-remove {
    position: absolute;
    top: 2px;
    right: 2px;
    background: none;
    border: none;
    font-size: 1rem;
    color: var(--warm-gray);
    cursor: pointer;
    opacity: 0;
    transition: opacity 0.2s, color 0.2s;
    padding: 2px 5px;
    line-height: 1;
}
.batch-cell-watch:hover .batch-item-remove { opacity: 1; }
.batch-item-remove:hover { color: #ef4444; }

/* Generate button in empty cell */
.batch-cell-empty {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 100%;
    height: 100%;
}
.batch-gen-btn {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 0.3rem;
    padding: 1rem 1.5rem;
    border: 2px dashed var(--glass-border);
    border-radius: 10px;
    background: transparent;
    color: var(--warm-gray);
    font-size: 0.75rem;
    cursor: pointer;
    transition: all 0.2s;
}
.batch-gen-btn:hover {
    border-color: var(--gold-light);
    color: var(--gold);
    background: rgba(184, 134, 11, 0.04);
}
.batch-gen-btn:disabled {
    opacity: 0.5;
    cursor: wait;
}
.batch-gen-icon {
    font-size: 1.5rem;
    line-height: 1;
}

/* Cell with generated image */
.batch-cell-content {
    width: 100%;
}
.batch-cell-main {
    position: relative;
    max-width: 240px;
}
.batch-cell-generating.batch-cell-overlay {
    position: absolute;
    inset: 0;
    width: auto;
    height: auto;
    border-radius: 8px;
    background: rgba(250, 247, 240, 0.72);
    z-index: 1;
}
.batch-regen-btn:disabled {
    opacity: 0.4;
    cursor: not-allowed;
}
.batch-cell-img {
    width: 100%;
    max-width: 240px;
    border-radius: 8px;
    cursor: pointer;
    transition: transform 0.2s, box-shadow 0.2s;
}
.batch-cell-img:hover {
    transform: scale(1.02);
    box-shadow: 0 4px 16px rgba(0,0,0,0.12);
}
.batch-cell-actions {
    display: flex;
    gap: 0.5rem;
    margin-top: 0.4rem;
}
.batch-action-link {
    font-size: 0.85rem;
    color: var(--warm-gray);
    background: none;
    border: none;
    cursor: pointer;
    padding: 2px 6px;
    border-radius: 4px;
    transition: all 0.15s;
    text-decoration: none;
}
.batch-action-link:hover {
    color: var(--gold);
    background: rgba(184, 134, 11, 0.08);
}
.batch-review-btn.is-approved { color: #2f7d4a; }
.batch-review-btn.is-rejected { color: #b42318; }
.batch-cell-content.is-approved .batch-cell-img,
.batch-edit-row.is-approved .batch-edit-mini {
    box-shadow: 0 0 0 2px #2f7d4a;
}
.batch-cell-content.is-rejected .batch-cell-img,
.batch-edit-row.is-rejected .batch-edit-mini {
    box-shadow: 0 0 0 2px #b42318;
    opacity: 0.6;
}

/* Edit history */
.batch-edits {
    margin-top: 0.5rem;
    padding-top: 0.5rem;
    border-top: 1px dashed rgba(0,0,0,0.08);
    display: flex;
    flex-direction: column;
    gap: 0.4rem;
}
.batch-edit-row {
    display: flex;
    align-items: flex-end;
    gap: 0.5rem;
}
.batch-edit-mini {
    width: 80px;
    height: 80px;
    object-fit: cover;
    border-radius: 6px;
    cursor: pointer;
    transition: transform 0.2s;
}
.batch-edit-mini:hover {
    transform: scale(1.08);
}

/* Zoomable cursor */
.batch-zoomable {
    cursor: zoom-in;
}

/* Batch action bar */
.batch-action-bar {
    position: sticky;
    bottom: 1rem;
    background: var(--glass-bg);
    backdrop-filter: blur(20px);
    border: 1px solid var(--glass-border);
    border-radius: 12px;
    padding: 1rem;
    margin-top: 1.5rem;
}
@keyframes spin {
    to { transform: rotate(360deg); }
}

a.kie-header {
    display: inline-flex;
    align-items: center;
    gap: 0.4rem;
    font-size: 0.7rem;
    font-weight: 500;
    letter-spacing: 0.04em;
    white-space: nowrap;
    text-decoration: none;
    padding: 0.28rem 0.65rem 0.28rem 0.5rem;
    border-radius: 999px;
    border: 1px solid rgba(0, 0, 0, 0.08);
    color: var(--warm-gray);
    line-height: 1.2;
}
a.kie-header .kie-dot {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    flex-shrink: 0;
    background: #dc2626;
}
a.kie-header.kie-ok {
    color: var(--charcoal);
    border-color: rgba(22, 163, 74, 0.35);
    background: rgba(22, 163, 74, 0.08);
}
a.kie-header.kie-ok .kie-dot {
    background: #16a34a;
    box-shadow: 0 0 0 3px rgba(22, 163, 74, 0.22);
}
a.kie-header.kie-off {
    color: #991b1b;
    border-color: rgba(220, 38, 38, 0.28);
    background: rgba(220, 38, 38, 0.08);
}
a.kie-header.kie-off .kie-dot {
    background: #dc2626;
    box-shadow: 0 0 0 3px rgba(220, 38, 38, 0.18);
}

/* Settings — AI labels */
.settings-layout {
    display: grid;
    grid-template-columns: 1fr;
    gap: 2rem;
}
@media (min-width: 900px) {
    .settings-layout {
        grid-template-columns: minmax(16rem, 22rem) 1fr;
        gap: 2.5rem;
        align-items: start;
    }
}
.settings-field-label {
    font-size: 0.75rem;
    font-weight: 500;
    letter-spacing: 0.08em;
    text-transform: uppercase;
    color: var(--warm-gray);
    margin-bottom: 0.75rem;
}
.label-picker {
    display: grid;
    grid-template-columns: repeat(4, minmax(0, 1fr));
    gap: 0.5rem;
    max-width: 22rem;
    min-height: 10rem;
}
.label-pick {
    aspect-ratio: 1;
    border-radius: 10px;
    border: 2px solid transparent;
    padding: 0.55rem;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: border-color 0.2s ease, box-shadow 0.2s ease;
}
.label-pick img {
    width: 100%;
    height: 100%;
    object-fit: contain;
    pointer-events: none;
}
.label-pick-light { background: var(--cream); }
.label-pick-dark { background: var(--charcoal); }
.label-pick:hover { border-color: rgba(184, 134, 11, 0.4); }
.label-pick.selected {
    border-color: var(--gold);
    box-shadow: 0 0 0 3px rgba(184, 134, 11, 0.2);
}
.label-pick:focus-visible {
    outline: 2px solid var(--gold);
    outline-offset: 2px;
}
.label-corners {
    display: grid;
    grid-template-columns: 2.5rem 2.5rem;
    gap: 0.4rem;
    width: fit-content;
    padding: 0.5rem;
    border: 1px solid rgba(0, 0, 0, 0.08);
    border-radius: 10px;
    background: rgba(245, 240, 235, 0.5);
}
.label-corner-btn {
    width: 2.5rem;
    height: 2.5rem;
    border-radius: 6px;
    border: 1px solid rgba(0, 0, 0, 0.1);
    background: white;
    cursor: pointer;
    position: relative;
}
.label-corner-btn::after {
    content: '';
    position: absolute;
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background: var(--charcoal);
    opacity: 0.35;
}
.label-corner-btn[data-corner="top_left"]::after { top: 6px; left: 6px; }
.label-corner-btn[data-corner="top_right"]::after { top: 6px; right: 6px; }
.label-corner-btn[data-corner="bottom_left"]::after { bottom: 6px; left: 6px; }
.label-corner-btn[data-corner="bottom_right"]::after { bottom: 6px; right: 6px; }
.label-corner-btn.active {
    border-color: var(--gold);
    box-shadow: 0 0 0 2px rgba(184, 134, 11, 0.25);
}
.label-corner-btn.active::after { background: var(--gold); opacity: 1; }
.label-corner-btn:focus-visible {
    outline: 2px solid var(--gold);
    outline-offset: 2px;
}
#scaleSlider {
    width: 100%;
    accent-color: var(--gold);
}
.label-stage {
    position: relative;
    display: block;
    overflow: hidden;
}
#labelStage {
    width: 100%;
    max-width: 26rem;
    aspect-ratio: 1;
    background: #ece7e1;
    border-radius: 12px;
}
#labelStage .label-demo-photo {
    width: 100%;
    height: 100%;
    object-fit: contain;
    display: block;
}
#resultStage {
    width: 100%;
    background: #ece7e1;
    border-radius: 12px;
}
#resultStage img {
    width: 100%;
    height: auto;
    display: block;
}
.lightbox-stage {
    max-width: min(90vw, 900px);
    margin: 0 auto;
    background: transparent;
}
.lightbox .label-overlay {
    max-width: none;
    max-height: none;
    border-radius: 0;
}
.label-overlay {
    position: absolute;
    pointer-events: none;
    z-index: 1;
    height: auto;
}
.label-toolbar {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 0.5rem;
    margin-top: 0.75rem;
}
.label-toolbar .form-select {
    width: auto;
    min-width: 7.5rem;
    padding: 0.4rem 1.75rem 0.4rem 0.6rem;
    font-size: 0.75rem;
}
.label-toolbar .btn-primary,
.label-toolbar .btn-secondary {
    padding: 0.45rem 0.9rem;
    font-size: 0.7rem;
}
.label-scale-wrap {
    display: flex;
    align-items: center;
    gap: 0.35rem;
    font-size: 0.75rem;
    color: var(--warm-gray);
}
.label-scale-wrap input[type="range"] {
    width: 6rem;
    accent-color: var(--gold);
}
.lightbox .label-toolbar {
    max-width: min(720px, 92vw);
    margin: 0.75rem auto 0;
    background: var(--glass-bg);
    padding: 0.6rem 0.75rem;
    border-radius: 12px;
}
@media (prefers-reduced-motion: reduce) {
    .label-pick, .label-corner-btn { transition: none; }
}

/* Diametri page */
.sizes-head {
    display: flex;
    flex-wrap: wrap;
    align-items: baseline;
    justify-content: space-between;
    gap: 0.5rem 1rem;
}
.sizes-search {
    width: 100%;
    max-width: 260px;
    padding: 0.45rem 0.75rem;
    border: 1px solid rgba(0,0,0,0.1);
    border-radius: 8px;
    font-size: 0.85rem;
    background: white;
}
.sizes-search:focus { outline: none; border-color: var(--gold); box-shadow: 0 0 0 3px rgba(184,134,11,0.15); }
.sizes-group {
    font-size: 0.75rem;
    letter-spacing: 0.08em;
    text-transform: uppercase;
    color: var(--warm-gray);
    margin: 1.25rem 0 0.6rem;
}
.sizes-group:first-child { margin-top: 0; }
.sizes-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(150px, 1fr));
    gap: 0.9rem;
}
.sizes-card {
    display: flex;
    flex-direction: column;
    gap: 0.45rem;
    padding: 0.6rem;
    border: 1px solid rgba(0,0,0,0.06);
    border-radius: 10px;
    background: rgba(0,0,0,0.015);
    min-width: 0;
}
.sizes-card img {
    width: 100%;
    aspect-ratio: 1;
    object-fit: cover;
    border-radius: 6px;
    background: white;
}
.sizes-name {
    font-size: 0.78rem;
    color: var(--charcoal);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}
.sizes-state { min-height: 1rem; font-size: 0.7rem; color: var(--warm-gray); }
.sizes-state-ok { color: #3f7d4e; }
.sizes-state-warn { color: #b45309; }
.sizes-state-error { color: #b91c1c; }

/* Generate page: case diameter + size check */
.watch-size-field {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    margin-top: 0.75rem;
    font-size: 0.8rem;
    color: var(--warm-gray);
}
.watch-size-field select {
    width: 9rem;
    padding: 0.4rem 0.55rem;
    border: 1px solid rgba(0,0,0,0.12);
    border-radius: 6px;
    font-size: 0.85rem;
    background: white;
    color: var(--charcoal);
}
.watch-size-field select:focus { outline: none; border-color: var(--gold); box-shadow: 0 0 0 3px rgba(184,134,11,0.15); }
.pose-size-note { font-size: 0.75rem; color: var(--warm-gray); margin-top: 0.5rem; }
.pose-size-note.is-warn { color: #b45309; }
.size-check {
    margin-top: 0.6rem;
    padding: 0.5rem 0.7rem;
    border-radius: 8px;
    font-size: 0.8rem;
    background: rgba(0,0,0,0.03);
    color: var(--warm-gray);
}
.size-check.is-off {
    background: #fffbeb;
    border: 1px solid #fde68a;
    color: #92400e;
}
.batch-watch-mm {
    display: flex;
    align-items: center;
    gap: 0.3rem;
    margin-top: 0.35rem;
    font-size: 0.7rem;
    color: var(--warm-gray);
}
.batch-watch-mm select {
    width: 6rem;
    padding: 0.25rem 0.4rem;
    border: 1px solid rgba(0,0,0,0.12);
    border-radius: 6px;
    font-size: 0.8rem;
    background: white;
}
.batch-watch-mm select:focus { outline: none; border-color: var(--gold); }

/* Diametri: zoomable thumbnails + lightbox */
.sizes-thumb { cursor: zoom-in; transition: opacity 0.2s ease; }
.sizes-thumb:hover { opacity: 0.85; }
.sizes-thumb:focus-visible { outline: 2px solid var(--gold); outline-offset: 2px; }
.sizes-lightbox { flex-direction: column; gap: 0.75rem; }
.sizes-zoom {
    max-width: 92vw;
    max-height: 84vh;
    overflow: hidden;
    border-radius: 6px;
    display: flex;
    align-items: center;
    justify-content: center;
}
.sizes-zoom img {
    max-width: 92vw;
    max-height: 84vh;
    object-fit: contain;
    cursor: zoom-in;
    transition: transform 0.2s ease;
    user-select: none;
}
.sizes-zoom.is-zoomed img { cursor: zoom-out; transition: transform 0.12s ease-out; }
.sizes-zoom-hint {
    color: rgba(255,255,255,0.7);
    font-size: 0.8rem;
    text-align: center;
}
.sizes-select {
    width: 100%;
    padding: 0.35rem 0.5rem;
    border: 1px solid rgba(0,0,0,0.12);
    border-radius: 6px;
    font-size: 0.82rem;
    background: white;
    color: var(--charcoal);
}
.sizes-select:focus { outline: none; border-color: var(--gold); box-shadow: 0 0 0 3px rgba(184,134,11,0.15); }
.sizes-select:disabled { background: rgba(0,0,0,0.03); color: var(--warm-gray); }
.sizes-zoom-bar {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    justify-content: center;
    gap: 0.5rem 1rem;
    max-width: 92vw;
    padding: 0.55rem 0.9rem;
    border-radius: 10px;
    background: rgba(255,255,255,0.1);
    color: white;
}
.sizes-zoom-title {
    font-size: 0.85rem;
    max-width: 40ch;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}
.sizes-zoom-field {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    font-size: 0.8rem;
    color: rgba(255,255,255,0.75);
}
.sizes-zoom-field[hidden] { display: none; }
.sizes-zoom-field .sizes-select { width: 11rem; }
.sizes-zoom-state { font-size: 0.75rem; min-height: 1rem; color: rgba(255,255,255,0.7); }
.sizes-zoom-state.sizes-state-ok { color: #86efac; }
.sizes-zoom-state.sizes-state-warn { color: #fcd34d; }
.sizes-zoom-state.sizes-state-error { color: #fca5a5; }

/* Settings: pose library */
.pose-lib-head {
    display: flex;
    flex-wrap: wrap;
    align-items: flex-start;
    justify-content: space-between;
    gap: 0.75rem 1rem;
    margin-bottom: 1rem;
}
.pose-lib-zip { text-decoration: none; white-space: nowrap; }
.pose-lib-tabs { margin-bottom: 1rem; }
.pose-lib-count { font-weight: 400; opacity: 0.8; }
.pose-lib-upload { padding: 1.5rem 1rem; }
.pose-lib-upload.is-busy { opacity: 0.6; pointer-events: none; }
.pose-lib-upload:focus-visible { outline: 2px solid var(--gold); outline-offset: 2px; }
.pose-lib-report {
    margin-top: 0.75rem;
    padding: 0.6rem 0.8rem;
    border-radius: 8px;
    font-size: 0.8rem;
    background: rgba(0,0,0,0.03);
    color: var(--warm-gray);
    overflow-wrap: anywhere;
}
.pose-lib-report.is-ok { background: #f0fdf4; color: #166534; }
.pose-lib-report.is-warn { background: #fffbeb; color: #92400e; }
.pose-lib-report.is-error { background: #fef2f2; color: #991b1b; }
.pose-lib-size { font-size: 0.72rem; color: var(--warm-gray); text-decoration: none; }
.pose-lib-size:hover { color: var(--gold); text-decoration: underline; }
.pose-lib-size.is-warn { color: #b45309; }
.pose-lib-actions { display: flex; flex-wrap: wrap; gap: 0.35rem; }
.pose-lib-btn {
    flex: 1;
    padding: 0.3rem 0.5rem;
    border-radius: 6px;
    border: 1px solid rgba(0,0,0,0.12);
    background: white;
    font-size: 0.75rem;
    color: var(--charcoal);
    cursor: pointer;
}
.pose-lib-btn:hover:not(:disabled) { border-color: var(--charcoal); }
.pose-lib-btn.is-danger { color: #b91c1c; border-color: rgba(185,28,28,0.3); }
.pose-lib-btn.is-danger:hover { background: #fef2f2; border-color: #b91c1c; }
.pose-lib-btn.is-danger-solid { background: #b91c1c; border-color: #b91c1c; color: white; }
.pose-lib-btn:disabled { opacity: 0.6; cursor: wait; }
.pose-lib-btn.hidden { display: none; }
.pose-lib-zipwrap { display: flex; flex-direction: column; align-items: flex-end; gap: 0.3rem; max-width: 260px; }
.pose-lib-ziphint { font-size: 0.7rem; color: var(--warm-gray); text-align: right; }
@media (max-width: 640px) {
    .pose-lib-zipwrap { align-items: flex-start; max-width: none; }
    .pose-lib-ziphint { text-align: left; }
}

/* Generation details modal */
.details-overlay { z-index: 120; }
.details-panel {
    position: relative;
    background: var(--cream);
    color: var(--charcoal);
    width: min(640px, 100%);
    max-height: 85vh;
    overflow-y: auto;
    padding: 1.5rem;
    border-radius: 4px;
}
.details-close {
    position: absolute;
    top: 0.5rem;
    right: 0.75rem;
    font-size: 1.5rem;
    line-height: 1;
    color: var(--charcoal);
}
.details-grid {
    display: grid;
    grid-template-columns: max-content 1fr;
    gap: 0.35rem 1rem;
    margin: 0.75rem 0;
    font-size: 0.85rem;
}
.details-grid dt { color: #8a8077; }
.details-grid dd { margin: 0; word-break: break-word; }
.details-label { font-size: 0.85rem; margin-top: 0.5rem; }
.details-warn { color: #b45309; font-weight: 600; }
.details-events { font-size: 0.8rem; margin: 0.25rem 0 0.75rem 1rem; list-style: disc; }
.details-note { font-size: 0.8rem; color: #8a8077; }
.details-prompt summary { cursor: pointer; font-size: 0.85rem; margin-top: 0.5rem; }
.details-prompt pre {
    white-space: pre-wrap;
    font-size: 0.75rem;
    background: #fff;
    padding: 0.75rem;
    margin-top: 0.5rem;
    max-height: 18rem;
    overflow-y: auto;
}

/* Gallery author and infinite-scroll sentinel */
.gallery-author {
    display: block;
    font-size: 0.7rem;
    opacity: 0.7;
}
.gallery-sentinel { height: 1px; }

/* Per-pose prompt note (Impostazioni → Pose) */
.pose-lib-note { margin-top: 0.5rem; }
.pose-lib-note-label { display: block; font-size: 0.7rem; color: #8a8077; }
.pose-lib-note-input { width: 100%; font-size: 0.75rem; margin-top: 0.25rem; }
.pose-lib-note-state { font-size: 0.7rem; color: #8a8077; min-height: 1em; }

/* CONFRONTA MODELLI with the real packshot as the first column */
.compare-ab-with-packshot { grid-template-columns: repeat(3, 1fr); }
@media (max-width: 640px) {
    .compare-ab-with-packshot { grid-template-columns: 1fr 1fr; }
}

/* === Brand library and brand picker === */
.brand-input {
    padding: 0.45rem 0.6rem;
    border: 1px solid rgba(0,0,0,0.12);
    border-radius: 6px;
    font-size: 0.85rem;
    background: white;
    color: var(--charcoal);
    min-width: 0;
}
.brand-input:focus { outline: none; border-color: var(--gold); box-shadow: 0 0 0 3px rgba(184,134,11,0.15); }
.brand-create { display: flex; flex-wrap: wrap; gap: 0.5rem; margin-top: 1rem; }
.brand-create .brand-input { flex: 1 1 12rem; }
.brand-list { display: grid; gap: 0.9rem; margin-top: 1.25rem; }
.brand-card { border: 1px solid rgba(0,0,0,0.08); border-radius: 10px; padding: 0.9rem; background: white; }
.brand-card-head { display: flex; flex-wrap: wrap; gap: 0.5rem; align-items: center; }
.brand-name-input { flex: 0 1 14rem; font-weight: 600; }
.brand-alias-input { flex: 1 1 16rem; }
.brand-logos { display: flex; flex-wrap: wrap; gap: 0.6rem; margin-top: 0.75rem; align-items: stretch; }
.brand-logo-tile {
    display: flex; flex-direction: column; gap: 0.35rem; align-items: center;
    width: 8.5rem; padding: 0.5rem; border-radius: 8px;
    /* checkerboard so white and transparent logos stay visible */
    background: repeating-conic-gradient(#eee 0% 25%, #fafafa 0% 50%) 0 0 / 14px 14px;
}
.brand-logo-tile img { width: 100%; height: 5rem; object-fit: contain; }
.brand-logo-add {
    display: flex; align-items: center; justify-content: center;
    width: 8.5rem; min-height: 6.5rem; border: 1px dashed rgba(0,0,0,0.25); border-radius: 8px;
    font-size: 0.8rem; color: var(--warm-gray); cursor: pointer;
}
.brand-logo-add:hover { border-color: var(--gold); color: var(--charcoal); }
.brand-field select { width: 12rem; }
.brand-hint { font-size: 0.75rem; color: #b45309; margin-top: 0.4rem; }
.brand-confirm-btn { font-weight: 600; text-decoration: underline; color: var(--charcoal); }
.batch-dialfix-btn.is-busy { animation: dialfix-pulse 1s ease-in-out infinite; }
@keyframes dialfix-pulse { 50% { opacity: 0.35; } }
.lightbox-actions { display: flex; flex-wrap: wrap; gap: 0.5rem; justify-content: center; }
